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

ci: create relay release workflow #128

Closed
wants to merge 15 commits into from
Closed
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
27 changes: 27 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# .github/release.yml

changelog:
exclude:
labels:
- cicd
- scripts
- test
categories:
- title: Breaking Changes 🛠
labels:
- Major
- breaking-change
- title: New Features 🎉
labels:
- Minor
- enhancement
- Feature

- title: Bug Fixes 🎉
labels:
- Patch
- bug
- title: Other Changes
labels:
- "*"

12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Release"
on:
push:
tags:
- '*' # Run release on any tag. Will be marked as draft by default anyway.
- 'v*.*.*-alpha.*' # Run release on any tag. Will be marked as draft by default anyway.

jobs:
goreleaser:
Expand All @@ -17,9 +17,15 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.20
go-version: 1.19

- run: echo https://github.com/cosmos/relayer/blob/${GITHUB_REF#refs/tags/}/CHANGELOG.md#${GITHUB_REF#refs/tags/} > ../release_notes.md
# setup gopath
- name: Set PATH
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash

- run: echo https://github.com/icon-project/ibc-relay/blob/${GITHUB_REF#refs/tags/}/CHANGELOG.md#${GITHUB_REF#refs/tags/} > ../release_notes.md

- name: setup release environment
run: |-
Expand Down
9 changes: 4 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
project_name: Cosmos Relayer

project_name: ibc-relay
builds:
- id: darwin-amd64
main: ./main.go
Expand All @@ -14,7 +13,7 @@ builds:
flags:
- -mod=readonly
ldflags:
- -s -w -X github.com/cosmos/relayer/v2/cmd.Version={{ .Tag }}
- -s -w -X github.com/icon-project/ibc-relay/v2/cmd.Version={{ .Tag }}
- id: darwin-arm64
main: ./main.go
binary: rly
Expand All @@ -28,7 +27,7 @@ builds:
flags:
- -mod=readonly
ldflags:
- -s -w -X github.com/cosmos/relayer/v2/cmd.Version={{ .Tag }}
- -s -w -X github.com/icon-project/ibc-relay/v2/cmd.Version={{ .Tag }}
- id: linux-amd64
main: ./main.go
binary: rly
Expand All @@ -42,7 +41,7 @@ builds:
flags:
- -mod=readonly
ldflags:
- -s -w -X github.com/cosmos/relayer/v2/cmd.Version={{ .Tag }}
- -s -w -X github.com/icon-project/ibc-relay/v2/cmd.Version={{ .Tag }}
- id: linux-arm64
main: ./main.go
binary: rly
Expand Down
170 changes: 107 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
![banner](./docs/images/comp.gif)

[![Project Status: Initial Release](https://img.shields.io/badge/repo%20status-active-green.svg?style=flat-square)](https://www.repostatus.org/#active)
![GitHub Workflow Status](https://github.com/cosmos/relayer/actions/workflows/build.yml/badge.svg)
![GitHub Workflow Status](https://github.com/icon-project/ibc-relay/actions/workflows/build.yml/badge.svg)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue?style=flat-square&logo=go)](https://godoc.org/github.com/cosmos/relayer)
[![Go Report Card](https://goreportcard.com/badge/github.com/cosmos/relayer)](https://goreportcard.com/report/github.com/cosmos/relayer)
[![License: Apache-2.0](https://img.shields.io/github/license/cosmos/relayer.svg?style=flat-square)](https://github.com/cosmos/relayer/blob/main/LICENSE)
[![Lines Of Code](https://img.shields.io/tokei/lines/github/cosmos/relayer?style=flat-square)](https://github.com/cosmos/relayer)
[![Version](https://img.shields.io/github/tag/cosmos/relayer.svg?style=flat-square)](https://github.com/cosmos/relayer/latest)
[![Go Report Card](https://goreportcard.com/badge/github.com/icon-project/ibc-relay)](https://goreportcard.com/report/github.com/icon-project/ibc-relay)
[![License: Apache-2.0](https://img.shields.io/github/license/icon-project/ibc-relay.svg?style=flat-square)](https://github.com/icon-project/ibc-relay/blob/main/LICENSE)
[![Lines Of Code](https://img.shields.io/tokei/lines/github/icon-project/ibc-relay?style=flat-square)](https://github.com/icon-project/ibc-relay)
[![Version](https://img.shields.io/github/tag/icon-project/ibc-relay.svg?style=flat-square)](https://github.com/icon-project/ibc-relay/latest)
[![codecov](https://codecov.io/gh/icon-project/ibc-relay/branch/main/graph/badge.svg?token=3OSG4KPSPZ)](https://codecov.io/gh/icon-project/ibc-relay)
</div>

---

This repo is a fork of cosmos [relayer](https://github.com/cosmos/relayer). The goal of this project is to relay packets between ICON and Wasm chains by following the IBC Specs.
1. [What is ICON-IBC Integration](https://github.com/icon-project/IBC-Integration)
2. [Deviations from Cosmos Relayer](./docs/deviations_from_ibc.md)
---


In IBC, blockchains do not directly pass messages to each other over the network. This is where `relayer` comes in.
A relayer process monitors for updates on opens paths between sets of [IBC](https://ibcprotocol.org/) enabled chains.
The relayer submits these updates in the form of specific message types to the counterparty chain. Clients are then used to
Expand All @@ -24,16 +32,21 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n

---

## Demo
- The easiest way would be to follow the guide in [this repo](https://github.com/izyak/icon-ibc/tree/master) to setup relay for icon ibc integration. It has all the relevant scripts setup, and you can start the relay using a single command.
- There is E2E tests demo for icon ibc integration [here](https://github.com/icon-project/IBC-Integration/blob/main/docs/e2e_test_setup.md)
---

## Table Of Contents
- [Basic Usage - Relaying Across Chains](#Basic-Usage---Relaying-Packets-Across-Chains)
- [Basic Usage - Relaying Across Chains](#basic-usage---relaying-packets-across-chains)
- [Create Path Across Chains](./docs/create-path-across-chain.md)
- [Advanced Usage](./docs/advanced_usage.md)
- [Troubleshooting](./docs/troubleshooting.md)
- [Features](./docs/features.md)
- [Relayer Terminology](./docs/terminology.md)
- [New Chain Implementation](./docs/chain_implementation.md)
- [Recommended Pruning Settings](./docs/node_pruning.md)
- [Demo/Dev-Environmnet](./examples/README.md)
- [Running Relayer Locally](https://github.com/izyak/icon-ibc/blob/master/README.md)

---
## Basic Usage - Relaying Packets Across Chains
Expand All @@ -48,7 +61,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
$ make install
```

Expand All @@ -74,57 +87,63 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
To omit the memo entirely, including the default value of `rly(VERSION)`, use `-` for the memo.

3. **Configure the chains you want to relay between.**

In our example, we will configure the relayer to operate on the canonical path between the Cosmos Hub and Osmosis.
<br>
The `rly chains add` command fetches chain meta-data from the [chain-registry](https://github.com/cosmos/chain-registry) and adds it to your config file.
In out example, we will configure the relayer to operate between ICON and Archway.
<br>

To add the chain config files manually, example config files have been included [here](./examples/demo/configs/chains/) Modify the config file as per your requirements and run the following command:
```shell
$ rly chains add cosmoshub osmosis
```

Adding chains from the chain-registry randomly selects an RPC address from the registry entry.
If you are running your own node, manually go into the config and adjust the `rpc-addr` setting.

> NOTE: `rly chains add` will check the liveliness of the available RPC endpoints for that chain in the chain-registry.
> It is possible that the command will fail if none of these RPC endpoints are available. In this case, you will want to manually add the chain config.

To add the chain config files manually, example config files have been included [here](https://github.com/cosmos/relayer/tree/main/docs/example-configs/)
```shell
$ rly chains add --url https://raw.githubusercontent.com/cosmos/relayer/main/docs/example-configs/cosmoshub-4.json cosmoshub
$ rly chains add --url https://raw.githubusercontent.com/cosmos/relayer/main/docs/example-configs/osmosis-1.json osmosis
$ rly chains add icon --file _path_to_/examples/demo/configs/chains/ibc-icon.json
$ rly chains add archway --file _path_to_/examples/demo/configs/chains/ibc-archway.json
```

4. **Import OR create new keys for the relayer to use when signing and relaying transactions.**

- For Cosmos chains:

>`key-name` is an identifier of your choosing.
>`key-name` is an identifier of your choosing.

If you need to generate a new private key you can use the `add` subcommand.
If you need to generate a new private key you can use the `add` subcommand.

```shell
$ rly keys add cosmoshub [key-name]
$ rly keys add osmosis [key-name]
```

If you already have a private key and want to restore it from your mnemonic you can use the `restore` subcommand.
```shell
$ rly keys add archway [key-name]
```

If you already have a private key and want to restore it from your mnemonic you can use the `restore` subcommand.

```shell
$ rly keys restore cosmoshub [key-name] "mnemonic words here"
$ rly keys restore osmosis [key-name] "mnemonic words here"
```
```shell
$ rly keys restore archway [key-name] "mnemonic words here"
```
- For Icon chain
To generate a new wallet for icon, you can use `add` subcommmand with password flag. If you do not supply `--password` flag, the default password is `x`
```shell
$ rly keys add icon [key-name] --password "password"
```

5. **Edit the relayer's `key` values in the config file to match the `key-name`'s chosen above.**

>This step is necessary if you chose a `key-name` other than "default"
5. **Edit the relayer's `key` values in the config file to match the `key-name`'s chosen above.**
- *For Archway*
>This step is necessary if you chose a `key-name` other than "default"

Example:
Example:

```yaml
- type: cosmos
value:
key: YOUR-KEY-NAME-HERE
chain-id: cosmoshub-4
rpc-addr: http://localhost:26657
- type: wasm
value:
key: YOUR-KEY-NAME-HERE
chain-id: localnet
rpc-addr: http://localhost:26657
```
- *For Icon*

```yaml
- type: icon
value:
keystore: YOUR-KEY-NAME-HERE
password: YOUR-KEY-PASSWORD-HERE
chain-id: ibc-icon
```


6. **Ensure the keys associated with the configured chains are funded.**

Expand All @@ -134,26 +153,45 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
You can query the balance of each configured key by running:

```shell
$ rly q balance cosmoshub
$ rly q balance osmosis
$ rly q balance icon [key-name]
$ rly q balance archway [key-name]
```

7. **Configure path meta-data in config file.**
<br>
We have the chain meta-data configured, now we need path meta-data. For more info on `path` terminology visit [here](docs/troubleshooting.md).
>NOTE: Thinking of chains in the config as "source" and "destination" can be confusing. Be aware that most path are bi-directional.

To add the chain config files manually, example config files have been included [here](./examples/demo/configs/paths/icon-archway.json) . Modify this file as per your requirements and run the following command.
<br>

```shell
$ rly paths add [chain-id-1] [chain-id-2] [path-name] --file _path_to/ibc-relay/examples/demo/configs/paths/icon-archway.json
```
8. **Client Creation and Handshaking [Optional]**
<br/>
If you want to create your own client, channels and connection to relay between chains, run the following command:
<br>

`rly paths fetch` will check for IBC path meta data from the [chain-registry](https://github.com/cosmos/chain-registry/tree/master/_IBC) and add these paths to your config file.
To create clients between chains
> Ensure that [btp-height] is a valid bto block height. This height will be used to create client for icon's counterparty chain .
```shell
rly tx clients [path-name] --client-tp "10000000m" --btp-block-height [btp-height]
```

```shell
$ rly paths fetch
```
> **NOTE:** Don't see the path metadata for paths you want to relay on?
> Please open a PR to add this metadata to the GitHub repo!
To create connection
```shell
rly tx conn [path-name]
```

To create channels
```sh
rly tx chan [path-name] --src-port=[src-port] --dst-port=[dst-port]
```

8. #### **Configure the channel filter.**
This step can entirely be skipped if connection and channel exists between 2 chains you want to relay. Ensure that client-id and connection-id are provided in the paths for this.

9. #### **Configure the channel filter [Optional]**

By default, the relayer will relay packets over all channels on a given connection.
<br>
Expand All @@ -169,18 +207,18 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
<br>
Example:
```yaml
hubosmo:
icon-archway:
src:
chain-id: cosmoshub-4
client-id: 07-tendermint-259
connection-id: connection-257
chain-id: ibc-icon
client-id: 07-tendermint-0
connection-id: connection-0
dst:
chain-id: osmosis-1
client-id: 07-tendermint-1
connection-id: connection-1
chain-id: localnet
client-id: iconclient-0
connection-id: connection-0
src-channel-filter:
rule: allowlist
channel-list: [channel-141]
rule: allowlist
channel-list: []
```

>Because two channels between chains are tightly coupled, there is no need to specify the dst channels.
Expand All @@ -203,10 +241,16 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
[[TROUBLESHOOTING](docs/troubleshooting.md)]
---

## Build Docker Image of Relayer
To build the docker image of the relayer, use the following command:
```sh
docker build -t .
```

## Security Notice

If you would like to report a security critical bug related to the relayer repo,
please reach out @jackzampolin or @Ethereal0ne on telegram.
please reach out @applexxx or @astra#2705 on discord.

## Code of Conduct

Expand Down
9 changes: 8 additions & 1 deletion cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
const (
flagCoinType = "coin-type"
flagAlgo = "signing-algorithm"
flagPassword = "password"
defaultCoinType uint32 = sdk.CoinType
)

Expand Down Expand Up @@ -97,6 +98,11 @@
return err
}

password, err := cmdFlags.GetString(flagPassword)
if err != nil {
return err
}

Check warning on line 104 in cmd/keys.go

View check run for this annotation

Codecov / codecov/patch

cmd/keys.go#L101-L104

Added lines #L101 - L104 were not covered by tests

if algo == "" {
if ccp, ok := chain.ChainProvider.(*cosmos.CosmosProvider); ok {
algo = ccp.PCfg.SigningAlgorithm
Expand All @@ -105,7 +111,7 @@
}
}

ko, err := chain.ChainProvider.AddKey(keyName, uint32(coinType), algo)
ko, err := chain.ChainProvider.AddKey(keyName, uint32(coinType), algo, password)

Check warning on line 114 in cmd/keys.go

View check run for this annotation

Codecov / codecov/patch

cmd/keys.go#L114

Added line #L114 was not covered by tests
if err != nil {
return fmt.Errorf("failed to add key: %w", err)
}
Expand All @@ -121,6 +127,7 @@
}
cmd.Flags().Int32(flagCoinType, -1, "coin type number for HD derivation")
cmd.Flags().String(flagAlgo, "", "signing algorithm for key (secp256k1, sr25519)")
cmd.Flags().String(flagPassword, "x", "icon keystore password")

return cmd
}
Expand Down
Loading
Loading