Skip to content

test_set_code_using_valid_synthetic_signatures()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_using_valid_synthetic_signatures@16d4f3bd.

Generate fixtures for these test cases for Prague with:

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

Test sending a transaction to set the code of an account using synthetic signatures.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
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
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
@pytest.mark.parametrize(
    "v,r,s",
    [
        pytest.param(0, 1, 1, id="v=0,r=1,s=1"),
        pytest.param(1, 1, 1, id="v=1,r=1,s=1"),
        pytest.param(0, SECP256K1N - 2, 1, id="v=0,r=SECP256K1N-2,s=1"),
        pytest.param(1, SECP256K1N - 2, 1, id="v=1,r=SECP256K1N-2,s=1"),
        pytest.param(0, 1, SECP256K1N_OVER_2, id="v=0,r=1,s=SECP256K1N_OVER_2"),
        pytest.param(1, 1, SECP256K1N_OVER_2, id="v=1,r=1,s=SECP256K1N_OVER_2"),
    ],
)
def test_set_code_using_valid_synthetic_signatures(
    state_test: StateTestFiller,
    pre: Alloc,
    v: int,
    r: int,
    s: int,
):
    """Test sending a transaction to set the code of an account using synthetic signatures."""
    success_slot = 1

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

    authorization_tuple = AuthorizationTuple(
        address=set_code_to_address,
        nonce=0,
        chain_id=1,
        v=v,
        r=r,
        s=s,
    )

    auth_signer = authorization_tuple.signer

    tx = Transaction(
        gas_limit=100_000,
        to=auth_signer,
        value=0,
        authorization_list=[authorization_tuple],
        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,
                },
            ),
        },
    )

Parametrized Test Cases

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

Test ID (Abbreviated) v r s
...fork_Prague-blockchain_test-v=0,r=1,s=1 0 1 1
...fork_Prague-blockchain_test-v=1,r=1,s=1 1 1 1
...fork_Prague-blockchain_test-v=0,r=SECP256K1N-2,s=1 0 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Prague-blockchain_test-v=1,r=SECP256K1N-2,s=1 1 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Prague-blockchain_test-v=0,r=1,s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Prague-blockchain_test-v=1,r=1,s=SECP256K1N_OVER_2 1 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Prague-state_test-v=0,r=1,s=1 0 1 1
...fork_Prague-state_test-v=1,r=1,s=1 1 1 1
...fork_Prague-state_test-v=0,r=SECP256K1N-2,s=1 0 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Prague-state_test-v=1,r=SECP256K1N-2,s=1 1 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Prague-state_test-v=0,r=1,s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Prague-state_test-v=1,r=1,s=SECP256K1N_OVER_2 1 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Osaka-blockchain_test-v=0,r=1,s=1 0 1 1
...fork_Osaka-blockchain_test-v=1,r=1,s=1 1 1 1
...fork_Osaka-blockchain_test-v=0,r=SECP256K1N-2,s=1 0 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Osaka-blockchain_test-v=1,r=SECP256K1N-2,s=1 1 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Osaka-blockchain_test-v=0,r=1,s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Osaka-blockchain_test-v=1,r=1,s=SECP256K1N_OVER_2 1 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Osaka-state_test-v=0,r=1,s=1 0 1 1
...fork_Osaka-state_test-v=1,r=1,s=1 1 1 1
...fork_Osaka-state_test-v=0,r=SECP256K1N-2,s=1 0 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Osaka-state_test-v=1,r=SECP256K1N-2,s=1 1 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Osaka-state_test-v=0,r=1,s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Osaka-state_test-v=1,r=1,s=SECP256K1N_OVER_2 1 1 57896044618658097711785492504343953926418782139537452191302581570759080747168