-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement recursive verification in the parity circuits (#6006)
This PR introduces recusive verification to the parity circuits. The base parity circuits are verified in the root parity circuit and the root parity circuit is verified by the root rollup.
- Loading branch information
1 parent
0ebee28
commit a5b6dac
Showing
50 changed files
with
1,293 additions
and
383 deletions.
There are no files selected for viewing
This file contains 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 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
3 changes: 2 additions & 1 deletion
3
noir-projects/noir-protocol-circuits/crates/parity-base/src/main.nr
This file contains 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,5 +1,6 @@ | ||
use dep::parity_lib::{BaseParityInputs, ParityPublicInputs}; | ||
|
||
fn main(inputs: BaseParityInputs) -> pub ParityPublicInputs { | ||
#[recursive] | ||
fn main(inputs: BaseParityInputs) -> distinct pub ParityPublicInputs { | ||
inputs.base_parity_circuit() | ||
} |
This file contains 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 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
32 changes: 24 additions & 8 deletions
32
noir-projects/noir-protocol-circuits/crates/parity-lib/src/parity_public_inputs.nr
This file contains 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,17 +1,33 @@ | ||
use dep::types::{mocked::AggregationObject, traits::Empty}; | ||
use dep::types::{traits::{Empty, Serialize, Deserialize}}; | ||
|
||
struct ParityPublicInputs { | ||
aggregation_object: AggregationObject, | ||
sha_root: Field, | ||
converted_root: Field, | ||
sha_root: Field, | ||
converted_root: Field, | ||
} | ||
|
||
impl Empty for ParityPublicInputs { | ||
fn empty() -> Self { | ||
ParityPublicInputs { | ||
aggregation_object: AggregationObject::empty(), | ||
sha_root: 0, | ||
ParityPublicInputs { | ||
sha_root: 0, | ||
converted_root: 0, | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl Serialize<2> for ParityPublicInputs { | ||
fn serialize(self) -> [Field; 2] { | ||
let mut fields = [0; 2]; | ||
fields[0] = self.sha_root; | ||
fields[1] = self.converted_root; | ||
fields | ||
} | ||
} | ||
|
||
impl Deserialize<2> for ParityPublicInputs { | ||
fn deserialize(fields: [Field; 2]) -> Self { | ||
ParityPublicInputs { | ||
sha_root: fields[0], | ||
converted_root: fields[1], | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
noir-projects/noir-protocol-circuits/crates/parity-lib/src/root.nr
This file contains 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,2 +1,3 @@ | ||
mod root_parity_input; | ||
mod root_parity_inputs; | ||
mod root_rollup_parity_input; |
13 changes: 6 additions & 7 deletions
13
noir-projects/noir-protocol-circuits/crates/parity-lib/src/root/root_parity_input.nr
This file contains 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,19 +1,18 @@ | ||
use dep::types::{ | ||
mocked::Proof, | ||
traits::Empty | ||
}; | ||
use dep::types::{traits::Empty, recursion::{verification_key::VerificationKey, proof::RecursiveProof}}; | ||
use crate::parity_public_inputs::ParityPublicInputs; | ||
|
||
struct RootParityInput { | ||
proof: Proof, | ||
proof: RecursiveProof, | ||
verification_key: VerificationKey, | ||
public_inputs: ParityPublicInputs, | ||
} | ||
|
||
impl Empty for RootParityInput { | ||
fn empty() -> Self { | ||
RootParityInput { | ||
proof: Proof::empty(), | ||
proof: RecursiveProof::empty(), | ||
verification_key: VerificationKey::empty(), | ||
public_inputs: ParityPublicInputs::empty(), | ||
} | ||
} | ||
} | ||
} |
This file contains 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.