diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go index bee4fe40fd..f75278c8b1 100644 --- a/accounts/abi/abi.go +++ b/accounts/abi/abi.go @@ -84,7 +84,7 @@ func (abi ABI) Pack(name string, args ...interface{}) ([]byte, error) { func (abi ABI) getArguments(name string, data []byte) (Arguments, error) { // since there can't be naming collisions with contracts and events, - // we need to decide whether we're calling a method or an event + // we need to decide whether we're calling a method, event or an error var args Arguments if method, ok := abi.Methods[name]; ok { if len(data)%32 != 0 { diff --git a/accounts/abi/abi_test.go b/accounts/abi/abi_test.go index e3a614688a..db9a4c55a5 100644 --- a/accounts/abi/abi_test.go +++ b/accounts/abi/abi_test.go @@ -21,7 +21,6 @@ import ( "encoding/hex" "errors" "fmt" - "github.com/ethereum/go-ethereum/internal/testrand" "math/big" "reflect" "strings" @@ -30,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/internal/testrand" ) const jsondata = ` @@ -318,7 +318,7 @@ func TestCustomErrors(t *testing.T) { check("MyError", "MyError(uint256)") } -func TestCustomErrorUnpack(t *testing.T) { +func TestCustomErrorUnpackIntoInterface(t *testing.T) { t.Parallel() errorName := "MyError" json := fmt.Sprintf(`[{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"%s","type":"error"}]`, errorName)