Skip to content

Commit

Permalink
temp: v panic
Browse files Browse the repository at this point in the history
  • Loading branch information
nhtyy committed Jan 14, 2025
1 parent 7769ee9 commit ecaee26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rust-analyzer.cargo.features": "all",
}
6 changes: 5 additions & 1 deletion src/fp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ impl Fp {
return CtOption::new(Self::zero(), Choice::from(0u8));
}

if self == Fp::one() {
return CtOption::new(Fp::one(), Choice::from(1u8));
}

unconstrained! {
sp1_lib::io::write(sp1_lib::io::FD_BLS12_381_INVERSE, &self.to_bytes());
}
Expand All @@ -452,7 +456,7 @@ impl Fp {

let inv = Fp::from_bytes(&byte_vec).unwrap();

assert!(self * &inv == Fp::one(), "Invalid hint: Fp invert");
assert!(self * &inv == Fp::one(), "Invalid hint: Fp invert, self = {:?}, self * inv = {:?}, inv = {:?}, one = {:?}", self, self * &inv, inv, Fp::one());

CtOption::new(inv, Choice::from(1u8))
}
Expand Down

0 comments on commit ecaee26

Please sign in to comment.