Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Golden test vectors: every implementation's CI must decode each vector's `wire_hex` to its `message` and re-encode `message` back to exactly `wire_hex`. This is the actual forcing function against drift between implementations -- a schema alone never proves interop, only shared vectors do, the same lesson Cascade's own `docs/conformance/*.v1.json` was built to enforce for its XDR-based protocol.

`mint.v1.json` covers the minting of capability tokens, revocation entries and room notices (see below). `handshake.v1.json` covers `handshake-frame`. `tokens.v1.json` covers `capability-token` (including a delegation chain, one token's `parent` pointing at another) and `handle-record`. `frames.v1.json` covers every other `$frame-variant` in `spec/frame.cddl`. `adverts.v1.json` covers `peer-advert` on its own. `secure-channel.v1.json` covers the secure channel's hellos and sealed frames and the cryptography around them. `invalid-frames.v1.json` covers frames a decoder must refuse. `coordinator-election.v1.json` covers the gossiped coordinator claims and the outcome of sequences of them. `data-sync.v1.json` covers the core/data have, request and entries exchange over a key-value store. `file-storage.v1.json` covers the on-disk layout of the file-backed key-value store. `room-params.v1.json` covers the typed core/room and capability verbs and the room-path and hex helpers. `introspection.v1.json` covers core/management's `path:trace` and `topology.get` and the topology they report.
`mint.v1.json` covers the minting of capability tokens, revocation entries and room notices (see below). `handshake.v1.json` covers `handshake-frame`. `tokens.v1.json` covers `capability-token` (including a delegation chain, one token's `parent` pointing at another) and `handle-record`. `frames.v1.json` covers every other `$frame-variant` in `spec/frame.cddl`. `adverts.v1.json` covers `peer-advert` on its own. `secure-channel.v1.json` covers the secure channel's hellos and sealed frames and the cryptography around them. `invalid-frames.v1.json` covers frames a decoder must refuse. `coordinator-election.v1.json` covers the gossiped coordinator claims and the outcome of sequences of them. `data-sync.v1.json` covers the core/data have, request and entries exchange over a key-value store. `file-storage.v1.json` covers the on-disk layout of the file-backed key-value store. `gossip-directory.v1.json` covers what a session does with the gossip it receives and sends. `room-params.v1.json` covers the typed core/room and capability verbs and the room-path and hex helpers. `introspection.v1.json` covers core/management's `path:trace` and `topology.get` and the topology they report.

`invalid-frames.v1.json` holds values outside the grammar of the spec's `.regexp` patterns, which match the whole string: a capability verb with two colons, a trailing space or newline or a leading hyphen, a domain with trailing text, a trailing newline or an embedded separator, and the three verb fields of token claims (`capability`, `grants-capability`, `requests-capability`). Each vector is well-formed CBOR in the shape of a valid frame (`kind: "frame"`) or token-claims map (`kind: "token-claims"`) with exactly one such value, so a conformant decoder refuses it at decoding or at validation. It carries `refused: true`, the rule it breaks in `pattern`, and `valid_control_wire_hex`, the same bytes with a value inside the grammar, which every consumer must accept, so a vector cannot be refused for any other reason than its pattern. `message` and `wire_hex` follow the shared round-trip contract, so the round-trip suites read it like any other file. The TypeScript core's conformance test and `rust/crates/wire-mesh-conformance` both check the refusal and the control. The same invalid capability verbs are sealed in `secure-channel.v1.json` (`undecodable_invalid_*capability_verb_*`), where the frame authenticates, is refused as `undecodable` and consumes its counter. The room-path and device-id-hex patterns occur only in room-notice claims; the implementations' own schema and parser tests pin them, edge by edge.

Expand Down Expand Up @@ -91,6 +91,18 @@ The outcomes are written by hand from the spec, never produced by an implementat

The outcomes are written by hand from the spec, never produced by an implementation. Device-ids, keys and signatures are structural bytes and the adverts are not verified. The TypeScript core's `conformance-introspection.unit.test.ts` and `rust/crates/wire-mesh-conformance` run them.

## gossip-directory.v1.json

`gossip-directory.v1.json` pins what a session does with the gossip it receives and sends. Its top-level `vectors` are the gossip frames the scenarios deliver. The adverts are really signed, with the Ed25519 keys under `identities` (fixed secrets, so every run writes the same bytes). The `gossip_directory` section holds:

- `identities`: the keys the adverts are signed with, each with its secret, public key and device id; `me` is the node the scenarios run as.
- `extension_validation`: key bags a gossip update may carry, each accepted or refused for one named reason (`reserved_field`, `session_managed`, `reserved_version`, `not_domain_qualified`), naming the first key refused.
- `directory_scenarios`: gossip frames delivered in order. Each step gives what became of every advert in it (`admitted`, `older`, or the reason it was refused: `wrong_device`, `bad_signature`) and the directory held afterwards, as the device and snapshot time of each entry in first-heard order. A scenario with `rust_only` pins a bound only the Rust session applies (the advert size cap): the TypeScript runner skips it. The TypeScript session reports no per-advert outcome, so its runner compares the directory only.
- `self_adverts`: the advert a session builds for a given clock and extension bag: its device, addresses, `snapshot-seconds`, the sorted keys of its open tail (the extensions, `topology/peers` and `wire-mesh/version`) and its topology. Each is signed by `me` and verifies. The version's value is not pinned, since it is each implementation's own.
- `counts`: the number of entries in each list, which both runners check.

The outcomes are written by hand from the rules of the session, never produced by an implementation. The TypeScript core's `conformance-gossip-directory.unit.test.ts` and `rust/crates/wire-mesh-conformance` run them.

`verify.unit.test.ts` checks only the round trip every vector file shares: this package holds no protocol implementation of its own, so `signing_input_hex`, `verifies` and the `secure_channel` section are checked by the implementations. `ts/packages/core`'s own conformance tests check them for the TypeScript. The Rust binary checks every file: the round trip of each, `adverts.v1.json`'s extra fields, and `secure-channel.v1.json`'s `secure_channel` section, which it recomputes from the fixed inputs and runs step by step against `wire_mesh_core::domain::secure_channel` (the intermediate keys, every sealed ciphertext, every verdict and every open step with its expected class), failing on any field of the section it does not read.

## Regenerating
Expand Down
Loading