Bounty
XE-13261 · Bounty

[Consensus/High] core/quorum: staged lease block validation defaults empty asset to XE, measuring XUSD costs against XE balances and triggering false promotion quarantine

Closed · duplicate — xe#401 filed 2026-11-11 17:44 UTC by telas929

Report

Summary

In core/quorum.go, both promotable() (lines 253–257) and confirmConflict() (lines 297–302) attempt to determine the asset type of a staged block to compute parentBalance via qm.ledger.GetAssetBalanceAtBlock(account, asset, previous). When staged.Asset is empty (""), both functions default the asset to "XE":

asset := staged.Asset
if asset == "" {
    asset = "XE"
}
var parentBalance uint64
if previous != "0" {
    parentBalance = qm.ledger.GetAssetBalanceAtBlock(account, asset, previous)
}
return qm.ledger.ValidateStagedBlock(staged, parentBalance) == nil

However, all compute lease operations (BlockLease, BlockLeaseAccept, BlockLeaseSettle, BlockLeaseCancel, BlockLeaseForceSettle) are strictly denominated in XUSD. When an empty-asset lease block enters conflict resolution, this fallback causes the node to fetch the account's XE balance rather than its XUSD balance, and validates the lease cost/stake against the XE balance in ValidateStagedBlock.

Furthermore, in core/ledger.go (lines 830–845), the pre-conflict staging path computes parentBalance using an ad-hoc loop that does not handle default assets (cb.Asset == "") or add lease.Stake on BlockLeaseSettle (unlike GetAssetBalanceAtBlock), causing divergence between the pre-conflict staging gate and quorum promotion validation.


Root Cause Analysis

  1. core/quorum.go:253-255 & core/quorum.go:297-302: staged.Asset is defaulted to "XE" without inspecting staged.Type. For any lease block, defaulting to "XE" evaluates the account's native XE balance for an operation that deducts or escrows XUSD.

  2. False Promotion & Quarantine Trigger: An account holding sufficient XE but 0 XUSD can construct a conflicting lease block. promotable() reports true because ValidateStagedBlock passes against the XE parentBalance. Consequently, the node votes for or considers the block eligible for promotion. When confirmConflict() proceeds to promote the staged winner:

    if err := qm.ledger.swapBlockLocked(result.ConflictAccount, loserHash, result.WinnerHash, winnerBlock); err != nil {
        if errors.Is(err, ErrWinnerFullValidation) && !IsRetryableError(err) {
            qm.failedPromotions[failedPromotionKey(...)] = Now()
            log.Printf("confirmConflict: winner %s ... failed full validation deterministically: quarantining for %s...", ...)
        }
    }
    

    swapBlockLocked invokes the full validateAndAddLease* path, which checks actual XUSD balances and fails deterministically. This enters the ErrWinnerFullValidation quarantine (failedPromotionTTL = 30s), causing the node's position to withhold and stalling consensus progress on the conflicting account chain.

  3. Divergent Balance Resolution in core/ledger.go:830-842:

    var parentBalance uint64
    if chain != nil && b.Previous != "0" {
        for _, cb := range chain.Blocks {
            if cb.Asset == b.Asset {
                parentBalance = cb.Balance
            }
            if cb.Hash == b.Previous {
                break
            }
        }
    }
    

    This inline search does not normalize cb.Asset == "" to "XE", and does not credit lease.Stake returned on BlockLeaseSettle (which GetAssetBalanceAtBlock in lines 3019–3034 explicitly accounts for).


Impact

  • Consensus / Quorum Denial of Service: Malicious or malformed conflicting lease blocks bypass lightweight pre-promotion staging checks by substituting XE balance for XUSD requirements, repeatedly poisoning quorum resolution and locking the account chain into 30-second withheld quarantine states.
  • Discrepancy between Staged Ingest and Promotion: Honest nodes can accept staged blocks that cannot be applied during conflict settlement.

Recommended Remediation

  1. In core/quorum.go (promotable and confirmConflict), derive the expected asset from the block type:
asset := staged.Asset
if asset == "" {
    if isLeaseStateTransition(staged.Type) {
        asset = "XUSD"
    } else {
        asset = "XE"
    }
}
  1. In core/ledger.go (line 830), replace the inline chain scan with l.GetAssetBalanceAtBlock(b.Account, b.Asset, b.Previous) to ensure consistent handling of default assets and settled lease escrow stakes.

Thread

Joseph Denneteam2026-11-20 00:04 UTCgithub

Thanks. This is the same finding as https://bounty.xe.network/XE-0028, 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-13261 and says what differs; it is read like any other.