<!-- XE-4323 · Consensus ledger desync: GetAssetBalanceAtBlock bypasses cascade overlay during conflict reorgs, causing false balance mismatch and winner promotion rejection · testnet -->
*Markdown view of <https://bounty.xe.network/XE-4323>. The page is the record; this is the same page for reading.*

XE-4323 · Bounty

# Consensus ledger desync: GetAssetBalanceAtBlock bypasses cascade overlay during conflict reorgs, causing false balance mismatch and winner promotion rejection

Closed · invalid
—
web
filed 2026-11-10 22:06 UTC
by xe:e4cd6974

Verdict
:   Invalid

Tier
:   —

Claimed
:   —

Area
:   Consensus

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-15 17:58 UTC

Told
:   2026-11-15 17:58 UTC

### Patches

None linked.

### History

- [284627](https://bounty.xe.network/log/284627) 2026-11-15 17:58 UTC reply.sent
- [284355](https://bounty.xe.network/log/284355) 2026-11-15 17:42 UTC proposal.adopted
- [284295](https://bounty.xe.network/log/284295) 2026-11-15 17:42 UTC proposal.adopted
- [284294](https://bounty.xe.network/log/284294) 2026-11-15 17:42 UTC ticket.status new → closed
- [283784](https://bounty.xe.network/log/283784) 2026-11-15 17:42 UTC proposal.adopted
- [283783](https://bounty.xe.network/log/283783) 2026-11-15 17:42 UTC ticket.facts area
- [283782](https://bounty.xe.network/log/283782) 2026-11-15 17:42 UTC proposal.adopted
- [283781](https://bounty.xe.network/log/283781) 2026-11-15 17:42 UTC ticket.facts
- [279556](https://bounty.xe.network/log/279556) 2026-11-15 16:00 UTC note.added
- [279555](https://bounty.xe.network/log/279555) 2026-11-15 16:00 UTC proposal.created
- [279554](https://bounty.xe.network/log/279554) 2026-11-15 16:00 UTC proposal.created
- [279553](https://bounty.xe.network/log/279553) 2026-11-15 16:00 UTC proposal.created

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

### Report

## Vulnerability Summary

In `core/ledger.go:3014-3040`, `GetAssetBalanceAtBlock(account, asset, blockHash string)` computes the historical asset balance of an account up to a specific block boundary. This function is called directly by the consensus engine in `core/quorum.go:306-313` during `confirmConflict`:

```
if result.ConflictPrev != "0" {
    parentBalance = qm.ledger.GetAssetBalanceAtBlock(result.ConflictAccount, asset, result.ConflictPrev)
}
if err := qm.ledger.ValidateStagedBlock(winnerBlock, parentBalance); err != nil {
    log.Printf("confirmConflict: staged winner %s failed validation: %v — refusing promotion", shortHash(result.WinnerHash), err)
    return fmt.Errorf("confirmConflict: invalid staged winner: %w", err)
}
```

However, while `xusdBalanceOnChain` in `core/rollback.go` was patched to consult lease state during reorgs, `GetAssetBalanceAtBlock` in `core/ledger.go`:

1. Reads directly from the underlying physical store via `l.store.GetAccountChain(account)` instead of `l.getAccountChainOverlay(account)`.
2. Resolves lease settlements via `ls.GetLease(b.Source)` directly from the physical store instead of `l.getLeaseOverlay(b.Source)`.

When `confirmConflict` or `SwapBlock` executes a reorg unwinding across dependent blocks, an active `cascadeCommit` overlay is in place. Because `GetAssetBalanceAtBlock` completely ignores the active cascade overlay, it returns a stale/desynchronized `parentBalance`. Consequently, `ValidateStagedBlock` fails with a false `balance mismatch`, causing the node to refuse promotion of the legitimate BFT quorum winner and deadlocking consensus conflict resolution.

---

## Vulnerable Code Location

In `core/ledger.go:3014-3040`:

```
func (l *Ledger) GetAssetBalanceAtBlock(account, asset, blockHash string) uint64 {
    chain, err := l.store.GetAccountChain(account) // <-- Bypasses account chain overlay!
    if err != nil || chain == nil {
        return 0
    }
    ls, hasLeases := l.store.(LeaseStore)
    xusd := asset == "XUSD"
    var bal uint64
    for _, b := range chain.Blocks {
        a := b.Asset
        if a == "" {
            a = "XE"
        }
        if a == asset {
            bal = b.Balance
        }
        if xusd && b.Type == BlockLeaseSettle && hasLeases {
            if lease, lerr := ls.GetLease(b.Source); lerr == nil && lease != nil { // <-- Bypasses lease overlay!
                bal += lease.Stake
            }
        }
        if b.Hash == blockHash {
            break
        }
    }
    return bal
}
```

---

## Failure Mechanism

1. **Conflict Resolution During Reorg**: A conflict winner (`winnerBlock`) is selected by 67%\+ quorum on an account that has uncommitted/unwound blocks under an active cascade overlay.
2. **Historical Balance Calculation**: `confirmConflict` invokes `GetAssetBalanceAtBlock(account, asset, prev)` to establish the parent balance baseline before validating the staged winner.
3. **Overlay Bypass**:
   - `GetAssetBalanceAtBlock` reads blocks and lease states directly from the persistent store (`l.store`), completely oblivious to the unwound state in the active cascade overlay.
   - If previous blocks in the account chain or related lease settlements were modified/reverted in the cascade overlay, `GetAssetBalanceAtBlock` calculates an incorrect balance.
4. **Promotion Refusal**:
   - `ValidateStagedBlock` verifies `winnerBlock.Balance == parentBalance - amount` (or `+ amount`).
   - Due to the desynchronized `parentBalance`, `ValidateStagedBlock` returns `balance mismatch: expected X, got Y`.
   - `confirmConflict` logs `refusing promotion` and halts consensus resolution for the conflict.

---

## Proposed Mitigation

Update `GetAssetBalanceAtBlock` in `core/ledger.go` to respect active cascade overlays:

1. Use `l.getAccountChainOverlay(account)` instead of `l.store.GetAccountChain(account)`.
2. Use `l.getLeaseOverlay(b.Source)` instead of `ls.GetLease(b.Source)`.

### Thread

**XE desk**team2026-11-15 17:58 UTCdesk

Thanks for the report. We read it against the code and could not confirm a bug in what it describes.

This report is closed as invalid. If we have missed something, file a new report that links
https://bounty.xe.network/XE-4323 and says what; it is read like any other.
