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

eth: avoid transaction pool query when annoucing transaction #31309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

minh-bq
Copy link
Contributor

@minh-bq minh-bq commented Mar 4, 2025

With eth/68, transaction announcement must have transaction type and size. So in announceTransactions, we need to query the transaction from transaction pool with its hash. This creates overhead in case of blob transaction which needs to load data from limbo and RLP decode. This commit tries to avoid transaction pool query by providing the transaction type and size information along with hash right from the beginning.

Comment on lines 449 to 451
if sc := blobtx.Sidecar; sc != nil {
tx.sidecarSize = rlp.ListSize(sc.encodedSize())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't looked into this PR too deeply yet, but this part strikes me as really weird, and goes against the implied semantics of the method (which one would assume doesn't mutate the instance it is called on).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've fixed this. The intention is to set cpy.sidecarSize not the tx.sidecarSize.

@jwasinger jwasinger self-assigned this Mar 4, 2025
With eth/68, transaction announcement must have transaction type and size. So
in announceTransactions, we need to query the transaction from transaction pool
with its hash. This creates overhead in case of blob transaction which needs to
load data from limbo and RLP decode. This commit tries to avoid transaction
pool query by providing the transaction type and size information along with
hash right from the beginning.
@jwasinger
Copy link
Contributor

jwasinger commented Mar 4, 2025

Any time we receive a remote transaction in the fetcher, we cache the encoded size (including sidecar) on the transaction object: https://github.com/ethereum/go-ethereum/blob/master/eth/fetcher/tx_fetcher.go#L365 .

If a transaction originates locally, we will do this when adding it to the local pool.

So afaict, this PR isn't necessary.

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