@@ -38,11 +38,8 @@ def data_test_type() -> DataTestType:
3838
3939@pytest .fixture
4040def 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
4643
4744
4845class TestGasConsumption :
@@ -61,47 +58,22 @@ def to(
6158 """Return a contract that consumes all gas when executed by calling an invalid opcode."""
6259 return pre .deploy_contract (Op .INVALID )
6360
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-
7861 @pytest .mark .parametrize (
7962 "ty,protected,authorization_list" ,
8063 [
8164 pytest .param (0 , False , None , id = "type_0_unprotected" ),
8265 pytest .param (0 , True , None , id = "type_0_protected" ),
8366 pytest .param (1 , True , None , id = "type_1" ),
8467 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" ),
9770 ],
9871 indirect = ["authorization_list" ],
9972 )
10073 @pytest .mark .parametrize (
10174 "tx_gas_delta" ,
10275 [
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.
10577 pytest .param (1 , id = "extra_gas" ),
10678 pytest .param (0 , id = "exact_gas" ),
10779 ],
@@ -111,10 +83,9 @@ def test_full_gas_consumption(
11183 state_test : StateTestFiller ,
11284 pre : Alloc ,
11385 tx : Transaction ,
114- refund : int ,
11586 ) -> None :
11687 """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 )
11889 state_test (
11990 pre = pre ,
12091 post = {},
@@ -130,20 +101,6 @@ def contract_creating_tx(self) -> bool:
130101 """Use a constant in order to avoid circular fixture dependencies."""
131102 return False
132103
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-
147104 @pytest .fixture
148105 def to (
149106 self ,
@@ -171,33 +128,14 @@ def to(
171128 return pre .deploy_contract ((Op .JUMPDEST * (execution_gas - 1 )) + Op .STOP )
172129
173130 @pytest .mark .parametrize (
174- "ty,protected,authorization_list,authorization_refund " ,
131+ "ty,protected,authorization_list" ,
175132 [
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" ),
201139 ],
202140 indirect = ["authorization_list" ],
203141 )
@@ -215,10 +153,9 @@ def test_gas_consumption_below_data_floor(
215153 pre : Alloc ,
216154 tx : Transaction ,
217155 tx_floor_data_cost : int ,
218- refund : int ,
219156 ) -> None :
220157 """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 )
222159 state_test (
223160 pre = pre ,
224161 post = {},
0 commit comments