mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 00:51:33 +01:00
checkpoint
This commit is contained in:
@@ -297,33 +297,34 @@ func DeserializeProofWithPublicInputs(path string) variables.ProofWithPublicInpu
|
||||
return proofWithPis
|
||||
}
|
||||
|
||||
func DeserializeProofChallenges(path string) variables.ProofChallenges {
|
||||
jsonFile, err := os.Open(path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// TODO: this seemed unused?
|
||||
// func DeserializeProofChallenges(path string) variables.ProofChallenges {
|
||||
// jsonFile, err := os.Open(path)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
|
||||
defer jsonFile.Close()
|
||||
rawBytes, _ := io.ReadAll(jsonFile)
|
||||
// defer jsonFile.Close()
|
||||
// rawBytes, _ := io.ReadAll(jsonFile)
|
||||
|
||||
var raw ProofChallengesRaw
|
||||
err = json.Unmarshal(rawBytes, &raw)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// var raw ProofChallengesRaw
|
||||
// err = json.Unmarshal(rawBytes, &raw)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
|
||||
var proofChallenges variables.ProofChallenges
|
||||
proofChallenges.PlonkBetas = gl.Uint64ArrayToVariableArray(raw.PlonkBetas)
|
||||
proofChallenges.PlonkGammas = gl.Uint64ArrayToVariableArray(raw.PlonkGammas)
|
||||
proofChallenges.PlonkAlphas = gl.Uint64ArrayToVariableArray(raw.PlonkAlphas)
|
||||
proofChallenges.PlonkZeta = gl.Uint64ArrayToQuadraticExtension(raw.PlonkZeta)
|
||||
proofChallenges.FriChallenges.FriAlpha = gl.Uint64ArrayToQuadraticExtension(raw.FriChallenges.FriAlpha)
|
||||
proofChallenges.FriChallenges.FriBetas = gl.Uint64ArrayToQuadraticExtensionArray(raw.FriChallenges.FriBetas)
|
||||
proofChallenges.FriChallenges.FriPowResponse = gl.NewVariable(raw.FriChallenges.FriPowResponse)
|
||||
proofChallenges.FriChallenges.FriQueryIndices = gl.Uint64ArrayToVariableArray(raw.FriChallenges.FriQueryIndices)
|
||||
// var proofChallenges variables.ProofChallenges
|
||||
// proofChallenges.PlonkBetas = gl.Uint64ArrayToVariableArray(raw.PlonkBetas)
|
||||
// proofChallenges.PlonkGammas = gl.Uint64ArrayToVariableArray(raw.PlonkGammas)
|
||||
// proofChallenges.PlonkAlphas = gl.Uint64ArrayToVariableArray(raw.PlonkAlphas)
|
||||
// proofChallenges.PlonkZeta = gl.Uint64ArrayToQuadraticExtension(raw.PlonkZeta)
|
||||
// proofChallenges.FriChallenges.FriAlpha = gl.Uint64ArrayToQuadraticExtension(raw.FriChallenges.FriAlpha)
|
||||
// proofChallenges.FriChallenges.FriBetas = gl.Uint64ArrayToQuadraticExtensionArray(raw.FriChallenges.FriBetas)
|
||||
// proofChallenges.FriChallenges.FriPowResponse = gl.NewVariable(raw.FriChallenges.FriPowResponse)
|
||||
// proofChallenges.FriChallenges.FriQueryIndices = gl.Uint64ArrayToVariableArray(raw.FriChallenges.FriQueryIndices)
|
||||
|
||||
return proofChallenges
|
||||
}
|
||||
// return proofChallenges
|
||||
// }
|
||||
|
||||
func ReductionArityBits(
|
||||
arityBits uint64,
|
||||
|
||||
@@ -80,73 +80,6 @@ func (c *VerifierChip) GetChallenges(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func (c *VerifierChip) generateProofInput(commonData common.CommonCircuitData) common.ProofWithPublicInputs {
|
||||
// Generate the parts of the witness that is for the plonky2 proof input
|
||||
|
||||
capHeight := commonData.Config.FriConfig.CapHeight
|
||||
|
||||
friCommitPhaseMerkleCaps := []common.MerkleCap{}
|
||||
for i := 0; i < len(commonData.FriParams.ReductionArityBits); i++ {
|
||||
friCommitPhaseMerkleCaps = append(friCommitPhaseMerkleCaps, common.NewMerkleCap(capHeight))
|
||||
}
|
||||
|
||||
salt := commonData.SaltSize()
|
||||
numLeavesPerOracle := []uint{
|
||||
commonData.NumPreprocessedPolys(),
|
||||
commonData.Config.NumWires + salt,
|
||||
commonData.NumZsPartialProductsPolys() + salt,
|
||||
commonData.NumQuotientPolys() + salt,
|
||||
}
|
||||
friQueryRoundProofs := []common.FriQueryRound{}
|
||||
for i := uint64(0); i < commonData.FriParams.Config.NumQueryRounds; i++ {
|
||||
evalProofs := []common.EvalProof{}
|
||||
merkleProofLen := commonData.FriParams.LDEBits() - capHeight
|
||||
for _, numLeaves := range numLeavesPerOracle {
|
||||
leaves := make([]field.F, numLeaves)
|
||||
merkleProof := common.NewMerkleProof(merkleProofLen)
|
||||
evalProofs = append(evalProofs, common.NewEvalProof(leaves, merkleProof))
|
||||
}
|
||||
|
||||
initialTreesProof := common.NewFriInitialTreeProof(evalProofs)
|
||||
steps := []common.FriQueryStep{}
|
||||
for _, arityBit := range commonData.FriParams.ReductionArityBits {
|
||||
if merkleProofLen < arityBit {
|
||||
panic("merkleProofLen < arityBits")
|
||||
}
|
||||
|
||||
steps = append(steps, common.NewFriQueryStep(arityBit, merkleProofLen))
|
||||
}
|
||||
|
||||
friQueryRoundProofs = append(friQueryRoundProofs, common.NewFriQueryRound(steps, initialTreesProof))
|
||||
}
|
||||
|
||||
proofInput := common.ProofWithPublicInputs{
|
||||
Proof: common.Proof{
|
||||
WiresCap: common.NewMerkleCap(capHeight),
|
||||
PlonkZsPartialProductsCap: common.NewMerkleCap(capHeight),
|
||||
QuotientPolysCap: common.NewMerkleCap(capHeight),
|
||||
Openings: common.NewOpeningSet(
|
||||
commonData.Config.NumConstants,
|
||||
commonData.Config.NumRoutedWires,
|
||||
commonData.Config.NumWires,
|
||||
commonData.Config.NumChallenges,
|
||||
commonData.NumPartialProducts,
|
||||
commonData.QuotientDegreeFactor,
|
||||
),
|
||||
OpeningProof: common.FriProof{
|
||||
CommitPhaseMerkleCaps: friCommitPhaseMerkleCaps,
|
||||
QueryRoundProofs: friQueryRoundProofs,
|
||||
FinalPoly: common.NewPolynomialCoeffs(commonData.FriParams.FinalPolyLen()),
|
||||
},
|
||||
},
|
||||
PublicInputs: make([]field.F, commonData.NumPublicInputs),
|
||||
}
|
||||
|
||||
return proofInput
|
||||
}
|
||||
*/
|
||||
|
||||
func (c *VerifierChip) rangeCheckProof(proof variables.Proof) {
|
||||
// Need to verify the plonky2 proof's openings, openings proof (other than the sibling elements), fri's final poly, pow witness.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user