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@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

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

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
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
@pytest.mark.xdist_group(name="bigmem")
@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,
    chain_config: ChainConfig,
    v: int,
    r: int,
    s: int,
) -> None:
    """
    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=chain_config.chain_id,
        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-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_Prague-blockchain_test_from_state_test-v=0,r=1,s=1 0 1 1
...fork_Prague-blockchain_test_from_state_test-v=1,r=1,s=1 1 1 1
...fork_Prague-blockchain_test_from_state_test-v=0,r=SECP256K1N-2,s=1 0 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Prague-blockchain_test_from_state_test-v=1,r=SECP256K1N-2,s=1 1 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Prague-blockchain_test_from_state_test-v=0,r=1,s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Prague-blockchain_test_from_state_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
...fork_Osaka-blockchain_test_from_state_test-v=0,r=1,s=1 0 1 1
...fork_Osaka-blockchain_test_from_state_test-v=1,r=1,s=1 1 1 1
...fork_Osaka-blockchain_test_from_state_test-v=0,r=SECP256K1N-2,s=1 0 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Osaka-blockchain_test_from_state_test-v=1,r=SECP256K1N-2,s=1 1 115792089237316195423570985008687907852837564279074904382605163141518161494335 1
...fork_Osaka-blockchain_test_from_state_test-v=0,r=1,s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Osaka-blockchain_test_from_state_test-v=1,r=1,s=SECP256K1N_OVER_2 1 1 57896044618658097711785492504343953926418782139537452191302581570759080747168