Supply monitor under-counts lease-renewal escrow → false conserved:false with empty notes (XUSD discrepancy −32318)
Report
Supply conservation monitor under-counts lease-renewal escrow → permanent false conserved:false with empty notes
Component: core/supply.go (SupplyAuditor) — GET /supply conservation audit
Version observed: xe/92d83d1 (testnet-0005), reproduced live on ldn, ffm, nyc
Source commit inspected: 978785929bc17a2f4ab30c383e5fc9cf4d634512
Suggested severity: MEDIUM — "accounting mismatch · API inconsistency" per the published tier table (target 2,500 XE). Accounting-integrity defect in the audit layer; no fund loss, no mint, no double-spend, so not Critical/Severe and filed publicly per the rules.
Phase 1 surface: transactions & running a node (the /supply invariant check)
Summary
The node's own supply auditor reports XUSD as not conserved on a healthy network:
"XUSD": { ... "discrepancy": -32318, "conserved": false },
"conserved": false, "notes": [], "stable": true
This is a false alarm. The underlying ledger conserves XUSD to the exact micro-unit. The discrepancy is caused entirely by SupplyAuditor omitting lease_renew escrow top-ups from its escrow_burned term.
Two documented contracts of GET /supply are violated simultaneously (per docs/api.md):
- "
notes— every reason the report is not clean … Empty on a healthy network." → Hereconserved:falseis reported withnotes: []— the monitor flags non-conservation but supplies no reason, so an operator cannot tell a false alarm from a real leak. - "
conserved… never reportstrueon incomplete data" — the converse failure: it reportsfalseon complete, correct ledger data because the auditor's own model is incomplete.
Impact: the protocol's documented integrity canary is permanently tripped once any lease is renewed, which masks any future real XUSD leak — the exact failure mode a conservation monitor exists to catch.
Affected code
core/supply.go, termsFromChain (block classification) — the switch b.Type has cases for BlockLease, BlockLeaseAccept, BlockLeaseSettle, but no case for BlockLeaseRenew:
// core/supply.go (termsFromChain, ~L88-103)
switch b.Type {
case BlockGenesis: c.genesis[b.Asset] += b.Balance
case BlockMint: c.minted[b.Asset] += b.Amount
case BlockBurn: c.burned[b.Asset] += b.Amount
case BlockLease: c.leaseCost[b.Hash] = b.Amount // base cost only
case BlockLeaseAccept: c.acceptStake[b.Source] = b.Amount
case BlockLeaseSettle: c.settleEmission[b.Source] = b.Amount
default: // <-- lease_renew falls here, ignored
}
The escrow-burn term is then derived from leaseCost (base only):
// core/supply.go walk(), ~L242-250
for h, em := range emissions {
add(&get(AssetXE.Symbol).Emitted, em)
if cost, ok := costs[h]; ok {
add(&get(AssetXUSD.Symbol).EscrowBurned, cost) // base lease cost ONLY
} else { ... }
}
But the real ledger escrow grows on each renewal and is burned in full at settle:
core/lease_renew.goL137-138 — renewal tops up the live escrow pending:commit.TopUpPendingID = b.Source commit.TopUpPendingAmount = b.Amountcore/ledger.goL2226 (lease_settle) — the entire escrow pending (base + all renewals) is removed:commit.DeletePendingID = b.Source
So at settle the ledger correctly removes base + Σ renewals from in_flight, but the auditor only adds base to escrow_burned. The missing Σ renewals makes accounted < created by exactly that sum → negative discrepancy.
Reproduction (live, read-only)
# 1. The monitor reports non-conservation with an empty notes array:
curl -s https://ldn.core.test.network/supply \
| jq '{conserved, stable, notes, XUSD: .assets.XUSD | {discrepancy, conserved, created, minted, balances, escrow_burned}}'
# => "discrepancy": -32318, "conserved": false, notes: [], stable: true
# (identical on ffm and nyc)
# 2. Reconstruct the discrepancy from lease data — it equals the renewal escrow the auditor omits:
curl -s "https://ldn.core.test.network/leases?state=settled" > settled.json
jq '[.[].renewals[]?.cost] | add' settled.json # => 32318 (== -discrepancy, exactly)
jq '[.[].cost] | add' settled.json # => 67738 (base; == auditor escrow_burned)
Exact conservation proof (XUSD)
| Term | Value (micro-XUSD) | Source |
|---|---|---|
created (= minted) |
213,000,000 | /supply |
balances (live accounts) |
212,899,944 | /supply |
escrow_burned reported |
67,738 | /supply (base cost of 98 settled leases) |
| renewal escrow omitted | 32,318 | Σ renewals[].cost over settled leases (46 segments) |
balances + escrow_burned(base) + renewals_omitted
= 212,899,944 + 67,738 + 32,318
= 213,000,000
= created ✓ conserves exactly once the renewal term is included
discrepancy = accounted − created = (212,899,944 + 67,738) − 213,000,000 = −32,318, i.e. precisely the omitted renewal escrow. The XE asset is unaffected (discrepancy: 0, conserved: true), as expected since only XUSD funds lease escrow.
Deterministic and stable: observed identical (−32318, stable:true, notes:[]) on all three public nodes and across repeated reads during live block production.
Why this is NOT a fund-safety issue
The real ledger conserves. Verified:
- Escrow top-up/reduce is a symmetric, underflow-guarded
int64delta (store.addToPendingAmountTxn); settle burns the full pending viaDeletePendingID; rollback pops renewals symmetrically (priorLeasePopRenewal+ReducePendingAmount). - Independent full-state reconstruction balances to the exact micro-XUSD (table above).
- XE emission/supply is independently
conserved: trueand stable over time.
The defect is confined to the audit model in supply.go, not to any balance-mutating path. No XUSD is created, lost, or double-counted on-chain.
Impact
- Integrity canary disabled.
GET /supplyis documented as the conservation authority (docs/api.md: "This endpoint is the authority"). Once any lease is renewed, it permanently reportsconserved:false. A genuine future XUSD leak would be indistinguishable from this baseline false alarm. - Contract violation / operator confusion.
conserved:falsewithnotes:[]contradicts the documented guarantee thatnotescarries "every reason the report is not clean" and is "empty on a healthy network." Monitoring/alerting built onconservedornoteswill either alarm forever or (if operators learn to ignore it) ignore a real breach.
No external attacker interaction is required; it is a protocol self-report defect.
Suggested fix
Account for renewal escrow in the auditor so the burned term matches what the ledger actually removes.
// core/supply.go — add a renewal-cost map to chainTerms
type chainTerms struct {
// ...
leaseCost map[string]uint64
leaseRenewCost map[string]uint64 // NEW: Source -> Σ renewal top-ups
// ...
}
// in termsFromChain switch:
case BlockLeaseRenew:
c.leaseRenewCost[b.Source] += b.Amount
// in walk(), fold renewal cost into EscrowBurned wherever the base escrow is burned
// (settle path, and the LeaseExpired loop), keyed consistently with how costs[h] is keyed.
Equivalent alternative: derive escrow_burned for a burned lease directly from the stored Lease (Cost + Σ Renewals[].Cost) rather than from the base lease block amount, so the auditor and the ledger use the same escrow total by construction.
After the fix, GET /supply should return XUSD.discrepancy: 0, conserved: true, notes: [] on the current testnet state.
Metadata
- Reporter contact: govrex5@gmail.com
- XE payout address:
0x05055eE6Bffc9467aa8aad5F8e8665871dC71060 - Suggested severity: MEDIUM (accounting mismatch + API inconsistency). Final severity at XE core team discretion.
- Channel: public GitHub issue on
xeprotocol/xe(not funds/network-risking, so not the privatesecurity@xe.networkchannel). - Affected files:
core/supply.go(primary); cross-referencedcore/lease_renew.goL137-138,core/ledger.goL2226. - Reproducible: yes, read-only
GET /supply+GET /leases?state=settled, no state mutation, no special access.
Thread
Thanks, this was well put together and the numbers were useful. It has the same root cause as finding 3 in #4 (lease-renewal escrow not counted by the supply auditor), which was filed first and is being fixed, so this one closes as a duplicate and your data points are folded into that ticket. If you believe it is a different bug, reply with what differs and we will look again.