Skip to content

test_precompile_before_fork()

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

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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
@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.