Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(consensus): we should panic if finalize block on apply commit fails #966

Merged
merged 3 commits into from
Nov 2, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ jobs:
version: v1.61
args: --timeout 10m
github-token: ${{ secrets.github_token }}
only-new-issues: true
if: env.GIT_DIFF
10 changes: 6 additions & 4 deletions dash/core/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion internal/consensus/state_apply_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ func (c *ApplyCommitAction) Execute(ctx context.Context, stateEvent StateEvent)
stateCopy, err := c.blockExec.finalize(ctx, stateData, commit)
if err != nil {
c.logger.Error("failed to apply block", "err", err)
return nil
// If something went wrong within ABCI client, it can stop and we can't recover from it.
// So, we panic here to ensure that the node will be restarted.
panic(fmt.Errorf("failed to finalize block %X at height %d: %w", block.Hash(), block.Height, err))
}

lastBlockMeta := c.blockStore.LoadBlockMeta(height - 1)
Expand Down
8 changes: 1 addition & 7 deletions internal/state/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,7 @@ func execBlockWithoutState(
commit *types.Commit,
logger log.Logger,
) (*abci.ResponseFinalizeBlock, error) {
respFinalizeBlock, err := execBlock(ctx, appConn, block, commit, logger)
if err != nil {
logger.Error("executing block", "err", err)
return respFinalizeBlock, err
}

return respFinalizeBlock, nil
return execBlock(ctx, appConn, block, commit, logger)
}

func (blockExec *BlockExecutor) pruneBlocks(retainHeight int64) {
Expand Down
70 changes: 35 additions & 35 deletions types/mocks/priv_validator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading