referrerpolicy=no-referrer-when-downgrade

Module channel

Module channel 

Source
Expand description

The channel layer: the formats both ends exchange, and each side’s local channel state. The pallet owns the lifecycle and flow-control logic.

§Formats (consensus surface)

  • ChannelMessage is the SCALE payload of every channel-stream MMR leaf, inside crate::mmr::leaf_hash’s framing.
  • Register is the SCALE payload of every ack-stream leaf: the receiver’s complete voice in the channel, lossy and latest-wins, read out-of-band by the sender.

ChannelMessage::Hello (index 0), ChannelMessage::CloseChannel (index 1) and the Register / RegisterStatus layout are the frozen core: they parse at every channel version. Variants beyond it (such as ChannelMessage::Data at index 2) are interpreted under the session’s negotiated channel version. The tests pin their byte layouts.

§Local state

Distinct ID types per direction and kind (OutChannelId, InChannelId, BroadcastId) prevent an outbound channel ID from indexing inbound state, and let the runtime API and inherent maps fix each entry’s discipline by type.

Helper convention: a bare StreamId is one of this chain’s own streams (a key in its own commitment tree and sender-side storage). A foreign stream is returned with its owner, (ParaId, StreamId).

Structs§

AppliedRegister
A register applied by the sender, with its position on the recipient’s Ack stream (the ack highwater).
BroadcastId
A broadcast stream: its sender plus the discriminator. Broadcast has no recipient, so this is the stream’s global identity.
InChannelId
A channel this chain receives on, named by its sender.
InChannelState
Receiver side, per inbound channel.
OpenSession
The session the sender took part in (sent Hello for), its parameters, and whether the sender has applied its Opened register.
OutChannelId
A channel this chain sends on, named by its recipient.
OutChannelState
Sender side, per outbound channel.
Register
The receiver’s complete voice in a channel, published as a leaf on its Ack stream. Latest-wins: every register is self-contained.
SessionParams
A session’s negotiated parameters, fixed from Accepting to Closed.

Enums§

ChannelMessage
The payload of every channel-stream MMR leaf: session signalling or userspace data.
RegisterStatus
Receiver-side session status carried in a Register.