Conversation
| } | ||
|
|
||
| switch { | ||
| case k.portKeeper.IsBound(ctx, portID) && !k.hasCapability(ctx, portID): |
There was a problem hiding this comment.
This case basically says - if a a capability exists (port is bound) with core ibc, but not claimed by the ica app, then return an error. This is essentially unreachable code, unless someone has wired a code path into the chain to allow icacontroller- port ids to be created with the core ibc scoped keeper.
| switch { | ||
| case k.portKeeper.IsBound(ctx, portID) && !k.hasCapability(ctx, portID): | ||
| return "", errorsmod.Wrapf(icatypes.ErrPortAlreadyBound, "another module has claimed capability for and bound port with portID: %s", portID) | ||
| case !k.portKeeper.IsBound(ctx, portID): |
There was a problem hiding this comment.
This case is - if no capability exists (port bound) for port id in core ibc's scoped keeper, then;
- Set port: this was previously used for genesis exports such that we can recreate ports on a genesis restart, unclear if we still actually need this for ica as ports are assumed to be in the format
icacontroller-. Unlike transfer where we set the port because it could be modified by devs to e.g. "ibc-transfer" (unclear if there is assumptions in other places that it must just be "transfer"). - Create a new capability via
BindPortusing ibc core's scoped keeper. This creates a capability and adds "ibc" as an owner. - Claim the capability using the ica scoped keeper. This adds ica as the second owner
In scenarios where we open a new channel(after close) for an existing port id, then neither of these cases are hit and skip the entire switch statement.
chatton
left a comment
There was a problem hiding this comment.
LGTM thanks for looking into this one 🫡
bznein
left a comment
There was a problem hiding this comment.
Massive red diff, love it! Should we add something to the changelog too?
| github.com/cosmos/cosmos-proto v1.0.0-beta.5 | ||
| github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef | ||
| github.com/cosmos/gogoproto v1.7.0 | ||
| github.com/cosmos/ibc-go/modules/capability v1.0.1 |
|
colin-axner
left a comment
There was a problem hiding this comment.
🎉 finally! What a great simplification! ❤️



Description
closes: #XXXX
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.