chore (api)!: remove capabilities from channel handshakes#7232
Conversation
bznein
left a comment
There was a problem hiding this comment.
This PR is definitely bigger than expected. I'm happy to split it into separate PRs if needed.
However, most of the diff is from removing stuff (usages of LookupModule.., tests that rely on capabilities, and usage of capabilities within other tets)
I also added as many comments to the PR as possible, to make review easier :)
| "success", func() {}, nil, | ||
| }, | ||
| { | ||
| "ICA auth module does not claim channel capability", func() { |
There was a problem hiding this comment.
Capability-related test. No longer needed
|
|
||
| // modify connA versions to only support UNORDERED channels | ||
| path.EndpointA.UpdateConnection(func(c *connectiontypes.ConnectionEnd) { | ||
| // modify connB versions to only support UNORDERED channels |
| // trigger upgradeInit on B which will bump the counterparty upgrade sequence. | ||
| path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion | ||
| err := path.EndpointB.ChanUpgradeInit() | ||
| path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion |
| // whether or not the route is present. | ||
| func (k *Keeper) Route(module string) (types.IBCModule, bool) { | ||
| return k.Router.GetRoute(module) | ||
| routes, ok := k.Router.GetRoute(module) |
There was a problem hiding this comment.
This is basically the same as https://github.com/cosmos/ibc-go/pull/7009/files#r1700067369, with the added function "Keys" (and the underlying Keys() in router.go)
| @@ -193,32 +193,24 @@ func (k *Keeper) ConnectionOpenConfirm(goCtx context.Context, msg *connectiontyp | |||
| func (k *Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgChannelOpenInit) (*channeltypes.MsgChannelOpenInitResponse, error) { | |||
There was a problem hiding this comment.
This is probably the file with most changes. They can be quite easily summarized as follows:
- For each method that uses capability:
- Remove usages of
LookupModule...and replace with direct call to the (now changed)Routemethod. - Since we do not get the capability anymore from the function above, remove it as an argument to underlying functions
- Remove usages of
|
Note: I haven't run E2E tests yet, and I need to open the PR for review for that. If anything fails, I'll mark the PR as not ready :) Edit: everything is Green!!! |
| return "", err | ||
| } | ||
|
|
||
| if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { |
There was a problem hiding this comment.
is this Path func in host in use anymore after this PR?
There was a problem hiding this comment.
Undirectly in a lot of test cases. I plan to remove them as followup
| capName := host.ChannelCapabilityPath(packet.GetDestPort(), packet.GetDestChannel()) | ||
| if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, capName) { | ||
| return "", errorsmod.Wrapf( | ||
| types.ErrInvalidChannelCapability, |
There was a problem hiding this comment.
Which one do you mean exactly? If it is AuthenticateCapability (the definition of the method itself), I'd like to do that as followup as well
There was a problem hiding this comment.
(or did you mean the error type? same answer anyway :) )
There was a problem hiding this comment.
sgtm! just worried that a lot of these public symbols don't get caught by linters so would be nice to keep track of them. A grep for Capability in the end might do the trick though!
| capName := host.ChannelCapabilityPath(packet.GetSourcePort(), packet.GetSourceChannel()) | ||
| if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, capName) { | ||
| return errorsmod.Wrapf( | ||
| types.ErrChannelCapabilityNotFound, |
| suite.Require().NoError(err) | ||
|
|
||
| cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) | ||
| cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) |
There was a problem hiding this comment.
not from your changes, but I think the test might have been incorrect. I feel like this should be EndpointB
There was a problem hiding this comment.
Uhm, it is EndpointB. Did you mean A?
| // whether or not the route is present. | ||
| func (k *Keeper) Route(module string) (types.IBCModule, bool) { | ||
| return k.Router.GetRoute(module) | ||
| routes, ok := k.Router.GetRoute(module) |
There was a problem hiding this comment.
we can probably rename this back to route
There was a problem hiding this comment.
haha I meant the var routes but all good
colin-axner
left a comment
There was a problem hiding this comment.
Amazing 🙌 thank you @bznein! I appreciate you doing this seemingly tedious work (twice!). It makes me quite happy to see over 800 lines of red code 😄
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
chatton
left a comment
There was a problem hiding this comment.
LGTM! Thank you so much for doing this clean up!
DimitrisJim
left a comment
There was a problem hiding this comment.
thats what I call a sweet diff. thanks much for clean up!
|



Description
ref: #7107
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/).godoccomments.Files changedin the GitHub PR explorer.SonarCloud Reportin the comment section below once CI passes.