Skip to content

Commit

Permalink
Merge pull request #26 from ICME-Lab/feat/zk
Browse files Browse the repository at this point in the history
Feat/zk
  • Loading branch information
Forpee authored Jan 22, 2025
2 parents d4b71f2 + f907e2e commit 5d04832
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/aggregation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use nova::{
AggregationPublicParams as NovaAggregationPublicParams, AggregationRecursiveSNARK,
},
traits::{
snark::{default_ck_hint, BatchedRelaxedR1CSSNARKTrait},
snark::{default_ck_hint, BatchedRelaxedR1CSSNARKTrait, RelaxedR1CSSNARKTrait},
CurveCycleEquipped, Dual,
},
};
Expand All @@ -28,7 +28,7 @@ pub struct AggregationPublicParams<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
pp: NovaAggregationPublicParams<E>,
/// Prover and verifier key for final proof compression
Expand All @@ -40,7 +40,7 @@ impl<E, S1, S2> AggregationPublicParams<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
/// provides a reference to a ProverKey suitable for producing a CompressedProof
pub fn pk(&self) -> &ProverKey<E, S1, S2> {
Expand Down Expand Up @@ -71,7 +71,7 @@ pub struct AggregationSNARK<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
rs: AggregationRecursiveSNARK<E>,
_s1: PhantomData<S1>,
Expand All @@ -82,7 +82,7 @@ impl<E, S1, S2> AggregationSNARK<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
/// Get the [`AggregationPublicParams`]
pub fn setup(wasm_pp: WASMPublicParams<E, S1, S2>) -> AggregationPublicParams<E, S1, S2> {
Expand Down
2 changes: 1 addition & 1 deletion src/aggregation/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub type E = Bn256EngineIPA;
pub type EE1 = ipa_pc::EvaluationEngine<E>;
pub type EE2 = ipa_pc::EvaluationEngine<Dual<E>>;
pub type S1 = spartan::batched::BatchedRelaxedR1CSSNARK<E, EE1>;
pub type S2 = spartan::batched::BatchedRelaxedR1CSSNARK<Dual<E>, EE2>;
pub type S2 = spartan::snark::RelaxedR1CSSNARK<Dual<E>, EE2>;

#[test]
fn test_aggregation_bit_check() -> Result<(), ZKWASMError> {
Expand Down
10 changes: 5 additions & 5 deletions src/sharding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use nova::{
ShardingPublicParams as NovaShardingPublicParams, ShardingRecursiveSNARK,
},
traits::{
snark::{default_ck_hint, BatchedRelaxedR1CSSNARKTrait},
snark::{default_ck_hint, BatchedRelaxedR1CSSNARKTrait, RelaxedR1CSSNARKTrait},
CurveCycleEquipped, Dual,
},
};
Expand All @@ -30,7 +30,7 @@ pub struct ShardingPublicParams<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
pp: NovaShardingPublicParams<E>,
/// Prover and verifier key for final proof compression
Expand All @@ -42,7 +42,7 @@ impl<E, S1, S2> ShardingPublicParams<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
/// provides a reference to a ProverKey suitable for producing a CompressedProof
pub fn pk(&self) -> &ProverKey<E, S1, S2> {
Expand Down Expand Up @@ -73,7 +73,7 @@ pub struct ShardingSNARK<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
rs: ShardingRecursiveSNARK<E>,
_s1: PhantomData<S1>,
Expand All @@ -84,7 +84,7 @@ impl<E, S1, S2> ShardingSNARK<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
/// Get the [`ShardingPublicParams`]
pub fn setup(wasm_pp: WASMPublicParams<E, S1, S2>) -> ShardingPublicParams<E, S1, S2> {
Expand Down
2 changes: 1 addition & 1 deletion src/sharding/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub type E = Bn256EngineIPA;
pub type EE1 = ipa_pc::EvaluationEngine<E>;
pub type EE2 = ipa_pc::EvaluationEngine<Dual<E>>;
pub type S1 = spartan::batched::BatchedRelaxedR1CSSNARK<E, EE1>;
pub type S2 = spartan::batched::BatchedRelaxedR1CSSNARK<Dual<E>, EE2>;
pub type S2 = spartan::snark::RelaxedR1CSSNARK<Dual<E>, EE2>;

#[test]
fn test_sharding_eq_func_mismatch() {
Expand Down
2 changes: 1 addition & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub type E = Bn256EngineIPA;
pub type EE1 = ipa_pc::EvaluationEngine<E>;
pub type EE2 = ipa_pc::EvaluationEngine<Dual<E>>;
pub type S1 = spartan::batched::BatchedRelaxedR1CSSNARK<E, EE1>;
pub type S2 = spartan::batched::BatchedRelaxedR1CSSNARK<Dual<E>, EE2>;
pub type S2 = spartan::snark::RelaxedR1CSSNARK<Dual<E>, EE2>;

fn test_wasm_snark_with(wasm_ctx: impl ZKWASMCtx, step_size: StepSize) -> Result<(), ZKWASMError> {
let pp_timer = start_timer!("Producing Public Parameters");
Expand Down
12 changes: 6 additions & 6 deletions src/wasm_snark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use nova::{
traits::{Layer1PPTrait, Layer1RSTrait, MemoryCommitmentsTraits},
},
traits::{
snark::{default_ck_hint, BatchedRelaxedR1CSSNARKTrait},
snark::{default_ck_hint, BatchedRelaxedR1CSSNARKTrait, RelaxedR1CSSNARKTrait},
CurveCycleEquipped, Dual, Engine, TranscriptEngineTrait,
},
};
Expand All @@ -42,7 +42,7 @@ pub struct WASMPublicParams<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
execution_pp: PublicParams<E>,
ops_pp: PublicParams<E>,
Expand All @@ -56,7 +56,7 @@ impl<E, S1, S2> WASMPublicParams<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
/// provides a reference to a ProverKey suitable for producing a CompressedProof
pub fn pk(&self) -> &ProverKey<E, S1, S2> {
Expand All @@ -79,7 +79,7 @@ impl<E, S1, S2> Layer1PPTrait<E> for WASMPublicParams<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
fn into_parts(self) -> (PublicParams<E>, PublicParams<E>, AuditPublicParams<E>) {
(self.execution_pp, self.ops_pp, self.scan_pp)
Expand Down Expand Up @@ -117,7 +117,7 @@ pub enum WasmSNARK<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
/// RecursiveSNARK for WASM execution
Recursive(Box<RecursiveWasmSNARK<E>>),
Expand All @@ -129,7 +129,7 @@ impl<E, S1, S2> WasmSNARK<E, S1, S2>
where
E: CurveCycleEquipped,
S1: BatchedRelaxedR1CSSNARKTrait<E>,
S2: BatchedRelaxedR1CSSNARKTrait<Dual<E>>,
S2: RelaxedR1CSSNARKTrait<Dual<E>>,
{
/// Fn used to obtain setup material for producing succinct arguments for
/// WASM program executions
Expand Down

0 comments on commit 5d04832

Please sign in to comment.