Skip to main content

Module packet

Module packet 

Source
Expand description

Packets: the chain, and identity over the whole body. Packets: the chain that makes “never derive from a derivation” a shape.

§Reusing the Merkle node rather than re-minting one

An earlier revision hand-rolled Packet { prior: Option<PacketId>, units } and hashed it. That is a hand-rolled Merkle node — a payload plus a parent link, with identity over both — in a workspace whose first-principle rule says every persisted structure derives its identity through content-addressable, and whose own decision record cited that rule while breaking it.

A packet is now MerkleNode<PacketBody>: the predecessor is a parent link, which is what a parent link is for, and the id is minted by the crate that owns id-minting. Genesis is the empty parent set — the same fact the old prior: None encoded, expressed in the vocabulary the rest of the line already speaks.

§Borrowing a DAG node does not make v0 a DAG

MerkleNode carries a parent set, because a Merkle DAG node does. v0 mints a chain: the referent is formal/ContextOps/Basic.lean, whose Chain has exactly two constructors — genesis (units) and sealed (prior : Chain) (units). There is no multi-parent constructor to correspond to.

So Packet does not implement serde::Deserialize, for the same reason crate::Unit does not. Foreign bytes decode to RawPacket — an ordinary untrusted DAG node — and cross into a Packet only through the fallible TryFrom below, which admits zero parents or exactly one.

The state that closes is a real one, not a hypothetical: a decoded two-parent node satisfied is_genesis() == false and prior() == None simultaneously. Neither constructor can mint that, and newt frame parents rendered it as outcome: "genesis" — “no parents: this frame is an origin, and the chain ends here” — of a packet with two. A forensic surface that reports the absence of a link it silently dropped is worse than one that refuses to answer.

Structs§

Packet
One sealed packet: an ordered list of units, rooted in a predecessor.
PacketBody
What a packet carries: the units it seals, in order.
PacketId
The content address of a Packet. A newtype for the same reason as UnitId.
UnitId
The content address of a crate::Unit.

Enums§

PacketAdmitError
Why a decoded packet was refused admission.

Type Aliases§

RawPacket
The transparent decode target: an untrusted DAG node.