Skip to content

Conversation

@mattac21
Copy link
Contributor

@mattac21 mattac21 commented Dec 16, 2025

Description

This adds the ability for proposals to be created out of txs in the pending pool while the pool is resetting via a new block. Previously, this resetting would hold the lock on the pool for the entire duration of the reset, which would need to call recheck on every tx in the pending pool. This may take multiple seconds, which will block a call to Pending and therefore block PrepareProposal.

This PR addresses this by pushing txs into a txCollector as they are validated via demoteUnexecutables. Creating a 'snapshot' of the pending txs that have been validated for a height at any given time. This snapshot no longer shares the same global legacypool lock, thus unblocking PrepareProposal's call to Pending.

This PR also adds functionality where the reorg loop will be cancelled if it is still processing a reset (new block seen), and a new block arrives. This is to prevent the case where demoteUnexecutables takes such a long time to process txs that processing the previous height, always takes longer than the timeout the caller is willing to wait in Pending, thus preventing any txs from ever making it into a proposal.

Closes: STACK-2008


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

@linear
Copy link

linear bot commented Dec 19, 2025

@mattac21 mattac21 marked this pull request as ready for review December 19, 2025 04:52
@mattac21 mattac21 force-pushed the ma/incremental-recheck branch from 3c991da to 392848e Compare December 19, 2025 21:51
@mattac21 mattac21 force-pushed the ma/incremental-recheck branch from b8e1b2b to 9134baf Compare December 19, 2025 22:19
@mattac21 mattac21 force-pushed the ma/incremental-recheck branch 2 times, most recently from e87dacf to 9134baf Compare December 20, 2025 05:13
dirtyAccounts: dirtyAccounts,
events: queuedEvents,
}
go pool.runReorg(input)

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
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.

3 participants