{"id":"XE-9596","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":693,"title":"desk/xe/encoding.py still sorts multisig keyset keys without lowercasing — the XE-0474 fix reached the DAO copy only, so the desk copy hashes a mixed-case multisig_open differently from the ledger","area":"other","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-12T05:49:50.488020+00:00","updated_at":"2026-11-20T00:33:17.618760+00:00","source_created_at":null,"told_at":"2026-11-20T00:33:17.639916+00:00","status_changed_at":"2026-11-20T00:33:17.626471+00:00","url":"https://bounty.xe.network/XE-9596","body":"Component: xeprotocol/desk @ ab9df7f — `desk/xe/encoding.py:178` in `marshal_block_canonical`. Fixed counterpart: xeprotocol/dao @ 2efbfee — `dao/xe/encoding.py:185`.\r\n\r\nSummary\r\nXE-0474 (awarded, Minor) established that the Python `xe` package sorted multisig keyset keys as raw strings while the Go ledger lowercases every key before sorting (`normalizeBlockHex`), so a mixed-case keyset hashes differently in Python than on the ledger. The fix has since landed in the dao repo's copy; the desk repo's copy still sorts the raw spellings at its current HEAD, so the desk copy still attests a block hash no node accepts for such a keyset.\r\n\r\nMechanism\r\nDesk copy, `desk/xe/encoding.py:178`:\r\n\r\n```python\r\nkeys = sorted(b.keyset[\"keys\"])\r\n```\r\n\r\nDAO copy, `dao/xe/encoding.py:182-185` (the XE-0474 fix, with its comment):\r\n\r\n```python\r\n# The ledger lowercases hex before it sorts (normalizeBlockHex), so a mixed-case keyset must sort the\r\n# same way here or the hash differs from the node's (XE-0474). Other hex fields decode to the same\r\n# bytes whatever their case.\r\nkeys = sorted(k.lower() for k in b.keyset[\"keys\"])\r\n```\r\n\r\nWith keys `F0…` and `e1…`, the raw string sort puts `F0…` first (`F` < `e`); the ledger's lowercased sort puts `e1…` first (`e` < `f`). The canonical bytes — and therefore the block hash — differ.\r\n\r\nImpact\r\nThe bound XE-0474 conceded still applies: nodes normalise their own emissions, so there is no consensus break and no victim account; what remains is a cross-implementation verification split on an accepted block type. Any tooling or check built on the desk repo's Python copy (the copy ships in the desk repo and is exercised by its wire tests, `tests/test_xe_wire.py`, which imports `hash_block`) computes a `multisig_open`/`multisig_update` hash the ledger rejects when the keyset arrives spelled with mixed case, e.g. from hand-built or foreign JSON; a multisig opened through that path cannot be created. The programme's invariant (audit assumptions §7.3 #17, cited by XE-0474) requires canonical encoding to round-trip byte-identically through the Go, TS and Python implementations.\r\n\r\nReproduction\r\nExecuted locally against both HEADs — one `multisig_open` block, keyset `{\"keys\": [\"F0\"*32, \"e1\"*32], \"threshold\": 1}`:\r\n\r\n```\r\ndao  copy hash_block: fe93f3ff94b17cc3d6cb757992d438c29917c87120a7e5efd230383e9dea0af5\r\ndesk copy hash_block: 859f4386a5e6663f0e7b5295e253b63f502fb16cc4b53e92c43ab540900fbdcd\r\n-> DIFFER\r\n```\r\n\r\nDistinctness\r\nSearches run: `q=lowercase` (51 hits), `q=keyset`, `q=encoding`. XE-0474 is the only ticket on this mechanism; its body covers both copies \"as shipped\" at be43d38/32fd760, when the two files were byte-identical, and it is awarded/closed against that state. At the current HEADs the copies have diverged and only the dao copy carries the fix — the same residual shape as XE-3533 (a fix that reached one vendored copy only), filed and accepted as a new ticket. XE-2426 (mixed-case duplicate keys in the Go `sys.dao_keyset` verification) is a different component and mechanism.","patch_refs":[],"thread":[{"id":13197,"source":"desk","source_ref":"reply:11219","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-9596 and says what differs; it is read like any other.","created_at":"2026-11-20T00:33:17.618760+00:00"}]}