Skip to content

Commit 3ff3b35

Browse files
committed
Add test for VMState.lock_changes()
Storage value lookups with from_journal=False must pin to the value at the time of the latest lock_changes() call.
1 parent 11009a5 commit 3ff3b35

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/core/vm/test_vm_state.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,13 @@ def test_revert_selfdestruct(state, read_storage_before_snapshot):
101101
# "starting" storage root hash would always be the empty one, which causes
102102
# it to not be able to recover from a revert
103103
assert state.get_storage(ADDRESS, 1) == 2
104+
105+
106+
def test_lock_state(state):
107+
assert state.get_storage(ADDRESS, 1, from_journal=False) == 0
108+
109+
state.set_storage(ADDRESS, 1, 2)
110+
assert state.get_storage(ADDRESS, 1, from_journal=False) == 0
111+
112+
state.lock_changes()
113+
assert state.get_storage(ADDRESS, 1, from_journal=False) == 2

0 commit comments

Comments
 (0)