Skip to content

test_address_from_set_code()

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

Generate fixtures for these test cases for Prague with:

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

Test the address opcode in a set-code transaction.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
def test_address_from_set_code(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """Test the address opcode in a set-code transaction."""
    storage = Storage()
    auth_signer = pre.fund_eoa(auth_account_start_balance)

    set_code = Op.SSTORE(storage.store_next(auth_signer), Op.ADDRESS) + Op.STOP
    set_code_to_address = pre.deploy_contract(set_code)

    tx = Transaction(
        gas_limit=10_000_000,
        to=auth_signer,
        value=0,
        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,
            ),
        },
    )

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