Skip to content

test_set_code_max_depth_call_stack()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_max_depth_call_stack@83970623.

Generate fixtures for these test cases for Prague with:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_max_depth_call_stack --fork Prague

Test re-entry to delegated account until the max call stack depth is reached.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
@pytest.mark.execute(pytest.mark.skip(reason="excessive gas"))
def test_set_code_max_depth_call_stack(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """Test re-entry to delegated account until the max call stack depth is reached."""
    storage = Storage()
    auth_signer = pre.fund_eoa(auth_account_start_balance)
    set_code = Conditional(
        condition=Op.ISZERO(Op.TLOAD(0)),
        if_true=Op.TSTORE(0, 1)
        + Op.CALL(address=auth_signer)
        + Op.SSTORE(storage.store_next(1025), Op.TLOAD(0)),
        if_false=Op.TSTORE(0, Op.ADD(1, Op.TLOAD(0))) + Op.CALL(address=auth_signer),
    )
    set_code_to_address = pre.deploy_contract(set_code)

    tx = Transaction(
        gas_limit=100_000_000_000_000,
        to=auth_signer,
        authorization_list=[
            AuthorizationTuple(
                address=set_code_to_address,
                nonce=0,
                signer=auth_signer,
            ),
        ],
        sender=pre.fund_eoa(),
    )

    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post={
            set_code_to_address: Account(storage={}),
            auth_signer: Account(
                nonce=1,
                code=Spec.delegation_designation(set_code_to_address),
                storage=storage,
                balance=auth_account_start_balance,
            ),
        },
    )

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated)
...fork_Prague-blockchain_test
...fork_Prague-state_test
...fork_Osaka-blockchain_test
...fork_Osaka-state_test