Skip to content

test_simple_eofcreate()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py::test_simple_eofcreate@21fb11c8.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py::test_simple_eofcreate --fork Osaka

Verifies a simple EOFCREATE case.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
def test_simple_eofcreate(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """Verifies a simple EOFCREATE case."""
    env = Environment()
    sender = pre.fund_eoa()
    contract_address = pre.deploy_contract(
        code=Container(
            sections=[
                Section.Code(
                    code=Op.SSTORE(0, Op.EOFCREATE[0](0, 0, 0, 0)) + Op.STOP,
                ),
                Section.Container(container=smallest_initcode_subcontainer),
            ],
        ),
        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, smallest_initcode_subcontainer)
            }
        )
    }
    tx = Transaction(
        to=contract_address,
        gas_limit=10_000_000,
        gas_price=10,
        protected=False,
        sender=sender,
    )
    state_test(env=env, pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated)
...fork_Osaka-state_test
...fork_Osaka-blockchain_test_from_state_test