Skip to content

test_set_code_using_chain_specific_id()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_using_chain_specific_id@verkle@v0.0.6.

Generate fixtures for these test cases for Prague with:

Prague only:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_using_chain_specific_id --fork=Prague --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Prague:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_using_chain_specific_id --until=Prague

Test sending a transaction to set the code of an account using a chain-specific ID.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
def test_set_code_using_chain_specific_id(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """
    Test sending a transaction to set the code of an account using a chain-specific ID.
    """
    auth_signer = pre.fund_eoa(auth_account_start_balance)

    success_slot = 1

    set_code = Op.SSTORE(success_slot, 1) + Op.STOP
    set_code_to_address = pre.deploy_contract(set_code)

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

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