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: clear transaction pool in Rollback #30534

Merged
merged 10 commits into from
Nov 19, 2024

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

Copy link

Choose a reason for hiding this comment

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

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

@fjl fjl changed the title core/txpool, eth/catalyst: add API method to drop tracked txs from pools. prevent simulated beacon Rollback from reverting gas tip to 1 gwei. core/txpool, eth/catalyst: clear transaction pool in Rollback Nov 15, 2024
@fjl fjl force-pushed the pool-drop-all-txs branch from 0bc3138 to e4e0c45 Compare November 15, 2024 08:11
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

@holiman holiman added this to the 1.14.12 milestone Nov 19, 2024
@holiman holiman merged commit 581e214 into ethereum:master Nov 19, 2024
3 checks passed
@jwasinger jwasinger deleted the pool-drop-all-txs branch November 19, 2024 13:23
holiman pushed a commit that referenced this pull request Nov 19, 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.

---------

Co-authored-by: Felix Lange <[email protected]>
zfy0701 pushed a commit to sentioxyz/go-ethereum that referenced this pull request Dec 3, 2024
…um#30534)

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.

---------

Co-authored-by: Felix Lange <[email protected]>
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.

5 participants