@@ -38,98 +38,8 @@ def data_test_type() -> DataTestType:
38
38
39
39
@pytest .fixture
40
40
def authorization_refund () -> bool :
41
- """
42
- Force the authority of the authorization tuple to be an existing authority in order
43
- to produce a refund.
44
- """
45
- return True
46
-
47
-
48
- class TestGasRefunds :
49
- """Test gas refunds with EIP-7623 active."""
50
-
51
- @pytest .fixture
52
- def intrinsic_gas_data_floor_minimum_delta (self ) -> int :
53
- """
54
- In this test we reset a storage key to zero to induce a refund,
55
- but we need to make sure that the floor is higher than the gas
56
- used during execution in order for the refund to be applied to
57
- the floor.
58
- """
59
- return 50_000
60
-
61
- @pytest .fixture
62
- def to (
63
- self ,
64
- pre : Alloc ,
65
- ) -> Address | None :
66
- """Return a contract that when executed results in refunds due to storage clearing."""
67
- return pre .deploy_contract (Op .SSTORE (0 , 0 ) + Op .STOP , storage = {0 : 1 })
68
-
69
- @pytest .fixture
70
- def refund (self , fork : Fork , ty : int ) -> int :
71
- """Return the refund gas of the transaction."""
72
- gas_costs = fork .gas_costs ()
73
- refund = gas_costs .R_STORAGE_CLEAR
74
- if ty == 4 :
75
- refund += gas_costs .R_AUTHORIZATION_EXISTING_AUTHORITY
76
- return refund
77
-
78
- @pytest .mark .parametrize (
79
- "ty,protected,authorization_list" ,
80
- [
81
- pytest .param (0 , False , None , id = "type_0_unprotected" ),
82
- pytest .param (0 , True , None , id = "type_0_protected" ),
83
- pytest .param (1 , True , None , id = "type_1" ),
84
- pytest .param (2 , True , None , id = "type_2" ),
85
- pytest .param (
86
- 3 ,
87
- True ,
88
- None ,
89
- id = "type_3" ,
90
- ),
91
- pytest .param (
92
- 4 ,
93
- True ,
94
- [Address (1 )],
95
- id = "type_4_with_authorization_refund" ,
96
- ),
97
- ],
98
- indirect = ["authorization_list" ],
99
- )
100
- @pytest .mark .parametrize (
101
- "tx_gas_delta" ,
102
- [
103
- # Test with exact gas and extra gas, to verify that the refund is correctly applied up
104
- # to the floor data cost.
105
- pytest .param (1 , id = "extra_gas" ),
106
- pytest .param (0 , id = "exact_gas" ),
107
- ],
108
- )
109
- def test_gas_refunds_from_data_floor (
110
- self ,
111
- state_test : StateTestFiller ,
112
- pre : Alloc ,
113
- tx : Transaction ,
114
- tx_floor_data_cost : int ,
115
- refund : int ,
116
- ) -> None :
117
- """
118
- Test gas refunds deducted from the data floor.
119
-
120
- I.e. the used gas by the intrinsic gas cost plus the execution cost is less than the data
121
- floor, hence data floor is used, and then the gas refunds are applied to the data floor.
122
- """
123
- tx .expected_receipt = TransactionReceipt (gas_used = tx_floor_data_cost - refund )
124
- state_test (
125
- pre = pre ,
126
- post = {
127
- tx .to : {
128
- "storage" : {0 : 0 }, # Verify storage was cleared
129
- }
130
- },
131
- tx = tx ,
132
- )
41
+ """Disable the refunds on these tests (see ./test_refunds.py)."""
42
+ return False
133
43
134
44
135
45
class TestGasConsumption :
@@ -148,47 +58,22 @@ def to(
148
58
"""Return a contract that consumes all gas when executed by calling an invalid opcode."""
149
59
return pre .deploy_contract (Op .INVALID )
150
60
151
- @pytest .fixture
152
- def refund (
153
- self ,
154
- fork : Fork ,
155
- ty : int ,
156
- authorization_refund : bool ,
157
- ) -> int :
158
- """Return the refund gas of the transaction."""
159
- gas_costs = fork .gas_costs ()
160
- refund = 0
161
- if ty == 4 and authorization_refund :
162
- refund += gas_costs .R_AUTHORIZATION_EXISTING_AUTHORITY
163
- return refund
164
-
165
61
@pytest .mark .parametrize (
166
62
"ty,protected,authorization_list" ,
167
63
[
168
64
pytest .param (0 , False , None , id = "type_0_unprotected" ),
169
65
pytest .param (0 , True , None , id = "type_0_protected" ),
170
66
pytest .param (1 , True , None , id = "type_1" ),
171
67
pytest .param (2 , True , None , id = "type_2" ),
172
- pytest .param (
173
- 3 ,
174
- True ,
175
- None ,
176
- id = "type_3" ,
177
- ),
178
- pytest .param (
179
- 4 ,
180
- True ,
181
- [Address (1 )],
182
- id = "type_4_with_authorization_refund" ,
183
- ),
68
+ pytest .param (3 , True , None , id = "type_3" ),
69
+ pytest .param (4 , True , [Address (1 )], id = "type_4" ),
184
70
],
185
71
indirect = ["authorization_list" ],
186
72
)
187
73
@pytest .mark .parametrize (
188
74
"tx_gas_delta" ,
189
75
[
190
- # Test with exact gas and extra gas, to verify that the refund is correctly applied
191
- # to the full consumed execution gas.
76
+ # Test with exact gas and extra gas.
192
77
pytest .param (1 , id = "extra_gas" ),
193
78
pytest .param (0 , id = "exact_gas" ),
194
79
],
@@ -198,10 +83,9 @@ def test_full_gas_consumption(
198
83
state_test : StateTestFiller ,
199
84
pre : Alloc ,
200
85
tx : Transaction ,
201
- refund : int ,
202
86
) -> None :
203
87
"""Test executing a transaction that fully consumes its execution gas allocation."""
204
- tx .expected_receipt = TransactionReceipt (gas_used = tx .gas_limit - refund )
88
+ tx .expected_receipt = TransactionReceipt (gas_used = tx .gas_limit )
205
89
state_test (
206
90
pre = pre ,
207
91
post = {},
@@ -217,20 +101,6 @@ def contract_creating_tx(self) -> bool:
217
101
"""Use a constant in order to avoid circular fixture dependencies."""
218
102
return False
219
103
220
- @pytest .fixture
221
- def refund (
222
- self ,
223
- fork : Fork ,
224
- ty : int ,
225
- authorization_refund : bool ,
226
- ) -> int :
227
- """Return the refund gas of the transaction."""
228
- gas_costs = fork .gas_costs ()
229
- refund = 0
230
- if ty == 4 and authorization_refund :
231
- refund += gas_costs .R_AUTHORIZATION_EXISTING_AUTHORITY
232
- return refund
233
-
234
104
@pytest .fixture
235
105
def to (
236
106
self ,
@@ -258,33 +128,14 @@ def to(
258
128
return pre .deploy_contract ((Op .JUMPDEST * (execution_gas - 1 )) + Op .STOP )
259
129
260
130
@pytest .mark .parametrize (
261
- "ty,protected,authorization_list,authorization_refund " ,
131
+ "ty,protected,authorization_list" ,
262
132
[
263
- pytest .param (0 , False , None , False , id = "type_0_unprotected" ),
264
- pytest .param (0 , True , None , False , id = "type_0_protected" ),
265
- pytest .param (1 , True , None , False , id = "type_1" ),
266
- pytest .param (2 , True , None , False , id = "type_2" ),
267
- pytest .param (
268
- 3 ,
269
- True ,
270
- None ,
271
- False ,
272
- id = "type_3" ,
273
- ),
274
- pytest .param (
275
- 4 ,
276
- True ,
277
- [Address (1 )],
278
- False ,
279
- id = "type_4" ,
280
- ),
281
- pytest .param (
282
- 4 ,
283
- True ,
284
- [Address (1 )],
285
- True ,
286
- id = "type_4_with_authorization_refund" ,
287
- ),
133
+ pytest .param (0 , False , None , id = "type_0_unprotected" ),
134
+ pytest .param (0 , True , None , id = "type_0_protected" ),
135
+ pytest .param (1 , True , None , id = "type_1" ),
136
+ pytest .param (2 , True , None , id = "type_2" ),
137
+ pytest .param (3 , True , None , id = "type_3" ),
138
+ pytest .param (4 , True , [Address (1 )], id = "type_4" ),
288
139
],
289
140
indirect = ["authorization_list" ],
290
141
)
@@ -302,10 +153,9 @@ def test_gas_consumption_below_data_floor(
302
153
pre : Alloc ,
303
154
tx : Transaction ,
304
155
tx_floor_data_cost : int ,
305
- refund : int ,
306
156
) -> None :
307
157
"""Test executing a transaction that almost consumes the floor data cost."""
308
- tx .expected_receipt = TransactionReceipt (gas_used = tx_floor_data_cost - refund )
158
+ tx .expected_receipt = TransactionReceipt (gas_used = tx_floor_data_cost )
309
159
state_test (
310
160
pre = pre ,
311
161
post = {},
0 commit comments