Independent Rust Conformance Engine ===================================== A core tenet of resilient distributed systems is **multi-implementation diversity**. Relying on a single reference implementation risks encoding implementation quirks into the protocol standard. To ensure the Fleetmesh protocol is fully specified and independent of Python runtime behaviors, the `meshctl` binary embeds an **independent, clean-room conformance implementation** written in Rust (`meshctl conform`). Clean-Room Design ----------------- The Rust conformance engine was written entirely from the normative specifications in `docs/`, `schema/`, and `vectors/` without referencing the Python codebase: - If the Rust engine could not implement a mechanism correctly from the documentation and test vectors alone, it was treated as a specification bug and the documentation was revised. - It shares zero code with `fleetmesh_core` or `meshnode`. - CI pipelines execute the automated conformance test suite against the Rust binary on every push, ensuring continuous compliance. The Conformance Wire Protocol ----------------------------- `meshctl conform` speaks a simple line-delimited JSON wire protocol over standard input and standard output, as specified in `docs/conformance.md`: .. code-block:: text Harness (python3 scripts/conform.py) meshctl conform (Rust) ────────────────────────────────── ─────────────────────── {"id": 1, "op": "hello"} ───► ◄─── {"id": 1, "ok": {"implementation": "meshctl 0.1.0 (rust)", "ops": [...]}} {"id": 2, "op": "fingerprint_of", ...} ───► ◄─── {"id": 2, "ok": "f3a2b1..."} Protocol rules: 1. Every line sent to stdin is a JSON object containing an integer ``id`` and an ``op`` name with arguments. 2. For every input line, `meshctl conform` writes exactly one JSON response to stdout with matching ``id`` and either ``{"ok": ...}`` or ``{"error": ...}``. 3. Operations not listed in the initial ``hello`` response are skipped by the test harness and never failed, allowing for honest partial scores across implementation tiers. Implemented Conformance Operations ---------------------------------- `meshctl conform` implements all **111 protocol operations** (523 test cases) across all six conformance planes (`store`, `identity`, `peering`, `lifecycle`, `compute`, and `wire`): Store & Reconciliation Plane ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - **``fingerprint_of`` / ``fingerprint_union``**: Implements NIP-77 set fingerprints using order-independent 32-byte XOR sums combined with count varints. - **``negentropy_encode`` / ``negentropy_reconcile``**: Implements the full Negentropy range-bound set reconciliation protocol for syncing event sets over low bandwidth. - **``store_put`` / ``store_get`` / ``store_range`` / ``blossom_auth`` / ``car_roundtrip`` / ``mst_build``**: Event store deduplication, tag indexing, Blossom BUD-01/BUD-04 authorization, CAR v1 framing, and ATProto Merkle Search Trees. Identity & Cryptography Plane ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - **``did_resolve`` / ``atproto_did`` / ``multikey_encode`` / ``multikey_decode``**: Parses and validates ``did:nostr``, ``did:key``, ``did:peer:2``, ``did:plc``, and ``did:web`` representations across secp256k1, Ed25519, and X25519 keys. - **``nip44_encrypt`` / ``giftwrap_seal`` / ``http_sig_sign`` / ``ssb_shs``**: NIP-44 v2 encryption, NIP-59 gift-wrapping, RFC 9421 HTTP Message Signatures, and SSB Secret Handshake / Box Stream primitives. Peering, Window & Settlement Plane ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - **``window_open`` / ``window_grow`` / ``window_close`` / ``divergence_eval``**: Validates bilateral sliding window boundaries, opening credit limits across tiers (T0 to T3), S0–S4 divergence evaluation, and monotonic receipt chaining. - **``peering_offer`` / ``peering_grant`` / ``paid_fetch_402`` / ``cashu_verify``**: Evaluates bilateral peering offers, blinded Kind 30801 grant commitments, Cashu NUT-18/NUT-24 ecash settlement, and PaidFetch HTTP 402 quotes. Lifecycle, Compute & Wire Planes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - **``node_heartbeat`` / ``coverage_claim`` / ``handover_chain``**: Validates Kind 21801 ephemeral heartbeats, Kind 30803 coverage attestations, and chained first-hand handover proofs. - **``compute_ask`` / ``compute_receipt`` / ``groth16_verify`` / ``dvm_job`` / ``nsite_resolve``**: Validates Kind 30810/30811 compute market envelopes, BN254 Groth16 zero-knowledge proofs, NIP-90 DVM job mappings, and NIP-5A nsite manifests. - **``didcomm_pack`` / ``didcomm_unpack`` / ``ucan_verify``**: Validates DIDComm v2 JWE authcrypt/anoncrypt envelopes and UCAN capability token delegation chains. Running Conformance Verification -------------------------------- To run the complete test suite against `meshctl`: .. code-block:: sh python3 fleetmesh.org/scripts/conform.py -- meshctl conform Example output: .. code-block:: text implementation: meshctl 0.1.0-draft.2 (rust) planes declared: store, identity, peering, lifecycle, compute, wire ops tested: 111 (523 cases) verdict: FULL CONFORMANT (523/523 passed, 0 failed, 0 skipped) all vectors match normative outputs.