Skip to content

Commit a1a4023

Browse files
committed
Get native tracing tests running on master
1 parent 9e8d380 commit a1a4023

13 files changed

+40
-29
lines changed

eth/tracers/testdata/call_tracer_legacy/create.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"eip155Block": 10,
3131
"eip158Block": 10,
3232
"ethash": {},
33-
"homesteadBlock": 0
33+
"homesteadBlock": 0,
34+
"donutBlock": 0
3435
},
3536
"difficulty": "3757315409",
3637
"extraData": "0x566961425443",

eth/tracers/testdata/call_tracer_legacy/deep_calls.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"eip155Block": 10,
9494
"eip158Block": 10,
9595
"ethash": {},
96-
"homesteadBlock": 0
96+
"homesteadBlock": 0,
97+
"donutBlock": 0
9798
},
9899
"difficulty": "117124093",
99100
"extraData": "0xd5830105008650617269747986312e31322e31826d61",

eth/tracers/testdata/call_tracer_legacy/delegatecall.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"eip155Block": 10,
4747
"eip158Block": 10,
4848
"ethash": {},
49-
"homesteadBlock": 0
49+
"homesteadBlock": 0,
50+
"donutBlock": 0
5051
},
5152
"difficulty": "31912170",
5253
"extraData": "0xd783010502846765746887676f312e372e33856c696e7578",

eth/tracers/testdata/call_tracer_legacy/inner_create_oog_outer_throw.json

+7-6
Large diffs are not rendered by default.

eth/tracers/testdata/call_tracer_legacy/inner_instafail.json

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"petersburgBlock": 4939394,
3939
"istanbulBlock": 6485846,
4040
"muirGlacierBlock": 7117117,
41+
"donutBlock": 0,
4142
"ethash": {}
4243
}
4344
},

eth/tracers/testdata/call_tracer_legacy/inner_throw_outer_revert.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"eip155Block": 10,
4242
"eip158Block": 10,
4343
"ethash": {},
44-
"homesteadBlock": 0
44+
"homesteadBlock": 0,
45+
"donutBlock": 0
4546
},
4647
"difficulty": "3956606365",
4748
"extraData": "0x566961425443",

eth/tracers/testdata/call_tracer_legacy/oog.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"eip155Block": 10,
3333
"eip158Block": 10,
3434
"ethash": {},
35-
"homesteadBlock": 0
35+
"homesteadBlock": 0,
36+
"donutBlock": 0
3637
},
3738
"difficulty": "3699098917",
3839
"extraData": "0x4554482e45544846414e532e4f52472d4641313738394444",

eth/tracers/testdata/call_tracer_legacy/revert.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"eip155Block": 10,
3131
"eip158Block": 10,
3232
"ethash": {},
33-
"homesteadBlock": 0
33+
"homesteadBlock": 0,
34+
"donutBlock": 0
3435
},
3536
"difficulty": "3672229776",
3637
"extraData": "0x4554482e45544846414e532e4f52472d4641313738394444",

eth/tracers/testdata/call_tracer_legacy/revert_reason.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"eip155Block": 10,
3636
"eip158Block": 10,
3737
"ethash": {},
38-
"homesteadBlock": 0
38+
"homesteadBlock": 0,
39+
"donutBlock": 0
3940
},
4041
"difficulty": "3509749784",
4142
"extraData": "0x4554482e45544846414e532e4f52472d4641313738394444",
@@ -54,7 +55,7 @@
5455
"error": "execution reverted",
5556
"from": "0xf7579c3d8a669c89d5ed246a22eb6db8f6fedbf1",
5657
"gas": "0x2d7308",
57-
"gasUsed": "0x588",
58+
"gasUsed": "0x330",
5859
"input": "0x5c19a95c000000000000000000000000f7579c3d8a669c89d5ed246a22eb6db8f6fedbf1",
5960
"to": "0xf58833cf0c791881b494eb79d461e08a1f043f52",
6061
"type": "CALL",

eth/tracers/testdata/call_tracer_legacy/selfdestruct.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"eip155Block": 10,
3737
"eip158Block": 10,
3838
"ethash": {},
39-
"homesteadBlock": 0
39+
"homesteadBlock": 0,
40+
"donutBlock": 0
4041
},
4142
"difficulty": "3509749784",
4243
"extraData": "0x4554482e45544846414e532e4f52472d4641313738394444",

eth/tracers/testdata/call_tracer_legacy/simple.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"code": "0x606060405236156100935763ffffffff60e060020a60003504166311ee8382811461009c57806313af4035146100be5780631f5e8f4c146100ee57806324daddc5146101125780634921a91a1461013b57806363e4bff414610157578063764978f91461017f578063893d20e8146101a1578063ba40aaa1146101cd578063cebc9a82146101f4578063e177246e14610216575b61009a5b5b565b005b34156100a457fe5b6100ac61023d565b60408051918252519081900360200190f35b34156100c657fe5b6100da600160a060020a0360043516610244565b604080519115158252519081900360200190f35b34156100f657fe5b6100da610307565b604080519115158252519081900360200190f35b341561011a57fe5b6100da6004351515610318565b604080519115158252519081900360200190f35b6100da6103d6565b604080519115158252519081900360200190f35b6100da600160a060020a0360043516610420565b604080519115158252519081900360200190f35b341561018757fe5b6100ac61046c565b60408051918252519081900360200190f35b34156101a957fe5b6101b1610473565b60408051600160a060020a039092168252519081900360200190f35b34156101d557fe5b6100da600435610483565b604080519115158252519081900360200190f35b34156101fc57fe5b6100ac61050d565b60408051918252519081900360200190f35b341561021e57fe5b6100da600435610514565b604080519115158252519081900360200190f35b6003545b90565b60006000610250610473565b600160a060020a031633600160a060020a03161415156102705760006000fd5b600160a060020a03831615156102865760006000fd5b50600054600160a060020a0390811690831681146102fb57604051600160a060020a0380851691908316907ffcf23a92150d56e85e3a3d33b357493246e55783095eb6a733eb8439ffc752c890600090a360008054600160a060020a031916600160a060020a03851617905560019150610300565b600091505b5b50919050565b60005460a060020a900460ff165b90565b60006000610324610473565b600160a060020a031633600160a060020a03161415156103445760006000fd5b5060005460a060020a900460ff16801515831515146102fb576000546040805160a060020a90920460ff1615158252841515602083015280517fe6cd46a119083b86efc6884b970bfa30c1708f53ba57b86716f15b2f4551a9539281900390910190a16000805460a060020a60ff02191660a060020a8515150217905560019150610300565b600091505b5b50919050565b60006103e0610307565b801561040557506103ef610473565b600160a060020a031633600160a060020a031614155b156104105760006000fd5b610419336105a0565b90505b5b90565b600061042a610307565b801561044f5750610439610473565b600160a060020a031633600160a060020a031614155b1561045a5760006000fd5b610463826105a0565b90505b5b919050565b6001545b90565b600054600160a060020a03165b90565b6000600061048f610473565b600160a060020a031633600160a060020a03161415156104af5760006000fd5b506001548281146102fb57604080518281526020810185905281517f79a3746dde45672c9e8ab3644b8bb9c399a103da2dc94b56ba09777330a83509929181900390910190a160018381559150610300565b600091505b5b50919050565b6002545b90565b60006000610520610473565b600160a060020a031633600160a060020a03161415156105405760006000fd5b506002548281146102fb57604080518281526020810185905281517ff6991a728965fedd6e927fdf16bdad42d8995970b4b31b8a2bf88767516e2494929181900390910190a1600283905560019150610300565b600091505b5b50919050565b60006000426105ad61023d565b116102fb576105c46105bd61050d565b4201610652565b6105cc61046c565b604051909150600160a060020a038416908290600081818185876187965a03f1925050501561063d57604080518281529051600160a060020a038516917f9bca65ce52fdef8a470977b51f247a2295123a4807dfa9e502edf0d30722da3b919081900360200190a260019150610300565b6102fb42610652565b5b600091505b50919050565b60038190555b505600a165627a7a72305820f3c973c8b7ed1f62000b6701bd5b708469e19d0f1d73fde378a56c07fd0b19090029",
1818
"nonce": "1",
1919
"storage": {
20-
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000001a94f5374Fce5edBC8E2a8697C15331677e6EbF0B",
20+
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000001b436ba50d378d4bbc8660d312a13df6af6e89dfb",
2121
"0x0000000000000000000000000000000000000000000000000000000000000001": "0x00000000000000000000000000000000000000000000000006f05b59d3b20000",
2222
"0x0000000000000000000000000000000000000000000000000000000000000002": "0x000000000000000000000000000000000000000000000000000000000000003c",
2323
"0x0000000000000000000000000000000000000000000000000000000000000003": "0x000000000000000000000000000000000000000000000000000000005a37b834"
2424
}
2525
},
26-
"0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B": {
26+
"0xb436ba50d378d4bbc8660d312a13df6af6e89dfb": {
2727
"balance": "0x1780d77678137ac1b775",
2828
"code": "0x",
2929
"nonce": "29072",
@@ -38,7 +38,8 @@
3838
"eip150Hash": "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d",
3939
"eip155Block": 10,
4040
"eip158Block": 10,
41-
"homesteadBlock": 0
41+
"homesteadBlock": 0,
42+
"donutBlock": 0
4243
},
4344
"extraData": "0x4554482e45544846414e532e4f52472d4641313738394444",
4445
"hash": "0x609948ac3bd3c00b7736b933248891d6c901ee28f066241bddb28f4e00a9f440",
@@ -48,7 +49,7 @@
4849
"timestamp": "1513601261",
4950
"totalDifficulty": "7143276353481064"
5051
},
51-
"input": "0xf88c8271908506fc23ac0083015f9080943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c529a08f222b9b673001e532500a44737153e6da6a750470b1f7d9cdb6286471382a41a01b33ba817d7982ae6bc83b0340de2b503be9b0a10bcd5255d44e78cc72a7eb62",
52+
"input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4",
5253
"result": {
5354
"calls": [
5455
{
@@ -59,7 +60,7 @@
5960
"value": "0x6f05b59d3b20000"
6061
}
6162
],
62-
"from": "0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B",
63+
"from": "0xb436ba50d378d4bbc8660d312a13df6af6e89dfb",
6364
"gas": "0x10738",
6465
"gasUsed": "0x3ef9",
6566
"input": "0x63e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c5",

eth/tracers/testdata/call_tracer_legacy/throw.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"eip155Block": 10,
3535
"eip158Block": 10,
3636
"ethash": {},
37-
"homesteadBlock": 0
37+
"homesteadBlock": 0,
38+
"donutBlock": 0
3839
},
3940
"difficulty": "117066792",
4041
"extraData": "0xd783010502846765746887676f312e372e33856c696e7578",

eth/tracers/tracers_test.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"crypto/ecdsa"
2020
"crypto/rand"
2121
"encoding/json"
22+
2223
"io/ioutil"
2324
"math/big"
2425
"path/filepath"
@@ -110,7 +111,6 @@ type callContext struct {
110111
Miner common.Address `json:"miner"`
111112
}
112113

113-
// nolint:deadcode // Used in commented out test
114114
// callTracerTest defines a single test to check the call tracer against.
115115
type callTracerTest struct {
116116
Genesis *core.Genesis `json:"genesis"`
@@ -205,12 +205,12 @@ func TestPrestateTracerCreate2(t *testing.T) {
205205
// TODO(kevjue/asaj): Figure out how to get the tracer tests to work with the new txn structure
206206
// Iterates over all the input-output datasets in the tracer test harness and
207207
// runs the JavaScript tracers against them.
208-
/*
209208
func TestCallTracerLegacy(t *testing.T) {
210209
testCallTracer("callTracerLegacy", "call_tracer_legacy", t)
211210
}
212211

213212
func testCallTracer(tracer string, dirPath string, t *testing.T) {
213+
celoMock := testutil.NewCeloMock()
214214
files, err := ioutil.ReadDir(filepath.Join("testdata", dirPath))
215215
if err != nil {
216216
t.Fatalf("failed to retrieve tracer test suite: %v", err)
@@ -238,20 +238,20 @@ func testCallTracer(tracer string, dirPath string, t *testing.T) {
238238
if err := rlp.DecodeBytes(common.FromHex(test.Input), tx); err != nil {
239239
t.Fatalf("failed to parse testcase input: %v", err)
240240
}
241+
241242
signer := types.MakeSigner(test.Genesis.Config, new(big.Int).SetUint64(uint64(test.Context.Number)))
242243
origin, _ := signer.Sender(tx)
243244
txContext := vm.TxContext{
244245
Origin: origin,
245246
GasPrice: tx.GasPrice(),
246247
}
247248
context := vm.BlockContext{
248-
CanTransfer: core.CanTransfer,
249-
Transfer: vm.Transfer,
249+
CanTransfer: vmcontext.CanTransfer,
250+
Transfer: vmcontext.TobinTransfer,
250251
Coinbase: test.Context.Miner,
251252
BlockNumber: new(big.Int).SetUint64(uint64(test.Context.Number)),
253+
252254
Time: new(big.Int).SetUint64(uint64(test.Context.Time)),
253-
GasLimit: uint64(test.Context.GasLimit),
254-
GetRegisteredAddress: contracts.GetRegisteredAddress,
255255
}
256256
_, statedb := tests.MakePreState(rawdb.NewMemoryDatabase(), test.Genesis.Alloc, false)
257257

@@ -266,7 +266,7 @@ func testCallTracer(tracer string, dirPath string, t *testing.T) {
266266
if err != nil {
267267
t.Fatalf("failed to prepare transaction for tracing: %v", err)
268268
}
269-
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()), nil)
269+
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()), celoMock.Runner, nil)
270270
if _, err = st.TransitionDb(); err != nil {
271271
t.Fatalf("failed to execute transaction: %v", err)
272272
}
@@ -294,7 +294,6 @@ func testCallTracer(tracer string, dirPath string, t *testing.T) {
294294
func TestCallTracer(t *testing.T) {
295295
testCallTracer("callTracer", "call_tracer", t)
296296
}
297-
*/
298297

299298
// jsonEqual is similar to reflect.DeepEqual, but does a 'bounce' via json prior to
300299
// comparison

0 commit comments

Comments
 (0)