Assessment reports>Nibiru>High findings>Panic in ,EndBlock, hooks will halt the chain
Category: Coding Mistakes

Panic in EndBlock hooks will halt the chain

High Severity
High Impact
High Likelihood

Description

When executing a transaction, Cosmos automatically handles any panics that may occur with the default recovery middleware (see runtx_middleware), but this is not the case for anything that runs within an EndBlock or BeginBlock hook. In these cases it is vital that there are no panics and that all errors are handled correctly; otherwise, it will result in a chain halt as all the validators will panic and crash.

The following locations are all reachable from an EndBlock or BeginBlock (AfterEpochEnd is called from a BeginBlock):

Impact

If any of these error conditions are met, there will be a chain halt as all the validators will crash.

Recommendations

The panics should be replaced with the appropriate error handling for each case and either log the error or fail gracefully.

Remediation

This issue has been acknowledged by Nibiru, and fixes were implemented in the following commits:

Zellic © 2024Back to top ↑