Skip to content

fix(factory): recover panics while validating a proposed block#4920

Merged
envestcc merged 1 commit into
masterfrom
fix/recover-block-validation-panic
Jul 13, 2026
Merged

fix(factory): recover panics while validating a proposed block#4920
envestcc merged 1 commit into
masterfrom
fix/recover-block-validation-panic

Conversation

@guo

@guo guo commented Jul 12, 2026

Copy link
Copy Markdown
Member

#4840 recovers panics on the mint path so a doomed draft cannot crash the process. A proposed block is likewise untrusted input, but ValidateBlock currently runs outside any recover, so a panic while processing a proposed block's actions takes the validating node down.

This extends the same resilience to the validation path: a panic during ValidateBlock is recovered and surfaced as an error (the block is rejected) instead of crashing the process.

  • The working set is discarded by the caller on error, so no partial state leaks.
  • No committed state changes — such a block could not validate successfully either way — so this needs no fork gate.
  • The commit/PutBlock path (trusted data) intentionally stays fatal, as before.
  • Adds a iotex_validate_block_panics_total metric and a regression test.

#4840 recovers panics on the mint path so a doomed draft cannot crash
the process. A proposed block is likewise untrusted input: extend the
same resilience to ValidateBlock so a panic while processing a block's
actions is recovered and surfaced as an error (the block is rejected)
instead of taking the validating node down. The working set is discarded
by the caller on error, so no partial state leaks and no committed state
changes; the commit/PutBlock path stays fatal as before.

Adds a regression test.
@guo guo requested a review from a team as a code owner July 12, 2026 23:08
@sonarqubecloud

Copy link
Copy Markdown

@envestcc envestcc merged commit 457ddbb into master Jul 13, 2026
4 checks passed
@envestcc envestcc deleted the fix/recover-block-validation-panic branch July 13, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants