4646 ],
4747)
4848def test_storage_slot_write (blockchain_test : BlockchainTestFiller , fork : str , slot_num ):
49- _storage_slot_write (blockchain_test , fork , slot_num )
49+ """
50+ Test that executes a SSTORE with a non-zero value.
51+ """
52+ env = Environment (
53+ fee_recipient = "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" ,
54+ difficulty = 0x20000 ,
55+ gas_limit = 10000000000 ,
56+ number = 1 ,
57+ timestamp = 1000 ,
58+ )
59+ pre = {
60+ TestAddress : Account (balance = 1000000000000000000000 ),
61+ }
62+ slot_value = 0x42
63+ tx = Transaction (
64+ ty = 0x0 ,
65+ chain_id = 0x01 ,
66+ nonce = 0 ,
67+ to = None ,
68+ gas_limit = 100000000 ,
69+ gas_price = 10 ,
70+ data = Op .SSTORE (slot_num , slot_value ),
71+ )
72+ blocks = [Block (txs = [tx ])]
5073
74+ contract_address = compute_create_address (address = TestAddress , nonce = tx .nonce )
5175
52- @pytest .mark .valid_from ("Verkle" )
53- def test_storage_slot_write_absent_zero (blockchain_test : BlockchainTestFiller , fork : str ):
54- _storage_slot_write (blockchain_test , fork , 0x88 , slot_value = 0x00 )
76+ post = {
77+ contract_address : Account (
78+ storage = {
79+ slot_num : slot_value ,
80+ },
81+ ),
82+ }
83+
84+ blockchain_test (
85+ genesis_environment = env ,
86+ pre = pre ,
87+ post = post ,
88+ blocks = blocks ,
89+ )
5590
5691
57- def _storage_slot_write (
58- blockchain_test : BlockchainTestFiller , fork : str , slot_num , slot_value : int = 0x42
59- ):
92+ @pytest .mark .valid_from ("Verkle" )
93+ def test_storage_slot_zero_nonzero_zero (blockchain_test : BlockchainTestFiller , fork : str ):
6094 """
61- Test that storage slot writes work as expected .
95+ Test that executes in the same tx a SSTORE looping from abscent to zero .
6296 """
6397 env = Environment (
6498 fee_recipient = "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" ,
@@ -77,7 +111,7 @@ def _storage_slot_write(
77111 to = None ,
78112 gas_limit = 100000000 ,
79113 gas_price = 10 ,
80- data = Op .SSTORE (slot_num , slot_value ),
114+ data = Op .SSTORE (0x88 , 0x42 ) + Op . SSTORE ( 0x88 , 0x00 ),
81115 )
82116 blocks = [Block (txs = [tx ])]
83117
@@ -86,7 +120,7 @@ def _storage_slot_write(
86120 post = {
87121 contract_address : Account (
88122 storage = {
89- slot_num : slot_value ,
123+ 0x88 : 0x00 ,
90124 },
91125 ),
92126 }
0 commit comments