-
Notifications
You must be signed in to change notification settings - Fork 598
feat: consistent handling of point at infinity in transcript #7709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0a16e60
7144552
65e9613
a659abf
b6e27b9
03ca5fa
dc486a0
b56cb85
002d88e
11592c9
e74d3f7
c60ac06
da51a7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,10 +149,25 @@ template <typename G1> class TestAffineElement : public testing::Test { | |
| EXPECT_EQ(affine_points[i], -result[i]); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @brief Ensure that the point at inifinity has a fixed value. | ||
| * | ||
| */ | ||
| static void test_fixed_point_at_infinity() | ||
| { | ||
| using Fq = affine_element::Fq; | ||
| affine_element P = affine_element::infinity(); | ||
| affine_element Q(Fq::zero(), Fq::zero()); | ||
| Q.x.self_set_msb(); | ||
| affine_element R = affine_element(element::random_element()); | ||
| EXPECT_EQ(P, Q); | ||
|
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. And not equal to a non-point at infinity? |
||
| EXPECT_NE(P, R); | ||
| } | ||
| }; | ||
|
|
||
| using TestTypes = testing::Types<bb::g1>; | ||
| // using TestTypes = testing::Types<bb::g1, grumpkin::g1, secp256k1::g1, secp256r1::g1>; | ||
| // using TestTypes = testing::Types<bb::g1>; | ||
| using TestTypes = testing::Types<bb::g1, grumpkin::g1, secp256k1::g1, secp256r1::g1>; | ||
| } // namespace | ||
|
|
||
| TYPED_TEST_SUITE(TestAffineElement, TestTypes); | ||
|
|
@@ -176,6 +191,15 @@ TYPED_TEST(TestAffineElement, PointCompression) | |
| } | ||
| } | ||
|
|
||
| TYPED_TEST(TestAffineElement, FixedInfinityPoint) | ||
| { | ||
| if constexpr (TypeParam::Fq::modulus.data[3] >= 0x4000000000000000ULL) { | ||
| GTEST_SKIP(); | ||
| } else { | ||
| TestFixture::test_fixed_point_at_infinity(); | ||
| } | ||
| } | ||
|
|
||
| TYPED_TEST(TestAffineElement, PointCompressionUnsafe) | ||
| { | ||
| if constexpr (TypeParam::Fq::modulus.data[3] >= 0x4000000000000000ULL) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -515,6 +515,9 @@ template <class Fq, class Fr, class T> constexpr void element<Fq, Fr, T>::self_s | |
| x.data[2] = Fq::modulus.data[2]; | ||
| x.data[3] = Fq::modulus.data[3]; | ||
| } else { | ||
| (*this).x = Fq::zero(); | ||
| (*this).y = Fq::zero(); | ||
|
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. You should also put zero into z
Author
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. Oh yeah I forgot about z thank you <3 |
||
| (*this).z = Fq::zero(); | ||
| x.self_set_msb(); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,12 +26,10 @@ class ECCVMTranscriptTests : public ::testing::Test { | |
| * | ||
| * @return TranscriptManifest | ||
| */ | ||
| TranscriptManifest construct_eccvm_honk_manifest(size_t circuit_size, size_t log_ipa_poly_degree) | ||
| TranscriptManifest construct_eccvm_honk_manifest(size_t circuit_size) | ||
| { | ||
| TranscriptManifest manifest_expected; | ||
| auto log_n = numeric::get_msb(circuit_size); | ||
|
Author
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. This assert is obsolete by the constant size proof stuff and now that we enable asserts it will complain |
||
| ASSERT(log_n == log_ipa_poly_degree); | ||
|
|
||
| size_t MAX_PARTIAL_RELATION_LENGTH = Flavor::BATCHED_RELATION_PARTIAL_LENGTH; | ||
| // Size of types is number of bb::frs needed to represent the type | ||
| size_t frs_per_Fr = bb::field_conversion::calc_num_bn254_frs<FF>(); | ||
|
|
@@ -252,8 +250,7 @@ TEST_F(ECCVMTranscriptTests, ProverManifestConsistency) | |
| auto proof = prover.construct_proof(); | ||
|
|
||
| // Check that the prover generated manifest agrees with the manifest hard coded in this suite | ||
| auto manifest_expected = | ||
| this->construct_eccvm_honk_manifest(prover.key->circuit_size, prover.sumcheck_output.challenge.size()); | ||
| auto manifest_expected = this->construct_eccvm_honk_manifest(prover.key->circuit_size); | ||
| auto prover_manifest = prover.transcript->get_manifest(); | ||
| // Note: a manifest can be printed using manifest.print() | ||
| for (size_t round = 0; round < manifest_expected.size(); ++round) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.