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

Txpool optimization: filter out staled transactions of "nonce too low" when providing all pending list to miner #244

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

andyzhang2023
Copy link
Contributor

Description

We got a lot of "nonce too low" transactions after the optimization of #85, and they would be re-executed in the EVM, which wasted too much CPU resources. So we removed them before giving out the whole pending list of txpool.

@github-actions github-actions bot requested review from redhdx and welkin22 December 25, 2024 01:36
Copy link
Contributor

@welkin22 welkin22 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +632 to +635
// TODO need to confirm
defer func(t0 time.Time) {
getPendingDurationTimer.Update(time.Since(t0))
}(time.Now())
Copy link
Contributor

Choose a reason for hiding this comment

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

still has TODO?

Comment on lines +650 to +652
currBlockDuration time.Duration = 0
currHeaderDuration time.Duration = 0
txHashesDuration time.Duration = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

we could remove the debug duration to keep code clean if we confirmed there's no perf issue here

@@ -1296,7 +1296,7 @@ func (w *worker) fillTransactions(interrupt *atomic.Int32, env *environment) err
pendingBlobTxs := w.eth.TxPool().Pending(filter)

packFromTxpoolTimer.UpdateSince(start)
log.Debug("packFromTxpoolTimer", "duration", common.PrettyDuration(time.Since(start)), "hash", env.header.Hash(), "txs", len(pendingPlainTxs))
log.Debug("packFromTxpoolTimer", "duration", common.PrettyDuration(time.Since(start)), "hash", env.header.Hash())
Copy link
Contributor

Choose a reason for hiding this comment

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

why delete "txs" log here, it's useful when debug i think

@bnoieh
Copy link
Contributor

bnoieh commented Jan 4, 2025

It seems this pr contains the whole modifications in pr #242, and we could drop #242

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.

4 participants