diff --git a/tests/verkle/eip6800_genesis_verkle_tree/test_storage_slot_write.py b/tests/verkle/eip6800_genesis_verkle_tree/test_storage_slot_write.py index 5f38a93e50..7e30512396 100644 --- a/tests/verkle/eip6800_genesis_verkle_tree/test_storage_slot_write.py +++ b/tests/verkle/eip6800_genesis_verkle_tree/test_storage_slot_write.py @@ -47,7 +47,7 @@ ) def test_storage_slot_write(blockchain_test: BlockchainTestFiller, fork: str, slot_num): """ - Test that storage slot writes work as expected. + Test that executes a SSTORE with a non-zero value. """ env = Environment( fee_recipient="0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", @@ -59,6 +59,7 @@ def test_storage_slot_write(blockchain_test: BlockchainTestFiller, fork: str, sl pre = { TestAddress: Account(balance=1000000000000000000000), } + slot_value = 0x42 tx = Transaction( ty=0x0, chain_id=0x01, @@ -66,7 +67,7 @@ def test_storage_slot_write(blockchain_test: BlockchainTestFiller, fork: str, sl to=None, gas_limit=100000000, gas_price=10, - data=Op.SSTORE(slot_num, 0x42), + data=Op.SSTORE(slot_num, slot_value), ) blocks = [Block(txs=[tx])] @@ -75,7 +76,51 @@ def test_storage_slot_write(blockchain_test: BlockchainTestFiller, fork: str, sl post = { contract_address: Account( storage={ - slot_num: 0x42, + slot_num: slot_value, + }, + ), + } + + blockchain_test( + genesis_environment=env, + pre=pre, + post=post, + blocks=blocks, + ) + + +@pytest.mark.valid_from("Verkle") +def test_storage_slot_zero_nonzero_zero(blockchain_test: BlockchainTestFiller, fork: str): + """ + Test that executes in the same tx a SSTORE looping from abscent to zero. + """ + env = Environment( + fee_recipient="0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + difficulty=0x20000, + gas_limit=10000000000, + number=1, + timestamp=1000, + ) + pre = { + TestAddress: Account(balance=1000000000000000000000), + } + tx = Transaction( + ty=0x0, + chain_id=0x01, + nonce=0, + to=None, + gas_limit=100000000, + gas_price=10, + data=Op.SSTORE(0x88, 0x42) + Op.SSTORE(0x88, 0x00), + ) + blocks = [Block(txs=[tx])] + + contract_address = compute_create_address(address=TestAddress, nonce=tx.nonce) + + post = { + contract_address: Account( + storage={ + 0x88: 0x00, }, ), }