Skip to main content

Module derivation

Module derivation 

Source
Expand description

Derivations: the addressed fact a unit’s identity is computed over. Derivations: the addressed fact a unit’s identity is computed over.

§The defect this type exists to fix

The first revision of this kernel hashed a Unit holding { op, depth, root_kind, life, addressed: bool }. None of those fields names the material. Two elisions over completely different sources, with the same root kind, serialize to identical bytes and therefore mint the same content id — the distinguishing information never enters the hash. And addressed: true is a declaration that a unit is addressed, not an address: nothing can be fetched from it, so checkOf .elide = .rederive had nothing to re-derive.

A Derivation carries the address instead of asserting one. The source is named, the byte range within it is named, and the material that range covers is named — so a consumer who holds the source bytes can recompute the claim and compare. That is what makes the id self-validating rather than self-describing.

§Two id profiles, deliberately

source and elided are RawContentId — they name opaque byte strings. root is a ContentId — it names a canonical structured value (crate::RootEvent). content-addressable mints these as different types with no PartialEq and no From between them precisely so this distinction cannot be lost by accident, and the kernel honours it.

Structs§

Derivation
What was done, to which material, on whose authority.
Span
A half-open byte range [start, end) within a source.