You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Panic on Header Validation Failure in Block Production #2182
In the publishBlock method of the block manager, there's a TODO comment suggesting that header validation failure should trigger a panic. Currently, when a newly produced header fails ValidateBasic(), it only logs an error and continues execution. This is problematic because:
A freshly produced header should never fail basic validation
If it does fail, it indicates a serious bug in the block production logic
Continuing execution with an invalid header could lead to undefined behavior and serious issues.
Current Behavior
iferr:=header.ValidateBasic(); err!=nil {
// TODO(tzdybal): I think this is could be even a panic, because if this happens, header is FUBARm.logger.Error("header validation error", "error", err)
}
Expected Behavior
The code should panic when a newly produced header fails validation, as this indicates a critical error in the block production process that requires immediate attention and cannot be safely recovered from.
Impact
Continuing with an invalid header could lead to:
Stalling the node (due to headers not being removed from the channel used for communication with go-header)
Potential security vulnerabilities
P2P sync issues
Proposed Solution
Replace the error logging with a panic when header validation fails:
Activity
linear commentedon Apr 16, 2025
ROL-131 Panic on Header Validation Failure in Block Production
fix: Panic instead of logging error of failing header validation (#2231)