Skip to content

test_precompile_before_fork()

Documentation for tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_precompile_before_fork@26332146.

Generate fixtures for these test cases for Cancun with:

fill -v tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_precompile_before_fork --fork Cancun

Test calling the Point Evaluation Precompile before the appropriate fork.

Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
@pytest.mark.parametrize(
    "z,y,kzg_commitment,kzg_proof,versioned_hash",
    [[Z, 0, INF_POINT, INF_POINT, None]],
    ids=["correct_proof"],
)
@pytest.mark.parametrize("precompile_caller_storage", [{}], ids=[""])
@pytest.mark.parametrize("precompile_caller_balance", [1], ids=[""])
@pytest.mark.parametrize(
    "precompile_caller_code",
    [
        Op.CALLDATACOPY(0, 0, Op.CALLDATASIZE)
        + Op.SSTORE(
            Op.NUMBER,
            Op.CALL(
                address=Spec.POINT_EVALUATION_PRECOMPILE_ADDRESS,
                value=1,
                args_size=Op.CALLDATASIZE,
            ),
        )
    ],
    ids=[""],
)
@pytest.mark.valid_at_transition_to("Cancun")
def test_precompile_before_fork(
    state_test: StateTestFiller,
    pre: Alloc,
    tx: Transaction,
    precompile_caller_address: Address,
) -> None:
    """
    Test calling the Point Evaluation Precompile before the appropriate fork.
    """
    post = {
        precompile_caller_address: Account(
            storage={1: 1},
            # The call succeeds because precompile is not there yet
        ),
        Address(Spec.POINT_EVALUATION_PRECOMPILE_ADDRESS): Account(
            balance=1,
        ),
    }

    state_test(
        pre=pre,
        env=Environment(timestamp=7_500),
        post=post,
        tx=tx,
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.