-
Notifications
You must be signed in to change notification settings - Fork 639
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
feat: adding InitChannel util function #534
Conversation
// Opens a new channel on a particular port given a connection | ||
// This is a helper function to open a new channel | ||
// in case of a channel closing and the controller chain needs to regain access to an interchain account on the host chain | ||
func (k Keeper) InitChannel(ctx sdk.Context, portID, connectionID string) error { |
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.
Not sure about the naming here. I would like some opinions on this.
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.
ReopenChannel? I'm not sure either, but I wouldn't want external users to start using InitChannel
in place of InitInterchainAccount
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, good point.
portID, _ = types.GeneratePortID(TestOwnerAddress, path.EndpointA.ConnectionID, path.EndpointA.Counterparty.ConnectionID) | ||
|
||
// bind port and claim capability | ||
cap := suite.chainA.GetSimApp().ICAKeeper.BindPort(suite.chainA.GetContext(), portID) |
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.
Also not entirely sure what the best method for testing this out is or how far we want to go with testing. I initially made a call to InitInterchainAccount
and finished the handshake, and then tried to call InitChannel
and finish a second handshake, but I ran into verification issues. This is probs overkill anyway.
Basically, I'm just binding the port fresh here and then checking that we can finish a handshake.
// finish the channel handshake | ||
|
||
// commit state changes for proof verification | ||
path.EndpointA.Chain.App.Commit() |
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.
maybe overkill finishing the handshake here?
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 have no strong preference, but might be better to split this off into its own test, ie one test doing table tests and another finishing the handshake in the happy case
Codecov Report
@@ Coverage Diff @@
## interchain-accounts #534 +/- ##
=======================================================
+ Coverage 79.10% 79.11% +0.01%
=======================================================
Files 134 134
Lines 10347 10354 +7
=======================================================
+ Hits 8185 8192 +7
Misses 1753 1753
Partials 409 409
|
@AdityaSripal @colin-axner @damiannolan I'm actually questioning now if this is even necessary at all and maybe should be removed from the spec as well. In the case that a channel closes, an ICA-auth module could just call the |
Hmm it seems like the way you have it here is the cleanest option. If you want to reopen the channel directly, you could do icaKeeper.channelKeeper.ChanOpenInit(...)
// callback doesn't get called by channelKeeper's ChanOpenInit function
// it gets called by the msg server
icaModule.OnChanOpenInit(...) But sending the message to IBC's msgserver, just abstracts the above lines for you since that is basically what the message server does. And it seems like easier maintanence to me, if core IBC ever refactors its message handling, then you don't have to reimplement the channel msg server function within ICA |
// Opens a new channel on a particular port given a connection | ||
// This is a helper function to open a new channel | ||
// in case of a channel closing and the controller chain needs to regain access to an interchain account on the host chain | ||
func (k Keeper) InitChannel(ctx sdk.Context, portID, connectionID string) error { |
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.
ReopenChannel? I'm not sure either, but I wouldn't want external users to start using InitChannel
in place of InitInterchainAccount
|
||
// Opens a new channel on a particular port given a connection | ||
// This is a helper function to open a new channel | ||
// in case of a channel closing and the controller chain needs to regain access to an interchain account on the host chain |
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.
godoc should begin with the name of the function
@@ -67,3 +68,74 @@ func (suite *KeeperTestSuite) TestInitInterchainAccount() { | |||
}) | |||
} | |||
} | |||
|
|||
func (suite *KeeperTestSuite) TestInitChannel() { |
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 should test that when a channel is closed and the portID is set to inactive, a new channel can be opened
// finish the channel handshake | ||
|
||
// commit state changes for proof verification | ||
path.EndpointA.Chain.App.Commit() |
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 have no strong preference, but might be better to split this off into its own test, ie one test doing table tests and another finishing the handshake in the happy case
@seantking I also question whether we need this. My hesitancy is that we don't fully understand when this might be needed. If the function is just creating a |
Not sure if this is feasible, but would there be any way of using the |
One point of consideration is that this change could be released in a minor release. Perhaps it is best to not add it for now and add it later if it becomes desirable? Relayers could always just send the MsgChanOpenInit themselves? |
Closing this for the now as we are deciding to leave this out of the API for the time being. @AdityaSripal We may want to remove this from the spec if we decide to leave it out of the release. |
Cleanup keeper result types
* WIP Provider interface * Add definitions to the txProvider and begin migration of cosmos specific logic to cosmos provider * get connection based msgs behind TxProvider * finish implementing TxProvider interface * WIP: implementing QueryProvider * finish implementing QueryProvider * Define and implement the KeyProvider interface * Merge PR cosmos#530: Config refactor to handle provider abstraction * WIP: refactor config for provider abstraction * bump gopkg.in/yaml from v2 to v3 * refactor config for provider abstraction * better var naming & doc tweaks * Merge PR cosmos#533: Refactor core relayer code to use provider interface * refactor cli based key management * refactor path cli based commands * testing new config * WIP: refactor chain cli based commands * delete dev and testnet cmds * Merge PR cosmos#534: State Based Relaying, Reenable tests, Add Osmosis to tests * Migrate https://github.com/strangelove-ventures/relayer/pull/35 to this PR * Merge PR cosmos#535: Working tests and Strategy removal * Add osmosis to supported chains for test env * Remove more stuff and add make test-short * Add build osmosis container make file * WIP: push everything behind provider interface * WIP: push everything behind provider interface pt 2 * WIP: swap out old function calls for new provider calls * IT'S ALIVE! (bug fix time) * Most tests working! 🎉🚀💯 * update filename for fetch tests Co-authored-by: Jack Zampolin <[email protected]> * Fix test race conditions * Add back makefile test targets Co-authored-by: jtieri <[email protected]>
…2.0 (cosmos#534) Bumps [nosborn/github-action-markdown-cli](https://github.com/nosborn/github-action-markdown-cli) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/nosborn/github-action-markdown-cli/releases) - [Commits](nosborn/github-action-markdown-cli@v3.1.0...v3.2.0) --- updated-dependencies: - dependency-name: nosborn/github-action-markdown-cli dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Description
Adding a helper function to open a new channel in the case that a channel closes. This is necessary so that a controller chain can regain access to an ICA.
closes: #509
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/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes