@@ -873,6 +873,94 @@ def test_worst_precompile_only_data_input(
873
873
),
874
874
id = "mod_1360_gas_balanced" ,
875
875
),
876
+ pytest .param (
877
+ ModExpInput (
878
+ base = 8 * "FF" ,
879
+ exponent = 81 * "FF" ,
880
+ modulus = 7 * "FF" ,
881
+ ),
882
+ id = "mod_8_exp_648" ,
883
+ ),
884
+ pytest .param (
885
+ ModExpInput (
886
+ base = 8 * "FF" ,
887
+ exponent = "FF" + 111 * "FF" ,
888
+ modulus = 7 * "FF" ,
889
+ ),
890
+ id = "mod_8_exp_896" ,
891
+ ),
892
+ pytest .param (
893
+ ModExpInput (
894
+ base = 32 * "FF" ,
895
+ exponent = 4 * "FF" ,
896
+ modulus = "00" + 31 * "FF" ,
897
+ ),
898
+ id = "mod_32_exp_32" ,
899
+ ),
900
+ pytest .param (
901
+ ModExpInput (
902
+ base = 32 * "FF" ,
903
+ exponent = "0D" + 4 * "FF" ,
904
+ modulus = "00" + 31 * "FF" ,
905
+ ),
906
+ id = "mod_32_exp_36" ,
907
+ ),
908
+ pytest .param (
909
+ ModExpInput (
910
+ base = 32 * "FF" ,
911
+ exponent = 5 * "FF" ,
912
+ modulus = "00" + 31 * "FF" ,
913
+ ),
914
+ id = "mod_32_exp_40" ,
915
+ ),
916
+ pytest .param (
917
+ ModExpInput (
918
+ base = 32 * "FF" ,
919
+ exponent = 8 * "FF" ,
920
+ modulus = "00" + 31 * "FF" ,
921
+ ),
922
+ id = "mod_32_exp_64" ,
923
+ ),
924
+ pytest .param (
925
+ ModExpInput (
926
+ base = 32 * "FF" ,
927
+ exponent = "01" + 8 * "FF" ,
928
+ modulus = "00" + 31 * "FF" ,
929
+ ),
930
+ id = "mod_32_exp_65" ,
931
+ ),
932
+ pytest .param (
933
+ ModExpInput (
934
+ base = 32 * "FF" ,
935
+ exponent = 16 * "FF" ,
936
+ modulus = "00" + 31 * "FF" ,
937
+ ),
938
+ id = "mod_32_exp_128" ,
939
+ ),
940
+ pytest .param (
941
+ ModExpInput (
942
+ base = 256 * "FF" ,
943
+ exponent = "03" + 0 * "FF" ,
944
+ modulus = 8 * ("00" + 31 * "FF" ),
945
+ ),
946
+ id = "mod_256_exp_2" ,
947
+ ),
948
+ pytest .param (
949
+ ModExpInput (
950
+ base = 264 * "FF" ,
951
+ exponent = "03" + 0 * "FF" ,
952
+ modulus = 8 * ("00" + 31 * "FF" ) + 7 * "FF" ,
953
+ ),
954
+ id = "mod_264_exp_2" ,
955
+ ),
956
+ pytest .param (
957
+ ModExpInput (
958
+ base = 1024 * "FF" ,
959
+ exponent = "03" ,
960
+ modulus = 32 * ("00" + 31 * "FF" ),
961
+ ),
962
+ id = "mod_1024_exp_2" ,
963
+ ),
876
964
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCases/ModexpVulnerability.cs#L122
877
965
pytest .param (
878
966
ModExpInput (
@@ -1161,6 +1249,14 @@ def test_worst_precompile_only_data_input(
1161
1249
),
1162
1250
id = "mod_vul_common_200n3" ,
1163
1251
),
1252
+ pytest .param (
1253
+ ModExpInput (
1254
+ base = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ,
1255
+ exponent = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ,
1256
+ modulus = "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe" ,
1257
+ ),
1258
+ id = "mod_vul_zkevm_worst_case" ,
1259
+ ),
1164
1260
],
1165
1261
)
1166
1262
def test_worst_modexp (
0 commit comments