<!-- XE-10307 · Consensus Timing Race: ApplyGenesisLeaseTiming mutates package-level global variables corrupting concurrent consensus validation · testnet -->
*Markdown view of <https://bounty.xe.network/XE-10307>. The page is the record; this is the same page for reading.*

XE-10307 · Bounty

# Consensus Timing Race: ApplyGenesisLeaseTiming mutates package-level global variables corrupting concurrent consensus validation

Closed · duplicate
—
web
filed 2026-11-12 11:54 UTC
by xe:e4cd6974

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   Leasing / ledger

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:33 UTC

Told
:   2026-11-20 00:33 UTC

### Patches

None linked.

### History

- [552322](https://bounty.xe.network/log/552322) 2026-11-20 00:33 UTC proposal.adopted
- [552321](https://bounty.xe.network/log/552321) 2026-11-20 00:33 UTC reply.sent
- [552320](https://bounty.xe.network/log/552320) 2026-11-20 00:33 UTC ticket.status new → closed
- [551677](https://bounty.xe.network/log/551677) 2026-11-20 00:33 UTC proposal.adopted
- [551676](https://bounty.xe.network/log/551676) 2026-11-20 00:33 UTC ticket.facts area
- [551675](https://bounty.xe.network/log/551675) 2026-11-20 00:33 UTC proposal.adopted
- [551674](https://bounty.xe.network/log/551674) 2026-11-20 00:33 UTC ticket.facts
- [551673](https://bounty.xe.network/log/551673) 2026-11-20 00:33 UTC proposal.adopted
- [551672](https://bounty.xe.network/log/551672) 2026-11-20 00:33 UTC ticket.facts
- [551380](https://bounty.xe.network/log/551380) 2026-11-20 00:32 UTC note.added
- [551379](https://bounty.xe.network/log/551379) 2026-11-20 00:32 UTC proposal.created
- [551378](https://bounty.xe.network/log/551378) 2026-11-20 00:32 UTC proposal.created

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

### Report

## Vulnerability Summary

In `core/ledger.go:155-186`, consensus lease timing constraints are declared as mutable package-level global variables:

```
var (
	LeaseMinDuration = DefaultLeaseMinDuration
	LeaseSettleGrace = DefaultLeaseSettleGrace
	LeaseForceSettleGap = DefaultLeaseForceSettleGap
	LeaseEscrowExpiry = DefaultLeaseEscrowExpiry
	LeaseArchiveGap = DefaultLeaseArchiveGap
)

func ApplyGenesisLeaseTiming(b *Block) {
	LeaseMinDuration = DefaultLeaseMinDuration
	LeaseSettleGrace = DefaultLeaseSettleGrace
	LeaseForceSettleGap = DefaultLeaseForceSettleGap
	LeaseEscrowExpiry = DefaultLeaseEscrowExpiry
	LeaseArchiveGap = DefaultLeaseArchiveGap
	MaxAttestationSkew = DefaultMaxAttestationSkew
	if b == nil {
		return
	}
	if b.LeaseMinDurationSecs != 0 {
		LeaseMinDuration = b.LeaseMinDurationSecs
	}
	if b.LeaseSettleGraceNs != 0 {
		LeaseSettleGrace = b.LeaseSettleGraceNs
	}
...
```

Critical architectural flaw:

1. Global Shared State: `LeaseSettleGrace`, `LeaseForceSettleGap`, and `LeaseEscrowExpiry` are package globals rather than ledger-scoped or block-scoped fields.
2. Non-Thread-Safe Mutexless Mutation: `ApplyGenesisLeaseTiming` mutates these variables without holding any synchronization lock.
3. Consensus Divergence across Runtimes: When multiple ledger instances, tests, or simulator routines run concurrently with custom genesis blocks, calling `ApplyGenesisLeaseTiming` on one instance silently mutates validation constants across all running ledgers.
4. Settle / Force-Settle Invalidation: In `validateAndAddLeaseForceSettle` (`core/ledger.go:1935`) and `validateAndAddLeaseSettle` (`core/ledger.go:2166`), calculations evaluate `expiry + LeaseSettleGrace + LeaseForceSettleGap`. If these global values are mutated or desynchronized during block evaluation, valid lease settlements and force-settlements fail consensus verification.

## Proposed Remediation

Store all timing parameters as immutable fields on the `Ledger` instance (`l.genesisTiming`) rather than package-level global variables, and read directly from `l.genesisTiming` during block validation.

### Thread

**Joseph Denne**team2026-11-20 00:33 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-10307 and says what differs; it is read like any other.
