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

Propose changes on ica host and ica controller #1238

Closed
catShaark opened this issue Apr 11, 2022 · 8 comments
Closed

Propose changes on ica host and ica controller #1238

catShaark opened this issue Apr 11, 2022 · 8 comments
Labels
27-interchain-accounts needs discussion Issues that need discussion before they can be worked on

Comments

@catShaark
Copy link
Contributor

Problem

So for now ica host module can only connect ica controller module . I know this is intended for some reason, but I think that constrain limit custom logic for other ibc module, such as wasmd. In order to use ica, wasmd keeper must has ica controller keeper in it so that wasmd can call RegisterInterchainAccount, we also have to put wasmd IBCHandler into ica controller middleware. Those changes causes many inconvenient as wasmd can't do ica directly on their ibc port id.

What if there're many ibc modules who want to use ica. Will there be some sort of another middleware that packs all those ibc module's IBCHandler into one and then also comes a router to route each ica packet ack to the correct IBCHandler. I think this is too many step.

Why don't we make it like the transfer module so that the counterparty module or the counterparty port id can be whatever it is. As long as the handshake conforms to the protocol defined by host ( ordered channel, metadata defined in version... ), I don't see any security issues AFAIK. This way, we get rid of many complication cause by using a middleware and open for many cool custom ibc logic.

Proposal

My suggestion is that we remove the validation of counterpartyPortID in ica host handshake . By doing so, we basically remove the hard tie between ica controller and ica host. Because of that, ica controller should be moved from ica to another module. I propose we combine ica controller with inter tx to make a new module with complete logic ( with msg server and tx cli ) for an ica application.

@catShaark
Copy link
Contributor Author

I know this is a bold proposal and this might be dumb since you guys must have a reason for those choice of design for ica that I haven't understood yet, so I'd love to hear it from you guys.

@colin-axner
Copy link
Contributor

I think trying to split off the controller module into it's own module will cause a lot of unforeseen issues. Particularly around duplicate registration as the SDK assumes only one unique module (I'm guessing the protobuf generation would cause a lot of issues)

Regardless, this is a hefty change to be made. It requires migrating existing state into a new SDK module. What is the exact issue with the current structure? It should be possible to use only the host or the controller module when desired.

The ica controller is intentionally isolated from inter tx because it can be reused for any number of ICA auth modules, furthermore inter tx is not intended for production usage. It is a demo module

@crodriguezvega crodriguezvega added needs discussion Issues that need discussion before they can be worked on 27-interchain-accounts labels Apr 14, 2022
@catShaark
Copy link
Contributor Author

catShaark commented Apr 17, 2022

Sorry for the late response

I think trying to split off the controller module into it's own module will cause a lot of unforeseen issues. Particularly around duplicate registration as the SDK assumes only one unique module (I'm guessing the protobuf generation would cause a lot of issues)

U mean the module registration? . Yes I agree with you that moving it will leaves us a lot of works to do.

What is the exact issue with the current structure? It should be possible to use only the host or the controller module when desired.

So in my opinion, the exact issues with the current structure is :

  1. The controller module's middleware can only take in one porttypes.IBCModule so if for example wasmd already put in its IBCHandler, then that leaves no place for other modules to include their logic into ica controller. We should fix this ?

  2. Ica host uses counterpartyPortID and connectionID to validate ica message's signer. If we enforce security for ica based on counterpartyPortID and connectionID, why only allow counterpartyPortID with controller- prefix. This restricts the logic for other modules that want to use ica ( like wasmd can't use their native smart contract's portID for ica, unlike transfer where they can use their native smart contract's portID ). And this constraint doesn't make the ica protocol any more secure.

@catShaark
Copy link
Contributor Author

catShaark commented Apr 20, 2022

On second thought about this issue, I think we don't need to move ica controller to its own module. We can just simply remove the counterPartyPortID prefix validation in ica host's handshake. We should also do something so that ica controller's middleware takes in many porttypes.IBCModule instead of just one porttypes.IBCModule. That's what I propose.

@catShaark catShaark changed the title Move ica controller from ica module to a new module Propose changes on ica host and ica controller Apr 20, 2022
@crodriguezvega
Copy link
Contributor

crodriguezvega commented Jun 3, 2022

Hi @catShaark. I think you are right that it should be possible for more that one authentication module to be able to use the ICA controller functionality. Just thinking out loud here... Would it be possible to enable that if it was possible to instantiate multiple icacontrollerkeeper.NewKeepers?

And do you mind to elaborate a bit more why we would need to remove the counterparty.PortId prefix validation in ICA host's OnChanOpenTry.

@catShaark
Copy link
Contributor Author

Hi @catShaark. I think you are right that it should be possible for more that one authentication module to be able to use the ICA controller functionality. Just thinking out loud here... Would it be possible to enable that if it was possible to instantiate multiple icacontrollerkeeper.NewKeepers?

Hi @crodriguezvega, I just read the code again and I think you're right that it's possible for more than one authentication module to use the ICA controller functionality with the current ICA logic. Back then when I made this issue, I haven't thought it through 😮‍💨 . Tho, I think we don't need to create many icacontrollerkeeper but instead we need to make many icacontroller.NewIBCMiddleware.

@catShaark
Copy link
Contributor Author

catShaark commented Jun 4, 2022

And do you mind to elaborate a bit more why we would need to remove the counterparty.PortId prefix validation in ICA host's OnChanOpenTry.

I considered removing the counterparty.PortId prefix validation when I looked at how wasm handle ibc transfer for a contract's token. We can use the native wasm.contract_address port of that contract for the contract's ibc transfer channel. Now compare to the case of contract's ica channel, we might have to create a new port like icacontroller-wasm.smart_contract_address so that it passes the prefix validation, I just don't think there's any benefit of doing this other than enforcing that the counterparty module must be ica controller module. If the transfer module doesn't require the counterparty module to be transfer module, maybe the ica host module shouldn't require the counterparty module to be ica controller module either

That's my reasoning. Any how, I'm not so against the port prefix validation now. If you guys want to enforce strict rules for the protocol more than allow free custom logic, that's understandable.

@crodriguezvega
Copy link
Contributor

Hi @catShaark. Sorry for not replying earlier, but, as you may have already seen, we are going to remove the validation of the controller prefix on the host chain. Thanks a lot for suggesting this! I will close this issue for now and we will track the change on #2580.

CosmosCar pushed a commit to caelus-labs/ibc-go that referenced this issue Nov 6, 2023
…s#1238)

Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from
1.16.0 to 1.17.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/spf13/viper/releases">github.com/spf13/viper's
releases</a>.</em></p>
<blockquote>
<h2>v1.17.0</h2>
<h2>Major changes</h2>
<p>Highlighting some of the changes for better visibility.</p>
<p>Please share your feedback in the Discussion forum. Thanks! ❤️</p>
<h3>Minimum Go version: 1.19</h3>
<p>Viper now requires Go 1.19</p>
<p>This change ensures we can stay up to date with modern practices and
dependencies.</p>
<h3><code>log/slog</code> support <strong>[BREAKING]</strong></h3>
<p>Viper <a
href="https://github.com/spf13/viper/releases/tag/v1.11.0">v1.11.0</a>
added an experimental <code>Logger</code> interface to allow custom
implementations (besides <a
href="https://github.com/spf13/jwalterweatherman">jwalterweatherman</a>).</p>
<p>In addition, it also exposed an experimental <code>WithLogger</code>
function allowing to set a custom logger.</p>
<p>This release deprecates that interface in favor of <a
href="https://pkg.go.dev/log/slog">log/slog</a> released in Go 1.21.</p>
<blockquote>
<p>[!WARNING]
<code>WithLogger</code> accepts an <a
href="https://pkg.go.dev/log/slog#Logger">*slog.Logger</a> from now
on.</p>
</blockquote>
<p>To preserve backwards compatibility with older Go versions, prior to
Go 1.21 Viper accepts a <a
href="https://pkg.go.dev/golang.org/x/exp/slog#Logger">*golang.org/x/exp/slog.Logger</a>.</p>
<p>The experimental flag is removed.</p>
<h3>New finder implementation <strong>[BREAKING]</strong></h3>
<p>As of this release, Viper uses a new library to look for files,
called <a
href="https://github.com/sagikazarmark/locafero">locafero</a>.</p>
<p>The new library is better covered by tests and has been built from
scratch as a general purpose file finder library.</p>
<p>The implementation is experimental and is hidden behind a
<code>finder</code> build tag.</p>
<blockquote>
<p>[!WARNING]
The <code>io/fs</code> based implementation (that used to be hidden
behind a <code>finder</code> build tag) has been removed.</p>
</blockquote>
<h2>What's Changed</h2>
<h3>Exciting New Features 🎉</h3>
<ul>
<li>Add NATS support by <a
href="https://github.com/hooksie1"><code>@​hooksie1</code></a> in <a
href="https://redirect.github.com/spf13/viper/pull/1590">spf13/viper#1590</a></li>
<li>Add slog support by <a
href="https://github.com/sagikazarmark"><code>@​sagikazarmark</code></a>
in <a
href="https://redirect.github.com/spf13/viper/pull/1627">spf13/viper#1627</a></li>
</ul>
<h3>Enhancements 🚀</h3>
<ul>
<li>chore: add local development environment using nix by <a
href="https://github.com/sagikazarmark"><code>@​sagikazarmark</code></a>
in <a
href="https://redirect.github.com/spf13/viper/pull/1572">spf13/viper#1572</a></li>
<li>feat: add func GetEnvPrefix by <a
href="https://github.com/baruchiro"><code>@​baruchiro</code></a> in <a
href="https://redirect.github.com/spf13/viper/pull/1565">spf13/viper#1565</a></li>
<li>Improve dev env by <a
href="https://github.com/sagikazarmark"><code>@​sagikazarmark</code></a>
in <a
href="https://redirect.github.com/spf13/viper/pull/1575">spf13/viper#1575</a></li>
<li>fix: code optimization by <a
href="https://github.com/testwill"><code>@​testwill</code></a> in <a
href="https://redirect.github.com/spf13/viper/pull/1557">spf13/viper#1557</a></li>
<li>test: remove not needed testutil.Setenv by <a
href="https://github.com/alexandear"><code>@​alexandear</code></a> in <a
href="https://redirect.github.com/spf13/viper/pull/1610">spf13/viper#1610</a></li>
<li>new finder library based on afero by <a
href="https://github.com/sagikazarmark"><code>@​sagikazarmark</code></a>
in <a
href="https://redirect.github.com/spf13/viper/pull/1625">spf13/viper#1625</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/spf13/viper/commit/f62f86a84b8395051efe0e490a29f3f89830a3ed"><code>f62f86a</code></a>
refactor: make use of <code>strings.Cut</code></li>
<li><a
href="https://github.com/spf13/viper/commit/94632fa21e01819de78bf0c931eb3cbdd1d426b4"><code>94632fa</code></a>
chore: Use pip3 explicitly to install yamllint</li>
<li><a
href="https://github.com/spf13/viper/commit/3f6cadcbeb9f193f8483c9edf6c6114ca7a20056"><code>3f6cadc</code></a>
chore: Fix copy-paste error for yamllint target</li>
<li><a
href="https://github.com/spf13/viper/commit/287507c0b5a13320f9b616e458ab7f3aadab1603"><code>287507c</code></a>
docs: add set subset KV example</li>
<li><a
href="https://github.com/spf13/viper/commit/f1cb2262bbda4cc549e617f41ba963409f23871c"><code>f1cb226</code></a>
chore(deps): update crypt</li>
<li><a
href="https://github.com/spf13/viper/commit/c292b55050aadcf08f9094033eb14d241f5002c5"><code>c292b55</code></a>
test: refactor asserts</li>
<li><a
href="https://github.com/spf13/viper/commit/3d006fe361ca4ea1ec973e39ce40f98aa3d2f2c9"><code>3d006fe</code></a>
refactor: replace interface{} with any</li>
<li><a
href="https://github.com/spf13/viper/commit/8a6dc5d43ce8b58288ec5b1db9ce83ab32580549"><code>8a6dc5d</code></a>
build(deps): bump github/codeql-action from 2.21.8 to 2.21.9</li>
<li><a
href="https://github.com/spf13/viper/commit/96c5c0083fb4a0e42282fbf04b626ca6792d8885"><code>96c5c00</code></a>
chore: remove deprecated build tags</li>
<li><a
href="https://github.com/spf13/viper/commit/44911d2cacff57448929c13f7346a1ea6ab13591"><code>44911d2</code></a>
build(deps): bump github/codeql-action from 2.21.7 to 2.21.8</li>
<li>Additional commits viewable in <a
href="https://github.com/spf13/viper/compare/v1.16.0...v1.17.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/spf13/viper&package-manager=go_modules&previous-version=1.16.0&new-version=1.17.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
27-interchain-accounts needs discussion Issues that need discussion before they can be worked on
Projects
None yet
Development

No branches or pull requests

3 participants