-
Notifications
You must be signed in to change notification settings - Fork 153
Constraints #47
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
Open
npwardberkeley
wants to merge
63
commits into
master
Choose a base branch
from
constraints
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.
Open
Constraints #47
Changes from 26 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
2d63406
prepared vk/commitment types, and individual opening challenges
npwardberkeley 895e274
addressed comments
npwardberkeley 084b4b9
removed constraints from this PR
npwardberkeley b3ac047
cargo fmt
npwardberkeley 85cc789
finish some final changes
weikengchen 8c25981
some other comments
weikengchen 6a7bc6a
remove the dependency of nonnative for now
weikengchen ee10685
try to fix nostd
weikengchen 24fd572
fix
npwardberkeley a467a52
constraints
npwardberkeley 37298ab
fix Cargo toml
weikengchen beee357
Default, Clone, ToConstraintField impls
npwardberkeley fdf1668
cargo fmt
npwardberkeley d04a9e9
cargo fmt
npwardberkeley 8f17d50
fixes
npwardberkeley 5e2ac2e
used HashMap instead of BTreeMap
npwardberkeley 1b7617f
using HashMap and HashSet
npwardberkeley e17ce7d
Update Cargo.toml
weikengchen 13c2ca0
Update pc_constraints.rs
weikengchen f080e51
fix nostd
weikengchen 88306f9
add density-optimized; clippy
weikengchen cf79c6b
add ToConstraintField
weikengchen 87084be
tracing
weikengchen a641d27
Merge branch 'master' into constraints
weikengchen 9baed3e
done
weikengchen 132842a
Update pc_constraints.rs
weikengchen 56e481a
fmt
weikengchen 8d4a964
Apply suggestions from code review
npwardberkeley 2eaed72
small fixes
npwardberkeley 1f639eb
Merge branch 'master' into constraints
weikengchen 7bc0da1
cleaning
weikengchen 58896f2
fix nostd
weikengchen 8c4641d
Merge branch 'master' into constraints
weikengchen 77c456a
reduce the PR size
oblivious-app ac23b82
reduce the PR size
oblivious-app ee7318c
reduce the PR size
oblivious-app f9baf70
reduce the PR size
oblivious-app cc2cfc0
reduce the PR size
oblivious-app a005c2d
minimize the PR size
oblivious-app 5a2ef01
Updates Marlin constraints to latest LC representation (#68)
howardwu ebcf462
bump digest abnd blake2
weikengchen 417154a
Update src/marlin_pc/constraints.rs
weikengchen d71e8d6
Merge branch 'master' into constraints
weikengchen 9a633fb
simplify and refactor
weikengchen 453841b
remove density-optimized feature
weikengchen 9f328fb
use PairingFriendlyCycle instead of CycleEngine
weikengchen 9019c22
simplify CycleEngine
weikengchen b0ff531
simplify
weikengchen 100bc57
derive Clone
weikengchen a757cc2
derive Clone for BatchLCProof
weikengchen cffd1a4
change the handling of one and minus one coeff
weikengchen 93969dc
no std
weikengchen 1751933
remove bench-utils
weikengchen 38add1b
rewrote some comments
npwardberkeley 78af43d
LCInfo type for clarity
npwardberkeley caa3375
update dependencies to use release versions
Will-Lin4 44ca5a6
fix lcitem type integration
Will-Lin4 afb2959
Merge branch 'master' into constraints
weikengchen e9d5af8
Merge branch 'master' into constraints
Pratyush 3cfa438
Fix and update dependencies to 0.3 (#93)
vlopes11 7f8e2c5
Merge `master` into `constraints` (#94)
vlopes11 9da67e2
Merge remote-tracking branch 'origin/master' into constraints
vlopes11 a688fe9
Update `PC::check_combinations` to optional rng (#97)
vlopes11 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
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
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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| use crate::*; | ||
| use ark_ec::{AffineCurve, PairingEngine, ProjectiveCurve}; | ||
| use ark_ff::{PrimeField, ToBytes, Zero}; | ||
| use ark_ff::{PrimeField, ToBytes, ToConstraintField, Zero}; | ||
| use ark_std::{ | ||
| borrow::Cow, | ||
| marker::PhantomData, | ||
|
|
@@ -90,6 +90,24 @@ impl<E: PairingEngine> ToBytes for VerifierKey<E> { | |
| } | ||
| } | ||
|
|
||
| impl<E: PairingEngine> ToConstraintField<<E::Fq as Field>::BasePrimeField> for VerifierKey<E> | ||
| where | ||
| E::G1Affine: ToConstraintField<<E::Fq as Field>::BasePrimeField>, | ||
| E::G2Affine: ToConstraintField<<E::Fq as Field>::BasePrimeField>, | ||
| { | ||
| fn to_field_elements(&self) -> Option<Vec<<E::Fq as Field>::BasePrimeField>> { | ||
| // TODO: gamma_g is omitted because our constraint system does not use. This is a little bit problematic | ||
|
||
| // The order should accommodate the one in the constraints.rs, which takes g, h, and beta_h. | ||
| let mut res = Vec::new(); | ||
|
|
||
| res.extend_from_slice(&self.g.to_field_elements().unwrap()); | ||
| res.extend_from_slice(&self.h.to_field_elements().unwrap()); | ||
| res.extend_from_slice(&self.beta_h.to_field_elements().unwrap()); | ||
|
|
||
| Some(res) | ||
| } | ||
| } | ||
|
|
||
| /// `PreparedVerifierKey` is the fully prepared version for checking evaluation proofs for a given commitment. | ||
| /// We omit gamma here for simplicity. | ||
| #[derive(Derivative)] | ||
|
|
@@ -109,7 +127,7 @@ impl<E: PairingEngine> PreparedVerifierKey<E> { | |
| let supported_bits = E::Fr::size_in_bits(); | ||
|
|
||
| let mut prepared_g = Vec::<E::G1Affine>::new(); | ||
| let mut g = E::G1Projective::from(vk.g.clone()); | ||
| let mut g = E::G1Projective::from(vk.g); | ||
| for _ in 0..supported_bits { | ||
| prepared_g.push(g.clone().into()); | ||
| g.double_in_place(); | ||
|
|
@@ -170,6 +188,15 @@ impl<'a, E: PairingEngine> AddAssign<(E::Fr, &'a Commitment<E>)> for Commitment< | |
| } | ||
| } | ||
|
|
||
| impl<E: PairingEngine> ToConstraintField<<E::Fq as Field>::BasePrimeField> for Commitment<E> | ||
| where | ||
| E::G1Affine: ToConstraintField<<E::Fq as Field>::BasePrimeField>, | ||
| { | ||
| fn to_field_elements(&self) -> Option<Vec<<E::Fq as Field>::BasePrimeField>> { | ||
| self.0.to_field_elements() | ||
| } | ||
| } | ||
|
|
||
| /// `PreparedCommitment` commits to a polynomial and prepares for mul_bits. | ||
| #[derive(Derivative)] | ||
| #[derivative( | ||
|
|
@@ -189,7 +216,7 @@ impl<E: PairingEngine> PreparedCommitment<E> { | |
| /// prepare `PreparedCommitment` from `Commitment` | ||
| pub fn prepare(comm: &Commitment<E>) -> Self { | ||
| let mut prepared_comm = Vec::<E::G1Affine>::new(); | ||
| let mut cur = E::G1Projective::from(comm.0.clone()); | ||
| let mut cur = E::G1Projective::from(comm.0); | ||
|
|
||
| let supported_bits = E::Fr::size_in_bits(); | ||
|
|
||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.