-
Notifications
You must be signed in to change notification settings - Fork 332
Testing examples
Luca Joss edited this page Dec 19, 2022
·
3 revisions
This section will give you a walkthrough on how to test Cross-Chain Queries using a Stride and Gaia chain.
In order to test the Cross-Chain Queries the following are required:
- Hermes version with the ICS31 implementation, e.g. https://github.com/validance/ibc-rs/tree/refactoring/ics-031-crosschain-queries
- Stride
v4.0.3
or later, https://github.com/Stride-Labs/stride - The following configuration file for Hermes:
[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
- Start by updating the submodules of the Stride repository:
git submodule update --init --recursive
- Start Stride's dockernet from the root of Stride's repository:
make start-docker build=sgr
- Stop the relayer's docker container:
docker rm dockernet-relayer-gaia-1 --force
- 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
- Start a Hermes instance:
hermes --config <path>/config.toml start
- Get the logs from the Stride chain:
docker logs dockernet-stride1-1 -f
- 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
- 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.