Skip to content

Commit

Permalink
expose params & structs for external usage
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaucube committed Apr 23, 2024
1 parent 87d3731 commit 92bff66
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions solidity-verifiers/src/verifiers/g16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions solidity-verifiers/src/verifiers/kzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions solidity-verifiers/src/verifiers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion solidity-verifiers/src/verifiers/nova_cyclefold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92bff66

Please sign in to comment.