@@ -19,6 +19,7 @@ import (
19
19
"crypto/ecdsa"
20
20
"crypto/rand"
21
21
"encoding/json"
22
+
22
23
"io/ioutil"
23
24
"math/big"
24
25
"path/filepath"
@@ -110,7 +111,6 @@ type callContext struct {
110
111
Miner common.Address `json:"miner"`
111
112
}
112
113
113
- // nolint:deadcode // Used in commented out test
114
114
// callTracerTest defines a single test to check the call tracer against.
115
115
type callTracerTest struct {
116
116
Genesis * core.Genesis `json:"genesis"`
@@ -205,12 +205,12 @@ func TestPrestateTracerCreate2(t *testing.T) {
205
205
// TODO(kevjue/asaj): Figure out how to get the tracer tests to work with the new txn structure
206
206
// Iterates over all the input-output datasets in the tracer test harness and
207
207
// runs the JavaScript tracers against them.
208
- /*
209
208
func TestCallTracerLegacy (t * testing.T ) {
210
209
testCallTracer ("callTracerLegacy" , "call_tracer_legacy" , t )
211
210
}
212
211
213
212
func testCallTracer (tracer string , dirPath string , t * testing.T ) {
213
+ celoMock := testutil .NewCeloMock ()
214
214
files , err := ioutil .ReadDir (filepath .Join ("testdata" , dirPath ))
215
215
if err != nil {
216
216
t .Fatalf ("failed to retrieve tracer test suite: %v" , err )
@@ -238,20 +238,20 @@ func testCallTracer(tracer string, dirPath string, t *testing.T) {
238
238
if err := rlp .DecodeBytes (common .FromHex (test .Input ), tx ); err != nil {
239
239
t .Fatalf ("failed to parse testcase input: %v" , err )
240
240
}
241
+
241
242
signer := types .MakeSigner (test .Genesis .Config , new (big.Int ).SetUint64 (uint64 (test .Context .Number )))
242
243
origin , _ := signer .Sender (tx )
243
244
txContext := vm.TxContext {
244
245
Origin : origin ,
245
246
GasPrice : tx .GasPrice (),
246
247
}
247
248
context := vm.BlockContext {
248
- CanTransfer: core .CanTransfer,
249
- Transfer: vm.Transfer ,
249
+ CanTransfer : vmcontext .CanTransfer ,
250
+ Transfer : vmcontext . TobinTransfer ,
250
251
Coinbase : test .Context .Miner ,
251
252
BlockNumber : new (big.Int ).SetUint64 (uint64 (test .Context .Number )),
253
+
252
254
Time : new (big.Int ).SetUint64 (uint64 (test .Context .Time )),
253
- GasLimit: uint64(test.Context.GasLimit),
254
- GetRegisteredAddress: contracts.GetRegisteredAddress,
255
255
}
256
256
_ , statedb := tests .MakePreState (rawdb .NewMemoryDatabase (), test .Genesis .Alloc , false )
257
257
@@ -266,7 +266,7 @@ func testCallTracer(tracer string, dirPath string, t *testing.T) {
266
266
if err != nil {
267
267
t .Fatalf ("failed to prepare transaction for tracing: %v" , err )
268
268
}
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 )
270
270
if _ , err = st .TransitionDb (); err != nil {
271
271
t .Fatalf ("failed to execute transaction: %v" , err )
272
272
}
@@ -294,7 +294,6 @@ func testCallTracer(tracer string, dirPath string, t *testing.T) {
294
294
func TestCallTracer (t * testing.T ) {
295
295
testCallTracer ("callTracer" , "call_tracer" , t )
296
296
}
297
- */
298
297
299
298
// jsonEqual is similar to reflect.DeepEqual, but does a 'bounce' via json prior to
300
299
// comparison
0 commit comments