@@ -3501,48 +3501,44 @@ def test_set_code_from_account_with_non_delegating_code(
3501
3501
self_sponsored : bool ,
3502
3502
):
3503
3503
"""
3504
- Test that a transaction is correctly rejected if the sender account has a non-delegating code
3505
- set.
3504
+ Test that a transaction is correctly rejected,
3505
+ if the sender account has a non-delegating code set.
3506
+
3507
+ The auth transaction is sent from sender which has contract code (not delegating)
3508
+ But at the same time it has auth tuple that will point this sender account
3509
+ To be eoa, delegation, contract .. etc
3506
3510
"""
3507
3511
sender = pre .fund_eoa ()
3508
- if self_sponsored :
3509
- auth_signer = sender
3510
- else :
3511
- auth_signer = pre .fund_eoa (0 )
3512
+ random_address = pre .fund_eoa (0 )
3512
3513
3513
3514
set_code_to_address : Address
3514
- set_code : Bytecode | Bytes
3515
3515
match set_code_type :
3516
3516
case AddressType .EMPTY_ACCOUNT :
3517
- set_code = Bytecode ()
3518
3517
set_code_to_address = pre .fund_eoa (0 )
3519
3518
case AddressType .EOA :
3520
- set_code = Bytecode ()
3521
3519
set_code_to_address = pre .fund_eoa (1 )
3522
3520
case AddressType .EOA_WITH_SET_CODE :
3523
3521
set_code_account = pre .fund_eoa (0 )
3524
- set_code = Spec .delegation_designation (set_code_account )
3525
3522
set_code_to_address = pre .fund_eoa (1 , delegation = set_code_account )
3526
3523
case AddressType .CONTRACT :
3527
- set_code = Op .STOP
3528
- set_code_to_address = pre .deploy_contract (set_code )
3524
+ set_code_to_address = pre .deploy_contract (Op .STOP )
3529
3525
case _:
3530
3526
raise ValueError (f"Unsupported set code type: { set_code_type } " )
3531
3527
callee_address = pre .deploy_contract (Op .SSTORE (0 , 1 ) + Op .STOP )
3532
3528
3533
- # Set the sender account to have some code, that is specifically not
3534
- # a delegation.
3529
+ # Set the sender account to have some code, that is specifically not a delegation.
3535
3530
sender_account = pre [sender ]
3536
3531
assert sender_account is not None
3537
3532
sender_account .code = Bytes (Op .STOP )
3533
+
3538
3534
tx = Transaction (
3539
3535
gas_limit = 100_000 ,
3540
3536
to = callee_address ,
3541
3537
authorization_list = [
3542
3538
AuthorizationTuple (
3543
3539
address = set_code_to_address ,
3544
3540
nonce = 1 if self_sponsored else 0 ,
3545
- signer = auth_signer ,
3541
+ signer = sender if self_sponsored else random_address ,
3546
3542
),
3547
3543
],
3548
3544
sender = sender ,
@@ -3559,7 +3555,7 @@ def test_set_code_from_account_with_non_delegating_code(
3559
3555
if set_code_type == AddressType .EMPTY_ACCOUNT
3560
3556
else Account (storage = {})
3561
3557
),
3562
- auth_signer : Account .NONEXISTENT
3558
+ random_address : Account .NONEXISTENT
3563
3559
if not self_sponsored
3564
3560
else Account (code = Bytes (Op .STOP )),
3565
3561
callee_address : Account (storage = {0 : 0 }),
0 commit comments