Skip to content

test_simple_txcreate()

Documentation for tests/osaka/eip7692_eof_v1/eip7873_tx_create/test_txcreate.py::test_simple_txcreate@v4.4.0.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip7873_tx_create/test_txcreate.py::test_simple_txcreate --fork Osaka

Verifies a simple TXCREATE case.

Source code in tests/osaka/eip7692_eof_v1/eip7873_tx_create/test_txcreate.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@pytest.mark.with_all_evm_code_types
@pytest.mark.parametrize("tx_initcode_count", [1, 255, 256])
def test_simple_txcreate(state_test: StateTestFiller, pre: Alloc, tx_initcode_count: int):
    """Verifies a simple TXCREATE case."""
    env = Environment()
    sender = pre.fund_eoa()
    initcode_hash = smallest_initcode_subcontainer.hash
    contract_address = pre.deploy_contract(
        code=Op.SSTORE(0, Op.TXCREATE(tx_initcode_hash=initcode_hash)) + Op.STOP,
        storage={0: 0xB17D},  # a canary to be overwritten
    )
    # Storage in 0 should have the address,
    post = {contract_address: Account(storage={0: compute_eofcreate_address(contract_address, 0)})}
    tx = Transaction(
        to=contract_address,
        gas_limit=10_000_000,
        sender=sender,
        initcodes=[smallest_initcode_subcontainer] * tx_initcode_count,
    )
    state_test(env=env, pre=pre, post=post, tx=tx)

Parametrized Test Cases

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

Test ID (Abbreviated) evm_code_type tx_initcode_count
...fork_Osaka-evm_code_type_LEGACY-state_test-tx_initcode_count_1 LEGACY 1
...fork_Osaka-evm_code_type_LEGACY-state_test-tx_initcode_count_255 LEGACY 255
...fork_Osaka-evm_code_type_LEGACY-state_test-tx_initcode_count_256 LEGACY 256
...fork_Osaka-evm_code_type_LEGACY-blockchain_test_from_state_test-tx_initcode_count_1 LEGACY 1
...fork_Osaka-evm_code_type_LEGACY-blockchain_test_from_state_test-tx_initcode_count_255 LEGACY 255
...fork_Osaka-evm_code_type_LEGACY-blockchain_test_from_state_test-tx_initcode_count_256 LEGACY 256
...fork_Osaka-evm_code_type_EOF_V1-state_test-tx_initcode_count_1 EOF_V1 1
...fork_Osaka-evm_code_type_EOF_V1-state_test-tx_initcode_count_255 EOF_V1 255
...fork_Osaka-evm_code_type_EOF_V1-state_test-tx_initcode_count_256 EOF_V1 256
...fork_Osaka-evm_code_type_EOF_V1-blockchain_test_from_state_test-tx_initcode_count_1 EOF_V1 1
...fork_Osaka-evm_code_type_EOF_V1-blockchain_test_from_state_test-tx_initcode_count_255 EOF_V1 255
...fork_Osaka-evm_code_type_EOF_V1-blockchain_test_from_state_test-tx_initcode_count_256 EOF_V1 256