Skip to content

Commit 6aba9a2

Browse files
test(zkevm): port nethermind modexp benchmark case (#1802)
1 parent d7c51a1 commit 6aba9a2

File tree

1 file changed

+225
-0
lines changed

1 file changed

+225
-0
lines changed

tests/zkevm/test_worst_compute.py

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,231 @@ def test_worst_precompile_only_data_input(
574574
),
575575
id="mod_odd_32b_exp_cover_windows",
576576
),
577+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L38
578+
pytest.param(
579+
ModExpInput(
580+
base=192 * "FF",
581+
exponent="03",
582+
modulus=6 * ("00" + 31 * "FF"),
583+
),
584+
id="mod_min_as_base_heavy",
585+
),
586+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L40
587+
pytest.param(
588+
ModExpInput(
589+
base=8 * "FF",
590+
exponent="07" + 75 * "FF",
591+
modulus=7 * "FF",
592+
),
593+
id="mod_min_as_exp_heavy",
594+
),
595+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L42
596+
pytest.param(
597+
ModExpInput(
598+
base=40 * "FF",
599+
exponent="01" + 3 * "FF",
600+
modulus="00" + 38 * "FF",
601+
),
602+
id="mod_min_as_balanced",
603+
),
604+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L44
605+
pytest.param(
606+
ModExpInput(
607+
base=32 * "FF",
608+
exponent=5 * "FF",
609+
modulus=("00" + 31 * "FF"),
610+
),
611+
id="mod_exp_208_gas_balanced",
612+
),
613+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L46
614+
pytest.param(
615+
ModExpInput(
616+
base=8 * "FF",
617+
exponent=81 * "FF",
618+
modulus=7 * "FF",
619+
),
620+
id="mod_exp_215_gas_exp_heavy",
621+
),
622+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L48
623+
pytest.param(
624+
ModExpInput(
625+
base=8 * "FF",
626+
exponent=112 * "FF",
627+
modulus=7 * "FF",
628+
),
629+
id="mod_exp_298_gas_exp_heavy",
630+
),
631+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L50
632+
pytest.param(
633+
ModExpInput(
634+
base=16 * "FF",
635+
exponent=40 * "FF",
636+
modulus=15 * "FF",
637+
),
638+
id="mod_pawel_2",
639+
),
640+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L52
641+
pytest.param(
642+
ModExpInput(
643+
base=24 * "FF",
644+
exponent=21 * "FF",
645+
modulus=23 * "FF",
646+
),
647+
id="mod_pawel_3",
648+
),
649+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L54
650+
pytest.param(
651+
ModExpInput(
652+
base=32 * "FF",
653+
exponent=12 * "FF",
654+
modulus="00" + 31 * "FF",
655+
),
656+
id="mod_pawel_4",
657+
),
658+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L56
659+
pytest.param(
660+
ModExpInput(
661+
base=280 * "FF",
662+
exponent="03",
663+
modulus=8 * ("00" + 31 * "FF") + 23 * "FF",
664+
),
665+
id="mod_408_gas_base_heavy",
666+
),
667+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L58
668+
pytest.param(
669+
ModExpInput(
670+
base=16 * "FF",
671+
exponent="15" + 37 * "FF",
672+
modulus=15 * "FF",
673+
),
674+
id="mod_400_gas_exp_heavy",
675+
),
676+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L60
677+
pytest.param(
678+
ModExpInput(
679+
base=48 * "FF",
680+
exponent="07" + 4 * "FF",
681+
modulus="00" + 46 * "FF",
682+
),
683+
id="mod_408_gas_balanced",
684+
),
685+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L62
686+
pytest.param(
687+
ModExpInput(
688+
base=344 * "FF",
689+
exponent="03",
690+
modulus=10 * ("00" + 31 * "FF") + 23 * "FF",
691+
),
692+
id="mod_616_gas_base_heavy",
693+
),
694+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L64
695+
pytest.param(
696+
ModExpInput(
697+
base=16 * "FF",
698+
exponent="07" + 56 * "FF",
699+
modulus=15 * "FF",
700+
),
701+
id="mod_600_gas_exp_heavy",
702+
),
703+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L66
704+
pytest.param(
705+
ModExpInput(
706+
base=48 * "FF",
707+
exponent="07" + 6 * "FF",
708+
modulus="00" + 46 * "FF",
709+
),
710+
id="mod_600_as_balanced",
711+
),
712+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L68
713+
pytest.param(
714+
ModExpInput(
715+
base=392 * "FF",
716+
exponent="03",
717+
modulus=12 * ("00" + 31 * "FF") + 7 * "FF",
718+
),
719+
id="mod_800_gas_base_heavy",
720+
),
721+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L70
722+
pytest.param(
723+
ModExpInput(
724+
base=16 * "FF",
725+
exponent="01" + 75 * "FF",
726+
modulus=15 * "FF",
727+
),
728+
id="mod_800_gas_exp_heavy",
729+
),
730+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L72
731+
pytest.param(
732+
ModExpInput(
733+
base=56 * "FF",
734+
exponent=6 * "FF",
735+
modulus="00" + 54 * "FF",
736+
),
737+
id="mod_767_gas_balanced",
738+
),
739+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L74
740+
pytest.param(
741+
ModExpInput(
742+
base=16 * "FF",
743+
exponent=80 * "FF",
744+
modulus=15 * "FF",
745+
),
746+
id="mod_852_gas_exp_heavy",
747+
),
748+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L76
749+
pytest.param(
750+
ModExpInput(
751+
base=408 * "FF",
752+
exponent="03",
753+
modulus=12 * ("00" + 31 * "FF") + 23 * "FF",
754+
),
755+
id="mod_867_gas_base_heavy",
756+
),
757+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L78
758+
pytest.param(
759+
ModExpInput(
760+
base=56 * "FF",
761+
exponent="2b" + 7 * "FF",
762+
modulus="00" + 54 * "FF",
763+
),
764+
id="mod_996_gas_balanced",
765+
),
766+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L80
767+
pytest.param(
768+
ModExpInput(
769+
base=448 * "FF",
770+
exponent="03",
771+
modulus=14 * ("00" + 31 * "FF"),
772+
),
773+
id="mod_1045_gas_base_heavy",
774+
),
775+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L82
776+
pytest.param(
777+
ModExpInput(
778+
base=32 * "FF",
779+
exponent=16 * "FF",
780+
modulus="00" + 31 * "FF",
781+
),
782+
id="mod_677_gas_base_heavy",
783+
),
784+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L84
785+
pytest.param(
786+
ModExpInput(
787+
base=24 * "FF",
788+
exponent=32 * "FF",
789+
modulus=23 * "FF",
790+
),
791+
id="mod_765_gas_exp_heavy",
792+
),
793+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/Modexp.cs#L86
794+
pytest.param(
795+
ModExpInput(
796+
base=32 * "FF",
797+
exponent=32 * "FF",
798+
modulus="00" + 31 * "FF",
799+
),
800+
id="mod_1360_gas_balanced",
801+
),
577802
],
578803
)
579804
def test_worst_modexp(

0 commit comments

Comments
 (0)