4747)
4848def test_storage_slot_write (blockchain_test : BlockchainTestFiller , fork : str , slot_num ):
4949 """
50- Test that storage slot writes work as expected .
50+ Test that executes a SSTORE with a non-zero value .
5151 """
5252 env = Environment (
5353 fee_recipient = "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" ,
@@ -59,14 +59,15 @@ def test_storage_slot_write(blockchain_test: BlockchainTestFiller, fork: str, sl
5959 pre = {
6060 TestAddress : Account (balance = 1000000000000000000000 ),
6161 }
62+ slot_value = 0x42
6263 tx = Transaction (
6364 ty = 0x0 ,
6465 chain_id = 0x01 ,
6566 nonce = 0 ,
6667 to = None ,
6768 gas_limit = 100000000 ,
6869 gas_price = 10 ,
69- data = Op .SSTORE (slot_num , 0x42 ),
70+ data = Op .SSTORE (slot_num , slot_value ),
7071 )
7172 blocks = [Block (txs = [tx ])]
7273
@@ -75,7 +76,51 @@ def test_storage_slot_write(blockchain_test: BlockchainTestFiller, fork: str, sl
7576 post = {
7677 contract_address : Account (
7778 storage = {
78- slot_num : 0x42 ,
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+ )
90+
91+
92+ @pytest .mark .valid_from ("Verkle" )
93+ def test_storage_slot_zero_nonzero_zero (blockchain_test : BlockchainTestFiller , fork : str ):
94+ """
95+ Test that executes in the same tx a SSTORE looping from abscent to zero.
96+ """
97+ env = Environment (
98+ fee_recipient = "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" ,
99+ difficulty = 0x20000 ,
100+ gas_limit = 10000000000 ,
101+ number = 1 ,
102+ timestamp = 1000 ,
103+ )
104+ pre = {
105+ TestAddress : Account (balance = 1000000000000000000000 ),
106+ }
107+ tx = Transaction (
108+ ty = 0x0 ,
109+ chain_id = 0x01 ,
110+ nonce = 0 ,
111+ to = None ,
112+ gas_limit = 100000000 ,
113+ gas_price = 10 ,
114+ data = Op .SSTORE (0x88 , 0x42 ) + Op .SSTORE (0x88 , 0x00 ),
115+ )
116+ blocks = [Block (txs = [tx ])]
117+
118+ contract_address = compute_create_address (address = TestAddress , nonce = tx .nonce )
119+
120+ post = {
121+ contract_address : Account (
122+ storage = {
123+ 0x88 : 0x00 ,
79124 },
80125 ),
81126 }
0 commit comments