Skip to content

test_valid_tx_invalid_auth_signature()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_valid_tx_invalid_auth_signature@49a16fac.

Generate fixtures for these test cases for Prague with:

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

Test sending a transaction to set the code of an account using synthetic signatures, the transaction is valid but the authorization should not go through.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
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
@pytest.mark.parametrize(
    "v,r,s",
    [
        # V
        pytest.param(2, 1, 1, id="v=2"),
        pytest.param(27, 1, 1, id="v=27"),  # Type-0 transaction valid value
        pytest.param(28, 1, 1, id="v=28"),  # Type-0 transaction valid value
        pytest.param(35, 1, 1, id="v=35"),  # Type-0 replay-protected transaction valid value
        pytest.param(36, 1, 1, id="v=36"),  # Type-0 replay-protected transaction valid value
        pytest.param(2**8 - 1, 1, 1, id="v=2**8-1"),
        # R
        pytest.param(1, 0, 1, id="r=0"),
        pytest.param(0, SECP256K1N - 1, 1, id="r=SECP256K1N-1"),
        pytest.param(0, SECP256K1N, 1, id="r=SECP256K1N"),
        pytest.param(0, SECP256K1N + 1, 1, id="r=SECP256K1N+1"),
        pytest.param(1, 2**256 - 1, 1, id="r=2**256-1"),
        # S
        pytest.param(1, 1, 0, id="s=0"),
        pytest.param(0, 1, SECP256K1N_OVER_2 - 1, id="s=SECP256K1N_OVER_2-1"),
        pytest.param(0, 1, SECP256K1N_OVER_2, id="s=SECP256K1N_OVER_2"),
        pytest.param(0, 1, SECP256K1N_OVER_2 + 1, id="s=SECP256K1N_OVER_2+1"),
        pytest.param(0, 1, SECP256K1N - 1, id="s=SECP256K1N-1"),
        pytest.param(0, 1, SECP256K1N, id="s=SECP256K1N"),
        pytest.param(0, 1, SECP256K1N + 1, id="s=SECP256K1N+1"),
        pytest.param(0, 1, 2**256 - 1, id="s=2**256-1"),
        # All Values
        pytest.param(0, 0, 0, id="v=r=s=0"),
        pytest.param(2**8 - 1, 2**256 - 1, 2**256 - 1, id="v=2**8-1,r=s=2**256-1"),
    ],
)
def test_valid_tx_invalid_auth_signature(
    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,
    the transaction is valid but the authorization should not go through.
    """
    success_slot = 1

    callee_code = Op.SSTORE(success_slot, 1) + Op.STOP
    callee_address = pre.deploy_contract(callee_code)

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

    tx = Transaction(
        gas_limit=100_000,
        to=callee_address,
        value=0,
        authorization_list=[authorization_tuple],
        sender=pre.fund_eoa(),
    )

    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post={
            callee_address: Account(
                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=2 2 1 1
...fork_Prague-blockchain_test-v=27 27 1 1
...fork_Prague-blockchain_test-v=28 28 1 1
...fork_Prague-blockchain_test-v=35 35 1 1
...fork_Prague-blockchain_test-v=36 36 1 1
...fork_Prague-blockchain_test-v=2**8-1 255 1 1
...fork_Prague-blockchain_test-r=0 1 0 1
...fork_Prague-blockchain_test-r=SECP256K1N-1 0 115792089237316195423570985008687907852837564279074904382605163141518161494336 1
...fork_Prague-blockchain_test-r=SECP256K1N 0 115792089237316195423570985008687907852837564279074904382605163141518161494337 1
...fork_Prague-blockchain_test-r=SECP256K1N+1 0 115792089237316195423570985008687907852837564279074904382605163141518161494338 1
...fork_Prague-blockchain_test-r=2**256-1 1 115792089237316195423570985008687907853269984665640564039457584007913129639935 1
...fork_Prague-blockchain_test-s=0 1 1 0
...fork_Prague-blockchain_test-s=SECP256K1N_OVER_2-1 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747167
...fork_Prague-blockchain_test-s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Prague-blockchain_test-s=SECP256K1N_OVER_2+1 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747169
...fork_Prague-blockchain_test-s=SECP256K1N-1 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494336
...fork_Prague-blockchain_test-s=SECP256K1N 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494337
...fork_Prague-blockchain_test-s=SECP256K1N+1 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494338
...fork_Prague-blockchain_test-s=2**256-1 0 1 115792089237316195423570985008687907853269984665640564039457584007913129639935
...fork_Prague-blockchain_test-v=r=s=0 0 0 0
...fork_Prague-blockchain_test-v=2**8-1,r=s=2**256-1 255 115792089237316195423570985008687907853269984665640564039457584007913129639935 115792089237316195423570985008687907853269984665640564039457584007913129639935
...fork_Prague-state_test-v=2 2 1 1
...fork_Prague-state_test-v=27 27 1 1
...fork_Prague-state_test-v=28 28 1 1
...fork_Prague-state_test-v=35 35 1 1
...fork_Prague-state_test-v=36 36 1 1
...fork_Prague-state_test-v=2**8-1 255 1 1
...fork_Prague-state_test-r=0 1 0 1
...fork_Prague-state_test-r=SECP256K1N-1 0 115792089237316195423570985008687907852837564279074904382605163141518161494336 1
...fork_Prague-state_test-r=SECP256K1N 0 115792089237316195423570985008687907852837564279074904382605163141518161494337 1
...fork_Prague-state_test-r=SECP256K1N+1 0 115792089237316195423570985008687907852837564279074904382605163141518161494338 1
...fork_Prague-state_test-r=2**256-1 1 115792089237316195423570985008687907853269984665640564039457584007913129639935 1
...fork_Prague-state_test-s=0 1 1 0
...fork_Prague-state_test-s=SECP256K1N_OVER_2-1 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747167
...fork_Prague-state_test-s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Prague-state_test-s=SECP256K1N_OVER_2+1 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747169
...fork_Prague-state_test-s=SECP256K1N-1 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494336
...fork_Prague-state_test-s=SECP256K1N 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494337
...fork_Prague-state_test-s=SECP256K1N+1 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494338
...fork_Prague-state_test-s=2**256-1 0 1 115792089237316195423570985008687907853269984665640564039457584007913129639935
...fork_Prague-state_test-v=r=s=0 0 0 0
...fork_Prague-state_test-v=2**8-1,r=s=2**256-1 255 115792089237316195423570985008687907853269984665640564039457584007913129639935 115792089237316195423570985008687907853269984665640564039457584007913129639935
...fork_Osaka-blockchain_test-v=2 2 1 1
...fork_Osaka-blockchain_test-v=27 27 1 1
...fork_Osaka-blockchain_test-v=28 28 1 1
...fork_Osaka-blockchain_test-v=35 35 1 1
...fork_Osaka-blockchain_test-v=36 36 1 1
...fork_Osaka-blockchain_test-v=2**8-1 255 1 1
...fork_Osaka-blockchain_test-r=0 1 0 1
...fork_Osaka-blockchain_test-r=SECP256K1N-1 0 115792089237316195423570985008687907852837564279074904382605163141518161494336 1
...fork_Osaka-blockchain_test-r=SECP256K1N 0 115792089237316195423570985008687907852837564279074904382605163141518161494337 1
...fork_Osaka-blockchain_test-r=SECP256K1N+1 0 115792089237316195423570985008687907852837564279074904382605163141518161494338 1
...fork_Osaka-blockchain_test-r=2**256-1 1 115792089237316195423570985008687907853269984665640564039457584007913129639935 1
...fork_Osaka-blockchain_test-s=0 1 1 0
...fork_Osaka-blockchain_test-s=SECP256K1N_OVER_2-1 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747167
...fork_Osaka-blockchain_test-s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Osaka-blockchain_test-s=SECP256K1N_OVER_2+1 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747169
...fork_Osaka-blockchain_test-s=SECP256K1N-1 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494336
...fork_Osaka-blockchain_test-s=SECP256K1N 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494337
...fork_Osaka-blockchain_test-s=SECP256K1N+1 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494338
...fork_Osaka-blockchain_test-s=2**256-1 0 1 115792089237316195423570985008687907853269984665640564039457584007913129639935
...fork_Osaka-blockchain_test-v=r=s=0 0 0 0
...fork_Osaka-blockchain_test-v=2**8-1,r=s=2**256-1 255 115792089237316195423570985008687907853269984665640564039457584007913129639935 115792089237316195423570985008687907853269984665640564039457584007913129639935
...fork_Osaka-state_test-v=2 2 1 1
...fork_Osaka-state_test-v=27 27 1 1
...fork_Osaka-state_test-v=28 28 1 1
...fork_Osaka-state_test-v=35 35 1 1
...fork_Osaka-state_test-v=36 36 1 1
...fork_Osaka-state_test-v=2**8-1 255 1 1
...fork_Osaka-state_test-r=0 1 0 1
...fork_Osaka-state_test-r=SECP256K1N-1 0 115792089237316195423570985008687907852837564279074904382605163141518161494336 1
...fork_Osaka-state_test-r=SECP256K1N 0 115792089237316195423570985008687907852837564279074904382605163141518161494337 1
...fork_Osaka-state_test-r=SECP256K1N+1 0 115792089237316195423570985008687907852837564279074904382605163141518161494338 1
...fork_Osaka-state_test-r=2**256-1 1 115792089237316195423570985008687907853269984665640564039457584007913129639935 1
...fork_Osaka-state_test-s=0 1 1 0
...fork_Osaka-state_test-s=SECP256K1N_OVER_2-1 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747167
...fork_Osaka-state_test-s=SECP256K1N_OVER_2 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747168
...fork_Osaka-state_test-s=SECP256K1N_OVER_2+1 0 1 57896044618658097711785492504343953926418782139537452191302581570759080747169
...fork_Osaka-state_test-s=SECP256K1N-1 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494336
...fork_Osaka-state_test-s=SECP256K1N 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494337
...fork_Osaka-state_test-s=SECP256K1N+1 0 1 115792089237316195423570985008687907852837564279074904382605163141518161494338
...fork_Osaka-state_test-s=2**256-1 0 1 115792089237316195423570985008687907853269984665640564039457584007913129639935
...fork_Osaka-state_test-v=r=s=0 0 0 0
...fork_Osaka-state_test-v=2**8-1,r=s=2**256-1 255 115792089237316195423570985008687907853269984665640564039457584007913129639935 115792089237316195423570985008687907853269984665640564039457584007913129639935