Skip to content

Commit

Permalink
feat: added a poc relayer implementation (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
srdtrk authored Nov 28, 2024
1 parent 71d82b4 commit cea5f92
Show file tree
Hide file tree
Showing 96 changed files with 10,485 additions and 224 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ ETH_TESTNET_TYPE="pow"
# Optional field to specify the revision (in the form of a commit hash) of the SP1 operator
# If not specified the default revision from justfile will be used when building the operator with `just install-operator`
# Format: SP1_OPERATOR_REV={a commit hash of `https://github.com/cosmos/sp1-ics07-tendermint`}
# Example: SP1_OPERATOR_REV=07e23bba5000c9d67dfc1d975ac477164e56db1f
# Example: SP1_OPERATOR_REV=f67f5fec9423a4744092ee98b62bc60e3354f223
10 changes: 9 additions & 1 deletion .github/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ runs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v2"
- name: "Install the Node.js dependencies"
shell: bash
run: "bun install"
run: bun install
- name: Setup Protoc
uses: taiki-e/install-action@protoc
32 changes: 23 additions & 9 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
- 'bun.lockb'
env:
FOUNDRY_PROFILE: ci
SP1_OPERATOR_REV: 07e23bba5000c9d67dfc1d975ac477164e56db1f
SP1_OPERATOR_REV: f67f5fec9423a4744092ee98b62bc60e3354f223
permissions:
contents: read

Expand Down Expand Up @@ -66,6 +66,7 @@ jobs:
- TestWithIbcEurekaTestSuite/TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Plonk
- TestWithIbcEurekaTestSuite/TestICS20TransferTimeoutFromEthereumToCosmosChain_Groth16
- TestWithIbcEurekaTestSuite/TestICS20TransferTimeoutFromEthereumToCosmosChain_Plonk
- TestWithRelayerTestSuite/TestRelayerInfo
name: ${{ matrix.test }}
runs-on: ubuntu-latest
env:
Expand All @@ -80,39 +81,52 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
go-version: "1.23"
check-latest: true
cache-dependency-path: e2e/interchaintestv8/go.sum

- name: Install rust toolchain
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-10-11
toolchain: stable
components: rustfmt, clippy

- name: "Cache Operator"
id: cache-operator
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
path: ~/.cargo/bin/operator
key: ${{ runner.os }}-operator-${{ env.SP1_OPERATOR_REV }}

- name: "Cache Relayer"
id: cache-relayer
uses: actions/cache@v4
with:
path: ~/.cargo/bin/relayer
key: ${{ runner.os }}-relayer-${{ hashFiles('Cargo.lock', 'packages/**', 'relayer/**') }}

- name: Install SP1 toolchain
if: steps.cache-operator.outputs.cache-hit != 'true'
if: (steps.cache-operator.outputs.cache-hit != 'true') || (steps.cache-relayer.outputs.cache-hit != 'true')
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up
~/.sp1/bin/sp1up --token ${{ secrets.GITHUB_TOKEN }}
~/.sp1/bin/cargo-prove prove --version
- name: Install operator
if: steps.cache-operator.outputs.cache-hit != 'true'
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-10-11
command: install
args: --git https://github.com/cosmos/sp1-ics07-tendermint --rev ${{ env.SP1_OPERATOR_REV }} sp1-ics07-tendermint-operator --bin operator --locked

- name: Install relayer
if: steps.cache-relayer.outputs.cache-hit != 'true'
uses: actions-rs/cargo@v1
with:
command: install
args: --bin relayer --path relayer --locked

- name: Setup Kurtosis
if: env.ETH_TESTNET_TYPE == 'pos'
run: |
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml
name: rust

on:
push:
branches: [main]
pull_request:

jobs:
lints:
name: fmt-and-clippy
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: "Set up environment"
uses: ./.github/setup

- name: Install SP1 toolchain
shell: bash
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up --token ${{ secrets.GITHUB_TOKEN }}
~/.sp1/bin/cargo-prove prove --version
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy

tests:
name: unit-tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install SP1 toolchain
shell: bash
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up --token ${{ secrets.GITHUB_TOKEN }}
~/.sp1/bin/cargo-prove prove --version
- name: "Set up environment"
uses: ./.github/setup
- name: Install just
uses: extractions/setup-just@v2
- name: Run unit tests
run: just test-cargo
env:
RUST_BACKTRACE: 1

build-relayer:
name: build-relayer
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: "Set up environment"
uses: ./.github/setup
- name: Install SP1 toolchain
shell: bash
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up --token ${{ secrets.GITHUB_TOKEN }}
~/.sp1/bin/cargo-prove prove --version
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --bin relayer --release --locked
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ broadcast/*/31337/
# ide files
.idea/
*.iml

# Rust
target

# Config files and test artifacts
relayer/config.json
Loading

0 comments on commit cea5f92

Please sign in to comment.