Skip to content

Commit 5f3613e

Browse files
fix(eth): add index to callTracer log ethereum#33629 (#2044)
closes ethereum#33566 Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
1 parent f11cf2c commit 5f3613e

8 files changed

Lines changed: 132 additions & 37 deletions

File tree

eth/tracers/internal/tracetest/calltrace_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type callLog struct {
4545
Address common.Address `json:"address"`
4646
Topics []common.Hash `json:"topics"`
4747
Data hexutil.Bytes `json:"data"`
48+
Index hexutil.Uint `json:"index"`
4849
Position hexutil.Uint `json:"position"`
4950
}
5051

@@ -314,7 +315,7 @@ func TestInternals(t *testing.T) {
314315
byte(vm.LOG0),
315316
},
316317
tracer: mkTracer("callTracer", json.RawMessage(`{ "withLog": true }`)),
317-
want: fmt.Sprintf(`{"from":"%s","gas":"0x13880","gasUsed":"0x5b9e","to":"0x00000000000000000000000000000000deadbeef","input":"0x","logs":[{"address":"0x00000000000000000000000000000000deadbeef","topics":[],"data":"0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","position":"0x0"}],"value":"0x0","type":"CALL"}`, originHex),
318+
want: fmt.Sprintf(`{"from":"%s","gas":"0x13880","gasUsed":"0x5b9e","to":"0x00000000000000000000000000000000deadbeef","input":"0x","logs":[{"address":"0x00000000000000000000000000000000deadbeef","topics":[],"data":"0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","index":"0x0","position":"0x0"}],"value":"0x0","type":"CALL"}`, originHex),
318319
},
319320
{
320321
// Leads to OOM on the prestate tracer

eth/tracers/internal/tracetest/testdata/call_tracer_withLog/calldata.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,17 @@
9696
"0xe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda"
9797
],
9898
"data": "0x0000000000000000000000004f5777744b500616697cb655dcb02ee6cd51deb5be96016bb57376da7a6d296e0a405ee1501778227dfa604df0a81cb1ae018598",
99-
"position": "0x0"
99+
"position": "0x0",
100+
"index": "0x0"
100101
},
101102
{
102103
"address": "0x200edd17f30485a8735878661960cd7a9a95733f",
103104
"topics": [
104105
"0xacbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da"
105106
],
106107
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
107-
"position": "0x0"
108+
"position": "0x0",
109+
"index": "0x1"
108110
}
109111
],
110112
"value": "0x8ac7230489e80000",
@@ -114,4 +116,4 @@
114116
"value": "0x8ac7230489e80000",
115117
"type": "CALL"
116118
}
117-
}
119+
}

eth/tracers/internal/tracetest/testdata/call_tracer_withLog/delegatecall.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
"0x0000000000000000000000006ca7f214ab2ddbb9a8e1a1e2c8550e3164e9dba5"
259259
],
260260
"data": "0x00000000000000000000000000000000000000000000000080d29fa5cccfadac",
261+
"index": "0x0",
261262
"position": "0x0"
262263
}
263264
],
@@ -280,6 +281,7 @@
280281
"0x0000000000000000000000005aae5c59d642e5fd45b427df6ed478b49d55fefd"
281282
],
282283
"data": "0x00000000000000000000000000000000000000000000000080d29fa5cccfadac",
284+
"index": "0x1",
283285
"position": "0x0"
284286
}
285287
],
@@ -310,6 +312,7 @@
310312
"0x0000000000000000000000005aae5c59d642e5fd45b427df6ed478b49d55fefd"
311313
],
312314
"data": "0x00000000000000000000000000000000000000000000000080d29fa5cccfadac",
315+
"index": "0x2",
313316
"position": "0x0"
314317
}
315318
],
@@ -332,6 +335,7 @@
332335
"0x000000000000000000000000950ca4a06c78934a148b7a3ff3ea8fc366f77a06"
333336
],
334337
"data": "0x0000000000000000000000000000000000000000000000000041f50e27d56848",
338+
"index": "0x3",
335339
"position": "0x0"
336340
}
337341
],
@@ -396,6 +400,7 @@
396400
"0x0000000000000000000000003de712784baf97260455ae25fb74f574ec9c1add"
397401
],
398402
"data": "0x000000000000000000000000000000000000000000000000de0b6b3a76400000",
403+
"index": "0x4",
399404
"position": "0x0"
400405
}
401406
],
@@ -410,4 +415,4 @@
410415
"value": "0x0",
411416
"type": "CALL"
412417
}
413-
}
418+
}

eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multi_contracts.json

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@
358358
"0x0000000000000000000000004fd27b205895e698fa350f7ea57cec8a21927fcd"
359359
],
360360
"data": "0x00000000000000000000000000000000000000000001819451f999d617dafa93",
361+
"index": "0x0",
361362
"position": "0x0"
362363
}
363364
],
@@ -372,6 +373,7 @@
372373
"0x69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de2"
373374
],
374375
"data": "0x0000000000000000000000004fd27b205895e698fa350f7ea57cec8a21927fcd00000000000000000000000000000000000000000001819451f999d617dafa93",
376+
"index": "0x1",
375377
"position": "0x1"
376378
}
377379
],
@@ -494,6 +496,7 @@
494496
"0x0000000000000000000000004fd27b205895e698fa350f7ea57cec8a21927fcd"
495497
],
496498
"data": "0x00000000000000000000000000000000000000000001819451f999d617dafa76",
499+
"index": "0x2",
497500
"position": "0x0"
498501
}
499502
],
@@ -508,6 +511,7 @@
508511
"0x69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de2"
509512
],
510513
"data": "0x0000000000000000000000004fd27b205895e698fa350f7ea57cec8a21927fcd00000000000000000000000000000000000000000001819451f999d617dafa76",
514+
"index": "0x3",
511515
"position": "0x1"
512516
}
513517
],
@@ -697,6 +701,7 @@
697701
"0x0000000000000000000000006e715ab4f598eacf0016b9b35ef33e4141844ccc"
698702
],
699703
"data": "0x0000000000000000000000000000000000000000000181a7ae53ea2f0bef8ccd",
704+
"index": "0x5",
700705
"position": "0x0"
701706
}
702707
],
@@ -880,6 +885,7 @@
880885
"0x0000000000000000000000004fd27b205895e698fa350f7ea57cec8a21927fcd"
881886
],
882887
"data": "0x0000000000000000000000000000000000000000000181a7ae53ea2f0bef8ccc",
888+
"index": "0x7",
883889
"position": "0x0"
884890
}
885891
],
@@ -899,6 +905,7 @@
899905
"0x0000000000000000000000006e715ab4f598eacf0016b9b35ef33e4141844ccc"
900906
],
901907
"data": "0x0000000000000000000000000000000000000000000000022b1c8c12279fffff",
908+
"index": "0x8",
902909
"position": "0x1"
903910
}
904911
],
@@ -922,6 +929,7 @@
922929
"0x0000000000000000000000006e715ab4f598eacf0016b9b35ef33e4141844ccc"
923930
],
924931
"data": "0x0000000000000000000000000000000000000000000000022b1c8c12279fffff",
932+
"index": "0x9",
925933
"position": "0x1"
926934
}
927935
],
@@ -948,6 +956,7 @@
948956
"0x0000000000000000000000006dbfc63479ffc031f23e94dc91befa38bec2c25f"
949957
],
950958
"data": "0x0000000000000000000000000000000000000000000000000000000000000001",
959+
"index": "0xa",
951960
"position": "0x0"
952961
}
953962
],
@@ -962,6 +971,7 @@
962971
"0x07cf7e805770612a8b2ee8e0bcbba8aa908df5f85fbc4f9e2ef384cf75315038"
963972
],
964973
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
974+
"index": "0x4",
965975
"position": "0x6"
966976
},
967977
{
@@ -970,6 +980,7 @@
970980
"0x7027eecbd2a688fc1fa281702b311ed7168571514adfd17014a55d828cb43382"
971981
],
972982
"data": "0x000000000000000000000000000000000000000000000004563918244f400000",
983+
"index": "0x6",
973984
"position": "0x8"
974985
}
975986
],
@@ -1047,6 +1058,7 @@
10471058
"0x0000000000000000000000006dbfc63479ffc031f23e94dc91befa38bec2c25f"
10481059
],
10491060
"data": "0x0000000000000000000000000000000000000000000000000000000000000063",
1061+
"index": "0xb",
10501062
"position": "0x0"
10511063
}
10521064
],
@@ -1175,6 +1187,7 @@
11751187
"0x000000000000000000000000da4a4626d3e16e094de3225a751aab7128e96526"
11761188
],
11771189
"data": "0x0000000000000000000000000000000000000000000000000000000000000064",
1190+
"index": "0xe",
11781191
"position": "0x0"
11791192
}
11801193
],
@@ -1189,6 +1202,7 @@
11891202
"0x4b0bc4f25f8d0b92d2e12b686ba96cd75e4e69325e6cf7b1f3119d14eaf2cbdf"
11901203
],
11911204
"data": "0x000000000000000000000000da4a4626d3e16e094de3225a751aab7128e96526",
1205+
"index": "0xc",
11921206
"position": "0x6"
11931207
},
11941208
{
@@ -1197,6 +1211,7 @@
11971211
"0xf340c079d598119636d42046c6a2d2faf7a68c04aecee516f0e0b8a9e79b8666"
11981212
],
11991213
"data": "0x000000000000000000000000da4a4626d3e16e094de3225a751aab7128e9652600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000",
1214+
"index": "0xd",
12001215
"position": "0x9"
12011216
}
12021217
],
@@ -1247,6 +1262,7 @@
12471262
"0x0000000000000000000000007498bb5749c9801f1f7e490baf5f966dbfe4e97b"
12481263
],
12491264
"data": "0x0000000000000000000000000000000000000000000000000000000000000001",
1265+
"index": "0xf",
12501266
"position": "0x0"
12511267
}
12521268
],
@@ -1341,6 +1357,7 @@
13411357
"0x0000000000000000000000000000000000000000000000000000000000000001"
13421358
],
13431359
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
1360+
"index": "0x10",
13441361
"position": "0x2"
13451362
}
13461363
],
@@ -1435,6 +1452,7 @@
14351452
"0x0000000000000000000000000000000000000000000000000000000000000002"
14361453
],
14371454
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
1455+
"index": "0x11",
14381456
"position": "0x2"
14391457
}
14401458
],
@@ -1529,6 +1547,7 @@
15291547
"0x0000000000000000000000000000000000000000000000000000000000000003"
15301548
],
15311549
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
1550+
"index": "0x12",
15321551
"position": "0x2"
15331552
}
15341553
],
@@ -1623,6 +1642,7 @@
16231642
"0x0000000000000000000000000000000000000000000000000000000000000004"
16241643
],
16251644
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
1645+
"index": "0x13",
16261646
"position": "0x2"
16271647
}
16281648
],
@@ -1717,6 +1737,7 @@
17171737
"0x0000000000000000000000000000000000000000000000000000000000000005"
17181738
],
17191739
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
1740+
"index": "0x14",
17201741
"position": "0x2"
17211742
}
17221743
],
@@ -1811,6 +1832,7 @@
18111832
"0x0000000000000000000000000000000000000000000000000000000000000006"
18121833
],
18131834
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
1835+
"index": "0x15",
18141836
"position": "0x2"
18151837
}
18161838
],
@@ -1905,6 +1927,7 @@
19051927
"0x0000000000000000000000000000000000000000000000000000000000000007"
19061928
],
19071929
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
1930+
"index": "0x16",
19081931
"position": "0x2"
19091932
}
19101933
],
@@ -1999,6 +2022,7 @@
19992022
"0x0000000000000000000000000000000000000000000000000000000000000008"
20002023
],
20012024
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
2025+
"index": "0x17",
20022026
"position": "0x2"
20032027
}
20042028
],
@@ -2093,6 +2117,7 @@
20932117
"0x0000000000000000000000000000000000000000000000000000000000000009"
20942118
],
20952119
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
2120+
"index": "0x18",
20962121
"position": "0x2"
20972122
}
20982123
],
@@ -2187,6 +2212,7 @@
21872212
"0x000000000000000000000000000000000000000000000000000000000000000a"
21882213
],
21892214
"data": "0x000000000000000000000000be3ae5cb97c253dda67181c6e34e43f5c275e08b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
2215+
"index": "0x19",
21902216
"position": "0x2"
21912217
}
21922218
],
@@ -2240,6 +2266,7 @@
22402266
"0x0000000000000000000000007ccbc69292c7a6d7b538c91f3b283de97906cf30"
22412267
],
22422268
"data": "0x00000000000000000000000000000000000000000001010d8bfbbbe40fe7518c",
2269+
"index": "0x1a",
22432270
"position": "0x0"
22442271
}
22452272
],
@@ -2262,6 +2289,7 @@
22622289
"0x0000000000000000000000001b9ec8ba24630b75a7a958153ffff56dd6d4b6a2"
22632290
],
22642291
"data": "0x00000000000000000000000000000000000000000001010d8bfbbbe40fe7518c",
2292+
"index": "0x1c",
22652293
"position": "0x0"
22662294
}
22672295
],
@@ -2284,6 +2312,7 @@
22842312
"0x000000000000000000000000c3a2c744ad1f5253c736875b93bacce5b01b060b"
22852313
],
22862314
"data": "0x00000000000000000000000000000000000000000001010d8bfbbbe40fe7518c",
2315+
"index": "0x1e",
22872316
"position": "0x0"
22882317
}
22892318
],
@@ -2298,6 +2327,7 @@
22982327
"0xc6d8c0af6d21f291e7c359603aa97e0ed500f04db6e983b9fce75a91c6b8da6b"
22992328
],
23002329
"data": "0x00000000000000000000000000000000000000000001010d8bfbbbe40fe7518c",
2330+
"index": "0x1b",
23012331
"position": "0x2"
23022332
},
23032333
{
@@ -2306,6 +2336,7 @@
23062336
"0xc6d8c0af6d21f291e7c359603aa97e0ed500f04db6e983b9fce75a91c6b8da6b"
23072337
],
23082338
"data": "0x00000000000000000000000000000000000000000001010d8bfbbbe40fe7518c",
2339+
"index": "0x1d",
23092340
"position": "0x3"
23102341
},
23112342
{
@@ -2314,6 +2345,7 @@
23142345
"0xc6d8c0af6d21f291e7c359603aa97e0ed500f04db6e983b9fce75a91c6b8da6b"
23152346
],
23162347
"data": "0x00000000000000000000000000000000000000000001010d8bfbbbe40fe7518c",
2348+
"index": "0x1f",
23172349
"position": "0x4"
23182350
}
23192351
],
@@ -2324,4 +2356,4 @@
23242356
"value": "0x0",
23252357
"type": "CALL"
23262358
}
2327-
}
2359+
}

0 commit comments

Comments
 (0)