aboutsummaryrefslogtreecommitdiffstats
path: root/tests/vm_test_util.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-10-04 18:36:02 +0800
committerFelix Lange <fjl@twurst.com>2016-10-06 21:32:16 +0800
commit1f1ea18b5414bea22332bb4fce53cc95b5c6a07d (patch)
treed1aa3051f9c4d9f33a24519c18b70f0dd2f00644 /tests/vm_test_util.go
parentab7adb0027dbcf09cf75a533be356c1e24c46c90 (diff)
downloadgo-tangerine-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.tar
go-tangerine-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.tar.gz
go-tangerine-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.tar.bz2
go-tangerine-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.tar.lz
go-tangerine-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.tar.xz
go-tangerine-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.tar.zst
go-tangerine-1f1ea18b5414bea22332bb4fce53cc95b5c6a07d.zip
core/state: implement reverts by journaling all changes
This commit replaces the deep-copy based state revert mechanism with a linear complexity journal. This commit also hides several internal StateDB methods to limit the number of ways in which calling code can use the journal incorrectly. As usual consultation and bug fixes to the initial implementation were provided by @karalabe, @obscuren and @Arachnid. Thank you!
Diffstat (limited to 'tests/vm_test_util.go')
-rw-r--r--tests/vm_test_util.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go
index 4ad72d91c..c269f21e0 100644
--- a/tests/vm_test_util.go
+++ b/tests/vm_test_util.go
@@ -101,14 +101,7 @@ func BenchVmTest(p string, conf bconf, b *testing.B) error {
func benchVmTest(test VmTest, env map[string]string, b *testing.B) {
b.StopTimer()
db, _ := ethdb.NewMemDatabase()
- statedb, _ := state.New(common.Hash{}, db)
- for addr, account := range test.Pre {
- obj := StateObjectFromAccount(db, addr, account, statedb.MarkStateObjectDirty)
- statedb.SetStateObject(obj)
- for a, v := range account.Storage {
- obj.SetState(common.HexToHash(a), common.HexToHash(v))
- }
- }
+ statedb := makePreState(db, test.Pre)
b.StartTimer()
RunVm(statedb, env, test.Exec)
@@ -152,14 +145,7 @@ func runVmTests(tests map[string]VmTest, skipTests []string) error {
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, statedb.MarkStateObjectDirty)
- statedb.SetStateObject(obj)
- for a, v := range account.Storage {
- obj.SetState(common.HexToHash(a), common.HexToHash(v))
- }
- }
+ statedb := makePreState(db, test.Pre)
// XXX Yeah, yeah...
env := make(map[string]string)