smart-byte: envelope wire format, v1 key-event logs, and their conformance vectors #125

Merged
dcharlot merged 3 commits from smart-byte-wire-format into main 2026-10-01 01:04:17 -04:00
Owner

Builds on #99, which this branch includes. Review #99 first.

Before this PR, the conformance pack's envelope-shaped vectors described a draft shape that no longer existed. Nothing pinned key-event logs at all. This PR puts both on the v1 wire format, and fixes everything that building them turned up.

Spec

  • spec/envelope_wire_format.md (new):
    • the envelope's members;
    • what each party signs (attested fields, transitions);
    • the snapshot SAID versus the byte's identity, and the history hash;
    • the cargo registry and controller signatures;
    • the verification procedure, with an error class for each failure;
    • what the cluster decides instead.
  • Identity spec:
    • An inception placeholders i with d.
    • An event has exactly its §3.3 members.
    • Thresholds are 1 to the number of keys, and no key or digest appears twice.
    • Nothing rotates after an empty n.
    • Rotations follow KERI's rule: signed by the keys they reveal, under both the committed threshold and their own. The previous rule ("signed by the previous keys") let anyone holding the current keys rotate.

Code

  • smart-byte-core:
    • wire: canonical CBOR for any serde type. from_slice refuses bytes that are not the decoded object's own encoding. Serde otherwise accepts an array of integers for a byte string, a byte string for text, and an array for a struct, each a second encoding the SAID does not cover.
    • Controller AIDs, and controller signatures checked against key states.
    • The envelope: attested provenance, ownership chain and joule cost.
    • One strict Ed25519 rule.
  • smart-byte-keri-witness:
    • Events are §2 SAIDs over canonical CBOR.
    • The default verifier is spec v1. It replays one event at a time and says which event it refused. It refuses dip, which had skipped the pre-rotation check entirely, along with zero thresholds, duplicate keys, rotations after an empty n, and extension members.
  • Extension mode, fixed too:
    • Witness receipts carried their own key, so anyone could receipt in any witness's name. A witness is now named by its key, and receipts sign everything they claim.
    • Duplicity evidence came from unverified receipts.
    • Recovery accepted any keys; it now needs its witnesses' receipts.
    • OOBIs were signed by an embedded key; they are now controller signatures.
    • Configuration traits were never enforced, so they are gone.
  • Dependents: VC, BBS+, CRDT, mDL, lockstep, libp2p and the CLI move to the new envelope and cargo registry.

Conformance pack (v1, DRAFT, regenerated in place)

  • kel_vectors.json (25 vectors): four accepted logs, and 21 refused for one defect each. The refusals cover takeovers, thresholds, log structure and decoding.
  • envelope_vectors.json (18 vectors): three accepted bytes, including a chain of transfers spanning a rotation, and 15 refusals. They are checked against the key states the logs establish.
  • SAID and signature vectors rebuilt on the real objects. The files describe one world: the SAID vectors' objects are the envelopes and events, and sig-001/002 are signatures that appear in them.
  • verify_v1.py replays logs and verifies envelopes independently, written from the spec text, standard library only.

Falsified

  • Rust checker: 28 planted defects, each caught on its own vector. A defect in a log fails that log and every envelope relying on it.
  • Python checker: 20 plants caught the same way, with and without -O.
  • Python rules: 30 rule mutations, each caught by the vector built for it.
  • Rust rules: 12 rules mutated one at a time. Each mutant compiles and fails named tests, and 11 of the 12 break pack generation itself. The twelfth, the zero-threshold floor, is held by a unit test; no valid log can produce a zero threshold.

cargo test --workspace passes, as does verify_v1.py (94 vectors, pack complete).

Still open

How a node serializes its post-frame state hash is unpinned; the lockstep vectors treat state hashes as opaque.

🤖 Generated with Claude Code

Builds on #99, which this branch includes. Review #99 first. Before this PR, the conformance pack's envelope-shaped vectors described a draft shape that no longer existed. Nothing pinned key-event logs at all. This PR puts both on the v1 wire format, and fixes everything that building them turned up. ## Spec - **`spec/envelope_wire_format.md` (new):** - the envelope's members; - what each party signs (attested fields, transitions); - the snapshot SAID versus the byte's identity, and the history hash; - the cargo registry and controller signatures; - the verification procedure, with an error class for each failure; - what the cluster decides instead. - **Identity spec:** - An inception placeholders `i` with `d`. - An event has exactly its §3.3 members. - Thresholds are 1 to the number of keys, and no key or digest appears twice. - Nothing rotates after an empty `n`. - Rotations follow KERI's rule: signed by the keys they reveal, under both the committed threshold and their own. The previous rule ("signed by the previous keys") let anyone holding the current keys rotate. ## Code - **`smart-byte-core`:** - **`wire`:** canonical CBOR for any serde type. `from_slice` refuses bytes that are not the decoded object's own encoding. Serde otherwise accepts an array of integers for a byte string, a byte string for text, and an array for a struct, each a second encoding the SAID does not cover. - Controller AIDs, and controller signatures checked against key states. - The envelope: attested provenance, ownership chain and joule cost. - One strict Ed25519 rule. - **`smart-byte-keri-witness`:** - Events are §2 SAIDs over canonical CBOR. - The default verifier is spec v1. It replays one event at a time and says which event it refused. It refuses `dip`, which had skipped the pre-rotation check entirely, along with zero thresholds, duplicate keys, rotations after an empty `n`, and extension members. - **Extension mode, fixed too:** - Witness receipts carried their own key, so anyone could receipt in any witness's name. A witness is now named by its key, and receipts sign everything they claim. - Duplicity evidence came from unverified receipts. - Recovery accepted any keys; it now needs its witnesses' receipts. - OOBIs were signed by an embedded key; they are now controller signatures. - Configuration traits were never enforced, so they are gone. - **Dependents:** VC, BBS+, CRDT, mDL, lockstep, libp2p and the CLI move to the new envelope and cargo registry. ## Conformance pack (v1, DRAFT, regenerated in place) - **`kel_vectors.json`** (25 vectors): four accepted logs, and 21 refused for one defect each. The refusals cover takeovers, thresholds, log structure and decoding. - **`envelope_vectors.json`** (18 vectors): three accepted bytes, including a chain of transfers spanning a rotation, and 15 refusals. They are checked against the key states the logs establish. - **SAID and signature vectors rebuilt on the real objects.** The files describe one world: the SAID vectors' objects are the envelopes and events, and sig-001/002 are signatures that appear in them. - **`verify_v1.py`** replays logs and verifies envelopes independently, written from the spec text, standard library only. ## Falsified - **Rust checker:** 28 planted defects, each caught on its own vector. A defect in a log fails that log and every envelope relying on it. - **Python checker:** 20 plants caught the same way, with and without `-O`. - **Python rules:** 30 rule mutations, each caught by the vector built for it. - **Rust rules:** 12 rules mutated one at a time. Each mutant compiles and fails named tests, and 11 of the 12 break pack generation itself. The twelfth, the zero-threshold floor, is held by a unit test; no valid log can produce a zero threshold. `cargo test --workspace` passes, as does `verify_v1.py` (94 vectors, pack complete). ## Still open How a node serializes its post-frame state hash is unpinned; the lockstep vectors treat state hashes as opaque. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
envelope_wire_format.md is new. It fixes what the treatise leaves open: the
envelope's members, what the issuer and each owner sign, the snapshot SAID
and the byte's identity, the history hash, the cargo registry, controller
signatures, and verification with an error class for each failure. It also
says which questions the cluster answers instead.

The identity spec now says:
- an inception placeholders `i` with `d`;
- an event has exactly its §3.3 members;
- thresholds run from 1 to the key count, with no key or digest listed twice;
- nothing rotates after an empty `n`;
- `dip` is not a v1 type.

Rotations follow KERI's rule: signed by the keys they reveal, under both the
committed threshold and their own. The previous rule, "signed by the previous
keys", let anyone holding the current keys rotate the controller away.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
smart-byte-core
- `wire`: canonical CBOR for any serde type. `from_slice` refuses bytes that
  are not the decoded object's own encoding. Serde otherwise accepts an array
  of integers for a byte string, a byte string for text, and an array for a
  struct, each a second encoding the SAID does not cover.
- Controller AIDs. Controller signatures are checked against the key states
  replayed logs establish. One strict Ed25519 rule.
- The envelope: attested provenance, ownership chain and joule cost. Cargo
  carries a registered type tag.

smart-byte-keri-witness
- Events are §2 SAIDs over canonical CBOR.
- The default verifier is spec v1. It replays one event at a time and says
  which event it refused. It refuses `dip`, which skipped the pre-rotation
  check entirely, plus zero thresholds, duplicate keys, rotations after an
  empty `n`, and extension members.
- Extension mode, fixed:
  - Witness receipts carried their own key, so anyone could receipt in any
    witness's name. Witnesses are now named by their keys, and receipts sign
    everything they claim.
  - Duplicity evidence was gathered from unverified receipts.
  - Recovery accepted any keys; it now needs its witnesses' receipts.
  - OOBIs were signed by an embedded key; they are now controller signatures.
  - Configuration traits were never enforced, so they are gone.

VC, BBS+, CRDT, mDL, lockstep, libp2p and the CLI move to the new envelope.

smart-byte-conformance
- kel_vectors.json: 25 vectors.
- envelope_vectors.json: 18 vectors, checked against the logs' key states.
- The SAID and signature vectors are rebuilt on the real objects, so all the
  files describe one set of parties.
- Planted defects in every file are caught on their own vectors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
smart-byte conformance: the second implementation replays logs and envelopes
All checks were successful
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 1m42s
standards workspaces build + test / aac-rs (pull_request) Successful in 46s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 39s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 38s
standards workspaces build + test / map-rs (pull_request) Successful in 32s
standards workspaces build + test / mesh-rs (pull_request) Successful in 23s
standards workspaces build + test / openpay (pull_request) Successful in 1m25s
smart-byte conformance gate / Validate conformance JSON files (pull_request) Successful in 4s
smart-byte conformance gate / Second implementation reproduces every vector (pull_request) Successful in 3s
smart-byte conformance gate / Spec changes require vector-pack updates (pull_request) Successful in 3s
smart-byte conformance gate / VERSIONS.md and README.md must exist (pull_request) Successful in 3s
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 3s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m48s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m16s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m11s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m6s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 2m51s
standards workspaces build + test / arl-rs (pull_request) Successful in 2m11s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 3m1s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 2m48s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 2m58s
standards workspaces build + test / sense-rs (pull_request) Successful in 2m34s
standards workspaces build + test / macOS energy backend (jcp-energy) (pull_request) Successful in 2m11s
84effb86f1
verify_v1.py now replays key-event logs (identity spec §3, §4) and verifies
envelopes (envelope wire format §8). It is written from the spec text, uses
the standard library only, and implements its own BLAKE3 and Ed25519. It
reproduces all 94 vectors and finds the pack complete.

Falsified:
- 20 planted defects, each caught on its own vector, with and without -O.
- 30 rule mutations, each caught by the vector built for it.

regeneration.md records the regeneration and what building it found;
VERSIONS.md names the new spec.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dcharlot changed target branch from ci/smart-byte-pack to main 2026-10-01 01:03:59 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!125
No description provided.