Skip to content

test_gas()

Documentation for tests/byzantium/eip197_ec_pairing/test_ecpairing.py::test_gas@8db70f93.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/byzantium/eip197_ec_pairing/test_ecpairing.py::test_gas --fork Amsterdam

Test gas combinations to the ecpairing precompile.

Source code in tests/byzantium/eip197_ec_pairing/test_ecpairing.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
@pytest.mark.parametrize(
    "input_data, expected_output, precompile_gas_modifier",
    [
        pytest.param(
            b"",
            Spec.INVALID,
            -1,
            id="empty_data_insufficient_gas",
        ),
        pytest.param(
            Spec.G1 + Spec.G2,
            Spec.INVALID,
            -1,
            id="one_pair_insufficient_gas",
        ),
        pytest.param(
            Spec.G1 + Spec.G2 + PointG1(0x1, Spec.P - 2) + Spec.G2,
            Spec.INVALID,
            -1,
            id="two_point_oog",
        ),
    ],
)
@pytest.mark.ported_from(
    [
        "https://github.com/ethereum/legacytests/tree/master/Cancun/GeneralStateTests/stZeroKnowledge/ecpairing_empty_data_insufficient_gasFiller.json",
        "https://github.com/ethereum/legacytests/tree/master/Cancun/GeneralStateTests/stZeroKnowledge/ecpairing_one_point_insufficient_gasFiller.json",
        "https://github.com/ethereum/legacytests/tree/master/Cancun/GeneralStateTests/stZeroKnowledge/ecpairing_two_point_oogFiller.json",
    ],
    pr=["https://github.com/ethereum/execution-specs/pull/2422"],
)
def test_gas(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """Test gas combinations to the ecpairing precompile."""
    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 3 parametrized test cases across 12 forks.