From d67d6a275bfa59eb939951adeb0702094e45ce77 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:34:57 +0100 Subject: [PATCH] refactor(serevr/v2/cometbft): update `RegisterQueryHandlers` and GRPC queries (backport #22403) (#22429) Co-authored-by: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Co-authored-by: Hieu Vu Co-authored-by: Julien Robert --- server/v2/cometbft/abci.go | 9 ++++++--- simapp/v2/go.mod | 2 +- simapp/v2/go.sum | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index 5daf0c1030..45a5be69da 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -259,12 +259,15 @@ func (c *Consensus[T]) maybeRunGRPCQuery(ctx context.Context, req *abci.QueryReq return nil, false, err } + var handlerFullName string md, isGRPC := desc.(protoreflect.MethodDescriptor) if !isGRPC { - return nil, false, nil + handlerFullName = string(desc.FullName()) + } else { + handlerFullName = string(md.Input().FullName()) } - handler, found := c.queryHandlersMap[string(md.Input().FullName())] + handler, found := c.queryHandlersMap[handlerFullName] if !found { return nil, true, fmt.Errorf("no query handler found for %s", req.Path) } @@ -282,7 +285,7 @@ func (c *Consensus[T]) maybeRunGRPCQuery(ctx context.Context, req *abci.QueryReq } resp, err = queryResponse(res, req.Height) - return resp, isGRPC, err + return resp, true, err } // InitChain implements types.Application. diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index d1b94fc52f..c67aff6e13 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -10,7 +10,7 @@ require ( cosmossdk.io/depinject v1.0.0 cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/runtime/v2 v2.0.0-20241104160456-3ba4661dc7cf // main + cosmossdk.io/runtime/v2 v2.0.0-20241105073932-55f7cfcebae4 // main cosmossdk.io/server/v2 v2.0.0-20241104160456-3ba4661dc7cf // main cosmossdk.io/server/v2/cometbft v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-20241017091405-f01baf302e2b // main diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index ce58dbe102..39c264ef60 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -210,8 +210,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/runtime/v2 v2.0.0-20241104160456-3ba4661dc7cf h1:Bvc69clDtE3k5dkE4wijo+QpmfEM3Quc/NqRowR2lbY= -cosmossdk.io/runtime/v2 v2.0.0-20241104160456-3ba4661dc7cf/go.mod h1:SCdBCUiZGKVFNUvglrCUontMZSoXAES5iMbRvPv8bsI= +cosmossdk.io/runtime/v2 v2.0.0-20241105073932-55f7cfcebae4 h1:uo4LBzsp1bIZ3rBUyo1V0ON7WMhQ50+HtcLPwgABQLQ= +cosmossdk.io/runtime/v2 v2.0.0-20241105073932-55f7cfcebae4/go.mod h1:SCdBCUiZGKVFNUvglrCUontMZSoXAES5iMbRvPv8bsI= cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac h1:3joNZZWZ3k7fMsrBDL1ktuQ2xQwYLZOaDhkruadDFmc= cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= cosmossdk.io/server/v2 v2.0.0-20241104160456-3ba4661dc7cf h1:UbuLoAN6+31O50i4zyfYM9pu4aZDQIda5PPYStuGq3A=