Skip to content

llmq: bind quorum cache entries to mined commitments across reorgs #8140

Open

Description

@thepastaclaw

CQuorumManager::GetQuorum can return a stale mapQuorumsCache entry after branches A and B mine different final commitments for the same quorum hash. The cache is keyed only by quorum hash; HasMinedCommitment does not verify that the cached quorum was built from the commitment currently mined on the active chain. Bind cached quorum entries to their mined commitment (for example, compare the cached minedBlockHash on cache hits). After that, make ScanMined reject inserting results when its uncached build spans a disconnect, including an A→B→A transition, so a result built from another branch cannot be cached under the scan block hash.`

Origin

Deferred from #8102 (review thread: #8102 (comment)) at the request of maintainer PastaPastaPasta.

PastaClaw finding (blocking): The insertion guard misses a reorg away and back during construction

The two active-chain checks do not establish that build() read commitments from the scanned branch. An uncached ScanQuorums call can read the index while branch A is active, release cs_main, then build a quorum while branch B is active. If the fork shares the quorum base block but mines a different final commitment, UndoBlock removes A's q_mc record and ProcessCommitment installs B's record under the same quorum hash. GetQuorum's HasQuorum check succeeds on B, and BuildQuorumFromCommitment reads B's payload at line 72. If A becomes active again before insertion, Contains(pindexStore) passes an

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions