Skip to content

test_valid_gas_g2msm()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_valid_gas_g2msm@verkle@v0.0.6.

Generate fixtures for these test cases for Prague with:

Prague only:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_valid_gas_g2msm --fork=Prague --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Prague:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_valid_gas_g2msm --until=Prague

Test the BLS12_G2MSM discount gas table in full, by expecting the call to succeed for all possible input lengths because the appropriate amount of gas is provided.

If any of the calls fail, the test will fail.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
@pytest.mark.parametrize(
    "precompile_gas_list,precompile_data_length_list",
    [
        pytest.param(
            [G2_GAS(i * G2_MSM_K_INPUT_LENGTH) for i in range(1, len(Spec.MSM_DISCOUNT_TABLE))],
            [i * G2_MSM_K_INPUT_LENGTH for i in range(1, len(Spec.MSM_DISCOUNT_TABLE))],
            id="exact_gas_full_discount_table",
        ),
        pytest.param(
            [
                G2_GAS(i * G2_MSM_K_INPUT_LENGTH) + 1
                for i in range(1, len(Spec.MSM_DISCOUNT_TABLE))
            ],
            [i * G2_MSM_K_INPUT_LENGTH for i in range(1, len(Spec.MSM_DISCOUNT_TABLE))],
            id="one_extra_gas_full_discount_table",
        ),
    ],
)
@pytest.mark.parametrize("expected_output", [PointG2()], ids=[""])
@pytest.mark.parametrize("tx_gas_limit", [100_000_000], ids=[""])
@pytest.mark.parametrize("precompile_address", [Spec.G2MSM])
def test_valid_gas_g2msm(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
):
    """
    Test the BLS12_G2MSM discount gas table in full, by expecting the call to succeed for
    all possible input lengths because the appropriate amount of gas is provided.

    If any of the calls fail, the test will fail.
    """
    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

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

Skipped Parameters

For more concise readability, the table below does not list the following parameter values: fork, blockchain_test, state_test, state_test_only, eof_test, eof_state_test.

Test ID precompile_address tx_gas_limit expected_output precompile_gas_list precompile_data_length_list
precompile_address_16---exact_gas_full_discount_table 16 100000000 PointG2(x=(0, 0), y=(0, 0)) [54000, 79920, 103140, 115380, 133650, 147690, 157500, 163080, 177390, 190350, 201960, 212760, 221715, 229320, 235575, 240480, 252450, 264060, 275310, 286200, 296730, 306900, 316710, 326160, 335250, 343980, 351135, 359100, 366705, 373950, 380835, 387360, 397980, 406980, 417375, 426060, 436230, 444600, 454545, 462600, 472320, 480060, 489555, 496980, 506250, 513360, 522405, 529200, 538020, 544500, 553095, 559260, 567630, 573480, 581625, 587160, 595080, 602910, 607995, 615600, 620370, 627750, 632205, 639360, 646425, 653400, 660285, 670140, 676890, 683550, 690120, 699840, 706275, 712620, 718875, 728460, 734580, 740610, 750105, 756000, 761805, 767520, 776880, 782460, 787950, 793350, 802575, 807840, 813015, 818100, 827190, 832140, 837000, 841770, 850725, 855360, 859905, 864360, 873180, 877500, 881730, 885870, 894555, 898560, 902475, 911070, 914850, 918540, 922140, 930600, 934065, 937440, 940725, 949050, 952200, 955260, 958230, 966420, 969255, 972000, 974655, 982710, 985230, 987660, 990000, 997920, 1000125, 1002240] [288, 576, 864, 1152, 1440, 1728, 2016, 2304, 2592, 2880, 3168, 3456, 3744, 4032, 4320, 4608, 4896, 5184, 5472, 5760, 6048, 6336, 6624, 6912, 7200, 7488, 7776, 8064, 8352, 8640, 8928, 9216, 9504, 9792, 10080, 10368, 10656, 10944, 11232, 11520, 11808, 12096, 12384, 12672, 12960, 13248, 13536, 13824, 14112, 14400, 14688, 14976, 15264, 15552, 15840, 16128, 16416, 16704, 16992, 17280, 17568, 17856, 18144, 18432, 18720, 19008, 19296, 19584, 19872, 20160, 20448, 20736, 21024, 21312, 21600, 21888, 22176, 22464, 22752, 23040, 23328, 23616, 23904, 24192, 24480, 24768, 25056, 25344, 25632, 25920, 26208, 26496, 26784, 27072, 27360, 27648, 27936, 28224, 28512, 28800, 29088, 29376, 29664, 29952, 30240, 30528, 30816, 31104, 31392, 31680, 31968, 32256, 32544, 32832, 33120, 33408, 33696, 33984, 34272, 34560, 34848, 35136, 35424, 35712, 36000, 36288, 36576, 36864]
precompile_address_16---one_extra_gas_full_discount_table 16 100000000 PointG2(x=(0, 0), y=(0, 0)) [54001, 79921, 103141, 115381, 133651, 147691, 157501, 163081, 177391, 190351, 201961, 212761, 221716, 229321, 235576, 240481, 252451, 264061, 275311, 286201, 296731, 306901, 316711, 326161, 335251, 343981, 351136, 359101, 366706, 373951, 380836, 387361, 397981, 406981, 417376, 426061, 436231, 444601, 454546, 462601, 472321, 480061, 489556, 496981, 506251, 513361, 522406, 529201, 538021, 544501, 553096, 559261, 567631, 573481, 581626, 587161, 595081, 602911, 607996, 615601, 620371, 627751, 632206, 639361, 646426, 653401, 660286, 670141, 676891, 683551, 690121, 699841, 706276, 712621, 718876, 728461, 734581, 740611, 750106, 756001, 761806, 767521, 776881, 782461, 787951, 793351, 802576, 807841, 813016, 818101, 827191, 832141, 837001, 841771, 850726, 855361, 859906, 864361, 873181, 877501, 881731, 885871, 894556, 898561, 902476, 911071, 914851, 918541, 922141, 930601, 934066, 937441, 940726, 949051, 952201, 955261, 958231, 966421, 969256, 972001, 974656, 982711, 985231, 987661, 990001, 997921, 1000126, 1002241] [288, 576, 864, 1152, 1440, 1728, 2016, 2304, 2592, 2880, 3168, 3456, 3744, 4032, 4320, 4608, 4896, 5184, 5472, 5760, 6048, 6336, 6624, 6912, 7200, 7488, 7776, 8064, 8352, 8640, 8928, 9216, 9504, 9792, 10080, 10368, 10656, 10944, 11232, 11520, 11808, 12096, 12384, 12672, 12960, 13248, 13536, 13824, 14112, 14400, 14688, 14976, 15264, 15552, 15840, 16128, 16416, 16704, 16992, 17280, 17568, 17856, 18144, 18432, 18720, 19008, 19296, 19584, 19872, 20160, 20448, 20736, 21024, 21312, 21600, 21888, 22176, 22464, 22752, 23040, 23328, 23616, 23904, 24192, 24480, 24768, 25056, 25344, 25632, 25920, 26208, 26496, 26784, 27072, 27360, 27648, 27936, 28224, 28512, 28800, 29088, 29376, 29664, 29952, 30240, 30528, 30816, 31104, 31392, 31680, 31968, 32256, 32544, 32832, 33120, 33408, 33696, 33984, 34272, 34560, 34848, 35136, 35424, 35712, 36000, 36288, 36576, 36864]
precompile_address_16---exact_gas_full_discount_table 16 100000000 PointG2(x=(0, 0), y=(0, 0)) [54000, 79920, 103140, 115380, 133650, 147690, 157500, 163080, 177390, 190350, 201960, 212760, 221715, 229320, 235575, 240480, 252450, 264060, 275310, 286200, 296730, 306900, 316710, 326160, 335250, 343980, 351135, 359100, 366705, 373950, 380835, 387360, 397980, 406980, 417375, 426060, 436230, 444600, 454545, 462600, 472320, 480060, 489555, 496980, 506250, 513360, 522405, 529200, 538020, 544500, 553095, 559260, 567630, 573480, 581625, 587160, 595080, 602910, 607995, 615600, 620370, 627750, 632205, 639360, 646425, 653400, 660285, 670140, 676890, 683550, 690120, 699840, 706275, 712620, 718875, 728460, 734580, 740610, 750105, 756000, 761805, 767520, 776880, 782460, 787950, 793350, 802575, 807840, 813015, 818100, 827190, 832140, 837000, 841770, 850725, 855360, 859905, 864360, 873180, 877500, 881730, 885870, 894555, 898560, 902475, 911070, 914850, 918540, 922140, 930600, 934065, 937440, 940725, 949050, 952200, 955260, 958230, 966420, 969255, 972000, 974655, 982710, 985230, 987660, 990000, 997920, 1000125, 1002240] [288, 576, 864, 1152, 1440, 1728, 2016, 2304, 2592, 2880, 3168, 3456, 3744, 4032, 4320, 4608, 4896, 5184, 5472, 5760, 6048, 6336, 6624, 6912, 7200, 7488, 7776, 8064, 8352, 8640, 8928, 9216, 9504, 9792, 10080, 10368, 10656, 10944, 11232, 11520, 11808, 12096, 12384, 12672, 12960, 13248, 13536, 13824, 14112, 14400, 14688, 14976, 15264, 15552, 15840, 16128, 16416, 16704, 16992, 17280, 17568, 17856, 18144, 18432, 18720, 19008, 19296, 19584, 19872, 20160, 20448, 20736, 21024, 21312, 21600, 21888, 22176, 22464, 22752, 23040, 23328, 23616, 23904, 24192, 24480, 24768, 25056, 25344, 25632, 25920, 26208, 26496, 26784, 27072, 27360, 27648, 27936, 28224, 28512, 28800, 29088, 29376, 29664, 29952, 30240, 30528, 30816, 31104, 31392, 31680, 31968, 32256, 32544, 32832, 33120, 33408, 33696, 33984, 34272, 34560, 34848, 35136, 35424, 35712, 36000, 36288, 36576, 36864]
precompile_address_16---one_extra_gas_full_discount_table 16 100000000 PointG2(x=(0, 0), y=(0, 0)) [54001, 79921, 103141, 115381, 133651, 147691, 157501, 163081, 177391, 190351, 201961, 212761, 221716, 229321, 235576, 240481, 252451, 264061, 275311, 286201, 296731, 306901, 316711, 326161, 335251, 343981, 351136, 359101, 366706, 373951, 380836, 387361, 397981, 406981, 417376, 426061, 436231, 444601, 454546, 462601, 472321, 480061, 489556, 496981, 506251, 513361, 522406, 529201, 538021, 544501, 553096, 559261, 567631, 573481, 581626, 587161, 595081, 602911, 607996, 615601, 620371, 627751, 632206, 639361, 646426, 653401, 660286, 670141, 676891, 683551, 690121, 699841, 706276, 712621, 718876, 728461, 734581, 740611, 750106, 756001, 761806, 767521, 776881, 782461, 787951, 793351, 802576, 807841, 813016, 818101, 827191, 832141, 837001, 841771, 850726, 855361, 859906, 864361, 873181, 877501, 881731, 885871, 894556, 898561, 902476, 911071, 914851, 918541, 922141, 930601, 934066, 937441, 940726, 949051, 952201, 955261, 958231, 966421, 969256, 972001, 974656, 982711, 985231, 987661, 990001, 997921, 1000126, 1002241] [288, 576, 864, 1152, 1440, 1728, 2016, 2304, 2592, 2880, 3168, 3456, 3744, 4032, 4320, 4608, 4896, 5184, 5472, 5760, 6048, 6336, 6624, 6912, 7200, 7488, 7776, 8064, 8352, 8640, 8928, 9216, 9504, 9792, 10080, 10368, 10656, 10944, 11232, 11520, 11808, 12096, 12384, 12672, 12960, 13248, 13536, 13824, 14112, 14400, 14688, 14976, 15264, 15552, 15840, 16128, 16416, 16704, 16992, 17280, 17568, 17856, 18144, 18432, 18720, 19008, 19296, 19584, 19872, 20160, 20448, 20736, 21024, 21312, 21600, 21888, 22176, 22464, 22752, 23040, 23328, 23616, 23904, 24192, 24480, 24768, 25056, 25344, 25632, 25920, 26208, 26496, 26784, 27072, 27360, 27648, 27936, 28224, 28512, 28800, 29088, 29376, 29664, 29952, 30240, 30528, 30816, 31104, 31392, 31680, 31968, 32256, 32544, 32832, 33120, 33408, 33696, 33984, 34272, 34560, 34848, 35136, 35424, 35712, 36000, 36288, 36576, 36864]