Skip to content

test_invalid_length_g2msm()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_invalid_length_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_invalid_length_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_invalid_length_g2msm --until=Prague

Test the BLS12_G2MSM discount gas table in full, by expecting the call to fail for all possible input lengths provided because they are too long or short, or zero length.

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

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
@pytest.mark.parametrize(
    "precompile_gas_list,precompile_data_length_list",
    [
        pytest.param(
            [G2_GAS(G2_MSM_K_INPUT_LENGTH)],
            [0],
            id="zero_length_input",
        ),
        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) - 1 for i in range(1, len(Spec.MSM_DISCOUNT_TABLE))],
            id="input_one_byte_too_short_full_discount_table",
        ),
        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) + 1 for i in range(1, len(Spec.MSM_DISCOUNT_TABLE))],
            id="input_one_byte_too_long_full_discount_table",
        ),
    ],
)
@pytest.mark.parametrize("expected_output", [Spec.INVALID], ids=[""])
@pytest.mark.parametrize("tx_gas_limit", [100_000_000], ids=[""])
@pytest.mark.parametrize("precompile_address", [Spec.G2MSM])
def test_invalid_length_g2msm(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
):
    """
    Test the BLS12_G2MSM discount gas table in full, by expecting the call to fail for
    all possible input lengths provided because they are too long or short, or zero length.

    If any of the calls succeeds, 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---zero_length_input 16 100000000 [54000] [0]
precompile_address_16---input_one_byte_too_short_full_discount_table 16 100000000 [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] [287, 575, 863, 1151, 1439, 1727, 2015, 2303, 2591, 2879, 3167, 3455, 3743, 4031, 4319, 4607, 4895, 5183, 5471, 5759, 6047, 6335, 6623, 6911, 7199, 7487, 7775, 8063, 8351, 8639, 8927, 9215, 9503, 9791, 10079, 10367, 10655, 10943, 11231, 11519, 11807, 12095, 12383, 12671, 12959, 13247, 13535, 13823, 14111, 14399, 14687, 14975, 15263, 15551, 15839, 16127, 16415, 16703, 16991, 17279, 17567, 17855, 18143, 18431, 18719, 19007, 19295, 19583, 19871, 20159, 20447, 20735, 21023, 21311, 21599, 21887, 22175, 22463, 22751, 23039, 23327, 23615, 23903, 24191, 24479, 24767, 25055, 25343, 25631, 25919, 26207, 26495, 26783, 27071, 27359, 27647, 27935, 28223, 28511, 28799, 29087, 29375, 29663, 29951, 30239, 30527, 30815, 31103, 31391, 31679, 31967, 32255, 32543, 32831, 33119, 33407, 33695, 33983, 34271, 34559, 34847, 35135, 35423, 35711, 35999, 36287, 36575, 36863]
precompile_address_16---input_one_byte_too_long_full_discount_table 16 100000000 [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] [289, 577, 865, 1153, 1441, 1729, 2017, 2305, 2593, 2881, 3169, 3457, 3745, 4033, 4321, 4609, 4897, 5185, 5473, 5761, 6049, 6337, 6625, 6913, 7201, 7489, 7777, 8065, 8353, 8641, 8929, 9217, 9505, 9793, 10081, 10369, 10657, 10945, 11233, 11521, 11809, 12097, 12385, 12673, 12961, 13249, 13537, 13825, 14113, 14401, 14689, 14977, 15265, 15553, 15841, 16129, 16417, 16705, 16993, 17281, 17569, 17857, 18145, 18433, 18721, 19009, 19297, 19585, 19873, 20161, 20449, 20737, 21025, 21313, 21601, 21889, 22177, 22465, 22753, 23041, 23329, 23617, 23905, 24193, 24481, 24769, 25057, 25345, 25633, 25921, 26209, 26497, 26785, 27073, 27361, 27649, 27937, 28225, 28513, 28801, 29089, 29377, 29665, 29953, 30241, 30529, 30817, 31105, 31393, 31681, 31969, 32257, 32545, 32833, 33121, 33409, 33697, 33985, 34273, 34561, 34849, 35137, 35425, 35713, 36001, 36289, 36577, 36865]
precompile_address_16---zero_length_input 16 100000000 [54000] [0]
precompile_address_16---input_one_byte_too_short_full_discount_table 16 100000000 [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] [287, 575, 863, 1151, 1439, 1727, 2015, 2303, 2591, 2879, 3167, 3455, 3743, 4031, 4319, 4607, 4895, 5183, 5471, 5759, 6047, 6335, 6623, 6911, 7199, 7487, 7775, 8063, 8351, 8639, 8927, 9215, 9503, 9791, 10079, 10367, 10655, 10943, 11231, 11519, 11807, 12095, 12383, 12671, 12959, 13247, 13535, 13823, 14111, 14399, 14687, 14975, 15263, 15551, 15839, 16127, 16415, 16703, 16991, 17279, 17567, 17855, 18143, 18431, 18719, 19007, 19295, 19583, 19871, 20159, 20447, 20735, 21023, 21311, 21599, 21887, 22175, 22463, 22751, 23039, 23327, 23615, 23903, 24191, 24479, 24767, 25055, 25343, 25631, 25919, 26207, 26495, 26783, 27071, 27359, 27647, 27935, 28223, 28511, 28799, 29087, 29375, 29663, 29951, 30239, 30527, 30815, 31103, 31391, 31679, 31967, 32255, 32543, 32831, 33119, 33407, 33695, 33983, 34271, 34559, 34847, 35135, 35423, 35711, 35999, 36287, 36575, 36863]
precompile_address_16---input_one_byte_too_long_full_discount_table 16 100000000 [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] [289, 577, 865, 1153, 1441, 1729, 2017, 2305, 2593, 2881, 3169, 3457, 3745, 4033, 4321, 4609, 4897, 5185, 5473, 5761, 6049, 6337, 6625, 6913, 7201, 7489, 7777, 8065, 8353, 8641, 8929, 9217, 9505, 9793, 10081, 10369, 10657, 10945, 11233, 11521, 11809, 12097, 12385, 12673, 12961, 13249, 13537, 13825, 14113, 14401, 14689, 14977, 15265, 15553, 15841, 16129, 16417, 16705, 16993, 17281, 17569, 17857, 18145, 18433, 18721, 19009, 19297, 19585, 19873, 20161, 20449, 20737, 21025, 21313, 21601, 21889, 22177, 22465, 22753, 23041, 23329, 23617, 23905, 24193, 24481, 24769, 25057, 25345, 25633, 25921, 26209, 26497, 26785, 27073, 27361, 27649, 27937, 28225, 28513, 28801, 29089, 29377, 29665, 29953, 30241, 30529, 30817, 31105, 31393, 31681, 31969, 32257, 32545, 32833, 33121, 33409, 33697, 33985, 34273, 34561, 34849, 35137, 35425, 35713, 36001, 36289, 36577, 36865]