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§
- Inner
Node - An inner node in the commitment trie.
- NodeKey
- Key identifying an inner node in the commitment trie storage.
- Stream
Proof - A membership proof that
(stream, stream_root)is committed under aStreamsRoot. Served by the sender, verified by the receiver. - 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. - Streams
Tree - An in-memory commitment tree caching inner nodes for
O(log S)updates and proofs. - Tree
Step - One step of a trie walk. The branch direction is not stored.
Enums§
- Tree
Child - A child pointer in an inner node or root entry.
- Tree
Error - Error encountered during commitment trie updates.
- Tree
Root Entry - The root entry of the commitment trie.
Traits§
- Node
Lookup - Read-only accessor for inner nodes in the commitment trie.
- Node
Store - Storage accessor for inner nodes in the commitment trie.
Functions§
- gen_
stream_ proof - Build the trie over
entriesand return(StreamsRoot, proof)forstream, orNoneif absent. Sender side. - gen_
stream_ proof_ from_ nodes - Generate a
StreamProofforstreamusing the node storage cache. - read_
streams_ root - Read the sender’s
StreamsRootfrom its header digest.Noneif absent or not exactly what the sender deposits: oneSPMSitem with a 32-byte payload. Foreign readers must agree on validity, so nothing else is accepted. - streams_
root - The
StreamsRootover(stream, stream_root)entries;Nonewith no active streams. Sender side. Takes aBTreeMapso keys are unique; duplicates would reachfirst_diverging_bitwith identical keys. - streams_
root_ from_ proof - Fold a membership proof for
(stream, stream_root)up to theStreamsRootit implies, orNoneon a malformed step. Callers compare the root themselves (the requires-lift records it, the fetch checks it againstunder). Each branch direction isstream’s bit atsplit_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.