|
|
|
@ -173,7 +173,7 @@ func TestEventTupleUnpack(t *testing.T) { |
|
|
|
|
type EventTransferWithTag struct { |
|
|
|
|
// this is valid because `value` is not exportable,
|
|
|
|
|
// so value is only unmarshalled into `Value1`.
|
|
|
|
|
value *big.Int |
|
|
|
|
value *big.Int //lint:ignore U1000 unused field is part of test
|
|
|
|
|
Value1 *big.Int `abi:"value"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -354,40 +354,6 @@ func unpackTestEventData(dest interface{}, hexData string, jsonEvent []byte, ass |
|
|
|
|
return a.Unpack(dest, "e", data) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
Taken from |
|
|
|
|
https://github.com/ethereum/go-ethereum/pull/15568
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
type testResult struct { |
|
|
|
|
Values [2]*big.Int |
|
|
|
|
Value1 *big.Int |
|
|
|
|
Value2 *big.Int |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type testCase struct { |
|
|
|
|
definition string |
|
|
|
|
want testResult |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (tc testCase) encoded(intType, arrayType Type) []byte { |
|
|
|
|
var b bytes.Buffer |
|
|
|
|
if tc.want.Value1 != nil { |
|
|
|
|
val, _ := intType.pack(reflect.ValueOf(tc.want.Value1)) |
|
|
|
|
b.Write(val) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(tc.want.Values, [2]*big.Int{nil, nil}) { |
|
|
|
|
val, _ := arrayType.pack(reflect.ValueOf(tc.want.Values)) |
|
|
|
|
b.Write(val) |
|
|
|
|
} |
|
|
|
|
if tc.want.Value2 != nil { |
|
|
|
|
val, _ := intType.pack(reflect.ValueOf(tc.want.Value2)) |
|
|
|
|
b.Write(val) |
|
|
|
|
} |
|
|
|
|
return b.Bytes() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TestEventUnpackIndexed verifies that indexed field will be skipped by event decoder.
|
|
|
|
|
func TestEventUnpackIndexed(t *testing.T) { |
|
|
|
|
definition := `[{"name": "test", "type": "event", "inputs": [{"indexed": true, "name":"value1", "type":"uint8"},{"indexed": false, "name":"value2", "type":"uint8"}]}]` |
|
|
|
|