<!-- XE-0012 · Escrow without service is uncostly: lease_settle verifies only elapsed time, returns the stake, and opens before force-settle · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0012>. The page is the record; this is the same page for reading.*

XE-0012 · Bounty

# Escrow without service is uncostly: lease\_settle verifies only elapsed time, returns the stake, and opens before force-settle

Accepted
claimed Critical
[xe#21](https://github.com/xeprotocol/xe/issues/21)
filed 2026-10-23 21:12 UTC
by BALSTOT

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Critical

Area
:   Leasing / ledger

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-11 13:35 UTC

Told
:   2026-11-10 00:15 UTC

### Patches

- [xe#25](https://github.com/xeprotocol/xe/pull/25) open by ocakciomursel-pixel
  fix(core,node): require delivery proof to refund lease stake on settle and open force-settle at expiry

### History

- [61403](https://bounty.xe.network/log/61403) 2026-11-10 00:15 UTC reply.mirrored
- [61360](https://bounty.xe.network/log/61360) 2026-11-10 00:15 UTC reply.sent
- [10092](https://bounty.xe.network/log/10092) 2026-11-05 22:17 UTC proposal.adopted
- [10091](https://bounty.xe.network/log/10091) 2026-11-05 22:17 UTC ticket.award
- [10090](https://bounty.xe.network/log/10090) 2026-11-05 22:17 UTC proposal.adopted
- [10089](https://bounty.xe.network/log/10089) 2026-11-05 22:17 UTC ticket.facts
- [10088](https://bounty.xe.network/log/10088) 2026-11-05 22:17 UTC proposal.rejected
- [6862](https://bounty.xe.network/log/6862) 2026-11-05 13:45 UTC proposal.created
- [1786](https://bounty.xe.network/log/1786) 2026-11-02 19:16 UTC proposal.created
- [1785](https://bounty.xe.network/log/1785) 2026-11-02 19:16 UTC proposal.created
- [1442](https://bounty.xe.network/log/1442) 2026-11-02 10:11 UTC note.added
- [740](https://bounty.xe.network/log/740) 2026-10-29 14:22 UTC note.added

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

### Report

**Severity:** Critical — escrow theft ("escrow taken without service"). See "Honest caveat".
**Area:** Compute leasing · `core/ledger.go`, `node/attestation.go`
**Related:** distinct root cause from #20 (see "Distinct from #20").

## Summary

`lease_settle` verifies only that time has passed — a timekeeper attests
`sha256(lease_hash || timestamp)`, never that the provider delivered compute. A provider can
therefore accept a lease, provision nothing, and at expiry settle with a timekeeper-signed
timestamp: the consumer's escrow is burned, the provider keeps their stake and mints XE. Because the
provider's settle window opens before the consumer's force-settle window, and because settlement
returns (rather than forfeits) the stake, this is uncostly and always winnable by the provider.

## Root cause

`validateAndAddLeaseSettle` (`core/ledger.go`) gates settlement exclusively on time:

```
// gates: settleTime >= expiry  &&  settleTime <= expiry + LeaseSettleGrace
// no check that a VM was provisioned, or that any compute was delivered
```

Settlement's side effects are then unconditional:

- `DeletePendingID = lease hash` — the consumer's escrow pending send is deleted (burned),
- `AssetCredit = {Account: provider, Asset: "XUSD", Amount: lease.Stake}` — the stake is returned,
- the provider's XE balance is credited the emission (newly minted supply),
- `reputation.Apply(EventLeaseSettled)` — a positive reputation event.

The only input a provider must produce is a timekeeper attestation. `canAttest`
(`node/attestation.go`) returns `nil` for any lease in `Created`/`Accepted` state — it never checks
that a VM exists or that work was delivered. `AttestationPayload` is `sha256(leaseHash || timestamp)`:
it binds a clock reading, not a delivery claim.

## Why the incentives do not protect the consumer

Three independent facts make this a theft, not a theoretical gap:

1. **Stake is returned, not forfeited, on settle.** `lease_force_settle` forfeits the stake, but the
   provider is the one who settles — and settle refunds `lease.Stake`. A provider loses their stake
   only if the *consumer* force-settles, which the provider preempts (next point).
2. **Settle precedes force-settle.** The provider may settle at `expiry`; the consumer's force-settle
   is eligible only at `expiry + LeaseSettleGrace + LeaseForceSettleGap` (default \+1h25m). By the time
   the consumer can act, the escrow is already burned.
3. **Reputation improves on settle.** Settling records `EventLeaseSettled` (positive); the
   "unfulfilled" reputation path only fires on force-settle, which the provider avoids.

Net: settle-without-delivery returns the stake, mints XE, raises the provider's reputation, and burns
the consumer's escrow — with no downside.

## Impact

- **Who:** every consumer leasing compute from a malicious provider.
- **Worst case:** a provider accepts leases, delivers nothing, and settles each one at expiry —
  draining the full escrowed XUSD of every consumer while minting XE and improving its own standing.
  There is no dispute mechanism (dispute arbitration is "design stage" in the README), so consumers
  have no recourse.
- This is the programme's own Critical class: "Leasing: escrow taken without service".

## Reproduce

A checkout runs the end-to-end lifecycle with no VM provisioned anywhere:

```
$ go test ./core -run TestAuditZeroCollateralEmission -v
    audit_e2e_test.go:103: provider BEFORE lease: XE=1 XUSD=0
    audit_e2e_test.go:129: lease cost = 500 µXUSD
    audit_e2e_test.go:156: required stake = LeaseStake(500) = 0
    audit_e2e_test.go:184: provider AFTER accept:  XE=1 XUSD=0
    audit_e2e_test.go:212: provider FINAL: XE=501 XUSD=0
    audit_e2e_test.go:213: consumer FINAL: XE=999999 XUSD=999500   ← escrow burned
    audit_e2e_test.go:221: provider minted 500 µXE emission with ZERO XUSD collateral at risk
```

The full test source is pasted in issue #20. The same block sequence demonstrates this claim: the
provider provisions no VM, obtains an attestation (`SignAttestation`) that only signs a timestamp,
and `AddBlock(settleBlock)` succeeds — minting XE and deleting the escrow pending send.

## Distinct from #20

#20 (`LeaseStakeDivisor = 0`) is the collapsed collateral constant. This finding holds even with the
divisor restored to `5`: settlement returns the stake (only force-settle forfeits it) and the settle
window precedes force-settle, so a provider whose stake is `cost/5` still settles-without-delivery at
no net loss. Fixing #20 does not close this.

## Honest caveat (steelman \+ answer)

- *Steelman:* settlement cannot prove delivery without a proof-of-uptime system, and the README marks
  "Proof of uptime 🚧 design stage". So "settlement trusts time, not work" is a known, unfinished piece.
- *Answer:* the report is not "the feature is missing" — it is that the *current ordering and
  accounting make the gap uncostly and always-winnable*. The stake is returned (not forfeited) on the
  path the attacker controls, settle opens before force-settle, and settle improves reputation. Those
  are concrete, separable defects, not merely the absence of a not-yet-built feature.

## Remediation

Any of (in order of preference):

1. Require a delivery/uptime attestation before the stake is returned, and forfeit the stake when it
   is absent.
2. Open the consumer's force-settle window at the same instant as the provider's settle window, so a
   non-delivering provider cannot win the race.
3. At minimum, do not return `lease.Stake` on settle without a delivery proof, and record a
   *disputed/unfulfilled* reputation event (not `EventLeaseSettled`) when a settle carries no delivery
   attestation.

### Thread

**XE desk**team2026-11-10 00:15 UTCgithub

Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is
updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0012.
