diff --git a/deployments/relayer/README.md b/deployments/relayer/README.md index 053cd042c2..ae2b1ffbea 100644 --- a/deployments/relayer/README.md +++ b/deployments/relayer/README.md @@ -9,9 +9,13 @@ from testnet-preview to testnet. ``` ./generate-configs preview ./generate-configs testnet -./configure-relayer penumbra-preview penumbra-testnet +./configure-relayer + ./run-relayer ``` +Or, you can use `just` to run it all, soup to nuts. See the path configuration +block in the `./configure-relayer` script for some example paths between chains +that aren't yet known to work. ## Further reading The config format for the JSON files are adapted from the [example-configs](https://github.com/cosmos/relayer/tree/main/docs/example-configs) @@ -19,3 +23,5 @@ in the relayer repo. Our configs will get out of date very quickly: the preview on every merge into main, for instance. Short-term, that's fine: we want to exercise IBC in our CI deployments, and dynamically generating the configs is good enough. Longer term, we'll want to upload our configs to the [chain-registry repo](https://github.com/cosmos/chain-registry). +Full documentation on the underlying steps used by the relayer can be found in the +[cross-chain docs](https://github.com/cosmos/relayer/blob/main/docs/create-path-across-chain.md). diff --git a/deployments/relayer/configs/babylon-testnet.json b/deployments/relayer/configs/babylon-testnet.json new file mode 100644 index 0000000000..fe36ff83d8 --- /dev/null +++ b/deployments/relayer/configs/babylon-testnet.json @@ -0,0 +1,16 @@ +{ + "type": "cosmos", + "value": { + "key": "default", + "chain-id": "bbn-test1", + "rpc-addr": "http://rpc.testnet.babylonchain.io:26657", + "account-prefix": "bbn", + "keyring-backend": "test", + "gas-adjustment": 1.0, + "gas-prices": "0.00bbn", + "debug": true, + "timeout": "20s", + "output-format": "json", + "sign-mode": "direct" + } +} diff --git a/deployments/relayer/configs/celestia-testnet.json b/deployments/relayer/configs/celestia-testnet.json new file mode 100644 index 0000000000..c41e780bbe --- /dev/null +++ b/deployments/relayer/configs/celestia-testnet.json @@ -0,0 +1,16 @@ +{ + "type": "cosmos", + "value": { + "key": "default", + "chain-id": "blockspacerace-0", + "rpc-addr": "https://celestia-blockspacerace-rpc.brocha.in:443", + "account-prefix": "celestia", + "keyring-backend": "test", + "gas-adjustment": 1.0, + "gas-prices": "0.00utia", + "debug": true, + "timeout": "20s", + "output-format": "json", + "sign-mode": "direct" + } +} diff --git a/deployments/relayer/configs/cosmwasm-testnet.json b/deployments/relayer/configs/cosmwasm-testnet.json new file mode 100644 index 0000000000..81d91e481e --- /dev/null +++ b/deployments/relayer/configs/cosmwasm-testnet.json @@ -0,0 +1,16 @@ +{ + "type": "cosmos", + "value": { + "key": "default", + "chain-id": "malaga-420", + "rpc-addr": "https://rpc.malaga-420.cosmwasm.com:443", + "account-prefix": "wasm", + "keyring-backend": "test", + "gas-adjustment": 1.0, + "gas-prices": "0.03umlg", + "debug": true, + "timeout": "20s", + "output-format": "json", + "sign-mode": "direct" + } +} diff --git a/deployments/relayer/configs/osmosis-testnet.json b/deployments/relayer/configs/osmosis-testnet.json new file mode 100644 index 0000000000..0492ffd87b --- /dev/null +++ b/deployments/relayer/configs/osmosis-testnet.json @@ -0,0 +1,16 @@ +{ + "type": "cosmos", + "value": { + "key": "default", + "chain-id": "osmo-test-4", + "rpc-addr": "https://rpc.testnet.osmosis.zone:443", + "account-prefix": "osmo", + "keyring-backend": "test", + "gas-adjustment": 1.0, + "gas-prices": "0.00uosmo", + "debug": true, + "timeout": "20s", + "output-format": "json", + "sign-mode": "direct" + } +} diff --git a/deployments/relayer/configs/penumbra-preview.json b/deployments/relayer/configs/penumbra-preview.json index ebf959c027..cf858f5e08 100644 --- a/deployments/relayer/configs/penumbra-preview.json +++ b/deployments/relayer/configs/penumbra-preview.json @@ -2,7 +2,7 @@ "type": "penumbra", "value": { "key": "default", - "chain-id": "penumbra-testnet-pasiphae-5d99ea66", + "chain-id": "penumbra-testnet-pasiphae-fceecc9b", "rpc-addr": "https://rpc.testnet-preview.penumbra.zone:443", "account-prefix": "penumbrav2t", "keyring-backend": "test", diff --git a/deployments/relayer/configure-relayer b/deployments/relayer/configure-relayer index a239049151..d9f99fbef2 100755 --- a/deployments/relayer/configure-relayer +++ b/deployments/relayer/configure-relayer @@ -4,17 +4,6 @@ # https://github.com/cosmos/relayer/ set -euo pipefail -if [[ $# -lt 2 ]] ; then - >&2 echo "ERROR: networks not specified. Use, e.g., 'penumbra-testnet penumbra-preview'." - >&2 echo "Usage: $0 " - exit 1 -fi - -chain_a="$1" -chain_b="$2" -shift 2 - - rm -rf ~/.relayer rly config init --memo "Automatic IBC for Penumbra, via relayer" @@ -26,17 +15,48 @@ rly chains add-dir configs/ # If we skip keygen, though, then `rly transact link ` shows an error: # # Error: key default not found on src chain penumbra-testnet-carme-dac8be27 ->&2 echo "Generating key for $chain_a:" -rly keys add "$chain_a" default ->&2 echo "Generating key for $chain_b:" -rly keys add "$chain_b" default - -# Configure paths. We can't fetch from an external registry, so we'll -# need to munge the YAML config directly. See docs at -# https://github.com/cosmos/relayer/blob/main/docs/create-path-across-chain.md -chain_a_id="$(jq -r '.value["chain-id"]' "configs/${chain_a}.json")" -chain_b_id="$(jq -r '.value["chain-id"]' "configs/${chain_b}.json")" -rly paths new "$chain_a_id" "$chain_b_id" penumbra_path +for chain in $(rly chains list --json | jq 'keys | join("\n")' -r) ; do + >&2 echo "Generating key for $chain" + rly keys add "$chain" default +done + +function create_paths() { + if [[ $# -lt 3 ]] ; then + >&2 echo "ERROR: networks not specified. Use, e.g., 'penumbra-testnet penumbra-preview'." + >&2 echo "Usage: $0 " + return 1 + fi + + local chain_a="$1" + local chain_b="$2" + local path_name="$3" + shift 3 + + # Make sure requested chain configs exist locally. This won't be necessary + # when the referenced chains exist in the upstream public chain registry. + if [[ ! -e "configs/${chain_a}.json" ]]; then + >&2 echo "ERROR: file not found: configs/${chain_a}.json" + return 2 + elif [[ ! -e "configs/${chain_b}.json" ]]; then + >&2 echo "ERROR: file not found: configs/${chain_b}.json" + return 2 + fi + + chain_a_id="$(jq -r '.value["chain-id"]' "configs/${chain_a}.json")" + chain_b_id="$(jq -r '.value["chain-id"]' "configs/${chain_b}.json")" + rly paths new "$chain_a_id" "$chain_b_id" "$path_name" +} + +# Create Penumbra-only path, between preview and testnet. Works! +create_paths penumbra-testnet penumbra-preview penumbra_path + +# Create paths between Penumbra and/or other Cosmos-adjacent testnets. +# These are not working yet, so commenting them out by default. +# +# create_paths penumbra-preview babylon-testnet babylon +# create_paths osmosis-testnet babylon-testnet osmosis +# create_paths osmosis-testnet cosmwasm-testnet osmosis-wasm +# create_paths osmosis-testnet celestia-testnet osmosis-celestia >&2 echo "Emitting status info:" rly chains list diff --git a/deployments/relayer/generate-configs b/deployments/relayer/generate-configs index 115298df5d..e0916d1860 100755 --- a/deployments/relayer/generate-configs +++ b/deployments/relayer/generate-configs @@ -14,7 +14,7 @@ function get_chain_id() { local u u="${1:-}" shift 1 - curl -s "${u}/status" | jq -r .result.node_info.network + curl -sSf "${u}/status" | jq -r .result.node_info.network } case $penumbra_network in diff --git a/deployments/relayer/justfile b/deployments/relayer/justfile index f0983277e8..86b4843e3a 100644 --- a/deployments/relayer/justfile +++ b/deployments/relayer/justfile @@ -7,5 +7,5 @@ configs: ./generate-configs testnet run: - ./configure-relayer penumbra-testnet penumbra-preview + ./configure-relayer ./run-relayer diff --git a/deployments/relayer/run-relayer b/deployments/relayer/run-relayer index dd60fdc634..cb4b08ea84 100755 --- a/deployments/relayer/run-relayer +++ b/deployments/relayer/run-relayer @@ -1,10 +1,24 @@ #!/bin/bash # Wrapper script to finalize configuration on relayer, # and submit a transaction to verify manual relaying of cross-chain -# info for Penumbra. +# info for Penumbra. We look up all paths configured in the relayer, +# and attempt to build a link across them. +set -euo pipefail ->&2 echo "Attempting to 'transact link' the path..." -rly --debug transact link penumbra_path ->&2 echo "Finished! No errors encountered setting up link. Available paths:" +# Function to add green bg to text, so it stands out amid +# a wall of debug logs. +function visible_log() { + local s="$1" + shift + >&2 printf '\e[42m%s\e[0m\n' "$s" +} + +while read -r p ; do + visible_log "Attempting to 'transact link' the $p path..." + rly --debug transact link "$p" +# We reverse-sort so that "penumbra" (which works) comes before "babylon" (which doesn't work, yet). +done < <(rly paths list --json | jq 'keys | join ("\n")' -r | sort -r) + +visible_log "Finished! No errors encountered setting up link. Available paths:" rly paths list