Skip to content

test_gas()

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

Generate fixtures for these test cases for Bogota with:

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

Test gas combinations to the ecpairing precompile.

Source code in tests/byzantium/eip197_ec_pairing/test_ecpairing.py
@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 13 forks.