@@ -38,11 +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
41
+ """Disable the refunds on these tests (see ./test_refunds.py)."""
42
+ return False
46
43
47
44
48
45
class TestGasConsumption :
@@ -61,47 +58,22 @@ def to(
61
58
"""Return a contract that consumes all gas when executed by calling an invalid opcode."""
62
59
return pre .deploy_contract (Op .INVALID )
63
60
64
- @pytest .fixture
65
- def refund (
66
- self ,
67
- fork : Fork ,
68
- ty : int ,
69
- authorization_refund : bool ,
70
- ) -> int :
71
- """Return the refund gas of the transaction."""
72
- gas_costs = fork .gas_costs ()
73
- refund = 0
74
- if ty == 4 and authorization_refund :
75
- refund += gas_costs .R_AUTHORIZATION_EXISTING_AUTHORITY
76
- return refund
77
-
78
61
@pytest .mark .parametrize (
79
62
"ty,protected,authorization_list" ,
80
63
[
81
64
pytest .param (0 , False , None , id = "type_0_unprotected" ),
82
65
pytest .param (0 , True , None , id = "type_0_protected" ),
83
66
pytest .param (1 , True , None , id = "type_1" ),
84
67
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
- ),
68
+ pytest .param (3 , True , None , id = "type_3" ),
69
+ pytest .param (4 , True , [Address (1 )], id = "type_4" ),
97
70
],
98
71
indirect = ["authorization_list" ],
99
72
)
100
73
@pytest .mark .parametrize (
101
74
"tx_gas_delta" ,
102
75
[
103
- # Test with exact gas and extra gas, to verify that the refund is correctly applied
104
- # to the full consumed execution gas.
76
+ # Test with exact gas and extra gas.
105
77
pytest .param (1 , id = "extra_gas" ),
106
78
pytest .param (0 , id = "exact_gas" ),
107
79
],
@@ -111,10 +83,9 @@ def test_full_gas_consumption(
111
83
state_test : StateTestFiller ,
112
84
pre : Alloc ,
113
85
tx : Transaction ,
114
- refund : int ,
115
86
) -> None :
116
87
"""Test executing a transaction that fully consumes its execution gas allocation."""
117
- tx .expected_receipt = TransactionReceipt (gas_used = tx .gas_limit - refund )
88
+ tx .expected_receipt = TransactionReceipt (gas_used = tx .gas_limit )
118
89
state_test (
119
90
pre = pre ,
120
91
post = {},
@@ -130,20 +101,6 @@ def contract_creating_tx(self) -> bool:
130
101
"""Use a constant in order to avoid circular fixture dependencies."""
131
102
return False
132
103
133
- @pytest .fixture
134
- def refund (
135
- self ,
136
- fork : Fork ,
137
- ty : int ,
138
- authorization_refund : bool ,
139
- ) -> int :
140
- """Return the refund gas of the transaction."""
141
- gas_costs = fork .gas_costs ()
142
- refund = 0
143
- if ty == 4 and authorization_refund :
144
- refund += gas_costs .R_AUTHORIZATION_EXISTING_AUTHORITY
145
- return refund
146
-
147
104
@pytest .fixture
148
105
def to (
149
106
self ,
@@ -171,33 +128,14 @@ def to(
171
128
return pre .deploy_contract ((Op .JUMPDEST * (execution_gas - 1 )) + Op .STOP )
172
129
173
130
@pytest .mark .parametrize (
174
- "ty,protected,authorization_list,authorization_refund " ,
131
+ "ty,protected,authorization_list" ,
175
132
[
176
- pytest .param (0 , False , None , False , id = "type_0_unprotected" ),
177
- pytest .param (0 , True , None , False , id = "type_0_protected" ),
178
- pytest .param (1 , True , None , False , id = "type_1" ),
179
- pytest .param (2 , True , None , False , id = "type_2" ),
180
- pytest .param (
181
- 3 ,
182
- True ,
183
- None ,
184
- False ,
185
- id = "type_3" ,
186
- ),
187
- pytest .param (
188
- 4 ,
189
- True ,
190
- [Address (1 )],
191
- False ,
192
- id = "type_4" ,
193
- ),
194
- pytest .param (
195
- 4 ,
196
- True ,
197
- [Address (1 )],
198
- True ,
199
- id = "type_4_with_authorization_refund" ,
200
- ),
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" ),
201
139
],
202
140
indirect = ["authorization_list" ],
203
141
)
@@ -215,10 +153,9 @@ def test_gas_consumption_below_data_floor(
215
153
pre : Alloc ,
216
154
tx : Transaction ,
217
155
tx_floor_data_cost : int ,
218
- refund : int ,
219
156
) -> None :
220
157
"""Test executing a transaction that almost consumes the floor data cost."""
221
- tx .expected_receipt = TransactionReceipt (gas_used = tx_floor_data_cost - refund )
158
+ tx .expected_receipt = TransactionReceipt (gas_used = tx_floor_data_cost )
222
159
state_test (
223
160
pre = pre ,
224
161
post = {},
0 commit comments