Make Plonky2 config more explicit (#209)

This commit is contained in:
Ahmad Afuni 2025-04-30 07:15:20 +10:00 committed by GitHub
parent 29545f03fc
commit e420aa7b32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 5 deletions

View file

@ -2,14 +2,30 @@
//! `backend_plonky2` feature is enabled. //! `backend_plonky2` feature is enabled.
//! See src/middleware/basetypes.rs for more details. //! See src/middleware/basetypes.rs for more details.
use plonky2::plonk::{config::PoseidonGoldilocksConfig, proof::Proof as Plonky2Proof}; use plonky2::{
field::extension::quadratic::QuadraticExtension,
hash::poseidon::PoseidonHash,
plonk::{config::GenericConfig, proof::Proof as Plonky2Proof},
};
use serde::Serialize;
use crate::middleware::F; use crate::middleware::F;
/// C is the Plonky2 config used in POD2 to work with Plonky2 recursion.
pub type C = PoseidonGoldilocksConfig;
/// D defines the extension degree of the field used in the Plonky2 proofs (quadratic extension). /// D defines the extension degree of the field used in the Plonky2 proofs (quadratic extension).
pub const D: usize = 2; pub const D: usize = 2;
/// FE is the degree D field extension used in Plonky2 proofs.
pub type FE = QuadraticExtension<F>;
/// C is the Plonky2 config used in POD2 to work with Plonky2 recursion.
#[derive(Debug, Copy, Clone, Default, Eq, PartialEq, Serialize)]
pub struct C;
impl GenericConfig<D> for C {
type F = F;
type FE = FE;
type Hasher = PoseidonHash;
type InnerHasher = PoseidonHash;
}
/// proof system proof /// proof system proof
pub type Proof = Plonky2Proof<F, PoseidonGoldilocksConfig, D>; pub type Proof = Plonky2Proof<F, C, D>;

View file

@ -352,7 +352,7 @@ pub struct MainPod {
params: Params, params: Params,
id: PodId, id: PodId,
public_statements: Vec<Statement>, public_statements: Vec<Statement>,
proof: ProofWithPublicInputs<F, C, 2>, proof: ProofWithPublicInputs<F, C, D>,
} }
/// Convert a Statement into middleware::Statement and replace references to SELF by `self_id`. /// Convert a Statement into middleware::Statement and replace references to SELF by `self_id`.