{"id":"XE-16714","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"652","source_url":"https://github.com/xeprotocol/xe/issues/652","reporter_id":2920,"title":"[High] SwapBlock unwinding a settled BlockLease refunds the full escrow while the XE settle emission stands (inflation, live on BadgerStore)","area":"leasing-ledger","claimed_tier":"high","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":true,"internal_ref":"#1064","internal_url":"https://github.com/xeprotocol/core/issues/1064","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T05:19:34.221189+00:00","updated_at":"2026-11-22T23:26:16.932744+00:00","source_created_at":"2026-11-17T05:17:50+00:00","told_at":"2026-11-22T23:26:16.949629+00:00","status_changed_at":"2026-11-22T23:26:16.939671+00:00","url":"https://bounty.xe.network/XE-16714","body":"## Summary\nWhen a fork wins a conflict whose loser is a settled lease's root `BlockLease`, `SwapBlock` unwinds the lease block -- restoring the consumer's balance and deleting the lease record -- while the XE settle emission minted by burning the escrow stays minted. Net: the escrow is back in circulation AND the emission still exists. Repeatable per lease. Reproduces identically on MemStore AND BadgerStore (the production store).\n\n## Relationship to XE-6375\nXE-6375 (\"SwapBlock unwinding a BlockLeaseRenew after settle...\") was closed 2026-11-16 as a duplicate of an earlier non-public report. The team wrote: \"If you believe it is a different bug, file a new report that links XE-6375 and says what differs; it is read like any other.\" This report links XE-6375 and states what differs:\n1. **Different unwound block:** `BlockLease` (lease root) vs `BlockLeaseRenew`; different undo arm (`buildBlockUndo` BlockLease arm); no `ReducePending` involved at all.\n2. **Reproduces on BadgerStore (the production store).** XE-6375's renewal variant FAILS on Badger (`addToPendingAmount: pending not found`, the XE-5826 wedge); its own text calls the inflation \"currently latent on production\". This variant is LIVE on production.\n3. **Bigger blast radius:** the ENTIRE lease record is deleted and the FULL escrow refunded with the FULL emission standing; XE-6375 refunds only one renewal segment.\n\n## Root Cause\n- `planSwap` (`core/ledger.go:3316-3321`) -- only `BlockSend` old blocks get cross-chain cascade planning (`planCascade`); a `BlockLease` old block is appended unchecked, with no settled-state guard.\n- `buildBlockUndo` BlockLease arm (`core/rollback.go:227-229`) -- deletes pending escrow + lease record unconditionally (`deletePendingID = b.Hash; deleteLeaseHash = b.Hash`).\n- `confirmConflict` (`core/quorum.go:329`) -- the production trigger via `swapBlockLocked`.\n- The swap cascade only unwinds the loser's own chain. A settled lease's provider-side effects (accept, settle block, XE emission minted by burning the escrow) live on the provider's chain and are never touched.\n\n## Impact\nInflation: the escrow burned at settle returns to circulation while the XE emission stands. Precondition: the fork must win >=67% final-vote weight and the lease block must be unfinalized; deterministic once met.\n\n## Verification (executed PoC)\nLease 40,000 XCU, accept, settle at expiry -> 40,000 XE emission, escrow burned; then `SwapBlock(consumer, leaseHash, forkSend)`. Identical on MemStore and BadgerStore:\n- Before swap: provider XE=40,000, total XCU=1,060,000 (40k burned)\n- After swap: consumer XCU=960,000, provider XE=40,000 (kept), total XCU=1,100,000, lease record=nil\n- Net: the 40,000 XCU burned at settle is back in circulation AND the 40,000 XE emission still exists. Repeatable per lease. Audited at HEAD `8cc209d` (testnet-0006).\n\n## Suggested fix\nRefuse to unwind any lease-family block when the lease is Settled or its escrow pending is gone, or extend the cascade to unwind the provider chain's accept/settle and claw back the emission.","patch_refs":[],"thread":[{"id":18877,"source":"desk","source_ref":"reply:16554","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-16714 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:16.932744+00:00"}]}