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@e9958ed2.

Generate fixtures for these test cases for Osaka with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_valid_gas_g2msm --fork Osaka

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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
@pytest.mark.parametrize_by_fork(
    "precompile_gas_list,precompile_data_length_list",
    get_split_discount_table_by_fork(
        G2_GAS, len(Spec.G2MSM_DISCOUNT_TABLE), G2_MSM_K_INPUT_LENGTH
    ),
)
@pytest.mark.parametrize("gas_modifier", [pytest.param(0, id="exact_gas")])
@pytest.mark.parametrize("expected_output", [PointG2()], ids=[""])
@pytest.mark.parametrize("precompile_address", [Spec.G2MSM])
@pytest.mark.slow()
def test_valid_gas_g2msm(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """
    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=env,
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

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

Test ID (Abbreviated) precompile_gas_list precompile_data_length_list precompile_address expected_output gas_modifier
...fork_Prague-full_discount_table-state_test-precompile_address_14--exact_gas [22500, 45000, 62302, 79560, 96187, 112320, 127890, 143280, 158355, 173250, 187852, 202230, 216450, 230580, 244350, 258120, 271957, 285120, 298822, 311850, 325080, 338085, 351382, 363960, 376875, 389610, 402772, 415170, 427387, 440100, 452677, 465120, 477427, 489600, 501637, 513540, 526140, 537795, 550192, 561600, 573795, 585900, 597915, 608850, 620662, 632385, 644017, 655560, 668115, 679500, 690795, 702000, 713115, 725355, 736312, 747180, 759240, 769950, 781897, 792450, 804285, 814680, 826402, 838080, 848250, 859815, 871335, 881280, 892687, 904050, 915367, 925020, 936225, 947385, 958500, 969570, 980595, 991575, 1000732, 1011600, 1022422, 1033200, 1043932, 1054620, 1065262, 1075860, 1086412, 1096920, 1107382, 1117800, 1130220, 1140570, 1150875, 1161135, 1171350, 1181520, 1191645, 1201725, 1213987, 1224000, 1233967, 1243890, 1253767, 1265940, 1275750, 1285515, 1295235, 1304910, 1316992, 1326600, 1336162, 1348200, 1357695, 1367145, 1376550, 1388520, 1397857, 1407150, 1419075, 1428300, 1437480, 1449360, 1458472, 1467540, 1479375, 1488375, 1497330, 1509120, 1520910] [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, 37152] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Prague-full_discount_table-blockchain_test_from_state_test-precompile_address_14--exact_gas [22500, 45000, 62302, 79560, 96187, 112320, 127890, 143280, 158355, 173250, 187852, 202230, 216450, 230580, 244350, 258120, 271957, 285120, 298822, 311850, 325080, 338085, 351382, 363960, 376875, 389610, 402772, 415170, 427387, 440100, 452677, 465120, 477427, 489600, 501637, 513540, 526140, 537795, 550192, 561600, 573795, 585900, 597915, 608850, 620662, 632385, 644017, 655560, 668115, 679500, 690795, 702000, 713115, 725355, 736312, 747180, 759240, 769950, 781897, 792450, 804285, 814680, 826402, 838080, 848250, 859815, 871335, 881280, 892687, 904050, 915367, 925020, 936225, 947385, 958500, 969570, 980595, 991575, 1000732, 1011600, 1022422, 1033200, 1043932, 1054620, 1065262, 1075860, 1086412, 1096920, 1107382, 1117800, 1130220, 1140570, 1150875, 1161135, 1171350, 1181520, 1191645, 1201725, 1213987, 1224000, 1233967, 1243890, 1253767, 1265940, 1275750, 1285515, 1295235, 1304910, 1316992, 1326600, 1336162, 1348200, 1357695, 1367145, 1376550, 1388520, 1397857, 1407150, 1419075, 1428300, 1437480, 1449360, 1458472, 1467540, 1479375, 1488375, 1497330, 1509120, 1520910] [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, 37152] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_1_of_7-state_test-precompile_address_14--exact_gas [22500, 45000, 62302, 79560, 96187, 112320, 127890, 143280, 158355, 173250, 187852, 202230, 216450, 230580, 244350, 258120, 271957, 285120, 298822, 311850, 325080, 338085, 351382, 363960, 376875, 389610, 402772, 415170, 427387, 440100, 452677, 465120, 477427, 489600, 501637, 513540, 526140, 537795, 550192, 561600, 573795, 585900, 597915, 608850, 620662] [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] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_1_of_7-blockchain_test_from_state_test-precompile_address_14--exact_gas [22500, 45000, 62302, 79560, 96187, 112320, 127890, 143280, 158355, 173250, 187852, 202230, 216450, 230580, 244350, 258120, 271957, 285120, 298822, 311850, 325080, 338085, 351382, 363960, 376875, 389610, 402772, 415170, 427387, 440100, 452677, 465120, 477427, 489600, 501637, 513540, 526140, 537795, 550192, 561600, 573795, 585900, 597915, 608850, 620662] [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] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_2_of_7-state_test-precompile_address_14--exact_gas [632385, 644017, 655560, 668115, 679500, 690795, 702000, 713115, 725355, 736312, 747180, 759240, 769950, 781897, 792450, 804285, 814680, 826402, 838080, 848250, 859815] [13248, 13536, 13824, 14112, 14400, 14688, 14976, 15264, 15552, 15840, 16128, 16416, 16704, 16992, 17280, 17568, 17856, 18144, 18432, 18720, 19008] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_2_of_7-blockchain_test_from_state_test-precompile_address_14--exact_gas [632385, 644017, 655560, 668115, 679500, 690795, 702000, 713115, 725355, 736312, 747180, 759240, 769950, 781897, 792450, 804285, 814680, 826402, 838080, 848250, 859815] [13248, 13536, 13824, 14112, 14400, 14688, 14976, 15264, 15552, 15840, 16128, 16416, 16704, 16992, 17280, 17568, 17856, 18144, 18432, 18720, 19008] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_3_of_7-state_test-precompile_address_14--exact_gas [871335, 881280, 892687, 904050, 915367, 925020, 936225, 947385, 958500, 969570, 980595, 991575, 1000732, 1011600, 1022422, 1033200, 1043932] [19296, 19584, 19872, 20160, 20448, 20736, 21024, 21312, 21600, 21888, 22176, 22464, 22752, 23040, 23328, 23616, 23904] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_3_of_7-blockchain_test_from_state_test-precompile_address_14--exact_gas [871335, 881280, 892687, 904050, 915367, 925020, 936225, 947385, 958500, 969570, 980595, 991575, 1000732, 1011600, 1022422, 1033200, 1043932] [19296, 19584, 19872, 20160, 20448, 20736, 21024, 21312, 21600, 21888, 22176, 22464, 22752, 23040, 23328, 23616, 23904] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_4_of_7-state_test-precompile_address_14--exact_gas [1054620, 1065262, 1075860, 1086412, 1096920, 1107382, 1117800, 1130220, 1140570, 1150875, 1161135, 1171350, 1181520, 1191645] [24192, 24480, 24768, 25056, 25344, 25632, 25920, 26208, 26496, 26784, 27072, 27360, 27648, 27936] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_4_of_7-blockchain_test_from_state_test-precompile_address_14--exact_gas [1054620, 1065262, 1075860, 1086412, 1096920, 1107382, 1117800, 1130220, 1140570, 1150875, 1161135, 1171350, 1181520, 1191645] [24192, 24480, 24768, 25056, 25344, 25632, 25920, 26208, 26496, 26784, 27072, 27360, 27648, 27936] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_5_of_7-state_test-precompile_address_14--exact_gas [1201725, 1213987, 1224000, 1233967, 1243890, 1253767, 1265940, 1275750, 1285515, 1295235, 1304910, 1316992, 1326600] [28224, 28512, 28800, 29088, 29376, 29664, 29952, 30240, 30528, 30816, 31104, 31392, 31680] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_5_of_7-blockchain_test_from_state_test-precompile_address_14--exact_gas [1201725, 1213987, 1224000, 1233967, 1243890, 1253767, 1265940, 1275750, 1285515, 1295235, 1304910, 1316992, 1326600] [28224, 28512, 28800, 29088, 29376, 29664, 29952, 30240, 30528, 30816, 31104, 31392, 31680] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_6_of_7-state_test-precompile_address_14--exact_gas [1336162, 1348200, 1357695, 1367145, 1376550, 1388520, 1397857, 1407150, 1419075, 1428300, 1437480] [31968, 32256, 32544, 32832, 33120, 33408, 33696, 33984, 34272, 34560, 34848] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_6_of_7-blockchain_test_from_state_test-precompile_address_14--exact_gas [1336162, 1348200, 1357695, 1367145, 1376550, 1388520, 1397857, 1407150, 1419075, 1428300, 1437480] [31968, 32256, 32544, 32832, 33120, 33408, 33696, 33984, 34272, 34560, 34848] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_7_of_7-state_test-precompile_address_14--exact_gas [1449360, 1458472, 1467540, 1479375, 1488375, 1497330, 1509120, 1520910] [35136, 35424, 35712, 36000, 36288, 36576, 36864, 37152] 14 PointG2(x=(0, 0), y=(0, 0)) 0
...fork_Osaka-discount_table_7_of_7-blockchain_test_from_state_test-precompile_address_14--exact_gas [1449360, 1458472, 1467540, 1479375, 1488375, 1497330, 1509120, 1520910] [35136, 35424, 35712, 36000, 36288, 36576, 36864, 37152] 14 PointG2(x=(0, 0), y=(0, 0)) 0