Skip to content

test_gas()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp2_to_g2.py::test_gas@21fb11c8.

Generate fixtures for these test cases for Prague with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp2_to_g2.py::test_gas --fork Prague

Test the BLS12_MAP_FP_TO_G2 precompile gas requirements.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp2_to_g2.py
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
@pytest.mark.parametrize(
    "input_data,expected_output,precompile_gas_modifier",
    [
        pytest.param(
            FP2((0, 0)),
            G2_POINT_ZERO_FP,
            1,
            id="extra_gas",
        ),
        pytest.param(
            FP2((0, 0)),
            Spec.INVALID,
            -1,
            id="insufficient_gas",
        ),
    ],
)
def test_gas(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
):
    """Test the BLS12_MAP_FP_TO_G2 precompile gas requirements."""
    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

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

Test ID (Abbreviated) input_data expected_output precompile_gas_modifier precompile_address
...fork_Prague-state_test-extra_gas- FP2(x=(0, 0)) PointG2(x=(232751224930677745396095561951152042576424604713130436843934548678666406429167866909490329228404544352148194115534, 1601558386896345240320690342453673501793035385728549575803514192020355846653238172333813953555511850549100476205202), y=(366072527324011932385571544496195798415567032250142018360048479110276041591259208603171511238009482094790662379841, 735055000775559535481906131992536480072884649650286758007297964611137923289749918348543505818551800823925955026780)) 1 17
...fork_Prague-state_test-insufficient_gas- FP2(x=(0, 0)) -1 17
...fork_Prague-blockchain_test_from_state_test-extra_gas- FP2(x=(0, 0)) PointG2(x=(232751224930677745396095561951152042576424604713130436843934548678666406429167866909490329228404544352148194115534, 1601558386896345240320690342453673501793035385728549575803514192020355846653238172333813953555511850549100476205202), y=(366072527324011932385571544496195798415567032250142018360048479110276041591259208603171511238009482094790662379841, 735055000775559535481906131992536480072884649650286758007297964611137923289749918348543505818551800823925955026780)) 1 17
...fork_Prague-blockchain_test_from_state_test-insufficient_gas- FP2(x=(0, 0)) -1 17
...fork_Osaka-state_test-extra_gas- FP2(x=(0, 0)) PointG2(x=(232751224930677745396095561951152042576424604713130436843934548678666406429167866909490329228404544352148194115534, 1601558386896345240320690342453673501793035385728549575803514192020355846653238172333813953555511850549100476205202), y=(366072527324011932385571544496195798415567032250142018360048479110276041591259208603171511238009482094790662379841, 735055000775559535481906131992536480072884649650286758007297964611137923289749918348543505818551800823925955026780)) 1 17
...fork_Osaka-state_test-insufficient_gas- FP2(x=(0, 0)) -1 17
...fork_Osaka-blockchain_test_from_state_test-extra_gas- FP2(x=(0, 0)) PointG2(x=(232751224930677745396095561951152042576424604713130436843934548678666406429167866909490329228404544352148194115534, 1601558386896345240320690342453673501793035385728549575803514192020355846653238172333813953555511850549100476205202), y=(366072527324011932385571544496195798415567032250142018360048479110276041591259208603171511238009482094790662379841, 735055000775559535481906131992536480072884649650286758007297964611137923289749918348543505818551800823925955026780)) 1 17
...fork_Osaka-blockchain_test_from_state_test-insufficient_gas- FP2(x=(0, 0)) -1 17