core/quorum: orphaned conflict drop leaks staged block bodies (record and votes deleted, bodies never deleted)
Report
Summary
QuorumManager.dropConflictIfOrphaned deletes the conflict record and its votes but never deletes the staged block bodies saved for that position. Once the record is gone the bodies are unreachable — GetAllConflicts is empty and nothing references their hashes — so they persist in the store indefinitely with attacker-chosen size. The sibling path (cleanupResolvedConflict) does delete staged bodies, so this is an asymmetry, not intended behaviour.
Affected code
| Location | Fact |
|---|---|
core/quorum.go:446-460 |
dropConflictIfOrphaned: DeleteVotesForConflict + RemoveConflict only — no DeleteStagedBlock |
core/quorum.go:388-410 |
cleanupResolvedConflict calls DeleteStagedBlock for the winner (391) and every loser (398) |
core/quorum.go:486-518 |
conflictOrphanedByRollback: position dead + no candidate on chain + one candidate StatusRejected |
core/quorum.go:523-545 |
sweepStaleConflicts drives the orphan path |
core/store.go:136, store/badger_store.go:1074, store/mem_store.go:240-242 |
RejectHash from rollback/cascade marks the losing candidate StatusRejected |
core/types.go:21-23 |
DeleteStagedBlock is part of ConflictStore, so this is not an API limitation |
Reproduction
- Two competing blocks at the same position are staged and a
Conflictrecord is created. - A rollback/cascade marks one candidate
StatusRejected(BlockUndo.RejectHash) and the parent leaves the canonical chain, soconflictOrphanedByRollbackreturns true. sweepStaleConflicts→dropConflictIfOrphaneddeletes the votes and the conflict record.- The staged bodies remain. No code path can enumerate or delete them afterwards.
Executed evidence
Test run against the real function on a copy of the pinned commit 89a542e, with a fake store implementing Store + ConflictStore + VoteStore + QuorumStore:
--- RUN TestOrphanDropLeaksStagedBodies
quorum: dropping orphaned conflict aa0000000000...|0 — its chain position was rolled back (a candidate is rejected and the parent is no longer on the canonical chain)
orphan leak: badan staged bb0000000000 masih tersimpan setelah orphan-drop (mskeyset=0)
orphan leak: badan staged cc0000000000 masih tersimpan setelah orphan-drop (mskeyset=3500)
sisa 2 badan staged (0 pemanggilan DeleteStagedBlock) — harus 0 setelah orphan drop
--- FAIL: TestOrphanDropLeaksStagedBodies (0.00s)
Control assertion that passes: the conflict record is genuinely deleted; the leak is in the bodies.
Impact
Persistent, unauthenticated storage exhaustion. Every orphaned conflict permanently retains every candidate body staged for it (body size is attacker-controlled — e.g. a multisig_update block with a large keyset), and no operator-visible reference remains to audit or reclaim it. Repeated across accounts and positions this grows the staging store without bound, since it is never compacted.
Suggested fix
In dropConflictIfOrphaned, iterate c.BlockHashes and call DeleteStagedBlock for each hash, mirroring cleanupResolvedConflict. Optionally reject staged bodies above the block-size limit at save time.
Notes
- Duplicate check: checked issues — no duplicate as of 2026-11-11 (closest: #226 conflict-store asymmetries, #43 swap cannot unwind lease/multisig descendants, #328/#329 conflict RMW/snapshot, #345 synchronization; none mentions staged bodies left behind by the orphan-drop path).
- Evidence status: executed unit-level proof against the real function on commit
89a542e; no badger-byte measurement before/after, and the live-testnet frequency of the orphan path is not measured. - XE Address for Reward:
b83e7e31358b8c1e1509de6cd34e7540425eb17a190e48b486909df11080033d
Reward address updated to the official desk-bound address.
Thread
Thanks for the report. We have read it against the code and confirmed the behaviour it describes; it is being handled. The assessment and any award follow the fix.
Appreciate the confirmation, I'll wait for the fix and assessment