diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index d9ecb1a2..a817320c 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -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 { @@ -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() diff --git a/aggregator/aggregator_test.go b/aggregator/aggregator_test.go index 95b55367..086550eb 100644 --- a/aggregator/aggregator_test.go +++ b/aggregator/aggregator_test.go @@ -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)