Skip to content

proto(v37): libmrr M2 Drop 3 — finality-gated owed/overlay ledger + KAT-4 goldens - #1068

Merged
frstrtr merged 3 commits into
v37-devfrom
v37/libmrr-drop3-finality-overlay
Aug 4, 2026
Merged

proto(v37): libmrr M2 Drop 3 — finality-gated owed/overlay ledger + KAT-4 goldens#1068
frstrtr merged 3 commits into
v37-devfrom
v37/libmrr-drop3-finality-overlay

Conversation

@frstrtr

@frstrtr frstrtr commented Aug 3, 2026

Copy link
Copy Markdown
Owner

What

Drop 3 of the libmrr V37 prototype line: mrr.Settlement (prototypes/libmrr/mrr/overlay.go) — the finality gate that turns owed work into paid work, built additively on the Drop-2 owed base. Prototype/research only; no production wiring.

Model

Three integer ledgers over one identity space with the conservation invariant accrued == owed + pending + settled (I-CONSERVE) held across every transition:

  • owed — accrued, un-earmarked (the Drop-2 self-carry base)
  • pending — earmarked to a found-but-not-final block overlay (reversible)
  • settled — paid by a finalized block (irreversible)

The three m1 settlement-machine block transitions are weight moves that leave I-CONSERVE invariant:

transition effect
BlockFound → OverlayAdded owed → pending (earmark, reversible)
BlockFinalized → OwedSettled + OverlayCleared pending → settled
BlockOrphaned → OverlayReverted pending → owed (snapshot restore)

Finalize(blockID, depth) is the symmetric payout-side finality-gate (round-4/5 conceded fix): a payout cannot settle below finalityK (the same Geometry.FinalityDepthK that seals the work side) — depth < K returns NotFinal and moves nothing.

Properties pinned (tests)

  • Snapshot revert — a found→orphaned round trip restores the prior digest bit-for-bit (reorg safety).
  • Found-order commutativity over disjoint identities.
  • No overdraw / no double-spend — a found overlay cannot draw more than an identity's owed; rejected atomically.
  • Symmetric gate — settle blocked below K.
  • Owed base seeds from a Drop-2 Ledger via its exported accessors; Drop 2 is untouched.

KAT-4 golden vectors (kat4_overlay_vectors.json, 3 scenarios) pin per-step disposition/totals/digest + hand-derived final balances; cmd/genkat4 asserts I-CONSERVE and the snapshot-revert pairs before it will mint. KAT-4 golden is regeneration-deterministic (identical hash across repeated runs).

MUST-NOTs honored

  • KAT-1/2/3 golden hashes bit-identical (additive only — those files are not in the diff).
  • Zero production call sites — referenced only by its own tests and cmd/genkat4.
  • Diff confined to prototypes/libmrr.

Base

Off v37-dev @ 86c46bba (Drop-2 tip). PR targets v37-dev, not master. Merge-cp into master is a separate later ask.

frstrtr added 2 commits August 4, 2026 02:20
…AT-4 goldens

Adds mrr.Settlement over the Drop-2 owed base: three integer ledgers (owed /
pending / settled) with I-CONSERVE (accrued == owed + pending + settled) held
across every transition. The three m1 settlement-machine block transitions are
weight moves: BlockFound->OverlayAdded (owed->pending), BlockFinalized->
OwedSettled+OverlayCleared (pending->settled), BlockOrphaned->OverlayReverted
(pending->owed). Finalize gates on finalityK (the symmetric payout-side
finality-gate): a payout cannot settle below depth K, matching the work side.

A found->orphaned round trip restores the prior digest bit-for-bit (reorg-safety
snapshot revert); found order over disjoint identities commutes; a found overlay
cannot overdraw an identity's owed (rejected atomically). The owed base seeds
from a Drop-2 Ledger via its exported accessors — Drop 2 is untouched. KAT-4
golden vectors pin per-step disposition/totals/digest and the hand-derived final
balances; cmd/genkat4 asserts I-CONSERVE and the snapshot-revert pairs before
minting. Additive only: KAT-1/2/3 goldens unchanged, zero production call sites,
diff confined to prototypes/libmrr.
@frstrtr
frstrtr merged commit 86b347f into v37-dev Aug 4, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant