-
Notifications
You must be signed in to change notification settings - Fork 329
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
Support for priority mempool chains #2350
Comments
An update on this:
|
Notes from today's meeting: Issues raised
Solutions proposed
|
Here is a summary from recent discussions: Interaction with account sequence in Cosmos SDK
Sender-specific limitation on Tendermint
Strategies for IBC Relayers
Testing Strategy
|
Here is a summary of recent discussions with the Tendermint and Cosmos SDK teams on this issue:
Short Term Recommendation
Long Term Plans
|
Update: It seems Umee and Cronos are two networks that confirmed they intend to enable priority mempool.
The cronos network has no entry on mintscan or IBC assets tagged in the chain-registry. The crypto.org team is managing everything relaying-related themselves it appears. I had a look through the mintscan IBC data for Umee, the relevant part is the channel Umee <> Osmosis https://www.mintscan.io/umee/relayers/channel-0 which has high traffic & will likely be impacted. After speaking with Robert Z. from Umee team, we decided on the following:
|
Apparently, the v1 mempool keeps FIFO behavior when the priorities are the same, so one short-term solution could be to make sure the relayer transactions end up with a static priority value, for example:
|
@adizere @soareschen can this workaround be added to Hermes in the short term? |
opened an issue which includes a simple proposal. #2566 |
Not sure how easy this is as the checker needs to decode the Tx and figure out the type of messages included. What should be the prio if there are also non IBC messages?
The problem is that this fee needs to be paid and should be enough to cover the actual Tx handling cost. And this constant fee needs to cover the cost of every Tx, big or small, that the relayer submits. It will result in high fees for relayers.
We should wait and see if SDK goes this way, I thought the idea is to give higher prio to higher fee Tx-es.
Could you please clarify? what is |
It's pretty easy to do in
We can single out the txs which only contains IBC messages, which I assume is the case with relayers.
There was discussions about should we set priority based on msg types or gas price/fee, there was no consensus on that, so the default implementation built in the SDK is only a minimal one.
Yeah, I think the default implementation in SDK is only like an MVP, the chains should think more about their own feemarket design, for example, the ethermint will use the ethereum-like design conveniently. But this brings us to the issue of a flexible way to build the tx in the clients.
it follows the design of EIP-1559 of ethereum, the base-fee is an in-protocol gas price that is constantly adjusted based on the gas usage of the previous block.
When apply to cosmos-sdk tx, we reuse the existing |
Thanks for the pointer and notes!
So a solution involving the Do you plan to enable priority mempool for ethermint? If yes, why (what are the usecases)? And have a custom impl of (*) I still feel we are trying a convoluted solution for a very basic SDK chain UX requirement, the ability to submit multiple Tx-es from same account, with incrementing nonces, to be included in the same block (i.e. never to be reordered regardless of the way priority is computed). |
I think this is a different issue, possibly an orthogonal one, that the fee is too costly for relayer operators, I can see several options:
yeah, that's the plan, together with the EIP-1559.
I think the main use case for prioritized mempool is when the chain is congested, the users who are willing to pay higher price can get through faster. |
I've proposed a tiered-price-system before, where client specify the priority(tier of service) explicitly, different tier has different gas price requirement, and within the same tier, it's FIFO. I still think this design has some merits, and we might use it on our main chain (which don't use ethermint). For ethermint, it makes sense to keep it compatible with ethereum. |
|
…2543) Partial fix for #2350 This PR adds a hidden chain configuration `sequential_batch_tx`, which will cause the relayer to submit batched messages in serial after the previous transaction is committed to the chain. The config has default value `false`, which disables sequential sending by default. However we can instruct relayer operators to set this to `true`, in the rare case that the batched transactions are failing due to priority mempool being turned on by validators of a chain. Note that enabling sequential sending may cause degradation in performance. Hence we do not expose this config in the public documentation, to prevent relayer operators from shooting themselves in the foot. --- * Add sequential version of send_batched_messages * Add sequential_batch_tx chain config * Manual test behavior of integration tests with sequential_batch_tx * Add draft test for sequential batching * Add set_mempool_version to enable priority mempool * Add integration test for sequential batching * Relax time assertion for parallel batch * Add some documentation to send_messages functions Co-authored-by: Romain Ruetschi <[email protected]>
#2543 is merged, but haven't fully resolved the workaround. This is because the I have also filed cosmos/cosmos-sdk#13009 to ask for the possibility to introduce parallel nonces to Cosmos SDK. If that option is available, it would be much easier for us to support concurrent transactions. |
This PR is merged, may I know if it fixes the relayer issues with prioritized mempool now? |
…nformalsystems#2543) Partial fix for informalsystems#2350 This PR adds a hidden chain configuration `sequential_batch_tx`, which will cause the relayer to submit batched messages in serial after the previous transaction is committed to the chain. The config has default value `false`, which disables sequential sending by default. However we can instruct relayer operators to set this to `true`, in the rare case that the batched transactions are failing due to priority mempool being turned on by validators of a chain. Note that enabling sequential sending may cause degradation in performance. Hence we do not expose this config in the public documentation, to prevent relayer operators from shooting themselves in the foot. --- * Add sequential version of send_batched_messages * Add sequential_batch_tx chain config * Manual test behavior of integration tests with sequential_batch_tx * Add draft test for sequential batching * Add set_mempool_version to enable priority mempool * Add integration test for sequential batching * Relax time assertion for parallel batch * Add some documentation to send_messages functions Co-authored-by: Romain Ruetschi <[email protected]>
I think the prio mempool issue is fixed as a temporary workaround in #2543. We plan to extend that solution with an approach that is more resilient to errors or corner-cases (eg #2565 and the comment above #2350 (comment)). |
I thought the issue with prioritized mempool is relayer txs get reordered, so if it keep the FIFO behavior with relayer txs, it's work just like before? And in recent sdk when using static gas price, the tx will have static priority, which will have get a FIFO treatment. |
This is correct. Networks that guarantee FIFO ordering do not need the fix we implemented in #2543. Things should work as usual for those networks as long as mempool FIFO ordering is retained. In order for Hermes to cope (or allow) cases when FIFO mempool is not guaranteed, we added #2543 (introducing an additional configuration parameter that adjusts Hermes behavior to submit transactions serially); in this case, the fix is partial and temporary. This is what my earlier comment refers to #2350 (comment). Hope this clarifies things. |
Summary
Starting with tm v0.34.20 we may see cosmos-sdk chains using priority enabled mempool. We need to make sure we support these chains.
Problem Definition
Here is my understanding about how prio mempool will be used from hermes pov.
Let’s say hermes submits 2 Tx-es,
tx1
andtx2
, with incrementing nonces, usingbroadcast_tx_sync
. The application runscheckTx
for each of them and returns anabci.ResponseCheckTx
that includes apriority
. The prio mempool then stores this and when it’s time to create a block it picks Tx-es in priority order.In sdk chains, during
checkTx
, thepriority
is set by aTxFeeChecker
and the default is defined in the auth module: https://github.com/cosmos/cosmos-sdk/blob/main/x/auth/ante/validator_tx_fee.go.In this case the priority is computed based on the Tx fee. Different apps/chains will have the ability to overwrite this handler.
But staying with the default behavior for now, it is possible that tx2 will be included in a block before tx1, so
deliverTx(tx2)
will be executed first and will fail with account sequence mismatch.tx1
will be successful.If we try to use multiple wallets to go around the account sequence mismatch we will still see issues, e.g.:
While we push for a solution in tendermint or SDK (e.g. to not reorder Tx-es from same account or allow out of order execution during
deliverTx
), we should remove our assumption that Tx-es are executed in order, figure out all the cases where we are exposed to this and how to handle them.For the examples above, include update client in every tx (see also #2191), don’t send multiple Tx-es for ordered channels in same block (i.e. wait for tx1 hash to show up in a block before sending tx2), etc.
Acceptance Criteria
hermes works with prio mempool chains
For Admin Use
The text was updated successfully, but these errors were encountered: