open-standards/joule-code/conformance/v1/regeneration.md
David Charlot e40bf51b53 joule-code: regenerate v1 conformance vectors with real cryptography
Completes the v0.1 conformance suite — no more placeholders. gen-vectors now
computes every derived field via the reference crates, and the verify harness
checks them all for real (the 7 prior SKIPs are gone).

- gen-vectors computes and prints real op_ids (BLAKE3 over canonical CBOR) and
  real Ed25519 signatures (op-binding op_id‖prior; receipt
  estimated_uj‖sequence‖nonce[‖measured_uj]).
- coding_op / signature / receipt vectors filled with the computed values; the
  negatives keep their hand-authored tamper (reused signature, different prior,
  mismatched op_id) and expected false/error.
- verify harness upgraded: C2 op-binding signature verification (positive +
  replay/tamper negatives) and C3 receipt signature verification (reconstruct
  the Receipt, verify against the endpoint key) now run for real.
- conformance/v1/README + regeneration.md updated; vanity scanner clean.

Result: cargo run -p joule-code-conformance -- verify ../conformance/v1 passes
the whole pack with no skipped vectors; cargo test --workspace green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-03 03:43:38 -04:00

26 lines
1.8 KiB
Markdown

# Regenerating v1 Conformance Vectors
The content-address and signature fields in this pack are **values generated by the Rust reference implementation**. This file documents how to re-derive them if a vector's inputs change.
## Status: all fields are real
Every derived field in this pack has been computed by `gen-vectors` and verified by the harness (all vectors pass, none skipped). There are no placeholders. This section documents how to re-derive them if an input changes.
- The Ed25519 known-answer cases in `signature_vectors.json` use RFC 8032 test-vector keys and exercise the signature primitive directly.
- Every `op_id` is BLAKE3-256 over the canonical CBOR of its `CodingOp`; every op-binding and receipt signature is a genuine Ed25519 signature over the spec's preimage (`op_id ‖ prior` for ops; `estimated_uj ‖ sequence ‖ nonce [‖ measured_uj]` for receipts), produced by the reference library.
## Prerequisites
- Rust toolchain pinned by [`../../../rust-toolchain.toml`](../../../rust-toolchain.toml).
- The `joule-code-rs` workspace in [`../../joule-code-rs/`](../../joule-code-rs/).
## Procedure
```bash
# from open-standards/joule-code/joule-code-rs
cargo run -p joule-code-conformance --bin gen-vectors
```
`gen-vectors` builds each vector's `CodingOp`/`Receipt` from the human-authored inputs (keys, prior, edits, energy figures) and prints the derived fields — every `op_id` and signature — via the reference crates. Paste the printed values into the corresponding `expected_*` / `signature` fields of the vector JSON. The negative vectors keep their hand-authored tamper (a reused signature, a different `prior`, a mismatched `op_id`) and the expected `false`/error.
After updating, `cargo run -p joule-code-conformance -- verify ../conformance/v1` MUST pass with no skipped vectors, and the diff MUST touch only derived fields.