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 <hieuvubk@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot] 2024-11-05 09:34:57 +01:00 committed by GitHub
parent 5bb5c457b0
commit d67d6a275b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 6 deletions

View File

@ -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.

View File

@ -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

View File

@ -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=