Skip to content

test_pointer_to_static()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs_2.py::test_pointer_to_static@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs_2.py::test_pointer_to_static --fork Osaka

Tx -> call -> pointer A -> static -> static violation.

Verify that static context is active when called under pointer.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs_2.py
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
@pytest.mark.valid_from("Prague")
def test_pointer_to_static(state_test: StateTestFiller, pre: Alloc) -> None:
    """
    Tx -> call -> pointer A -> static -> static violation.

    Verify that static context is active when called under pointer.
    """
    env = Environment()
    storage: Storage = Storage()
    sender = pre.fund_eoa()
    pointer_a = pre.fund_eoa()

    contract_b = pre.deploy_contract(code=Op.SSTORE(0, 5))
    contract_a = pre.deploy_contract(
        code=Op.SSTORE(
            storage.store_next(0, "static_call"),
            Op.STATICCALL(
                gas=1_000_000, address=contract_b, args_size=32, ret_offset=1000, ret_size=32
            ),
        )
        + Op.SSTORE(storage.store_next(1, "call_worked"), 1)
    )

    tx = Transaction(
        to=pointer_a,
        gas_limit=3_000_000,
        data=b"",
        value=0,
        sender=sender,
        authorization_list=[
            AuthorizationTuple(
                address=contract_a,
                nonce=0,
                signer=pointer_a,
            )
        ],
    )

    post = {pointer_a: Account(storage=storage), contract_b: Account(storage={0: 0})}
    state_test(
        env=env,
        pre=pre,
        post=post,
        tx=tx,
    )

Parametrized Test Cases

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

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