Skip to content

test_invalid_gas_g1msm()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_invalid_gas_g1msm@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_g1msm --fork Prague

Test the BLS12_G1MSM 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
@pytest.mark.parametrize(
    "precompile_gas_list,precompile_data_length_list",
    [
        pytest.param(
            [0],
            [G1_MSM_K_INPUT_LENGTH],
            id="zero_gas_passed",
        ),
        pytest.param(
            [
                G1_GAS(i * G1_MSM_K_INPUT_LENGTH) - 1
                for i in range(1, len(Spec.G1MSM_DISCOUNT_TABLE))
            ],
            [i * G1_MSM_K_INPUT_LENGTH for i in range(1, len(Spec.G1MSM_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.G1MSM])
def test_invalid_gas_g1msm(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
):
    """
    Test the BLS12_G1MSM 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_12---zero_gas_passed 12 100000000 [0] [160]
...fork_Prague-state_test-precompile_address_12---insufficient_gas_full_discount_table 12 100000000 [11999, 22775, 30527, 38255, 45839, 53999, 61991, 69887, 77651, 85439, 93059, 100511, 107951, 115415, 122759, 129983, 137291, 144503, 151619, 158639, 165815, 172655, 179675, 186623, 193499, 200303, 207359, 214031, 220979, 227519, 234359, 240767, 247499, 254183, 260819, 267407, 273947, 280439, 286883, 293279, 299627, 306431, 312695, 318911, 325619, 331751, 337835, 344447, 350447, 356999, 362915, 369407, 375875, 381671, 388079, 393791, 400139, 406463, 412055, 418319, 424559, 430775, 436211, 442367, 448499, 454607, 460691, 466751, 471959, 477959, 483935, 489887, 495815, 501719, 507599, 513455, 519287, 525095, 530879, 536639, 542375, 548087, 553775, 559439, 565079, 570695, 576287, 581855, 587399, 592919, 598415, 603887, 610451, 615887, 621299, 626687, 632051, 637391, 642707, 647999, 654479, 659735, 664967, 670175, 675359, 681791, 686939, 692063, 697163, 702239, 708623, 713663, 718679, 723671, 728639, 734975, 739907, 744815, 749699, 755999, 760847, 765671, 770471, 776735, 781499, 786239, 792479, 797183] [160, 320, 480, 640, 800, 960, 1120, 1280, 1440, 1600, 1760, 1920, 2080, 2240, 2400, 2560, 2720, 2880, 3040, 3200, 3360, 3520, 3680, 3840, 4000, 4160, 4320, 4480, 4640, 4800, 4960, 5120, 5280, 5440, 5600, 5760, 5920, 6080, 6240, 6400, 6560, 6720, 6880, 7040, 7200, 7360, 7520, 7680, 7840, 8000, 8160, 8320, 8480, 8640, 8800, 8960, 9120, 9280, 9440, 9600, 9760, 9920, 10080, 10240, 10400, 10560, 10720, 10880, 11040, 11200, 11360, 11520, 11680, 11840, 12000, 12160, 12320, 12480, 12640, 12800, 12960, 13120, 13280, 13440, 13600, 13760, 13920, 14080, 14240, 14400, 14560, 14720, 14880, 15040, 15200, 15360, 15520, 15680, 15840, 16000, 16160, 16320, 16480, 16640, 16800, 16960, 17120, 17280, 17440, 17600, 17760, 17920, 18080, 18240, 18400, 18560, 18720, 18880, 19040, 19200, 19360, 19520, 19680, 19840, 20000, 20160, 20320, 20480]
...fork_Prague-blockchain_test_from_state_test-precompile_address_12---zero_gas_passed 12 100000000 [0] [160]
...fork_Prague-blockchain_test_from_state_test-precompile_address_12---insufficient_gas_full_discount_table 12 100000000 [11999, 22775, 30527, 38255, 45839, 53999, 61991, 69887, 77651, 85439, 93059, 100511, 107951, 115415, 122759, 129983, 137291, 144503, 151619, 158639, 165815, 172655, 179675, 186623, 193499, 200303, 207359, 214031, 220979, 227519, 234359, 240767, 247499, 254183, 260819, 267407, 273947, 280439, 286883, 293279, 299627, 306431, 312695, 318911, 325619, 331751, 337835, 344447, 350447, 356999, 362915, 369407, 375875, 381671, 388079, 393791, 400139, 406463, 412055, 418319, 424559, 430775, 436211, 442367, 448499, 454607, 460691, 466751, 471959, 477959, 483935, 489887, 495815, 501719, 507599, 513455, 519287, 525095, 530879, 536639, 542375, 548087, 553775, 559439, 565079, 570695, 576287, 581855, 587399, 592919, 598415, 603887, 610451, 615887, 621299, 626687, 632051, 637391, 642707, 647999, 654479, 659735, 664967, 670175, 675359, 681791, 686939, 692063, 697163, 702239, 708623, 713663, 718679, 723671, 728639, 734975, 739907, 744815, 749699, 755999, 760847, 765671, 770471, 776735, 781499, 786239, 792479, 797183] [160, 320, 480, 640, 800, 960, 1120, 1280, 1440, 1600, 1760, 1920, 2080, 2240, 2400, 2560, 2720, 2880, 3040, 3200, 3360, 3520, 3680, 3840, 4000, 4160, 4320, 4480, 4640, 4800, 4960, 5120, 5280, 5440, 5600, 5760, 5920, 6080, 6240, 6400, 6560, 6720, 6880, 7040, 7200, 7360, 7520, 7680, 7840, 8000, 8160, 8320, 8480, 8640, 8800, 8960, 9120, 9280, 9440, 9600, 9760, 9920, 10080, 10240, 10400, 10560, 10720, 10880, 11040, 11200, 11360, 11520, 11680, 11840, 12000, 12160, 12320, 12480, 12640, 12800, 12960, 13120, 13280, 13440, 13600, 13760, 13920, 14080, 14240, 14400, 14560, 14720, 14880, 15040, 15200, 15360, 15520, 15680, 15840, 16000, 16160, 16320, 16480, 16640, 16800, 16960, 17120, 17280, 17440, 17600, 17760, 17920, 18080, 18240, 18400, 18560, 18720, 18880, 19040, 19200, 19360, 19520, 19680, 19840, 20000, 20160, 20320, 20480]
...fork_Osaka-state_test-precompile_address_12---zero_gas_passed 12 100000000 [0] [160]
...fork_Osaka-state_test-precompile_address_12---insufficient_gas_full_discount_table 12 100000000 [11999, 22775, 30527, 38255, 45839, 53999, 61991, 69887, 77651, 85439, 93059, 100511, 107951, 115415, 122759, 129983, 137291, 144503, 151619, 158639, 165815, 172655, 179675, 186623, 193499, 200303, 207359, 214031, 220979, 227519, 234359, 240767, 247499, 254183, 260819, 267407, 273947, 280439, 286883, 293279, 299627, 306431, 312695, 318911, 325619, 331751, 337835, 344447, 350447, 356999, 362915, 369407, 375875, 381671, 388079, 393791, 400139, 406463, 412055, 418319, 424559, 430775, 436211, 442367, 448499, 454607, 460691, 466751, 471959, 477959, 483935, 489887, 495815, 501719, 507599, 513455, 519287, 525095, 530879, 536639, 542375, 548087, 553775, 559439, 565079, 570695, 576287, 581855, 587399, 592919, 598415, 603887, 610451, 615887, 621299, 626687, 632051, 637391, 642707, 647999, 654479, 659735, 664967, 670175, 675359, 681791, 686939, 692063, 697163, 702239, 708623, 713663, 718679, 723671, 728639, 734975, 739907, 744815, 749699, 755999, 760847, 765671, 770471, 776735, 781499, 786239, 792479, 797183] [160, 320, 480, 640, 800, 960, 1120, 1280, 1440, 1600, 1760, 1920, 2080, 2240, 2400, 2560, 2720, 2880, 3040, 3200, 3360, 3520, 3680, 3840, 4000, 4160, 4320, 4480, 4640, 4800, 4960, 5120, 5280, 5440, 5600, 5760, 5920, 6080, 6240, 6400, 6560, 6720, 6880, 7040, 7200, 7360, 7520, 7680, 7840, 8000, 8160, 8320, 8480, 8640, 8800, 8960, 9120, 9280, 9440, 9600, 9760, 9920, 10080, 10240, 10400, 10560, 10720, 10880, 11040, 11200, 11360, 11520, 11680, 11840, 12000, 12160, 12320, 12480, 12640, 12800, 12960, 13120, 13280, 13440, 13600, 13760, 13920, 14080, 14240, 14400, 14560, 14720, 14880, 15040, 15200, 15360, 15520, 15680, 15840, 16000, 16160, 16320, 16480, 16640, 16800, 16960, 17120, 17280, 17440, 17600, 17760, 17920, 18080, 18240, 18400, 18560, 18720, 18880, 19040, 19200, 19360, 19520, 19680, 19840, 20000, 20160, 20320, 20480]
...fork_Osaka-blockchain_test_from_state_test-precompile_address_12---zero_gas_passed 12 100000000 [0] [160]
...fork_Osaka-blockchain_test_from_state_test-precompile_address_12---insufficient_gas_full_discount_table 12 100000000 [11999, 22775, 30527, 38255, 45839, 53999, 61991, 69887, 77651, 85439, 93059, 100511, 107951, 115415, 122759, 129983, 137291, 144503, 151619, 158639, 165815, 172655, 179675, 186623, 193499, 200303, 207359, 214031, 220979, 227519, 234359, 240767, 247499, 254183, 260819, 267407, 273947, 280439, 286883, 293279, 299627, 306431, 312695, 318911, 325619, 331751, 337835, 344447, 350447, 356999, 362915, 369407, 375875, 381671, 388079, 393791, 400139, 406463, 412055, 418319, 424559, 430775, 436211, 442367, 448499, 454607, 460691, 466751, 471959, 477959, 483935, 489887, 495815, 501719, 507599, 513455, 519287, 525095, 530879, 536639, 542375, 548087, 553775, 559439, 565079, 570695, 576287, 581855, 587399, 592919, 598415, 603887, 610451, 615887, 621299, 626687, 632051, 637391, 642707, 647999, 654479, 659735, 664967, 670175, 675359, 681791, 686939, 692063, 697163, 702239, 708623, 713663, 718679, 723671, 728639, 734975, 739907, 744815, 749699, 755999, 760847, 765671, 770471, 776735, 781499, 786239, 792479, 797183] [160, 320, 480, 640, 800, 960, 1120, 1280, 1440, 1600, 1760, 1920, 2080, 2240, 2400, 2560, 2720, 2880, 3040, 3200, 3360, 3520, 3680, 3840, 4000, 4160, 4320, 4480, 4640, 4800, 4960, 5120, 5280, 5440, 5600, 5760, 5920, 6080, 6240, 6400, 6560, 6720, 6880, 7040, 7200, 7360, 7520, 7680, 7840, 8000, 8160, 8320, 8480, 8640, 8800, 8960, 9120, 9280, 9440, 9600, 9760, 9920, 10080, 10240, 10400, 10560, 10720, 10880, 11040, 11200, 11360, 11520, 11680, 11840, 12000, 12160, 12320, 12480, 12640, 12800, 12960, 13120, 13280, 13440, 13600, 13760, 13920, 14080, 14240, 14400, 14560, 14720, 14880, 15040, 15200, 15360, 15520, 15680, 15840, 16000, 16160, 16320, 16480, 16640, 16800, 16960, 17120, 17280, 17440, 17600, 17760, 17920, 18080, 18240, 18400, 18560, 18720, 18880, 19040, 19200, 19360, 19520, 19680, 19840, 20000, 20160, 20320, 20480]