Skip to content

Commit

Permalink
marshal proof
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam committed Feb 14, 2024
1 parent 24cf613 commit 7d41351
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions plonky2x/verifier/system/groth16.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,7 @@ func (s *Groth16System) ProveCircuit(r1cs constraint.ConstraintSystem, pk groth1
const fpSize = 4 * 8

// read in proof.json and extract the proof bytes
proofBytes, err := os.ReadFile("proof.json")
if err != nil {
return nil, nil, errors.Wrap(err, "read proof file")
}
proofBytes := _proof.Ar.Marshal()

proofs := make([]string, 8)
// Print out the proof
Expand Down
6 changes: 3 additions & 3 deletions plonky2x/verifier/system/plonk.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

"github.com/consensys/gnark-crypto/ecc"
groth16Bn254 "github.com/consensys/gnark/backend/groth16/bn254"
"github.com/consensys/gnark/backend/plonk"
plonk16Bn254 "github.com/consensys/gnark/backend/plonk/bn254"
"github.com/consensys/gnark/backend/witness"
"github.com/consensys/gnark/constraint"
"github.com/consensys/gnark/frontend"
Expand Down Expand Up @@ -246,11 +246,11 @@ func (s *PlonkSystem) ProveCircuit(r1cs constraint.ConstraintSystem, pk plonk.Pr
elapsed = time.Since(start)
s.logger.Info().Msg("Successfully created proof in " + elapsed.String())

_proof := proof.(*groth16Bn254.Proof)
_proof := proof.(*plonk16Bn254.Proof)
s.logger.Info().Msg("Saving proof to proof.json")
jsonProof, err := json.Marshal(ProofResult{
Output: []byte{},
Proof: _proof.Ar.Marshal(),
Proof: _proof.MarshalSolidity(),
})
if err != nil {
return nil, nil, errors.Wrap(err, "marshal proof")
Expand Down

0 comments on commit 7d41351

Please sign in to comment.