Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into config-enum
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Oct 12, 2023
2 parents 6b5f8fb + 7742305 commit 4457c2b
Show file tree
Hide file tree
Showing 28 changed files with 323 additions and 544 deletions.
327 changes: 90 additions & 237 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ exclude = [
overflow-checks = true

[patch.crates-io]
# ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", branch = "main" }
# tendermint = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint-rpc = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
# tendermint-proto = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "main" }
Expand Down
4 changes: 2 additions & 2 deletions crates/chain-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ description = """
"""

[dependencies]
ibc-proto = { version = "0.34.0", features = ["serde"] }
ibc-proto = { version = "0.37.0", features = ["serde"] }
ibc-relayer-types = { version = "0.25.0", path = "../relayer-types" }
tendermint-rpc = { version = "0.33.0", features = [
tendermint-rpc = { version = "0.34.0", features = [
"http-client",
"websocket-client",
] }
Expand Down
6 changes: 3 additions & 3 deletions crates/relayer-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ tracing = "0.1.36"
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "json"]}
time = "0.3"
[dependencies.tendermint]
version = "0.33.0"
version = "0.34.0"
features = ["secp256k1"]

[dependencies.tendermint-rpc]
version = "0.33.0"
version = "0.34.0"
features = ["http-client", "websocket-client"]

[dependencies.tendermint-light-client-verifier]
version = "0.33.0"
version = "0.34.0"

[dependencies.abscissa_core]
version = "=0.6.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/relayer-cli/src/commands/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ mod list;
/// `keys` subcommand
#[derive(Command, Debug, Parser, Runnable)]
pub enum KeysCmd {
/// Adds key to a configured chain or restores a key to a configured chain using a mnemonic
/// Add a key to a chain from its keyring file or restore a key using its mnemonic
Add(add::KeysAddCmd),

/// Delete key(s) from a configured chain
Delete(delete::KeysDeleteCmd),

/// List keys configured on a chain
/// List keys configured for a chain
List(list::KeysListCmd),

/// Query balance for a key from a configured chain. If no key is given, the key is retrieved from the configuration file.
Expand Down
23 changes: 14 additions & 9 deletions crates/relayer-cli/src/commands/keys/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,23 @@ use crate::conclude::Output;
///
/// `keys add [OPTIONS] --chain <CHAIN_ID> --key-file <KEY_FILE>`
///
/// The command to restore a key from a file containing mnemonic:
/// The command to restore a key from a file containing its mnemonic:
///
/// `keys add [OPTIONS] --chain <CHAIN_ID> --mnemonic-file <MNEMONIC_FILE>`
///
/// The key-file and mnemonic-file flags can't be given at the same time, this will cause a terminating error.
/// On *nix platforms, both flags also accept `/dev/stdin` as a value, which will read the key or the mnemonic from stdin.
///
/// The `--key-file` and `--mnemonic-file` flags cannot both be provided at the same time, this will cause a terminating error.
///
/// If successful the key will be created or restored, depending on which flag was given.
#[derive(Clone, Command, Debug, Parser, PartialEq, Eq)]
#[clap(
override_usage = "hermes keys add [OPTIONS] --chain <CHAIN_ID> --key-file <KEY_FILE>
hermes keys add [OPTIONS] --chain <CHAIN_ID> --mnemonic-file <MNEMONIC_FILE>"
)]
#[clap(override_usage = "Add a key from a Comet keyring file:
hermes keys add [OPTIONS] --chain <CHAIN_ID> --key-file <KEY_FILE>
Add a key from a file containing its mnemonic:
hermes keys add [OPTIONS] --chain <CHAIN_ID> --mnemonic-file <MNEMONIC_FILE>
On *nix platforms, both flags also accept `/dev/stdin` as a value, which will read the key or the mnemonic from stdin.")]
pub struct KeysAddCmd {
#[clap(
long = "chain",
Expand All @@ -55,7 +60,7 @@ pub struct KeysAddCmd {
required = true,
value_name = "KEY_FILE",
help_heading = "FLAGS",
help = "Path to the key file",
help = "Path to the key file, or /dev/stdin to read the content from stdin",
group = "add-restore"
)]
key_file: Option<PathBuf>,
Expand All @@ -65,7 +70,7 @@ pub struct KeysAddCmd {
required = true,
value_name = "MNEMONIC_FILE",
help_heading = "FLAGS",
help = "Path to file containing mnemonic to restore the key from",
help = "Path to file containing the mnemonic to restore the key from, or /dev/stdin to read the mnemonic from stdin",
group = "add-restore"
)]
mnemonic_file: Option<PathBuf>,
Expand Down
3 changes: 1 addition & 2 deletions crates/relayer-cli/src/commands/listen.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use alloc::sync::Arc;
use core::{
fmt::{Display, Error as FmtError, Formatter},
ops::Deref,
str::FromStr,
};
use std::thread;
Expand Down Expand Up @@ -97,7 +96,7 @@ impl ListenCmd {
impl Runnable for ListenCmd {
fn run(&self) {
self.cmd()
.unwrap_or_else(|e| fatal_error(app_reader().deref(), &*e));
.unwrap_or_else(|e| fatal_error(app_reader(), &*e));
}
}

Expand Down
22 changes: 11 additions & 11 deletions crates/relayer-cli/src/commands/tx/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,18 +448,18 @@ impl Runnable for TxUpgradeClientsCmd {
let results = config
.chains
.iter()
.filter_map(|chain| {
(self.reference_chain_id != *chain.id()
.filter(|&chain| {
self.reference_chain_id != *chain.id()
&& (self.host_chain_id.is_none()
|| self.host_chain_id == Some(chain.id().clone())))
.then(|| {
self.upgrade_clients_for_chain(
&config,
reference_chain.clone(),
&chain.id(),
reference_upgrade_height,
)
})
|| self.host_chain_id == Some(chain.id().clone()))
})
.map(|chain| {
self.upgrade_clients_for_chain(
&config,
reference_chain.clone(),
&chain.id(),
reference_upgrade_height,
)
})
.collect();

Expand Down
18 changes: 9 additions & 9 deletions crates/relayer-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ mocks = ["tendermint-testgen", "clock"]

[dependencies]
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.34.0" }
ics23 = { version = "0.10.2", features = ["std", "host-functions"] }
ibc-proto = { version = "0.37.0" }
ics23 = { version = "0.11.0", features = ["std", "host-functions"] }
time = { version = "0.3" }
serde_derive = { version = "1.0.104" }
serde = { version = "1.0" }
serde_json = { version = "1" }
erased-serde = { version = "0.3" }
prost = { version = "0.11" }
prost = { version = "0.12" }
bytes = { version = "1.4.0" }
subtle-encoding = { version = "0.5" }
flex-error = { version = "0.4.4" }
Expand All @@ -44,24 +44,24 @@ num-rational = "0.4.1"
regex = "1"

[dependencies.tendermint]
version = "0.33.0"
version = "0.34.0"
features = ["clock"]

[dependencies.tendermint-proto]
version = "0.33.0"
version = "0.34.0"

[dependencies.tendermint-light-client-verifier]
version = "0.33.0"
version = "0.34.0"
features = ["rust-crypto"]

[dependencies.tendermint-testgen]
version = "0.33.0"
version = "0.34.0"
optional = true

[dev-dependencies]
env_logger = "0.10.0"
tracing = { version = "0.1.36", default-features = false }
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "json"] }
test-log = { version = "0.2.10", features = ["trace"] }
tendermint-rpc = { version = "0.33.0", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.33.0" } # Needed for generating (synthetic) light blocks.
tendermint-rpc = { version = "0.34.0", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.34.0" } # Needed for generating (synthetic) light blocks.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ impl Protobuf<RawMsgSubmitMisbehaviour> for MsgSubmitMisbehaviour {}
impl TryFrom<RawMsgSubmitMisbehaviour> for MsgSubmitMisbehaviour {
type Error = Error;

// NOTE: The `MsgSubmitMisbehaviour` message is has been deprecated in IBC-Go v7 in favor of a
// regular `MsgUpdateClient`, but will keep working for the foreseeable future.
#[allow(deprecated)]
fn try_from(raw: RawMsgSubmitMisbehaviour) -> Result<Self, Self::Error> {
let raw_misbehaviour = raw
.misbehaviour
Expand All @@ -55,6 +58,9 @@ impl TryFrom<RawMsgSubmitMisbehaviour> for MsgSubmitMisbehaviour {
}

impl From<MsgSubmitMisbehaviour> for RawMsgSubmitMisbehaviour {
// NOTE: The `MsgSubmitMisbehaviour` message is has been deprecated in IBC-Go v7 in favor of a
// regular `MsgUpdateClient`, but will keep working for the foreseeable future.
#[allow(deprecated)]
fn from(ics_msg: MsgSubmitMisbehaviour) -> Self {
RawMsgSubmitMisbehaviour {
client_id: ics_msg.client_id.to_string(),
Expand Down
16 changes: 8 additions & 8 deletions crates/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default = ["flex-error/std", "flex-error/eyre_tracer"]
telemetry = ["ibc-telemetry"]

[dependencies]
ibc-proto = { version = "0.34.0", features = ["serde"] }
ibc-proto = { version = "0.37.0", features = ["serde"] }
ibc-telemetry = { version = "0.25.0", path = "../telemetry", optional = true }
ibc-relayer-types = { version = "0.25.0", path = "../relayer-types", features = ["mocks"] }

Expand All @@ -34,8 +34,8 @@ tracing = "0.1.36"
tokio = { version = "1.0", features = ["rt-multi-thread", "time", "sync"] }
serde_json = { version = "1" }
bytes = "1.4.0"
prost = { version = "0.11" }
tonic = { version = "0.9", features = ["tls", "tls-roots"] }
prost = { version = "0.12" }
tonic = { version = "0.10", features = ["tls", "tls-roots"] }
futures = "0.3.27"
crossbeam-channel = "0.5.8"
hex = "0.4"
Expand Down Expand Up @@ -84,20 +84,20 @@ version = "0.4.1"
features = ["num-bigint", "serde"]

[dependencies.tendermint]
version = "0.33.0"
version = "0.34.0"
features = ["secp256k1"]

[dependencies.tendermint-rpc]
version = "0.33.0"
version = "0.34.0"
features = ["http-client", "websocket-client"]

[dependencies.tendermint-light-client]
version = "0.33.0"
version = "0.34.0"
default-features = false
features = ["rpc-client", "secp256k1", "unstable"]

[dependencies.tendermint-light-client-detector]
version = "0.33.0"
version = "0.34.0"
default-features = false

[dev-dependencies]
Expand All @@ -108,4 +108,4 @@ tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "jso
test-log = { version = "0.2.10", features = ["trace"] }

# Needed for generating (synthetic) light blocks.
tendermint-testgen = { version = "0.33.0" }
tendermint-testgen = { version = "0.34.0" }
1 change: 0 additions & 1 deletion crates/relayer/src/chain/cosmos/query/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pub async fn query_all_balances(

let request = tonic::Request::new(QueryAllBalancesRequest {
address: account_address.to_string(),
resolve_denom: false,
pagination: None,
});

Expand Down
2 changes: 1 addition & 1 deletion crates/telemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ tokio = "1.26.0"
tracing = "0.1.36"

[dependencies.tendermint]
version = "0.33.0"
version = "0.34.0"
default-features = false
12 changes: 6 additions & 6 deletions guide/src/documentation/commands/keys/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The command outputs a JSON similar to the one below.
}
```

You can save this to a file (e.g. `key_seed.json`) and use it to add to Hermes with `{{#template ../../../templates/commands/hermes/keys/add_1.md CHAIN_ID=<CHAIN_ID> KEY_FILE=key_seed.json}}`. See the `Adding Keys` section for more details.
You can save this to a file (e.g. `key_seed.json`) and use it to add to Hermes with `{{#template ../../../templates/commands/hermes/keys/add_2.md CHAIN_ID=<CHAIN_ID> KEY_FILE=key_seed.json}}`. See the `Adding Keys` section for more details.

### Adding and restoring Keys

Expand All @@ -64,7 +64,7 @@ If a key with the same `key_name` already exists, the flag `--overwrite` must be
#### Add a private key to a chain from a key file

```shell
{{#template ../../../templates/commands/hermes/keys/add_1.md CHAIN_ID=<CHAIN_ID> KEY_FILE=<PRIVATE_KEY_FILE>}}
{{#template ../../../templates/commands/hermes/keys/add_2.md CHAIN_ID=<CHAIN_ID> KEY_FILE=<PRIVATE_KEY_FILE>}}
```

The content of the file key should have the same format as the output of the `gaiad keys add` command:
Expand All @@ -90,21 +90,21 @@ Success: Added key testkey (<ADDRESS>) on <CHAIN_ID> chain
> To use a different key name, specify the `--key-name` option when invoking `keys add`.
>
> ```
> {{#template ../../../templates/commands/hermes/keys/add_1.md CHAIN_ID=<CHAIN_ID> KEY_FILE=<PRIVATE_KEY_FILE> OPTIONS= --key-name [KEY_NAME]}}
> {{#template ../../../templates/commands/hermes/keys/add_2.md CHAIN_ID=<CHAIN_ID> KEY_FILE=<PRIVATE_KEY_FILE> OPTIONS= --key-name [KEY_NAME]}}
> ```
#### Restore a private key to a chain from a mnemonic

```shell
{{#template ../../../templates/commands/hermes/keys/add_2.md CHAIN_ID=<CHAIN_ID> MNEMONIC_FILE=<MNEMONIC_FILE>}}
{{#template ../../../templates/commands/hermes/keys/add_4.md CHAIN_ID=<CHAIN_ID> MNEMONIC_FILE=<MNEMONIC_FILE>}}
```

or using an explicit [derivation path](https://github.com/satoshilabs/slips/blob/master/slip-0044.md), for example
an Ethereum coin type (used for Evmos, Injective, Umee, Cronos, and
possibly other networks):

```shell
{{#template ../../../templates/commands/hermes/keys/add_2.md CHAIN_ID=<CHAIN_ID> MNEMONIC_FILE=<MNEMONIC_FILE> OPTIONS= --hd-path "m/44'/60'/0'/0/0"}}
{{#template ../../../templates/commands/hermes/keys/add_4.md CHAIN_ID=<CHAIN_ID> MNEMONIC_FILE=<MNEMONIC_FILE> OPTIONS= --hd-path "m/44'/60'/0'/0/0"}}
```

The mnemonic file needs to have the 24 mnemonic words on the same line, separated by a white space. So the content should have the following format:
Expand All @@ -123,7 +123,7 @@ Success: Restore key testkey (<ADDRESS>) on <CHAIN_ID> chain
> To use a different key name, specify the `--key-name` option when invoking `keys add`.
>
> ```
> {{#template ../../../templates/commands/hermes/keys/add_2.md CHAIN_ID=<CHAIN_ID> MNEMONIC_FILE=<MNEMONIC_FILE> OPTIONS= --key-name <KEY_NAME>}}
> {{#template ../../../templates/commands/hermes/keys/add_4.md CHAIN_ID=<CHAIN_ID> MNEMONIC_FILE=<MNEMONIC_FILE> OPTIONS= --key-name <KEY_NAME>}}
> ```
### Delete keys
Expand Down
2 changes: 1 addition & 1 deletion guide/src/templates/commands/hermes/keys/add_1.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[[#BINARY hermes]][[#GLOBALOPTIONS]] keys add[[#OPTIONS]] --chain [[#CHAIN_ID]] --key-file [[#KEY_FILE]]
Add a key from a Comet keyring file:
2 changes: 1 addition & 1 deletion guide/src/templates/commands/hermes/keys/add_2.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[[#BINARY hermes]][[#GLOBALOPTIONS]] keys add[[#OPTIONS]] --chain [[#CHAIN_ID]] --mnemonic-file [[#MNEMONIC_FILE]]
[[#BINARY hermes]][[#GLOBALOPTIONS]] keys add[[#OPTIONS]] --chain [[#CHAIN_ID]] --key-file [[#KEY_FILE]]
1 change: 1 addition & 0 deletions guide/src/templates/commands/hermes/keys/add_3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a key from a file containing its mnemonic:
1 change: 1 addition & 0 deletions guide/src/templates/commands/hermes/keys/add_4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[[#BINARY hermes]][[#GLOBALOPTIONS]] keys add[[#OPTIONS]] --chain [[#CHAIN_ID]] --mnemonic-file [[#MNEMONIC_FILE]]
1 change: 1 addition & 0 deletions guide/src/templates/commands/hermes/keys/add_5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On flake.nix platforms, both flags also accept `/dev/stdin` as a value, which will read the key or the mnemonic from stdin.
5 changes: 2 additions & 3 deletions guide/src/templates/help_templates/keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ OPTIONS:
-h, --help Print help information

SUBCOMMANDS:
add Adds key to a configured chain or restores a key to a configured chain using a
mnemonic
add Add a key to a chain from its keyring file or restore a key using its mnemonic
balance Query balance for a key from a configured chain. If no key is given, the key is
retrieved from the configuration file
delete Delete key(s) from a configured chain
help Print this message or the help of the given subcommand(s)
list List keys configured on a chain
list List keys configured for a chain
Loading

0 comments on commit 4457c2b

Please sign in to comment.