Skip to content

Testing examples

Luca Joss edited this page Dec 19, 2022 · 3 revisions

ICS31 Cross-Chain Queries

Overview

This section will give you a walkthrough on how to test Cross-Chain Queries using a Stride and Gaia chain.

Setup

In order to test the Cross-Chain Queries the following are required:

[global]
log_level = 'info'

[mode]

[mode.clients]
enabled = true
refresh = true
misbehaviour = true

[mode.connections]
enabled = true

[mode.channels]
enabled = true

[mode.packets]
enabled = true
clear_interval = 100
clear_on_start = true
tx_confirmation = true

[telemetry]
enabled = true
host = '127.0.0.1'
port = 3001

[[chains]]
id = 'STRIDE'
rpc_addr = 'http://localhost:26657'
grpc_addr = 'http://localhost:9090'
websocket_addr = 'ws://localhost:26657/websocket'
rpc_timeout = '15s'
account_prefix = 'stride'
key_name = 'wallet'
store_prefix = 'ibc'
gas_price = { price = 0.0, denom = 'ustrd' }
max_gas = 10000000
clock_drift = '5s'
trusting_period = '14day'
trust_threshold = { numerator = '1', denominator = '3' }

[[chains]]
id = 'GAIA'
rpc_addr = 'http://localhost:26557'
grpc_addr = 'http://localhost:9080'
websocket_addr = 'ws://localhost:26557/websocket'
rpc_timeout = '15s'
account_prefix = 'cosmos'
key_name = 'wallet'
store_prefix = 'ibc'
gas_price = { price = 0.0, denom = 'uatom' }
max_gas = 10000000
clock_drift = '5s'
trusting_period = '14day'
trust_threshold = { numerator = '1', denominator = '3' }
  • The mnemonics for the Stride key, in a file named stride_mnemonic: tone cause tribe this switch near host damage idle fragile antique tail soda alien depth write wool they rapid unfold body scan pledge soft
  • The mnemonics for the Gaia key, in a file named gaia_mnemonic: fiction perfect rapid steel bundle giant blade grain eagle wing cannon fever must humble dance kitchen lazy episode museum faith off notable rate flavor

Testing Cross-Chain Queries

  1. Start by updating the submodules of the Stride repository: git submodule update --init --recursive
  2. Start Stride's dockernet from the root of Stride's repository: make start-docker build=sgr
  3. Stop the relayer's docker container: docker rm dockernet-relayer-gaia-1 --force
  4. Register the keys for Stride and Gaia chain:
    • hermes --config <path>/config.toml keys add --chain STRIDE --mnemonic-file <path>/stride_mnemonic --overwrite
    • hermes --config <path>/config.toml keys add --chain GAIA --mnemonic-file <path>/gaia_mnemonic --overwrite
  5. Start a Hermes instance: hermes --config <path>/config.toml start
  6. Get the logs from the Stride chain: docker logs dockernet-stride1-1 -f
  7. Look for the Gaia Withdrawal address in the Stride logs, it should look like this:
12:44PM INF ------------------------------------- EPOCH 4 - 2022-12-14 12:44:07.36967 +0000 UTC ------------------------------------- module=x/stakeibc
12:44PM INF ----------------------------------------------------- STRIDE EPOCH 4 ----------------------------------------------------- module=x/stakeibc
12:44PM INF Creating Deposit Records for Epoch 4 module=x/stakeibc
12:44PM INF |   GAIA          |  Creating Deposit Record module=x/stakeibc
12:44PM INF Setting Withdrawal Addresses... module=x/stakeibc
12:44PM INF |   GAIA          |  Withdrawal Address: cosmos1x5p8er7e2ne8l54tx33l560l8djuyapny55pksctuguzdc00dj7saqcw2l, Delegator Address: cosmos1sy63lffevueudvvlvh2lf6s387xh9xq72n3fsy6n2gr5hm6u2szs2v0ujm module=x/stakeibc
  1. Transfer some tokens: docker exec dockernet-gaia1-1 gaiad tx bank send rly2 <Gaia Withdrawal address> 12345uatom --node http://localhost:26657 -b block -y

After a while you should be able to see the following Hermes logs:

2022-12-14T13:28:09.678924Z  INFO ThreadId(175) worker.batch{chain=STRIDE}:supervisor.handle_batch{chain=STRIDE}:supervisor.process_batch{chain=STRIDE}:cross chain query: request: cross_chain_query::GAIA/ba8606cdd8b91b6e1d1114b7d962bc1522d56b852367ee0f9bf30552ec0f8391
2022-12-14T13:28:10.425892Z  INFO ThreadId(175) worker.batch{chain=STRIDE}:supervisor.handle_batch{chain=STRIDE}:supervisor.process_batch{chain=STRIDE}:cross chain query: response arrived: query_id: ba8606cdd8b91b6e1d1114b7d962bc1522d56b852367ee0f9bf30552ec0f8391
2022-12-14T13:28:10.631025Z  INFO ThreadId(119) worker.batch{chain=GAIA}:supervisor.handle_batch{chain=GAIA}:supervisor.process_batch{chain=GAIA}:worker.packet.cmd{src_chain=GAIA src_port=icahost src_channel=channel-2 dst_chain=STRIDE}:relay{odata=d7ada1a0 ->Destination @0-1957; len=1}: assembled batch of 2 message(s)
2022-12-14T13:28:10.635816Z  INFO ThreadId(119) worker.batch{chain=GAIA}:supervisor.handle_batch{chain=GAIA}:supervisor.process_batch{chain=GAIA}:worker.packet.cmd{src_chain=GAIA src_port=icahost src_channel=channel-2 dst_chain=STRIDE}:relay{odata=d7ada1a0 ->Destination @0-1957; len=1}: response(s): 1; Ok:287C321600A7AB33ED4A75F43E7FE92465463AEA5212EDF45BFA72192643F424 target_chain=STRIDE

And Stride logs:

1:28PM INF [ICQ Resp] query ba8606cdd8b91b6e1d1114b7d962bc1522d56b852367ee0f9bf30552ec0f8391 with ttl: 1671024515496579000, resp time: 1671024489317845384. module=x/interchainquery
1:28PM INF [ICQ Resp] query ba8606cdd8b91b6e1d1114b7d962bc1522d56b852367ee0f9bf30552ec0f8391 is contentless, removing from store. module=x/interchainquery

Showing the Cross-Chain Query from Stride is correctly picked up by Hermes, and the reply correctly relayed back to Stride.