Skip to content

test_stack_access_initcode_tx()

Documentation for tests/amsterdam/eip8024_dupn_swapn_exchange/test_execution_contexts.py::test_stack_access_initcode_tx@26332146.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8024_dupn_swapn_exchange/test_execution_contexts.py::test_stack_access_initcode_tx --fork Amsterdam

Test DUPN, SWAPN and EXCHANGE inside the initcode of a contract-creating transaction.

Source code in tests/amsterdam/eip8024_dupn_swapn_exchange/test_execution_contexts.py
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
@EIPChecklist.Opcode.Test.ExecutionContext.Initcode.Behavior()
@EIPChecklist.Opcode.Test.ExecutionContext.Initcode.Behavior.Tx()
def test_stack_access_initcode_tx(
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """
    Test DUPN, SWAPN and EXCHANGE inside the initcode of a
    contract-creating transaction.
    """
    init_code = stack_access_storage_code()
    sender = pre.fund_eoa()
    contract_address = compute_create_address(address=sender, nonce=0)

    tx = Transaction(to=None, data=init_code, sender=sender)

    post = {
        contract_address: Account(storage=EXPECTED_STORAGE),
    }

    state_test(pre=pre, tx=tx, post=post)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.