Skip to content

test_eofcreate_revert_eof_returndata()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py::test_eofcreate_revert_eof_returndata@3719e927.

Generate fixtures for these test cases for Osaka with:

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

Verifies the return data is not being deployed, even if happens to be valid EOF.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
def test_eofcreate_revert_eof_returndata(
    state_test: StateTestFiller,
    pre: Alloc,
):
    """Verifies the return data is not being deployed, even if happens to be valid EOF."""
    env = Environment()
    code_reverts_with_calldata = Container(
        name="Initcode Subcontainer reverting with its calldata",
        sections=[
            Section.Code(
                code=Op.CALLDATACOPY(0, 0, Op.CALLDATASIZE) + Op.REVERT(0, Op.CALLDATASIZE),
            ),
        ],
    )

    sender = pre.fund_eoa()
    salt = 0
    contract_address = pre.deploy_contract(
        code=Container(
            sections=[
                Section.Code(
                    code=Op.CALLDATACOPY(0, 0, Op.CALLDATASIZE)
                    + Op.SSTORE(
                        slot_create_address, Op.EOFCREATE[0](salt=salt, input_size=Op.CALLDATASIZE)
                    )
                    + Op.SSTORE(slot_returndata_size, Op.RETURNDATASIZE)
                    + Op.STOP,
                ),
                Section.Container(container=code_reverts_with_calldata),
            ],
        ),
        storage={slot_create_address: value_canary_to_be_overwritten},
    )
    eof_create_address = compute_eofcreate_address(contract_address, salt)

    post = {
        contract_address: Account(
            storage={
                slot_create_address: 0,
                slot_returndata_size: len(smallest_runtime_subcontainer),
            },
        ),
        eof_create_address: Account.NONEXISTENT,
    }

    tx = Transaction(
        to=contract_address,
        gas_limit=1_000_000,
        sender=sender,
        # Simplest possible valid EOF container, which is going to be
        # revert-returned from initcode and must not end up being deployed.
        data=smallest_runtime_subcontainer,
    )

    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