Skip to content

bch: CashTokens transparency KAT (CHIP-2022-02 transparent-carry pin) - #242

Merged
frstrtr merged 2 commits into
masterfrom
bch/m5-cashtokens-transparency
Jun 20, 2026
Merged

bch: CashTokens transparency KAT (CHIP-2022-02 transparent-carry pin)#242
frstrtr merged 2 commits into
masterfrom
bch/m5-cashtokens-transparency

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner

M5 conform-pass slice. Pins the M1 §4 invariant that the embedded BCH daemon carries CashToken txs unchanged.

The 0xef CHIP-2022-02 token prefix lives inside the CompactSize-length-prefixed TxOut scriptPubKey, so the SHA256d tx serializer treats it as opaque locking bytecode — no token-aware parse, no field rewrite. Until now this was asserted only by comment (transaction.hpp:19-22, template_builder.hpp:11).

Asserts:

  1. token scriptPubKey serializes as <CompactSize len><blob>, len == whole blob (prefix not split out)
  2. 0xef prefix bytes survive verbatim
  3. deserialize -> re-serialize byte-identical (lossless carry into block template)
  4. mutating a prefix byte changes the bytes (bound into tx_id pre-image; tokens not invisible to CTOR/merkle)

Local: built + ran green under COIN_BCH build (ctest #49 PASS, 123-byte tx).

Scope: fenced src/impl/bch/test/ only. p2pool-merged-v36 surface: NONE.

frstrtr added 2 commits June 19, 2026 21:53
Pins the M1 §4 invariant that the embedded daemon carries CashToken txs
unchanged: the 0xef token prefix lives inside the CompactSize-length-prefixed
TxOut scriptPubKey, so the SHA256d serializer treats it as opaque locking
bytecode. Asserts lossless serialize/deserialize round-trip, verbatim byte
survival, <len><blob> framing with no prefix special-casing, and binding into
the tx_id pre-image (tokens not invisible to CTOR/merkle). Closes the test gap
behind the transaction.hpp and template_builder.hpp transparency comments.

Fenced src/impl/bch/test/ only; no p2pool-merged-v36 surface.
The test registers via add_test, so ctest -R "^bch_" runs it, but both
COIN_BCH jobs (x86_64 and ASan) build an explicit target list that omitted
it. ctest then failed to find the unbuilt executable, reding both legs while
the test built+passed green on an incremental local tree. Append the target
after bch_coinbase_kat_bytevector_test in both job lists.

BCH test-list append only; no cross-coin or shared CI logic surface.
@frstrtr
frstrtr merged commit e2d6730 into master Jun 20, 2026
19 checks passed
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