feat(txpool): add txpool_contentFrom rpc method#11048
Conversation
|
ethereum/execution-apis#758 in respect to this |
batrr
left a comment
There was a problem hiding this comment.
This module seems allocation-heavy, but out of scope, I guess.
|
|
||
| public ResultWrapper<TxPoolContentFrom> txpool_contentFrom(Address address) | ||
| { | ||
| var poolInfo = txPoolInfoProvider.GetInfo(); |
There was a problem hiding this comment.
Let’s avoid building the full pool here. Fetch only this sender with ITxPool.GetPendingTransactionsBySender(Address)
There was a problem hiding this comment.
This means I will have to add ITxPool to TxPoolRpcModule's constructor and the replicat the nonce-sequencing logic inline, which also requires access to account state?
There was a problem hiding this comment.
What about TxPoolInfoProvider.GetInfo(Address)?
TxPoolInfoProvider already has ITxPool and we can reuse some code from TxPoolInfoProvider.GetInfo()
There was a problem hiding this comment.
I agree, this is wasteful, should be passed down
| TransactionForRpcContext extraData = new(chainId); | ||
| Pending = info.Pending.TryGetValue(address, out var pending) | ||
| ? pending.ToDictionary(v => v.Key, v => TransactionForRpc.FromTransaction(v.Value, extraData)) | ||
| : new Dictionary<ulong, TransactionForRpc>(); |
There was a problem hiding this comment.
uuse static dictionary for empty ones to avoid allocating.
| : new Dictionary<ulong, TransactionForRpc>(); | |
| : Empty; |
| public ResultWrapper<TxPoolContentFrom> txpool_contentFrom(Address address) | ||
| { | ||
| var poolInfo = txPoolInfoProvider.GetInfo(); | ||
| var chainId = specProvider.ChainId; |
|
|
||
| public ResultWrapper<TxPoolContentFrom> txpool_contentFrom(Address address) | ||
| { | ||
| var poolInfo = txPoolInfoProvider.GetInfo(); |
There was a problem hiding this comment.
I agree, this is wasteful, should be passed down
|
@claude review |
|
I'll analyze this and get back to you. |
Review findings (Claude)
|
|
@claude review |
|
I'll analyze this and get back to you. |
|
Replaced by #11305 |

Fixes Closes Resolves #
Please choose one of the keywords above to refer to the issue this PR solves followed by the issue number (e.g. Fixes #000). If no issue number, remove the line. Also, remove everything marked optional that is not applicable. Remove this note after reading.
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Optional. Remove if not applicable.
Documentation
Requires documentation update
If yes, link the PR to the docs update or the issue with the details labeled
docs. Remove if not applicable.Requires explanation in Release Notes
If yes, fill in the details here. Remove if not applicable.
Remarks
Optional. Remove if not applicable.