-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(encoding): remove weird type overhead thing #1691
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,31 +21,18 @@ | |
package hex | ||
|
||
import ( | ||
"encoding/json" | ||
"errors" | ||
"reflect" | ||
) | ||
|
||
var ( | ||
ErrEmptyString = errors.New("empty hex string") | ||
ErrMissingPrefix = errors.New("hex string without 0x prefix") | ||
ErrOddLength = errors.New("hex string of odd length") | ||
ErrNonQuotedString = errors.New("non-quoted hex string") | ||
ErrInvalidString = errors.New("invalid hex string") | ||
|
||
ErrLeadingZero = errors.New("hex number with leading zero digits") | ||
ErrEmptyNumber = errors.New("hex string \"0x\"") | ||
ErrUint64Range = errors.New("hex number > 64 bits") | ||
ErrBig256Range = errors.New("hex number > 256 bits") | ||
|
||
ErrEmptyString = errors.New("empty hex string") | ||
ErrMissingPrefix = errors.New("hex string without 0x prefix") | ||
ErrOddLength = errors.New("hex string of odd length") | ||
ErrNonQuotedString = errors.New("non-quoted hex string") | ||
ErrInvalidString = errors.New("invalid hex string") | ||
ErrLeadingZero = errors.New("hex number with leading zero digits") | ||
ErrEmptyNumber = errors.New("hex string \"0x\"") | ||
ErrUint64Range = errors.New("hex number > 64 bits") | ||
ErrBig256Range = errors.New("hex number > 256 bits") | ||
Comment on lines
+28
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification Action Required: Remove or Replace The function
Analysis chainLGTM! Verify the removal of The code changes are approved. However, ensure that the removal of Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the removal of `WrapUnmarshalError` and its usage in the codebase.
# Test: Search for the function usage. Expect: No occurrences of `WrapUnmarshalError`.
rg --type go --pattern $'WrapUnmarshalError'
Length of output: 455 Script: #!/bin/bash
# Description: Verify the removal of `WrapUnmarshalError` and its usage in the codebase.
# Test: Search for the function usage. Expect: No occurrences of `WrapUnmarshalError`.
rg 'WrapUnmarshalError' --type go
Length of output: 96 Script: #!/bin/bash
# Description: Verify the definition of `WrapUnmarshalError` in the codebase.
# Test: Search for the function definition. Expect: No occurrences of `WrapUnmarshalError`.
rg 'func WrapUnmarshalError' --type go
Length of output: 40 |
||
ErrInvalidBigWordSize = errors.New("weird big.Word size") | ||
) | ||
|
||
// WrapUnmarshalError wraps an error occurring during JSON unmarshaling. | ||
func WrapUnmarshalError(err error, t reflect.Type) error { | ||
if err != nil { | ||
err = &json.UnmarshalTypeError{Value: err.Error(), Type: t} | ||
} | ||
|
||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Update required: Test function
TestDecodeFixedJSON
uses outdated signatureThe test function
TestDecodeFixedJSON
inmod/primitives/pkg/encoding/hex/bytes_test.go
still uses the old signature ofDecodeFixedJSON
with thetypename
parameter. Please update the test to match the new function signature.mod/primitives/pkg/encoding/hex/bytes_test.go
Please remove the
typename
field and update the test cases accordingly.Analysis chain
LGTM! But verify the function usage in the codebase.
The code changes are approved.
However, ensure that all function calls to
DecodeFixedJSON
match the new signature.Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 474
Script:
Length of output: 1533