8000 Mempool Lanes: introduce QoS to the mempool [tracking issue] · Issue #2803 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Mempool Lanes: introduce QoS to the mempool [tracking issue] #2803

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

Closed
41 of 42 tasks
sergio-mena opened this issue Apr 12, 2024 · 6 comments
Closed
41 of 42 tasks

Mempool Lanes: introduce QoS to the mempool [tracking issue] #2803

sergio-mena opened this issue Apr 12, 2024 · 6 comments
Assignees
Labels
community-call To be discussed in an upcoming community call enhancement New feature or request mempool tracking A complex issue broken down into sub-problems
Milestone

Comments

@sergio-mena
Copy link
Contributor
sergio-mena commented Apr 12, 2024

Feature Request

Summary

In order to enable better management of transaction traffic at P2P level, we need to allow the app to classify transactions. For that, we introduce the concept of Quality of Service (QoS), well known in IP networks, which we realize as mempool lanes. ADR-118 describes this feature more in detail.

This issue will track:

  • the discussion with our users
  • design work
  • implementation work
  • any follow up

Teams interested

  1. Osmosis
  2. Injective
  3. dYdX
  4. Astria

Execution Steps

As with previous sizeable features, the design and implementation work will be carried out in a feature branch -- feature/mempool-qos, bifurcating from main -- to avoid the risk of last-minute serious problems. A feature branch enables the (management) decision to defer shipping a feature in a new release if it is considered not ready.

If we need our users to validate our design/implementation while this feature is in progress, we will probably need to maintain some temporary branch off a released version (likely v0.38.x) that reflects our work in feature/mempool-qos. We will work out the details as we start creating PRs with code.

Initial steps

Other related pending improvements on mempool

Design: core work

These tasks are mostly sequential, although some of them can be done in parallel

Initial estimate (this section): 12 days

Implementation

Initial estimate (this section): 50 days

Final steps

Initial estimate (this section): 12 days

Additional changes after merging to main:

@sergio-mena sergio-mena added enhancement New feature or request mempool tracking A complex issue broken down into sub-problems labels Apr 12, 2024
@sergio-mena sergio-mena added this to the 2024-Q2 milestone Apr 12, 2024
@github-project-automation github-project-automation bot moved this to Todo in CometBFT Apr 12, 2024
@adizere
Copy link
Member
adizere commented Apr 18, 2024

Please see cosmos/ibc-go#6159 while doing the research here. Glad to provide IBC-side related context of background if that would help.

@sergio-mena sergio-mena changed the title mempool: introduce mempool lanes & other improvements mempool: introduce mempool QoS & other improvements Apr 24, 2024
@adizere adizere added the community-call To be discussed in an upcoming community call label Apr 24, 2024
@sergio-mena
Copy link
Contributor Author
sergio-mena commented Apr 24, 2024

@adizere will do as part of due-diligence on alternative approaches (added the link to the corresponding task above)

@sergio-mena sergio-mena changed the title mempool: introduce mempool QoS & other improvements [tracking] mempool: introduce mempool QoS & other improvements Jun 18, 2024
@sergio-mena sergio-mena changed the title [tracking] mempool: introduce mempool QoS & other improvements mempool: introduce mempool QoS & other improvements Jun 18, 2024
@hdevalence
Copy link

This is an interesting proposal. I wanted to flag, however, that it doesn't serve Penumbra's needs, and while I can't speak on behalf of other users I am unconvinced that it solves the problem in general either.

Specifically, while the proposal allows an application to specify a few statically-designated lanes, and assign transactions to those lanes, it provides no way to prioritize transactions WITHIN those lanes. But this is the actual problem faced by an application receiving more transactions than there is execution capacity — which is the context where this problem needs to be solved in the first place.

Penumbra is designed so that every transaction has a chain-determined base fee and a user-specified transaction fee. The transaction fee minus the base fee is the proposer tip, and transactions should be priority ordered by the proposer tip. This is not possible to implement with the proposed design, which only allows defining a small number (as the number linearly replicates internal comet data structures) of lanes and assigning transactions to them, but does not allow specifying a transaction ordering within each lane. How is the app supposed to assign transactions to lanes to respect fee priority order? It cannot create one lane for every possible fee value, and it cannot statically quantize fee amounts into "priority groups" because the distribution of fee amounts is not known a priori.

The notes describe a FCFS ordering as a desirable goal. This is both a conceptual and practical mistake. Conceptually, FCFS is not a transaction ordering, because different nodes may receive transactions in different orders. An ordering must be a property of a set of transactions, i.e., using information in the transactions themselves. Practically, it is also a mistake because FCFS allows abusive users to spam low value transactions without consequence. For example, while this proposal would allow an app to define an IBC lane to prioritize IBC packets, this would do absolutely nothing about the IBC spam currently ongoing on deployed chains, because it does not allow any prioritization within a lane. In other words, it is only useful for enshrined, permissioned transaction submission, and not useful for transactions made by users of the chain.

Every other blockchain that has users and therefore experiences congestion has some kind of fee market (emergent or otherwise) that allows transactions to be sorted by fee. Comet should do the same. At the very least, this should be described in the alternatives section.

@hvanz
Copy link
Member
hvanz commented Jun 21, 2024

Thanks for the feedback @hdevalence! I think what you want is something like the deprecated priority mempool, where each tx has a priority? One of the main requirements for this proposal was to respect the (best-effort) FIFO ordering because it's needed by IBC, so in this initial design all lanes will use the same scheduling algorithm for transaction dissemination and for reaping. That doesn't mean that in the future we can't change how each lane prioritize its transactions by customizing the scheduling logic per lane, probably with a callback defined in the application.

@hvanz
Copy link
Member
hvanz commented Jun 21, 2024

while this proposal would allow an app to define an IBC lane to prioritize IBC packets, this would do absolutely nothing about the IBC spam currently ongoing on deployed chains, because it does not allow any prioritization within a lane

With this proposal, the application can define a high-priority lane for IBC restricted to small and medium transactions and another low-priority lane for large transactions (IBC or not). I know it's not the final solution to the spamming problem but it helps.

@hvanz hvanz moved this from Todo to In Progress in CometBFT Jun 21, 2024
@hvanz hvanz changed the title mempool: introduce mempool QoS & other improvements Mempool Lanes: introduce QoS to the mempool [tracking issue] Jun 21, 2024
@adizere < 8000 /div>
Copy link
Member
adizere commented Jul 4, 2024

Really appreciate the insights @hdevalence, in particular the perspective from Penumbra which helps understand better the application requirements.

I wonder if the concern about within-lane prioritization (or roughly equivalent concern of fee market) goes into the direction of #1112. If so, would love to have your input on that discussion; if not then I'll open another issue dedicated to within-lane prio work to gather requirements.

@hvanz hvanz closed this as completed Oct 4, 2024
@melekes melekes unpinned this issue Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-call To be discussed in an upcoming community call enhancement New feature or request mempool tracking A complex issue broken down into sub-problems
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants
0