Skip to content

Commit 3397c23

Browse files
author
Vesselin Velichkov
committed
plonk: removed check that we are on the BLS12-381 in view of the fact that all example test vectors are defined on this curve. the check is not necessary since there will be an error at the compiler level if there is an attempt to compile the unit tests for a curve other than BLS12-381.
1 parent b1c76fc commit 3397c23

File tree

1 file changed

+17
-71
lines changed

1 file changed

+17
-71
lines changed

libsnark/zk_proof_systems/plonk/tests/test_plonk.cpp

Lines changed: 17 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,12 @@ void test_verify_invalid_proof(
134134
}
135135

136136
/// Compute or fill-in ciruit specific data from example.
137+
/// \attention the example class is defined specifically for the BLS12-381
138+
/// curve, so make sure we are using this curve
137139
template<typename ppT>
138140
circuit_t<ppT> plonk_circuit_description_from_example(
139141
const plonk_example example)
140142
{
141-
// the example class is defined specifically for the BLS12-381
142-
// curve, so make sure we are using this curve TODO: remove when
143-
// the implementation is stable and tested
144-
try {
145-
plonk_exception_assert_curve_bls12_381<ppT>();
146-
} catch (const std::domain_error &e) {
147-
std::cout << "Error: " << e.what() << "\n";
148-
exit(EXIT_FAILURE);
149-
}
150-
151143
using Field = libff::Fr<ppT>;
152144

153145
// public input (PI)
@@ -458,19 +450,12 @@ void test_plonk_prover_round_five(
458450
ASSERT_EQ(W_zeta_omega_at_secret_aff.Y, example.W_zeta_omega_at_secret[1]);
459451
}
460452

453+
/// \attention the example class is defined specifically for the BLS12-381
454+
/// curve, so make sure we are using this curve
461455
template<typename ppT> void test_plonk_prover_rounds()
462456
{
463457
using Field = libff::Fr<ppT>;
464458

465-
// example test values are defined specifically for the BLS12-381
466-
// curve, so make sure we are using this curve
467-
try {
468-
plonk_exception_assert_curve_bls12_381<ppT>();
469-
} catch (const std::domain_error &e) {
470-
std::cout << "Error: " << e.what() << "\n";
471-
exit(EXIT_FAILURE);
472-
}
473-
474459
ppT::init_public_params();
475460

476461
// load test vector values from example circuit
@@ -562,18 +547,12 @@ template<typename ppT> void test_plonk_prover_rounds()
562547
srs);
563548
}
564549

550+
/// \attention the example class is defined specifically for the BLS12-381
551+
/// curve, so make sure we are using this curve
565552
template<typename ppT> void test_plonk_srs()
566553
{
567554
using Field = libff::Fr<ppT>;
568555

569-
// example test values are defined specifically for the BLS12-381
570-
// curve, so make sure we are using this curve
571-
try {
572-
plonk_exception_assert_curve_bls12_381<ppT>();
573-
} catch (const std::domain_error &e) {
574-
std::cout << "Error: " << e.what() << "\n";
575-
exit(EXIT_FAILURE);
576-
}
577556
ppT::init_public_params();
578557
// load test vector values from example circuit
579558
plonk_example example;
@@ -609,18 +588,12 @@ template<typename ppT> void test_plonk_srs()
609588
}
610589
}
611590

591+
/// \attention the example class is defined specifically for the BLS12-381
592+
/// curve, so make sure we are using this curve
612593
template<typename ppT> void test_plonk_prover()
613594
{
614595
using Field = libff::Fr<ppT>;
615596

616-
// example test values are defined specifically for the BLS12-381
617-
// curve, so make sure we are using this curve
618-
try {
619-
plonk_exception_assert_curve_bls12_381<ppT>();
620-
} catch (const std::domain_error &e) {
621-
std::cout << "Error: " << e.what() << "\n";
622-
exit(EXIT_FAILURE);
623-
}
624597
ppT::init_public_params();
625598
// load test vector values from example circuit
626599
plonk_example example;
@@ -700,20 +673,12 @@ template<typename ppT> void test_plonk_prover()
700673
ASSERT_EQ(W_zeta_omega_at_secret_aff.Y, example.W_zeta_omega_at_secret[1]);
701674
}
702675

676+
/// \attention the example class is defined specifically for the BLS12-381
677+
/// curve, so make sure we are using this curve
703678
template<typename ppT>
704679
void test_plonk_verifier_preprocessed_input(
705680
const plonk_example &example, const srs<ppT> &srs)
706681
{
707-
// the example class is defined specifically for the BLS12-381
708-
// curve, so make sure we are using this curve TODO: remove when
709-
// the implementation is stable and tested
710-
try {
711-
plonk_exception_assert_curve_bls12_381<ppT>();
712-
} catch (const std::domain_error &e) {
713-
std::cout << "Error: " << e.what() << "\n";
714-
exit(EXIT_FAILURE);
715-
}
716-
717682
// compute verifier preprocessed input
718683
const verifier_preprocessed_input_t<ppT> preprocessed_input =
719684
plonk_verifier<ppT>::preprocessed_input(srs);
@@ -846,7 +811,9 @@ void test_plonk_verifier_step_eleven(
846811
ASSERT_EQ(E1_aff.Y, example.E1[1]);
847812
}
848813

849-
// step 12
814+
/// test verifier step 12
815+
/// \attention the example class is defined specifically for the BLS12-381
816+
/// curve, so make sure we are using this curve
850817
template<typename ppT>
851818
void test_plonk_verifier_pairing(
852819
const plonk_example &example,
@@ -857,15 +824,6 @@ void test_plonk_verifier_pairing(
857824
const plonk_proof<ppT> &proof,
858825
const srs<ppT> &srs)
859826
{
860-
// the example class is defined specifically for the BLS12-381
861-
// curve, so make sure we are using this curve TODO: remove when
862-
// the implementation is stable and tested
863-
try {
864-
plonk_exception_assert_curve_bls12_381<ppT>();
865-
} catch (const std::domain_error &e) {
866-
std::cout << "Error: " << e.what() << "\n";
867-
exit(EXIT_FAILURE);
868-
}
869827
using Field = libff::Fr<ppT>;
870828
std::vector<libff::G1<ppT>> curve_points_lhs{
871829
proof.W_zeta_at_secret, proof.W_zeta_omega_at_secret};
@@ -912,18 +870,12 @@ void test_plonk_verifier_pairing(
912870
ASSERT_TRUE(b_accept);
913871
}
914872

873+
/// \attention the example class is defined specifically for the BLS12-381
874+
/// curve, so make sure we are using this curve
915875
template<typename ppT> void test_plonk_verifier_steps()
916876
{
917877
using Field = libff::Fr<ppT>;
918878

919-
// example test values are defined specifically for the BLS12-381
920-
// curve, so make sure we are using this curve
921-
try {
922-
plonk_exception_assert_curve_bls12_381<ppT>();
923-
} catch (const std::domain_error &e) {
924-
std::cout << "Error: " << e.what() << "\n";
925-
exit(EXIT_FAILURE);
926-
}
927879
ppT::init_public_params();
928880
// load test vector values from example circuit
929881
plonk_example example;
@@ -1021,18 +973,12 @@ template<typename ppT> void test_plonk_verifier_steps()
1021973
srs);
1022974
}
1023975

976+
/// \attention the example class is defined specifically for the BLS12-381
977+
/// curve, so make sure we are using this curve
1024978
template<typename ppT> void test_plonk_verifier()
1025979
{
1026980
using Field = libff::Fr<ppT>;
1027981

1028-
// example test values are defined specifically for the BLS12-381
1029-
// curve, so make sure we are using this curve
1030-
try {
1031-
plonk_exception_assert_curve_bls12_381<ppT>();
1032-
} catch (const std::domain_error &e) {
1033-
std::cout << "Error: " << e.what() << "\n";
1034-
exit(EXIT_FAILURE);
1035-
}
1036982
ppT::init_public_params();
1037983
// load test vector values from example circuit
1038984
plonk_example example;

0 commit comments

Comments
 (0)