Skip to content

test_set_code_to_non_empty_storage_non_zero_nonce()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_to_non_empty_storage_non_zero_nonce@3719e927.

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_to_non_empty_storage_non_zero_nonce --fork Prague

Test the setting the code to an account that has non-empty storage.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
def test_set_code_to_non_empty_storage_non_zero_nonce(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """Test the setting the code to an account that has non-empty storage."""
    auth_signer = pre.fund_eoa(
        amount=0,
        storage=Storage({0: 1}),  # type: ignore
    )
    sender = pre.fund_eoa()

    set_code = Op.SSTORE(0, Op.ADD(Op.SLOAD(0), 1)) + Op.STOP
    set_code_to_address = pre.deploy_contract(
        set_code,
    )

    tx = Transaction(
        gas_limit=500_000,
        to=auth_signer,
        value=0,
        authorization_list=[
            AuthorizationTuple(
                address=set_code_to_address,
                nonce=auth_signer.nonce,
                signer=auth_signer,
            ),
        ],
        sender=sender,
    )

    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post={
            set_code_to_address: Account(
                storage={},
            ),
            auth_signer: Account(
                storage={0: 2},
            ),
        },
    )

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