node: archiveExpiredLease destroys lease escrow with no block — clock-driven, per-node, unreplayable (Severe)
Report
Note from the reporter (2026-11-09): I filed this publicly by mistake. The bounty desk at https://bounty.xe.network/report is private by default and is the correct channel; I used this public issue because it was the only submission route reachable without signing in. I am redacting the step-by-step detail below and will file the full report through the desk. Maintainers: please treat the detail here as withdrawn and read the desk ticket instead. I have asked the desk to link this issue once filed.
Summary (redacted)
node.archiveExpiredLease (node/node.go:1881) resolves a stale lease by calling
store.DeletePendingSend(lease.LeaseHash) and PutLease with State = LeaseExpired,
Settled = true — and emits no block. There is no core.SignBlock, no solvePoW, no
Ledger.AddBlock, and nothing gossiped.
The trigger is each node's own wall clock: shouldArchiveExpiredLease (node/node.go:1858)
returns true when core.Now().UnixNano() >= lease.EffectiveExpiry() + core.LeaseEscrowExpiry + core.LeaseArchiveGap (core/ledger.go:151-152 — 365 days + 1 hour), re-evaluated by
settleLoop() (node/node.go:1756) every 10 seconds.
Every other value-moving lease transition in the same file — notably forceSettleLease
(node/node.go:1900) — builds, signs, PoWs and AddBlocks a BlockLeaseForceSettle. This path
is the only one that skips all of it.
Secondary observation
core/supply.go:281-283 reconciles the archive by crediting EscrowBurned += l.Cost for every
LeaseExpired lease. That is a census assumption rather than an observation of a burn, and it
credits only the base-cost field. core/lease_renew.go:137-138 accumulates renewal top-ups into
the same pending via TopUpPendingID/TopUpPendingAmount (applied at store/mem_store.go:340
and store/badger_store.go:867), and those top-ups are recorded in lease.Renewals[].Cost
rather than lease.Cost. So for a renewed lease the amount actually destroyed by
DeletePendingSend exceeds what the auditor credits.
Why it matters
- A value-moving state transition bypasses block validation entirely — no signature, no PoW, no quorum, nothing a peer can validate or replay.
- The decision is per-node wall clock, so nodes reach different conclusions about the same lease
at different times, and their
/pending,/leasesand/supplyoutputs disagree in between. - Chain replay cannot reproduce the archive, because it is a function of each node's clock rather than of any block.
Suggested direction
Either emit a signed, PoW'd block for the archive exactly as forceSettleLease does, or — if the
intent really is "both parties offline, refund nobody" — derive the decision from a signed
timekeeper attestation or from block height so all nodes converge, and have the auditor count the
amount actually destroyed rather than the bare lease.Cost field.
Dedupe
Full desk pulled (/v1/tickets?kind=bounty&status=all, 499 tickets, all pages). Zero tickets
mention the archive path. Closest items — XE-0105 (lease-mutation merge races) and XE-0102
(force-settle/escrow lock) — are different mechanisms and do not mention the archive burn or the
census.
Redacted at the reporter's request. Full detail filed privately at the bounty desk. Analysis by
source review of github.com/xeprotocol/xe at master (02e9641) plus read-only probing of
ldn.core.test.network; no accounts created, no testnet state modified.
Thread
Correction to my own report — the material gap is the renewal top-up, not lease.Stake
On re-verification I need to correct one claim in the report above. I wrote that the auditor
"ignores l.Stake". That is technically true but practically vacuous, and it distracted from
the real gap. Correcting it here rather than leaving the report imprecise.
lease.Stake is always zero
core/ledger.go:116:
LeaseStakeDivisor = uint64(0)
and core/ledger.go:44-52:
func LeaseStake(cost uint64) uint64 {
if LeaseStakeDivisor == 0 {
return 0
}
...
}
So lease.Stake is structurally always 0, and the Cost+Stake in the archive log line is
really just Cost. Please disregard that half of my claim.
The real gap: renewal top-ups accumulate into the same escrow pending
core/lease_renew.go:137-138:
commit.TopUpPendingID = b.Source
commit.TopUpPendingAmount = b.Amount
and the renewed lease records the top-up only in lease.Renewals[], not in lease.Cost:
renewed.Renewals = append(append([]LeaseSegment(nil), lease.Renewals...), LeaseSegment{
RenewHash: b.Hash,
Duration: b.Duration,
Cost: b.Amount, // ← lives here, NOT in lease.Cost
...
})
The pending is then accumulated in place under the lease hash, not replaced:
store/mem_store.go:338-343:
if c.TopUpPendingID != "" {
if ps, ok := m.pending[c.TopUpPendingID]; ok {
ps.Amount += c.TopUpPendingAmount
}
...
}
store/badger_store.go:866-867:
if c.TopUpPendingID != "" {
if err := addToPendingAmountTxn(txn, c.TopUpPendingID, int64(c.TopUpPendingAmount)); err != nil {
So the escrow pending behind a lease is base cost + every renewal top-up, all under one ID.
archiveExpiredLease deletes that whole pending with DeletePendingSend(lease.LeaseHash).
core/supply.go:281-283 credits only l.Cost — the base field.
Concrete numbers
- Consumer opens a lease, base cost
10,000µXUSD → escrow pending =10,000,lease.Cost = 10,000 - Consumer renews with
5,000→TopUpPendingAmount = 5,000, pending becomes15,000;lease.Coststays10,000; the5,000lives only inlease.Renewals[0].Cost - Both parties go offline. After
expiry + 365d + 1heach node archives:DeletePendingSendremoves the full15,000fromInFlight,State = LeaseExpired - Auditor credits
EscrowBurned += l.Cost = 10,000only - Net:
Accounteddrops by5,000relative toCreated→Discrepancy = -5,000,Conserved = false
The 5,000 is destroyed with no block and never appears in Destroyed at all.
Why this strengthens rather than weakens the report
The stake half of my original claim was vacuous (always zero). The renewal top-up is real, non-zero value that a lease accrues over its lifetime, and it is the part that actually breaks conservation. The suggested fix is unchanged in kind but should be stated precisely:
Count the amount actually destroyed — the pending behind
lease.LeaseHashat archive time, or equivalentlylease.Cost + Σ lease.Renewals[].Cost— not the barelease.Costfield.
The same one-line fix covers the settle branch at core/supply.go:246 and this expired branch at
core/supply.go:281, which is why I expect the conservation half to be triaged alongside XE-0511.
The un-cited parts of this report remain the ones I originally flagged: the archive path emits no
block, and the trigger is per-node wall clock.
Apologies for the imprecision in the first pass — I would rather correct it on the ticket than let it stand.
Thanks for the report and for the correction you added. The lease archive behaviour you describe was reported earlier and is being handled under https://bounty.xe.network/XE-1640; this ticket is closed as a duplicate of it. The accounting point you raise is also already tracked with the earlier reports in that family.