Skip to content

Prefix-based routing in IBCv2 Router #8302

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

Closed
4 tasks
kulikthebird opened this issue Apr 15, 2025 · 2 comments · Fixed by #8303
Closed
4 tasks

Prefix-based routing in IBCv2 Router #8302

kulikthebird opened this issue Apr 15, 2025 · 2 comments · Fixed by #8303

Comments

@kulikthebird
Copy link
Contributor

Summary

Add a prefix-based routing in IBCv2 Router.

Problem Definition

The router in IBCv2 stores exact port IDs. The CosmWasm module needs to route IBC messages to many potential destination contracts. This means that either CosmWasm must register all contracts in the router, or register only one path (e.g., "WasmPort") and implement additional internal routing for the contracts. From both a complexity and performance point of view, each proposal introduces computational overhead and may increase the complexity of the IBC message handler logic. With very little cost, we could improve the behavior of the IBCv2 router to make the entire procedure much simpler and faster.

Use cases

IBCv2 ports can be associated with proper modules based on their prefix. It removes the necessity to register additional paths per module in the IBC-go Router.

Proposal

Use Radix-tree to store prefixes of the port IDs in the IBCv2 Router.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
  • Estimate provided
@kulikthebird kulikthebird changed the title Improvement: Prefix-based routing in IBCv2 Router Prefix-based routing in IBCv2 Router Apr 15, 2025
@damiannolan
Copy link
Contributor

The router in v2 initially had prefixed routing -> https://github.com/cosmos/ibc-go/pull/7392/files#diff-8a40329b45e29c5e8c51405756298064353e80d5597c22564e7714bf24226cea

I would avoid adding unnecessary dependencies on third party libs

@kulikthebird
Copy link
Contributor Author

Thanks for the update. Do you think we should re-implement the routing mechanism you mentioned? From CW's perspective, I think that would be totally fine. I proposed using a radix tree to make it a bit more efficient and elegant, but I'm not sure how many modules blockchains typically register.

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.

2 participants