@@ -235,9 +235,7 @@ def test_dynamic_create2_selfdestruct_collision(
235235)
236236@pytest .mark .parametrize (
237237 "call_create2_contract_at_the_end" ,
238- [
239- (True , False ),
240- ],
238+ (True , False ),
241239)
242240def test_dynamic_create2_selfdestruct_collision_two_different_transactions (
243241 env : Environment ,
@@ -374,7 +372,11 @@ def test_dynamic_create2_selfdestruct_collision_two_different_transactions(
374372 post [create2_address ] = (
375373 Account (balance = 0 , nonce = 1 , code = deploy_code , storage = {create2_constructor_worked : 0x00 })
376374 if create2_dest_already_in_state and fork >= Cancun
377- else Account .NONEXISTENT
375+ else (
376+ Account .NONEXISTENT
377+ if call_create2_contract_at_the_end
378+ else Account (balance = 1000 , nonce = 1 , code = deploy_code )
379+ )
378380 )
379381
380382 # after Cancun Create2 initcode is only executed if the contract did not already exist
@@ -419,11 +421,15 @@ def test_dynamic_create2_selfdestruct_collision_two_different_transactions(
419421 else :
420422 # first create2 fails, first calls totally removes the account
421423 # in the second transaction second create2 is successful
422- sendall_destination_balance += first_call_value + second_create2_value
424+ sendall_destination_balance += first_call_value
425+ if call_create2_contract_at_the_end :
426+ sendall_destination_balance += second_create2_value
423427 else :
424428 # if no account in the state, first create2 successful, first call successful and removes
425429 # because it is removed in the next transaction second create2 successful
426- sendall_destination_balance = first_create2_value + first_call_value + second_create2_value
430+ sendall_destination_balance = first_create2_value + first_call_value
431+ if call_create2_contract_at_the_end :
432+ sendall_destination_balance += second_create2_value
427433
428434 if call_create2_contract_at_the_end :
429435 sendall_destination_balance += second_call_value
0 commit comments