common/hexutil: reject big integer inputs > 256 bits
This follows the change to common/math big integer parsing in PR #3699.
This commit is contained in:
@ -130,6 +130,10 @@ var unmarshalBigTests = []unmarshalTest{
|
||||
{input: `"0x01"`, wantErr: ErrLeadingZero},
|
||||
{input: `"0xx"`, wantErr: ErrSyntax},
|
||||
{input: `"0x1zz01"`, wantErr: ErrSyntax},
|
||||
{
|
||||
input: `"0x10000000000000000000000000000000000000000000000000000000000000000"`,
|
||||
wantErr: ErrBig256Range,
|
||||
},
|
||||
|
||||
// valid encoding
|
||||
{input: `""`, want: big.NewInt(0)},
|
||||
@ -148,6 +152,10 @@ var unmarshalBigTests = []unmarshalTest{
|
||||
input: `"0xffffffffffffffffffffffffffffffffffff"`,
|
||||
want: referenceBig("ffffffffffffffffffffffffffffffffffff"),
|
||||
},
|
||||
{
|
||||
input: `"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"`,
|
||||
want: referenceBig("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
|
||||
},
|
||||
}
|
||||
|
||||
func TestUnmarshalBig(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user