Skip to content

Commit

Permalink
Added more content mostly in the configuration section (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
andynog committed Jan 27, 2021
1 parent d135e7c commit f157f17
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 5 deletions.
3 changes: 2 additions & 1 deletion guide/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
- [Local chains](./local_chains.md)
- [Configuration](./config.md)
- [Commands](./commands.md)
- [Light Clients](./light_clients.md)
- [Transactions](./transactions.md)
- [Queries](./queries.md)
- [Troubleshooting](./troubleshoot.md)
- [Common Issues](./common_issues.md)
- [FAQ](./faq.md)
---
---
173 changes: 173 additions & 0 deletions guide/src/config.md
Original file line number Diff line number Diff line change
@@ -1 +1,174 @@
# Configuration

In order to run the relayer, you will need to have a configuration file.

Currently the relayer does not store the configuration information in the local disk. Every command executed through the relayer requires the configuration file localtion to be passed as a parameter.

The relayer currently also does not support adding the sections below programmatically. You will need to use a text editor to create the file and add content to it.

The format supported for the configuration file is [TOML](https://toml.io/en/)

```bash
relayer -c config.toml
```
## Sections

Each configuration file should have one `global` and two `chains` sections (one for each chain).

### [global]

The global section has parameters that apply globally concerning the relayer operation.

#### Parameters

* __timeout__: Specify the maximum amount of time (duration) that the operations should take before timing out. Default value is `10s` (10 seconds)

* __strategy__: Specify the strategy to be used by the relayer. Currently only `naive` is supported

* __log_level__: Specify the verbosity for the relayer logging output. Valid options are 'error', 'warn', 'info', 'debug', 'trace'. Default value is `info`.

Here's an example for the `global` section:

```toml
[global]
timeout = '10s'
strategy = 'naive'
log_level = 'info'
```

### [[chains]]

A `chains` section has parameters related to a chain that the relayer can send transactions and execute queries. It also has parameters related to the light client configuration peers for the chain.

#### Parameters

* __id__: Specify the chain ID. For example `ibc-0`

* __rpc_addr__: Specify the RPC address and port where the chain RPC server listens on. For example `tcp://localhost:26657`

* __grpc_addr__: Specify the GRPC address and port where the chain GRPC server listens on. For example `tcp://localhost:9090`

* __account_prefix__: Specify the prefix used by the chain. For example `cosmos`

* __key_name__: Specify the name of the private key JSON file. This is the filename for the private key used to sign transactions on this chain. Don't specify the file extension, for example if the filename for the private key is `testkey.json`, specify only `testkey` for this parameter.

* __store_prefix__: Specify the prefix that will be used by the chain store. For example `ibc`.

* __gas__: Specify the maximum amount of gas to be used as the gas limit for a transaction. Default value is `300000`

* __clock_drift__: Specify the maximum amount of time to tolerate a clock drift. The clock drift parameter defines how much new (untrusted) header's Time can drift into the future. Default value is `5s`

* __trusting_period__: Specify the amount of time to be used as the trusting period. It should be significantly less than the unbonding period (e.g. unbonding period = 3 weeks, trusting period = 2 weeks). Default value is `14days` (336 hours)

For example if you want to add a configuration for a chain named `ibc-0`:

```toml
[[chains]]
id = 'ibc-0'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 200000
clock_drift = '5s'
trusting_period = '14days'
```

### Light clients

The configuration file also store information about the light client peers, but this configuration is automatically added by the relayer to the configuration file when running the [`relayer light add`](./light_clients.md) command


### Example configuration file

Here is an full example of a configuration file with two [local chains](./local_chains.md) configured and light client peers added:

```toml
[global]
timeout = '10s'
strategy = 'naive'
log_level = 'error'

[[chains]]
id = 'ibc-0'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 200000
clock_drift = '5s'
trusting_period = '14days'

[chains.trust_threshold]
numerator = '1'
denominator = '3'

[chains.peers]
primary = '66E3B7083DF9DD1FC57A611929BF4C505E34AA88'

[[chains.peers.light_clients]]
peer_id = '66E3B7083DF9DD1FC57A611929BF4C505E34AA88'
address = 'tcp://localhost:26657'
timeout = '10s'
trusted_header_hash = 'A24F654188BC3FC9EFE589FB33D513CE9AC86BFA48B063BDBF1D769750713E09'
trusted_height = '15'

[chains.peers.light_clients.store]
type = 'disk'
path = '/home/andy/development/github.com/informalsystems/ibc-rs/data/ibc-0/data/66E3B7083DF9DD1FC57A611929BF4C505E34AA88'

[[chains.peers.light_clients]]
peer_id = '2427F8D914A6862279B3326FA64F76E3BC06DB2E'
address = 'tcp://localhost:26657'
timeout = '10s'
trusted_header_hash = '44E7C90BFA53256AD72B84286BFDA70FE87BBC7C0D80A1DB199C72A4FBE88FB6'
trusted_height = '16'

[chains.peers.light_clients.store]
type = 'disk'
path = '/home/andy/development/github.com/informalsystems/ibc-rs/data/ibc-0/data/2427F8D914A6862279B3326FA64F76E3BC06DB2E'

[[chains]]
id = 'ibc-1'
rpc_addr = 'tcp://localhost:26557'
grpc_addr = 'tcp://localhost:9091'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
gas = 200000
clock_drift = '5s'
trusting_period = '14days'

[chains.trust_threshold]
numerator = '1'
denominator = '3'

[chains.peers]
primary = '28ED8856CBACA85DA866AB99F50DB22A58DA35F4'

[[chains.peers.light_clients]]
peer_id = '28ED8856CBACA85DA866AB99F50DB22A58DA35F4'
address = 'tcp://localhost:26557'
timeout = '10s'
trusted_header_hash = '66BD0E5ED1FA2022A036782F7D8444DB98DC0326B379BCA6BA75864295D1C910'
trusted_height = '4'

[chains.peers.light_clients.store]
type = 'disk'
path = '/home/andy/development/github.com/informalsystems/ibc-rs/data/ibc-1/data/28ED8856CBACA85DA866AB99F50DB22A58DA35F4'

[[chains.peers.light_clients]]
peer_id = 'A885BB3D3DFF6101188B462466AE926E7A6CD51E'
address = 'tcp://localhost:26557'
timeout = '10s'
trusted_header_hash = '0325BFAA36407D1F11966AEC57D34131CB27B370D3698F284F09152ADE3423C4'
trusted_height = '5'

[chains.peers.light_clients.store]
type = 'disk'
path = '/home/andy/development/github.com/informalsystems/ibc-rs/data/ibc-1/data/A885BB3D3DFF6101188B462466AE926E7A6CD51E'
```

##
1 change: 1 addition & 0 deletions guide/src/light_clients.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Light Clients
40 changes: 36 additions & 4 deletions guide/src/local_chains.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ In order to test the relayer against two chains, we provide a script that can st

The script below starts two [`gaia`](https://github.com/cosmos/gaia) chains that support the `IBC` protocol.

### Running the script

To run the script, open a terminal and navigate to the `ibc-rs` repository folder

```bash
cd ibc-rs
```

Then run the following script with the parameters below:
#### Configuration

In order to run the script, you will need a `TOML` configuration file to be passed as a parameter. Please check the [`Configuration`](./config.md) section for more information about the relayer configuration file.

#### Start the chains

Run the following script with the parameters below to start the chains:

```bash
./dev-env ./relayer-cli/tests/fixtures/two_chains.toml ibc-0 ibc-1
./dev-env two_chains.toml ibc-0 ibc-1
```

The script will configure and start two `gaiad` instances, one named `ibc-0` and the other `ibc-1`



```mermaid
graph TD
A[dev-env] -->|run| C(start chains)
Expand Down Expand Up @@ -76,4 +82,30 @@ Adding secondary peers to light client configuration...
Importing keys...
```

#### Data directory
The script will also create a `data` directory in the current directory in order to install the chain store and configuration files for each chain.

The `data` directory should have a tree structure similar to this

```shell
data
├── ibc-0
│   ├── config
│   ├── data
│   ├── keyring-test
│   ├── key_seed.json
│   └── validator_seed.json
├── ibc-0.log
├── ibc-1
│   ├── config
│   ├── data
│   ├── keyring-test
│   ├── key_seed.json
│   └── validator_seed.json
└── ibc-1.log

```

#### Next steps

Now that you have two chains running with IBC support, you can run some relayer [commands](./commands.md)

0 comments on commit f157f17

Please sign in to comment.