99from eth .chains .mainnet import (
1010 MAINNET_VMS ,
1111)
12- from eth .exceptions import InvalidInstruction , ReservedBytesInCode
12+ from eth .exceptions import InvalidInstruction
1313from eth .vm .forks import BerlinVM
1414from eth .tools .factories .transaction import (
1515 new_dynamic_fee_transaction , new_transaction ,
@@ -166,7 +166,7 @@ def test_revert_on_reserved_0xEF_byte_for_CREATE_and_CREATE2_post_london(
166166 )
167167
168168 assert successful_create_computation .is_success
169- # assert only the appropriate gas is consumed, not all the gas . This falls within a range
169+ # assert gas is consumed. This falls within a range
170170 assert 32261 <= successful_create_computation .get_gas_used () <= 32270
171171
172172 # test parameterized negative cases
@@ -182,10 +182,7 @@ def test_revert_on_reserved_0xEF_byte_for_CREATE_and_CREATE2_post_london(
182182 )
183183
184184 assert revert_create_computation .is_error
185- assert isinstance (revert_create_computation .error , ReservedBytesInCode )
186- assert "0xef" in repr (revert_create_computation .error ).lower ()
187-
188- assert revert_create_computation .get_gas_used () == 40000 # assert gas is consumed
185+ assert 35000 < revert_create_computation .get_gas_used () < 40000 # assert gas is still consumed
189186 assert revert_create_computation .get_gas_refund () == 0
190187
191188
@@ -259,24 +256,19 @@ def test_state_revert_on_reserved_0xEF_byte_for_create_transaction_post_london(
259256 data = data ,
260257 )
261258
262- with pytest .raises (ReservedBytesInCode ):
263- block_import , _ , computations = chain .mine_all (
264- [create_contract_txn_reserved_byte ],
265- gas_limit = 84082
266- )
259+ block_import , _ , computations = chain .mine_all (
260+ [create_contract_txn_reserved_byte ],
261+ gas_limit = 84082
262+ )
267263
268- reverted_computation = computations [0 ]
269- mined_header = block_import .imported_block .header
270- end_balance = reverted_computation .state .get_balance (funded_address )
264+ reverted_computation = computations [0 ]
265+ mined_header = block_import .imported_block .header
271266
272- assert reverted_computation .is_error
273- assert isinstance (reverted_computation .error , ReservedBytesInCode )
274- assert "0xef" in repr (reverted_computation .error ).lower ()
267+ assert reverted_computation .is_error
268+ assert "0xef" in repr (reverted_computation .error ).lower ()
275269
276- assert reverted_computation .get_nonce (funded_address ) == 1 # assert nonce is still 1
277- # reverted txn consumes the gas:
278- assert mined_header .gas_used == 60000
279- assert end_balance == new_balance - 60000
270+ # reverted txn consumes the gas:
271+ assert mined_header .gas_used == 60000
280272
281273
282274@pytest .mark .parametrize (
0 commit comments