Skip to main content

Crate eml

Crate eml 

Source
Expand description

§EML — Epoch Merkle Log

A single RFC 9162 append-only Merkle tree supporting dynamic sets of hash algorithms over a shared topology. Algorithms activate and deactivate between appends. A new algorithm’s view of pre-activation positions consists of deterministic null constants, enabling O(log n) algorithm addition without retroactive computation.

See docs/models/epoch-merkle-log.md for the formal model.

§Architecture

EML is algorithm-agnostic. Callers provide hash implementations via the Hasher trait. Leaf storage is decoupled via the Storage trait. The crate has zero runtime dependencies.

§Proofs

EML generates standard RFC 9162 inclusion and consistency proofs per algorithm. Proofs verify against the standard verify_inclusion and verify_consistency functions — no modified verifier is needed.

Specification vs. implementation. The formal model (§11) defines project(S, a) as an O(n) specification oracle — the conceptual per-algorithm leaf sequence that establishes correctness via equational laws. The implementation does not materialize this sequence. Proof generation instead uses subtree_root (§11c), which resolves sibling hashes via O(1) stored-node lookups, achieving O(log n) proof generation. The correctness bridge (§12) proves these produce identical output.

§Usage

use eml::{Log, Hasher, MemoryStorage};

// Implement Hasher for your algorithm, then:
let mut log = Log::new(MemoryStorage::new());
log.add_algorithm(0, my_hasher);     // algorithm 0 active from genesis
log.append(b"first entry");
let root = log.root(0).unwrap();

Structs§

AlgorithmInfo
Per-algorithm metadata snapshot (Definition 13).
ConsistencyProof
Consistency proof — proves a tree of old_size is a prefix of new_size.
ElidedInclusionProof
An inclusion proof with null subtree siblings elided.
InclusionProof
Inclusion proof — proves a leaf at index exists in a tree of tree_size.
Log
An Epoch Merkle Log.
MemoryStorage
In-memory leaf and node storage backed by collections.
MemoryStorageError
Error type for MemoryStorage operations.
NullTable
Precomputed null subtree constants for a single algorithm.

Enums§

Error
Errors that can occur during EML operations.

Traits§

Hasher
Hash operations required by the EML tree.
Storage
Backend for persisting and retrieving raw leaf payloads and sealed internal node hashes.

Functions§

elide_inclusion_proof
Elide null subtree siblings from a full inclusion proof.
rehydrate_inclusion_proof
Rehydrate an elided inclusion proof by synthesizing null subtree hashes.
verify_consistency
Verify a consistency proof (RFC 9162 §2.1.4.2).
verify_inclusion
Verify an inclusion proof (RFC 9162 §2.1.3.2).

Type Aliases§

AlgorithmMetas
Reconstructed metadata for registered algorithms: a list of (alg_id, epochs) pairs.
Epochs
Epoch metadata for a registered algorithm: a sequence of half-open [start, end) intervals.
Result
Convenience alias.