smart-byte: generate the conformance pack from the reference implementation #99
Loading…
Reference in a new issue
No description provided.
Delete branch "ci/smart-byte-pack"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
smart-byte/conformance/v1was placeholder filler that the spec said implementers MUST pass. The reference crate didn't implement the spec's SAIDs, so there was nothing correct to generate the pack from. This PR builds that implementation and generates the pack from it.What's built
smart-byte-core:Envelope::from_cbor, which accepts only an envelope's own encoding.smart-byte-lockstep: the §13.1 threshold, §13.3 outcomes and §14.1 dissent log, computed per node from its own view, so the §13.4 transport liar commits while its peers log it.Cluster::stepkeeps the dissent log.smart-byte-libp2p: gossip is validated before it is forwarded. Before this PR, a forged or byte-padded envelope crossed every honest node, and a fetch could be answered with any envelope. A three-node test pins the fix, and it fails when either check is removed.smart-byte-keri-witness: the verifier rejectsrecby default, as spec v1 requires.smart-byte-conformance: providesgen-conformance-vectorsandverify-conformance-vectors. Itscargo testrequires the published pack to equal the generator's output byte for byte, verifies every vector, checks the pack is complete, and plants 19 defects to prove the verifier catches each one.conformance/crosscheck/verify_v1.py: a second implementation in standard-library Python, with BLAKE3 and Ed25519 tested against known answers first. The conformance gate runs it.The pack
51 vectors:
Both checkers fail a pack that is empty, lacks a vector the spec cites, or uses an error class the README doesn't list.
Spec
Verification
smart-byte-rsworkspace.python -O.Next, in a follow-up: envelope and key-event-log identifiers move to §2 SAIDs, under an envelope wire-format spec.
🤖 Generated with Claude Code
d92626d08623ceabf08esmart-byte: verify what the pack really contains, and pin what it does notto smart-byte: the pack is placeholders, and the spec mandates a suite that does not exist23ceabf08e0acb0cc57f0acb0cc57f5391e895d5The v1 pack was filler. Its SAIDs were runs of one repeated character, every `canonical_cbor_hex` was the same 7-byte stub, and its signatures were RFC 8032 test signatures over the empty message. All five canonicalisation encodings were wrong; two were odd-length hex that could not be decoded at all. The gate only ran `jq` over it, and the spec said implementers MUST pass it. Now every value is computed, and checked twice: - New crate `smart-byte-conformance`. It is the `gen-conformance-vectors` / `verify-conformance-vectors` pair that regeneration.md always promised and that never existed. The generator computes every expected value with smart-byte-core and smart-byte-lockstep, and fails if a negative vector is refused for any reason other than the one it names. Its `cargo test` (run by standards-build on every push) checks: * every published vector verifies; * the published files equal the generator's output byte for byte; * a defect planted in each file is caught on the vector it was planted in; * identity spec §2.4 prints the worked example's real values. - `conformance/crosscheck/verify_v1.py`: a second implementation, in Python, stdlib only, with BLAKE3 and Ed25519 written from their specs and checked against known answers first. It reproduces all 47 vectors, and the conformance gate now runs it. The pack now tests what the spec says: - canonicalisation: each §2.3 rule, accepted and refused (19 vectors). - SAIDs: the suite §2.5 names, which the pack never contained — the empty-map case, the one-field case, the worked example, five envelope-shaped objects, and two adversarial non-canonical encodings (one aimed at re-encoding verifiers, one at verifiers that hash bytes as received). - signatures: over real SAIDs, plus a non-canonical S. - lockstep: §13.3 outcomes and §14.1 dissent entries. - gossip: content-addressed intake. Vectors that contradicted the spec are corrected: - canon-004 encoded floats, which §2.3 forbids; - lockstep-003 logged dissent on a frame that never committed; - gossip-002 settled a "collision" by arrival order; - gossip-003 asserted backfill limits no spec defines. regeneration.md records each change and why the draft pack was regenerated in place, not by supersession. Spec: §2.4 printed an invented digest and SAID, and miscounted the encoding as 62 bytes (it is 61); it now prints the real values. §2.5 names the vectors. §6 pointed at modules that did not exist, and now says where each part lives — including that the key-event log does not derive §2 SAIDs yet. Replaces this branch's placeholder pins in smart-byte-core/tests/pack.rs, which were written to fail once the pack was regenerated, with the assertions they asked for. Co-Authored-By: Claude Opus 5.5 <[email protected]>smart-byte: the pack is placeholders, and the spec mandates a suite that does not existto smart-byte: generate the conformance pack from the reference implementationrecby default, as spec v1 requires b7df79083a