Skip to content

test(ccb): pin the two frozen byte grammars, so "byte-identical" stops being an unchecked claim - #821

Merged
cryptskii merged 1 commit into
mainfrom
test/pin-the-frozen-byte-grammars
Sep 9, 2026
Merged

test(ccb): pin the two frozen byte grammars, so "byte-identical" stops being an unchecked claim#821
cryptskii merged 1 commit into
mainfrom
test/pin-the-frozen-byte-grammars

Conversation

@cryptskii

Copy link
Copy Markdown
Collaborator

The gap

2c-B freezes CloseAuthorizationPreimageV1 and DlvSettleOperationPreimageV1 as byte grammars, then states the authority rule:

The shipping Operation::to_bytes is the current implementation of these grammars and is byte-identical to them. It is evidence of the byte grammar, never the normative authority. A future refactor that changes these bytes changes the protocol and requires an amendment.

Nothing enforced it. Both grammar names appeared in the tree only inside doc comments.

That matters because dlv::close_authorization signs Operation::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:

  • byte equality against the frozen table for both grammars
  • the cleared-signature encoding the close grammar names explicitly as four zero bytes
  • a full-length 49,856-byte signature, proving the length prefix does not truncate
  • a decode round trip that reproduces the exact bytes
  • refusal of a trailing byte

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.

mutation result
swap owner_devid and owner_genesis in the tag-26 encoder dlv_settle_to_bytes_is_byte_identical_to_the_frozen_grammar red, plus three more
change the close discriminator from 28 to 27 dlv_close_to_bytes_is_byte_identical_to_the_frozen_grammar red, every settle test still green

The 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 G1G4 as 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 lint at repo root on pinned 1.98.0 — passed.
  • bash ci/production_safety_checks.sh — all passed, including TLA+.

…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+.
@cryptskii
cryptskii merged commit c14ece7 into main Sep 9, 2026
19 checks passed
@cryptskii
cryptskii deleted the test/pin-the-frozen-byte-grammars branch September 9, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant