Skip to content

Commit

Permalink
Add prover check for imput's first element
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole authored and Nicole committed Jan 13, 2025
1 parent 9c717ef commit f16f6e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/baby-snark/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct Proof {
#[derive(Debug)]
pub enum Error {
WrongWitness,
FirstInputElementIsNotOne,
}

pub struct Prover;
Expand All @@ -19,6 +20,9 @@ impl Prover {
ssp: &SquareSpanProgram,
pk: &ProvingKey,
) -> Result<Proof, Error> {
if inputs[0].ne(&FrElement::one()) {
return Err(Error::FirstInputElementIsNotOne);
}
if !ssp.check_valid(inputs) {
return Err(Error::WrongWitness);
}
Expand Down

0 comments on commit f16f6e2

Please sign in to comment.