|
|
@ -68,7 +68,7 @@ func TestNewUnpacker(t *testing.T) { |
|
|
|
[10]byte{49, 50, 51, 52, 53, 54, 55, 56, 57, 48}, |
|
|
|
[10]byte{49, 50, 51, 52, 53, 54, 55, 56, 57, 48}, |
|
|
|
common.Hex2Bytes("48656c6c6f2c20776f726c6421"), |
|
|
|
common.Hex2Bytes("48656c6c6f2c20776f726c6421"), |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, { // https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#examples
|
|
|
|
}, { // https://docs.soliditylang.org/en/develop/abi-spec.html#examples
|
|
|
|
`[{"type":"function","name":"sam","inputs":[{"type":"bytes"},{"type":"bool"},{"type":"uint256[]"}]}]`, |
|
|
|
`[{"type":"function","name":"sam","inputs":[{"type":"bytes"},{"type":"bool"},{"type":"uint256[]"}]}]`, |
|
|
|
// "dave", true and [1,2,3]
|
|
|
|
// "dave", true and [1,2,3]
|
|
|
|
"a5643bf20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000464617665000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003", |
|
|
|
"a5643bf20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000464617665000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003", |
|
|
@ -124,7 +124,7 @@ func TestCalldataDecoding(t *testing.T) { |
|
|
|
"42958b5400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000042", |
|
|
|
"42958b5400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000042", |
|
|
|
// Too short compareAndApprove
|
|
|
|
// Too short compareAndApprove
|
|
|
|
"a52c101e00ff0000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000042", |
|
|
|
"a52c101e00ff0000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000042", |
|
|
|
// From https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
|
|
|
|
// From https://docs.soliditylang.org/en/develop/abi-spec.html
|
|
|
|
// contains a bool with illegal values
|
|
|
|
// contains a bool with illegal values
|
|
|
|
"a5643bf20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000464617665000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003", |
|
|
|
"a5643bf20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000464617665000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003", |
|
|
|
} { |
|
|
|
} { |
|
|
@ -135,7 +135,7 @@ func TestCalldataDecoding(t *testing.T) { |
|
|
|
} |
|
|
|
} |
|
|
|
// Expected success
|
|
|
|
// Expected success
|
|
|
|
for i, hexdata := range []string{ |
|
|
|
for i, hexdata := range []string{ |
|
|
|
// From https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
|
|
|
|
// From https://docs.soliditylang.org/en/develop/abi-spec.html
|
|
|
|
"a5643bf20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000464617665000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003", |
|
|
|
"a5643bf20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000464617665000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003", |
|
|
|
"a52c101e0000000000000000000000000000000000000000000000000000000000000012", |
|
|
|
"a52c101e0000000000000000000000000000000000000000000000000000000000000012", |
|
|
|
"a52c101eFFffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", |
|
|
|
"a52c101eFFffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", |
|
|
|