From 5cd86443ee071b5e3abe4995c777ce467c29f2c5 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Mon, 31 Oct 2016 11:32:05 +0100 Subject: tests: added new EIP158 tests --- tests/state_test_util.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/state_test_util.go') diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 6427537b4..c8899392a 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -110,7 +110,7 @@ func runStateTests(chainConfig *params.ChainConfig, tests map[string]VmTest, ski } for name, test := range tests { - if skipTest[name] /*|| name != "callcodecallcode_11" */ { + if skipTest[name] /*|| name != "NonZeroValue_CALL_ToEmpty"*/ { glog.Infoln("Skipping state test", name) continue } @@ -221,7 +221,6 @@ func RunState(chainConfig *params.ChainConfig, statedb *state.StateDB, env, tx m } // Set pre compiled contracts vm.Precompiled = vm.PrecompiledContracts() - snapshot := statedb.Snapshot() gaspool := new(core.GasPool).AddGas(common.Big(env["currentGasLimit"])) key, _ := hex.DecodeString(tx["secretKey"]) @@ -229,6 +228,12 @@ func RunState(chainConfig *params.ChainConfig, statedb *state.StateDB, env, tx m message := NewMessage(addr, to, data, value, gas, price, nonce) vmenv := NewEnvFromMap(chainConfig, statedb, env, tx) vmenv.origin = addr + + root, _ := statedb.Commit(false) + statedb.Reset(root) + + snapshot := statedb.Snapshot() + ret, _, err := core.ApplyMessage(vmenv, message, gaspool) if core.IsNonceErr(err) || core.IsInvalidTxErr(err) || core.IsGasLimitErr(err) { statedb.RevertToSnapshot(snapshot) -- cgit v1.2.3