Panic in EndBlock
hooks will halt the chain
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: