Skip to content

Commit 1bad10b

Browse files
committed
Review fixes
1 parent 6257568 commit 1bad10b

File tree

3 files changed

+31
-34
lines changed

3 files changed

+31
-34
lines changed

fillers/eips/eip3651.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
CodeGasMeasure,
1111
Environment,
1212
StateTest,
13+
TestAddress,
1314
Transaction,
1415
Yul,
1516
is_fork,
@@ -106,9 +107,7 @@ def test_warm_coinbase_call_out_of_gas(fork):
106107
)
107108

108109
pre = {
109-
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": Account(
110-
balance=1000000000000000000000
111-
),
110+
TestAddress: Account(balance=1000000000000000000000),
112111
"0xcccccccccccccccccccccccccccccccccccccccc": Account(
113112
code=caller_code
114113
),
@@ -304,9 +303,7 @@ def test_warm_coinbase_gas_usage(fork):
304303
for opcode in gas_measured_opcodes:
305304
measure_address = to_address(0x100)
306305
pre = {
307-
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": Account(
308-
balance=1000000000000000000000
309-
),
306+
TestAddress: Account(balance=1000000000000000000000),
310307
measure_address: Account(
311308
code=gas_measured_opcodes[opcode],
312309
),

fillers/eips/eip3855.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
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
}

fillers/eips/eip3860.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
General constants used for testing purposes
3131
"""
3232

33-
MAX_INITCODE_SIZE = 0xC000
34-
INITCODE_WORD_COST = 0x02
35-
KECCAK_WORD_COST = 0x06
33+
MAX_INITCODE_SIZE = 49152
34+
INITCODE_WORD_COST = 2
35+
KECCAK_WORD_COST = 6
3636
INITCODE_RESULTING_DEPLOYED_CODE = bytes([0x00])
3737

38-
BASE_TRANSACTION_GAS = 0x5208
39-
CREATE_CONTRACT_BASE_GAS = 0x7D00
40-
GAS_OPCODE_GAS = 0x02
41-
PUSH_DUP_OPCODE_GAS = 0x03
38+
BASE_TRANSACTION_GAS = 21000
39+
CREATE_CONTRACT_BASE_GAS = 32000
40+
GAS_OPCODE_GAS = 2
41+
PUSH_DUP_OPCODE_GAS = 3
4242

4343
"""
4444
Helper functions
@@ -86,9 +86,8 @@ def calculate_create_tx_execution_cost(
8686
eip_3860_active: bool,
8787
) -> int:
8888
"""
89-
Calculates the minimum total execution gas cost of a transaction that
90-
contains initcode and creates a contract for the contract to be
91-
successfully deployed
89+
Calculates the total execution gas cost of a transaction that
90+
contains initcode and creates a contract
9291
"""
9392
cost = calculate_create_tx_intrinsic_cost(
9493
initcode=initcode, eip_3860_active=eip_3860_active

0 commit comments

Comments
 (0)