This repository was archived by the owner on Feb 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Added tests of alt_bn128_254 in various suitest #292
Draft
tigran-at-nil
wants to merge
1
commit into
master
Choose a base branch
from
add_alt_bn128_254_tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,10 @@ | |
| #include <nil/crypto3/algebra/pairing/mnt4.hpp> | ||
| #include <nil/crypto3/algebra/fields/arithmetic_params/mnt4.hpp> | ||
|
|
||
| #include <nil/crypto3/algebra/curves/alt_bn128.hpp> | ||
| #include <nil/crypto3/algebra/pairing/alt_bn128.hpp> | ||
| #include <nil/crypto3/algebra/fields/arithmetic_params/alt_bn128.hpp> | ||
|
|
||
| #include <nil/crypto3/zk/commitments/polynomial/kzg.hpp> | ||
| #include <nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp> | ||
|
|
||
|
|
@@ -108,7 +112,8 @@ struct kzg_basic_test_runner { | |
| using BasicTestFixtures = boost::mpl::list< | ||
| kzg_basic_test_runner<algebra::curves::bls12_381>, | ||
| kzg_basic_test_runner<algebra::curves::mnt4_298>, | ||
| kzg_basic_test_runner<algebra::curves::mnt6_298> | ||
| kzg_basic_test_runner<algebra::curves::mnt6_298>, | ||
| kzg_basic_test_runner<algebra::curves::alt_bn128_254> | ||
| >; | ||
|
|
||
| BOOST_AUTO_TEST_CASE_TEMPLATE(kzg_basic_test, F, BasicTestFixtures) { | ||
|
|
@@ -144,7 +149,8 @@ struct kzg_random_test_runner { | |
| using RandomTestFixtures = boost::mpl::list< | ||
| kzg_random_test_runner<algebra::curves::bls12_381>, | ||
| kzg_random_test_runner<algebra::curves::mnt4_298>, | ||
| kzg_random_test_runner<algebra::curves::mnt6_298> | ||
| kzg_random_test_runner<algebra::curves::mnt6_298>, | ||
| kzg_random_test_runner<algebra::curves::alt_bn128_254> | ||
| >; | ||
|
|
||
| BOOST_AUTO_TEST_CASE_TEMPLATE(kzg_random_test, F, RandomTestFixtures) { | ||
|
|
@@ -250,6 +256,51 @@ BOOST_AUTO_TEST_CASE(kzg_test_mnt6_accumulated) { | |
| } | ||
| BOOST_AUTO_TEST_SUITE_END() | ||
|
|
||
| /*BOOST_AUTO_TEST_CASE(kzg_test_alt_bn128_254_accumulated) { | ||
|
|
||
| typedef algebra::curves::alt_bn128_254 curve_type; | ||
| typedef typename curve_type::scalar_field_type::value_type scalar_value_type; | ||
|
|
||
| typedef zk::commitments::kzg<curve_type> kzg_type; | ||
|
|
||
| scalar_value_type alpha = 7u; | ||
| std::size_t n = 8; | ||
| scalar_value_type z = 2u; | ||
| const polynomial<scalar_value_type> f = { | ||
| 0x0ed6fb07f52c1f1ef7952250702368474f20fd7af906ba3a5842cdb7946c69b603852bf1069_cppui_modular298, | ||
| 0x14db9efba58de09f8ccb1d73fefce45393856e6a7509006561fe67ea354ec69d791b44c1476_cppui_modular298, | ||
| 0x0e9fa83a6f8891bc7e6aa1afae85e11dd80cdef32dfcef7cedc12792cf74141c899c8fb1f98_cppui_modular298, | ||
| 0x101cc0b43782ca40ae5bf96aabf461e1a623ab9284acac3bb6d55bff4429356dad714ee0bd0_cppui_modular298, | ||
| 0x1310586a4d1ed251d1e4c95711fb9346a2b233649f5ce32fe1cf3aea423d131787187a13799_cppui_modular298, | ||
| 0x0d9ed064a24e83ac6134de7cca08bdc3e31ffd4db0a004b63039f76821ec2cc53b7e6a74735_cppui_modular298, | ||
| 0x2839e48822f55b4e487b817ddf06a6e32e0dcc0c2ced1e738d38fec15bd4717d7680dda90ec_cppui_modular298, | ||
| }; | ||
|
|
||
| auto f_eval = f.evaluate(alpha); | ||
|
|
||
| auto params = typename kzg_type::params_type(n, alpha); | ||
| auto commit = zk::algorithms::commit<kzg_type>(params, f); | ||
| nil::marshalling::status_type status; | ||
| using endianness = nil::marshalling::option::big_endian; | ||
| std::vector<uint8_t> single_commitment_bytes = | ||
| nil::marshalling::pack<endianness>(commit, status); | ||
| dump_vector(single_commitment_bytes, "commitment"); | ||
|
|
||
| BOOST_CHECK(curve_type::template g1_type<>::value_type::one() == params.commitment_key[0]); | ||
| BOOST_CHECK(alpha * curve_type::template g1_type<>::value_type::one() == params.commitment_key[1]); | ||
| BOOST_CHECK(alpha * alpha * curve_type::template g1_type<>::value_type::one() == params.commitment_key[2]); | ||
| BOOST_CHECK(alpha * alpha * alpha * curve_type::template g1_type<>::value_type::one() == params.commitment_key[3]); | ||
| BOOST_CHECK(alpha * curve_type::template g2_type<>::value_type::one() == params.verification_key); | ||
|
|
||
| BOOST_CHECK(f_eval * curve_type::template g1_type<>::value_type::one() == commit); | ||
|
|
||
| typename kzg_type::public_key_type pk = {commit, z, f.evaluate(z)}; | ||
| auto proof = zk::algorithms::proof_eval<kzg_type>(params, f, pk); | ||
|
|
||
| BOOST_CHECK(zk::algorithms::verify_eval<kzg_type>(params, proof, pk)); | ||
| } | ||
| BOOST_AUTO_TEST_SUITE_END()*/ | ||
|
|
||
| BOOST_AUTO_TEST_SUITE(batched_kzg_test_suite) | ||
|
|
||
| template<typename curve_type> | ||
|
|
@@ -298,7 +349,8 @@ struct batched_kzg_basic_test_runner { | |
| using BatchedBasicTestFixtures = boost::mpl::list< | ||
| batched_kzg_basic_test_runner<algebra::curves::bls12_381>, | ||
| batched_kzg_basic_test_runner<algebra::curves::mnt4_298>, | ||
| batched_kzg_basic_test_runner<algebra::curves::mnt6_298> | ||
| batched_kzg_basic_test_runner<algebra::curves::mnt6_298>, | ||
| batched_kzg_basic_test_runner<algebra::curves::alt_bn128_254> | ||
| >; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add alt_bn128_254 test |
||
|
|
||
| BOOST_AUTO_TEST_CASE_TEMPLATE(batched_kzg_basic_test, F, BatchedBasicTestFixtures) { | ||
|
|
@@ -360,7 +412,8 @@ struct batched_kzg_bigger_test_runner { | |
| using BatchedBiggerTestFixtures = boost::mpl::list< | ||
| batched_kzg_bigger_test_runner<algebra::curves::bls12_381>, | ||
| batched_kzg_bigger_test_runner<algebra::curves::mnt4_298>, | ||
| batched_kzg_bigger_test_runner<algebra::curves::mnt6_298> | ||
| batched_kzg_bigger_test_runner<algebra::curves::mnt6_298>, | ||
| batched_kzg_bigger_test_runner<algebra::curves::alt_bn128_254> | ||
| >; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add alt_bn128_254 test |
||
|
|
||
| BOOST_AUTO_TEST_CASE_TEMPLATE(batched_kzg_bigger_test, F, BatchedBiggerTestFixtures) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,11 @@ | |
| #include <nil/crypto3/algebra/curves/mnt6.hpp> | ||
| #include <nil/crypto3/algebra/pairing/mnt6.hpp> | ||
| #include <nil/crypto3/algebra/fields/arithmetic_params/mnt6.hpp> | ||
| /**/ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove empty comments |
||
| #include <nil/crypto3/algebra/curves/alt_bn128.hpp> | ||
| #include <nil/crypto3/algebra/pairing/alt_bn128.hpp> | ||
| #include <nil/crypto3/algebra/fields/arithmetic_params/alt_bn128.hpp> | ||
| /**/ | ||
|
|
||
| #include <nil/crypto3/random/algebraic_engine.hpp> | ||
| #include <nil/crypto3/random/algebraic_random_device.hpp> | ||
|
|
@@ -77,7 +82,8 @@ BOOST_AUTO_TEST_SUITE(placeholder_circuit2_kzg) | |
|
|
||
| using TestRunners = boost::mpl::list< | ||
| placeholder_kzg_test_runner<algebra::curves::mnt4_298, hash_type>, | ||
| placeholder_kzg_test_runner<algebra::curves::mnt6_298, hash_type> | ||
| placeholder_kzg_test_runner<algebra::curves::mnt6_298, hash_type>, | ||
| placeholder_kzg_test_runner<algebra::curves::alt_bn128_254, hash_type> | ||
| >; | ||
|
|
||
| BOOST_AUTO_TEST_CASE_TEMPLATE(kzg_test, TestRunner, TestRunners) { | ||
|
|
@@ -99,7 +105,8 @@ BOOST_AUTO_TEST_SUITE(placeholder_circuit2_kzg_v2) | |
|
|
||
| using TestRunners = boost::mpl::list< | ||
| placeholder_kzg_test_runner_v2<algebra::curves::mnt4_298, hash_type>, | ||
| placeholder_kzg_test_runner_v2<algebra::curves::mnt6_298, hash_type> | ||
| placeholder_kzg_test_runner_v2<algebra::curves::mnt6_298, hash_type>, | ||
| placeholder_kzg_test_runner_v2<algebra::curves::alt_bn128_254, hash_type> | ||
| >; | ||
|
|
||
| BOOST_AUTO_TEST_CASE_TEMPLATE(kzg_v2_test, TestRunner, TestRunners) { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty comments