Skip to content

Shielded transactions support in block proposer#6

Merged
sam0x17 merged 14 commits intopolkadot-stable2506-2-otf-patchesfrom
polkadot-stable2506-2-otf-mev-block-builder
Feb 18, 2026
Merged

Shielded transactions support in block proposer#6
sam0x17 merged 14 commits intopolkadot-stable2506-2-otf-patchesfrom
polkadot-stable2506-2-otf-mev-block-builder

Conversation

@l0r1s
Copy link
Copy Markdown

@l0r1s l0r1s commented Feb 12, 2026

Summary

Companion PR to opentensor/subtensor#2415

Adds MEV shield support to Substrate: shielded (encrypted) transaction handling in the block
proposer, along with the shared primitive and client crates (sp-shield, sc-shield) that were
moved here from subtensor to avoid a circular dependency between the two repos.

Users encrypt their extrinsics using ML-KEM-768 + XChaCha20-Poly1305 against the next block
author's public key. At block building time, the proposer decrypts each shielded transaction and
pushes both the wrapper and the inner extrinsic into the block, keeping transaction contents
hidden from the mempool.

Changes

stp-shield (new subtensor primitives crate)

Shared types used by both the runtime and the node side:

  • ShieldedTransaction struct and wire-format parsing
  • ShieldKeystore trait and ShieldKeystoreExt runtime extension
  • ShieldApi runtime API definition (try_decode_shielded_tx, try_unshield_tx)
  • Inherent identifier, ShieldPublicKey type, logging target

stc-shield (new subtensor client crate)

Node-side shield logic:

  • MemoryShieldKeystore — in-memory ML-KEM keystore implementation
  • ShieldInherentDataProvider — provides the next public key as an inherent
  • KeyRotationService — generates and rotates ML-KEM keypairs per slot

sc-basic-authorship (block proposer)

  • ProposerFactory / Proposer accept a ShieldKeystorePtr for decryption
  • Shielded transactions are detected via the ShieldApi, decrypted, and their inner extrinsic
    is included alongside the wrapper in the produced block
  • Block size estimation accounts for wrapper + estimated inner transaction size
  • Validators can opt out via SUBSTRATE_SKIP_SHIELDED_TXS=1 — skipped transactions stay in the
    pool for gossip to other authors
  • Refactored report_exhausted_resources helper shared between normal and unshielded tx paths

sp-runtime (minor)

  • Add fn call() to the Applyable trait (needed to inspect the call after signature check)

pallet-aura (minor)

  • Make current_slot_from_digests public for shield key rotation

substrate-test-runtime

  • Implement ShieldApi using storage keys (Wasm-compatible) for proposer tests

Tests

Screenshot 2026-02-17 at 11 40 18 AM

@l0r1s l0r1s changed the title Shielded transactions in block proposer Shielded transactions support in block proposer Feb 14, 2026
@l0r1s l0r1s requested a review from a team February 17, 2026 15:43
Copy link
Copy Markdown

@sam0x17 sam0x17 left a comment

Choose a reason for hiding this comment

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

looks great!

@sam0x17 sam0x17 merged commit 9783760 into polkadot-stable2506-2-otf-patches Feb 18, 2026
133 of 224 checks passed
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.

4 participants