aboutsummaryrefslogtreecommitdiffstats
path: root/eth/tracers/tracer_test.go
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2018-10-23 22:28:18 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-10-23 22:28:18 +0800
commit4c0883e20d78b987dc95acd46498f326626aaee3 (patch)
tree056c6ae87ae9e4746affe66058396162910021fa /eth/tracers/tracer_test.go
parent3088c122d8497acf176f03a3f19f6292e817cab7 (diff)
downloaddexon-4c0883e20d78b987dc95acd46498f326626aaee3.tar
dexon-4c0883e20d78b987dc95acd46498f326626aaee3.tar.gz
dexon-4c0883e20d78b987dc95acd46498f326626aaee3.tar.bz2
dexon-4c0883e20d78b987dc95acd46498f326626aaee3.tar.lz
dexon-4c0883e20d78b987dc95acd46498f326626aaee3.tar.xz
dexon-4c0883e20d78b987dc95acd46498f326626aaee3.tar.zst
dexon-4c0883e20d78b987dc95acd46498f326626aaee3.zip
core/vm: adds refund as part of the json standard trace (#17910)
This adds the global accumulated refund counter to the standard json output as a numeric json value. Previously this was not very interesting since it was not used much, but with the new sstore gas changes the value is a lot more interesting from a consensus investigation perspective.
Diffstat (limited to 'eth/tracers/tracer_test.go')
-rw-r--r--eth/tracers/tracer_test.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/eth/tracers/tracer_test.go b/eth/tracers/tracer_test.go
index 58b624724..52f29c83f 100644
--- a/eth/tracers/tracer_test.go
+++ b/eth/tracers/tracer_test.go
@@ -25,6 +25,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
)
@@ -43,8 +44,14 @@ func (account) ReturnGas(*big.Int) {}
func (account) SetCode(common.Hash, []byte) {}
func (account) ForEachStorage(cb func(key, value common.Hash) bool) {}
+type dummyStatedb struct {
+ state.StateDB
+}
+
+func (dummyStatedb) GetRefund() uint64 { return 1337 }
+
func runTrace(tracer *Tracer) (json.RawMessage, error) {
- env := vm.NewEVM(vm.Context{BlockNumber: big.NewInt(1)}, nil, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
+ env := vm.NewEVM(vm.Context{BlockNumber: big.NewInt(1)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
contract := vm.NewContract(account{}, account{}, big.NewInt(0), 10000)
contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x1, 0x0}
@@ -126,7 +133,7 @@ func TestHaltBetweenSteps(t *testing.T) {
t.Fatal(err)
}
- env := vm.NewEVM(vm.Context{BlockNumber: big.NewInt(1)}, nil, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
+ env := vm.NewEVM(vm.Context{BlockNumber: big.NewInt(1)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
contract := vm.NewContract(&account{}, &account{}, big.NewInt(0), 0)
tracer.CaptureState(env, 0, 0, 0, 0, nil, nil, contract, 0, nil)