Skip to content
Merged
1 change: 1 addition & 0 deletions constants/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub const NS: usize = 10; // Max number of statements in a POD
pub const VL: usize = 10; // Max length of vectors
pub const L: usize = 0; // Max number of POD1-Introducer (1 level recursion) verifications
pub const M: usize = 2; // Max number of Schnorr POD
pub const N: usize = 2; // Max number of recursive proof verification in the creation of a POD
10 changes: 5 additions & 5 deletions pex/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod macros;
mod pex_constants;
use constants::{M, N, NS, VL};
use constants::{L, M, N, NS, VL};
pub mod repl;
pub mod store;

Expand All @@ -26,7 +26,7 @@ use plonky2::{
use pod2::{
pod::{
entry::Entry,
gadget::{plonky_pod::ProverParams, GadgetID, PlonkyButNotPlonkyGadget},
gadget::{plonky_pod::ProverParams, GadgetID},
origin::Origin,
payload::HashablePayload,
statement::{AnchoredKey, StatementRef},
Expand Down Expand Up @@ -214,7 +214,7 @@ pub struct Env {
bindings: Arc<Mutex<HashMap<String, Value>>>,
sk: Option<SchnorrSecretKey>,
script_id: Option<ScriptId>,
prover_params: Option<Arc<Mutex<ProverParams<M, N, NS, VL>>>>,
prover_params: Option<Arc<Mutex<ProverParams<L, M, N, NS, VL>>>>,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -744,7 +744,7 @@ impl PodBuilder {
.collect::<Vec<OpCmd>>()[..];
if let Some(prover_params) = &env.prover_params {
let mut params = prover_params.lock().unwrap();
POD::execute_plonky_gadget::<M, N, NS, VL>(&mut params, &gpg_input, pending_ops)
POD::execute_plonky_gadget::<L, M, N, NS, VL>(&mut params, &gpg_input, pending_ops)
} else {
POD::execute_oracle_gadget(&gpg_input, pending_ops)
}
Expand All @@ -759,7 +759,7 @@ impl Env {
pod_store: Arc<Mutex<MyPods>>,
sk: Option<SchnorrSecretKey>,
script_id: Option<ScriptId>,
prover_params: Option<Arc<Mutex<ProverParams<M, N, NS, VL>>>>,
prover_params: Option<Arc<Mutex<ProverParams<L, M, N, NS, VL>>>>,
) -> Self {
Self {
user,
Expand Down
15 changes: 12 additions & 3 deletions pex/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use pex::{
use pex::{Env, MyPods, Value};
use pod2::{
pod::gadget::PlonkyButNotPlonkyGadget,
recursion::traits::IntroducerCircuitTrait,
signature::schnorr::{SchnorrSecretKey, SchnorrSigner},
};
use reedline::{
Expand Down Expand Up @@ -130,9 +131,17 @@ async fn main() -> Result<()> {

let pod_store = Arc::new(Mutex::new(MyPods::default()));
let spinner = create_spinner("Generating prover parameters...");
let circuit_data = PlonkyButNotPlonkyGadget::<M, N, NS, VL>::circuit_data().unwrap();
let prover_params =
PlonkyButNotPlonkyGadget::<M, N, NS, VL>::build_prover_params(circuit_data).unwrap();

let pod1_circuit_data =
pod2::recursion::traits_examples::ExampleIntroducer::circuit_data().unwrap();
let pod1_verifier_data = pod1_circuit_data.verifier_data();
let circuit_data =
PlonkyButNotPlonkyGadget::<L, M, N, NS, VL>::circuit_data(pod1_verifier_data).unwrap();
let prover_params = PlonkyButNotPlonkyGadget::<L, M, N, NS, VL>::build_prover_params(
pod1_circuit_data,
circuit_data,
)
.unwrap();
spinner.finish_and_clear();
println!("⚙️ Prover parameters generated");
let env = Env::new(
Expand Down
Binary file modified pod2/POD-recursion.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions pod2/src/pod/gadget/introducer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use anyhow::{anyhow, Result};
use hashbrown::HashMap;
use plonky2::field::types::Field;
use plonky2::gates::noop::NoopGate;
use plonky2::iop::target::{BoolTarget, Target};
use plonky2::iop::witness::{PartialWitness, WitnessWrite};
use plonky2::plonk::circuit_builder::CircuitBuilder;
use plonky2::plonk::circuit_data::{
CircuitConfig, CircuitData, ProverCircuitData, VerifierCircuitData, VerifierCircuitTarget,
};
use plonky2::plonk::proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget};
use plonky2::recursion::dummy_circuit::cyclic_base_proof;
use std::array;
use std::marker::PhantomData;
use std::time::Instant;

use crate::pod::gadget::SchnorrPODGadget;
use crate::recursion::IntroducerCircuitTrait;
use crate::{PlonkyProof, C, D, F};

pub struct IntroducerCircuit {}

/// IntroducerCircuit defines the circuit whose plonky2 proof is verified in the RecursiveCircuit
/// (1-level recursion). This is, the POD1-Introducer circuit.
impl IntroducerCircuitTrait for IntroducerCircuit {
type Input = (); // TODO
type Targets = ();

/// return dummy inputs that will satisfy the circuit. This is used to generate the
/// dummy_proof.
fn dummy_inputs() -> Result<Self::Input> {
todo!();
}

/// set up the circuit logic
fn add_targets(builder: &mut CircuitBuilder<F, D>) -> Result<Self::Targets> {
todo!();
}

/// set the actual witness values for the current instance of the circuit. Returns a Vec<F>
/// containing the values that will be set as public inputs
fn set_targets(
pw: &mut PartialWitness<F>,
targets: &Self::Targets,
input: &Self::Input,
) -> Result<()> {
todo!();
}
}
2 changes: 2 additions & 0 deletions pod2/src/pod/gadget/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use core::fmt;
use serde::{Deserialize, Serialize};

pub mod introducer;
pub mod opexecutor;
pub mod plonky_pod;
pub mod schnorr_pod;

pub use introducer::IntroducerCircuit;
pub use opexecutor::OpExecutorGadget;
pub use plonky_pod::PlonkyButNotPlonkyGadget;
pub use schnorr_pod::SchnorrPODGadget;
Expand Down
Loading