Skip to content

Commit f2894be

Browse files
winsvegamarioevz
authored andcommitted
apply comments
1 parent 548b364 commit f2894be

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

tests/prague/eip7702_set_code_tx/test_set_code_txs.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3501,48 +3501,44 @@ def test_set_code_from_account_with_non_delegating_code(
35013501
self_sponsored: bool,
35023502
):
35033503
"""
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
35063510
"""
35073511
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)
35123513

35133514
set_code_to_address: Address
3514-
set_code: Bytecode | Bytes
35153515
match set_code_type:
35163516
case AddressType.EMPTY_ACCOUNT:
3517-
set_code = Bytecode()
35183517
set_code_to_address = pre.fund_eoa(0)
35193518
case AddressType.EOA:
3520-
set_code = Bytecode()
35213519
set_code_to_address = pre.fund_eoa(1)
35223520
case AddressType.EOA_WITH_SET_CODE:
35233521
set_code_account = pre.fund_eoa(0)
3524-
set_code = Spec.delegation_designation(set_code_account)
35253522
set_code_to_address = pre.fund_eoa(1, delegation=set_code_account)
35263523
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)
35293525
case _:
35303526
raise ValueError(f"Unsupported set code type: {set_code_type}")
35313527
callee_address = pre.deploy_contract(Op.SSTORE(0, 1) + Op.STOP)
35323528

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.
35353530
sender_account = pre[sender]
35363531
assert sender_account is not None
35373532
sender_account.code = Bytes(Op.STOP)
3533+
35383534
tx = Transaction(
35393535
gas_limit=100_000,
35403536
to=callee_address,
35413537
authorization_list=[
35423538
AuthorizationTuple(
35433539
address=set_code_to_address,
35443540
nonce=1 if self_sponsored else 0,
3545-
signer=auth_signer,
3541+
signer=sender if self_sponsored else random_address,
35463542
),
35473543
],
35483544
sender=sender,
@@ -3559,7 +3555,7 @@ def test_set_code_from_account_with_non_delegating_code(
35593555
if set_code_type == AddressType.EMPTY_ACCOUNT
35603556
else Account(storage={})
35613557
),
3562-
auth_signer: Account.NONEXISTENT
3558+
random_address: Account.NONEXISTENT
35633559
if not self_sponsored
35643560
else Account(code=Bytes(Op.STOP)),
35653561
callee_address: Account(storage={0: 0}),

0 commit comments

Comments
 (0)