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

Remove light client commands and configuration #793

Merged
merged 12 commits into from
Apr 7, 2021
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Added `client-upgrade` CLI ([#357])
- Update gaia to version 4.1.0 for e2e tests on CI ([#702])
- Add `start-multi` command to relay on all paths defined in the configuration ([#748])
- Add option to specify which events to listen for in `listen` command ([#550])

### IMPROVEMENTS

Expand Down Expand Up @@ -56,21 +57,26 @@
- Hermes guide: improved installation guideline ([#672])
- Make fee denom and amount configurable ([#754])

- [ibc-proto]
- Fix for proto files re-compilation bug ([#801])

### BREAKING CHANGES

- [ibc]
- `MsgConnectionOpenAck.counterparty_connection_id` is now a `ConnectionId` instead of an `Option<ConnectionId>`([#700])

- [ibc-relayer]
- [nothing yet]
- Remove the light client configuration from the global configuration ([#793])

- [ibc-relayer-cli]
- [nothing yet]
- Remove the light add and light rm commands ([#793])


[#352]: https://github.com/informalsystems/ibc-rs/issues/352
[#357]: https://github.com/informalsystems/ibc-rs/issues/357
[#416]: https://github.com/informalsystems/ibc-rs/issues/416
[#561]: https://github.com/informalsystems/ibc-rs/issues/561
[#550]: https://github.com/informalsystems/ibc-rs/issues/550
[#599]: https://github.com/informalsystems/ibc-rs/issues/599
[#630]: https://github.com/informalsystems/ibc-rs/issues/630
[#672]: https://github.com/informalsystems/ibc-rs/issues/672
Expand All @@ -91,7 +97,9 @@
[#761]: https://github.com/informalsystems/ibc-rs/issues/761
[#772]: https://github.com/informalsystems/ibc-rs/issues/772
[#770]: https://github.com/informalsystems/ibc-rs/issues/770
[#793]: https://github.com/informalsystems/ibc-rs/pull/793
[#798]: https://github.com/informalsystems/ibc-rs/issues/798
[#801]: https://github.com/informalsystems/ibc-rs/issues/801


## v0.1.1
Expand Down
24 changes: 0 additions & 24 deletions ci/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,6 @@ echo "Add keys for chains"
echo "-----------------------------------------------------------------------------------------------------------------"
hermes -c "$CONFIG_PATH" keys add "$CHAIN_A" key_seed_"$CHAIN_A".json
hermes -c "$CONFIG_PATH" keys add "$CHAIN_B" key_seed_"$CHAIN_B".json
echo "-----------------------------------------------------------------------------------------------------------------"
echo "Set the primary peers for clients on each chain "
echo "-----------------------------------------------------------------------------------------------------------------"
LIGHT_ADD_CHAIN_A="hermes -c $CONFIG_PATH light add http://$CHAIN_A:$CHAIN_A_PORT -c $CHAIN_A -s $CHAIN_A_HOME -p -y -f"
echo "Executing: $LIGHT_ADD_CHAIN_A"
bash -c "$LIGHT_ADD_CHAIN_A"
sleep 2
echo "-----------------------------------------------------------------------------------------------------------------"
LIGHT_ADD_CHAIN_B="hermes -c $CONFIG_PATH light add http://$CHAIN_B:$CHAIN_B_PORT -c $CHAIN_B -s $CHAIN_B_HOME -p -y -f"
echo "Executing: $LIGHT_ADD_CHAIN_B"
bash -c "$LIGHT_ADD_CHAIN_B"
sleep 2
echo "-----------------------------------------------------------------------------------------------------------------"
echo "Set the secondary peers for clients on each chain "
echo "-----------------------------------------------------------------------------------------------------------------"
LIGHT_ADD_CHAIN_A_PEER="hermes -c $CONFIG_PATH light add http://$CHAIN_A:$CHAIN_A_PORT -c $CHAIN_A -s $CHAIN_A_HOME --peer-id 17D46D8C1576A79203A6733F63B2C9B7235DD559 -y"
echo "Executing: $LIGHT_ADD_CHAIN_A_PEER"
bash -c "$LIGHT_ADD_CHAIN_A_PEER"
sleep 2
echo "-----------------------------------------------------------------------------------------------------------------"
LIGHT_ADD_CHAIN_B_PEER="hermes -c $CONFIG_PATH light add http://$CHAIN_B:$CHAIN_B_PORT -c $CHAIN_B -s $CHAIN_B_HOME --peer-id A885BB3D3DFF6101188B462466AE926E7A6CD51E -y"
echo "Executing: $LIGHT_ADD_CHAIN_B_PEER"
bash -c "$LIGHT_ADD_CHAIN_B_PEER"
sleep 2

echo "================================================================================================================="
echo " END-TO-END TESTS "
Expand Down
3 changes: 2 additions & 1 deletion ci/simple_config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[global]
timeout = '10s'
strategy = 'naive'
log_level = 'info'

Expand All @@ -8,6 +7,7 @@ id = 'ibc-0'
rpc_addr = 'http://ibc-0:26657'
grpc_addr = 'http://ibc-0:9090'
websocket_addr = 'ws://ibc-0:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand All @@ -22,6 +22,7 @@ id = 'ibc-1'
rpc_addr = 'http://ibc-1:26657'
grpc_addr = 'http://ibc-1:9090'
websocket_addr = 'ws://ibc-1:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand Down
3 changes: 2 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[global]
timeout = '10s'
strategy = 'naive'
log_level = 'error'

Expand All @@ -8,6 +7,7 @@ id = 'ibc-0'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9090'
websocket_addr = 'ws://127.0.0.1:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand All @@ -26,6 +26,7 @@ id = 'ibc-1'
rpc_addr = 'http://127.0.0.1:26557'
grpc_addr = 'http://127.0.0.1:9091'
websocket_addr = 'ws://127.0.0.1:26557/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand Down
11 changes: 6 additions & 5 deletions config_example.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[global]
timeout = '10s'
strategy = 'naive'
log_level = 'error'

[[chains]]
id = 'ibc-0'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
rpc_addr = 'http://localhost:26657'
grpc_addr = 'http://localhost:9090'
websocket_addr = 'ws://localhost:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand All @@ -23,9 +23,10 @@ denominator = '3'

[[chains]]
id = 'ibc-1'
rpc_addr = 'tcp://localhost:26557'
grpc_addr = 'tcp://localhost:9091'
rpc_addr = 'http://localhost:26557'
grpc_addr = 'http://localhost:9091'
websocket_addr = 'ws://localhost:26557/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
Expand Down
34 changes: 20 additions & 14 deletions docs/architecture/adr-002-ibc-relayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Changelog
* 2020-05-19: First draft. Accepted
* 2020-04-06: Configuration updates

## Definitions
These definitions are specific for this document and they may not be consistent with the IBC Specification.
Expand Down Expand Up @@ -110,20 +111,23 @@ The relayer MAY:
The initial implementation will heavily borrow from the Go relayer implementation that uses a "naive" algorithm for relaying messages. The structure of the configuration file is similar with the one in Go (see [Go-Relayer](https://github.com/cosmos/relayer))

### Configuration
(WIP)

> WIP

Upon start the relayer reads a configuration file that includes global and per chain parameters. The file format is .toml
Below is an example of a configuration file.

```toml
title = "IBC Relayer Config Example"

[global]
timeout = "10s"
strategy = "naive"
log_level = "error"

[[chains]]
id = "chain_A"
rpc_addr = "localhost:26657"
rpc_addr = "http://localhost:26657"
grpc_addr = "http://localhost:9090"
websocket_addr = "ws://localhost:26657/websocket"
rpc_timeout = "10s"
account_prefix = "cosmos"
key_name = "testkey"
store_prefix = "ibc"
Expand All @@ -135,7 +139,10 @@ strategy = "naive"

[[chains]]
id = "chain_B"
rpc_addr = "localhost:26557"
rpc_addr = "http://localhost:26557"
grpc_addr = "http://localhost:9091"
websocket_addr = "ws://localhost:26557/websocket"
rpc_timeout = "10s"
account_prefix = "cosmos"
key_name = "testkey"
store_prefix = "ibc"
Expand Down Expand Up @@ -197,13 +204,19 @@ pub enum Strategy {
}

pub struct GlobalConfig {
pub timeout: Duration,
pub strategy: Strategy,

/// All valid log levels, as defined in tracing:
/// https://docs.rs/tracing-core/0.1.17/tracing_core/struct.Level.html
pub log_level: String,
}

pub struct ChainConfig {
pub id: ChainId,
pub rpc_addr: tendermint_rpc::Url,
pub websocket_addr: tendermint_rpc::Url,
pub grpc_addr: tendermint_rpc::Url,
pub rpc_timeout: Duration,
pub account_prefix: String,
pub key_name: String,
pub client_ids: Vec<String>,
Expand Down Expand Up @@ -248,13 +261,6 @@ To validate a configuration file:

The command verifies that the specified configuration file parses and it is semantically correct.

#### Light Client Initialization
To initialize a light client:

`relayer -c <config_file> light init -x <hash> -h <height> <chain>`

The command initializes the light client for `<chain>` with a trusted height and hash. This should be done for all chains for which relaying is performed.

#### Start
To start the relayer:

Expand Down
1 change: 0 additions & 1 deletion docs/architecture/adr-006-hermes-v0.2-usecases.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ of the config file will look as follows:

```toml
[global]
timeout = '10s'
strategy = 'naive'
log_level = 'error'
log_json = 'false'
Expand Down
8 changes: 5 additions & 3 deletions proto-compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Note: the full commit hash must be specified.
Alternatively, one can check out a tag for the Cosmos SDK with the `--sdk-tag` option:

```bash
$ cargo run -- clone --out /tmp/cosmos --sdk-tag v0.42.1 --ibc-commit 333c1f338b2a14a1928a6f8ab64c37123c0e97b6
$ cargo run -- clone --out /tmp/cosmos --sdk-tag v0.42.1 --ibc-go-commit 333c1f338b2a14a1928a6f8ab64c37123c0e97b6
```

### Generate Rust sources from Protobuf definitions
Expand All @@ -34,6 +34,8 @@ To generate the Rust sources from the Protobuf definitions, and copy them to the
$ cargo run -- compile --sdk /tmp/cosmos/sdk --ibc /tmp/cosmos/ibc --out ../proto/src/prost
```

Additionally, this command will output the commit hash at which the Cosmos SDK is checked out into `$out/COSMOS_SDK_COMMIT`.
Additionally, this command will output the commit hash at which the Cosmos SDK is checked out into `$out/COSMOS_SDK_COMMIT` and
similarly the commit hash for IBC-go is saved into `$out/COSMOS_IBC_VERSION`.

This value is exposed via the `ibc_proto::COSMOS_SDK_VERSION` constant in the `ibc-proto` library.
The two commit values are exposed via the `ibc_proto::COSMOS_SDK_VERSION` and `ibc_proto::COSMOS_IBC_VERSION`
constants in the `ibc-proto` library.
40 changes: 25 additions & 15 deletions proto-compiler/src/cmd/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ pub struct CloneCmd {
out: PathBuf,
}

pub const COSMOS_SDK_URL: &str = "https://github.com/cosmos/cosmos-sdk";
pub const IBC_GO_URL: &str = "https://github.com/cosmos/ibc-go";

impl CloneCmd {
pub fn validate(&self) {
if self.sdk_commit.is_some() && self.sdk_tag.is_some() {
Expand All @@ -48,27 +51,26 @@ impl CloneCmd {
pub fn run(&self) {
self.validate();

let sdk_repo = if self.out.exists() {
let sdk_path = self.sdk_subdir();
let sdk_repo = if sdk_path.exists() {
println!(
"[info ] Found Cosmos SDK or IBC proto source at '{}'",
self.out.display()
"[info ] Found Cosmos SDK source at '{}'",
sdk_path.display()
);

Repository::open(&self.out).unwrap_or_else(|e| {
Repository::open(&sdk_path).unwrap_or_else(|e| {
println!("[error] Failed to open repository: {}", e);
process::exit(1)
})
} else {
println!("[info ] Cloning cosmos/cosmos-sdk repository...");

let url = "https://github.com/cosmos/cosmos-sdk";

let repo = Repository::clone(url, &self.sdk_subdir()).unwrap_or_else(|e| {
let repo = Repository::clone(COSMOS_SDK_URL, &sdk_path).unwrap_or_else(|e| {
println!("[error] Failed to clone the SDK repository: {}", e);
process::exit(1)
});

println!("[info ] Cloned at '{}'", self.sdk_subdir().display());
println!("[info ] Cloned at '{}'", sdk_path.display());

repo
};
Expand All @@ -87,17 +89,25 @@ impl CloneCmd {

println!("[info ] Cloning cosmos/ibc-go repository...");

let ibc_url = "https://github.com/cosmos/ibc-go";
let ibc_path = self.ibc_subdir();
let ibc_repo = if ibc_path.exists() {
println!("[info ] Found IBC Go source at '{}'", sdk_path.display());

let ibc_repo = Repository::clone(ibc_url, &self.ibc_subdir()).unwrap_or_else(|e| {
println!("[error] Failed to clone the IBC repository: {}", e);
process::exit(1)
});
Repository::open(&sdk_path).unwrap_or_else(|e| {
println!("[error] Failed to open repository: {}", e);
process::exit(1)
})
} else {
Repository::clone(IBC_GO_URL, &ibc_path).unwrap_or_else(|e| {
println!("[error] Failed to clone the IBC Go repository: {}", e);
process::exit(1)
})
};

println!("[info ] Cloned at '{}'", self.ibc_subdir().display());
println!("[info ] Cloned at '{}'", ibc_path.display());
checkout_commit(&ibc_repo, &self.ibc_go_commit).unwrap_or_else(|e| {
println!(
"[error] Failed to checkout IBC commit {}: {}",
"[error] Failed to checkout IBC Go commit {}: {}",
self.ibc_go_commit, e
);
process::exit(1)
Expand Down
Loading