<!-- XE-9526 · Consensus State Corruption: confirmConflict premature finalization and conflict purge when winner block body is missing · testnet -->
*Markdown view of <https://bounty.xe.network/XE-9526>. The page is the record; this is the same page for reading.*

XE-9526 · Bounty

# Consensus State Corruption: confirmConflict premature finalization and conflict purge when winner block body is missing

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

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   Consensus

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:33 UTC

Told
:   2026-11-20 00:33 UTC

### Patches

None linked.

### History

- [552800](https://bounty.xe.network/log/552800) 2026-11-20 00:33 UTC proposal.adopted
- [552799](https://bounty.xe.network/log/552799) 2026-11-20 00:33 UTC reply.sent
- [552798](https://bounty.xe.network/log/552798) 2026-11-20 00:33 UTC ticket.status new → closed
- [552244](https://bounty.xe.network/log/552244) 2026-11-20 00:33 UTC proposal.adopted
- [552243](https://bounty.xe.network/log/552243) 2026-11-20 00:33 UTC ticket.facts area
- [552242](https://bounty.xe.network/log/552242) 2026-11-20 00:33 UTC proposal.adopted
- [552241](https://bounty.xe.network/log/552241) 2026-11-20 00:33 UTC ticket.facts
- [552240](https://bounty.xe.network/log/552240) 2026-11-20 00:33 UTC proposal.adopted
- [552239](https://bounty.xe.network/log/552239) 2026-11-20 00:33 UTC ticket.facts
- [550539](https://bounty.xe.network/log/550539) 2026-11-20 00:30 UTC note.added
- [550538](https://bounty.xe.network/log/550538) 2026-11-20 00:30 UTC proposal.created
- [550537](https://bounty.xe.network/log/550537) 2026-11-20 00:30 UTC proposal.created

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

### Report

## Vulnerability Summary

In `core/quorum.go:268-375`, `confirmConflict(result *quorumResult)` is responsible for promoting and finalizing a BFT quorum winner block while demoting loser candidates.

When retrieving the winner block from the staged block store:

```
	winnerBlock, err := qm.conflictMgr.GetStagedBlock(result.WinnerHash)
	if err != nil {
		return fmt.Errorf("confirmConflict: GetStagedBlock: %w", err)
	}

	if winnerBlock != nil {
		if _, onChain := qm.ledger.GetBlockHeight(result.ConflictAccount, result.WinnerHash); onChain != nil {
            // Validation, swap, or append logic
            ...
        }
    }

	if height, herr := qm.ledger.GetBlockHeight(result.ConflictAccount, result.WinnerHash); herr == nil {
		if cur, _ := qm.store.GetFinalHeight(result.ConflictAccount); height > cur {
			if err := qm.store.SetFinalHeight(result.ConflictAccount, height); err != nil {
				return fmt.Errorf("confirmConflict: SetFinalHeight: %w", err)
			}
			qm.ledger.recordFinalityAdvance()
			observeFinalityAdvance(height-cur, qm.ledger.GetBlockOrStaged(result.WinnerHash))
		}
	}

	if err := qm.finalizeBlock(result.WinnerHash); err != nil {
		return err
	}

	qm.cleanupResolvedConflict(result)
	return nil
```

Consider the case where the local node received quorum votes that converged on `result.WinnerHash`, but the node does **not** yet have the winner block body in `stagedStore` (`winnerBlock == nil`), nor is it on-chain (`herr != nil`):

1. The entire `if winnerBlock != nil` block is skipped. Neither `swapBlockLocked` nor `appendStagedWinner` is ever called.
2. `GetBlockHeight` returns an error (`herr != nil`), so `SetFinalHeight` is skipped.
3. Execution proceeds directly to `qm.finalizeBlock(result.WinnerHash)`, calling `qm.store.SetBlockStatus(result.WinnerHash, StatusFinalized)`. The node permanently marks a **completely missing block** as `StatusFinalized`!
4. Execution calls `qm.cleanupResolvedConflict(result)`:
   - `qm.rejectBlocks(result.LoserHashes)` marks the current on-chain block as `StatusRejected`.
   - `RemoveConflict` permanently deletes the conflict metadata from storage.
   - `DeleteVotesForConflict` deletes all voting records.

The result is critical consensus state corruption: the local node deletes the conflict record and marks the on-chain block as rejected, while the winning block was never downloaded, never validated, and never inserted into the account chain.

---

## Vulnerable Code Locations

In `core/quorum.go:280-375`:

```
	winnerBlock, err := qm.conflictMgr.GetStagedBlock(result.WinnerHash)
	if err != nil {
		return fmt.Errorf("confirmConflict: GetStagedBlock: %w", err)
	}

	if winnerBlock != nil {
        ...
    }

    // Execution continues even when winnerBlock == nil and WinnerHash is not on chain!
	if height, herr := qm.ledger.GetBlockHeight(result.ConflictAccount, result.WinnerHash); herr == nil {
        ...
    }

	if err := qm.finalizeBlock(result.WinnerHash); err != nil {
		return err
	}

	qm.cleanupResolvedConflict(result)
	return nil
```

---

## Failure Scenario \& Network Impact

1. A conflict occurs between Block L (locally known and appended to chain) and Block W (submitted on a peer node).
2. Network representatives vote for Block W. The local node receives quorum votes via GossipSub and converges on Block W as the BFT winner (`result.WinnerHash = W`).
3. However, due to network latency, the local node has not yet pulled the body of Block W (`stagedBlock == nil`).
4. `confirmConflict` fires:
   - Since `winnerBlock == nil`, no swap occurs. Block L remains on the local account chain.
   - `finalizeBlock(W)` marks the missing hash `W` as `StatusFinalized`.
   - `cleanupResolvedConflict` runs: it marks Block L on the chain as `StatusRejected`, deletes all conflict records, and purges votes.
5. Post-condition:
   - The account chain contains a block marked `StatusRejected` at its frontier.
   - The winning block `W` is nowhere in the chain.
   - The conflict record has been deleted, so the conflict resolution routine will never trigger again for this position.
   - Subsequent blocks built on Block W cannot be appended because Block W is absent from the local ledger chain.
   - The account chain is permanently halted on the local node.

---

## Remediation

In `core/quorum.go:280-285`, if the winner block is not currently in the ledger chain and its body is not yet held in the staged store, `confirmConflict` must defer confirmation and trigger block retrieval rather than continuing to finalize and clean up:

```
	winnerBlock, err := qm.conflictMgr.GetStagedBlock(result.WinnerHash)
	if err != nil {
		return fmt.Errorf("confirmConflict: GetStagedBlock: %w", err)
	}

	_, onChain := qm.ledger.GetBlockHeight(result.ConflictAccount, result.WinnerHash)
	if onChain != nil && winnerBlock == nil {
		// Winner block body is not yet available; trigger phantom block pull and defer resolution
		if qm.PhantomPullFn != nil {
			qm.PhantomPullFn(result.ConflictAccount, result.ConflictPrev, []string{result.WinnerHash})
		}
		return fmt.Errorf("confirmConflict: winner block body %s not yet available: deferring finalization", shortHash(result.WinnerHash))
	}
```

This prevents the premature deletion of conflict records and ensures that a missing winner block is retrieved and applied to the chain before finality is declared.

### 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-9526 and says what differs; it is read like any other.
