Consensus Conflict Stall: pullPhantomBlocks calls AddBlock instead of SaveStagedBlock causing permanent phantom rejection and delayed quorum resolution
Report
Vulnerability Summary
In node/node.go:887-907, pullPhantomBlocks is registered as the node's PhantomPullFn (node/node.go:584) to retrieve missing block bodies for conflict candidates from connected peers:
func (n *Node) pullPhantomBlocks(account, previous string, hashes []string) {
if len(hashes) == 0 {
return
}
want := append([]string(nil), hashes...)
n.wg.Add(1)
go func() {
defer n.wg.Done()
peers := n.Host.Network().Peers()
if len(peers) == 0 {
return
}
xenet.PullBlocks(n.ctx, n.Msg, peers, want, func(b *core.Block) error {
if err := n.Ledger.AddBlock(b); err != nil {
return err
}
n.syncTracker.MarkDirty()
return nil
})
}()
}
When a phantom block body is retrieved from a peer:
The ingestion callback invokes n.Ledger.AddBlock(b).
However, by definition, a phantom block in an open conflict shares the same Previous hash as an already-existing block on the account's chain. In core/ledger.go, invoking AddBlock(b) on a conflicting block immediately triggers:
return errForkDetected or return errPreviousMismatch.
Because AddBlock returns an error:
PullBlockslogs an ingest failure and considers the block un-ingested (delete(want, b.Hash)is skipped).- The block is never saved to the staged block store (
n.Store.SaveStagedBlock(b)). - On every subsequent sweep of
QuorumManager.sweepOpenConflicts(),qm.ledger.GetBlockOrStaged(h)returnsnil, classifying the block as a phantom repeatedly. - The conflict is unable to resolve normally and remains stalled until the hard timeout (
phantomUnretrievableTimeout) forces an unretrievable drop.
Impact & Severity
- Consensus Livelock: Legitimate conflict candidates successfully retrieved from the P2P network cannot be staged or evaluated by the BFT quorum engine.
- Delayed Finality: Accounts with conflicting transactions are blocked from settling or progressing until phantom timeouts expire.
Proposed Remediation
In pullPhantomBlocks, validate the block's hash and signature, then store it as a staged block rather than calling AddBlock:
xenet.PullBlocks(n.ctx, n.Msg, peers, want, func(b *core.Block) error {
if err := core.VerifyBlockHash(b); err != nil {
return err
}
if err := core.VerifyBlockSignature(b); err != nil {
return err
}
if err := n.Store.SaveStagedBlock(b); err != nil {
return err
}
n.syncTracker.MarkDirty()
return nil
})
Thread
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-10160 and says what; it is read like any other.