Skip to content

test_static_flag_eofcreate()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate_failures.py::test_static_flag_eofcreate@21fb11c8.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate_failures.py::test_static_flag_eofcreate --fork Osaka

Verifies correct handling of the static call flag with EOFCREATE.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate_failures.py
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
@pytest.mark.parametrize(
    "opcode",
    [
        Op.STATICCALL,
        Op.EXTSTATICCALL,
    ],
)
@pytest.mark.parametrize("endowment", [0, 1])  # included to verify static flag check comes first
@pytest.mark.parametrize(
    "initcode",
    [smallest_initcode_subcontainer, aborting_container],
    ids=["working_initcode", "aborting_code"],
)
def test_static_flag_eofcreate(
    state_test: StateTestFiller,
    pre: Alloc,
    opcode: Op,
    endowment: int,
    initcode: Container,
):
    """Verifies correct handling of the static call flag with EOFCREATE."""
    env = Environment()
    sender = pre.fund_eoa()
    contract_address = pre.deploy_contract(
        code=Container(
            sections=[
                Section.Code(
                    code=Op.EOFCREATE[0](value=endowment) + Op.STOP,
                ),
                Section.Container(container=initcode),
            ]
        )
    )
    calling_code = (
        Op.SSTORE(slot_call_result, opcode(address=contract_address))
        + Op.SSTORE(slot_code_worked, value_code_worked)
        + Op.STOP
    )
    calling_address = pre.deploy_contract(
        Container.Code(calling_code) if opcode == Op.EXTSTATICCALL else calling_code
    )

    post = {
        calling_address: Account(
            storage={
                slot_call_result: EXTCALL_FAILURE
                if opcode == Op.EXTSTATICCALL
                else LEGACY_CALL_FAILURE,
                slot_code_worked: value_code_worked,
            }
        )
    }
    tx = Transaction(
        to=calling_address,
        gas_limit=10_000_000,
        protected=False,
        sender=sender,
    )

    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) initcode endowment opcode
...fork_Osaka-state_test-working_initcode-endowment_0-opcode_STATICCALL Initcode Subcontainer 0 STATICCALL
...fork_Osaka-state_test-working_initcode-endowment_0-opcode_EXTSTATICCALL Initcode Subcontainer 0 EXTSTATICCALL
...fork_Osaka-state_test-working_initcode-endowment_1-opcode_STATICCALL Initcode Subcontainer 1 STATICCALL
...fork_Osaka-state_test-working_initcode-endowment_1-opcode_EXTSTATICCALL Initcode Subcontainer 1 EXTSTATICCALL
...fork_Osaka-state_test-aborting_code-endowment_0-opcode_STATICCALL b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\x04\x00\x00\x00\x00\x80\x00\x00\xfe' 0 STATICCALL
...fork_Osaka-state_test-aborting_code-endowment_0-opcode_EXTSTATICCALL b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\x04\x00\x00\x00\x00\x80\x00\x00\xfe' 0 EXTSTATICCALL
...fork_Osaka-state_test-aborting_code-endowment_1-opcode_STATICCALL b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\x04\x00\x00\x00\x00\x80\x00\x00\xfe' 1 STATICCALL
...fork_Osaka-state_test-aborting_code-endowment_1-opcode_EXTSTATICCALL b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\x04\x00\x00\x00\x00\x80\x00\x00\xfe' 1 EXTSTATICCALL
...fork_Osaka-blockchain_test_from_state_test-working_initcode-endowment_0-opcode_STATICCALL Initcode Subcontainer 0 STATICCALL
...fork_Osaka-blockchain_test_from_state_test-working_initcode-endowment_0-opcode_EXTSTATICCALL Initcode Subcontainer 0 EXTSTATICCALL
...fork_Osaka-blockchain_test_from_state_test-working_initcode-endowment_1-opcode_STATICCALL Initcode Subcontainer 1 STATICCALL
...fork_Osaka-blockchain_test_from_state_test-working_initcode-endowment_1-opcode_EXTSTATICCALL Initcode Subcontainer 1 EXTSTATICCALL
...fork_Osaka-blockchain_test_from_state_test-aborting_code-endowment_0-opcode_STATICCALL b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\x04\x00\x00\x00\x00\x80\x00\x00\xfe' 0 STATICCALL
...fork_Osaka-blockchain_test_from_state_test-aborting_code-endowment_0-opcode_EXTSTATICCALL b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\x04\x00\x00\x00\x00\x80\x00\x00\xfe' 0 EXTSTATICCALL
...fork_Osaka-blockchain_test_from_state_test-aborting_code-endowment_1-opcode_STATICCALL b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\x04\x00\x00\x00\x00\x80\x00\x00\xfe' 1 STATICCALL
...fork_Osaka-blockchain_test_from_state_test-aborting_code-endowment_1-opcode_EXTSTATICCALL b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\x04\x00\x00\x00\x00\x80\x00\x00\xfe' 1 EXTSTATICCALL