diff --git a/common/compiler/solidity.go b/common/compiler/solidity.go index 9de94017c2..ea21e1ac49 100644 --- a/common/compiler/solidity.go +++ b/common/compiler/solidity.go @@ -33,7 +33,7 @@ type solcOutput struct { Version string } -// solidity v.0.8 changes the way ABI, Devdoc and Userdoc are serialized +// solcOutputV8 outputs combined format under solidity v.0.8 type solcOutputV8 struct { Contracts map[string]struct { BinRuntime string `json:"bin-runtime"` diff --git a/common/hexutil/hexutil.go b/common/hexutil/hexutil.go index d3201850a8..ac93f09e32 100644 --- a/common/hexutil/hexutil.go +++ b/common/hexutil/hexutil.go @@ -186,10 +186,12 @@ func EncodeBig(bigint *big.Int) string { } } +// has0xPrefix checks if a string has the "0x" prefix. func has0xPrefix(input string) bool { return len(input) >= 2 && input[0] == '0' && (input[1] == 'x' || input[1] == 'X') } +// checkNumber validates a hex string and removes the "0x" prefix. func checkNumber(input string) (raw string, err error) { if len(input) == 0 { return "", ErrEmptyString @@ -209,6 +211,7 @@ func checkNumber(input string) (raw string, err error) { const badNibble = ^uint64(0) +// decodeNibble converts a hex digit into its numeric value. func decodeNibble(in byte) uint64 { switch { case in >= '0' && in <= '9': @@ -222,6 +225,7 @@ func decodeNibble(in byte) uint64 { } } +// mapError converts decoding errors from the standard library to package-specific errors. func mapError(err error) error { if err, ok := err.(*strconv.NumError); ok { switch err.Err {