Skip to content

Commit

Permalink
fix(consensus): we should panic if finalize block on apply commit fai…
Browse files Browse the repository at this point in the history
…ls (#966)

* fix(consensus): we should panic on apply commit

* build(github): lint only new issues

* chore: update mocks
  • Loading branch information
lklimek authored Nov 2, 2024
1 parent f8ebd34 commit 71764d5
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 47 deletions.
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.

0 comments on commit 71764d5

Please sign in to comment.