diff options
author | Yohann Leon <sybiload@gmail.com> | 2017-03-22 22:32:51 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-03-22 22:32:51 +0800 |
commit | 6742fc526f3e1ae985d82a1781df4267485e2c70 (patch) | |
tree | 83da1e8ce5c2ae673358fc244b9cba8862f806be /internal | |
parent | 9b84caf3a5f55cc2a14b50291118b9fab668b8c2 (diff) | |
download | go-tangerine-6742fc526f3e1ae985d82a1781df4267485e2c70.tar.gz go-tangerine-6742fc526f3e1ae985d82a1781df4267485e2c70.tar.zst go-tangerine-6742fc526f3e1ae985d82a1781df4267485e2c70.zip |
core/vm: use uint64 instead of *big.Int in tracer (#3805)
Diffstat (limited to 'internal')
-rw-r--r-- | internal/ethapi/api.go | 4 | ||||
-rw-r--r-- | internal/ethapi/tracer.go | 6 | ||||
-rw-r--r-- | internal/ethapi/tracer_test.go | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index c8374fe18..0928c973f 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -695,8 +695,8 @@ type ExecutionResult struct { type StructLogRes struct { Pc uint64 `json:"pc"` Op string `json:"op"` - Gas *big.Int `json:"gas"` - GasCost *big.Int `json:"gasCost"` + Gas uint64 `json:"gas"` + GasCost uint64 `json:"gasCost"` Depth int `json:"depth"` Error error `json:"error"` Stack []string `json:"stack"` diff --git a/internal/ethapi/tracer.go b/internal/ethapi/tracer.go index ef107fc42..fe2685375 100644 --- a/internal/ethapi/tracer.go +++ b/internal/ethapi/tracer.go @@ -278,7 +278,7 @@ func wrapError(context string, err error) error { } // CaptureState implements the Tracer interface to trace a single step of VM execution -func (jst *JavascriptTracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost *big.Int, memory *vm.Memory, stack *vm.Stack, contract *vm.Contract, depth int, err error) error { +func (jst *JavascriptTracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, stack *vm.Stack, contract *vm.Contract, depth int, err error) error { if jst.err == nil { jst.memory.memory = memory jst.stack.stack = stack @@ -288,8 +288,8 @@ func (jst *JavascriptTracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, jst.log["pc"] = pc jst.log["op"] = ocw.toValue(jst.vm) - jst.log["gas"] = gas.Int64() - jst.log["gasPrice"] = cost.Int64() + jst.log["gas"] = gas + jst.log["gasPrice"] = cost jst.log["memory"] = jst.memvalue jst.log["stack"] = jst.stackvalue jst.log["depth"] = depth diff --git a/internal/ethapi/tracer_test.go b/internal/ethapi/tracer_test.go index 693afe802..0ef450ce3 100644 --- a/internal/ethapi/tracer_test.go +++ b/internal/ethapi/tracer_test.go @@ -136,10 +136,10 @@ func TestHaltBetweenSteps(t *testing.T) { env := vm.NewEVM(vm.Context{}, nil, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer}) contract := vm.NewContract(&account{}, &account{}, big.NewInt(0), 0) - tracer.CaptureState(env, 0, 0, big.NewInt(0), big.NewInt(0), nil, nil, contract, 0, nil) + tracer.CaptureState(env, 0, 0, 0, 0, nil, nil, contract, 0, nil) timeout := errors.New("stahp") tracer.Stop(timeout) - tracer.CaptureState(env, 0, 0, big.NewInt(0), big.NewInt(0), nil, nil, contract, 0, nil) + tracer.CaptureState(env, 0, 0, 0, 0, nil, nil, contract, 0, nil) if _, err := tracer.GetResult(); err.Error() != "stahp in server-side tracer function 'step'" { t.Errorf("Expected timeout error, got %v", err) |