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)
ChannelMessageis the SCALE payload of every channel-stream MMR leaf, insidecrate::mmr::leaf_hash’s framing.Registeris 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§
- Applied
Register - A register applied by the sender, with its position on the recipient’s
Ackstream (the ack highwater). - Broadcast
Id - A broadcast stream: its sender plus the discriminator. Broadcast has no recipient, so this is the stream’s global identity.
- InChannel
Id - A channel this chain receives on, named by its sender.
- InChannel
State - Receiver side, per inbound channel.
- Open
Session - The session the sender took part in (sent
Hellofor), its parameters, and whether the sender has applied itsOpenedregister. - OutChannel
Id - A channel this chain sends on, named by its recipient.
- OutChannel
State - Sender side, per outbound channel.
- Register
- The receiver’s complete voice in a channel, published as a leaf on its
Ackstream. Latest-wins: every register is self-contained. - Session
Params - A session’s negotiated parameters, fixed from
AcceptingtoClosed.
Enums§
- Channel
Message - The payload of every channel-stream MMR leaf: session signalling or userspace data.
- Register
Status - Receiver-side session status carried in a
Register.