Expand description
Primitives for the Speculative Messaging protocol.
A sender parachain keeps each outgoing stream as an MMR and commits all stream roots as one
StreamsRoot (a keyed trie). Messages travel between collators; the relay chain only checks
that each receiver’s Requires matches a sender’s Provides.
The relay-visible types (StreamsRoot, RequiresSet) are in polkadot-primitives. This crate
has the parachain-side types and the off-chain wire format.
Re-exports§
pub use channel::AppliedRegister;pub use channel::BroadcastId;pub use channel::ChannelMessage;pub use channel::InChannelId;pub use channel::InChannelState;pub use channel::OpenSession;pub use channel::OutChannelId;pub use channel::OutChannelState;pub use channel::Register;pub use channel::RegisterStatus;pub use channel::SessionParams;pub use fetch::verify_channel_messages;pub use fetch::verify_messages;pub use fetch::FetchError;pub use fetch::FetchResponse;pub use fetch::MessagesRequest;pub use fetch::MessagesResponse;pub use fetch::VerifyError;pub use fetch::MAX_MESSAGES_PER_RESPONSE;pub use fetch::MAX_SPECULATIVE_MESSAGE_LEN;pub use inherent::ConsumedStreams;pub use inherent::LossyRead;pub use inherent::MessagingInherentData;pub use inherent::Payload;pub use inherent::INHERENT_IDENTIFIER;pub use lift::build_requires;pub use lift::build_requires_entry;pub use lift::stitch;pub use lift::ConsumptionRecord;pub use lift::Interval;pub use lift::LiftError;pub use lift::LiftsBySource;pub use lift::RequiresLift;pub use lift::SourceStreams;pub use mmr::leaf_hash;pub use mmr::leaf_hash_with_version;pub use mmr::FrontierFull;pub use mmr::MessagePosition;pub use mmr::MmrExtensionProof;pub use mmr::MmrFrontier;pub use mmr::MmrRoot;pub use mmr::ProofError;pub use stream::PrivateKind;pub use stream::StreamId;pub use stream::STREAM_ID_LEN;pub use streams_root::InnerNode;pub use streams_root::NodeKey;pub use streams_root::NodeLookup;pub use streams_root::NodeStore;pub use streams_root::StreamProof;pub use streams_root::StreamsTree;pub use streams_root::TreeChild;pub use streams_root::TreeError;pub use streams_root::TreeRootEntry;
Modules§
- channel
- The channel layer: the formats both ends exchange, and each side’s local channel state. The pallet owns the lifecycle and flow-control logic.
- fetch
- The fetch protocol: off-chain wire types and their verifier.
- inherent
- The node/runtime consumption interface: what the runtime asks the node to fetch
(
ConsumedStreams, via theconsumed_streams()runtime API) and what the node delivers in the messaging inherent (MessagingInherentDataandLossyRead). - lift
- Requires-lift and consumption-record primitives.
- mmr
- MMR primitives for the Speculative Messaging protocol.
- stream
StreamId: the parachain-structured stream key.- streams_
root StreamsRoot: the sender’s stream commitment.
Structs§
- Streams
Root - The sender’s per-block stream commitment root. Defined relay-side and re-exported here.
Root of a sender’s stream commitment tree: a compact binary trie keyed by the 8-byte
StreamIdencoding, with the streams’ MMR roots as leaves.
Constants§
- INNER_
TAG - MMR inner node.
- LEAF_
TAG - MMR leaf.
- LEAF_
VERSION - Leaf preimage version. Versions are hash-disjoint, so the layout can change without old leaves colliding with new ones.
- PEAK_
TAG - MMR peak bagging.
- ROOT_
TAG - Stream root (
mmr::MmrRoot::from_bag). - SPMS_
ENGINE_ ID - Engine id of the header digest carrying a block’s
StreamsRoot, deposited only by blocks that send. - TREE_
INNER_ TAG - Commitment-tree inner node. It binds its split bit.
- TREE_
LEAF_ TAG - Commitment-tree leaf. It binds the full
StreamIdkey.
Type Aliases§
- Spec
Hasher - The hash function for all of speculative messaging: leaves, MMR merges, stream and commitment-tree roots. A protocol constant. Changing it is a consensus break, so nothing here is generic over it.