-
Notifications
You must be signed in to change notification settings - Fork 616
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
chore: pull out get light client module to helper methods #6712
chore: pull out get light client module to helper methods #6712
Conversation
I was thinking that it might be worth to have feature branch for this, if it's going to span multiple PRs. We have still the benefit of reviewing smaller PRs, but at the same time we also have another opportunity to review how each piece fits together when reviewing the feature branch. What do you think? |
Yeah, happy to do that! I will create a feature branch and target that one instead :) Edit: done! |
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.
I'd say that it makes sense to also do the IsAllowedClient
check in the other functions...
Quality Gate passed for 'ibc-go'Issues Measures |
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.
Trying to continue the work of Gjermund while he is away...
@@ -89,7 +89,7 @@ func (ClientState) VerifyMembership( | |||
} | |||
|
|||
// The commitment prefix (eg: "ibc") is omitted when operating on the core IBC store | |||
bz := store.Get([]byte(merklePath.KeyPath[1])) | |||
bz := store.Get(merklePath.KeyPath[1]) |
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.
Linter was complaining about this.
clientModule, found := k.router.GetRoute(clientID) | ||
if !found { | ||
return errorsmod.Wrap(types.ErrRouteNotFound, clientID) | ||
clientModule, err := k.getLightClientModule(ctx, clientID) |
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.
I had to leave the parsing of the client ID above, because the client type is used in the telemetry below. Same thing in UpdateClient
. If somebody has a proposal to get rid of it (since it is also done in getLightClientModule
), I'm all ears.
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 also think it makes sense to include the IsAllowed check anywhere we are fetching the client module.
92b6c86
into
feat/refactor-client-route-to-verify
…ient keeper (#6760) * chore: pull out get light client module to helper methods (#6712) * 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]> * add verify(non)membership functions to client keeper and removed route from interface * delete file * use VerifyMembershipProof function name until #6775 * Update modules/core/02-client/keeper/keeper.go Co-authored-by: DimitrisJim <[email protected]> --------- Co-authored-by: Gjermund Garaba <[email protected]> Co-authored-by: DimitrisJim <[email protected]>
* chore: pull out get light client module to helper methods (#6712) * 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]> * add verify(non)membership functions to client keeper and removed route from interface * delete file * refactor: unexported grpc queryServer struct for 02-client * refactor: use queryServer struct for 03-connection handlers * refactor: 04-channel query server * refactor: more query server refactoring * refactor: rm top level query server interface * chore: update interface type assertions * chore: add changelog and migration docs * chore: linter * Update docs/docs/05-migrations/13-v8-to-v9.md * chore: update godocs on submodule query servers --------- Co-authored-by: Gjermund Garaba <[email protected]> Co-authored-by: Carlos Rodriguez <[email protected]>
Description
Start of #6019
In order to keep the PRs for this task a little more digestible, I wanted to do this small refactor first.
And I wanted to ask if I should also use the helper method in other places where we currently do not do any
if !k.GetParams(ctx).IsAllowedClient(clientType)
checks.The places I have identified that currently gets the route, but does not run
IsAllowedClient
:ibc-go/modules/core/02-client/keeper/keeper.go
Lines 307 to 314 in dd23cf9
ibc-go/modules/core/02-client/keeper/keeper.go
Lines 395 to 411 in dd23cf9
ibc-go/modules/core/02-client/keeper/keeper.go
Lines 415 to 436 in dd23cf9
ibc-go/modules/core/02-client/keeper/client.go
Lines 63 to 121 in dd23cf9
Should they also do this?
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.