mirror of
https://github.com/logos-storage/gnark-plonky2-verifier.git
synced 2026-01-08 08:03:12 +00:00
add observe the FRI config in the challenger
This commit is contained in:
parent
51e3f0ffeb
commit
ec39e03b10
@ -22,3 +22,10 @@ func (c *ExampleVerifierCircuit) Define(api frontend.API) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func boolToUint64(b bool) uint64 {
|
||||||
|
if b {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|||||||
@ -51,6 +51,27 @@ func (c *VerifierChip) GetChallenges(
|
|||||||
numChallenges := config.NumChallenges
|
numChallenges := config.NumChallenges
|
||||||
challenger := challenger.NewChip(c.api)
|
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
|
var circuitDigest = verifierData.CircuitDigest
|
||||||
|
|
||||||
challenger.ObserveBN254Hash(circuitDigest)
|
challenger.ObserveBN254Hash(circuitDigest)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user