Skip to content

P6 milestone 1: Rust conformance core — reproduces the golden vectors byte-for-byte - #25

Merged
Judge-M merged 5 commits into
mainfrom
p6/rust-conformance-core
Aug 5, 2026
Merged

Judge-M merged 5 commits into
mainfrom
p6/rust-conformance-core

Conversation

@Judge-M

@Judge-M Judge-M commented Aug 5, 2026

Copy link
Copy Markdown
Owner

What landed

The first milestone of the single Rust port, under rust/:

  • decima-core (library, #![forbid(unsafe_code)]) reproduces the Python heartbeat reference (heartbeat/decima/) byte-for-byte:
    • hashing — canonical encoding (sorted-key JSON, UTF-8/raw non-ASCII, compact separators, recursive NFC, no floats, arbitrary-precision ints) and domain-separated BLAKE2b-128 content addressing ("decima:v0.1:" || kind || 0x00 || bytes; kinds cell/event/blob/snapshot)
    • crypto — Ed25519 (RFC 8032, deterministic → golden signatures); named mint, self-certifying keyed mint, DerivedKeyStore-equivalent custody
    • weft — append-only signed log; linear append, Lamport clocks, NFC-on-entry, content-addressed event ids, author signs the eid string's UTF-8 bytes
    • weave — the fold: deterministic total order (lamport, event_id), idempotent by event id, register merge substrate (LWW + MV/adjudicated head preservation), CONTENT/EDGE/TYPE_DEF, RETRACT modes WITHDRAW/REDACT/SUPERSEDE/TERMINATE with cascade-root recording, DERIVED_AUTHORITY/LEASE_TREE cascade as a pure derived pass, state_root
    • model, capability (grant + downhill attenuate), reference (a Rust re-run of the exact _fold_vector script)
  • decima-verify (binary) — loads heartbeat/protocol/reference_vectors.json and re-derives every value in it from first principles; prints a per-section report; exits 0 iff everything matches.
  • rust/README.md documents the layout and the honest subset. Deps: blake2 / ed25519-dalek / serde / serde_json / unicode-normalization / hex, exact-pinned via Cargo.lock.

Verification evidence

  • cargo test — 10/10 conformance unit tests pass (canonical, NFC collapse, big-int, blobs, principals, golden signatures + tamper fail-closed, weft linear append, fold golden root, fold idempotence).
  • cargo run -p decima-verify — exit 0, 107/107 checks match:
    • canonical: 27 · blobs: 3 · principals: 20 · signatures: 16 · fold: 41
    • fold state_root = 28aacd8ab21e83790eb81563b5de4e26 (matches the golden vector)

Not yet ported (honest list)

None exercised by the reference vectors: INVOKE and ATTEST folds (attestations, adjudication collapse, promotion), the or-set / counter / append-log / sequence / map reducers, lease-expiry derivation, capability delegation verification / authorization, key-rotation succession chains, event ingest/sync, snapshots, time-travel windows, SQLite persistence.

How to run

cd rust
cargo test                  # 10 conformance unit tests
cargo run -p decima-verify  # per-section report; exit 0 = full match

Judge-M and others added 5 commits August 5, 2026 05:30
…1/3: manifests)

First landing of the single Rust port. decima-core reproduces the heartbeat
reference byte-for-byte: canonical encoding (sorted-key JSON/UTF-8/NFC,
arbitrary-precision ints), domain-separated BLAKE2b-128 content addressing,
Ed25519 derived identity + golden signatures, Weft linear-append semantics,
and the Weave fold subset exercised by the golden vectors. decima-verify
re-derives every value in heartbeat/protocol/reference_vectors.json from
first principles and exits 0 — 107/107 checks match, cargo test 10/10.

Honest subset documented in rust/README.md: INVOKE/ATTEST folds, non-register
reducers, leases, rotation, ingest, snapshots, persistence not yet ported.
No unsafe; deps blake2/ed25519-dalek/serde_json/unicode-normalization/hex,
exact-pinned via Cargo.lock.
…2/3: lock + hashing/crypto/weft)

First landing of the single Rust port. decima-core reproduces the heartbeat
reference byte-for-byte: canonical encoding (sorted-key JSON/UTF-8/NFC,
arbitrary-precision ints), domain-separated BLAKE2b-128 content addressing,
Ed25519 derived identity + golden signatures, Weft linear-append semantics,
and the Weave fold subset exercised by the golden vectors. decima-verify
re-derives every value in heartbeat/protocol/reference_vectors.json from
first principles and exits 0 — 107/107 checks match, cargo test 10/10.

Honest subset documented in rust/README.md: INVOKE/ATTEST folds, non-register
reducers, leases, rotation, ingest, snapshots, persistence not yet ported.
No unsafe; deps blake2/ed25519-dalek/serde_json/unicode-normalization/hex,
exact-pinned via Cargo.lock.
…3/4: weave/model/capability/reference)

First landing of the single Rust port. decima-core reproduces the heartbeat
reference byte-for-byte: canonical encoding (sorted-key JSON/UTF-8/NFC,
arbitrary-precision ints), domain-separated BLAKE2b-128 content addressing,
Ed25519 derived identity + golden signatures, Weft linear-append semantics,
and the Weave fold subset exercised by the golden vectors. decima-verify
re-derives every value in heartbeat/protocol/reference_vectors.json from
first principles and exits 0 — 107/107 checks match, cargo test 10/10.

Honest subset documented in rust/README.md: INVOKE/ATTEST folds, non-register
reducers, leases, rotation, ingest, snapshots, persistence not yet ported.
No unsafe; deps blake2/ed25519-dalek/serde_json/unicode-normalization/hex,
exact-pinned via Cargo.lock.
…4/4: conformance tests + verifier)

First landing of the single Rust port. decima-core reproduces the heartbeat
reference byte-for-byte: canonical encoding (sorted-key JSON/UTF-8/NFC,
arbitrary-precision ints), domain-separated BLAKE2b-128 content addressing,
Ed25519 derived identity + golden signatures, Weft linear-append semantics,
and the Weave fold subset exercised by the golden vectors. decima-verify
re-derives every value in heartbeat/protocol/reference_vectors.json from
first principles and exits 0 — 107/107 checks match, cargo test 10/10.

Honest subset documented in rust/README.md: INVOKE/ATTEST folds, non-register
reducers, leases, rotation, ingest, snapshots, persistence not yet ported.
No unsafe; deps blake2/ed25519-dalek/serde_json/unicode-normalization/hex,
exact-pinned via Cargo.lock.
Adds the rust-conformance job and clears the lint debt so it can run with the
same rigor as the Python lanes.

WHY THE GATE. decima-verify already re-derives every value in
heartbeat/protocol/reference_vectors.json and exits non-zero on mismatch, but
nothing ran it — the port's conformance was hand-verified only. That left the
golden vectors enforced on the PYTHON side alone (check 510): a deliberate,
reviewed regeneration of the vectors would turn 510 green against the new bytes
while the Rust port silently fell out of conformance, with nothing to say so.
The vectors exist to be a continuously enforced port contract; this is the half
that makes that true of the port itself. It is the same "proven mechanism, no
caller" shape the roadmap re-audits kept finding, here as "proven verifier, no
gate".

THE JOB (4 steps): cargo fmt --check, cargo clippy --all-targets -D warnings,
cargo test, cargo run -p decima-verify. No third-party action is added — Rust
ships preinstalled on the ubuntu runner, so this lane introduces nothing new to
pin and audit, which is deliberate given this workflow's stated threat model for
mutable action tags. checkout is the same pinned SHA the other jobs use.

PROOF THE GATE BITES (not a green-always lane): injecting a real port divergence
— removing the domain separator from the digest — makes the verify step exit 1
(34/107 checks fail) and the test step exit 101 (6/10 tests fail); reverting
returns both to 0.

LINT DEBT CLEARED so the new lane starts green: cargo fmt applied across the
crate (formatting only), and three clippy warnings fixed — two redundant
closures in weave.rs (sort_by(|a, b| value_cmp(a, b)) -> sort_by(value_cmp)) and
a push-after-creation in decima-verify (Vec::new + 5 pushes -> vec![]). All
behavior-preserving, confirmed by re-running the full verifier afterward:
107/107 checks, state_root 28aacd8ab21e83790eb81563b5de4e26, unchanged.

Also adds rust/.gitignore for /target/. The crate shipped without one, so a
clean debug build leaves 226 MB / 1087 files of artifacts untracked and one
`git add` away from the history.

Full CI sequence simulated locally from a clean build (rm -rf target): all four
steps pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ath9hAwj37EriRGEDrj9a
@Judge-M
Judge-M force-pushed the p6/rust-conformance-core branch from 6bd91f6 to 2ca5fbb Compare August 5, 2026 10:40
@Judge-M
Judge-M merged commit e692d74 into main Aug 5, 2026
7 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.

2 participants