Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(taiko-client): only update LastUpdatedAt after batch proof submission #18630

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions packages/taiko-client/prover/proof_submitter/proof_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,16 @@ func (pb *ProofBuffer) Len() int {
return len(pb.buffer)
}

// Clear clears all buffer.
func (pb *ProofBuffer) Clear() {
pb.mutex.Lock()
defer pb.mutex.Unlock()
pb.buffer = pb.buffer[:0]
pb.lastUpdatedAt = time.Now()
pb.isAggregating = false
}

// LastUpdatedAt returns the last updated time of the buffer.
func (pb *ProofBuffer) LastUpdatedAt() time.Time {
return pb.lastUpdatedAt
}

// LastUpdatedAt returns the last updated time of the buffer.
func (pb *ProofBuffer) UpdateLastUpdatedAt() {
pb.lastUpdatedAt = time.Now()
}

// ClearItems clears items that has given block ids in the buffer.
func (pb *ProofBuffer) ClearItems(blockIDs ...uint64) int {
pb.mutex.Lock()
Expand All @@ -106,7 +102,6 @@ func (pb *ProofBuffer) ClearItems(blockIDs ...uint64) int {
}

pb.buffer = newBuffer
pb.lastUpdatedAt = time.Now()
pb.isAggregating = false
return clearedCount
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ func (s *ProofSubmitter) BatchSubmitProofs(ctx context.Context, batchProof *proo
metrics.ProverSentProofCounter.Add(float64(len(batchProof.BlockIDs)))
metrics.ProverLatestProvenBlockIDGauge.Set(float64(latestProvenBlockID.Uint64()))
s.proofBuffer.ClearItems(uint64BlockIDs...)
// Each time we submit a batch proof, we should update the LastUpdatedAt() of the buffer.
s.proofBuffer.UpdateLastUpdatedAt()

return nil
}
Expand Down
Loading