@@ -42,7 +42,7 @@ func TestPack(t *testing.T) {
4242 {
4343 "uint8[]" ,
4444 []uint8 {1 , 2 },
45- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
45+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
4646 },
4747 {
4848 "uint16" ,
@@ -52,7 +52,7 @@ func TestPack(t *testing.T) {
5252 {
5353 "uint16[]" ,
5454 []uint16 {1 , 2 },
55- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
55+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
5656 },
5757 {
5858 "uint32" ,
@@ -62,7 +62,7 @@ func TestPack(t *testing.T) {
6262 {
6363 "uint32[]" ,
6464 []uint32 {1 , 2 },
65- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
65+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
6666 },
6767 {
6868 "uint64" ,
@@ -72,7 +72,7 @@ func TestPack(t *testing.T) {
7272 {
7373 "uint64[]" ,
7474 []uint64 {1 , 2 },
75- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
75+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
7676 },
7777 {
7878 "uint256" ,
@@ -82,7 +82,7 @@ func TestPack(t *testing.T) {
8282 {
8383 "uint256[]" ,
8484 []* big.Int {big .NewInt (1 ), big .NewInt (2 )},
85- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
85+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
8686 },
8787 {
8888 "int8" ,
@@ -92,7 +92,7 @@ func TestPack(t *testing.T) {
9292 {
9393 "int8[]" ,
9494 []int8 {1 , 2 },
95- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
95+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
9696 },
9797 {
9898 "int16" ,
@@ -102,7 +102,7 @@ func TestPack(t *testing.T) {
102102 {
103103 "int16[]" ,
104104 []int16 {1 , 2 },
105- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
105+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
106106 },
107107 {
108108 "int32" ,
@@ -112,7 +112,7 @@ func TestPack(t *testing.T) {
112112 {
113113 "int32[]" ,
114114 []int32 {1 , 2 },
115- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
115+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
116116 },
117117 {
118118 "int64" ,
@@ -122,7 +122,7 @@ func TestPack(t *testing.T) {
122122 {
123123 "int64[]" ,
124124 []int64 {1 , 2 },
125- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
125+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
126126 },
127127 {
128128 "int256" ,
@@ -132,7 +132,7 @@ func TestPack(t *testing.T) {
132132 {
133133 "int256[]" ,
134134 []* big.Int {big .NewInt (1 ), big .NewInt (2 )},
135- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
135+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002 " ),
136136 },
137137 {
138138 "bytes1" ,
@@ -308,18 +308,12 @@ func TestPack(t *testing.T) {
308308 //web3.eth.abi.encodeParameter('address[]', ['0x0100000000000000000000000000000000000000','0x0200000000000000000000000000000000000000']);
309309 "address[]" ,
310310 []common.Address {{1 }, {2 }},
311- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020" +
312- "0000000000000000000000000000000000000000000000000000000000000002" +
313- "0000000000000000000000000100000000000000000000000000000000000000" +
314- "0000000000000000000000000200000000000000000000000000000000000000" ),
311+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000200000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000" ),
315312 },
316313 {
317314 "bytes32[]" ,
318315 []common.Hash {{1 }, {2 }},
319- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020" + //offset: 32
320- "0000000000000000000000000000000000000000000000000000000000000002" + //len: 2
321- "0100000000000000000000000000000000000000000000000000000000000000" + // 1
322- "0200000000000000000000000000000000000000000000000000000000000000" ), // 2
316+ common .Hex2Bytes ("000000000000000000000000000000000000000000000000000000000000000201000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000" ),
323317 },
324318 {
325319 "function" ,
@@ -329,15 +323,12 @@ func TestPack(t *testing.T) {
329323 {
330324 "string" ,
331325 "foobar" ,
332- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020" + // offset: 32
333- "0000000000000000000000000000000000000000000000000000000000000006" + // len: 6
334- "666f6f6261720000000000000000000000000000000000000000000000000000" ), // "foobar"
326+ common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000006666f6f6261720000000000000000000000000000000000000000000000000000" ),
335327 },
336328 {
337329 "string[]" ,
338330 []string {"hello" , "foobar" },
339- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020" + // offset array 32
340- "0000000000000000000000000000000000000000000000000000000000000002" + // len(array) = 2
331+ common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000002" + // len(array) = 2
341332 "0000000000000000000000000000000000000000000000000000000000000040" + // offset 64 to i=0
342333 "0000000000000000000000000000000000000000000000000000000000000080" + // offset 128 to i=1
343334 "0000000000000000000000000000000000000000000000000000000000000005" + // len(str[0]) = 5
@@ -352,8 +343,7 @@ func TestPack(t *testing.T) {
352343 // '0x0400000000000000000000000000000000000000000000000000000000000000','0x0500000000000000000000000000000000000000000000000000000000000000']]);
353344 "bytes32[][]" ,
354345 [][]common.Hash {{{1 }, {2 }}, {{3 }, {4 }, {5 }}},
355- common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000020" + // offset array 32
356- "0000000000000000000000000000000000000000000000000000000000000002" + // len(array) = 2
346+ common .Hex2Bytes ("0000000000000000000000000000000000000000000000000000000000000002" + // len(array) = 2
357347 "0000000000000000000000000000000000000000000000000000000000000040" + // offset 64 to i=0
358348 "00000000000000000000000000000000000000000000000000000000000000a0" + // offset 160 to i=1
359349 "0000000000000000000000000000000000000000000000000000000000000002" + // len(array[0]) = 2
0 commit comments