Node: a U+2028/U+2029 character in a DAO statechain op value splits the governance chain — Python compact_json leaves the separators raw, Go re-marshal escapes them, and every peer rejects the signed
Report
Claim
The Python and Go statechain encoders disagree on exactly two characters, and the disagreement executes as a governance-chain split. Python compact_json (desk xe/statechain.py, byte-identical in dao) — the function the DAO uses to build op values — dumps with ensure_ascii=False and replaces only <, > and &, so U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are emitted as raw UTF-8. Go's encoding/json escapes both characters even inside json.RawMessage. The shipped wire test (test_xe_wire.py::test_compact_json_matches_go_rawmessage) asserts the two encoders match on a single <b>& value and never tests these separators — the invariant it claims is false.
Sequence (all real code, proof below):
- A DAO signing session builds a block whose
dao.*op value contains U+2028 (or U+2029) — e.g. pasted free text.compact_jsonleaves the character raw (E2 80 A8/E2 80 A9); the block is hashed and threshold-signed (2-of-3) over those bytes and submitted viato_wire(), which splices the value verbatim. Nothing inStateOp.validaterejects the character (key shape, ≤65536-byte size and JSON validity are all it checks). - The receiving node's
AddBlockverifies the hash over the exact wire bytes (op.Valueis ajson.RawMessage;MarshalCanonicalhashes it verbatim) — the node accepts and applies the block: tip advances, KV set. - That node propagates the block. Gossip (
StateChainGossip.Publish,json.Marshal) and statechain sync (json.NewEncoder(...).Encode(...)) both use Go's encoder with HTML escaping on, which rewrites the raw separator to the six ASCII bytes\u2028/\u2029. Every peer'sRawMessagenow differs from the signed bytes,VerifyBlockHashfails with "hash mismatch", andhandleStateChainonly logs the rejection — resync happens solely onErrGap, so nothing heals the drop, on either propagation leg. - The DAO's own tooling never sees the break: Python
StateBlock.from_jsonre-compacts throughcompact_json, normalizing the escaped form back to raw bytes, so a Python re-hash of the gossiped block still matches. The submitting side reports success while the network has split.
The divergence runs in both directions (also proven): a Go-built block whose value bytes carry the escaped \u2028 hashes over the escaped bytes, while Python's from_json + hash_state_block re-hashes over raw bytes and mismatches.
Conceded up front: the trigger requires a DAO-premise signed block, and the realistic vector is an operator pasting invisible text, not an outside attacker — see Bounds. The claim is Medium; a triager could reasonably assess Minor on the operator-premise ground, and that downgrade risk is priced into this report rather than hidden.
Code (repos/desk @32fd760, repos/dao @be43d38, repos/xe @9787859, as shipped)
desk/xe/statechain.py:41-44compact_json(=dao/xe/statechain.py, byte-identical — verified withcmp):json.dumps(value, separators=(",", ":"), ensure_ascii=False, sort_keys=False)followed by only three replacements (<→\u003c,>→\u003e,&→\u0026). U+2028/U+2029 pass through as raw UTF-8.- Go
encoding/json(defaultMarshal/NewEncoder, HTML escaping on) escapes<,>,&and U+2028/U+2029, including insidejson.RawMessagevalues. xe/statechain/encoding.goMarshalCanonical: writes[]byte(op.Value)verbatim into the hash input;xe/statechain/crypto.goVerifyBlockHashrecomputes and fails with "hash mismatch";xe/statechain/chain.go:106AddBlockverifies the hash before anything else. No normalization exists anywhere between wire bytes and hash.xe/node/node.go:2289SubmitStateChainBlock:AddBlockthenStateChainGossip.Publish— the apply is unconditional.:2237handleStateChain: on error it only logs; resync is triggered only forErrGap.xe/net/gossip.goStateChainGossip.Publish:json.Marshal(msg).xe/statechain/sync.go: blocks are sent withjson.NewEncoder(s).Encode(...)— the same escaping encoder, so sync carries the same break.- Production trigger path:
dao/dao/services/sessions.pynormalise_ops→ values re-compacted viacompact_json→build_block→ thresholdsign→xe/client.pysubmit_statechain_block→StateBlock.to_wire()(value spliced verbatim). Session values are operator JSON fordao.*keys and may carry free text;StateOp.validate(deskxe/statechain.py:77-91) checks key shape, value size and JSON validity only.
Reproduced?
Yes — executed end-to-end on the real code on both sides, locally, with identical results across four independent harness executions (the finding lane's run, two full clean-scratch gate re-runs of the whole pipeline, and two runs of the packaged PoC; full transcripts in the attached run-evidence). Real Python xe.statechain (desk-venv), real Go statechain.Chain over an in-memory store, own DAO keys, threshold 2-of-3, genesis tip 0183ecef…:
- Stage A:
compact_json({"note": "a\u2028b"})emits the raw bytesE2 80 A8(not\u2028); U+2029 emitsE2 80 A9. The<b>&control compacts to\u003c/\u003e/\u0026exactly as the shipped test asserts. - Cross-language agreement: with the real genesis tip as prev_hash, Python
hash_state_blockequals GoHashBlockon all four values (plain,<b>&, U+2028, U+2029 — 4/4), so the canonical layout agrees and the divergence is purely the value-byte escaping. - Go harness, 16/16 PASS every run: for each value, a DAO-threshold-signed block whose op value bytes are exactly the Python
compact_jsonoutput, on keydao.registry:- plain and
<b>&controls:AddBlockACCEPTED on the submitting chain (KV applied) and ACCEPTED on a fresh peer chain after thejson.Marshal→json.Unmarshalround-trip. - U+2028:
AddBlockACCEPTED on the submitting chain, KV applied; the round-tripped block is REJECTED "hash mismatch" on the peer — KV absent, peer tip still genesis. Wire value bytes after marshal:{"note":"a\u2028b"}(escaped) vs the signed raw bytes. - U+2029: identical result.
- plain and
- Reverse direction: a Go-built block (value bytes
{"note":"a\u2028b"}as Go marshals them) hashes to0598c752…over the escaped bytes; PythonStateBlock.from_json+hash_state_blockover the same wire block gives6487e5c7…— mismatch. - Negative control: Python re-hashing a DAO-originated gossiped block still matches (re-compaction normalizes escaped → raw) — which is why the DAO's tooling reports success while Go peers reject; this is part of the finding, not a contradiction.
Impact A single invisible character in one DAO session op value produces a governance-chain split that the protocol cannot heal: the submitting node applies a threshold-signed block that no other node will ever accept, by gossip or by sync, so statechain tips diverge and the applied KV value is live on exactly one node and absent everywhere else. Unlike a restart-gated partition, this fork is permanent until manual intervention — follow-on governance built on the submitting node's tip inherits the poisoned ancestry and is likewise rejected by peers (prev-hash/fork mismatch), so governance stalls until an operator notices the split, points the DAO at a healthy node, and resets the diverged node's statechain store. Account-chain funds, balances and signatures are untouched: the block is threshold-signed and valid, only its propagation encoding differs, and no unauthorized state change occurs.
Bounds (honest)
- Actor/premise: a DAO signing session (2-of-3 keyset holders) whose op value contains U+2028 or U+2029. No outside attacker can inject the character — session creation is seat-signed and values are operator JSON. The realistic trigger is accidental (pasted text carrying an invisible separator), not adversarial; a hostile DAO insider gains nothing here beyond what threshold signing already grants. This premise, and the resulting Minor-downgrade risk, are the honest ceiling on the claim: we do not expect High.
- Reachability of free text in
dao.*values was code-traced, not executed through the DAO HTTP session API:sessions.create→normalise_ops→compact_jsonis the production path and the harness executes exactly that function plus the real Go chain, but no live DAO session was created and nothing was submitted to a live node. If the DAO in practice only writes structured values with no free-text field, the trigger narrows to operator-supplied strings in registry/descriptive values — still reachable through the same API, but rarer. - Scope of the executed split: one block at one index on two fresh chains. The gossip leg is executed as marshal → unmarshal →
AddBlock(byte-for-byte whatPublishand the sync encoder emit); the libp2p transport itself was not run — it carries the marshalled bytes verbatim and the failure is in the bytes, not the transport. The follow-on governance stall is code-traced fromAddBlock's prev-hash/fork checks, not executed as a second block. Recovery (reset + resync) is assessed from the code paths, not measured.
Already known?
No. Deduped against the 143-ticket desk corpus, the 135 GitHub issues, the shared register and our own filed reports, and re-checked first-hand at gate review (2026-11-04): a corpus grep for 2028 / 2029 / compact_json returns 0 hits.
- XE-0031 (accepted High) is the opposite direction: the statechain gossip validator accepts too easily (a dummy hash with a non-empty signature list is forwarded, starving propagation). This finding is peers rejecting a valid, threshold-signed block; fixing XE-0031 (verify in the validator) does not close the byte divergence.
- Our filed CT-9 (XE-0422) is a DAO block rewriting
sys.network_id— a different op/key and a handshake-identity effect (a restart-gated transient partition), not an encoding/propagation split. - XE-0060 (accepted Minor): delete-op value bytes are ignored in hashing — a different canonicalization quirk on the delete path, with no propagation effect.
- DEEP-2 / XE-0010 are sync-path acceptance divergences on the account chain — different chain, different mechanism.
- One internal note, disclosed: our own sweep ledger (LEDGER-C, D5 note (d), 2026-11-04) earlier recorded that U+2028/U+2029 "round-trip identically". That note was wrong for the production function — it tested default
json.dumps(which escapes all non-ASCII) and thefrom_jsonre-hash path, nevercompact_jsonitself on the gossip/sync re-marshal leg where the break executes. This report supersedes that note with executed proof; it was an internal working note, never a ticket.
Fix (suggested)
Make Python compact_json match Go's encoder exactly: after the </>/& replacements, also replace U+2028 → \u2028 and U+2029 → \u2029. That single change closes both directions: DAO-built blocks then carry the escaped bytes Go re-marshal preserves, and Python re-hashes of Go-built blocks match. Defence in depth: reject (or normalize with a warning) U+2028/U+2029 in StateOp.validate, and add regression tests to test_xe_wire.py asserting compact_json on U+2028/U+2029 values plus a gossip round-trip test (submit → marshal → unmarshal → verify hash) for a block carrying each. A Go-side alternative (marshal gossip/sync with HTML escaping off) is NOT recommended on its own: it would change the wire bytes of every </&-bearing value already in flight, and it is not the side whose encoder the Python code claims to match.
Thread
DEEP-9 run evidence (lane + AiSOC verification + hostile gate, 2026-11-04). All runs local, no network, no live host touched. Pinned trees: repos/desk @32fd760, repos/dao @be43d38, repos/xe @9787859 — git-clean before and after every run (the Go harness runs as a scratch module with a replace directive to the pinned checkout, which is never written).
Mechanism in one paragraph: Python compact_json (desk xe/statechain.py, byte-identical in dao) dumps with ensure_ascii=False and replaces only <, >, &, so U+2028/U+2029 leave as raw UTF-8. Go hashes op.Value verbatim, so the submitting node accepts a DAO-signed block carrying those raw bytes — but gossip (json.Marshal) and sync (json.NewEncoder) re-marshal with HTML escaping on, rewriting the separator to \u2028/\u2029, and every peer's VerifyBlockHash then fails: hash mismatch, silent drop, no resync (only ErrGap resyncs). The block exists on exactly one node.
Gate re-runs (clean scratch, twice, end-to-end, identical in every check line and hash): Stage A: plain compact='{"note":"plain text"}' hash=1b0656e5… · html compact='{"note":"a\u003cb\u003e\u0026c"}' hash=9d3a4f8f… · sep compact carries raw U+2028 (bytes E2 80 A8) hash=6487e5c7… · para carries raw U+2029 (bytes E2 80 A9) hash=574815bc… Go harness — RESULT pass=16 fail=0 (both runs): GENESIS_TIP 0183ecef80b02149d85dc69762d1663257cdc677453ab6385c24092b9d6a8796 plain: submit-leg ACCEPTED · KV applied chain1 · gossip-leg ACCEPTED (control) html: submit-leg ACCEPTED · KV applied chain1 · gossip-leg ACCEPTED (control) sep: submit-leg ACCEPTED · KV applied chain1 · gossip-leg REJECTED (hash mismatch) · KV NOT applied chain2 · chain2 tip still genesis · wire-value-bytes="{"note":"a\u2028b"}" para: submit-leg ACCEPTED · KV applied chain1 · gossip-leg REJECTED (hash mismatch) · KV NOT applied chain2 · chain2 tip still genesis · wire-value-bytes="{"note":"a\u2029b"}" CASE hashes: plain 81bfad95… · html 0f555397… · sep a644090d… · para 5f411c50… Stage A2: Python hash_state_block with the real genesis prev_hash equals the Go HashBlock on all four values (4/4) — the canonical layout agrees; only the value-byte escaping diverges. Stage B: Python re-hash of the gossiped sep/para blocks MATCHES the original hash — from_json re-compacts escaped→raw, so DAO-side tooling sees no break (the blindness is part of the finding). Stage B-reverse: Go-originated hash over escaped bytes 0598c752… vs Python rehash over raw bytes 6487e5c7… — mismatch. The divergence runs in both directions.
Packaged PoC (attached: poc_deep9_statechain_split.go): the Go harness with the four stage-A compact_json outputs embedded verbatim. Run from its own scratch module (go.mod: require github.com/xeprotocol/xe v0.0.0 + replace github.com/xeprotocol/xe => <path to repos/xe>), Go 1.25.0, GOPROXY=off: go run poc_deep9_statechain_split.go → RESULT pass=16 fail=0. Executed twice at gate: 16/16 both runs, transcripts byte-identical, genesis tip and CASE hashes identical to the full pipeline runs.
Code verification (first-hand at gate): desk/xe/statechain.py:41-44 compact_json (ensure_ascii=False, replacements only for <, >, &; cmp vs dao copy byte-identical); StateOp.validate (:77-91) checks key shape, size, JSON validity only — no U+2028/U+2029 rejection; dao sessions.py normalise_ops (:39) is the production path re-compacting session values through compact_json; desk/tests/test_xe_wire.py:106-107 asserts only one <b>& value; xe/statechain/encoding.go MarshalCanonical writes []byte(op.Value) verbatim; crypto.go VerifyBlockHash → "hash mismatch"; chain.go:106 AddBlock verifies hash first; net/gossip.go Publish = json.Marshal; statechain/sync.go = json.NewEncoder Encode; node.go:2289 SubmitStateChainBlock = AddBlock then Publish; node.go:2237 handleStateChain logs errors, resyncing solely on ErrGap.
Dedup (re-checked first-hand at gate): corpus grep for 2028 / 2029 / compact_json over all 143 ticket bodies: 0 hits. XE-0031 body read in full — opposite-direction gossip-validator-accepts claim. CT-9/XE-0422 is the sys.network_id rewrite. XE-0060 is delete-op value hashing.