diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go index c7bc2b4541..e7a8bdfa13 100644 --- a/accounts/abi/abi.go +++ b/accounts/abi/abi.go @@ -198,9 +198,9 @@ func (abi *ABI) UnmarshalJSON(data []byte) error { return nil } -// MethodById looks up a method by the 4-byte id, +// MethodByID looks up a method by the 4-byte id, // returns nil if none found. -func (abi *ABI) MethodById(sigdata []byte) (*Method, error) { +func (abi *ABI) MethodByID(sigdata []byte) (*Method, error) { if len(sigdata) < 4 { return nil, fmt.Errorf("data too short (%d bytes) for abi method lookup", len(sigdata)) } diff --git a/accounts/abi/abi_test.go b/accounts/abi/abi_test.go index bc76df0dc2..29bea7c3d9 100644 --- a/accounts/abi/abi_test.go +++ b/accounts/abi/abi_test.go @@ -983,7 +983,7 @@ func TestABI_MethodById(t *testing.T) { } for name, m := range abi.Methods { a := fmt.Sprintf("%v", m) - m2, err := abi.MethodById(m.ID) + m2, err := abi.MethodByID(m.ID) if err != nil { t.Fatalf("Failed to look up ABI method: %v", err) } @@ -993,17 +993,17 @@ func TestABI_MethodById(t *testing.T) { } } // test unsuccessful lookups - if _, err = abi.MethodById(crypto.Keccak256()); err == nil { + if _, err = abi.MethodByID(crypto.Keccak256()); err == nil { t.Error("Expected error: no method with this id") } // Also test empty - if _, err := abi.MethodById([]byte{0x00}); err == nil { + if _, err := abi.MethodByID([]byte{0x00}); err == nil { t.Errorf("Expected error, too short to decode data") } - if _, err := abi.MethodById([]byte{}); err == nil { + if _, err := abi.MethodByID([]byte{}); err == nil { t.Errorf("Expected error, too short to decode data") } - if _, err := abi.MethodById(nil); err == nil { + if _, err := abi.MethodByID(nil); err == nil { t.Errorf("Expected error, nil is short to decode data") } } diff --git a/signer/fourbyte/abi.go b/signer/fourbyte/abi.go index 352abc59e1..680040b5ca 100644 --- a/signer/fourbyte/abi.go +++ b/signer/fourbyte/abi.go @@ -103,7 +103,7 @@ func parseCallData(calldata []byte, unescapedAbidata string) (*decodedCallData, if err != nil { return nil, fmt.Errorf("invalid method signature (%q): %v", unescapedAbidata, err) } - method, err := abispec.MethodById(sigdata) + method, err := abispec.MethodByID(sigdata) if err != nil { return nil, err } diff --git a/signer/fourbyte/abi_test.go b/signer/fourbyte/abi_test.go index 9656732dff..c4c4c7a0cc 100644 --- a/signer/fourbyte/abi_test.go +++ b/signer/fourbyte/abi_test.go @@ -33,7 +33,7 @@ func verify(t *testing.T, jsondata, calldata string, exp []interface{}) { } cd := common.Hex2Bytes(calldata) sigdata, argdata := cd[:4], cd[4:] - method, err := abispec.MethodById(sigdata) + method, err := abispec.MethodByID(sigdata) if err != nil { t.Fatal(err) } diff --git a/signer/fourbyte/fourbyte_test.go b/signer/fourbyte/fourbyte_test.go index a3dc3b5117..0ebca578da 100644 --- a/signer/fourbyte/fourbyte_test.go +++ b/signer/fourbyte/fourbyte_test.go @@ -43,7 +43,7 @@ func TestEmbeddedDatabase(t *testing.T) { t.Errorf("Failed to parse ABI: %v", err) continue } - m, err := abistruct.MethodById(common.Hex2Bytes(id)) + m, err := abistruct.MethodByID(common.Hex2Bytes(id)) if err != nil { t.Errorf("Failed to get method by id (%s): %v", id, err) continue