Skip to content

test_invalid_gas_g2msm()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_invalid_gas_g2msm@21fb11c8.

Generate fixtures for these test cases for Prague with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_invalid_gas_g2msm --fork Prague

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

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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
@pytest.mark.parametrize(
    "precompile_gas_list,precompile_data_length_list",
    [
        pytest.param(
            [0],
            [G2_MSM_K_INPUT_LENGTH],
            id="zero_gas_passed",
        ),
        pytest.param(
            [
                G2_GAS(i * G2_MSM_K_INPUT_LENGTH) - 1
                for i in range(1, len(Spec.G2MSM_DISCOUNT_TABLE))
            ],
            [i * G2_MSM_K_INPUT_LENGTH for i in range(1, len(Spec.G2MSM_DISCOUNT_TABLE))],
            id="insufficient_gas_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_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 fail for
    all possible input lengths because the appropriate amount of gas is not provided.

    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.

Test ID (Abbreviated) precompile_address tx_gas_limit expected_output precompile_gas_list precompile_data_length_list
...fork_Prague-state_test-precompile_address_14---zero_gas_passed 14 100000000 [0] [288]
...fork_Prague-state_test-precompile_address_14---insufficient_gas_full_discount_table 14 100000000 [22499, 44999, 62301, 79559, 96186, 112319, 127889, 143279, 158354, 173249, 187851, 202229, 216449, 230579, 244349, 258119, 271956, 285119, 298821, 311849, 325079, 338084, 351381, 363959, 376874, 389609, 402771, 415169, 427386, 440099, 452676, 465119, 477426, 489599, 501636, 513539, 526139, 537794, 550191, 561599, 573794, 585899, 597914, 608849, 620661, 632384, 644016, 655559, 668114, 679499, 690794, 701999, 713114, 725354, 736311, 747179, 759239, 769949, 781896, 792449, 804284, 814679, 826401, 838079, 848249, 859814, 871334, 881279, 892686, 904049, 915366, 925019, 936224, 947384, 958499, 969569, 980594, 991574, 1000731, 1011599, 1022421, 1033199, 1043931, 1054619, 1065261, 1075859, 1086411, 1096919, 1107381, 1117799, 1130219, 1140569, 1150874, 1161134, 1171349, 1181519, 1191644, 1201724, 1213986, 1223999, 1233966, 1243889, 1253766, 1265939, 1275749, 1285514, 1295234, 1304909, 1316991, 1326599, 1336161, 1348199, 1357694, 1367144, 1376549, 1388519, 1397856, 1407149, 1419074, 1428299, 1437479, 1449359, 1458471, 1467539, 1479374, 1488374, 1497329, 1509119] [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]
...fork_Prague-blockchain_test_from_state_test-precompile_address_14---zero_gas_passed 14 100000000 [0] [288]
...fork_Prague-blockchain_test_from_state_test-precompile_address_14---insufficient_gas_full_discount_table 14 100000000 [22499, 44999, 62301, 79559, 96186, 112319, 127889, 143279, 158354, 173249, 187851, 202229, 216449, 230579, 244349, 258119, 271956, 285119, 298821, 311849, 325079, 338084, 351381, 363959, 376874, 389609, 402771, 415169, 427386, 440099, 452676, 465119, 477426, 489599, 501636, 513539, 526139, 537794, 550191, 561599, 573794, 585899, 597914, 608849, 620661, 632384, 644016, 655559, 668114, 679499, 690794, 701999, 713114, 725354, 736311, 747179, 759239, 769949, 781896, 792449, 804284, 814679, 826401, 838079, 848249, 859814, 871334, 881279, 892686, 904049, 915366, 925019, 936224, 947384, 958499, 969569, 980594, 991574, 1000731, 1011599, 1022421, 1033199, 1043931, 1054619, 1065261, 1075859, 1086411, 1096919, 1107381, 1117799, 1130219, 1140569, 1150874, 1161134, 1171349, 1181519, 1191644, 1201724, 1213986, 1223999, 1233966, 1243889, 1253766, 1265939, 1275749, 1285514, 1295234, 1304909, 1316991, 1326599, 1336161, 1348199, 1357694, 1367144, 1376549, 1388519, 1397856, 1407149, 1419074, 1428299, 1437479, 1449359, 1458471, 1467539, 1479374, 1488374, 1497329, 1509119] [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]
...fork_Osaka-state_test-precompile_address_14---zero_gas_passed 14 100000000 [0] [288]
...fork_Osaka-state_test-precompile_address_14---insufficient_gas_full_discount_table 14 100000000 [22499, 44999, 62301, 79559, 96186, 112319, 127889, 143279, 158354, 173249, 187851, 202229, 216449, 230579, 244349, 258119, 271956, 285119, 298821, 311849, 325079, 338084, 351381, 363959, 376874, 389609, 402771, 415169, 427386, 440099, 452676, 465119, 477426, 489599, 501636, 513539, 526139, 537794, 550191, 561599, 573794, 585899, 597914, 608849, 620661, 632384, 644016, 655559, 668114, 679499, 690794, 701999, 713114, 725354, 736311, 747179, 759239, 769949, 781896, 792449, 804284, 814679, 826401, 838079, 848249, 859814, 871334, 881279, 892686, 904049, 915366, 925019, 936224, 947384, 958499, 969569, 980594, 991574, 1000731, 1011599, 1022421, 1033199, 1043931, 1054619, 1065261, 1075859, 1086411, 1096919, 1107381, 1117799, 1130219, 1140569, 1150874, 1161134, 1171349, 1181519, 1191644, 1201724, 1213986, 1223999, 1233966, 1243889, 1253766, 1265939, 1275749, 1285514, 1295234, 1304909, 1316991, 1326599, 1336161, 1348199, 1357694, 1367144, 1376549, 1388519, 1397856, 1407149, 1419074, 1428299, 1437479, 1449359, 1458471, 1467539, 1479374, 1488374, 1497329, 1509119] [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]
...fork_Osaka-blockchain_test_from_state_test-precompile_address_14---zero_gas_passed 14 100000000 [0] [288]
...fork_Osaka-blockchain_test_from_state_test-precompile_address_14---insufficient_gas_full_discount_table 14 100000000 [22499, 44999, 62301, 79559, 96186, 112319, 127889, 143279, 158354, 173249, 187851, 202229, 216449, 230579, 244349, 258119, 271956, 285119, 298821, 311849, 325079, 338084, 351381, 363959, 376874, 389609, 402771, 415169, 427386, 440099, 452676, 465119, 477426, 489599, 501636, 513539, 526139, 537794, 550191, 561599, 573794, 585899, 597914, 608849, 620661, 632384, 644016, 655559, 668114, 679499, 690794, 701999, 713114, 725354, 736311, 747179, 759239, 769949, 781896, 792449, 804284, 814679, 826401, 838079, 848249, 859814, 871334, 881279, 892686, 904049, 915366, 925019, 936224, 947384, 958499, 969569, 980594, 991574, 1000731, 1011599, 1022421, 1033199, 1043931, 1054619, 1065261, 1075859, 1086411, 1096919, 1107381, 1117799, 1130219, 1140569, 1150874, 1161134, 1171349, 1181519, 1191644, 1201724, 1213986, 1223999, 1233966, 1243889, 1253766, 1265939, 1275749, 1285514, 1295234, 1304909, 1316991, 1326599, 1336161, 1348199, 1357694, 1367144, 1376549, 1388519, 1397856, 1407149, 1419074, 1428299, 1437479, 1449359, 1458471, 1467539, 1479374, 1488374, 1497329, 1509119] [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]