Conversation
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Francisco Hernandez Iglesias <f.hernandeziglesias@outlook.com>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
| - ubuntu-latest | ||
| channel: | ||
| - stable | ||
| # TODO: add custom stable checks for those parts of the workspace that can run on it |
There was a problem hiding this comment.
Why these changes? Is there something wrong with the stable CI?
There was a problem hiding this comment.
We can't use stable with plonky2 because it uses unstable features.
| /// Converts a `u32` value to a field element. | ||
| fn from_u32(elem: u32) -> Self; |
There was a problem hiding this comment.
Why not an associated type NumberType and a function
fn from_number_type? This would cover both the arkworks and plonky2 plugin implementations of this trait without losing randomness from the arkworks side.
| } | ||
| } | ||
|
|
||
| impl<const ARITY: usize> SBoxExponent for Spec<bn254::Fr, ARITY> { |
There was a problem hiding this comment.
Why only bn254 implementation?
| .is_equal(self.target.target, rhs.target.target), | ||
| ) | ||
| } | ||
| } |
| impl<F, const D: usize, const ARITY: usize, COM> Constant<COM> for Spec<F, D, ARITY> | ||
| where | ||
| F: RichField + Extendable<D>, | ||
| { | ||
| type Type = Self; | ||
|
|
||
| #[inline] | ||
| fn new_constant(this: &Self::Type, compiler: &mut COM) -> Self { | ||
| let _ = (this, compiler); | ||
| Self(PhantomData) | ||
| } | ||
| } |
| impl<const D: usize, const ARITY: usize> poseidon::SBoxExponent | ||
| for Spec<GoldilocksField, D, ARITY> | ||
| { | ||
| const SBOX_EXPONENT: u64 = 7; | ||
| } | ||
|
|
||
| impl<const D: usize> poseidon::Constants for Spec<GoldilocksField, D, 7> { | ||
| const WIDTH: usize = 8; | ||
| const FULL_ROUNDS: usize = 8; | ||
| const PARTIAL_ROUNDS: usize = 22; | ||
| } | ||
|
|
||
| impl<const D: usize> poseidon::Constants for Spec<GoldilocksField, D, 11> { | ||
| const WIDTH: usize = 12; | ||
| const FULL_ROUNDS: usize = 8; | ||
| const PARTIAL_ROUNDS: usize = 22; | ||
| } |
There was a problem hiding this comment.
Where did you get these constants from? Maybe mention in the docs.
| let pw = PartialWitness::new(); | ||
| let mut builder = CircuitBuilder::<C::F, D>::new(config); |
There was a problem hiding this comment.
Ideally we'd interact with plonky2 through the plugin structs and not their native ones.
| data.verify(proof).expect("Verification failed."); | ||
| } | ||
|
|
||
| /// Testing Module |
There was a problem hiding this comment.
Time for openzl-benchmark?
|
|
||
| /// Tests the proving and verification of the ECDSA signature circuit. | ||
| #[inline] | ||
| pub fn test_ecdsa_circuit<C, const D: usize>(config: CircuitConfig) |
There was a problem hiding this comment.
We don't use the eclair interface at all for this circuit. If the eclair creator doesn't use it in a simple signature scheme example, who will?
There was a problem hiding this comment.
This stuff was copied directly from plonky2, I haven't converted it over yet.
There was a problem hiding this comment.
When we do change this let's allocate the pieces appropriately as public/private inputs, rather than all being constants as they are here.
|
|
||
| /// Tests the proving and verification of the ECDSA signature circuit. | ||
| #[inline] | ||
| pub fn test_ecdsa_circuit<C, const D: usize>(config: CircuitConfig) |
There was a problem hiding this comment.
When we do change this let's allocate the pieces appropriately as public/private inputs, rather than all being constants as they are here.
| ) | ||
| } | ||
|
|
||
| /// Runs the ECDSA benchmark for a narrow circuit configuration. |
There was a problem hiding this comment.
| /// Runs the ECDSA benchmark for a narrow circuit configuration. | |
| /// Runs the ECDSA benchmark for a wide circuit configuration. |
| F: FieldGeneration, | ||
| { | ||
| let ys: Vec<F> = (t as u64..2 * t as u64).map(F::from_u64).collect(); | ||
| let ys: Vec<F> = (t as u32..2 * t as u32).map(F::from_u32).collect(); // TODO: Change u64 to integer mod order(F) |
There was a problem hiding this comment.
Was this change because of the smaller size of the Goldilocks field?
| num-bigint = { version = "0.4.3", default-features = false } | ||
| openzl-crypto = { path = "../../openzl-crypto", default-features = false, features = ["alloc"] } | ||
| openzl-util = { path = "../../openzl-util", default-features = false, features = ["alloc"] } | ||
| plonky2 = { git = "https://github.com/openzklib/plonky2", branch = "feat/circuit-data-serde", default-features = false } |
There was a problem hiding this comment.
Why do we use this branch?
| } | ||
| } | ||
|
|
||
| impl<F, const D: usize> Default for Compiler<F, D> |
There was a problem hiding this comment.
I think the problem is that CircuitBuilder doesn't impl Default even though you can construct it from a CircuitConfig which does.
Builds a Plonky2 plugin that supports the
poseidongadget fromopenzl_crypto.ProofSystemimplposeidonbackendBefore we can merge this PR, please make sure that all the following items have been checked off:
CHANGELOG.mdand added the appropriateL-label to the PR.Files changedin the GitHub PR explorer.CONTRIBUTING.md.