{"id":"XE-13362","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"379","source_url":"https://github.com/xeprotocol/xe/issues/379","reporter_id":2132,"title":"[Low] sys.minter.keys accepts a public key where an account address is required (silent mint lockout)","area":"leasing-ledger","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0360","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:11.766330+00:00","updated_at":"2026-11-20T00:06:58.889754+00:00","source_created_at":"2026-11-11T12:07:56+00:00","told_at":"2026-11-20T00:05:11+00:00","status_changed_at":"2026-11-20T00:04:40.898258+00:00","url":"https://bounty.xe.network/XE-13362","body":"### Summary\n\n`isMinter` (`core/mint.go:12`) compares the minting block's `Account` against the entries of `sys.minter.keys` verbatim (`strings.EqualFold`). The documentation (`docs/api.md:764`) states that `sys.minter.keys` holds account **addresses**, matched against the block's `account` — unlike `sys.timekeepers` / `sys.oracle` / `sys.dao_keyset`, which hold verifying keys matched against signatures. But the field is named `keys`, the statechain config validation calls each entry `minter key[i]`, and every sibling keyset holds raw verifying keys — so an operator following the naming will configure the minter's **public key** instead of its derived address. Config validation only checks that each entry is 64 hex characters, so a public-key entry is silently accepted; every later mint then fails with \"not an authorized minter\", including mints from the legitimate minter, with no error at config time. A public key and an account address are both 64 hex characters, so the two spellings cannot be told apart by inspection.\n\n### Impact\n\nA single operator mistake at config time silently disables all XUSD minting: the legitimate minter's mint blocks are rejected (\"not an authorized minter\") and there is no error, warning, or health signal at config load to reveal the misconfiguration. XUSD is the only mintable asset and the only way new XUSD enters the system, so a misconfigured `sys.minter` blocks the mint supply path entirely until the config is corrected.\n\nSeverity is Low, not higher: this is a latent misconfiguration trap, and the live network is configured correctly — the testnet-0005 minter account is `8bc63438d2e9e59ef229865abb73520955da9f3c43b41ff50298884f78ab970d`, and its opening mint block (hash `14c2b2584172...`, 100 XUSD) is FINALIZED, with 12 finalized mint/send blocks on that account. There is no live impact; the defect only bites the next operator who configures a minter by following the field name.\n\n### Root cause (repo `github.com/xeprotocol/xe`, commit `89a542ea51d38375299aee54c6c99102e9bfa666`, \"release: testnet-0005 quorum withhold fix\")\n\n`core/mint.go:12` — `isMinter` matches the entry verbatim, with no fallback to the derived address:\n\n```go\nfunc (l *Ledger) isMinter(account string) bool {\n\t...\n\tfor _, k := range cfg.Keys {\n\t\tif strings.EqualFold(k, account) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n```\n\nAnd the rejection is produced in `validateAndAddMint` (`core/mint.go`):\n\n```go\nif !l.isMinter(b.Account) {\n\treturn fmt.Errorf(\"mint: account %s is not an authorized minter\", shortAddr(b.Account))\n}\n```\n\nThree things combine to create the trap:\n\n1. The config field is `MinterConfig.Keys` (`core/mint.go`, `Keys []string `json:\"keys\"``) — the name says \"keys\", and every other keyset in the same config family (`sys.oracle`, `sys.timekeepers`, `sys.dao_keyset`) holds verifying keys.\n2. Statechain config validation (`statechain/kvstore.go:126-132`) only checks the shape of each entry — 64 hex characters, unique — while calling it `minter key[i]`:\n\n```go\nreturn fmt.Errorf(\"minter key[%d] invalid length: got %d, want 64 hex chars\", i, len(k))\nreturn fmt.Errorf(\"minter key[%d] invalid hex: %w\", i, err)\nreturn fmt.Errorf(\"minter key[%d] is a duplicate\", i)\n```\n\n3. The one place that states the real semantics is a single sentence in `docs/api.md:764`: \"`sys.minter.keys` holds account **addresses**, matched against the block's `account` (unlike `sys.timekeepers` / `sys.oracle` / `sys.dao_keyset`, which hold verifying keys matched against signatures)\". An account address is `sha256(\"xe/account/v1\" || pubkey)` — also 64 hex — so nothing distinguishes a wrong (pubkey) entry from a right (address) entry at config time.\n\n### Reproduction\n\nPoC tests (assert the trap; they fail once `isMinter` accepts both spellings or the config rejects pubkeys):\n\n- `core/xe02_mint_config_test.go` — `TestXE02MintWorksWithAddressConfig`: mint accepted when `sys.minter` holds the minter's derived address (XUSD balance after mint = 1,000,000). `TestXE02MintFailsWithPubkeyConfig`: the same mint, signed by the same key, rejected with \"not an authorized minter\" when `sys.minter` holds the minter's public key instead.\n\nRun:\n\n```bash\ngit clone https://github.com/xeprotocol/xe && cd xe\n# add the PoC test file above, then:\ngo test ./core/ -run XE02 -v   # 2/2 PASS (trap reproduced)\n```\n\nLive cross-check (testnet-0005, 2026-11-11): the minter account `8bc63438d2e9...` declares pubkey `200048d329da...` on its opening mint block, and that pubkey's derived address IS `8bc63438d2e9...` — i.e. the live `sys.minter` entry is the derived address, which is why minting works there. This confirms the trap is latent, not live.\n\n### Suggested fix\n\n- Make `isMinter` accept both spellings: an entry matches if `entry == account` OR `DeriveAddress(entry) == account`.\n- And/or rename/document the field as addresses (e.g. `sys.minter.addresses`, or a doc note on the field) and validate at config load that each entry equals the derived address of some known key — or at least warn when an entry looks like a raw public key rather than a derived address.\n- The live network needs no change (it is already configured with the address spelling).\n\n### Environment\n\n- Codebase: `github.com/xeprotocol/xe` @ `89a542e` (2026-11-10)\n- Go 1.25.0, `go test` as above, local reproduction only (live testnet used only for read-only cross-checks)\n\nXE payout address: e3d3e4407fec5a846201c7ed8560484ffb881cc30068745a110dd8efb824500c","patch_refs":[{"id":730,"repo":"xeprotocol/xe","kind":"pr","ref":"879","title":"fix(xe): low--sys-minter-keys-accepts (fixes #379)","url":"https://github.com/xeprotocol/xe/pull/879","note":"","state":"open","author":"tipprb","added_by":"desk","created_at":"2026-11-19T18:20:39.331749+00:00"}],"thread":[{"id":12847,"source":"github","source_ref":"7025804394","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0360, 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-13362 and says what differs; it is read like any other.","created_at":"2026-11-20T00:05:11+00:00"}]}