referrerpolicy=no-referrer-when-downgrade

Module streams_root

Module streams_root 

Source
Expand description

StreamsRoot: the sender’s stream commitment.

Each block that sends commits one hash, the root of a keyed binary Patricia trie over (StreamId, current stream root) for every active stream. The relay records it as the sender’s Provides, and a receiver proves the streams it consumed against it, without a sender-state proof.

The key drives the walk, so a proof cannot be moved to another stream (streams_root_from_proof).

Roles: the sender builds the root (streams_root) and its node serves proofs (gen_stream_proof), checking its own header digest (read_streams_root); a receiver’s lift walks a proof up to the committed root (streams_root_from_proof).

Structs§

InnerNode
An inner node in the commitment trie.
NodeKey
Key identifying an inner node in the commitment trie storage.
StreamProof
A membership proof that (stream, stream_root) is committed under a StreamsRoot. Served by the sender, verified by the receiver.
StreamsRoot
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 StreamId encoding, with the streams’ MMR roots as leaves.
StreamsTree
An in-memory commitment tree caching inner nodes for O(log S) updates and proofs.
TreeStep
One step of a trie walk. The branch direction is not stored.

Enums§

TreeChild
A child pointer in an inner node or root entry.
TreeError
Error encountered during commitment trie updates.
TreeRootEntry
The root entry of the commitment trie.

Traits§

NodeLookup
Read-only accessor for inner nodes in the commitment trie.
NodeStore
Storage accessor for inner nodes in the commitment trie.

Functions§

gen_stream_proof
Build the trie over entries and return (StreamsRoot, proof) for stream, or None if absent. Sender side.
gen_stream_proof_from_nodes
Generate a StreamProof for stream using the node storage cache.
read_streams_root
Read the sender’s StreamsRoot from its header digest. None if absent or not exactly what the sender deposits: one SPMS item with a 32-byte payload. Foreign readers must agree on validity, so nothing else is accepted.
streams_root
The StreamsRoot over (stream, stream_root) entries; None with no active streams. Sender side. Takes a BTreeMap so keys are unique; duplicates would reach first_diverging_bit with identical keys.
streams_root_from_proof
Fold a membership proof for (stream, stream_root) up to the StreamsRoot it implies, or None on a malformed step. Callers compare the root themselves (the requires-lift records it, the fetch checks it against under). Each branch direction is stream’s bit at split_bit, so a proof built for another stream yields a different root.
update_tree_leaf
Incrementally update or insert a stream into the commitment trie storage.