aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/pack_test.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2019-08-02 15:20:46 +0800
committerMartin Holst Swende <martin@swende.se>2019-08-02 15:20:46 +0800
commit947f5f2b152e18dfab2bec72c99ef76e1d851764 (patch)
tree7656fcf2546bf6955003472af4dc9c60949ae7ff /accounts/abi/pack_test.go
parente46a01d56c190badd6b71a4fba6c886fcee1059b (diff)
downloadgo-tangerine-947f5f2b152e18dfab2bec72c99ef76e1d851764.tar
go-tangerine-947f5f2b152e18dfab2bec72c99ef76e1d851764.tar.gz
go-tangerine-947f5f2b152e18dfab2bec72c99ef76e1d851764.tar.bz2
go-tangerine-947f5f2b152e18dfab2bec72c99ef76e1d851764.tar.lz
go-tangerine-947f5f2b152e18dfab2bec72c99ef76e1d851764.tar.xz
go-tangerine-947f5f2b152e18dfab2bec72c99ef76e1d851764.tar.zst
go-tangerine-947f5f2b152e18dfab2bec72c99ef76e1d851764.zip
accounts/abi, signer/fourbyte: fix incorrect signature (#19881)
The abi package already supports function overload by adding a suffix to the overloaded function name, but it uses the function name with suffix to calculate signature(both for the event and method). This PR fixes it by adding a new field named RawName, which can be used to calcuate all signatures but use Name to distinguish different overloaded function.
Diffstat (limited to 'accounts/abi/pack_test.go')
-rw-r--r--accounts/abi/pack_test.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/accounts/abi/pack_test.go b/accounts/abi/pack_test.go
index 10cd3a396..f43e39056 100644
--- a/accounts/abi/pack_test.go
+++ b/accounts/abi/pack_test.go
@@ -634,7 +634,7 @@ func TestMethodPack(t *testing.T) {
t.Fatal(err)
}
- sig := abi.Methods["slice"].Id()
+ sig := abi.Methods["slice"].ID()
sig = append(sig, common.LeftPadBytes([]byte{1}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{2}, 32)...)
@@ -648,7 +648,7 @@ func TestMethodPack(t *testing.T) {
}
var addrA, addrB = common.Address{1}, common.Address{2}
- sig = abi.Methods["sliceAddress"].Id()
+ sig = abi.Methods["sliceAddress"].ID()
sig = append(sig, common.LeftPadBytes([]byte{32}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{2}, 32)...)
sig = append(sig, common.LeftPadBytes(addrA[:], 32)...)
@@ -663,7 +663,7 @@ func TestMethodPack(t *testing.T) {
}
var addrC, addrD = common.Address{3}, common.Address{4}
- sig = abi.Methods["sliceMultiAddress"].Id()
+ sig = abi.Methods["sliceMultiAddress"].ID()
sig = append(sig, common.LeftPadBytes([]byte{64}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{160}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{2}, 32)...)
@@ -681,7 +681,7 @@ func TestMethodPack(t *testing.T) {
t.Errorf("expected %x got %x", sig, packed)
}
- sig = abi.Methods["slice256"].Id()
+ sig = abi.Methods["slice256"].ID()
sig = append(sig, common.LeftPadBytes([]byte{1}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{2}, 32)...)
@@ -695,7 +695,7 @@ func TestMethodPack(t *testing.T) {
}
a := [2][2]*big.Int{{big.NewInt(1), big.NewInt(1)}, {big.NewInt(2), big.NewInt(0)}}
- sig = abi.Methods["nestedArray"].Id()
+ sig = abi.Methods["nestedArray"].ID()
sig = append(sig, common.LeftPadBytes([]byte{1}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{1}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{2}, 32)...)
@@ -712,7 +712,7 @@ func TestMethodPack(t *testing.T) {
t.Errorf("expected %x got %x", sig, packed)
}
- sig = abi.Methods["nestedArray2"].Id()
+ sig = abi.Methods["nestedArray2"].ID()
sig = append(sig, common.LeftPadBytes([]byte{0x20}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{0x40}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{0x80}, 32)...)
@@ -728,7 +728,7 @@ func TestMethodPack(t *testing.T) {
t.Errorf("expected %x got %x", sig, packed)
}
- sig = abi.Methods["nestedSlice"].Id()
+ sig = abi.Methods["nestedSlice"].ID()
sig = append(sig, common.LeftPadBytes([]byte{0x20}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{0x02}, 32)...)
sig = append(sig, common.LeftPadBytes([]byte{0x40}, 32)...)