<!-- XE-9596 · 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 · testnet -->
*Markdown view of <https://bounty.xe.network/XE-9596>. The page is the record; this is the same page for reading.*

XE-9596 · Bounty

# 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

Closed · duplicate
—claimed Minor
web
filed 2026-11-12 05:49 UTC
by xe:03ea5b15

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Minor

Area
:   Other

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:33 UTC

Told
:   2026-11-20 00:33 UTC

### Patches

None linked.

### History

- [552337](https://bounty.xe.network/log/552337) 2026-11-20 00:33 UTC proposal.adopted
- [552336](https://bounty.xe.network/log/552336) 2026-11-20 00:33 UTC reply.sent
- [552335](https://bounty.xe.network/log/552335) 2026-11-20 00:33 UTC ticket.status new → closed
- [551708](https://bounty.xe.network/log/551708) 2026-11-20 00:33 UTC proposal.adopted
- [551707](https://bounty.xe.network/log/551707) 2026-11-20 00:33 UTC ticket.facts area
- [551706](https://bounty.xe.network/log/551706) 2026-11-20 00:33 UTC proposal.adopted
- [551705](https://bounty.xe.network/log/551705) 2026-11-20 00:33 UTC ticket.facts
- [551704](https://bounty.xe.network/log/551704) 2026-11-20 00:33 UTC proposal.adopted
- [551703](https://bounty.xe.network/log/551703) 2026-11-20 00:33 UTC ticket.facts
- [551326](https://bounty.xe.network/log/551326) 2026-11-20 00:32 UTC note.added
- [551325](https://bounty.xe.network/log/551325) 2026-11-20 00:32 UTC proposal.created
- [551324](https://bounty.xe.network/log/551324) 2026-11-20 00:32 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-9596) · [JSON](https://bounty.xe.network/v1/tickets/XE-9596) · [markdown](https://bounty.xe.network/XE-9596.md)

### Report

Component: xeprotocol/desk @ ab9df7f — `desk/xe/encoding.py:178` in `marshal_block_canonical`. Fixed counterpart: xeprotocol/dao @ 2efbfee — `dao/xe/encoding.py:185`.

Summary
XE-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.

Mechanism
Desk copy, `desk/xe/encoding.py:178`:

```
keys = sorted(b.keyset["keys"])
```

DAO copy, `dao/xe/encoding.py:182-185` (the XE-0474 fix, with its comment):

```
# The ledger lowercases hex before it sorts (normalizeBlockHex), so a mixed-case keyset must sort the
# same way here or the hash differs from the node's (XE-0474). Other hex fields decode to the same
# bytes whatever their case.
keys = sorted(k.lower() for k in b.keyset["keys"])
```

With 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.

Impact
The 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.

Reproduction
Executed locally against both HEADs — one `multisig_open` block, keyset `{"keys": ["F0"*32, "e1"*32], "threshold": 1}`:

```
dao  copy hash_block: fe93f3ff94b17cc3d6cb757992d438c29917c87120a7e5efd230383e9dea0af5
desk copy hash_block: 859f4386a5e6663f0e7b5295e253b63f502fb16cc4b53e92c43ab540900fbdcd
-> DIFFER
```

Distinctness
Searches 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.

### Thread

**Joseph Denne**team2026-11-20 00:33 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-9596 and says what differs; it is read like any other.
