Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 committed Oct 9, 2024
1 parent af76a29 commit 2ffe93a
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions packages/taiko-client/prover/proof_submitter/proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,24 +444,33 @@ func (s *ProofSubmitter) BatchSubmitProofs(ctx context.Context, batchProof *proo
// AggregateProofs read all data from buffer and aggregate them.
func (s *ProofSubmitter) AggregateProofs(ctx context.Context) error {
startTime := time.Now()
buffer, err := s.proofBuffer.ReadAll()
if err != nil {
return fmt.Errorf("failed to read proof from buffer: %w", err)
}
if len(buffer) == 0 {
log.Debug("Buffer is empty now, skip aggregating")
return nil
}
if err := backoff.Retry(
func() error {
buffer, err := s.proofBuffer.ReadAll()
if err != nil {
return fmt.Errorf("failed to read proof from buffer: %w", err)
}
if len(buffer) == 0 {
log.Debug("Buffer is empty now, skip aggregating")
return nil
}

result, err := s.proofProducer.Aggregate(
ctx,
buffer,
startTime,
)
if err != nil {
return fmt.Errorf("failed to request proof aggregation: %w", err)
result, err := s.proofProducer.Aggregate(
ctx,
buffer,
startTime,
)
if err != nil {
return fmt.Errorf("failed to request proof aggregation: %w", err)
}
s.batchResultCh <- result
return nil
},
backoff.WithContext(backoff.NewConstantBackOff(proofPollingInterval), ctx),
); err != nil {
log.Error("Aggregate proof error", "error", err)
return err
}
s.batchResultCh <- result
return nil
}

Expand Down

0 comments on commit 2ffe93a

Please sign in to comment.