Skip to content

Commit 6ee9787

Browse files
test(zkevm): add extra test case for ecAdd, ecMul and ecPairing (#1799)
* tests(zkevm): port test case for ecadd precompile * tests(zkevm): port test case for ecmul precompile * tests(zkevm): port test case for ecpairing precompile
1 parent 57cd36c commit 6ee9787

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

tests/zkevm/test_worst_compute.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,28 @@ def test_worst_modexp(
863863
],
864864
id="bn128_add",
865865
),
866+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L326
867+
pytest.param(
868+
0x06,
869+
[
870+
"0000000000000000000000000000000000000000000000000000000000000000",
871+
"0000000000000000000000000000000000000000000000000000000000000000",
872+
"0000000000000000000000000000000000000000000000000000000000000000",
873+
"0000000000000000000000000000000000000000000000000000000000000000",
874+
],
875+
id="bn128_add_infinities",
876+
),
877+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L329
878+
pytest.param(
879+
0x06,
880+
[
881+
"0000000000000000000000000000000000000000000000000000000000000001",
882+
"0000000000000000000000000000000000000000000000000000000000000002",
883+
"0000000000000000000000000000000000000000000000000000000000000001",
884+
"0000000000000000000000000000000000000000000000000000000000000002",
885+
],
886+
id="bn128_add_1_2",
887+
),
866888
pytest.param(
867889
0x07,
868890
[
@@ -872,6 +894,66 @@ def test_worst_modexp(
872894
],
873895
id="bn128_mul",
874896
),
897+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L335
898+
pytest.param(
899+
0x07,
900+
[
901+
"0000000000000000000000000000000000000000000000000000000000000000",
902+
"0000000000000000000000000000000000000000000000000000000000000000",
903+
"0000000000000000000000000000000000000000000000000000000000000002",
904+
],
905+
id="bn128_mul_infinities_2_scalar",
906+
),
907+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L338
908+
pytest.param(
909+
0x07,
910+
[
911+
"0000000000000000000000000000000000000000000000000000000000000000",
912+
"0000000000000000000000000000000000000000000000000000000000000000",
913+
"25f8c89ea3437f44f8fc8b6bfbb6312074dc6f983809a5e809ff4e1d076dd585",
914+
],
915+
id="bn128_mul_infinities_32_byte_scalar",
916+
),
917+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L341
918+
pytest.param(
919+
0x07,
920+
[
921+
"0000000000000000000000000000000000000000000000000000000000000001",
922+
"0000000000000000000000000000000000000000000000000000000000000002",
923+
"0000000000000000000000000000000000000000000000000000000000000002",
924+
],
925+
id="bn128_mul_1_2_2_scalar",
926+
),
927+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L344
928+
pytest.param(
929+
0x07,
930+
[
931+
"0000000000000000000000000000000000000000000000000000000000000001",
932+
"0000000000000000000000000000000000000000000000000000000000000002",
933+
"25f8c89ea3437f44f8fc8b6bfbb6312074dc6f983809a5e809ff4e1d076dd585",
934+
],
935+
id="bn128_mul_1_2_32_byte_scalar",
936+
),
937+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L347
938+
pytest.param(
939+
0x07,
940+
[
941+
"089142debb13c461f61523586a60732d8b69c5b38a3380a74da7b2961d867dbf",
942+
"2d5fc7bbc013c16d7945f190b232eacc25da675c0eb093fe6b9f1b4b4e107b36",
943+
"0000000000000000000000000000000000000000000000000000000000000002",
944+
],
945+
id="bn128_mul_32_byte_coord_and_2_scalar",
946+
),
947+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L350
948+
pytest.param(
949+
0x07,
950+
[
951+
"089142debb13c461f61523586a60732d8b69c5b38a3380a74da7b2961d867dbf",
952+
"2d5fc7bbc013c16d7945f190b232eacc25da675c0eb093fe6b9f1b4b4e107b36",
953+
"25f8c89ea3437f44f8fc8b6bfbb6312074dc6f983809a5e809ff4e1d076dd585",
954+
],
955+
id="bn128_mul_32_byte_coord_and_scalar",
956+
),
875957
pytest.param(
876958
0x08,
877959
[
@@ -905,6 +987,8 @@ def test_worst_modexp(
905987
],
906988
id="bn128_one_pairing",
907989
),
990+
# Ported from https://github.com/NethermindEth/nethermind/blob/ceb8d57b8530ce8181d7427c115ca593386909d6/tools/EngineRequestsGenerator/TestCase.cs#L353
991+
pytest.param(0x08, [""], id="bn128_two_pairings_empty"),
908992
pytest.param(
909993
Blake2bSpec.BLAKE2_PRECOMPILE_ADDRESS,
910994
[

0 commit comments

Comments
 (0)