Skip to content

Validators panic on malformed inherent data in cnight-observation pallet #1317

@m2ux

Description

@m2ux

Problem

The get_data_from_inherent_data function in the cnight-observation pallet uses .expect() on the SCALE decode result. If inherent data is malformed — due to serialization bugs, version mismatches, or data corruption — every validator panics simultaneously, permanently halting the chain with no automatic recovery.

The function is called from three consensus-critical entry points: create_inherent, check_inherent, and is_inherent_required.

Expected behavior

Decode failures should be handled gracefully via typed errors, not panics. The sibling federated-authority-observation pallet already follows this pattern.

Fix

PR #1234 replaces .expect() with Result<Option<T>, InherentError> using a new DecodeFailed variant, and propagates the error appropriately in each caller.

JIRA: https://shielded.atlassian.net/browse/PM-21799

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions