Skip to content

test_precompile_before_fork()

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

Generate fixtures for these test cases for Prague with:

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

Test calling the Point Evaluation Precompile before the appropriate fork.

Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
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
@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,
):
    """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 case is only parametrized by fork and fixture format.

Test ID (Abbreviated) precompile_caller_code precompile_caller_balance precompile_caller_storage z y kzg_commitment kzg_proof versioned_hash
...fork_ShanghaiToCancunAtTime15k-blockchain_test----correct_proof 1 {} 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None
...fork_ShanghaiToCancunAtTime15k-state_test----correct_proof 1 {} 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None