Skip to content
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

imp: remove Route method in favour of Verify(Non)Membership on client keeper #6760

Merged
merged 6 commits into from
Jul 9, 2024

Conversation

crodriguezvega
Copy link
Contributor

Description

closes: #6019


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.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

gjermundgaraba and others added 2 commits July 3, 2024 21:44
* 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]>
Carlos Rodriguez added 2 commits July 3, 2024 22:49
# Conflicts:
#	modules/core/03-connection/keeper/verify.go
#	modules/light-clients/09-localhost/client_state.go
@crodriguezvega crodriguezvega added the priority PRs that need prompt reviews label Jul 8, 2024
@@ -16,7 +16,7 @@ type ClientKeeper interface {
GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool)
GetSelfConsensusState(ctx sdk.Context, height exported.Height) (exported.ConsensusState, error)
ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error
VerifyMembershipp(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte) error
VerifyMembershipProof(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte) error
VerifyNonMembership(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path) error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call this VerifyNonMembershipProof for now so that the names align?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we will (hopefully) rename the other one back to VerifyMembership before we release, I thought of keeping it just like this.

@DimitrisJim
Copy link
Contributor

assigned ya too Damian, feel free to remove if no bandwidth

Copy link
Contributor

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

modules/core/02-client/keeper/keeper.go Outdated Show resolved Hide resolved
Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @crodriguezvega! 🙏🏻

Comment on lines +497 to +507
if !k.GetParams(ctx).IsAllowedClient(clientType) {
return nil, errorsmod.Wrapf(
types.ErrInvalidClientType,
"client (%s) type %s is not in the allowed client list", clientID, clientType,
)
}

clientModule, found := k.router.GetRoute(clientID)
if !found {
return nil, errorsmod.Wrap(types.ErrRouteNotFound, clientID)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this params check could be moved into router.GetRoute().

We already parse the clientID in there, so the changes would be to accept a context and return and error rather than a boolean. I'd be in favour of doing this in a following PR. I can create an issue if others are onboard

Copy link
Contributor

@DimitrisJim DimitrisJim Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would this jive with registering them in app.go? Wouldn't you need to run extra logic when updating params just to register the newly allowed light client module?

Copy link

sonarcloud bot commented Jul 8, 2024

@crodriguezvega crodriguezvega added this pull request to the merge queue Jul 9, 2024
Merged via the queue into main with commit b62e7d4 Jul 9, 2024
79 of 82 checks passed
@crodriguezvega crodriguezvega deleted the feat/refactor-client-route-to-verify branch July 9, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority PRs that need prompt reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Route method in favour of Verify(Non)Membership on client keeper
4 participants