-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59250e7
commit 1ec45d7
Showing
7 changed files
with
417 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,53 @@ | ||
use std::collections::BTreeMap; | ||
|
||
use kimchi::{curve::KimchiCurve, proof::PointEvaluations}; | ||
use kimchi_msm::{ | ||
logup::{prover::Env as LookupEnv, LookupProof}, | ||
LogupWitness, LookupTableID, | ||
}; | ||
use poly_commitment::{ipa::OpeningProof, PolyComm}; | ||
|
||
use crate::interpreters::mips::{column::N_MIPS_SEL_COLS, witness::SCRATCH_SIZE}; | ||
|
||
pub struct WitnessColumns<G, S> { | ||
pub scratch: [G; SCRATCH_SIZE], | ||
pub instruction_counter: G, | ||
pub error: G, | ||
#[derive(Clone)] | ||
pub struct WitnessColumns<F, G: KimchiCurve, S, ID: LookupTableID> { | ||
pub scratch: [F; crate::interpreters::mips::witness::SCRATCH_SIZE], | ||
pub instruction_counter: F, | ||
pub error: F, | ||
pub selector: S, | ||
pub lookup_env: Option<LookupEnv<G, ID>>, | ||
} | ||
|
||
pub struct ProofInputs<G: KimchiCurve> { | ||
pub evaluations: WitnessColumns<Vec<G::ScalarField>, Vec<G::ScalarField>>, | ||
pub struct ProofInputs<G: KimchiCurve, ID: LookupTableID> { | ||
pub evaluations: WitnessColumns<Vec<G::ScalarField>, G, Vec<G::ScalarField>, ID>, | ||
pub logups: BTreeMap<ID, LogupWitness<G::ScalarField, ID>>, | ||
} | ||
|
||
impl<G: KimchiCurve> ProofInputs<G> { | ||
impl<G: KimchiCurve, ID: LookupTableID> ProofInputs<G, ID> { | ||
pub fn new(domain_size: usize) -> Self { | ||
ProofInputs { | ||
evaluations: WitnessColumns { | ||
scratch: std::array::from_fn(|_| Vec::with_capacity(domain_size)), | ||
instruction_counter: Vec::with_capacity(domain_size), | ||
error: Vec::with_capacity(domain_size), | ||
selector: Vec::with_capacity(domain_size), | ||
lookup_env: None, | ||
}, | ||
logups: BTreeMap::new(), | ||
} | ||
} | ||
} | ||
|
||
// FIXME: should we blind the commitment? | ||
pub struct Proof<G: KimchiCurve> { | ||
pub commitments: WitnessColumns<PolyComm<G>, [PolyComm<G>; N_MIPS_SEL_COLS]>, | ||
pub zeta_evaluations: WitnessColumns<G::ScalarField, [G::ScalarField; N_MIPS_SEL_COLS]>, | ||
pub zeta_omega_evaluations: WitnessColumns<G::ScalarField, [G::ScalarField; N_MIPS_SEL_COLS]>, | ||
pub struct Proof<G: KimchiCurve, ID: LookupTableID> { | ||
pub commitments: WitnessColumns<PolyComm<G>, G, [PolyComm<G>; N_MIPS_SEL_COLS], ID>, | ||
pub zeta_evaluations: WitnessColumns<G::ScalarField, G, [G::ScalarField; N_MIPS_SEL_COLS], ID>, | ||
pub zeta_omega_evaluations: | ||
WitnessColumns<G::ScalarField, G, [G::ScalarField; N_MIPS_SEL_COLS], ID>, | ||
pub quotient_commitment: PolyComm<G>, | ||
pub quotient_evaluations: PointEvaluations<Vec<G::ScalarField>>, | ||
pub logup_commitments: Option<LookupProof<PolyComm<G>, ID>>, | ||
pub logup_evaluations: Option<LookupProof<PointEvaluations<G::ScalarField>, ID>>, | ||
/// IPA opening proof | ||
pub opening_proof: OpeningProof<G>, | ||
} |
Oops, something went wrong.