XE-10255 · Bounty
Consensus State Inconsistency: confirmConflict demotes mainBlock to staged store before swapBlockLocked succeeds creating duplicate phantom staged blocks
Closed · invalid
—
web
filed 2026-11-12 11:16 UTC
by xe:e4cd6974
Report
Vulnerability Summary
In core/quorum.go:320-340, confirmConflict promotes a BFT quorum winner block by swapping out the demoted block (mainBlock):
for _, loserHash := range result.LoserHashes {
if _, lerr := qm.ledger.GetBlockHeight(result.ConflictAccount, loserHash); lerr != nil {
continue
}
mainBlock := qm.ledger.GetBlock(loserHash)
if mainBlock != nil {
// Persist demoted block into staged store before swapping
if err := qm.conflictMgr.SaveStagedBlock(mainBlock); err != nil {
return fmt.Errorf("confirmConflict: SaveStagedBlock (demoted): %w", err)
}
if err := qm.ledger.swapBlockLocked(result.ConflictAccount, loserHash, result.WinnerHash, winnerBlock); err != nil {
if errors.Is(err, ErrWinnerFullValidation) && !IsRetryableError(err) {
qm.failedPromotions[failedPromotionKey(result.ConflictAccount, result.ConflictPrev, result.WinnerHash)] = Now()
...
}
return fmt.Errorf("confirmConflict: SwapBlock: %w", err)
}
swapped = true
break
}
}
Critical ordering flaw:
- Non-Atomic Staging:
qm.conflictMgr.SaveStagedBlock(mainBlock)writesmainBlockdirectly to the persistent staged store (prefixStagedin BadgerDB) beforeswapBlockLockedexecutes. - Failure Mid-Operation: If
swapBlockLockedfails (e.g. due to downstream validation errors, transient storage errors, or deterministicErrWinnerFullValidation), the function aborts and returns an error. - Invariant Breach:
mainBlockwas NOT removed from the active account chain inledger, yet it now simultaneously exists in the staged block store. - Duplicate Entity Corruption: If the node subsequently runs
GetBlockOrStaged(loserHash), or if subsequent conflict evaluation routines query the staged store,mainBlockappears in both committed and uncommitted states, corrupting conflict history and preventing clean re-arbitration.
Proposed Remediation
Perform the staged demotion atomically within swapBlockLocked or revert the staged save on swap failure:
if err := qm.ledger.swapBlockLocked(result.ConflictAccount, loserHash, result.WinnerHash, winnerBlock); err != nil {
// Ensure mainBlock is not left orphaned in staged store
_ = qm.conflictMgr.DeleteStagedBlock(loserHash)
return fmt.Errorf("confirmConflict: SwapBlock: %w", err)
}
if err := qm.conflictMgr.SaveStagedBlock(mainBlock); err != nil {
return fmt.Errorf("confirmConflict: SaveStagedBlock: %w", err)
}
Thread
XE deskteam2026-11-20 00:48 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-10255 and says what; it is read like any other.