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

refactor(server/v2/cometbft): Handle non-module service queries #22803

Merged
merged 17 commits into from
Dec 11, 2024
Prev Previous commit
Next Next commit
fixes
julienrbrt committed Dec 11, 2024

Verified

This commit was signed with the committer’s verified signature.
laverya Andrew Lavery
commit b0260cce5f562dd9b0b12aade3a3d7e079fcf131
7 changes: 4 additions & 3 deletions server/v2/cometbft/grpc.go
Original file line number Diff line number Diff line change
@@ -463,8 +463,9 @@ func parseOrderBy(orderBy txtypes.OrderBy) string {

func (c *consensus[T]) maybeHandleExternalServices(ctx context.Context, req *abci.QueryRequest) (transaction.Msg, error) {
// Handle comet service
if strings.Contains(req.Path, "/cosmos.base.tendermint.v1beta1.Service") {
if strings.HasPrefix(req.Path, "/cosmos.base.tendermint.v1beta1.Service") {
rpcClient, _ := rpchttp.New(c.cfg.AppTomlConfig.Address)

cometQServer := cmtservice.NewQueryServer(rpcClient, c.Query, c.consensusAddressCodec)
paths := strings.Split(req.Path, "/")
if len(paths) <= 2 {
@@ -494,7 +495,7 @@ func (c *consensus[T]) maybeHandleExternalServices(ctx context.Context, req *abc
}

// Handle node service
if strings.Contains(req.Path, "/cosmos.base.node.v1beta1.Service") {
if strings.HasPrefix(req.Path, "/cosmos.base.node.v1beta1.Service") {
nodeQService := nodeServer[T]{c.cfgMap, c.cfg.AppTomlConfig, c}
paths := strings.Split(req.Path, "/")
if len(paths) <= 2 {
@@ -514,7 +515,7 @@ func (c *consensus[T]) maybeHandleExternalServices(ctx context.Context, req *abc
}

// Handle tx service
if strings.Contains(req.Path, "/cosmos.tx.v1beta1.Service") {
if strings.HasPrefix(req.Path, "/cosmos.tx.v1beta1.Service") {
// init simple client context
amino := codec.NewLegacyAmino()
std.RegisterLegacyAminoCodec(amino)
1 change: 1 addition & 0 deletions server/v2/cometbft/server.go
Original file line number Diff line number Diff line change
@@ -192,6 +192,7 @@ func New[T transaction.Tx](
addrPeerFilter: srv.serverOptions.AddrPeerFilter,
idPeerFilter: srv.serverOptions.IdPeerFilter,
cfgMap: cfg,
consensusAddressCodec: consensusAddressCodec,
}

c.optimisticExec = oe.NewOptimisticExecution(