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

Dynamic capability & routing implementation #5542

Closed
fedekunze opened this issue Jan 21, 2020 · 9 comments
Closed

Dynamic capability & routing implementation #5542

fedekunze opened this issue Jan 21, 2020 · 9 comments
Assignees

Comments

@fedekunze
Copy link
Collaborator

fedekunze commented Jan 21, 2020

  • Implement ADR03 - Dynamic capability store.
  • Fix routing.
    Apparently we assume that ModuleName == PortName in MsgPacket, this is just wrong. Instead we need a routing table mapping port owners to module names.
@cwgoes
Copy link
Contributor

cwgoes commented Mar 17, 2020

@alexanderbez Are you interested in working on this 🙏 ?

@cwgoes cwgoes modified the milestones: IBC 1.0, IBC GoZ Readiness Mar 17, 2020
@cwgoes cwgoes changed the title ADR 03 Implementation Dynamic capability & routing implementation Mar 17, 2020
@alexanderbez
Copy link
Contributor

@cwgoes yes. WRT to routing, is it enough to pass a router to the IBC module that handles package/msg route to module message handler?

@cwgoes
Copy link
Contributor

cwgoes commented Mar 17, 2020

We could architect it that way, I don't have a strong preference. The important part is simply that IBC packets get routed to the module which owns the port to which the packet is addressed.

@cwgoes
Copy link
Contributor

cwgoes commented Mar 23, 2020

After #5828 the next step is to update x/ibc to use the dynamic capability keeper in accordance with the spec, and add a routing mechanism as described above - perhaps @AdityaSripal can help with that - I'll also try to clarify the spec a bit with respect to the ADR 3 API.

@cwgoes
Copy link
Contributor

cwgoes commented Mar 27, 2020

Basic routing mechanism:

  • The SDK needs to implement channel handshake callbacks as per ICS 26 (and see usage example in ICS 20) that allow modules to run code during the handshake process, negotiate versions, and claim channel capabilities. Initial routing for ChanOpenInit and ChanOpenTry must be based on which module owns the port capability to which the channel is being opened, while routing for ChanOpenAck and ChanOpenConfirm must be based on which module owns the channel capability (which was created during one of the first two steps). Modules must store the channel capability under an appropriate name so that they can look it up automatically (e.g. based on the channel & port identifier) - if they do this, no user interaction should be required, the relayer should be able to send all the transactions as it does currently.
  • The SDK needs to implement an IBC-specific router which will route packets to the module which owns the channel capability associated with the channel & port to which the packet is addressed. Technically, the way the spec is written, if multiple modules own a channel capability, they should all be able to send & receive packets on the channel, but we can safely assume that only one module will own the channel capability for now.

If we do want to implement support for multi-owner capability routing, either the call pattern has to be reversed (modules have to call into the IBC handler, rather than vice versa), or we need to implement some way for a module which is one (of many) owners of a capability to claim the "routing slot", which is singular. I don't think present use cases require this, though (dynamic IBC does not require this, at least not at the moment).

@alexanderbez
Copy link
Contributor

Can we go with the simpler approach of routing to a single module while we design a cleaner approach for multi-owner/module routing?

@cwgoes
Copy link
Contributor

cwgoes commented Mar 27, 2020

Can we go with the simpler approach of routing to a single module while we design a cleaner approach for multi-owner/module routing?

I think that's fine for the time being.

@AdityaSripal
Copy link
Member

The SDK needs to implement an IBC-specific router which will route packets to the module which owns the channel capability associated with the channel & port to which the packet is addressed. Technically, the way the spec is written, if multiple modules own a channel capability, they should all be able to send & receive packets on the channel, but we can safely assume that only one module will own the channel capability for now.

Currently because single owner ports can't be enforced at the capability level, unless we force modules to release after transfer. I am enforcing this property in the routing module. Even if port capabilities are owned by multiple modules. The router will only map portID to a single module name at any given point for now

@cwgoes
Copy link
Contributor

cwgoes commented Apr 7, 2020

Closed by #5888.

@cwgoes cwgoes closed this as completed Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants