Repository navigation
conformance: handshake profiles state schema and encoding agreement - #70
Merged
Merged
Conversation
A handshake profile now states two boolean facts, `schema_agreement` and `encoding_agreement`: what the handshake establishes between the two ends. One it leaves out, or states `false`, isn't established, and core makes a protocol using the handshake give it up (`@unverified`, core#147). - New op `handshake_check` (decode only): one end's declaration against the frame its peer sent, accepted when the fingerprint, format and framing agree. Four cases in vectors/handshake.json prove the facts. - `profiles/comline@1.json` states both facts, proven by them, and `profiles_are_proven` and the runner check it. - A fact's value may be a JSON boolean; a fact stated `false` names no cases. - The FFI export, its Rust, C and Node harnesses replay the new cases with `comline_handshake_check`; the reference lists the op. - Spec 0.1 -> 0.2: the case format and profile schema changed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of ComlineProject/core#147: handshake profiles state what a handshake establishes.
Profile schema
ProfileKind::Handshakenow has two facts,schema_agreementandencoding_agreement, with valuestrue/false. They're written as JSON booleans ("value": true);Fact.valuestill holds them as the strings"true"/"false", so the API doesn't change.ProfileKind::states_every_fact), which reads asfalse. A fact statedfalseclaims nothing, so it names no cases (proven_bydefaults to empty).fact_shownshowstruewithhandshake_checkcases: one where the peer agrees, accepted, and for each thing the fact covers a peer frame that differs in only that, refused.schema_agreementcovers the IR hash;encoding_agreementcovers the format and the framing.Vectors
handshake_check(decode only,Op::decode_only): the input is one end's{ir_hash, wire_format, framing, capabilities}, andbytesis the peer'scomline@1frame. It accepts and returns the input when the IR hash, format and framing agree (capability bits may differ), and refuses otherwise.vectors/handshake.jsongainshandshake/check-agree,check-reject-ir-hash,check-reject-formatandcheck-reject-framing. They are byte-exact, generated byreference_cases, and run by the Rust harness. The existing handshake cases only encode or decode a frame and never check one against another, so none of them could prove either fact.profiles/comline@1.jsonis new and states both facts astrue.profiles_are_provennow checks it, and the runner test expects 7 profiles.Spec 0.1 → 0.2. The case format changed (a new op, boolean fact values, optional handshake facts), so
runner::SPEC_VERSIONis now0.2, and the README has a changelog. The ops protocol stays at 1, since the new op is an addition.Other harnesses in this repo
handshake_check ID exact|reject OURS PEER. The Rust (tests/vectors.rs), C and Node harnesses replay it withcomline_handshake_check.comline-referencelists the op, andcore/tests/async_handshake.rs(which readshandshake.jsondirectly) replays the check cases over the async exchange.comline-typescript must re-vendor. Its vendored
vectors/handshake.jsongains fourhandshake_checkcases. Its harness needs to handle that op, which takes about ten lines: encode the input's frame, callcheckByteson the peer bytes, and accept with the input or refuse. If it doesn't, itshandshakeclaim will fail assupported.Local runs:
cargo testfor the workspace,CONFORMANCE_BLESS=1(the vectors andreports/rust.jsonare regenerated), the C harness (static and cdylib), and the Node vectors harness all pass. The ASan build andpoison.test.mjscan't run here because libasan and the test-hooks wasm are missing, so CI covers them.