sonobe/folding-schemes/src/folding/protogalaxy/mod.rs
folding-schemes/src/folding/protogalaxy/mod.rsRaw
1/// Implements the scheme described in [ProtoGalaxy](https://eprint.iacr.org/2023/1106.pdf)
2use ark_ec::CurveGroup;
3use ark_ff::PrimeField;
4use ark_r1cs_std::fields::fp::FpVar;
5use thiserror::Error;
6
7use super::circuits::nonnative::affine::NonNativeAffineVar;
8
9pub mod folding;
10pub mod traits;
11pub(crate) mod utils;
12
13#[derive(Clone, Debug)]
14pub struct CommittedInstance<C: CurveGroup> {
15 phi: C,
16 betas: Vec<C::ScalarField>,
17 e: C::ScalarField,
18}
19
20#[derive(Clone, Debug)]
21pub struct CommittedInstanceVar<C: CurveGroup> {
22 phi: NonNativeAffineVar<C>,
23 betas: Vec<FpVar<C::ScalarField>>,
24 e: FpVar<C::ScalarField>,
25}
26
27#[derive(Clone, Debug)]
28pub struct Witness<F: PrimeField> {
29 w: Vec<F>,
30 r_w: F,
31}
32
33#[derive(Debug, Error, PartialEq)]
34pub enum ProtoGalaxyError {
35 #[error("The remainder from G(X)-F(α)*L_0(X)) / Z(X) should be zero")]
36 RemainderNotZero,
37 #[error("Could not divide by vanishing polynomial")]
38 CouldNotDivideByVanishing,
39 #[error("The number of incoming instances + 1 should be a power of two, current number of instances: {0}")]
40 WrongNumInstances(usize),
41 #[error("The number of incoming items should be a power of two, current number of coefficients: {0}")]
42 BTreeNotFull(usize),
43 #[error("The lengths of β and δ do not equal: |β| = {0}, |δ|={0}")]
44 WrongLenBetas(usize, usize),
45}