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

Standardize 'txpool' namespace #353

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Standardize 'txpool' namespace #353

wants to merge 11 commits into from

Conversation

wslyvh
Copy link
Member

@wslyvh wslyvh commented Jan 12, 2023

This PR is a proposal to standardize the txpool namespace. All clients provide some access to txpool information, but they currently all have their own implementations. See more details here.

Standardizing the txpool namespace would be beneficial for interoperability, and hopefully allows for more reliable integrations that enable for example crLists.

  • txpool_transactions - Returns a list of all transactions that match the supplied filter conditions that are either pending for inclusion in the next block(s) or scheduled for future execution. Similar to txpool_content that most clients have, but with (optional) filter params.
  • txpool_statistics - Returns statistics about the node's transaction pool. Similar to txpool_status that most clients have.

value:
title: value
$ref: '#/components/schemas/FilterOperators'
nonce:
Copy link
Member

Choose a reason for hiding this comment

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

is there a use for being able to filter by nonce?

Copy link
Member Author

Choose a reason for hiding this comment

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

It might not be used that much, but I can imagine if you have multiple txs pending (or stuck), it could be helpful to be able to filter. But this might be more with the idea that while we're at it we might as well include these

src/schemas/txpool.yaml Outdated Show resolved Hide resolved
src/schemas/txpool.yaml Outdated Show resolved Hide resolved
title: statistics
type: object
properties:
maxSize:
Copy link
Member

Choose a reason for hiding this comment

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

Is this useful? I lean towards omitting it.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's meant to show the configured maximum amount of txs on the pool.
E.g. txpool.globalslots value or tx-pool-max-size

Which would give some indication of how full / utilized the node's pool is compared to pending/queued txs.

No strong opinion here tho.

src/schemas/txpool.yaml Outdated Show resolved Hide resolved
title: Result
schema:
$ref: '#/components/schemas/TxPoolTransactions'
- name: txpool_statistics
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- name: txpool_statistics
- name: txpool_stats

Copy link
Member Author

Choose a reason for hiding this comment

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

I think introducing txpool_stats next to the existing txpool_status might cause confusion and potential typos/errors.
txpool_statistics would avoid that

But again, no strong opinion

@@ -0,0 +1,2 @@
>> {"jsonrpc":"2.0","id":31,"method":"txpool_transactions"}
Copy link
Member

Choose a reason for hiding this comment

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

So I think what we should here for the tests is have two eth_sendRawTransactions before txpool_transactions so it actually seeds the pool with the txs. This way we can still use these tests in hive to verify the response of each client. You can do this by defining the interaction as a test generator here: https://github.com/lightclient/rpctestgen/blob/main/testgen/generators.go

src/txpool/getters.yaml Outdated Show resolved Hide resolved
params:
- name: Filter
schema:
title: txpool filter
Copy link

Choose a reason for hiding this comment

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

Having now different kind of txs, probably a type filter could be useful

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean 4844/blobs transactions? if so, also see other comment that from my understanding 4844/blobs will have its own transaction pool and will not be included for this proposal.

Copy link

Choose a reason for hiding this comment

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

I mean that the filter could accept a type field where you can specify any of the transaction types: Frontier, EIP2930, EIP1559, EIP4844

type: object
properties:
pending:
title: pending
Copy link

Choose a reason for hiding this comment

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

If not yet present elsewhere, I think we should define which criteria make a tx pending and queue, to avoid interpretations that could results in different implementations

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you know if this is specified somewhere already?
From my understanding pending means it's ready to be included in the next block
Queued is for the ones which are planned for future processing.

Copy link

Choose a reason for hiding this comment

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

I am thinking about the distinction of the two sets, so what makes a tx ready to be included or not.
At first it seems easier to find the reasons why a tx in pool is not ready for inclusion, and the main reasons are:

  • a previous tx is missing for the sender (nonce gap)
  • not enough funds to pay for the gas

at the moment I only see these two, but I could miss something.

title: pending
type: array
items:
$ref: '#/components/schemas/GenericTransaction'
Copy link

Choose a reason for hiding this comment

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

Just to start a discussion, since specially with EIP-4844, we could have quite big network representation (that includes blob content) of a tx, so a way to select what to return and/or to limit the amount of data returned should be considered.

Copy link
Member Author

Choose a reason for hiding this comment

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

From my understanding, 4844/blobs will have its own transaction pool and do not use the generic tx pool. So not sure if this should be part of this proposal.

Copy link

Choose a reason for hiding this comment

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

Quoting the previous answer, where I think blob txs should be included, setting some kind of limits make sense

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