Skip to content

Commit

Permalink
XXX: add prints at critical steps
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub committed Nov 9, 2023
1 parent 131fbb5 commit 4e6454d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions backend/plonk/bls12-377/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions std/algebra/native/sw_bls12377/pairing2.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ func (c *Curve) MultiScalarMul(P []*G1Affine, scalars []*Scalar) (*G1Affine, err
res := c.ScalarMul(P[0], scalars[0])
for i := 1; i < len(P); i++ {
q := c.ScalarMul(P[i], scalars[i])
c.api.Println(i)
c.Print(*P[i])
c.Print(*q)
c.Print(*res)
res = c.Add(res, q)
}
return res, nil
Expand Down
9 changes: 9 additions & 0 deletions std/recursion/plonk/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,16 @@ func (v *Verifier[FR, G1El, G2El, GtEl]) AssertProof(vk VerifyingKey[FR, G1El, G
_s1, _s2, // second & third part
)

// for i := range points {
// v.curve.Print(*points[i])
// v.f.Println(scalars[i])
// }
linearizedPolynomialDigest, err := v.curve.MultiScalarMul(points, scalars)
if err != nil {
return fmt.Errorf("linearized polynomial digest MSM: %w", err)
}
// XXX: it looks like in MultiScalarMul when we compute 1*0 then it messes up!
v.curve.Print(*linearizedPolynomialDigest) // wrong

// Fold the first proof
digestsToFold := []kzg.Commitment[G1El]{
Expand All @@ -530,6 +536,7 @@ func (v *Verifier[FR, G1El, G2El, GtEl]) AssertProof(vk VerifyingKey[FR, G1El, G
vk.S[1],
}
digestsToFold = append(digestsToFold, vk.Qcp...)
// v.curve.Print(digestsToFold[1].G1El) // wrong
foldedProof, foldedDigest, err := v.kzg.FoldProof(
digestsToFold,
proof.BatchedProof,
Expand All @@ -540,6 +547,8 @@ func (v *Verifier[FR, G1El, G2El, GtEl]) AssertProof(vk VerifyingKey[FR, G1El, G
return fmt.Errorf("fold kzg proof: %w", err)
}
shiftedZeta := v.f.Mul(zeta, &vk.Generator)
// v.curve.Print(foldedDigest.G1El) // wrong
// v.f.Println(&foldedProof.ClaimedValue) // wrong
err = v.kzg.BatchVerifyMultiPoints(
[]kzg.Commitment[G1El]{
foldedDigest,
Expand Down
3 changes: 2 additions & 1 deletion std/recursion/plonk/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ func getInner(assert *test.Assert, field, outer *big.Int) (constraint.Constraint
backend.WithVerifierChallengeHashFunction(fsVerifierHasher),
backend.WithVerifierKZGFoldingHashFunction(kzgProverHasher),
)
assert.NoError(err)
// commented out to allow debugging native and circuit verifier
// assert.NoError(err)
return innerCcs, innerVK, innerPubWitness, innerProof
}

Expand Down

0 comments on commit 4e6454d

Please sign in to comment.