-
Notifications
You must be signed in to change notification settings - Fork 405
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
Add PCS types and basic setup flow using SRS #28
Conversation
* cleanup secondary circuit code * rework relaxed nimfs * fix circuits * run bench build in the same profile * reduce the number of bits to 127
This looks good. However, I think the last patch (merge of main) is not right. Did you want to rebase the two commits not in main onto main? |
* cleanup secondary circuit code * rework relaxed nimfs * fix circuits * run bench build in the same profile * reduce the number of bits to 127
cd811ab
to
9964e5a
Compare
.gitignore
Outdated
|
||
# public parameter files | ||
*.zst |
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.
This is supposed to used cache folder. If postponed for later, newline missing
prover/src/pp.rs
Outdated
{ | ||
let f = File::open(file)?; | ||
let mut dec = Decoder::new(&f)?; | ||
let pp = PP::<SP>::deserialize_compressed(&mut dec)?; | ||
let pp = PP::<C, SP>::deserialize_compressed_unchecked(&mut dec)?; |
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.
Why is this change needed?
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.
I thought it wouldn't make a difference anymore due to the arkworks update: is
this not true?
SC: StepCircuit<F1> + Sync, | ||
SP: SetupParams<G1, G2, C1, C2, RO, SC> + Sync, | ||
SP: SetupParams<G1, G2, C, C2, RO, SC> + Sync, |
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.
We should keep C1 C2
notation
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.
C1 is a type alias for Pedersen: here, we want C to be generic so it works
for PVC as well.
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.
Didn't notice it because of wildcard imports unfortunately
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
SC: StepCircuit<F1> + Sync, | ||
SP: SetupParams<G1, G2, C1, C2, RO, SC> + Sync, | ||
SP: SetupParams<G1, G2, C, C2, RO, SC> + Sync, |
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.
Didn't notice it because of wildcard imports unfortunately
pub fn gen_test_srs(num_vars: usize) -> Result<SRS, ProofError> { | ||
let mut rng = test_rng(); | ||
PC::setup(num_vars, b"test_srs", &mut rng).map_err(|_| ProofError::SRSSamplingError) | ||
} | ||
|
||
pub fn save_srs(srs: SRS, file: &str) -> Result<(), ProofError> { | ||
let f = File::create(file)?; | ||
let mut enc = Encoder::new(&f, 0)?; | ||
srs.serialize_compressed(&mut enc)?; | ||
enc.finish()?; | ||
f.sync_all()?; | ||
Ok(()) | ||
} | ||
|
||
pub fn gen_test_srs_to_file(poly_length: usize, file: &str) -> Result<(), ProofError> { | ||
let srs = gen_test_srs(poly_length)?; | ||
save_srs(srs, file) | ||
} |
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.
same story
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.
these aren't tests; the compression-cli PR will introduce a CLI command to call into these. the word test is in the name to emphasize that an SRS generated this way is insecure and not to be used in production.
* testing proof deserialization * proofs save and verify * removed cargo.lock * todo: merge dorebell onto this * fixed merge mistakes * reads proof and compresses. key not yet saved to file * added back cargo.lock * moved the compression cli into prover crate * formatting * remove whitespace * added com option to prove * updated local prove * todo:save key and proof to file * derive CanonicalSerialize+CanonicalDeserialize for Spartan types * add options to save and load spartan key from file * save compressed proof to file, implement arkworks serialization * clippy * remove SRS generation from CI * ignore spartan_encode_test * integrate compression cli with recent version of nexus-tools * add cli function to sample test SRS * forgot to add new files * small compression UI fixes * add spartan setup command to main 'cargo nexus' * bump number of SRS vars to 27 * minor fix * review fixes * another round of review fixes * read pp and srs from default cache locations if unspecified during compression * add helper function to get minimum srs size for a given k --------- Co-authored-by: Dan Dore <dorebell@gmail.com>
* Initial CCS implementation. * Remove direct construction interfaces so that everything goes through R1CS. * Trim more, Fold multipliers together, and inline satisfaction checking. * Fix formatting. * Precompute products. * Remove direct CCS construction. * Add mle helpers. * Start to integrate polynomial commitments. * Shading closer to polynomial commitments. * Initial stab at relating various polynomial types and traits. * Finish utility functions. * Fix endianness and ranges and get tests passing. * Fix formatting. * Realized there's a better way to invoke the partially fixed polynomial. * Update interfaces and some additional reworking. * Resolve clippy. * Unify shapes. * Product renaming Co-authored-by: Dan Dore <dorebell@gmail.com> * Revert "Unify shapes." This reverts commit 3463e43. * Move to polynomial/poly commitment implementations from Spartan repo. * Move to unified matrix-based model. * Fix tests. * Fix fmt. * Remove files accidently restored during rebase. * Move to using polynomial commitment exlcusively. * Fix formatting. --------- Co-authored-by: Dan Dore <dorebell@gmail.com>
* Update README.md * Update README.md * Create .all-contributorsrc
* docs: update README.md * docs: update .all-contributorsrc --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
* Delete .all-contributorsrc * Update README.md
This adds some basic support for generating public parameters from a SRS for a polynomial commitment scheme.