ibc-rs icon indicating copy to clipboard operation
ibc-rs copied to clipboard

support wrapper type for host client state

Open rnbguy opened this issue 9 months ago • 1 comments

Feature Summary

Now that ibc-go comes with wasm-08, client state of an ibc-rs chain maybe stored as wasm wrapped format in wasm-08 enabled chain.

So when MsgConnectionOpenTry or MsgConnectionOpenAck is received at ibc-rs, it should expect two cases:

  1. normal client state. e.g., the chain is using vanilla tendermint engine, so the counterparty ibc-go chain uses ibc-go implementation of ics07.
  2. wasm wrapped client state. e.g., the chain is using a custom consensus, so the counterparty ibc-go chain uses wasm client via wasm-08

Proposal

We need to introduce an enum:

pub enum HostClientState<T> {
    Native {
        state: T,
    },
    Wasm {
        state: T,
        checksum: Vec<u8>,
        latest_height: Height,
    },
}

Then, use HosClientState<Ctx::HostClientState> in the following places:

https://github.com/cosmos/ibc-rs/blob/2378cd4ba45094b8ed856ff7dba5f1d0882f59ae/ibc-core/ics03-connection/src/handler/conn_open_ack.rs#L52

https://github.com/cosmos/ibc-rs/blob/2378cd4ba45094b8ed856ff7dba5f1d0882f59ae/ibc-core/ics03-connection/src/handler/conn_open_try.rs#L42

rnbguy avatar May 23 '24 18:05 rnbguy