From a59a93f476434f2805c8fd3e10bf1b2f579b078f Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 22 Sep 2016 21:04:58 +0200 Subject: core/state: track all accounts in canon state This change introduces a global, per-state cache that keeps account data in the canon state. Thanks to @karalabe for lots of fixes. --- tests/vm_test_util.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tests/vm_test_util.go') diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go index 37f0af33c..4ad72d91c 100644 --- a/tests/vm_test_util.go +++ b/tests/vm_test_util.go @@ -103,7 +103,7 @@ func benchVmTest(test VmTest, env map[string]string, b *testing.B) { db, _ := ethdb.NewMemDatabase() statedb, _ := state.New(common.Hash{}, db) for addr, account := range test.Pre { - obj := StateObjectFromAccount(db, addr, account) + obj := StateObjectFromAccount(db, addr, account, statedb.MarkStateObjectDirty) statedb.SetStateObject(obj) for a, v := range account.Storage { obj.SetState(common.HexToHash(a), common.HexToHash(v)) @@ -154,7 +154,7 @@ func runVmTest(test VmTest) error { db, _ := ethdb.NewMemDatabase() statedb, _ := state.New(common.Hash{}, db) for addr, account := range test.Pre { - obj := StateObjectFromAccount(db, addr, account) + obj := StateObjectFromAccount(db, addr, account, statedb.MarkStateObjectDirty) statedb.SetStateObject(obj) for a, v := range account.Storage { obj.SetState(common.HexToHash(a), common.HexToHash(v)) @@ -205,11 +205,9 @@ func runVmTest(test VmTest) error { if obj == nil { continue } - for addr, value := range account.Storage { - v := obj.GetState(common.HexToHash(addr)) + v := statedb.GetState(obj.Address(), common.HexToHash(addr)) vexp := common.HexToHash(value) - if v != vexp { return fmt.Errorf("(%x: %s) storage failed. Expected %x, got %x (%v %v)\n", obj.Address().Bytes()[0:4], addr, vexp, v, vexp.Big(), v.Big()) } -- cgit