Skip to content

Commit

Permalink
Merge branch 'cosmos-main' into upgrade-relayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish Chandra committed Sep 27, 2023
2 parents deb0267 + bfdb6bf commit 2a20514
Show file tree
Hide file tree
Showing 107 changed files with 12,198 additions and 7,900 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
# Install and setup go
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: 1.20.2
go-version: '1.21'

# setup gopath
- name: Set PATH
Expand All @@ -40,4 +40,4 @@ jobs:
uses: actions/upload-artifact@v1
with:
name: rly
path: ./build/rly
path: ./build/rly
156 changes: 127 additions & 29 deletions .github/workflows/interchaintest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ jobs:
events:
runs-on: self-hosted
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v1
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: 1.20
id: go
go-version: '1.21'

- name: checkout relayer
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
Expand All @@ -32,18 +33,19 @@ jobs:
legacy:
runs-on: self-hosted
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v1
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: 1.20
id: go
go-version: '1.21'

- name: checkout relayer
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
Expand All @@ -54,43 +56,139 @@ jobs:
multiple-paths:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v1
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: 1.20
id: go
go-version: '1.21'

- name: checkout relayer
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: interchaintest
run: make interchaintest-multiple

misbehaviour:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: checkout relayer
uses: actions/checkout@v4

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: interchaintest
run: make interchaintest-misbehaviour

fee-middleware:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: checkout relayer
uses: actions/checkout@v4

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: interchaintest
run: make interchaintest-fee-middleware

fee-grant:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: checkout relayer
uses: actions/checkout@v4

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: interchaintest
run: make interchaintest-fee-grant

prepare-scenario-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Generate matrix
id: set-matrix
run: |
# Run the command and convert its output to a JSON array
TESTS=$(cd interchaintest && go test -list ^TestScenario | grep -v "^ok " | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=${TESTS}" >> $GITHUB_OUTPUT
# Note : This job will not start until prepare-scenario-matrix completes sucessfully
scenarios:
needs: prepare-scenario-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test: ${{fromJson(needs.prepare-scenario-matrix.outputs.matrix)}}

steps:
- name: Set up Go 1.20
uses: actions/setup-go@v1
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: 1.20
id: go
go-version: '1.21'

- name: checkout relayer
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: interchaintest
run: make interchaintest-scenario
run: |
cd interchaintest
go test -timeout 30m -race -v -run ${{ matrix.test }}
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Release"
name: 'Release'

on:
push:
Expand All @@ -15,11 +15,11 @@ jobs:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.20
go-version: '1.21'

- run: echo https://github.com/cosmos/relayer/blob/${GITHUB_REF#refs/tags/}/CHANGELOG.md#${GITHUB_REF#refs/tags/} > ../release_notes.md
- run: echo https://github.com/cosmos/relayer/blob/${GITHUB_REF#refs/tags/}/CHANGELOG.md#${GITHUB_REF#refs/tags/} > ../release_notes.md

- name: setup release environment
run: |-
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
* [\#1177](https://github.com/cosmos/relayer/pull/1177) Avoid panic due to nil map when add new path and ensure path get written to config.
* [\#1178](https://github.com/cosmos/relayer/pull/1178) Add max-gas-amount parameter in chain configs.
* [\#1180](https://github.com/cosmos/relayer/pull/1180) Update SDK from v0.47.0 to v0.47.2.
* [\#1205](https://github.com/cosmos/relayer/pull/1205) Update ibc-go to v7.0.1.
* [\#1179](https://github.com/cosmos/relayer/pull/1179) Add extension-options parameter in chain configs and update SDK to v0.47.3.
* [\#1208](https://github.com/cosmos/relayer/pull/1208) Replace gogo/protobuf to cosmos/gogoproto.
* [\#1221](https://github.com/cosmos/relayer/pull/1221) Update cometbft to v0.37.2 and ibc-go to v7.2.0.
* [\#1226](https://github.com/cosmos/relayer/pull/1226) Avoid invalid Bech32 prefix error in parallel tests when sdk Config get overwritten by each other in single process.
* [\#1231](https://github.com/cosmos/relayer/pull/1231) Reduce get bech32 prefix when get signer.

## v0.9.3

Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.16 AS build-env
FROM --platform=$BUILDPLATFORM golang:1.21-alpine3.17 AS build-env

RUN apk add --update --no-cache curl make git libc-dev bash gcc linux-headers eudev-dev

ARG TARGETARCH
ARG BUILDARCH

RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \
wget -c https://musl.cc/aarch64-linux-musl-cross.tgz -O - | tar -xzvv --strip-components 1 -C /usr; \
wget -c https://musl.cc/aarch64-linux-musl-cross.tgz -O - | tar -xzvv --strip-components 1 -C /usr; \
elif [ "${TARGETARCH}" = "amd64" ] && [ "${BUILDARCH}" != "amd64" ]; then \
wget -c https://musl.cc/x86_64-linux-musl-cross.tgz -O - | tar -xzvv --strip-components 1 -C /usr; \
wget -c https://musl.cc/x86_64-linux-musl-cross.tgz -O - | tar -xzvv --strip-components 1 -C /usr; \
fi

ADD . .

RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \
export CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++;\
export CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++;\
elif [ "${TARGETARCH}" = "amd64" ] && [ "${BUILDARCH}" != "amd64" ]; then \
export CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++; \
export CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++; \
fi; \
GOOS=linux GOARCH=$TARGETARCH CGO_ENABLED=1 LDFLAGS='-linkmode external -extldflags "-static"' make install

Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ interchaintest-legacy:
interchaintest-multiple:
cd interchaintest && go test -race -v -run TestRelayerMultiplePathsSingleProcess .

interchaintest-misbehaviour:
cd interchaintest && go test -race -v -run TestRelayerMisbehaviourDetection .

interchaintest-fee-middleware:
cd interchaintest && go test -race -v -run TestRelayerFeeMiddleware .

interchaintest-fee-grant:
cd interchaintest && go test -race -v -run TestRelayerFeeGrant .

interchaintest-scenario: ## Scenario tests are suitable for simple networks of 1 validator and no full nodes. They test specific functionality.
cd interchaintest && go test -timeout 30m -race -v -run TestScenario ./...

Expand Down
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n

```shell
$ git clone https://github.com/cosmos/relayer.git
$ cd relayer && git checkout v2.3.0
$ cd relayer && git checkout v2.4.0
$ make install
```

Expand All @@ -58,15 +58,15 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
```
**Default config file location:** `~/.relayer/config/config.yaml`
By default, transactions will be relayed with a memo of `rly(VERSION)` e.g. `rly(v2.3.0)`.
By default, transactions will be relayed with a memo of `rly(VERSION)` e.g. `rly(v2.4.0)`.
To customize the memo for all relaying, use the `--memo` flag when initializing the configuration.
```shell
$ rly config init --memo "My custom memo"
```
Custom memos will have `rly(VERSION)` appended. For example, a memo of `My custom memo` running on relayer version `v2.3.0` would result in a transaction memo of `My custom memo | rly(v2.3.0)`.
Custom memos will have `rly(VERSION)` appended. For example, a memo of `My custom memo` running on relayer version `v2.4.0` would result in a transaction memo of `My custom memo | rly(v2.4.0)`.
The `--memo` flag is also available for other `rly` commands also that involve sending transactions such as `rly tx link` and `rly start`. It can be passed there to override the `config.yaml` value if desired.
Expand Down Expand Up @@ -112,18 +112,14 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
$ rly keys restore osmosis [key-name] "mnemonic words here"
```
5. **Edit the relayer's `key` values in the config file to match the `key-name`'s chosen above.**
5. **Use the `key-name` created above.**
>This step is necessary if you chose a `key-name` other than "default"
Example:
```yaml
- type: cosmos
value:
key: YOUR-KEY-NAME-HERE
chain-id: cosmoshub-4
rpc-addr: http://localhost:26657
```
```shell
$ rly keys use cosmoshub [key-name]
$ rly keys use osmosis [key-name]
```
6. **Ensure the keys associated with the configured chains are funded.**
Expand Down
31 changes: 31 additions & 0 deletions cmd/appstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,34 @@ func (a *appState) updatePathConfig(
return nil
})
}

func (a *appState) useKey(chainName, key string) error {

chain, exists := a.config.Chains[chainName]
if !exists {
return fmt.Errorf("chain %s not found in config", chainName)
}

cc := chain.ChainProvider

info, err := cc.ListAddresses()
if err != nil {
return err
}
value, exists := info[key]
currentValue := a.config.Chains[chainName].ChainProvider.Key()

if currentValue == key {
return fmt.Errorf("config is already using %s -> %s for %s", key, value, cc.ChainName())
}

if exists {
fmt.Printf("Config will now use %s -> %s for %s\n", key, value, cc.ChainName())
} else {
return fmt.Errorf("key %s does not exist for chain %s", key, cc.ChainName())
}
return a.performConfigLockingOperation(context.Background(), func() error {
a.config.Chains[chainName].ChainProvider.UseKey(key)
return nil
})
}
Loading

0 comments on commit 2a20514

Please sign in to comment.