aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/logger_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 /core/vm/logger_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 'core/vm/logger_test.go')
-rw-r--r--core/vm/logger_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/vm/logger_test.go b/core/vm/logger_test.go
index cdbb70dc4..cba7c7a0e 100644
--- a/core/vm/logger_test.go
+++ b/core/vm/logger_test.go
@@ -21,6 +21,7 @@ import (
"testing"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/params"
)
@@ -41,9 +42,15 @@ func (d *dummyContractRef) SetBalance(*big.Int) {}
func (d *dummyContractRef) SetNonce(uint64) {}
func (d *dummyContractRef) Balance() *big.Int { return new(big.Int) }
+type dummyStatedb struct {
+ state.StateDB
+}
+
+func (dummyStatedb) GetRefund() uint64 { return 1337 }
+
func TestStoreCapture(t *testing.T) {
var (
- env = NewEVM(Context{}, nil, params.TestChainConfig, Config{})
+ env = NewEVM(Context{}, &dummyStatedb{}, params.TestChainConfig, Config{})
logger = NewStructLogger(nil)
mem = NewMemory()
stack = newstack()
@@ -51,9 +58,7 @@ func TestStoreCapture(t *testing.T) {
)
stack.push(big.NewInt(1))
stack.push(big.NewInt(0))
-
var index common.Hash
-
logger.CaptureState(env, 0, SSTORE, 0, 0, mem, stack, contract, 0, nil)
if len(logger.changedValues[contract.Address()]) == 0 {
t.Fatalf("expected exactly 1 changed value on address %x, got %d", contract.Address(), len(logger.changedValues[contract.Address()]))