Skip to content

Continue candidate assembly after limit overflow - #2479

Open
a-shannon wants to merge 2 commits into
ergoplatform:v6.0.7from
a-shannon:fix/collecttxs-head-of-line-v607
Open

Continue candidate assembly after limit overflow#2479
a-shannon wants to merge 2 commits into
ergoplatform:v6.0.7from
a-shannon:fix/collecttxs-head-of-line-v607

Conversation

@a-shannon

Copy link
Copy Markdown
Contributor

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

Invariant

A valid transaction that cannot fit the current candidate must not prevent later independent transactions from being considered, or cause its later dependents to be eliminated from the mempool.

Root cause

CandidateGenerator.collectTxs returned immediately when adding a valid transaction plus the updated fee transaction exceeded the candidate cost or size limit. Because the mempool sequence is priority-ordered rather than size-packed, one non-fitting transaction could starve every later transaction.

Simply continuing is unsafe: a later transaction spending or reading the omitted transaction's output would appear to have a missing box and could be returned in EliminateTransactions.

Fix

  • Keep the existing single-pass priority order.
  • Defer a valid transaction when the resulting candidate exceeds either strict limit, leaving the accepted prefix and fee transaction unchanged.
  • Record deferred output IDs with content-based identity.
  • Transitively defer later regular-input and data-input dependents without eliminating them.
  • Preserve existing invalid and double-spend handling for transactions outside a deferred family.

Regression coverage

The properties cover size and cost head-of-line blocking, fee and no-fee overflow branches, regular and data-input dependency propagation, conflicts inside and outside deferred families, and exact equality at the existing strict limits.

Validation

  • CandidateGeneratorSpec: 19/19 passed.
  • CandidateGeneratorPropSpec: 16/16 passed.
  • git diff --check passed on 721dbf783.
  • Independent review of the v6.0.7 replay found no blocker or duplicate implementation.

Scope

This remains a focused candidate-selection fix. It does not introduce package scoring or change data-input CPFP policy. #2303 is complementary; #2462 changes fee collection and may require a later combined rebase if it lands first.

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