Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/txpool, eth/catalyst: add API method to drop tracked txs from pools. prevent simulated beacon Rollback from reverting gas tip to 1 gwei. #30534

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

jwasinger
Copy link
Contributor

@jwasinger jwasinger commented Oct 1, 2024

This adds an API method DropTransactions to legacy pool, blob pool and txpool interface. This method removes all txs currently tracked in the pools.

It modifies the simulated beacon to use the new method in Rollback which removes previous hacky implementation that also erroneously reset the gas tip to 1 gwei.

@jwasinger jwasinger marked this pull request as ready for review October 1, 2024 12:08
@jwasinger jwasinger changed the title (wip) implement tx drop functionality for pools core/txpool, eth/catalyst: add API method to drop tracked txs from pools. prevent simulated beacon Rollback from reverting gas tip to 1 gwei. Oct 1, 2024
@@ -162,4 +162,7 @@ type SubPool interface {
// Status returns the known status (unknown/pending/queued) of a transaction
// identified by their hashes.
Status(hash common.Hash) TxStatus

// DropTransactions removes all tracked transactions from the pool
DropTransactions()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls rename to Clear

p.lock.Lock()
defer p.lock.Unlock()

// manually iterating and deleting every entry is super sub-optimal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably iterate and unreserve the addresses here. It's less optimal that recreating the reservations map in the parent pool, but that's very sensitive datarace wise, so it's simpler to iterate for now.

p.mu.Lock()
defer p.mu.Unlock()

p.all = newLookup()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably iterate and unreserve the addresses here. It's less optimal that recreating the reservations map in the parent pool, but that's very sensitive datarace wise, so it's simpler to iterate for now.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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