Skip to content

Commit

Permalink
Merge branch 'main' into justin/deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jtieri authored Mar 27, 2024
2 parents 7b5e8ef + bc46373 commit 08e5b10
Show file tree
Hide file tree
Showing 32 changed files with 143 additions and 105 deletions.
5 changes: 5 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[codespell]
skip = *.pulsar.go,*.pb.go,*.pb.gw.go,*.json,*.git,*.bin,*.sum,*.mod,query_test.go
ignore-words-list = usera
count =
quiet-level = 3
35 changes: 35 additions & 0 deletions .github/workflows/chores.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: chores

on:
pull_request:

jobs:
link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/[email protected]

typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run codespell
continue-on-error: true
run: |
# .codespellrc is used
sudo apt-get install codespell -y
codespell -w --config .codespellrc
exit $?
pr-title-format:
name: Lint PR Title
permissions:
pull-requests: read
statuses: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* [\#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.
* [\#1302](https://github.com/cosmos/relayer/pull/1302) Avoid packet get relayed when estimated gas is higher than max gas.
* [\#1303](https://github.com/cosmos/relayer/pull/1303) Add missing max gas amount on txf to avoid estimate less gas when simualte runTx.
* [\#1303](https://github.com/cosmos/relayer/pull/1303) Add missing max gas amount on txf to avoid estimate less gas when simulate runTx.
* [\#1324](https://github.com/cosmos/relayer/pull/1324) Add log-level in global config.
* [\#1325](https://github.com/cosmos/relayer/pull/1325) Ignore only file not exist error when loadConfigFile.
* [\#1326](https://github.com/cosmos/relayer/pull/1326) Avoid sending channel close confirm message after channel get closed successfully.
Expand Down Expand Up @@ -137,7 +137,7 @@
### CLI/scripts

* [\#412](https://github.com/cosmos/relayer/pull/412) Auto update clients to prevent expiry. `rly start` command supports auto updating a client if it is about to expire. Use the `--time-threshold` flag.
* [\#323](https://github.com/cosmos/relayer/pull/323) Implmenet an API server. A rest server with API endpoints to support interacting with the relayer
* [\#323](https://github.com/cosmos/relayer/pull/323) Implement an API server. A rest server with API endpoints to support interacting with the relayer
* [\#406](https://github.com/cosmos/relayer/pull/406) Split `add-dir` into `add-chains` and `add-paths`. You must add a chain, then the keys, and then the paths. This enables support of bottom up validation.
* [\#428](https://github.com/cosmos/relayer/pull/428) Fix add-paths failure when called on exiting configuration
* [\#427](https://github.com/cosmos/relayer/pull/427) Fix nil paths bug which occurred when validating paths
Expand All @@ -154,5 +154,5 @@

* (deps) Bump SDK version to [v0.41.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.0).
* Bug fixes and minor improvements
* (relayer)[\#329](https://github.com/cosmos/relayer/issues/329) client, conenction, and channel handshake refactor (identifiers generated auto generated on-chain)
* (relayer)[\#329](https://github.com/cosmos/relayer/issues/329) client, connection, and channel handshake refactor (identifiers generated auto generated on-chain)
* (relayer)[\#386](https://github.com/cosmos/relayer/pull/386) client, connection and channel identifier reuse
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ get-gaia:
@git clone --branch $(GAIA_VERSION) --depth=1 https://github.com/cosmos/gaia.git $(GAIA_REPO)

build-gaia:
@[ -d $(GAIA_REPO) ] || { echo "Repositry for gaia does not exist at $(GAIA_REPO). Try running 'make get-gaia'..." ; exit 1; }
@[ -d $(GAIA_REPO) ] || { echo "Repository for gaia does not exist at $(GAIA_REPO). Try running 'make get-gaia'..." ; exit 1; }
@cd $(GAIA_REPO) && \
make install &> /dev/null
@gaiad version --long
Expand Down
77 changes: 39 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
[![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)
[![Version](https://img.shields.io/github/tag/cosmos/relayer.svg?style=flat-square)](https://github.com/cosmos/relayer/releases/latest)
</div>

In IBC, blockchains do not directly pass messages to each other over the network. This is where `relayer` comes in.
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
The relayer submits these updates in the form of specific message types to the counterparty chain. Clients are then used to
track and verify the consensus state.

In addition to relaying packets, this relayer can open paths across chains, thus creating clients, connections and channels.
Expand All @@ -24,7 +24,7 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
---

## 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)
Expand All @@ -35,6 +35,7 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
- [Demo/Dev-Environment](./examples/README.md)

---

## Basic Usage - Relaying Packets Across Chains

> The `-h` (help) flag tailing any `rly` command will be your best friend. USE THIS IN YOUR RELAYING JOURNEY.
Expand All @@ -52,7 +53,7 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
```

2. **Initialize the relayer's configuration directory/file.**
```shell
$ rly config init
```
Expand All @@ -66,45 +67,45 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
$ 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.5.2` would result in a transaction memo of `My custom memo | rly(v2.5.2)`.
Custom memos will have `rly(VERSION)` appended. For example, a memo of `My custom memo` running on relayer version `v2.5.2` would result in a transaction memo of `My custom memo | rly(v2.5.2)`.
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.
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.
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.
```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.
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
```
4. **Import OR create new keys for the relayer to use when signing and relaying transactions.**
>`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.
```shell
$ rly keys add cosmoshub [key-name]
$ rly keys add osmosis [key-name]
$ 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
Expand All @@ -115,18 +116,18 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
5. **Use the `key-name` created above.**
>This step is necessary if you chose a `key-name` other than "default"
```shell
$ rly keys use cosmoshub [key-name]
$ rly keys use osmosis [key-name]
$ rly keys use cosmoshub [key-name]
$ rly keys use osmosis [key-name]
```
6. **Ensure the keys associated with the configured chains are funded.**
>Your configured addresses will need to contain some of the respective native tokens for paying relayer fees.
>Your configured addresses will need to contain some of the respective native tokens for paying relayer fees.
<br>
You can query the balance of each configured key by running:
You can query the balance of each configured key by running:
```shell
$ rly q balance cosmoshub
Expand All @@ -135,7 +136,7 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
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).
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.
<br>
Expand All @@ -145,22 +146,22 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
```shell
$ rly paths fetch
```
> **NOTE:** Don't see the path metadata for paths you want to relay on?
> **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!

8. #### **Configure the channel filter.**
By default, the relayer will relay packets over all channels on a given connection.

By default, the relayer will relay packets over all channels on a given connection.
<br>
Each path has a `src-channel-filter` which you can utilize to specify which channels you would like to relay on.
Each path has a `src-channel-filter` which you can utilize to specify which channels you would like to relay on.
<br>
The `rule` can be one of three values:
The `rule` can be one of three values:
- `allowlist` which tells the relayer to relay on _ONLY_ the channels in `channel-list`
- `denylist` which tells the relayer to relay on all channels _BESIDES_ the channels in `channel-list`
- empty value, which is the default setting, and tells the relayer to relay on all channels
- empty value, which is the default setting, and tells the relayer to relay on all channels
<br>
Since we are only worried about the canonical channel between the Cosmos Hub and Osmosis our filter settings would look like the following.

Since we are only worried about the canonical channel between the Cosmos Hub and Osmosis our filter settings would look like the following.
<br>
Example:
```yaml
Expand All @@ -175,9 +176,9 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
connection-id: connection-1
src-channel-filter:
rule: allowlist
channel-list: [channel-141]
channel-list: [channel-141]
```

>Because two channels between chains are tightly coupled, there is no need to specify the dst channels.
>If you only know the "dst" channel-ID you can query the "src" channel-ID by running: `rly q channel <dst_chain_name> <dst_channel_id> <port> | jq '.channel.counterparty.channel_id'`

Expand All @@ -189,9 +190,9 @@ Additional information on how IBC works can be found [here](https://ibc.cosmos.n
$ rly paths list
$ rly start [path]
# Optionally you can omit the `path` argument to start all configured paths
$ rly start
$ rly start
```

>When running multiple instances of `rly start`, you will need to use the `--debug-addr` flag and provide an address:port. You can also pass an empty string `''` to turn off this feature or pass `localhost:0` to randomly select a port.

---
Expand Down
12 changes: 6 additions & 6 deletions cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $ %s keys use ibc-0 key_name`, appName)),
return cmd
}

// keysAddCmd respresents the `keys add` command
// keysAddCmd represents the `keys add` command
func keysAddCmd(a *appState) *cobra.Command {
cmd := &cobra.Command{
Use: "add chain_name key_name",
Expand Down Expand Up @@ -143,7 +143,7 @@ $ %s k a cosmoshub testkey`, appName, appName, appName)),
return cmd
}

// keysRestoreCmd respresents the `keys add` command
// keysRestoreCmd represents the `keys add` command
func keysRestoreCmd(a *appState) *cobra.Command {
cmd := &cobra.Command{
Use: "restore chain_name key_name mnemonic",
Expand Down Expand Up @@ -265,7 +265,7 @@ $ %s k r demo-key "[mnemonic-words]" --restore-all`, appName, appName, appName))
return cmd
}

// keysDeleteCmd respresents the `keys delete` command
// keysDeleteCmd represents the `keys delete` command
func keysDeleteCmd(a *appState) *cobra.Command {
cmd := &cobra.Command{
Use: "delete chain_name key_name",
Expand Down Expand Up @@ -326,7 +326,7 @@ func askForConfirmation(a *appState, stdin io.Reader, stderr io.Writer) bool {
}
}

// keysListCmd respresents the `keys list` command
// keysListCmd represents the `keys list` command
func keysListCmd(a *appState) *cobra.Command {
cmd := &cobra.Command{
Use: "list chain_name",
Expand Down Expand Up @@ -364,7 +364,7 @@ $ %s k l ibc-1`, appName, appName)),
return cmd
}

// keysExportCmd respresents the `keys export` command
// keysExportCmd represents the `keys export` command
func keysExportCmd(a *appState) *cobra.Command {
cmd := &cobra.Command{
Use: "export chain_name key_name",
Expand Down Expand Up @@ -425,7 +425,7 @@ func (a *appState) showAddressByChainAndKey(cmd *cobra.Command, args []string) e
return nil
}

// keysShowCmd respresents the `keys show` command
// keysShowCmd represents the `keys show` command
func keysShowCmd(a *appState) *cobra.Command {
cmd := &cobra.Command{
Use: "show chain_name [key_name]",
Expand Down
8 changes: 4 additions & 4 deletions docs/advanced_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Exported metrics:
| cosmos_relayer_client_expiration_seconds | Seconds until the client expires | Gauge |
| cosmos_relayer_client_trusting_period_seconds | The trusting period (in seconds) of the client | Gauge |
| cosmos_relayer_unrelayed_packets | Current number of unrelayed packet sequences on a specific path and channel. This is updated after each flush (default is 5 min) | Gauge |
| cosmos_relayer_unrelayed_acks | Current number of unrelayed acknoledgment sequences on a specific path and channel. This is updated after each flush (default is 5 min) | Gauge |
| cosmos_relayer_unrelayed_acks | Current number of unrelayed acknowledgment sequences on a specific path and channel. This is updated after each flush (default is 5 min) | Gauge |



Expand All @@ -31,7 +31,7 @@ Exported metrics:

## Auto Update Light Client

By default, the Relayer will automatically update clients (`MsgUpdateClient`) if the client has <= 1/3 of its trusting period left.
By default, the Relayer will automatically update clients (`MsgUpdateClient`) if the client has <= 1/3 of its trusting period left.

> NOTE: The trusting period of the corresponding client is restored with each transaction a relayer relays. In other words, every time a relayer relays a message, it also sends a `MsgUpdateClient` message restarting the time to the clients expiration.*
Expand All @@ -49,8 +49,8 @@ Example:
Selecting a time-threshold that is greater than 2/3 of the client trusting period will deem itself useless.

Use cases for configuring the `--time-threshold` flag:
- The underlying chain node that the relayer is using as an endpoint has restrictive pruning. Client updates are needed more frequently since states 2/3 trusting period ago would not be available due to pruning.
- Mitiage relayer operational errors allowing more frequent updates incase a relayer node goes down for > the client trusting period.
- The underlying chain node that the relayer is using as an endpoint has restrictive pruning. Client updates are needed more frequently since states 2/3 trusting period ago would not be available due to pruning.
- Mitiage relayer operational errors allowing more frequent updates in case a relayer node goes down for > the client trusting period.

\* It is not mandatory for relayers to include the `MsgUpdateClient` when relaying packets, however most, if not all relayers currently do.

Expand Down
2 changes: 1 addition & 1 deletion docs/node_pruning.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Here are the settings used to configure SDK-based full nodes (assuming 3 week un
Note, operators can tweak `--pruning-keep-every` and `--pruning-interval` to their
liking.

[<-- Relayer Terminology](./terminology.md) - [Demo -->](./demo.md)
[<-- Relayer Terminology](./terminology.md) - [Demo -->](../examples/README.md)
Loading

0 comments on commit 08e5b10

Please sign in to comment.