Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relayer: testnet configs for other cosmos chains #2294

Merged
merged 3 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion deployments/relayer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ 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)
in the relayer repo. Our configs will get out of date very quickly: the preview chain id changes
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).
16 changes: 16 additions & 0 deletions deployments/relayer/configs/babylon-testnet.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
16 changes: 16 additions & 0 deletions deployments/relayer/configs/celestia-testnet.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
16 changes: 16 additions & 0 deletions deployments/relayer/configs/cosmwasm-testnet.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
16 changes: 16 additions & 0 deletions deployments/relayer/configs/osmosis-testnet.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
2 changes: 1 addition & 1 deletion deployments/relayer/configs/penumbra-preview.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
64 changes: 42 additions & 22 deletions deployments/relayer/configure-relayer
Original file line number Diff line number Diff line change
Expand Up @@ -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 <network-1> <network-2>"
exit 1
fi

chain_a="$1"
chain_b="$2"
shift 2


rm -rf ~/.relayer
rly config init --memo "Automatic IBC for Penumbra, via relayer"

Expand All @@ -26,17 +15,48 @@ rly chains add-dir configs/
# If we skip keygen, though, then `rly transact link <path>` 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 <network-1> <network-2> <path-name>"
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
Expand Down
2 changes: 1 addition & 1 deletion deployments/relayer/generate-configs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deployments/relayer/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ configs:
./generate-configs testnet

run:
./configure-relayer penumbra-testnet penumbra-preview
./configure-relayer
./run-relayer
22 changes: 18 additions & 4 deletions deployments/relayer/run-relayer
Original file line number Diff line number Diff line change
@@ -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