test(ccb): pin the two frozen byte grammars, so "byte-identical" stops being an unchecked claim - #821
Merged
Merged
Conversation
…s being an unchecked claim 2c-B freezes CloseAuthorizationPreimageV1 and DlvSettleOperationPreimageV1 as byte grammars, then states the authority rule: Operation::to_bytes is the CURRENT IMPLEMENTATION of those grammars and is byte-identical to them, it is evidence of the grammar and never the normative authority, and a refactor that changes these bytes changes the protocol and requires an amendment. Nothing enforced that. Both grammars appeared in the tree only inside doc comments, so the claim was untested against live signatures. dlv::close_authorization signs Operation::to_bytes() directly, which means a reordered field, a widened integer or a dropped length prefix would silently invalidate every close signature already produced, with no test going red. Class-1 per 2c-C2 ruling D: the expected bytes are built by a local encoder written from the amendment's field tables, never by calling the encoder under test, so agreement is evidence rather than a tautology. The local primitives mirror 2c-B's, which are deliberately the opposite of CCB's: every 32-byte value is length-prefixed here because these are foreign grammars, not CCB objects. Seven tests: byte equality for both grammars, the cleared-signature encoding the close grammar names explicitly as four zero bytes, a full-length 49,856-byte signature to prove the u32 prefix does not truncate, a decode round trip, and the refusal of a trailing byte. Both grammars were already conformant. The tests record that, they do not repair anything. Two mutation controls executed, restored from a byte copy and verified identical: - swapping owner_devid and owner_genesis in the tag-26 encoder turns dlv_settle_to_bytes_is_byte_identical_to_the_frozen_grammar red, plus three more - changing the close discriminator from 28 to 27 turns dlv_close_to_bytes_is_byte_identical_to_the_frozen_grammar red, while every settle test stays green, which shows the two are scoped apart Scope: this pins the grammar. It does NOT lift the market emission refusal and does not wire 2c-B's G1 through G4 as production gates. Those need a producer that emits a real preimage, which is 5c-2 Step 2/3. dsm: 7/7. make lint green; production safety checks green including TLA+.
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.
The gap
2c-B freezes
CloseAuthorizationPreimageV1andDlvSettleOperationPreimageV1as byte grammars, then states the authority rule:Nothing enforced it. Both grammar names appeared in the tree only inside doc comments.
That matters because
dlv::close_authorizationsignsOperation::to_bytes()directly. A reordered field, a widened integer or a dropped length prefix would silently invalidate every close signature already produced, and no test would go red.What this adds
A class-1 conformance file, per 2c-C2 ruling D: the expected bytes are built by a local encoder written from the amendment's field tables, never by calling the encoder under test. Agreement is therefore evidence rather than a tautology.
The local primitives mirror 2c-B's, which are deliberately the opposite of the canonical encoding's: every 32-byte value is length-prefixed here, because these are foreign grammars carried in a bytes field and not objects in the graph.
Seven tests:
Both grammars were already conformant. These tests record that; they repair nothing.
Mutation controls, executed
Restored from a byte copy each time and verified byte-identical afterwards.
owner_devidandowner_genesisin the tag-26 encoderdlv_settle_to_bytes_is_byte_identical_to_the_frozen_grammarred, plus three moredlv_close_to_bytes_is_byte_identical_to_the_frozen_grammarred, every settle test still greenThe second control also shows the two grammars are scoped apart rather than passing together by accident.
Scope
This pins the grammar. It does not lift the market emission refusal, and it does not wire 2c-B's
G1–G4as production gates. Those need a producer that emits a real preimage, which is 5c-2 Step 2/3. Wiring them now would create a gate no producer can reach.Verification
cargo test --locked -p dsm --test frozen_byte_grammars_conformance— 7 passed, 0 failed.make lintat repo root on pinned 1.98.0 — passed.bash ci/production_safety_checks.sh— all passed, including TLA+.