Skip to main content

Module descriptor

Module descriptor 

Source
Expand description

Shared helpers for signed DHT descriptors.

A descriptor is signed by the node’s MessageSigner, so its signature is bound to the signer’s overlay exactly like every other message, and verified under the receiver’s overlay. The body also carries network_id as a signed field; signing refuses a body whose stated overlay differs from the signer’s, so a verified descriptor’s stated overlay is the overlay it was signed for, and a descriptor issued in one overlay does not verify in another.

Lease law (#918; removal-stability paper, Laws 8 and 9): a descriptor is a signed lease. Its body signs the lease end expires_at_ms = ℓ and the freshness window fresh_for_ms = T, and nothing that changes between heartbeats, so its bytes are fixed for the lease and a heartbeat re-appends them, which raises their dot without writing a remove. The time a reader last heard the descriptor, heartbeat_at_ms = τ*, is the dot of its element in the fetched carrier: it is not signed and not encoded, so a re-append or a forged dot can raise it, but never past the signed ℓ. A reader at t holds the descriptor live iff it verifies, its terms are admissible, ℓ ≤ t + Λ + σ and T ≤ Λ (registry_lease), and t ≤ ℓ and t ≤ τ* + T + σ. The terms are the signer’s choice, so the reader bounds them: a lease longer than Λ, or a window longer than the lease, is never live, and a registrant that stops is listed at most Λ + σ after its last write against any signer, writer or syncer.

Traits§

RegistryElement
A descriptor as one element of its DHT registry: the element is the descriptor’s codec encoding, carried as is.
SignedDescriptor
A published descriptor: its body plus the signature over it.
SignedDescriptorBody
The signed fields of one descriptor kind.

Functions§

heard_descriptors
Decode every element of entry as D, heard at its dot; elements that do not decode are skipped.
heard_elements
The registry elements of entry, each with the issue time of its dot, τ*: the time the newest write of those bytes was stamped, which a heartbeat’s re-append raises.
latest_valid_by_did
Select the newest descriptor per DID that verifies under the receiver’s overlay.
latest_valid_by_key
Select the newest descriptor per key that verifies under the receiver’s overlay, and live at now_ms unless include_expired: the join ⊔ of the descriptors under SignedDescriptor::supersedes within each key, a total order, so the selection does not depend on the input order.
registry_lease
The registry lease Λ: the data default lifetime L, so a replayed descriptor outlives its registrant by at most L (removal-stability paper, Def. 7), and the bound a reader puts on every signed lease and freshness window.
sign_descriptor_body
Sign body with the node’s authority.