-
Notifications
You must be signed in to change notification settings - Fork 1
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
Absorb Ligero Public Parameters #71
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
use ark_crypto_primitives::{ | ||
crh::{CRHScheme, TwoToOneCRHScheme}, | ||
merkle_tree::{Config, LeafParam, TwoToOneParam}, | ||
sponge::Absorb, | ||
}; | ||
use ark_ff::PrimeField; | ||
use ark_std::{log2, marker::PhantomData}; | ||
|
@@ -96,6 +97,23 @@ | |
} | ||
} | ||
|
||
impl<F, C, H> Absorb for LigeroPCParams<F, C, H> | ||
where | ||
F: PrimeField, | ||
C: Config, | ||
H: CRHScheme, | ||
{ | ||
fn to_sponge_bytes(&self, dest: &mut Vec<u8>) { | ||
self.sec_param.to_sponge_bytes(dest); | ||
self.rho_inv.to_sponge_bytes(dest); | ||
} | ||
|
||
fn to_sponge_field_elements<F2: PrimeField>(&self, dest: &mut Vec<F2>) { | ||
self.sec_param.to_sponge_field_elements(dest); | ||
self.rho_inv.to_sponge_field_elements(dest); | ||
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. Hmm I am a bit doubtful about:
Regarding 1: - I think the well-formedness check boolean Regarding 2: I'm actually quite surprised that we don't have the RS-code parameters in the key: num rows, num_cols and num_ext_cols. It's true that we have rho = num_cols/num_ext_cols, but of course the quotient doesn't determine both of them separately. I've actually looked at the code and the verifier never learns these parameters until they have a commitment (they are in commitment.metadata). I think in most UV PCS definitions the public parameters should determine a degree bound on the polynomials (in UV Ligero the degree bound is simply num rows * num_cols - 1). Suppose we want to use this implementation of the PCS in a protocol where the polynomials must satisfy certain degree bounds. The way things are, there is no way in the API to enforce it, since it is Long story short (for point 2): the verifier key is missing three important parameters and I think that has genuine security implications when using the API. @mmagician I can talk to Hossein to fix it everywhere. One way or another, once those three 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. Regarding 1: the hashing parameters are definitely not empty. They determine the type of hash function used for:
These could in principle be all the same or all different. In our cases, the first is usually just identity, and the other two can have implications on the speed, especially if we're using SNARK-friendly hash functions. Bottom line: these parameters are important even in our usage. I don't know whether they should be absorbed though, I think you'll have a much better idea about this than I do. 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. Regarding 2: the reason for not including these was that a single verifier key can (right now) be used for multiple polynomials. If you add the cols/rows, that limits the polynomials to all be of the same size. 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. Could we tap into the wisdom of @mmaker here, especially on point 1 from above^ 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. To be clear, the issue of not having the parameters So at least we have to allow the constructor to optionally receive Going back to the FS question, I think we should absorb |
||
} | ||
} | ||
|
||
impl<F, C, H> LinCodeParametersInfo<C, H> for LigeroPCParams<F, C, H> | ||
where | ||
F: PrimeField, | ||
|
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.
You need to import
ark_std::vec::Vec
under theno_std
feature flag. If you want to test the library withno_std
you can installcross
(cargo install cross
) and then: