Skip to content

Commit

Permalink
Add support for Namada (informalsystems#3705)
Browse files Browse the repository at this point in the history
Add support for relaying between Namada and Cosmos-base chains.

- Add Namada to `ChainConfig`
- Reuse `CosmosSdkConfig` for generating Tendermint light clients
- Add `NamadaChain` as `ChainEndpoint` implementation
  - See `crates/relayer/src/chain/namada.rs` and files under `crates/relayer/src/chain/namada`
  - To submit Namada transactions and query
- Store Namada key to KeyRing
---------

Signed-off-by: Yuji Ito <[email protected]>
Co-authored-by: Luca Joss <[email protected]>
Co-authored-by: Luca Joss <[email protected]>
Co-authored-by: Gianmarco Fraccaroli <[email protected]>
Co-authored-by: Tomáš Zemanovič <[email protected]>
Co-authored-by: Romain Ruetschi <[email protected]>
  • Loading branch information
6 people authored Dec 3, 2024
1 parent c90b69c commit 00a0cf5
Show file tree
Hide file tree
Showing 178 changed files with 9,662 additions and 951 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/3705-support-namada.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add support for relaying between Namada and CosmosSDK-based chains.
([\#3705](https://github.com/informalsystems/hermes/issues/3705))
3 changes: 3 additions & 0 deletions .github/codespell/words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ crate
shs
ser
numer
nam
inout
wast
7 changes: 6 additions & 1 deletion .github/workflows/cargo-doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-04-21
toolchain: nightly-2024-10-15
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build API documentation
uses: actions-rs/cargo@v1
env:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/guide-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check templates
run: bash scripts/auto_gen_templates.sh --mode "check"
- uses: actions-rs/cargo@v1
name: Update lockfile
with:
command: generate-lockfile
args: --manifest-path tools/check-guide/Cargo.toml
- uses: actions-rs/cargo@v1
name: Check guide
with:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down Expand Up @@ -156,6 +161,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down Expand Up @@ -199,6 +209,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down Expand Up @@ -242,6 +257,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down Expand Up @@ -284,6 +304,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down Expand Up @@ -328,6 +353,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/misbehaviour.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Hermes
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -132,6 +137,11 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Hermes
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -184,6 +194,11 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Hermes
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -236,6 +251,11 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Hermes
uses: actions-rs/cargo@v1
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/multi-chains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down
199 changes: 199 additions & 0 deletions .github/workflows/namada.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
name: Namada Integration

on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/namada.yaml
- Cargo.toml
- Cargo.lock
- flake.nix
- flake.lock
- ci/**
- e2e/**
- crates/**
- tools/**

env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 1
CARGO_PROFILE_RELEASE_DEBUG: 1
RUST_BACKTRACE: short
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10

# Cancel previous runs of this workflow when a new commit is added to the PR, branch or tag
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
cosmos-namada:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
chain:
- package: .#gaia20
command: gaiad,namada
account_prefix: cosmos,''
native_token: stake,nam
- package: .#osmosis
command: osmosisd,namada
account_prefix: osmo,''
native_token: stake,nam
steps:
- uses: actions/checkout@v4
- name: Clone Namada
uses: actions/checkout@v4
with:
repository: anoma/namada
ref: v0.46.1
path: namada
- name: Retrieve Namada repository path
id: namada-repo-path
run: |
echo "NAMADA_REPO_PATH=$(pwd)/namada" >> "$GITHUB_ENV"
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
substituters = https://cache.nixos.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
- name: Install Cachix
uses: cachix/cachix-action@v14
with:
name: cosmos-nix
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install libudev
run: sudo apt-get update && sudo apt-get -y install libudev-dev
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
args: -p ibc-integration-test --features namada --no-fail-fast --no-run
- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Download CometBFT
run: |
curl -o cometbft.tar.gz -LO https://github.com/cometbft/cometbft/releases/download/v0.37.11/cometbft_0.37.11_linux_amd64.tar.gz
tar -xvzf cometbft.tar.gz
chmod +x cometbft
mkdir -p $HOME/local/bin
mv cometbft ~/local/bin
- name: Download Namada binaries
env:
OPERATING_SYSTEM: Linux
run: |
release_url=$(curl -s "https://api.github.com/repos/anoma/namada/releases/188247367" | grep "browser_download_url" | cut -d '"' -f 4 | grep "$OPERATING_SYSTEM")
wget "$release_url"
tar -xzvf namada*.tar.gz
cp ./namada*/namadac ~/local/bin/namadac
cp ./namada*/namadan ~/local/bin/namadan
cp ./namada*/namadaw ~/local/bin/namadaw
cp ./namada*/namada ~/local/bin/namada
cp ./namada*/wasm/checksums.json $NAMADA_REPO_PATH/wasm
cp ./namada*/wasm/*.wasm $NAMADA_REPO_PATH/wasm
- name: Update environment path
run: |
echo "${HOME}/local/bin" >> $GITHUB_PATH
- name: Download MASP parameters
run: |
echo $HOME
mkdir -p $HOME/.masp-params
curl -o $HOME/.masp-params/masp-spend.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params\?raw\=true
curl -o $HOME/.masp-params/masp-output.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-output.params?raw=true
curl -o $HOME/.masp-params/masp-convert.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-convert.params?raw=true
- env:
RUST_LOG: info
RUST_BACKTRACE: 1
NO_COLOR_LOG: 1
NEXTEST_RETRIES: 2
CHAIN_COMMAND_PATHS: ${{ matrix.chain.command }}
ACCOUNT_PREFIXES: ${{ matrix.chain.account_prefix }}
NATIVE_TOKENS: ${{ matrix.chain.native_token }}
run: |
nix shell ${{ matrix.chain.package }} -c \
cargo nextest run -p ibc-integration-test --no-fail-fast --failure-output final --test-threads=1 \
--features namada
namada:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Clone Namada
uses: actions/checkout@v4
with:
repository: anoma/namada
ref: v0.46.1
path: namada
- name: Retrieve Namada repository path
id: namada-repo-path
run: |
echo "NAMADA_REPO_PATH=$(pwd)/namada" >> "$GITHUB_ENV"
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install libudev
run: sudo apt-get update && sudo apt-get -y install libudev-dev
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1
with:
command: test
args: -p ibc-integration-test --features namada --no-fail-fast --no-run
- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Download CometBFT
run: |
curl -o cometbft.tar.gz -LO https://github.com/cometbft/cometbft/releases/download/v0.37.11/cometbft_0.37.11_linux_amd64.tar.gz
tar -xvzf cometbft.tar.gz
mkdir -p ~/local/bin
chmod +x cometbft
mv cometbft ~/local/bin
- name: Download Namada binaries
env:
OPERATING_SYSTEM: Linux
run: |
release_url=$(curl -s "https://api.github.com/repos/anoma/namada/releases/188247367" | grep "browser_download_url" | cut -d '"' -f 4 | grep "$OPERATING_SYSTEM")
wget "$release_url"
tar -xzvf namada*.tar.gz
cp ./namada*/namadac ~/local/bin/namadac
cp ./namada*/namadan ~/local/bin/namadan
cp ./namada*/namadaw ~/local/bin/namadaw
cp ./namada*/namada ~/local/bin/namada
cp ./namada*/wasm/checksums.json $NAMADA_REPO_PATH/wasm
cp ./namada*/wasm/*.wasm $NAMADA_REPO_PATH/wasm
- name: Update environment path
run: |
echo "${HOME}/local/bin" >> $GITHUB_PATH
- name: Download MASP parameters
run: |
echo $HOME
mkdir -p $HOME/.masp-params
curl -o $HOME/.masp-params/masp-spend.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params\?raw\=true
curl -o $HOME/.masp-params/masp-output.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-output.params?raw=true
curl -o $HOME/.masp-params/masp-convert.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-convert.params?raw=true
- env:
RUST_LOG: info
RUST_BACKTRACE: 1
NO_COLOR_LOG: 1
NEXTEST_RETRIES: 2
CHAIN_COMMAND_PATHS: namada
ACCOUNT_PREFIXES: ''
NATIVE_TOKENS: nam
run: |
cargo nextest run -p ibc-integration-test --no-fail-fast --failure-output final --test-threads=1 \
--features namada
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v4
- name: Install Protoc
uses: heliaxdev/setup-protoc@v2
with:
version: "25.0"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required)
Expand Down
Loading

0 comments on commit 00a0cf5

Please sign in to comment.