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

Make ValidationContext and ExecutionContext implement the ICS-26 router #322

Closed
plafer opened this issue Jan 4, 2023 · 1 comment · Fixed by #393 or #377
Closed

Make ValidationContext and ExecutionContext implement the ICS-26 router #322

plafer opened this issue Jan 4, 2023 · 1 comment · Fixed by #393 or #377
Assignees
Milestone

Comments

@plafer
Copy link
Contributor

plafer commented Jan 4, 2023

When we wrote ADR 5, we forgot to consider how the ICS-26 router would work with the new ValidationContext and ExecutionContext. Also, since then, the removal of crossing hellos from connection and channel handshakes changed how certain handlers interact with the router (e.g. we can no longer emit events directly in ChanOpenTry and ChanOpenAck handlers). This issue serves to amend ADR 5 in order to address all of the above.

The bottom line is: both validate() and execute() need to perform the relevant parts of the ICS-26 router. As an example, here is what validate() and execute() would do to handle a ChanOpenTry message:

  • validate():

    1. Get the associated Module based on the msg.port_id
    2. Call the core chan_open_try::validate() handler
    3. Query the host for the channel_id (through the channel counter)
    4. Call the Module callback on_chan_open_try_validate() (which only performs validation)
  • execute():

    1. Get the associated Module based on the msg.port_id
    2. Query the host for the channel_id (through the channel counter)
    3. Call the Module callback on_chan_open_try_execute(channel_id, ...) (which only performs state changes), and save the returned version
    4. Call the core chan_open_try::execute(version, ...) handler, feeding it the version obtained from the execute() callback

A few things to note:

  • we need to extend the Module trait with validation methods (1 per callback).
  • The channel_id is no longer generated by the core handler, as specified in the specs (although see this spec issue which shows that the spec needs to be updated). Instead we generate it in what is effectively the ICS-26 router.
@plafer
Copy link
Contributor Author

plafer commented Jan 19, 2023

Blocked on #361.

@plafer plafer added A: blocked Admin: blocked by another (internal/external) issue or PR and removed A: blocked Admin: blocked by another (internal/external) issue or PR labels Jan 19, 2023
@Farhad-Shabani Farhad-Shabani moved this to 🏗️ In Progress in ibc-rs Feb 2, 2023
@Farhad-Shabani Farhad-Shabani added this to the ADR05 milestone Feb 2, 2023
@Farhad-Shabani Farhad-Shabani modified the milestones: ADR05, Support Anoma's onboarding efforts Feb 3, 2023
@Farhad-Shabani Farhad-Shabani moved this from 🏗️ In Progress to 🔖 Needs Review in ibc-rs Feb 3, 2023
@Farhad-Shabani Farhad-Shabani moved this from 🔖 Needs Review to 👀 In Review in ibc-rs Feb 7, 2023
@Farhad-Shabani Farhad-Shabani modified the milestones: Support Anoma's onboarding efforts, v0.28.0 Feb 8, 2023
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Done in ibc-rs Feb 8, 2023
@plafer plafer mentioned this issue Feb 22, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
2 participants