add observe the FRI config in the challenger

This commit is contained in:
M Alghazwi 2025-05-27 10:27:40 +02:00
parent 51e3f0ffeb
commit ec39e03b10
2 changed files with 28 additions and 0 deletions

View File

@ -22,3 +22,10 @@ func (c *ExampleVerifierCircuit) Define(api frontend.API) error {
return nil
}
func boolToUint64(b bool) uint64 {
if b {
return 1
}
return 0
}

View File

@ -51,6 +51,27 @@ func (c *VerifierChip) GetChallenges(
numChallenges := config.NumChallenges
challenger := challenger.NewChip(c.api)
// observe the FRI config
var friParams = c.commonData.FriParams
var friConfig = friParams.Config
challenger.ObserveElement(gl.NewVariable(friConfig.RateBits))
challenger.ObserveElement(gl.NewVariable(friConfig.CapHeight))
challenger.ObserveElement(gl.NewVariable(friConfig.ProofOfWorkBits))
// here we fix the reduction strategy to the standard one:
// reduction_strategy: FriReductionStrategy::ConstantArityBits(4, 5)
// this is serialized as [1,4,5]
// TODO: make this work for all reduction strategies
challenger.ObserveElement(gl.One())
challenger.ObserveElement(gl.NewVariable(4))
challenger.ObserveElement(gl.NewVariable(5))
challenger.ObserveElement(gl.NewVariable(friConfig.NumQueryRounds))
var hide uint64 = boolToUint64(friParams.Hiding)
challenger.ObserveElement(gl.NewVariable(hide))
challenger.ObserveElement(gl.NewVariable(friParams.DegreeBits))
for _, arity := range friParams.ReductionArityBits {
challenger.ObserveElement(gl.NewVariable(arity))
}
var circuitDigest = verifierData.CircuitDigest
challenger.ObserveBN254Hash(circuitDigest)