cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.2k stars 3.59k forks source link

Expose Mempool Txs #15240

Open alexanderbez opened 1 year ago

alexanderbez commented 1 year ago

Summary

With ABCI++, the application can now define and power it's own mempool.

Problem Definition

When designing the integration of ABCI++, we never considered the barrier between the mempool and the gRPC layer, i.e. exposing any insight into the contents and perhaps telemetry of the mempool.

Should we expand the Mempool interface to expose some sort of query method and write a gRPC query with a pagination request?

Proposal

Alternatively, given that mempools can vary in shapes and sizes, we leave this up to the application.

cc @kocubinski @tac0turtle

tac0turtle commented 1 year ago

we should expand the interface so something can be registered instead of having to use some global method to get the endpoint to be part of the already exposed endpoints

chixiaowen commented 1 year ago

let me try onece again! haha.

alexanderbez commented 1 year ago

we should expand the interface so something can be registered instead of having to use some global method to get the endpoint to be part of the already exposed endpoints

What is being registered? Elaborate on the API

tac0turtle commented 1 year ago

We could do something along the lines to https://github.com/cosmos/cosmos-sdk/blob/1055478d48571288277b6c0b87bcd60772d56559/client/grpc/cmtservice/service.go#L249, where we register it at a top level, or, if possible, have a method on the interface that would return the service to be registered

alexanderbez commented 1 year ago

Yeah this is why I said:

Alternatively, given that mempools can vary in shapes and sizes, we leave this up to the application.

Since the application has access to the gRPC server, it can just register whatever queries it wants itself.

chixiaowen commented 1 year ago
  • Expand the Mempool interface to support a Query method
  • Implement a gRPC method

I think we can add interface of mempool txs function in this line https://github.com/cosmos/cosmos-sdk/blob/ee458eb6c4362305fa08fad6dff5c32b6c9c6252/client/cometbft.go#L12

then Implement a gRPC method

alexanderbez commented 1 year ago

This is for the app-side mempool, not Comet's. Comet already has a mempool endpoint to expose Txs.

chixiaowen commented 1 year ago

@alexanderbez I have submitted a pr that marked as Draft, you can now review my pr and give me some suggestions。