mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 00:51:33 +01:00
fix for V-SCT-VUL-027
This commit is contained in:
@@ -73,11 +73,15 @@ func (f *Chip) ToOpenings(c variables.OpeningSet) Openings {
|
||||
}
|
||||
|
||||
func (f *Chip) assertLeadingZeros(powWitness gl.Variable, friConfig types.FriConfig) {
|
||||
// Asserts that powWitness'es big-endian bit representation has at least `leading_zeros` leading zeros.
|
||||
// Asserts that powWitness'es big-endian bit representation has at least friConfig.ProofOfWorkBits leading zeros.
|
||||
// Note that this is assuming that the Goldilocks field is being used. Specfically that the
|
||||
// field is 64 bits long
|
||||
maxPowWitness := uint64(math.Pow(2, float64(64-friConfig.ProofOfWorkBits))) - 1
|
||||
|
||||
// TODO: This does an un-nessary reduce, since powWitness is already range checked to be within GL field.
|
||||
reducedPowWitness := f.gl.Reduce(powWitness)
|
||||
|
||||
// TODO: Can replace with with std.rangecheck.Check. Will probably be less contraints.
|
||||
f.api.AssertIsLessOrEqual(reducedPowWitness.Limb, frontend.Variable(maxPowWitness))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user