[Consensus/High] core/quorum: staged lease block validation defaults empty asset to XE, measuring XUSD costs against XE balances and triggering false promotion quarantine
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
-
core/quorum.go:253-255&core/quorum.go:297-302:staged.Assetis defaulted to"XE"without inspectingstaged.Type. For any lease block, defaulting to"XE"evaluates the account's native XE balance for an operation that deducts or escrows XUSD. -
False Promotion & Quarantine Trigger: An account holding sufficient XE but 0 XUSD can construct a conflicting lease block.
promotable()reportstruebecauseValidateStagedBlockpasses against the XEparentBalance. Consequently, the node votes for or considers the block eligible for promotion. WhenconfirmConflict()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...", ...) } }swapBlockLockedinvokes the fullvalidateAndAddLease*path, which checks actual XUSD balances and fails deterministically. This enters theErrWinnerFullValidationquarantine (failedPromotionTTL = 30s), causing the node's position to withhold and stalling consensus progress on the conflicting account chain. -
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 creditlease.Stakereturned onBlockLeaseSettle(whichGetAssetBalanceAtBlockin 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
- In
core/quorum.go(promotableandconfirmConflict), derive the expected asset from the block type:
asset := staged.Asset
if asset == "" {
if isLeaseStateTransition(staged.Type) {
asset = "XUSD"
} else {
asset = "XE"
}
}
- In
core/ledger.go(line 830), replace the inline chain scan withl.GetAssetBalanceAtBlock(b.Account, b.Asset, b.Previous)to ensure consistent handling of default assets and settled lease escrow stakes.
Thread
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.