Skip to content

Conversation

@xlc
Copy link
Member

@xlc xlc commented Oct 30, 2025

This pull request introduces a more flexible signature mocking mechanism to support Cumulus-based consensus for parachains. This is primarily required to apply inherents that contain mock relay-chain data, a key step in parachain block production during local testing.

Changes

  • The mock_signature_host parameter in the WASM executor has been changed from a boolean to a u8 to support three distinct modes:
    • 0: No mocking (default behavior).
    • 1: Mocking is enabled but requires a "magic signature" (maintains previous behavior).
    • 2: All signature verifications are bypassed and always considered valid.
  • When applying inherents via BlockBuilder_apply_extrinsic, the new "always valid" (mode 2) signature mocking is now used. This allows the parachainSystem.setValidationData inherent to work with mock relay-chain headers without failing signature checks.
  • The inherent provider for setValidationData has been updated to correctly construct and handle mock relayParentDescendants.
  • The newHeader logic in the block builder has been refactored to robustly handle various consensus engine digest items.

Closes #975

@xlc xlc requested a review from ermalkaleci October 30, 2025 02:40
The `mockSignatureHost` option has been enhanced from a simple boolean to a tri-state numeric value, offering more granular control over signature verification during task execution.

- `0`: No mock (default behavior)
- `1`: Requires a 'magic signature' to bypass verification
- `2`: Always considers signatures valid

This change is primarily to support parachain development, enabling the `BlockBuilder_apply_extrinsic` call to bypass signature checks for inherent extrinsics. This is crucial for allowing parachains to process faked relay chain data, such as validation data with synthetic descendant headers, without failing signature verification.
@xlc xlc force-pushed the support-cumulus-consensus branch from 086d6a8 to 4ba653b Compare October 30, 2025 02:41
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes introduce a flexible signature mocking mechanism, which is well-implemented on the Rust side. However, in the TypeScript code, there are significant type-safety issues with the use of any for relayParentDescendants, accompanied by a comment that indicates uncertainty about the code's correctness. This could lead to runtime errors and makes the code difficult to maintain.

@xlc xlc mentioned this pull request Oct 30, 2025
@xlc xlc merged commit ed8a1c0 into master Oct 31, 2025
6 of 8 checks passed
@xlc xlc deleted the support-cumulus-consensus branch October 31, 2025 09:41
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.

Not working with Kreivo 0.16

3 participants