Skip to content

Commit

Permalink
Halt a node if it errors when applying a block from the sequencer (#1438
Browse files Browse the repository at this point in the history
)

<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview
Closes: #1437 

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 
-->

## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [x] New and updated code has appropriate documentation
- [ ] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [ ] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Improved error handling in the block synchronization process to ensure
node stability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
Manav-Aggarwal committed Jan 9, 2024
1 parent 7abee7c commit 08c6be8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion block/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,11 @@ func (m *Manager) trySyncNextBlock(ctx context.Context, daHeight uint64) error {
}
newState, responses, err := m.applyBlock(ctx, b)
if err != nil {
return fmt.Errorf("failed to ApplyBlock: %w", err)
if ctx.Err() != nil {
return err
}
// if call to applyBlock fails, we halt the node, see https://github.com/cometbft/cometbft/pull/496
panic(fmt.Errorf("failed to ApplyBlock: %w", err))
}
err = m.store.SaveBlock(b, &b.SignedHeader.Commit)
if err != nil {
Expand Down

0 comments on commit 08c6be8

Please sign in to comment.