-
Notifications
You must be signed in to change notification settings - Fork 586
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
Should registering counterparty address be based on channel ID or client ID? #1133
Comments
Thanks for opening these issues, @soareschen! |
This is a great point, what if we try to do the best of both worlds. It'd be slightly awkward under the hood, but we could introduce a new message to allow relayers to register a counterparty address for a client ID. The address associated with a clientID would be the default address, if an address is registered with a channel ID then that takes precedence So two mappings: two messages: Register counterparty address: Register default counterparty address: When getting forward relayer address: |
Given that my proposed solution can be made backwards compatible and that the unknown concern here is whether it is desirable to have a counterparty address per channel rather than a default address for all channels associated with a client ID, I'd be in favor of changing our existing mapping to use the clientID Then, if we get feedback/desire for a per channel counterparty address, we could add in a new message to do the channel ID mapping. This could be accomplished in a minor release |
Thanks for the suggestion @soareschen. I'd actually like to push back and keep the mapping to be channelID for now for a number of reasons.
Each relayer is choosing to relay on a particular channel not over particular clients. Thus the natural architecture for relayer incentivization especially as it is being implemented at the channel layer, is to use the channelID.
If we use channelID, then we get the following state reads:
If we use clientID, then we get the following state reads:
Of course, we can reduce the number of state reads in the second case by caching the channelID->clientID mapping in the middleware state. But this is still an additional state read, and additional state to store in the middleware. I believe we should keep the middleware as lightweight and stateless as possible. So there is a tradeoff between number of relayer msgs and state reads during packet execution. Since there will be many more packet executions than relayer registration msgs, I think we should optimize on simplifying the packet execution logic in our middleware.
I expect that an individual relayer will relay a small number of channels/client for the foreseeable future. This optimization becomes more attractive if there are many many channels that a relayer will relay for on a given client. But realistically most relayers will only relay on one canonical channel per application between two chains. And it isn't even clear to me that relayers will choose to relay on all applications. I imagine there will be transfer-only relayers and ICA-only relayers. So I would like to see this play out in the ecosystem before implementing a premature optimization.
It is trivial implementation-wise for relayers to integrate the once-per-channel registration msg whenever they create a new channel or decide to relay on an existing one. It is a bit more complicated to figure out if you've already registered on the underlying client but not too difficult so this is a minor benefit.
Another minor benefit is that relayers may intentionally use different addresses for different channels so they can easily track the revenue/cost/profit of each individual channel and use this to make operator decisions. If all of it is pooled by client, it is more difficult to assess whether it is worth relaying on a particular channel. Given that channelID mapping is more natural and has some benefits over clientID mapping, I think we should leave the spec as is. And if relayer operators request the clientID mapping, we can add it in as a backwards-compatible feature rather than doing it as a premature optimization |
Summary
From the relayer stand point, registering counterparty address based on client ID may be more efficient than channel ID.
Problem Definition
Currently in #276, the counterparty address is registered based on channel ID. This works fine in today's setting, where most IBC clients only have one associated channel. With the introduction of Interchain Accounts, there may be many more channels associated with an IBC client. If incentivized fee is enabled on all these channels, the relayer may need to perform repeated work of registering its counterparty address every time it relays on a new channel.
A potentially more efficient approach is to allow a relayer to register its counterparty address based on the client ID instead of channel ID. That way, it can reuse the same counterparty address for all channels created on the client.
We should still consider if there can be any case where a relayer would want to register different counterparty addresses on different channels on the same client. It could also be possible that registering counterparty address on every channel do not introduce as much overhead as we imagined, depending on the actual use cases of IBC.
Proposal
Register counterparty addresses based on client ID instead of channel ID.
For Admin Use
The text was updated successfully, but these errors were encountered: