Skip to content

Commit

Permalink
feat: sp1 recursive verifier fixes (Plonky3#291)
Browse files Browse the repository at this point in the history
Co-authored-by: John Guibas <[email protected]>
  • Loading branch information
jtguibas and John Guibas authored Mar 26, 2024
1 parent 4d1865e commit 7b5b8a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions bn254-fr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ use serde::{Deserialize, Deserializer, Serialize};
#[PrimeFieldModulus = "21888242871839275222246405745257275088548364400416034343698204186575808495617"]
#[PrimeFieldGenerator = "5"]
#[PrimeFieldReprEndianness = "little"]
struct FFBn254Fr([u64; 4]);
pub struct FFBn254Fr([u64; 4]);

/// The BN254 curve scalar field prime, defined as `F_r` where `r = 21888242871839275222246405745257275088548364400416034343698204186575808495617`.
#[derive(Copy, Clone, Default, Eq, PartialEq)]
pub struct Bn254Fr {
value: FFBn254Fr,
pub value: FFBn254Fr,
}

impl Bn254Fr {
Expand Down
14 changes: 7 additions & 7 deletions fri/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ use serde::{Deserialize, Serialize};
deserialize = "Witness: Deserialize<'de>"
))]
pub struct FriProof<F: Field, M: Mmcs<F>, Witness> {
pub(crate) commit_phase_commits: Vec<M::Commitment>,
pub(crate) query_proofs: Vec<QueryProof<F, M>>,
pub commit_phase_commits: Vec<M::Commitment>,
pub query_proofs: Vec<QueryProof<F, M>>,
// This could become Vec<FC::Challenge> if this library was generalized to support non-constant
// final polynomials.
pub(crate) final_poly: F,
pub(crate) pow_witness: Witness,
pub final_poly: F,
pub pow_witness: Witness,
}

#[derive(Serialize, Deserialize)]
#[serde(bound = "")]
pub struct QueryProof<F: Field, M: Mmcs<F>> {
/// For each commit phase commitment, this contains openings of a commit phase codeword at the
/// queried location, along with an opening proof.
pub(crate) commit_phase_openings: Vec<CommitPhaseProofStep<F, M>>,
pub commit_phase_openings: Vec<CommitPhaseProofStep<F, M>>,
}

#[derive(Serialize, Deserialize)]
Expand All @@ -33,7 +33,7 @@ pub struct CommitPhaseProofStep<F: Field, M: Mmcs<F>> {
/// The opening of the commit phase codeword at the sibling location.
// This may change to Vec<FC::Challenge> if the library is generalized to support other FRI
// folding arities besides 2, meaning that there can be multiple siblings.
pub(crate) sibling_value: F,
pub sibling_value: F,

pub(crate) opening_proof: M::Proof,
pub opening_proof: M::Proof,
}
8 changes: 4 additions & 4 deletions fri/src/two_adic_pcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ pub struct TwoAdicFriPcsProof<
InputMmcs: Mmcs<Val>,
FriMmcs: Mmcs<Challenge>,
> {
pub(crate) fri_proof: FriProof<Challenge, FriMmcs, Val>,
pub fri_proof: FriProof<Challenge, FriMmcs, Val>,
/// For each query, for each committed batch, query openings for that batch
pub(crate) query_openings: Vec<Vec<BatchOpening<Val, InputMmcs>>>,
pub query_openings: Vec<Vec<BatchOpening<Val, InputMmcs>>>,
}

#[derive(Serialize, Deserialize)]
#[serde(bound = "")]
pub struct BatchOpening<Val: Field, InputMmcs: Mmcs<Val>> {
pub(crate) opened_values: Vec<Vec<Val>>,
pub(crate) opening_proof: <InputMmcs as Mmcs<Val>>::Proof,
pub opened_values: Vec<Vec<Val>>,
pub opening_proof: <InputMmcs as Mmcs<Val>>::Proof,
}

impl<Val, Dft, InputMmcs, FriMmcs, Challenge, Challenger> Pcs<Challenge, Challenger>
Expand Down

0 comments on commit 7b5b8a6

Please sign in to comment.