Skip to content

K6 · The seam: KelProvider trait + verdict-output pattern + MemKel reference impl #92

Description

@joeldsouzax

Goal

The seam itself: the minimal trait set through which the pure core sees the world, plus an in-memory reference implementation. This is what makes "cesr has everything except db/runtime/config" concrete — and it's deliberately tiny.

Design

/// The ONLY window the pure core gets onto stored KELs. Sync, allocation-light,
/// GAT-friendly borrows (house style — not cesride's owned-everything API).
pub trait KelProvider {
    type Event<'a>: /* borrowed event view */ where Self: 'a;
    fn event_at(&self, pre: &Prefix, sn: u64) -> Option<Self::Event<'_>>;
    fn latest(&self, pre: &Prefix) -> Option<Self::Event<'_>>;
    fn key_state(&self, pre: &Prefix) -> Option<&KeyState>;
}

Plus the verdict-output pattern (replaces keripy's in-place self.db.* mutation): validation returns data describing what happened — the caller commits.

pub struct Acceptance<'a> { pub new_state: KeyState, pub event: KeriEvent<'a>, /* digests, receipts counted, … */ }
// The layer above persists it (nexus repository, LMDB, whatever) — cesr never writes.

Keep it minimal on purpose: no EscrowStore trait (escrow storage is runtime-owned; K2 verdicts are enough), no async (a sync trait is trivially adapted upward; the reverse poisons no_std).

  • MemKel: in-memory KelProvider impl (feature testing or always-on — it's tiny) used by all K1–K5 tests and any wasm demo
  • Rustdoc "implementing a KEL store" page naming the two real implementations planned above cesr: a nexus repository (nexus-side card) and the keri binary's store
  • Trait-bound audit: everything object-safe or intentionally not, documented; no std types in signatures

Acceptance

K1–K5 compile against KelProvider only (grep proves no other storage touchpoint); MemKel passes the whole verdict suite; no_std + wasm32 green.

From the 2026-07-05 keripy teardown (the anti-Baser: keripy's 50-table basing.py collapses to one lookup trait on the read side). Depends on: K1 types. Co-designs with: K3/K4/K5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    design-intelSurfaced by the design-intel watcher

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions