From ca0945694cf19f84cdaf9b445286f77701ed380a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 15 Mar 2023 17:20:20 +0100 Subject: [PATCH] ABCI calls should crash/exit in all cases when the call itself reports and error (backport #496) (#520) * ABCI calls should crash/exit in all cases when the call itself reports and error (#496) * Review call hierarchies of ABCI methods to make sure they panic on error * Added changelog * Trying 1.20.2 explicitly (cherry picked from commit 2ab85986097ef50710d4484381ca1f57f350b771) # Conflicts: # .github/workflows/govulncheck.yml # state/execution.go * Revert "ABCI calls should crash/exit in all cases when the call itself reports and error (#496)" This reverts commit d2fae794533dd2552af89268e39763f7b63ea26d. * [partial cherry-pick] ABCI calls should crash/exit in all cases when the call itself reports and error (#496) * Review call hierarchies of ABCI methods to make sure they panic on error * Added changelog * Trying 1.20.2 explicitly --------- Co-authored-by: Sergio Mena --- .../bug-fixes/496-error-on-applyblock-should-panic.md | 2 ++ consensus/state.go | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .changelog/unreleased/bug-fixes/496-error-on-applyblock-should-panic.md diff --git a/.changelog/unreleased/bug-fixes/496-error-on-applyblock-should-panic.md b/.changelog/unreleased/bug-fixes/496-error-on-applyblock-should-panic.md new file mode 100644 index 0000000000..55e9c874f8 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/496-error-on-applyblock-should-panic.md @@ -0,0 +1,2 @@ +- `[consensus]` Unexpected error conditions in `ApplyBlock` are non-recoverable, so ignoring the error and carrying on is a bug. We replaced a `return` that disregarded the error by a `panic`. + ([\#496](https://github.com/cometbft/cometbft/pull/496)) \ No newline at end of file diff --git a/consensus/state.go b/consensus/state.go index 144ea7d65d..941ea1d5e6 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1667,8 +1667,7 @@ func (cs *State) finalizeCommit(height int64) { block, ) if err != nil { - logger.Error("failed to apply block", "err", err) - return + panic(fmt.Sprintf("failed to apply block; error %v", err)) } fail.Fail() // XXX