Skip to content

Add txpool namespace spec and test generators#758

Open
bomanaps wants to merge 3 commits intoethereum:mainfrom
bomanaps:add-txpool-namespace
Open

Add txpool namespace spec and test generators#758
bomanaps wants to merge 3 commits intoethereum:mainfrom
bomanaps:add-txpool-namespace

Conversation

@bomanaps
Copy link
Contributor

@bomanaps bomanaps commented Feb 25, 2026

part of this #353 Adds OpenRPC specification for txpool_content and txpool_status methods, documenting the common subset implemented by Geth, Erigon, Nethermind, and Reth. Includes test generators and fixtures for Hive rpc-compat testing.

@bomanaps
Copy link
Contributor Author

bomanaps commented Feb 25, 2026

Continued the work started in #353 to standardize the txpool namespace.

I found that Geth, Erigon, Nethermind, and Reth already implement txpool_content and txpool_status with compatible semantics, txpool_contentFrom is supported by Geth and Erigon, and txpool_inspect is supported by Geth and Nethermind making standardization straightforward for these methods. Besu uses different method names (txpool_besu*) and ethrex support is unknown.

This PR documents the common subset that exists today. The proposed filtering capabilities (txpool_transactions, txpool_statistics) from #353 will follow in subsequent PRs, with the filtering functionality likely requiring an EIP per RPC Standards Meeting 21 discussion.

@bomanaps
Copy link
Contributor Author

cc @fjl to this

@MysticRyuujin
Copy link
Contributor

This looks good, but it will require a PR into hive/clients for each client to add the txpool namespace, e.g. besu in order for tests to pass during hive runs.

@bomanaps
Copy link
Contributor Author

bomanaps commented Feb 25, 2026

This looks good, but it will require a PR into hive/clients for each client to add the txpool namespace, e.g. besu in order for tests to pass during hive runs.

Thanks I will do this next
I have opened the pr for hive here just two clients missing ethereum/hive#1393 please take a look

Copy link

@fab-10 fab-10 left a comment

Choose a reason for hiding this comment

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

I welcome a standardization in this field, please check my comments

$ref: '#/components/schemas/uint'
queued:
title: queued count
description: Number of transactions scheduled for future execution (nonce gaps)
Copy link

Choose a reason for hiding this comment

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

This needs some clarification, since there could be other reasons why a tx is not ready for inclusion, other than nonce gaps, for example not enough balance or max fee below current base fee.
So either queued is only related to nonce gaps, and in that case the description should say that other reasons are excluded, or "(nonce gaps)" should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have to either restrict the definition OR remove "(nonce gaps)" to be more general?

Copy link

Choose a reason for hiding this comment

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

the direction could be driven by what existing implementations do right now, do they keep only nonce gapped txs in the queued pool, or not?

Since Besu does not yet have this API, we'd like to know what to report as part of the queued pool.

Comment on lines +24 to +27
Returns an object containing all pending and queued transactions in the pool,
grouped by origin address and sorted by nonce. Pending transactions are ready
for inclusion in the next block(s). Queued transactions have nonce gaps and
are scheduled for future execution.
Copy link

Choose a reason for hiding this comment

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

I understand it is convenient to return all the txs with a single call, but that does not scale well with large pools, and could hit some of the RPC response size limits, so it would be nice to have some kind of agreed limit on how many are returned by this call.

The same applies also to other calls, only txpool_status has a bounded response size, so a general approach to filtering and/or pagination could be evaluated.

Copy link
Contributor

@MysticRyuujin MysticRyuujin Feb 26, 2026

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Both things are valuable, and could be part of an iteration, where starting from the de facto standard, API are evolved to match current use cases.

Copy link
Contributor

@MysticRyuujin MysticRyuujin Feb 26, 2026

Choose a reason for hiding this comment

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

Sure but I don't know if pagination is even an option, the mempool changes constantly, you wouldn't be able to split transactions into pages AND track the pages between calls.

In theory the mempool is already bound by a max size that is configurable on the nodes. You'r right in that it returns potentially a very large responses and is annoying to support at the RPC provider level, and many don't, they simply turn it off / block it.

txpool_content is ripe for abuse from MEV bots and searchers against the pulbic mempool, but it can also be a useful debugging tool to pull all the txs out of the mempool.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed that scalability is a valid concern. This PR documents the existing behavior across clients. The proposed txpool_transactions method with filtering and limits will address these concerns through the EIP process that's where we can design a more scalable approach.

Copy link

Choose a reason for hiding this comment

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

I agree that perfect pagination is not worth, but if there is any use case for downloading everything, some kind of range could be passed, like responses are sorted by sender, so you can use the last sender as input for the next batch.

For example in Besu, the txpool is only bounded by the amount of memory you give to it, so if you configure 1GB there could be millions of pending txs in the pool.

Said that, I do not think there is any urgency in doing some sort of pagination now, I see filtering more useful to have as debugging tool.

Comment on lines +123 to +127
'0x0216d5032f356960cd3749c31ab34eeff21b3395':
'806': '0x7f69a91a3cf4be60020fb58b893b7cbb65376db8: 115000000000000000 wei + 21000 gas × 50000000000 wei'
queued:
'0x0216d5032f356960cd3749c31ab34eeff21b3395':
'808': '0x7f69a91a3cf4be60020fb58b893b7cbb65376db8: 115000000000000000 wei + 21000 gas × 50000000000 wei'
Copy link

Choose a reason for hiding this comment

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

is the format intentionally left free-form? who is the intended consumer of this API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the free-form string format is intentional this matches Geth's original implementation the intended consumers are developers and node operators who want a quick human-readable summary of pool contents for debugging purposes, without parsing full transaction objects. If you need structured data, txpool_content provides that. txpool_inspect is essentially a convenience method for visual inspection.

Copy link

Choose a reason for hiding this comment

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

So, if I got it right, there is no enforced format and the result will be implementation specific.
Will this be covered by tests? Could be hard to verify free form responses.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct the response structure is standardized (nested maps of address → nonce → string), but the string content itself is implementation-specific. the tests verify the structure returns correctly (pending/queued maps with string values), not the string format this is similar to how some debug methods work the structure is defined but content can vary.
I can add a note in the spec clarifying that the string format is informational and may vary between implementations.

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