informalsystems / hermes

IBC Relayer in Rust
https://hermes.informal.systems
Apache License 2.0
447 stars 329 forks source link

Ensure Hermes can be configured to relay or not on ICA channels whose controller port does not start with `icacontroller-` #2991

Open romac opened 1 year ago

romac commented 1 year ago

As per https://github.com/cosmos/ibc/pull/887/files, the controller port does not need to start with icacontroller- anymore, meaning that Hermes will not be able to relay on these channels when it is configured as follows, as per our documentation:

# Example configuration of a channel filter, only allowing packet relaying on
# channel with port ID 'transfer' and channel ID 'channel-0', as well as on
# all ICA channels.
[chains.packet_filter]
policy = 'allow'
list = [
  ['ica*', '*'],
  ['transfer', 'channel-0'],
]

On the controller chain, this filter will fail to match ICA channels whose port identifier does not start with icacontroller-, as is now permitted by ICS 27.

We should therefore find another way to let operators instruct Hermes to relay (or not) on ICA channels.

One way to do that would be to

1) Add a bespoke setting to the configuration to enable/disable relaying on ICA channels 2) Would have Hermes determine if a channel is an ICA channel by performing the following steps:

  1. Inspect the channel's version metadata
  2. Try to parse it as JSON
  3. If that fails, consider the channel to NOT be an ICA channel
  4. If that succeeds, check whether the Version is equal to ics27-1, as per the ICS 27 spec.
  5. If that succeeds, consider the channel to be an ICA channel

Hermes would then only relay on an ICA channel if the setting introduced in (1) is enabled and if the check performed in (2) is successful.

@adizere @ancazamfir @crodriguezvega I would love to hear your thoughts on this

adizere commented 1 year ago

Hermes would then only relay on an ICA channel if the setting introduced in (1) is enabled and if the check performed in (2) is successful.

Seems like a solid approach to me. Great breakdown of the problem & potential solution Romain! I like the idea of a bespoke setting, though it's not obvious to me how we would encode it, what it's syntax and UX would be in the config.toml; though that is a secondary concern at this moment.

@crodriguezvega is there an approximate timeline/version on when we can expect this change to land into ibc-go?