Skip to content

Commit

Permalink
fix: clean proof table on start (#207) (#210)
Browse files Browse the repository at this point in the history
* fix: clean proof table on start
  • Loading branch information
ToniRamirezM authored Nov 29, 2024
1 parent 03b4e7e commit f8a2f23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,6 @@ func (a *Aggregator) Start() error {
healthService := newHealthChecker()
grpchealth.RegisterHealthServer(a.srv, healthService)

// Delete ungenerated recursive proofs
err = a.storage.DeleteUngeneratedProofs(a.ctx, nil)
if err != nil {
return fmt.Errorf("failed to initialize proofs cache %w", err)
}

// Get last verified batch number to set the starting point for verifications
lastVerifiedBatchNumber, err := a.etherman.GetLatestVerifiedBatchNum()
if err != nil {
Expand All @@ -347,6 +341,12 @@ func (a *Aggregator) Start() error {
a.logger.Infof("Starting AccInputHash:%v", accInputHash.String())
a.setAccInputHash(lastVerifiedBatchNumber, *accInputHash)

// Delete existing proofs
err = a.storage.DeleteGeneratedProofs(a.ctx, lastVerifiedBatchNumber, maxDBBigIntValue, nil)
if err != nil {
return fmt.Errorf("failed to delete proofs table %w", err)
}

a.resetVerifyProofTime()

go a.cleanupLockedProofs()
Expand Down
2 changes: 1 addition & 1 deletion aggregator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func Test_Start(t *testing.T) {
mockL1Syncr.On("Sync", mock.Anything).Return(nil)
mockEtherman.On("GetLatestVerifiedBatchNum").Return(uint64(90), nil).Once()
mockEtherman.On("GetBatchAccInputHash", mock.Anything, uint64(90)).Return(common.Hash{}, nil).Once()
mockStorage.On("DeleteUngeneratedProofs", mock.Anything, nil).Return(nil).Once()
mockStorage.On("DeleteGeneratedProofs", mock.Anything, uint64(90), mock.Anything, nil).Return(nil).Once()
mockStorage.On("CleanupLockedProofs", mock.Anything, "", nil).Return(int64(0), nil)

mockEthTxManager.On("Start").Return(nil)
Expand Down

0 comments on commit f8a2f23

Please sign in to comment.