Skip to content

test_static_to_pointer()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs_2.py::test_static_to_pointer@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_static_to_pointer --fork Osaka

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

Verify that static context is active when make sub call to pointer.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs_2.py
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
@pytest.mark.valid_from("Prague")
def test_static_to_pointer(state_test: StateTestFiller, pre: Alloc) -> None:
    """
    Tx -> staticcall -> pointer A -> static violation.

    Verify that static context is active when make sub call to 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=pointer_a, args_size=32, ret_offset=1000, ret_size=32
            ),
        )
        + Op.SSTORE(storage.store_next(1, "call_worked"), 1)
    )

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

    post = {contract_a: Account(storage=storage), pointer_a: 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