Skip to content

test_tx_entry_point()

Documentation for tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py::test_tx_entry_point@83970623.

Generate fixtures for these test cases for Prague with:

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

Test calling the Point Evaluation Precompile directly as transaction entry point, and measure the gas consumption.

  • Using gas_limit with exact necessary gas, insufficient gas and extra gas.
  • Using correct and incorrect proofs
Source code in tests/cancun/eip4844_blobs/test_point_evaluation_precompile.py
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
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
@pytest.mark.parametrize(
    "call_gas",
    [
        (Spec.POINT_EVALUATION_PRECOMPILE_GAS),
        (Spec.POINT_EVALUATION_PRECOMPILE_GAS + 1),
        (Spec.POINT_EVALUATION_PRECOMPILE_GAS - 1),
    ],
    ids=["exact_gas", "extra_gas", "insufficient_gas"],
)
@pytest.mark.parametrize(
    "z,y,kzg_commitment,kzg_proof,versioned_hash,proof_correct",
    [
        [Z, 0, INF_POINT, INF_POINT, None, True],
        [Z, 1, INF_POINT, INF_POINT, None, False],
    ],
    ids=["correct_proof", "incorrect_proof"],
)
@pytest.mark.valid_from("Cancun")
def test_tx_entry_point(
    fork: Fork,
    state_test: StateTestFiller,
    precompile_input: bytes,
    call_gas: int,
    pre: Alloc,
    proof_correct: bool,
):
    """
    Test calling the Point Evaluation Precompile directly as
    transaction entry point, and measure the gas consumption.

    - Using `gas_limit` with exact necessary gas, insufficient gas and extra gas.
    - Using correct and incorrect proofs
    """
    sender = pre.fund_eoa()

    # Starting from EIP-7623, we need to use an access list to raise the intrinsic gas cost to be
    # above the floor data cost.
    access_list = [AccessList(address=Address(i), storage_keys=[]) for i in range(1, 10)]

    # Gas is appended the intrinsic gas cost of the transaction
    tx_intrinsic_gas_cost_calculator = fork.transaction_intrinsic_cost_calculator()
    intrinsic_gas_cost = tx_intrinsic_gas_cost_calculator(
        calldata=precompile_input, access_list=access_list
    )

    # Consumed gas will only be the precompile gas if the proof is correct and
    # the call gas is sufficient.
    # Otherwise, the call gas will be consumed in full.
    consumed_gas = (
        Spec.POINT_EVALUATION_PRECOMPILE_GAS
        if call_gas >= Spec.POINT_EVALUATION_PRECOMPILE_GAS and proof_correct
        else call_gas
    ) + tx_intrinsic_gas_cost_calculator(
        calldata=precompile_input,
        access_list=access_list,
        return_cost_deducted_prior_execution=True,
    )

    tx = Transaction(
        sender=sender,
        data=precompile_input,
        access_list=access_list,
        to=Address(Spec.POINT_EVALUATION_PRECOMPILE_ADDRESS),
        gas_limit=call_gas + intrinsic_gas_cost,
        expected_receipt=TransactionReceipt(gas_used=consumed_gas),
    )

    post = {
        sender: Account(
            nonce=1,
        )
    }

    state_test(
        env=Environment(),
        pre=pre,
        post=post,
        tx=tx,
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) z y kzg_commitment kzg_proof versioned_hash proof_correct call_gas
...fork_Cancun-blockchain_test-correct_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50000
...fork_Cancun-blockchain_test-correct_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50001
...fork_Cancun-blockchain_test-correct_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 49999
...fork_Cancun-blockchain_test-incorrect_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50000
...fork_Cancun-blockchain_test-incorrect_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50001
...fork_Cancun-blockchain_test-incorrect_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 49999
...fork_Cancun-state_test-correct_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50000
...fork_Cancun-state_test-correct_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50001
...fork_Cancun-state_test-correct_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 49999
...fork_Cancun-state_test-incorrect_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50000
...fork_Cancun-state_test-incorrect_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50001
...fork_Cancun-state_test-incorrect_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 49999
...fork_Prague-blockchain_test-correct_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50000
...fork_Prague-blockchain_test-correct_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50001
...fork_Prague-blockchain_test-correct_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 49999
...fork_Prague-blockchain_test-incorrect_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50000
...fork_Prague-blockchain_test-incorrect_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50001
...fork_Prague-blockchain_test-incorrect_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 49999
...fork_Prague-state_test-correct_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50000
...fork_Prague-state_test-correct_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50001
...fork_Prague-state_test-correct_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 49999
...fork_Prague-state_test-incorrect_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50000
...fork_Prague-state_test-incorrect_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50001
...fork_Prague-state_test-incorrect_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 49999
...fork_Osaka-blockchain_test-correct_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50000
...fork_Osaka-blockchain_test-correct_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50001
...fork_Osaka-blockchain_test-correct_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 49999
...fork_Osaka-blockchain_test-incorrect_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50000
...fork_Osaka-blockchain_test-incorrect_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50001
...fork_Osaka-blockchain_test-incorrect_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 49999
...fork_Osaka-state_test-correct_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50000
...fork_Osaka-state_test-correct_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 50001
...fork_Osaka-state_test-correct_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 0 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None True 49999
...fork_Osaka-state_test-incorrect_proof-exact_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50000
...fork_Osaka-state_test-incorrect_proof-extra_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 50001
...fork_Osaka-state_test-incorrect_proof-insufficient_gas 44434237462617176941757081182233388991875531411361848851531703873752436619102 1 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 c0000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 None False 49999