99 CodeGasMeasure ,
1010 Environment ,
1111 StateTest ,
12+ TestAddress ,
1213 Transaction ,
1314 Yul ,
1415 test_from ,
@@ -24,23 +25,23 @@ def test_push0(fork):
2425 env = Environment ()
2526
2627 pre = {
27- "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : Account (
28- balance = 1000000000000000000000
29- ),
28+ TestAddress : Account (balance = 1000000000000000000000 ),
3029 }
3130
3231 post = {}
3332
33+ code_address = to_address (0x100 )
34+
3435 # Entry point for all test cases this address
3536 tx = Transaction (
36- to = to_address ( 0x100 ) ,
37+ to = code_address ,
3738 gas_limit = 100000 ,
3839 )
3940
4041 """
4142 Test case 1: Simple PUSH0 as key to SSTORE
4243 """
43- pre [to_address ( 0x100 ) ] = Account (
44+ pre [code_address ] = Account (
4445 code = bytes (
4546 [
4647 0x60 , # PUSH1
@@ -51,7 +52,7 @@ def test_push0(fork):
5152 ),
5253 )
5354
54- post [to_address ( 0x100 ) ] = Account (
55+ post [code_address ] = Account (
5556 storage = {
5657 0x00 : 0x01 ,
5758 }
@@ -65,7 +66,7 @@ def test_push0(fork):
6566 Test case 2: Fill stack with PUSH0, then OR all values and save using
6667 SSTORE
6768 """
68- pre [to_address ( 0x100 ) ] = Account (
69+ pre [code_address ] = Account (
6970 code = bytes (
7071 [
7172 0x5F , # PUSH0
@@ -88,7 +89,7 @@ def test_push0(fork):
8889 ),
8990 )
9091
91- post [to_address ( 0x100 ) ] = Account (
92+ post [code_address ] = Account (
9293 storage = {
9394 0x00 : 0x01 ,
9495 }
@@ -101,7 +102,7 @@ def test_push0(fork):
101102 """
102103 Test case 3: Stack overflow by using PUSH0 1025 times
103104 """
104- pre [to_address ( 0x100 ) ] = Account (
105+ pre [code_address ] = Account (
105106 code = Yul ("{ sstore(0, 1) }" )
106107 + bytes (
107108 [
@@ -111,7 +112,7 @@ def test_push0(fork):
111112 ),
112113 )
113114
114- post [to_address ( 0x100 ) ] = Account (
115+ post [code_address ] = Account (
115116 storage = {
116117 0x00 : 0x00 ,
117118 }
@@ -124,7 +125,7 @@ def test_push0(fork):
124125 """
125126 Test case 4: Update already existing storage value
126127 """
127- pre [to_address ( 0x100 ) ] = Account (
128+ pre [code_address ] = Account (
128129 code = bytes (
129130 [
130131 0x60 , # PUSH1
@@ -143,7 +144,7 @@ def test_push0(fork):
143144 },
144145 )
145146
146- post [to_address ( 0x100 ) ] = Account (
147+ post [code_address ] = Account (
147148 storage = {
148149 0x00 : 0x02 ,
149150 0x01 : 0x00 ,
@@ -158,7 +159,7 @@ def test_push0(fork):
158159 Test case 5: PUSH0 during staticcall
159160 """
160161
161- pre [to_address ( 0x100 ) ] = Account (
162+ pre [code_address ] = Account (
162163 code = Yul (
163164 """
164165 {
@@ -185,7 +186,7 @@ def test_push0(fork):
185186 ]
186187 ),
187188 )
188- post [to_address ( 0x100 ) ] = Account (
189+ post [code_address ] = Account (
189190 storage = {
190191 0x00 : 0x01 ,
191192 0x01 : 0xFF ,
@@ -201,7 +202,7 @@ def test_push0(fork):
201202 """
202203 Test case 6: Jump to a JUMPDEST next to a PUSH0, must succeed.
203204 """
204- pre [to_address ( 0x100 ) ] = Account (
205+ pre [code_address ] = Account (
205206 code = bytes (
206207 [
207208 0x60 , # PUSH1
@@ -218,7 +219,7 @@ def test_push0(fork):
218219 ),
219220 )
220221
221- post [to_address ( 0x100 ) ] = Account (
222+ post [code_address ] = Account (
222223 storage = {
223224 0x00 : 0x01 ,
224225 }
@@ -231,7 +232,7 @@ def test_push0(fork):
231232 """
232233 Test case 7: PUSH0 gas cost
233234 """
234- pre [to_address ( 0x100 ) ] = Account (
235+ pre [code_address ] = Account (
235236 code = CodeGasMeasure (
236237 code = bytes (
237238 [
@@ -242,7 +243,7 @@ def test_push0(fork):
242243 ),
243244 )
244245
245- post [to_address ( 0x100 ) ] = Account (
246+ post [code_address ] = Account (
246247 storage = {
247248 0x00 : 0x02 ,
248249 }
0 commit comments