Skip to content

Commit

Permalink
Add more logging during loading (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzejkop authored Apr 30, 2024
1 parent 50a9a8b commit 2b5a3f8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions prover/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"math/big"
"os"
"worldcoin/gnark-mbu/logging"

"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark/backend/groth16"
Expand Down Expand Up @@ -289,34 +290,39 @@ func (ps *ProvingSystem) UnsafeReadFrom(r io.Reader) (int64, error) {
var totalRead int64 = 0
var intBuf [4]byte

logging.Logger().Debug().Msg("Reading tree depth")
read, err := io.ReadFull(r, intBuf[:])
totalRead += int64(read)
if err != nil {
return totalRead, err
}
ps.TreeDepth = binary.BigEndian.Uint32(intBuf[:])

logging.Logger().Debug().Msg("Reading batch size")
read, err = io.ReadFull(r, intBuf[:])
totalRead += int64(read)
if err != nil {
return totalRead, err
}
ps.BatchSize = binary.BigEndian.Uint32(intBuf[:])

logging.Logger().Debug().Msg("Reading proving key")
ps.ProvingKey = groth16.NewProvingKey(ecc.BN254)
keyRead, err := ps.ProvingKey.UnsafeReadFrom(r)
totalRead += keyRead
if err != nil {
return totalRead, err
}

logging.Logger().Debug().Msg("Reading verifying key")
ps.VerifyingKey = groth16.NewVerifyingKey(ecc.BN254)
keyRead, err = ps.VerifyingKey.UnsafeReadFrom(r)
totalRead += keyRead
if err != nil {
return totalRead, err
}

logging.Logger().Debug().Msg("Reading constraint system")
ps.ConstraintSystem = groth16.NewCS(ecc.BN254)
keyRead, err = ps.ConstraintSystem.ReadFrom(r)
totalRead += keyRead
Expand Down

0 comments on commit 2b5a3f8

Please sign in to comment.