Skip to content

Commit

Permalink
fix: clean proof table on start (#207)
Browse files Browse the repository at this point in the history
* fix: clean proof table on start
  • Loading branch information
ToniRamirezM authored Nov 28, 2024
1 parent a5c6aa1 commit a5b8984
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 @@ -335,12 +335,6 @@ func (a *Aggregator) Start() error {
healthService := newHealthChecker()
grpchealth.RegisterHealthServer(a.srv, healthService)

// Delete ungenerated recursive proofs
err = a.state.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 @@ -357,6 +351,12 @@ func (a *Aggregator) Start() error {
a.logger.Infof("Starting AccInputHash:%v", accInputHash.String())
a.setAccInputHash(lastVerifiedBatchNumber, *accInputHash)

// Delete existing proofs
err = a.state.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 @@ -83,7 +83,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()
mockState.On("DeleteUngeneratedProofs", mock.Anything, nil).Return(nil).Once()
mockState.On("DeleteGeneratedProofs", mock.Anything, uint64(90), mock.Anything, nil).Return(nil).Once()
mockState.On("CleanupLockedProofs", mock.Anything, "", nil).Return(int64(0), nil)

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

0 comments on commit a5b8984

Please sign in to comment.