aboutsummaryrefslogtreecommitdiffstats
path: root/tests/vm_test_util.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-09-23 03:04:58 +0800
committerFelix Lange <fjl@twurst.com>2016-09-26 16:09:52 +0800
commita59a93f476434f2805c8fd3e10bf1b2f579b078f (patch)
tree17d1f3abefabfd7f8cb9149994a4788d2c0f08bc /tests/vm_test_util.go
parente859f3696783ec75d9bb39c0c66eda3a88cea8c6 (diff)
downloadgo-tangerine-a59a93f476434f2805c8fd3e10bf1b2f579b078f.tar.gz
go-tangerine-a59a93f476434f2805c8fd3e10bf1b2f579b078f.tar.zst
go-tangerine-a59a93f476434f2805c8fd3e10bf1b2f579b078f.zip
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.
Diffstat (limited to 'tests/vm_test_util.go')
-rw-r--r--tests/vm_test_util.go8
1 files changed, 3 insertions, 5 deletions
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())
}