Skip to content

test_invalid_length_g1msm()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_invalid_length_g1msm@88e9fb8f.

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_invalid_length_g1msm --fork Osaka

Test the BLS12_G1MSM 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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
@pytest.mark.parametrize_by_fork(
    "precompile_gas_list,precompile_data_length_list",
    get_split_discount_table_by_fork(
        G1_GAS, len(Spec.G1MSM_DISCOUNT_TABLE), G1_MSM_K_INPUT_LENGTH
    ),
)
@pytest.mark.parametrize(
    "input_length_modifier",
    [
        pytest.param(-1, id="input_one_byte_too_short"),
        pytest.param(1, id="input_one_byte_too_long"),
    ],
)
@pytest.mark.parametrize("expected_output", [Spec.INVALID], ids=[""])
@pytest.mark.parametrize("precompile_address", [Spec.G1MSM])
def test_invalid_length_g1msm(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """
    Test the BLS12_G1MSM 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=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 input_length_modifier
...fork_Prague-full_discount_table-state_test-precompile_address_12--input_one_byte_too_short [12000, 22776, 30528, 38256, 45840, 54000, 61992, 69888, 77652, 85440, 93060, 100512, 107952, 115416, 122760, 129984, 137292, 144504, 151620, 158640, 165816, 172656, 179676, 186624, 193500, 200304, 207360, 214032, 220980, 227520, 234360, 240768, 247500, 254184, 260820, 267408, 273948, 280440, 286884, 293280, 299628, 306432, 312696, 318912, 325620, 331752, 337836, 344448, 350448, 357000, 362916, 369408, 375876, 381672, 388080, 393792, 400140, 406464, 412056, 418320, 424560, 430776, 436212, 442368, 448500, 454608, 460692, 466752, 471960, 477960, 483936, 489888, 495816, 501720, 507600, 513456, 519288, 525096, 530880, 536640, 542376, 548088, 553776, 559440, 565080, 570696, 576288, 581856, 587400, 592920, 598416, 603888, 610452, 615888, 621300, 626688, 632052, 637392, 642708, 648000, 654480, 659736, 664968, 670176, 675360, 681792, 686940, 692064, 697164, 702240, 708624, 713664, 718680, 723672, 728640, 734976, 739908, 744816, 749700, 756000, 760848, 765672, 770472, 776736, 781500, 786240, 792480, 797184, 803412] [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, 20640] 12 -1
...fork_Prague-full_discount_table-state_test-precompile_address_12--input_one_byte_too_long [12000, 22776, 30528, 38256, 45840, 54000, 61992, 69888, 77652, 85440, 93060, 100512, 107952, 115416, 122760, 129984, 137292, 144504, 151620, 158640, 165816, 172656, 179676, 186624, 193500, 200304, 207360, 214032, 220980, 227520, 234360, 240768, 247500, 254184, 260820, 267408, 273948, 280440, 286884, 293280, 299628, 306432, 312696, 318912, 325620, 331752, 337836, 344448, 350448, 357000, 362916, 369408, 375876, 381672, 388080, 393792, 400140, 406464, 412056, 418320, 424560, 430776, 436212, 442368, 448500, 454608, 460692, 466752, 471960, 477960, 483936, 489888, 495816, 501720, 507600, 513456, 519288, 525096, 530880, 536640, 542376, 548088, 553776, 559440, 565080, 570696, 576288, 581856, 587400, 592920, 598416, 603888, 610452, 615888, 621300, 626688, 632052, 637392, 642708, 648000, 654480, 659736, 664968, 670176, 675360, 681792, 686940, 692064, 697164, 702240, 708624, 713664, 718680, 723672, 728640, 734976, 739908, 744816, 749700, 756000, 760848, 765672, 770472, 776736, 781500, 786240, 792480, 797184, 803412] [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, 20640] 12 1
...fork_Prague-full_discount_table-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_short [12000, 22776, 30528, 38256, 45840, 54000, 61992, 69888, 77652, 85440, 93060, 100512, 107952, 115416, 122760, 129984, 137292, 144504, 151620, 158640, 165816, 172656, 179676, 186624, 193500, 200304, 207360, 214032, 220980, 227520, 234360, 240768, 247500, 254184, 260820, 267408, 273948, 280440, 286884, 293280, 299628, 306432, 312696, 318912, 325620, 331752, 337836, 344448, 350448, 357000, 362916, 369408, 375876, 381672, 388080, 393792, 400140, 406464, 412056, 418320, 424560, 430776, 436212, 442368, 448500, 454608, 460692, 466752, 471960, 477960, 483936, 489888, 495816, 501720, 507600, 513456, 519288, 525096, 530880, 536640, 542376, 548088, 553776, 559440, 565080, 570696, 576288, 581856, 587400, 592920, 598416, 603888, 610452, 615888, 621300, 626688, 632052, 637392, 642708, 648000, 654480, 659736, 664968, 670176, 675360, 681792, 686940, 692064, 697164, 702240, 708624, 713664, 718680, 723672, 728640, 734976, 739908, 744816, 749700, 756000, 760848, 765672, 770472, 776736, 781500, 786240, 792480, 797184, 803412] [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, 20640] 12 -1
...fork_Prague-full_discount_table-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_long [12000, 22776, 30528, 38256, 45840, 54000, 61992, 69888, 77652, 85440, 93060, 100512, 107952, 115416, 122760, 129984, 137292, 144504, 151620, 158640, 165816, 172656, 179676, 186624, 193500, 200304, 207360, 214032, 220980, 227520, 234360, 240768, 247500, 254184, 260820, 267408, 273948, 280440, 286884, 293280, 299628, 306432, 312696, 318912, 325620, 331752, 337836, 344448, 350448, 357000, 362916, 369408, 375876, 381672, 388080, 393792, 400140, 406464, 412056, 418320, 424560, 430776, 436212, 442368, 448500, 454608, 460692, 466752, 471960, 477960, 483936, 489888, 495816, 501720, 507600, 513456, 519288, 525096, 530880, 536640, 542376, 548088, 553776, 559440, 565080, 570696, 576288, 581856, 587400, 592920, 598416, 603888, 610452, 615888, 621300, 626688, 632052, 637392, 642708, 648000, 654480, 659736, 664968, 670176, 675360, 681792, 686940, 692064, 697164, 702240, 708624, 713664, 718680, 723672, 728640, 734976, 739908, 744816, 749700, 756000, 760848, 765672, 770472, 776736, 781500, 786240, 792480, 797184, 803412] [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, 20640] 12 1
...fork_Osaka-discount_table_1_of_4-state_test-precompile_address_12--input_one_byte_too_short [12000, 22776, 30528, 38256, 45840, 54000, 61992, 69888, 77652, 85440, 93060, 100512, 107952, 115416, 122760, 129984, 137292, 144504, 151620, 158640, 165816, 172656, 179676, 186624, 193500, 200304, 207360, 214032, 220980, 227520, 234360, 240768, 247500, 254184, 260820, 267408, 273948, 280440, 286884, 293280, 299628, 306432, 312696, 318912, 325620, 331752, 337836, 344448, 350448, 357000, 362916, 369408, 375876, 381672, 388080, 393792, 400140, 406464, 412056, 418320, 424560, 430776, 436212, 442368] [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] 12 -1
...fork_Osaka-discount_table_1_of_4-state_test-precompile_address_12--input_one_byte_too_long [12000, 22776, 30528, 38256, 45840, 54000, 61992, 69888, 77652, 85440, 93060, 100512, 107952, 115416, 122760, 129984, 137292, 144504, 151620, 158640, 165816, 172656, 179676, 186624, 193500, 200304, 207360, 214032, 220980, 227520, 234360, 240768, 247500, 254184, 260820, 267408, 273948, 280440, 286884, 293280, 299628, 306432, 312696, 318912, 325620, 331752, 337836, 344448, 350448, 357000, 362916, 369408, 375876, 381672, 388080, 393792, 400140, 406464, 412056, 418320, 424560, 430776, 436212, 442368] [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] 12 1
...fork_Osaka-discount_table_1_of_4-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_short [12000, 22776, 30528, 38256, 45840, 54000, 61992, 69888, 77652, 85440, 93060, 100512, 107952, 115416, 122760, 129984, 137292, 144504, 151620, 158640, 165816, 172656, 179676, 186624, 193500, 200304, 207360, 214032, 220980, 227520, 234360, 240768, 247500, 254184, 260820, 267408, 273948, 280440, 286884, 293280, 299628, 306432, 312696, 318912, 325620, 331752, 337836, 344448, 350448, 357000, 362916, 369408, 375876, 381672, 388080, 393792, 400140, 406464, 412056, 418320, 424560, 430776, 436212, 442368] [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] 12 -1
...fork_Osaka-discount_table_1_of_4-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_long [12000, 22776, 30528, 38256, 45840, 54000, 61992, 69888, 77652, 85440, 93060, 100512, 107952, 115416, 122760, 129984, 137292, 144504, 151620, 158640, 165816, 172656, 179676, 186624, 193500, 200304, 207360, 214032, 220980, 227520, 234360, 240768, 247500, 254184, 260820, 267408, 273948, 280440, 286884, 293280, 299628, 306432, 312696, 318912, 325620, 331752, 337836, 344448, 350448, 357000, 362916, 369408, 375876, 381672, 388080, 393792, 400140, 406464, 412056, 418320, 424560, 430776, 436212, 442368] [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] 12 1
...fork_Osaka-discount_table_2_of_4-state_test-precompile_address_12--input_one_byte_too_short [448500, 454608, 460692, 466752, 471960, 477960, 483936, 489888, 495816, 501720, 507600, 513456, 519288, 525096, 530880, 536640, 542376, 548088, 553776, 559440, 565080, 570696, 576288, 581856, 587400, 592920, 598416, 603888, 610452, 615888] [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] 12 -1
...fork_Osaka-discount_table_2_of_4-state_test-precompile_address_12--input_one_byte_too_long [448500, 454608, 460692, 466752, 471960, 477960, 483936, 489888, 495816, 501720, 507600, 513456, 519288, 525096, 530880, 536640, 542376, 548088, 553776, 559440, 565080, 570696, 576288, 581856, 587400, 592920, 598416, 603888, 610452, 615888] [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] 12 1
...fork_Osaka-discount_table_2_of_4-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_short [448500, 454608, 460692, 466752, 471960, 477960, 483936, 489888, 495816, 501720, 507600, 513456, 519288, 525096, 530880, 536640, 542376, 548088, 553776, 559440, 565080, 570696, 576288, 581856, 587400, 592920, 598416, 603888, 610452, 615888] [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] 12 -1
...fork_Osaka-discount_table_2_of_4-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_long [448500, 454608, 460692, 466752, 471960, 477960, 483936, 489888, 495816, 501720, 507600, 513456, 519288, 525096, 530880, 536640, 542376, 548088, 553776, 559440, 565080, 570696, 576288, 581856, 587400, 592920, 598416, 603888, 610452, 615888] [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] 12 1
...fork_Osaka-discount_table_3_of_4-state_test-precompile_address_12--input_one_byte_too_short [621300, 626688, 632052, 637392, 642708, 648000, 654480, 659736, 664968, 670176, 675360, 681792, 686940, 692064, 697164, 702240, 708624, 713664, 718680, 723672, 728640, 734976, 739908] [15200, 15360, 15520, 15680, 15840, 16000, 16160, 16320, 16480, 16640, 16800, 16960, 17120, 17280, 17440, 17600, 17760, 17920, 18080, 18240, 18400, 18560, 18720] 12 -1
...fork_Osaka-discount_table_3_of_4-state_test-precompile_address_12--input_one_byte_too_long [621300, 626688, 632052, 637392, 642708, 648000, 654480, 659736, 664968, 670176, 675360, 681792, 686940, 692064, 697164, 702240, 708624, 713664, 718680, 723672, 728640, 734976, 739908] [15200, 15360, 15520, 15680, 15840, 16000, 16160, 16320, 16480, 16640, 16800, 16960, 17120, 17280, 17440, 17600, 17760, 17920, 18080, 18240, 18400, 18560, 18720] 12 1
...fork_Osaka-discount_table_3_of_4-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_short [621300, 626688, 632052, 637392, 642708, 648000, 654480, 659736, 664968, 670176, 675360, 681792, 686940, 692064, 697164, 702240, 708624, 713664, 718680, 723672, 728640, 734976, 739908] [15200, 15360, 15520, 15680, 15840, 16000, 16160, 16320, 16480, 16640, 16800, 16960, 17120, 17280, 17440, 17600, 17760, 17920, 18080, 18240, 18400, 18560, 18720] 12 -1
...fork_Osaka-discount_table_3_of_4-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_long [621300, 626688, 632052, 637392, 642708, 648000, 654480, 659736, 664968, 670176, 675360, 681792, 686940, 692064, 697164, 702240, 708624, 713664, 718680, 723672, 728640, 734976, 739908] [15200, 15360, 15520, 15680, 15840, 16000, 16160, 16320, 16480, 16640, 16800, 16960, 17120, 17280, 17440, 17600, 17760, 17920, 18080, 18240, 18400, 18560, 18720] 12 1
...fork_Osaka-discount_table_4_of_4-state_test-precompile_address_12--input_one_byte_too_short [744816, 749700, 756000, 760848, 765672, 770472, 776736, 781500, 786240, 792480, 797184, 803412] [18880, 19040, 19200, 19360, 19520, 19680, 19840, 20000, 20160, 20320, 20480, 20640] 12 -1
...fork_Osaka-discount_table_4_of_4-state_test-precompile_address_12--input_one_byte_too_long [744816, 749700, 756000, 760848, 765672, 770472, 776736, 781500, 786240, 792480, 797184, 803412] [18880, 19040, 19200, 19360, 19520, 19680, 19840, 20000, 20160, 20320, 20480, 20640] 12 1
...fork_Osaka-discount_table_4_of_4-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_short [744816, 749700, 756000, 760848, 765672, 770472, 776736, 781500, 786240, 792480, 797184, 803412] [18880, 19040, 19200, 19360, 19520, 19680, 19840, 20000, 20160, 20320, 20480, 20640] 12 -1
...fork_Osaka-discount_table_4_of_4-blockchain_test_from_state_test-precompile_address_12--input_one_byte_too_long [744816, 749700, 756000, 760848, 765672, 770472, 776736, 781500, 786240, 792480, 797184, 803412] [18880, 19040, 19200, 19360, 19520, 19680, 19840, 20000, 20160, 20320, 20480, 20640] 12 1