mirror of
https://github.com/arnaucube/sonobe.git
synced 2026-01-08 15:01:30 +01:00
Full flow example (#90)
* expose params & structs for external usage * add full_flow example, move examples into 'examples' dir
This commit is contained in:
@@ -40,4 +40,7 @@ parallel = [
|
||||
]
|
||||
|
||||
|
||||
|
||||
[[example]]
|
||||
name = "full_flow"
|
||||
path = "../examples/full_flow.rs"
|
||||
# required-features = ["light-test"]
|
||||
|
||||
@@ -11,19 +11,19 @@ use super::PRAGMA_GROTH16_VERIFIER;
|
||||
|
||||
#[derive(Template, Default)]
|
||||
#[template(path = "groth16_verifier.askama.sol", ext = "sol")]
|
||||
pub(crate) struct Groth16Verifier {
|
||||
pub struct Groth16Verifier {
|
||||
/// The `alpha * G`, where `G` is the generator of `G1`.
|
||||
pub(crate) vkey_alpha_g1: G1Repr,
|
||||
pub vkey_alpha_g1: G1Repr,
|
||||
/// The `alpha * H`, where `H` is the generator of `G2`.
|
||||
pub(crate) vkey_beta_g2: G2Repr,
|
||||
pub vkey_beta_g2: G2Repr,
|
||||
/// The `gamma * H`, where `H` is the generator of `G2`.
|
||||
pub(crate) vkey_gamma_g2: G2Repr,
|
||||
pub vkey_gamma_g2: G2Repr,
|
||||
/// The `delta * H`, where `H` is the generator of `G2`.
|
||||
pub(crate) vkey_delta_g2: G2Repr,
|
||||
pub vkey_delta_g2: G2Repr,
|
||||
/// Length of the `gamma_abc_g1` vector.
|
||||
pub(crate) gamma_abc_len: usize,
|
||||
pub gamma_abc_len: usize,
|
||||
/// The `gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H`, where `H` is the generator of `E::G1`.
|
||||
pub(crate) gamma_abc_g1: Vec<G1Repr>,
|
||||
pub gamma_abc_g1: Vec<G1Repr>,
|
||||
}
|
||||
|
||||
impl From<Groth16VerifierKey> for Groth16Verifier {
|
||||
|
||||
@@ -11,7 +11,7 @@ use super::PRAGMA_KZG10_VERIFIER;
|
||||
|
||||
#[derive(Template, Default)]
|
||||
#[template(path = "kzg10_verifier.askama.sol", ext = "sol")]
|
||||
pub(crate) struct KZG10Verifier {
|
||||
pub struct KZG10Verifier {
|
||||
/// The generator of `G1`.
|
||||
pub(crate) g1: G1Repr,
|
||||
/// The generator of `G2`.
|
||||
@@ -42,8 +42,8 @@ impl From<KZG10VerifierKey> for KZG10Verifier {
|
||||
|
||||
#[derive(CanonicalDeserialize, CanonicalSerialize, Clone, PartialEq, Debug)]
|
||||
pub struct KZG10VerifierKey {
|
||||
pub(crate) vk: VerifierKey<Bn254>,
|
||||
pub(crate) g1_crs_batch_points: Vec<G1Affine>,
|
||||
pub vk: VerifierKey<Bn254>,
|
||||
pub g1_crs_batch_points: Vec<G1Affine>,
|
||||
}
|
||||
|
||||
impl From<(VerifierKey<Bn254>, Vec<G1Affine>)> for KZG10VerifierKey {
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
//! We use askama for templating and define which variables are required for each template.
|
||||
|
||||
// Pragma statements for verifiers
|
||||
pub(crate) const PRAGMA_GROTH16_VERIFIER: &str = "pragma solidity >=0.7.0 <0.9.0;"; // from snarkjs, avoid changing
|
||||
pub(crate) const PRAGMA_KZG10_VERIFIER: &str = "pragma solidity >=0.8.1 <=0.8.4;";
|
||||
pub const PRAGMA_GROTH16_VERIFIER: &str = "pragma solidity >=0.7.0 <0.9.0;"; // from snarkjs, avoid changing
|
||||
pub const PRAGMA_KZG10_VERIFIER: &str = "pragma solidity >=0.8.1 <=0.8.4;";
|
||||
|
||||
/// Default SDPX License identifier
|
||||
pub(crate) const GPL3_SDPX_IDENTIFIER: &str = "// SPDX-License-Identifier: GPL-3.0";
|
||||
pub(crate) const MIT_SDPX_IDENTIFIER: &str = "// SPDX-License-Identifier: MIT";
|
||||
pub const GPL3_SDPX_IDENTIFIER: &str = "// SPDX-License-Identifier: GPL-3.0";
|
||||
pub const MIT_SDPX_IDENTIFIER: &str = "// SPDX-License-Identifier: MIT";
|
||||
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write};
|
||||
|
||||
mod g16;
|
||||
mod kzg;
|
||||
mod nova_cyclefold;
|
||||
pub mod g16;
|
||||
pub mod kzg;
|
||||
pub mod nova_cyclefold;
|
||||
|
||||
pub use g16::Groth16VerifierKey;
|
||||
pub use kzg::KZG10VerifierKey;
|
||||
|
||||
@@ -26,7 +26,7 @@ pub fn get_decider_template_for_cyclefold_decider(
|
||||
|
||||
#[derive(Template, Default)]
|
||||
#[template(path = "nova_cyclefold_decider.askama.sol", ext = "sol")]
|
||||
pub(crate) struct NovaCycleFoldDecider {
|
||||
pub struct NovaCycleFoldDecider {
|
||||
groth16_verifier: Groth16Verifier,
|
||||
kzg10_verifier: KZG10Verifier,
|
||||
// z_len denotes the FCircuit state (z_i) length
|
||||
|
||||
Reference in New Issue
Block a user