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

Host chain doesn't account for multiple controller chains using overlapping namespace #767

Closed
5 tasks
colin-axner opened this issue Jan 19, 2022 · 10 comments
Closed
5 tasks
Assignees
Labels
27-interchain-accounts type: bug Something isn't working as expected

Comments

@colin-axner
Copy link
Contributor

Summary

The host chain currently assumes that the controller port ID is unique amongst all its connected chains. This is immediately evident when viewing its setting of the interchain account. It uses only the controller port as the key. Thus two controller chains using the same format to generate the port address will collide. This seems highly probable as chains will likely reuse the same ICA auth modules.

Previously the connection sequences were included in the portID thus making this assumption okay since a chains binded ports must be unique. Thus, there would never be two ownerA ports on connection 0. But there may be ownerA on connection 0 and ownerA on connection 1.

Problem Definition

The interchain account mapping on the host chain uses the controller port as the key. Controller ports are a prefix and account owner address. There is no uniqueness properties in the controller ports anymore.

Proposal

We should use either the connection sequence or channel sequence in the key for the interchain account address mapping. Since we still have the active channel mapping, I think it makes sense to use the connection sequence, otherwise you'd need to migrate the mapping when opening a new active channel. You'd also need to account for the channelID in ICA address generation. It is possible a channel is created on the controller chain which will never become an active channel (but the current controller handshake code might create an interchain account anyways). I don't think we need the controller chain connection sequence?

Action items (separate pr's):

  • use the host chain connection sequence in the ica address mapping (key is now connectionSeq/controllerPort) + test cases
  • use host chain connection sequence when generating ica address + test cases

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@colin-axner colin-axner added the type: bug Something isn't working as expected label Jan 19, 2022
@colin-axner colin-axner added this to the Interchain Accounts milestone Jan 19, 2022
@crodriguezvega crodriguezvega moved this to Todo in ibc-go Jan 19, 2022
@AdityaSripal
Copy link
Member

Nice catch, until we use ORDERED channels that don't close on timeout, I think we'll need to use the connection sequence as you mentioned.

@seantking
Copy link
Contributor

Yeah good catch, makes sense to me. Agree with the proposal.

@colin-axner
Copy link
Contributor Author

We need this for the active channel mapping (on the host chain)? Since the controller port is only unique from the perspective of the controller chain

@damiannolan
Copy link
Contributor

Do we need this for the active channel mapping on the controller chain also? In the scenario where one owner account wants to control interchain accounts on multiple different hosts chains. If we key active channel ID by the port ID then we risk overwriting, right?

@colin-axner
Copy link
Contributor Author

That's an interesting point. Thoughts @AdityaSripal?

So we could allow multiple active channels connected to a single port on the controller channel (so long as they use different connections)

Or we could force ica auth modules to create a new owner address taking into account the connection sequence

@damiannolan
Copy link
Contributor

damiannolan commented Jan 26, 2022

Or we could force ica auth modules to create a new owner address taking into account the connection sequence

Maybe this is the best approach. After taking a second look, controllers cannot reuse the same owner account as it will fail when checking if the port is bound.

This makes my last point re. active channel overwriting void. But it does raise the question on whether or not an account owner should, or shouldn't be allowed to reuse the same account address for different interchain accounts on separate hosts.

@seantking
Copy link
Contributor

Maybe this is the best approach. After taking a second look, controllers cannot reuse the same owner account as it will fail when checking if the port is bound

Damn, this was a pretty big oversight by us. In hindsight, I do remember now that I put the connection seq in the portID for this very reason.

I think we need to be very careful here with regards to dev UX on the ica-auth side of things.

@seantking
Copy link
Contributor

But it does raise the question on whether or not an account owner should, or shouldn't be allowed to reuse the same account address for different interchain accounts on separate hosts

This loops back around to the owner-account model not being entirely clear in the first place. But in terms of what we set out to build with ics27 so far, an owner-account should absolutely be able to own separate ICA accounts across different host chains. In practice, there's nothing stopping this from still being the case as at the end of the day it's just an arbitrary string, but we'll need to document/specify this better if we expect devs to workout around this limitation.

IMO it's partly a documentation/spec issue & also a conversation around how much we expect an ica-auth dev to handle themselves vs how much we bake into ICA out of the box with regards to owning accounts.

@damiannolan damiannolan moved this from Todo to In progress in ibc-go Jan 26, 2022
@AdityaSripal
Copy link
Member

AdityaSripal commented Jan 26, 2022

I think we definitely want a single controller address to control host addresses on multiple host chains. We should not change that ability.

Or we could force ica auth modules to create a new owner address taking into account the connection sequence

If we do this, this is basically the old architecture but forcing ica-auth devs to handle it instead of handling it internally. I'd rather abstract that into ICA if it is going to be necessary.

What does seem weird is that we are creating a unique port for each (owner address, connection sequence) tuple. This is unnecessary. Perhaps we can just create a unique port for each owner address, and then only bind port once. But once it is bound for that controller, we can reuse that port to open channels on different connections without a problem.
Note: This will require a new check in the controller code that we only open a single channel for an owner address on the same connection since that will no longer be automatically checked. I believe this will also affect the reopening logic since we need to ensure that reopening on a port is only allowed if the active channel for that connection is CLOSED.

I think the above is a viable option. But I think this issue underscores how much workaround is necessary given that timeouts close ORDERED channels. How much resistance is there to getting ORDERED_NO_TIMEOUT channels in and just removing all this complexity?

@damiannolan
Copy link
Contributor

Closed by #807 #790 #791

Repository owner moved this from In review to Done in ibc-go Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
27-interchain-accounts type: bug Something isn't working as expected
Projects
Archived in project
Development

No branches or pull requests

5 participants