Skip to content

test_eofcreate_then_dataload()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py::test_eofcreate_then_dataload@01f496f4.

Generate fixtures for these test cases for Osaka with:

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

Verifies that a contract returned with auxdata does not overwrite the parent data.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
def test_eofcreate_then_dataload(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """Verifies that a contract returned with auxdata does not overwrite the parent data."""
    env = Environment()
    sender = pre.fund_eoa()
    small_auxdata_container = Container(
        sections=[
            Section.Code(code=Op.RETURNCODE[0](0, 32)),
            Section.Container(container=smallest_runtime_subcontainer),
        ],
    )
    contract_address = pre.deploy_contract(
        code=Container(
            sections=[
                Section.Code(
                    code=Op.SSTORE(0, Op.EOFCREATE[0](0, 0, 0, 0))
                    + Op.SSTORE(slot_data_load, Op.DATALOAD(0))
                    + Op.STOP,
                ),
                Section.Container(
                    container=small_auxdata_container,
                ),
                Section.Data(data=value_long_value),
            ],
        ),
        storage={slot_data_load: value_canary_to_be_overwritten},
    )

    post = {
        contract_address: Account(
            storage={
                0: compute_eofcreate_address(contract_address, 0, small_auxdata_container),
                slot_data_load: value_long_value,
            }
        )
    }
    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