Skip to content

Commit

Permalink
chore(taiko-client): improve prover logs (#18718)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Jan 6, 2025
1 parent ae07365 commit 3246071
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
10 changes: 8 additions & 2 deletions packages/taiko-client/internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ var (
ProverAggregationSubmissionErrorCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_aggregation_submission_error",
})
ProverAggregationGenerationTime = factory.NewGauge(prometheus.GaugeOpts{
Name: "prover_proof_aggregation_generation_time",
ProverSGXAggregationGenerationTime = factory.NewGauge(prometheus.GaugeOpts{
Name: "prover_proof_sgx_aggregation_generation_time",
})
ProverSgxProofGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_sgx_generated",
Expand All @@ -67,6 +67,9 @@ var (
ProverSgxProofAggregationGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_sgx_aggregation_generated",
})
ProverR0AggregationGenerationTime = factory.NewGauge(prometheus.GaugeOpts{
Name: "prover_proof_r0_aggregation_generation_time",
})
ProverR0ProofGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_r0_generated",
})
Expand All @@ -76,6 +79,9 @@ var (
ProverR0ProofAggregationGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_r0_aggregation_generated",
})
ProverSP1AggregationGenerationTime = factory.NewGauge(prometheus.GaugeOpts{
Name: "prover_proof_sp1_aggregation_generation_time",
})
ProverSp1ProofGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_sp1_generated",
})
Expand Down
7 changes: 6 additions & 1 deletion packages/taiko-client/prover/proof_producer/sgx_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func (s *SGXProofProducer) RequestProof(
"coinbase", meta.GetCoinbase(),
"height", header.Number,
"hash", header.Hash(),
"time", time.Since(requestAt),
)

if s.Dummy {
Expand Down Expand Up @@ -137,6 +138,10 @@ func (s *SGXProofProducer) Aggregate(
) (*BatchProofs, error) {
log.Info(
"Aggregate sgx batch proofs from raiko-host service",
"batchSize", len(items),
"firstID", items[0].BlockID,
"lastID", items[len(items)-1].BlockID,
"time", time.Since(requestAt),
)
if len(items) == 0 {
return nil, ErrInvalidLength
Expand Down Expand Up @@ -333,7 +338,7 @@ func (s *SGXProofProducer) requestBatchProof(
"time", time.Since(requestAt),
"producer", "SGXProofProducer",
)
metrics.ProverAggregationGenerationTime.Set(float64(time.Since(requestAt).Seconds()))
metrics.ProverSGXAggregationGenerationTime.Set(float64(time.Since(requestAt).Seconds()))

return proof, nil
}
Expand Down
13 changes: 12 additions & 1 deletion packages/taiko-client/prover/proof_producer/zkvm_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ func (s *ZKvmProofProducer) RequestProof(
"coinbase", meta.GetCoinbase(),
"height", header.Number,
"hash", header.Hash(),
"zk type", s.ZKProofType,
"zkType", s.ZKProofType,
"time", time.Since(requestAt),
)

if s.Dummy {
Expand Down Expand Up @@ -123,6 +124,10 @@ func (s *ZKvmProofProducer) Aggregate(
log.Info(
"Aggregate zkvm batch proofs from raiko-host service",
"zkType", s.ZKProofType,
"batchSize", len(items),
"firstID", items[0].BlockID,
"lastID", items[len(items)-1].BlockID,
"time", time.Since(requestAt),
)
if len(items) == 0 {
return nil, ErrInvalidLength
Expand Down Expand Up @@ -515,6 +520,12 @@ func (s *ZKvmProofProducer) requestBatchProof(
"producer", "ZKvmProofProducer",
)

if s.ZKProofType == ZKProofTypeR0 {
metrics.ProverR0AggregationGenerationTime.Set(float64(time.Since(requestAt).Seconds()))
} else if s.ZKProofType == ZKProofTypeSP1 {
metrics.ProverSP1AggregationGenerationTime.Set(float64(time.Since(requestAt).Seconds()))
}

return proof, nil
}

Expand Down
11 changes: 8 additions & 3 deletions packages/taiko-client/prover/proof_submitter/proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ func (s *ProofSubmitter) BatchSubmitProofs(ctx context.Context, batchProof *proo
log.Info(
"Batch submit block proofs",
"proof", common.Bytes2Hex(batchProof.BatchProof),
"blockIds", batchProof.BlockIDs,
"size", len(batchProof.Proofs),
"firstID", batchProof.BlockIDs[0],
"lastID", batchProof.BlockIDs[len(batchProof.BlockIDs)-1],
"tier", batchProof.Tier,
)
var (
Expand Down Expand Up @@ -479,9 +481,12 @@ func (s *ProofSubmitter) AggregateProofs(ctx context.Context) error {
if err != nil {
if errors.Is(err, proofProducer.ErrProofInProgress) ||
errors.Is(err, proofProducer.ErrRetry) {
log.Info("Aggregating proofs",
log.Info(
"Aggregating proofs",
"status", err,
"length", len(buffer),
"batchSize", len(buffer),
"firstID", buffer[0].BlockID,
"lastID", buffer[len(buffer)-1].BlockID,
"tier", s.Tier(),
)
} else {
Expand Down

0 comments on commit 3246071

Please sign in to comment.