Use unexported types for core query servers #6775
Labels
core
gRPC
Issues for gRPC endpoints
needs discussion
Issues that need discussion before they can be worked on
type: refactor
Architecture, code or CI improvements that may or may not tackle technical debt.
Milestone
Summary
Introduce unexported types for core query servers in ibc-core:
Limit the api surface of each of the keepers belonging to core subpackages.
Add a private struct which embdeds the
Keeper
type, and moveQueryServer
interface methods to this type.Note, that this will have a knock on affect to how we register the query servers in the ibc core module.
As it exists today, the
IBCKeeper
implements every query servers throughcore/keeper/grpc_query.go
, with a passthrough function for every query handler. This file is unnecessary and could be removed. As a result, we may register query servers like below.Considerations
As mentioned above, the
IBCKeeper
currently implements everyQueryServer
interface of each subpackage in ibc core.The
QueryServer
interface in core/types, composes each of the subpackageQueryServer
s into one interface.This interface is composed by the
TestChain
in ibctesting, where theIBCKeeper
is passed the concrete implementation.If the
grpc_query.go
file is removed this will break that abstraction. However, we can explore alternative options when working on this issue. It may be possible to still include some facade pattern struct to provide access to these query handlers.The
QueryServer
s can still be created on demand by passing the respective subpackageKeeper
to the public constructor function. E.g.clientkeeper.NewQueryServer
For Admin Use
The text was updated successfully, but these errors were encountered: