Skip to content

Harden explicit mempool dependency tracking - #2480

Draft
a-shannon wants to merge 1 commit into
ergoplatform:v6.0.7from
a-shannon:fix/mempool-dependency-graph-v607
Draft

Harden explicit mempool dependency tracking#2480
a-shannon wants to merge 1 commit into
ergoplatform:v6.0.7from
a-shannon:fix/mempool-dependency-graph-v607

Conversation

@a-shannon

Copy link
Copy Markdown
Contributor

Reopens #2446 against v6.0.7. GitHub closed the original PR automatically when its v6.0.4 base branch was deleted.

Invariant

Every live mempool transaction ID must have exactly one ordered entry, with consistent registry, box-index, and dependency-graph state across insertion, replacement, removal, invalidation, eviction, late producer arrival, and reinsertion.

Why

#2439 fixed the deterministic duplicate-ID producer in updateFamily and added targeted cleanup for the corrupt states observed in the wild. The remaining dual use of mutable weighted keys in ordering, lookup, and dependency discovery still makes lifecycle correctness difficult to maintain.

#2341 by @jozanek introduced the right architectural direction: keep transaction IDs stable in box indexes and model family relationships explicitly. This draft is the hardened v6.0.7 successor/integration of that work, reopened at Kushti's request for maintainer review rather than as an unrelated competing implementation.

Changes

  • Add a typed TxFamilyGraph with separate spend and data-input/read edges.
  • Store stable transaction IDs, rather than mutable WeightedTxId keys, in input and output indexes.
  • Resolve each ancestor's current weighted key from the accumulating pool while updating a family.
  • Remove RBF losers before inserting the winner, so shared indexes cannot be removed by the losing transactions afterward.
  • Reconcile graph and box-index state when producers arrive after children, and when transactions are reinserted after eviction or rollback-style removal.
  • Repair the observed duplicate, stale-registry, orphaned-ordered-entry, and registry-only inconsistency shapes during normal pool operations.
  • Recompute restored ancestor weights from direct live children, independently of restoration order.

Preserved semantics

  • Spend edges determine double-spend conflicts and family-weight propagation.
  • Data-input/read edges are tracked for dependency closure and cleanup, but do not create double-spend conflicts or change family weights. Mempool: Enable CPFP via dataInputs (Closes #1156) #2303 remains a separate policy change.
  • Existing per-path family-weight behavior is preserved; this draft does not switch to unique-ancestor weighting.

Validation

  • 108/108 passed across TxFamilyGraphSpec, ErgoMemPoolIndexSpec, OrderedTxPoolSpec, ErgoMemPoolSpec, CandidateGeneratorSpec, CandidateGeneratorPropSpec, and MempoolAuditorSpec.
  • git diff --check passed on ac0eff36c.
  • Independent review confirmed a clean replay onto v6.0.7; full upstream CI is still required.

Related work and scope

Published as a draft for maintainer review and CI.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants