-
Notifications
You must be signed in to change notification settings - Fork 628
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: use unexported types for core query servers #6794
Conversation
* chore: pull out get light client module to helper methods * another place to use getLightClientModuleRoute * use getLightClientModule in other 02-client functions * lint --------- Co-authored-by: Carlos Rodriguez <[email protected]>
# Conflicts: # modules/core/03-connection/keeper/verify.go # modules/light-clients/09-localhost/client_state.go
@@ -150,7 +148,6 @@ func NewTestChainWithValSet(tb testing.TB, coord *Coordinator, chainID string, v | |||
ChainID: chainID, | |||
App: app, | |||
ProposedHeader: header, | |||
QueryServer: app.GetIBCKeeper(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason why you didn't want to keep this with keeper.NewQueryServer(app.GetIBCKeeper().ChannelKeeper)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query server is the interface that was previously defined in core/types
which I removed in this PR.
It was the union of all core query servers.
type QueryServer interface {
clienttypes.QueryServer
connectiontypes.QueryServer
channeltypes.QueryServer
}
I'm not sure this provides a tonne of value and each submodule query server can be created on demand since the sub keepers are public on the ibc core keeper.
If folks feel strongly about keeping this type for testing purposes then I would suggest moving this to the testing
pkg, which would still require creating a struct to passthrough to each submodule query server. Similar to what was removed in core/keeper/grpc_query.go
in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. I don't feel strongly about it tbh, was mostly curious about the thinking, but it makes sense! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the query server was added to the testing chain struct for testing grpcs. Given that the individual query server is created as necessary in the grpc tests, I agree it makes sense to remove. It also didn't contain all the queries available on the chain (non core ibc queries) so it might have led to confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to get this done! LGTM! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, I guess we should also add a note to changelog for this?
should we open follow up issues for apps?
res, err := suite.chainA.QueryServer.ClientState(ctx, req) | ||
|
||
queryServer := keeper.NewQueryServer(suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) | ||
res, err := queryServer.ClientState(ctx, req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these could also be defined on a ClientQuerierTestSuite
to further separate. Probably could also init the querier in the setup to avoid needing to call new in each test. Nice for follow up if people agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's a nice idea 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice bit of cleanup
Quality Gate passed for 'ibc-go'Issues Measures |
Description
Refactors the query servers in core to use unexported/private
queryServer
structs.Removes the core/types
QueryServer
top level interface.closes: #6775
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
).godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.