Skip to content

Instantly share code, notes, and snippets.

@rootulp
Last active September 16, 2023 22:34
Show Gist options
  • Save rootulp/6dd1d298d92f347a349d0e9d92a7519c to your computer and use it in GitHub Desktop.
Save rootulp/6dd1d298d92f347a349d0e9d92a7519c to your computer and use it in GitHub Desktop.
Notes from testing IBC between mocha-4 and Cosmos hub testnet
[global]
log_level = "info"
[mode.clients]
enabled = true
refresh = true
misbehaviour = true
[mode.connections]
enabled = false
[mode.channels]
enabled = false
[mode.packets]
enabled = true
clear_interval = 100
clear_on_start = true
tx_confirmation = false
auto_register_counterparty_payee = false
[rest]
enabled = false
host = "127.0.0.1"
port = 3000
[telemetry]
enabled = false
host = "127.0.0.1"
port = 3001
[telemetry.buckets.latency_submitted]
start = 500
end = 20000
buckets = 10
[telemetry.buckets.latency_confirmed]
start = 1000
end = 30000
buckets = 10
[[chains]]
id = "theta-testnet-001"
type = "CosmosSdk"
rpc_addr = "https://rpc.sentry-01.theta-testnet.polypore.xyz"
grpc_addr = "https://grpc.sentry-01.theta-testnet.polypore.xyz"
rpc_timeout = "10s"
trusted_node = false
account_prefix = "cosmos"
key_name = "key-cosmos"
key_store_type = "Test"
store_prefix = "ibc"
default_gas = 100000
max_gas = 400000
gas_multiplier = 1.5
max_msg_num = 30
max_tx_size = 180000
max_grpc_decoding_size = 33554432
clock_drift = "5s"
max_block_time = "30s"
ccv_consumer_chain = false
memo_prefix = ""
sequential_batch_tx = false
[chains.event_source]
mode = "push"
url = "ws://rpc.sentry-01.theta-testnet.polypore.xyz:26657/websocket"
batch_delay = "500ms"
[chains.trust_threshold]
numerator = "1"
denominator = "3"
[chains.gas_price]
price = 0.025
denom = "uatom"
[chains.packet_filter]
policy = "allow"
list = [["transfer", "channel-3108"]]
[chains.packet_filter.min_fees]
[chains.address_type]
derivation = "cosmos"
[[chains]]
id = "mocha-4"
type = "CosmosSdk"
rpc_addr = "https://rpc-celestia-mocha.architectnodes.com"
grpc_addr = "https://grpc.celestia-mocha.com:443"
rpc_timeout = "10s"
trusted_node = false
account_prefix = "celestia"
key_name = "celestia-key"
key_store_type = "Test"
store_prefix = "ibc"
default_gas = 100000
max_gas = 400000
gas_multiplier = 1.5
max_msg_num = 30
max_tx_size = 180000
max_grpc_decoding_size = 33554432
clock_drift = "5s"
max_block_time = "30s"
ccv_consumer_chain = false
memo_prefix = ""
sequential_batch_tx = false
[chains.event_source]
mode = "push"
url = "ws://rpc-mocha.pops.one:26657/websocket"
batch_delay = "500ms"
[chains.trust_threshold]
numerator = "1"
denominator = "3"
[chains.gas_price]
price = 0.1
denom = "utia"
[chains.packet_filter]
policy = "allow"
list = [["transfer", "channel-0"]]
[chains.packet_filter.min_fees]
[chains.address_type]
derivation = "cosmos"

IBC testing

This gist contains notes from testing IBC between a Celestia testnet (mocha-4) and Cosmos Hub testnet (theta-testnet-001). It was motivated by GH issue: celestiaorg/celestia-app#195

Resources

Testnets

Prerequisites

  1. Install Hermes
  2. Configure Hermes with config.toml
  3. Create wallets on all the testnets that you're interested in testing. Get them funded via faucets.

Wallets

Warning

The following steps will only work for Celestia if you're running a slightly modified Hermes. See https://github.com/rootulp/hermes/tree/rp/tendermint

Steps

  1. Learn if clients already exist for the chains you are testing. To learn if a client already exists use:

    hermes query clients --host-chain mocha-4 --reference-chain theta-testnet-001
  2. If clients already exist, you can skip this step. Create a client

    $ hermes create client --host-chain mocha-4 --reference-chain theta-testnet-001
    2023-09-15T15:15:54.602346Z  INFO ThreadId(01) using default configuration from '/Users/rootulp/.hermes/config.toml'
    2023-09-15T15:15:54.602777Z  INFO ThreadId(01) running Hermes v1.6.0+1c1cf02
    2023-09-15T15:15:55.655123Z  WARN ThreadId(01) Unsupported tendermint version, will use v0.37 compatibility mode but relaying might not work as desired: unsupported Tendermint version reported by the node: 1.0.0-rc14
    SUCCESS CreateClient(
        CreateClient(
            Attributes {
                client_id: ClientId(
                    "07-tendermint-0",
                ),
                client_type: Tendermint,
                consensus_height: Height {
                    revision: 0,
                    height: 1,
                },
            },
        ),
    )
  3. Create another client

    $ ./target/release/hermes create client --host-chain theta-testnet-001 --reference-chain mocha-4
    2023-09-16T19:40:35.845092Z  INFO ThreadId(01) using default configuration from '/Users/rootulp/.hermes/config.toml'
    2023-09-16T19:40:35.847473Z  INFO ThreadId(01) running Hermes v1.6.0+1c1cf0298-dirty
    2023-09-16T19:40:36.489807Z  WARN ThreadId(01) Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: unsupported Tendermint version reported by the node: 1.0.0-rc14
    2023-09-16T19:40:44.024678Z TRACE ThreadId(25) send_messages_and_wait_commit{chain=theta-testnet-001 tracking_id=create client}: retrieved 1 tx results after 2149 ms
    SUCCESS CreateClient(
        CreateClient(
            Attributes {
                client_id: ClientId(
                    "07-tendermint-2382",
                ),
                client_type: Tendermint,
                consensus_height: Height {
                    revision: 4,
                    height: 78057,
                },
            },
        ),
    )
  4. Create connections. If you encounter an out of gas error, increase the gas-multiplier in config.toml for both chains.

    2023-09-16T19:50:34.632823Z  INFO ThreadId(01) connection handshake already finished for Connection { delay_period: 0ns, a_side: ConnectionSide { chain: BaseChainHandle { chain_id: theta-testnet-001 }, client_id: 07-tendermint-2382, connection_id: connection-2727 }, b_side: ConnectionSide { chain: BaseChainHandle { chain_id: mocha-4 }, client_id: 07-tendermint-0, connection_id: connection-0 } }
    SUCCESS Connection {
        delay_period: 0ns,
        a_side: ConnectionSide {
            chain: BaseChainHandle {
                chain_id: ChainId {
                    id: "theta-testnet-001",
                    version: 0,
                },
                runtime_sender: Sender { .. },
            },
            client_id: ClientId(
                "07-tendermint-2382",
            ),
            connection_id: Some(
                ConnectionId(
                    "connection-2727",
                ),
            ),
        },
        b_side: ConnectionSide {
            chain: BaseChainHandle {
                chain_id: ChainId {
                    id: "mocha-4",
                    version: 4,
                },
                runtime_sender: Sender { .. },
            },
            client_id: ClientId(
                "07-tendermint-0",
            ),
            connection_id: Some(
                ConnectionId(
                    "connection-0",
                ),
            ),
        },
    }
  5. Create channel

    $ ./target/release/hermes create channel --a-chain theta-testnet-001 --a-connection connection-2727 --a-port transfer --b-port transfer
    2023-09-16T19:53:09.813815Z  INFO ThreadId(01) using default configuration from '/Users/rootulp/.hermes/config.toml'
    2023-09-16T19:53:09.815380Z  INFO ThreadId(01) running Hermes v1.6.0+1c1cf0298-dirty
    2023-09-16T19:53:11.056847Z  WARN ThreadId(01) Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: unsupported Tendermint version reported by the node: 1.0.0-rc14
    2023-09-16T19:53:15.227950Z  INFO ThreadId(01) 🎊  theta-testnet-001 => OpenInitChannel(OpenInit { port_id: transfer, channel_id: channel-3152, connection_id: None, counterparty_port_id: transfer, counterparty_channel_id: None }) at height 0-17936815
    2023-09-16T19:53:26.469824Z  INFO ThreadId(01) 🎊  mocha-4 => OpenTryChannel(OpenTry { port_id: transfer, channel_id: channel-0, connection_id: connection-0, counterparty_port_id: transfer, counterparty_channel_id: channel-3152 }) at height 4-78122
    2023-09-16T19:53:53.057004Z  INFO ThreadId(01) 🎊  theta-testnet-001 => OpenAckChannel(OpenAck { port_id: transfer, channel_id: channel-3152, connection_id: connection-2727, counterparty_port_id: transfer, counterparty_channel_id: channel-0 }) at height 0-17936822
    2023-09-16T19:54:13.450361Z  INFO ThreadId(01) 🎊  mocha-4 => OpenConfirmChannel(OpenConfirm { port_id: transfer, channel_id: channel-0, connection_id: connection-0, counterparty_port_id: transfer, counterparty_channel_id: channel-3152 }) at height 4-78126
    2023-09-16T19:54:16.606587Z  INFO ThreadId(01) channel handshake already finished for Channel { ordering: ORDER_UNORDERED, a_side: ChannelSide { chain: BaseChainHandle { chain_id: theta-testnet-001 }, client_id: 07-tendermint-2382, connection_id: connection-2727, port_id: transfer, channel_id: channel-3152, version: None }, b_side: ChannelSide { chain: BaseChainHandle { chain_id: mocha-4 }, client_id: 07-tendermint-0, connection_id: connection-0, port_id: transfer, channel_id: channel-0, version: None }, connection_delay: 0ns }
    SUCCESS Channel {
        ordering: Unordered,
        a_side: ChannelSide {
            chain: BaseChainHandle {
                chain_id: ChainId {
                    id: "theta-testnet-001",
                    version: 0,
                },
                runtime_sender: Sender { .. },
            },
            client_id: ClientId(
                "07-tendermint-2382",
            ),
            connection_id: ConnectionId(
                "connection-2727",
            ),
            port_id: PortId(
                "transfer",
            ),
            channel_id: Some(
                ChannelId(
                    "channel-3152",
                ),
            ),
            version: None,
        },
        b_side: ChannelSide {
            chain: BaseChainHandle {
                chain_id: ChainId {
                    id: "mocha-4",
                    version: 4,
                },
                runtime_sender: Sender { .. },
            },
            client_id: ClientId(
                "07-tendermint-0",
            ),
            connection_id: ConnectionId(
                "connection-0",
            ),
            port_id: PortId(
                "transfer",
            ),
            channel_id: Some(
                ChannelId(
                    "channel-0",
                ),
            ),
            version: None,
        },
        connection_delay: 0ns,
    }
  6. Verify the network looks good

    $ ./target/release/hermes query channels --show-counterparty --chain mocha-4
    2023-09-16T19:55:13.236895Z  INFO ThreadId(01) using default configuration from '/Users/rootulp/.hermes/config.toml'
    2023-09-16T19:55:13.239037Z  INFO ThreadId(01) running Hermes v1.6.0+1c1cf0298-dirty
    2023-09-16T19:55:13.854914Z  WARN ThreadId(01) Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: unsupported Tendermint version reported by the node: 1.0.0-rc14
    SUCCESS
    mocha-4: transfer/channel-0 --- theta-testnet-001: transfer/channel-3152
  7. Test a cross-chain tranfser

    $ ./target/release/hermes tx ft-transfer --timeout-seconds 1000 --dst-chain mocha-4 --src-chain theta-testnet-001 --src-port transfer --src-channel channel-3152 --amount 1 --denom uatom
    2023-09-16T19:57:02.194054Z  INFO ThreadId(01) using default configuration from '/Users/rootulp/.hermes/config.toml'
    2023-09-16T19:57:02.194273Z  INFO ThreadId(01) running Hermes v1.6.0+1c1cf0298-dirty
    2023-09-16T19:57:03.207201Z  WARN ThreadId(01) Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: unsupported Tendermint version reported by the node: 1.0.0-rc14
    SUCCESS [
        IbcEventWithHeight {
            event: SendPacket(
                SendPacket {
                    packet: Packet {
                        sequence: Sequence(
                            1,
                        ),
                        source_port: PortId(
                            "transfer",
                        ),
                        source_channel: ChannelId(
                            "channel-3152",
                        ),
                        destination_port: PortId(
                            "transfer",
                        ),
                        destination_channel: ChannelId(
                            "channel-0",
                        ),
                        data: [123, 34, 97, 109, 111, 117, 110, 116, 34, 58, 34, 49, 34, 44, 34, 100, 101, 110, 111, 109, 34, 58, 34, 117, 97, 116, 111, 109, 34, 44, 34, 114, 101, 99, 101, 105, 118, 101, 114, 34, 58, 34, 99, 101, 108, 101, 115, 116, 105, 97, 49, 100, 115, 109, 110, 122, 122, 56, 113, 118, 110, 51, 52, 51, 108, 120, 113, 50, 101, 119, 54, 55, 51, 57, 115, 100, 48, 50, 103, 115, 115, 112, 121, 101, 115, 97, 52, 106, 117, 34, 44, 34, 115, 101, 110, 100, 101, 114, 34, 58, 34, 99, 111, 115, 109, 111, 115, 49, 101, 112, 113, 122, 117, 104, 54, 109, 121, 114, 119, 114, 112, 52, 122, 114, 56, 122, 106, 97, 109, 99, 121, 101, 52, 110, 118, 107, 107, 103, 57, 120, 100, 56, 121, 119, 97, 107, 34, 125],
                        timeout_height: Never,
                        timeout_timestamp: Timestamp {
                            time: Some(
                                Time(
                                    2023-09-16 20:13:24.499864829,
                                ),
                            ),
                        },
                    },
                },
            ),
            height: Height {
                revision: 0,
                height: 17936858,
            },
        },
    ]
  8. Test a transfer in the other direction

    $ ./target/release/hermes tx ft-transfer --timeout-seconds 1000 --src-chain mocha-4 --dst-chain theta-testnet-001 --src-port transfer --src-channel channel-0 --amount 1 --denom utia
    2023-09-16T22:05:13.101915Z  INFO ThreadId(01) using default configuration from '/Users/rootulp/.hermes/config.toml'
    2023-09-16T22:05:13.105082Z  INFO ThreadId(01) running Hermes v1.6.0+1c1cf0298-dirty
    2023-09-16T22:05:14.272608Z  WARN ThreadId(01) Unsupported tendermint version, will use v0.34 compatibility mode but relaying might not work as desired: unsupported Tendermint version reported by the node: 1.0.0-rc14
    SUCCESS [
        IbcEventWithHeight {
            event: SendPacket(
                SendPacket {
                    packet: Packet {
                        sequence: Sequence(
                            1,
                        ),
                        source_port: PortId(
                            "transfer",
                        ),
                        source_channel: ChannelId(
                            "channel-0",
                        ),
                        destination_port: PortId(
                            "transfer",
                        ),
                        destination_channel: ChannelId(
                            "channel-3152",
                        ),
                        data: [123, 34, 97, 109, 111, 117, 110, 116, 34, 58, 34, 49, 34, 44, 34, 100, 101, 110, 111, 109, 34, 58, 34, 117, 116, 105, 97, 34, 44, 34, 114, 101, 99, 101, 105, 118, 101, 114, 34, 58, 34, 99, 111, 115, 109, 111, 115, 49, 101, 112, 113, 122, 117, 104, 54, 109, 121, 114, 119, 114, 112, 52, 122, 114, 56, 122, 106, 97, 109, 99, 121, 101, 52, 110, 118, 107, 107, 103, 57, 120, 100, 56, 121, 119, 97, 107, 34, 44, 34, 115, 101, 110, 100, 101, 114, 34, 58, 34, 99, 101, 108, 101, 115, 116, 105, 97, 49, 100, 115, 109, 110, 122, 122, 56, 113, 118, 110, 51, 52, 51, 108, 120, 113, 50, 101, 119, 54, 55, 51, 57, 115, 100, 48, 50, 103, 115, 115, 112, 121, 101, 115, 97, 52, 106, 117, 34, 125],
                        timeout_height: Never,
                        timeout_timestamp: Timestamp {
                            time: Some(
                                Time(
                                    2023-09-16 22:21:48.394874025,
                                ),
                            ),
                        },
                    },
                },
            ),
            height: Height {
                revision: 4,
                height: 78794,
            },
        },
    ]

Issues encountered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment