Skip to content

Commit ea84402

Browse files
committed
Merge branch 'master' into Cezara
2 parents a9611fa + daeb8dc commit ea84402

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1562
-1124
lines changed

CHANGELOG.md

+34
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
## Unreleased Changes
44

5+
6+
### FEATURES
7+
8+
- Add support for streamlining releases ([#507])
9+
- [relayer-cli]
10+
- Implement command to query the channels associated with a connection ([#505])
11+
- JSON output for queries and txs ([#500])
12+
13+
### IMPROVEMENTS
14+
15+
- [relayer-cli]
16+
- Replace `ChannelConfig` in `Channel::new` ([#511])
17+
- Add `packet-send` CLI ([#470])
18+
19+
- [relayer]
20+
- Performance improvements ([#514])
21+
- Fix for mismatching `bitcoin` dep ([#525])
22+
23+
- [modules]
24+
- Clean the validate_basic method ([#94])
25+
26+
- Update to `tendermint-rs` v0.17.1 ([#517])
27+
28+
[#94]: https://github.com/informalsystems/ibc-rs/issues/94
29+
[#470]: https://github.com/informalsystems/ibc-rs/issues/470
30+
[#500]: https://github.com/informalsystems/ibc-rs/issues/500
31+
[#505]: https://github.com/informalsystems/ibc-rs/issues/505
32+
[#507]: https://github.com/informalsystems/ibc-rs/issues/507
33+
[#511]: https://github.com/informalsystems/ibc-rs/pull/511
34+
[#514]: https://github.com/informalsystems/ibc-rs/issues/514
35+
[#517]: https://github.com/informalsystems/ibc-rs/issues/517
36+
[#525]: https://github.com/informalsystems/ibc-rs/issues/525
37+
38+
539
## v0.0.6
640
*December 23, 2020*
741

Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ exclude = [
1313

1414
[patch.crates-io]
1515

16-
tendermint = { git = "https://github.com/informalsystems/tendermint-rs", branch = "romac/skip-verif" }
17-
tendermint-rpc = { git = "https://github.com/informalsystems/tendermint-rs", branch = "romac/skip-verif" }
18-
tendermint-proto = { git = "https://github.com/informalsystems/tendermint-rs", branch = "romac/skip-verif" }
19-
tendermint-light-client = { git = "https://github.com/informalsystems/tendermint-rs", branch = "romac/skip-verif" }
20-
tendermint-testgen = { git = "https://github.com/informalsystems/tendermint-rs", branch = "romac/skip-verif" }
16+
tendermint = { git = "https://github.com/informalsystems/tendermint-rs", branch = "ibc" }
17+
tendermint-rpc = { git = "https://github.com/informalsystems/tendermint-rs", branch = "ibc" }
18+
tendermint-proto = { git = "https://github.com/informalsystems/tendermint-rs", branch = "ibc" }
19+
tendermint-light-client = { git = "https://github.com/informalsystems/tendermint-rs", branch = "ibc" }
20+
tendermint-testgen = { git = "https://github.com/informalsystems/tendermint-rs", branch = "ibc" }

dev-env

+48-26
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,47 @@
33
# Copied from https://github.com/cosmos/relayer and modified to initialize the Rust relayer light clients.
44

55
usage() {
6-
echo "Missing $1 parameter. Please check if all parameters were specified."
7-
echo "Usage: $0 [CONFIG_FILE] [CHAIN_ID_0] [CHAIN_ID_1]"
6+
echo "Usage: $0 [CONFIG_FILE] [CHAIN_0_ID] [CHAIN_1_ID]"
87
echo "Example: $0 ./config.toml ibc-0 ibc-1"
98
exit 1
109
}
1110

11+
missing() {
12+
echo "Missing $1 parameter. Please check if all parameters were specified."
13+
usage
14+
}
15+
1216
if [ -z "$1" ]; then
13-
usage "CONFIG_FILE"
17+
missing "CONFIG_FILE"
1418
fi
1519

1620
if [ -z "$2" ]; then
17-
usage "CHAIN_ID_0"
21+
missing "CHAIN_0_ID"
1822
fi
1923

2024
if [ -z "$3" ]; then
21-
usage "CHAIN_ID_1"
25+
missing "CHAIN_1_ID"
2226
fi
2327

24-
tomlcfg="$1"
25-
chainid0="$2"
26-
chainid1="$3"
28+
if [ "$#" -gt 3 ]; then
29+
echo "Incorrect number of parameters."
30+
usage
31+
fi
32+
33+
CONFIG_FILE="$1"
34+
CHAIN_0_ID="$2"
35+
CHAIN_1_ID="$3"
36+
37+
if ! [ -f $CONFIG_FILE ]; then
38+
echo "[CONFIG_FILE] ($1) does not exist or is not a file."
39+
usage
40+
fi
2741

2842
GAIA_DATA="$(pwd)/data"
2943

3044
# Ensure user understands what will be deleted
3145
if [[ -d $GAIA_DATA ]] && [[ ! "$3" == "skip" ]]; then
32-
echo "$0 will delete $HOME/.relayer and $(pwd)/data folder."
46+
echo "$0 will delete $(pwd)/data folder."
3347
read -p "> Do you wish to continue? (y/n): " -n 1 -r
3448
echo
3549
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
@@ -50,41 +64,49 @@ echo "GAIA VERSION INFO: $(gaiad version)"
5064
rm -rf "$GAIA_DATA" &> /dev/null
5165

5266
# Stop existing gaiad processes
53-
killall gaiad &> /dev/null
54-
killall akash &> /dev/null
55-
56-
set -e
67+
killall gaiad &> /dev/null || true
68+
killall akash &> /dev/null || true
5769

5870
echo "Generating gaia configurations..."
5971
mkdir -p "$GAIA_DATA" && cd "$GAIA_DATA" && cd ../
6072

6173
ONE_CHAIN="$(dirname "$0")/one-chain"
6274

63-
"$ONE_CHAIN" gaiad "$chainid0" ./data 26657 26656 6060 9090
64-
"$ONE_CHAIN" gaiad "$chainid1" ./data 26557 26556 6061 9091
75+
CHAIN_0_RPC_PORT=26657
76+
CHAIN_0_RPC_ADDR="localhost:$CHAIN_0_RPC_PORT"
77+
CHAIN_1_RPC_PORT=26557
78+
CHAIN_1_RPC_ADDR="localhost:$CHAIN_1_RPC_PORT"
79+
80+
CHAIN_0_SAMOLEANS=100000000000
81+
CHAIN_1_SAMOLEANS=100000000000
6582

66-
[ -f "$GAIA_DATA/$chainid0.log" ] && echo "$chainid0 initialized. Watch file $GAIA_DATA/$chainid0.log to see its execution."
67-
[ -f "$GAIA_DATA/$chainid1.log" ] && echo "$chainid1 initialized. Watch file $GAIA_DATA/$chainid1.log to see its execution."
83+
"$ONE_CHAIN" gaiad "$CHAIN_0_ID" ./data $CHAIN_0_RPC_PORT 26656 6060 9090 $CHAIN_0_SAMOLEANS
84+
"$ONE_CHAIN" gaiad "$CHAIN_1_ID" ./data $CHAIN_1_RPC_PORT 26556 6061 9091 $CHAIN_1_SAMOLEANS
85+
86+
[ -f "$GAIA_DATA/$CHAIN_0_ID.log" ] && echo "$CHAIN_0_ID initialized. Watch file $GAIA_DATA/$CHAIN_0_ID.log to see its execution."
87+
[ -f "$GAIA_DATA/$CHAIN_1_ID.log" ] && echo "$CHAIN_1_ID initialized. Watch file $GAIA_DATA/$CHAIN_1_ID.log to see its execution."
6888

6989
echo "Building the Rust relayer..."
70-
cargo build
90+
cargo build &> /dev/null
7191

7292
# cleanup the client entries from config
7393
echo "Removing light client peers from configuration..."
74-
cargo run --bin relayer -- -c "$tomlcfg" light rm -c "$chainid0" --all -y &> /dev/null || true
75-
cargo run --bin relayer -- -c "$tomlcfg" light rm -c "$chainid1" --all -y &> /dev/null || true
94+
cargo run --bin relayer -- -c "$CONFIG_FILE" light rm -c "$CHAIN_0_ID" --all -y &> /dev/null || true
95+
cargo run --bin relayer -- -c "$CONFIG_FILE" light rm -c "$CHAIN_1_ID" --all -y &> /dev/null || true
7696

7797
# set the primary peers for clients on each chain
7898
echo "Adding primary peers to light client configuration..."
79-
cargo run --bin relayer -- -c "$tomlcfg" light add localhost:26657 -c "$chainid0" -f -p -s "$GAIA_DATA/$chainid0/data" -y &>/dev/null
80-
cargo run --bin relayer -- -c "$tomlcfg" light add localhost:26557 -c "$chainid1" -f -p -s "$GAIA_DATA/$chainid1/data" -y &>/dev/null
99+
cargo run --bin relayer -- -c "$CONFIG_FILE" light add $CHAIN_0_RPC_ADDR -c "$CHAIN_0_ID" -f -p -s "$GAIA_DATA/$CHAIN_0_ID/data" -y &>/dev/null
100+
cargo run --bin relayer -- -c "$CONFIG_FILE" light add $CHAIN_1_RPC_ADDR -c "$CHAIN_1_ID" -f -p -s "$GAIA_DATA/$CHAIN_1_ID/data" -y &>/dev/null
81101

82102
# set the secondary peers for clients on each chain
83103
echo "Adding secondary peers to light client configuration..."
84-
cargo run --bin relayer -- -c "$tomlcfg" light add localhost:26657 -c "$chainid0" -s "$GAIA_DATA/$chainid0/data" -y --peer-id 2427F8D914A6862279B3326FA64F76E3BC06DB2E &>/dev/null
85-
cargo run --bin relayer -- -c "$tomlcfg" light add localhost:26557 -c "$chainid1" -s "$GAIA_DATA/$chainid1/data" -y --peer-id A885BB3D3DFF6101188B462466AE926E7A6CD51E &>/dev/null
104+
cargo run --bin relayer -- -c "$CONFIG_FILE" light add $CHAIN_0_RPC_ADDR -c "$CHAIN_0_ID" -s "$GAIA_DATA/$CHAIN_0_ID/data" -y --peer-id 2427F8D914A6862279B3326FA64F76E3BC06DB2E &>/dev/null
105+
cargo run --bin relayer -- -c "$CONFIG_FILE" light add $CHAIN_1_RPC_ADDR -c "$CHAIN_1_ID" -s "$GAIA_DATA/$CHAIN_1_ID/data" -y --peer-id A885BB3D3DFF6101188B462466AE926E7A6CD51E &>/dev/null
86106

87107
# add the key seeds to the keyring of each chain
88108
echo "Importing keys..."
89-
cargo run --bin relayer -- -c "$tomlcfg" keys add "$chainid0" "$GAIA_DATA/$chainid0/key_seed.json" &>/dev/null
90-
cargo run --bin relayer -- -c "$tomlcfg" keys add "$chainid1" "$GAIA_DATA/$chainid1/key_seed.json" &>/dev/null
109+
cargo run --bin relayer -- -c "$CONFIG_FILE" keys add "$CHAIN_0_ID" "$GAIA_DATA/$CHAIN_0_ID/key_seed.json" &>/dev/null
110+
cargo run --bin relayer -- -c "$CONFIG_FILE" keys add "$CHAIN_1_ID" "$GAIA_DATA/$CHAIN_1_ID/key_seed.json" &>/dev/null
111+
112+
echo "Done!"

modules/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ regex = "1"
3838
bech32 = "0.7.2"
3939

4040
[dependencies.tendermint]
41-
version = "=0.17.0"
41+
version = "=0.17.1"
4242

4343
[dependencies.tendermint-rpc]
44-
version = "=0.17.0"
44+
version = "=0.17.1"
4545
features = ["http-client", "websocket-client"]
4646

4747
[dependencies.tendermint-light-client]
48-
version = "=0.17.0"
48+
version = "=0.17.1"
4949

5050
[dependencies.tendermint-proto]
51-
version = "=0.17.0"
51+
version = "=0.17.1"
5252

5353
[dependencies.tendermint-testgen]
54-
version = "=0.17.0"
54+
version = "=0.17.1"
5555
optional = true
5656

5757
[dev-dependencies]
5858
tokio = { version = "0.2", features = ["macros"] }
5959
subtle-encoding = { version = "0.5" }
60-
tendermint-testgen = { version = "=0.17.0" } # Needed for generating (synthetic) light blocks.
60+
tendermint-testgen = { version = "=0.17.1" } # Needed for generating (synthetic) light blocks.

modules/src/address.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ pub fn string_to_account(raw: String) -> Result<AccountId, BoxError> {
1919
let addr_bytes =
2020
Vec::<u8>::from_base32(&data).map_err(|e| Context::new("bad signer", Some(e.into())))?;
2121

22-
Ok(AccountId::try_from(addr_bytes).map_err(|e| Context::new("bad signer", Some(e)))?)
22+
Ok(AccountId::try_from(addr_bytes).map_err(|e| Context::new("bad signer", Some(e.into())))?)
2323
}

modules/src/application/ics20_fungible_token_transfer/msgs/transfer.rs

-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ impl Msg for MsgTransfer {
4343
crate::keys::ROUTER_KEY.to_string()
4444
}
4545

46-
fn validate_basic(&self) -> Result<(), Self::ValidationError> {
47-
Ok(())
48-
}
49-
5046
fn type_url(&self) -> String {
5147
TYPE_URL.to_string()
5248
}

modules/src/ics02_client/client_def.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use prost_types::Any;
21
use std::convert::TryFrom;
32

3+
use prost_types::Any;
4+
use serde::Serialize;
45
use tendermint_proto::Protobuf;
56

67
use crate::downcast;
@@ -161,7 +162,8 @@ impl From<AnyHeader> for Any {
161162
}
162163
}
163164

164-
#[derive(Clone, Debug, PartialEq, Eq)]
165+
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
166+
#[serde(tag = "AnyClientState")]
165167
pub enum AnyClientState {
166168
Tendermint(TendermintClientState),
167169

@@ -196,6 +198,8 @@ impl TryFrom<Any> for AnyClientState {
196198
// TODO Fix type urls: avoid having hardcoded values sprinkled around the whole codebase.
197199
fn try_from(raw: Any) -> Result<Self, Self::Error> {
198200
match raw.type_url.as_str() {
201+
"" => Err(Kind::EmptyClientState.into()),
202+
199203
TENDERMINT_CLIENT_STATE_TYPE_URL => Ok(AnyClientState::Tendermint(
200204
TendermintClientState::decode_vec(&raw.value)
201205
.map_err(|e| Kind::InvalidRawClientState.context(e))?,
@@ -255,7 +259,8 @@ impl ClientState for AnyClientState {
255259
}
256260
}
257261

258-
#[derive(Clone, Debug, PartialEq, Eq)]
262+
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
263+
#[serde(tag = "AnyConsensusState")]
259264
pub enum AnyConsensusState {
260265
Tendermint(TendermintConsensusState),
261266

@@ -538,11 +543,13 @@ impl ClientDef for AnyClient {
538543

539544
#[cfg(test)]
540545
mod tests {
546+
use std::convert::TryFrom;
547+
548+
use prost_types::Any;
549+
541550
use crate::ics02_client::client_def::AnyClientState;
542551
use crate::ics07_tendermint::client_state::test_util::get_dummy_tendermint_client_state;
543552
use crate::ics07_tendermint::header::test_util::get_dummy_tendermint_header;
544-
use prost_types::Any;
545-
use std::convert::TryFrom;
546553

547554
#[test]
548555
fn any_client_state_serialization() {

modules/src/ics02_client/error.rs

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ pub enum Kind {
3030
#[error("unknown client state type: {0}")]
3131
UnknownClientStateType(String),
3232

33+
#[error("empty client state")]
34+
EmptyClientState,
35+
3336
#[error("unknown client consensus state type: {0}")]
3437
UnknownConsensusStateType(String),
3538

modules/src/ics02_client/msgs/create_client.rs

-5
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ impl Msg for MsgCreateAnyClient {
6161
crate::keys::ROUTER_KEY.to_string()
6262
}
6363

64-
fn validate_basic(&self) -> Result<(), Self::ValidationError> {
65-
// Nothing to validate since all fields are validated on creation.
66-
Ok(())
67-
}
68-
6964
fn type_url(&self) -> String {
7065
TYPE_URL.to_string()
7166
}

modules/src/ics02_client/msgs/update_client.rs

-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ impl Msg for MsgUpdateAnyClient {
4444
crate::keys::ROUTER_KEY.to_string()
4545
}
4646

47-
fn validate_basic(&self) -> Result<(), Self::ValidationError> {
48-
// Nothing to validate since all fields are validated on creation.
49-
Ok(())
50-
}
51-
5247
fn type_url(&self) -> String {
5348
TYPE_URL.to_string()
5449
}

modules/src/ics02_client/raw.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
use crate::ics03_connection::error::Kind;
2-
use crate::ics24_host::identifier::ConnectionId;
31
use std::convert::TryFrom;
42
use std::str::FromStr;
3+
4+
use serde::Serialize;
5+
56
use tendermint_proto::Protobuf;
67

8+
use crate::ics03_connection::error::Kind;
9+
use crate::ics24_host::identifier::ConnectionId;
10+
711
//TODO: This might need to be migrated to ibc-proto crate. But ClientConnections (as array of strings)
812
// might not be part of an official proto file
913
#[derive(::prost::Message)]
@@ -12,7 +16,7 @@ pub struct RawClientConnections {
1216
pub connections: ::std::vec::Vec<String>,
1317
}
1418

15-
#[derive(Clone, Debug)]
19+
#[derive(Clone, Debug, Serialize)]
1620
pub struct ConnectionIds(pub Vec<ConnectionId>);
1721

1822
impl Protobuf<RawClientConnections> for ConnectionIds {}
@@ -21,19 +25,15 @@ impl TryFrom<RawClientConnections> for ConnectionIds {
2125
type Error = anomaly::Error<Kind>;
2226

2327
fn try_from(value: RawClientConnections) -> Result<Self, Self::Error> {
24-
if !value.connections.is_empty() {
25-
let mut connections: Vec<ConnectionId> = vec![];
26-
for value in value.connections {
27-
let conn_id = ConnectionId::from_str(&value.replace("connections/", ""));
28-
match conn_id {
29-
Ok(c) => connections.push(c),
30-
Err(_e) => return Err(Kind::IdentifierError.into()),
31-
}
28+
let mut connections: Vec<ConnectionId> = vec![];
29+
for value in value.connections {
30+
let conn_id = ConnectionId::from_str(&value.replace("connections/", ""));
31+
match conn_id {
32+
Ok(c) => connections.push(c),
33+
Err(_e) => return Err(Kind::IdentifierError.into()),
3234
}
33-
Ok(ConnectionIds(connections))
34-
} else {
35-
Err(Kind::ConnectionNotFound.into())
3635
}
36+
Ok(ConnectionIds(connections))
3737
}
3838
}
3939

0 commit comments

Comments
 (0)