Skip to content

Commit

Permalink
Staking: force Penalty to only be used as a public circuit input
Browse files Browse the repository at this point in the history
Until we add a <= 1 constraint this is probably a good idea.
  • Loading branch information
cronokirby committed Dec 11, 2023
1 parent c5a5459 commit 22ff965
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/core/component/stake/src/penalty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ impl AllocVar<Penalty, Fq> for PenaltyVar {
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: ark_r1cs_std::prelude::AllocationMode,
) -> Result<Self, SynthesisError> {
assert!(
matches!(mode, ark_r1cs_std::prelude::AllocationMode::Input),
"Penalty must be an input variable"
);
Ok(Self {
inner: U128x128Var::new_variable(cs, || Ok(f()?.borrow().0), mode)?,
})
Expand Down

0 comments on commit 22ff965

Please sign in to comment.