Skip to content

test_call_into_self_delegating_set_code()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_call_into_self_delegating_set_code@21fb11c8.

Generate fixtures for these test cases for Prague with:

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

Test call into a set-code account that delegates to itself.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
@pytest.mark.with_all_call_opcodes
def test_call_into_self_delegating_set_code(
    state_test: StateTestFiller,
    pre: Alloc,
    call_opcode: Op,
):
    """Test call into a set-code account that delegates to itself."""
    auth_signer = pre.fund_eoa(auth_account_start_balance)

    storage = Storage()
    entry_code = (
        Op.SSTORE(
            storage.store_next(
                call_return_code(
                    opcode=call_opcode,
                    success=False,
                    revert=(call_opcode == Op.EXTDELEGATECALL),
                )
            ),
            call_opcode(address=auth_signer),
        )
        + Op.STOP
    )
    entry_address = pre.deploy_contract(entry_code)

    tx = Transaction(
        gas_limit=10_000_000,
        to=entry_address,
        value=0,
        authorization_list=[
            AuthorizationTuple(
                address=auth_signer,
                nonce=0,
                signer=auth_signer,
            ),
        ],
        sender=pre.fund_eoa(),
    )

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

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) call_opcode evm_code_type
...fork_Prague-call_opcode_STATICCALL-evm_code_type_LEGACY-state_test STATICCALL LEGACY
...fork_Prague-call_opcode_STATICCALL-evm_code_type_LEGACY-blockchain_test_from_state_test STATICCALL LEGACY
...fork_Prague-call_opcode_DELEGATECALL-evm_code_type_LEGACY-state_test DELEGATECALL LEGACY
...fork_Prague-call_opcode_DELEGATECALL-evm_code_type_LEGACY-blockchain_test_from_state_test DELEGATECALL LEGACY
...fork_Prague-call_opcode_CALL-evm_code_type_LEGACY-state_test CALL LEGACY
...fork_Prague-call_opcode_CALL-evm_code_type_LEGACY-blockchain_test_from_state_test CALL LEGACY
...fork_Prague-call_opcode_CALLCODE-evm_code_type_LEGACY-state_test CALLCODE LEGACY
...fork_Prague-call_opcode_CALLCODE-evm_code_type_LEGACY-blockchain_test_from_state_test CALLCODE LEGACY
...fork_Osaka-call_opcode_EXTCALL-evm_code_type_EOF_V1-state_test EXTCALL EOF_V1
...fork_Osaka-call_opcode_EXTCALL-evm_code_type_EOF_V1-blockchain_test_from_state_test EXTCALL EOF_V1
...fork_Osaka-call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-state_test EXTSTATICCALL EOF_V1
...fork_Osaka-call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-blockchain_test_from_state_test EXTSTATICCALL EOF_V1
...fork_Osaka-call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-state_test EXTDELEGATECALL EOF_V1
...fork_Osaka-call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-blockchain_test_from_state_test EXTDELEGATECALL EOF_V1
...fork_Osaka-call_opcode_STATICCALL-evm_code_type_LEGACY-state_test STATICCALL LEGACY
...fork_Osaka-call_opcode_STATICCALL-evm_code_type_LEGACY-blockchain_test_from_state_test STATICCALL LEGACY
...fork_Osaka-call_opcode_DELEGATECALL-evm_code_type_LEGACY-state_test DELEGATECALL LEGACY
...fork_Osaka-call_opcode_DELEGATECALL-evm_code_type_LEGACY-blockchain_test_from_state_test DELEGATECALL LEGACY
...fork_Osaka-call_opcode_CALL-evm_code_type_LEGACY-state_test CALL LEGACY
...fork_Osaka-call_opcode_CALL-evm_code_type_LEGACY-blockchain_test_from_state_test CALL LEGACY
...fork_Osaka-call_opcode_CALLCODE-evm_code_type_LEGACY-state_test CALLCODE LEGACY
...fork_Osaka-call_opcode_CALLCODE-evm_code_type_LEGACY-blockchain_test_from_state_test CALLCODE LEGACY