Skip to content
Open
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ data
*.sqlite-shm
*.sqlite-wal
**aggkit-001-data**
.vscode
.vscode
debug
bin
7 changes: 7 additions & 0 deletions aggsender/statuschecker/cert_status_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ func (c *certStatusChecker) checkLastCertificateFromAgglayer(ctx context.Context

func (c *certStatusChecker) executeInitialStatusAction(ctx context.Context,
action *initialStatusResult, localCert *types.CertificateHeader, logFn types.EmitLogFunc) error {
if action.warning != "" {
c.log.Warnf("recovery: %s", action.warning)
}
logFn("recovery: action: %s", action.String())
switch action.action {
case InitialStatusActionNone:
Expand Down Expand Up @@ -277,6 +280,10 @@ func (c *certStatusChecker) executeInitialStatusAction(ctx context.Context,
if _, err := c.updateLocalStorageWithSettledAggLayerCert(ctx, action.cert); err != nil {
return fmt.Errorf("recovery: error new local storage with agglayer certificate: %w", err)
}
case InitialStatusActionDeleteLocalCert:
if err := c.storage.DeleteCertificate(nil, action.height, db.MaybeDelete); err != nil {
return fmt.Errorf("recovery: error deleting stale local certificate at height %d: %w", action.height, err)
}
default:
c.log.Warnf("recovery: error unknown action: %s", action.String())
return fmt.Errorf("recovery: unknown action: %s", action.action)
Expand Down
10 changes: 10 additions & 0 deletions aggsender/statuschecker/cert_status_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,16 @@ func TestExecuteInitialStatusAction(t *testing.T) {
},
expectedError: "Waiting for it to be settled",
},
{
name: "Action DeleteLocalCert - success",
action: &initialStatusResult{
action: InitialStatusActionDeleteLocalCert,
height: 7,
},
mockFn: func(mockStorage *mocks.AggSenderStorage, mockCertQuerier *mocks.CertificateQuerier) {
mockStorage.EXPECT().DeleteCertificate(nil, uint64(7), db.MaybeDelete).Return(nil)
},
},
{
name: "Unknown Action",
action: &initialStatusResult{
Expand Down
Loading
Loading