From 2e8d8390f731866d30d37627fc66925f4b381fda Mon Sep 17 00:00:00 2001 From: Mikhail Zabaluev Date: Fri, 3 Dec 2021 15:35:17 +0200 Subject: [PATCH 1/4] Pin the abscissa version to 0.6.0-beta.1 (#1638) Unpinned, a `cargo update` "updates" it to 0.6.0-pre.2, which is later by semver, but not by the pre-release sequence used by abscissa. --- relayer-cli/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/relayer-cli/Cargo.toml b/relayer-cli/Cargo.toml index c17833f946..323371f895 100644 --- a/relayer-cli/Cargo.toml +++ b/relayer-cli/Cargo.toml @@ -71,10 +71,10 @@ version = "=0.23.1" features = ["unstable"] [dependencies.abscissa_core] -version = "0.6.0-beta.1" +version = "=0.6.0-beta.1" features = ["options"] [dev-dependencies] -abscissa_core = { version = "0.6.0-beta.1", features = ["testing"] } +abscissa_core = { version = "=0.6.0-beta.1", features = ["testing"] } once_cell = "1.8" regex = "1.5" From 859f9dcc8a006cab21eb28bcfa7c9bbfcb46663b Mon Sep 17 00:00:00 2001 From: Mikhail Zabaluev Date: Sun, 5 Dec 2021 14:03:54 +0200 Subject: [PATCH 2/4] Bump Rust toolchain to 1.57, fix lints (#1642) * Bump Rust toolchain to 1.57 * Fix trivial lints introduced in clippy 0.1.57 * Box the value in SupervisorCmd::UpdateConfig The clippy lint has a point: the enum may be too large to be efficiently sent over a channel. * Factor config errors out into a smaller error type There's been a layering violation, the config module should use its own smaller domain error. This gets rid of a clippy lint, too. * Remove reload handles for tracing subscribers They don't seem to be used for anything, and this triggers a clippy lint. * relayer-cli: Remove trivial casts in components --- .../clients/ics07_tendermint/client_def.rs | 10 +--- .../src/core/ics03_connection/connection.rs | 12 +---- modules/src/core/ics03_connection/events.rs | 14 +----- modules/src/core/ics04_channel/channel.rs | 11 +---- modules/src/core/ics04_channel/events.rs | 15 +----- modules/src/core/ics04_channel/packet.rs | 10 ++-- modules/src/timestamp.rs | 8 +--- relayer-cli/src/components.rs | 47 ++++--------------- relayer/src/config.rs | 24 ++++------ relayer/src/config/error.rs | 18 +++++++ relayer/src/config/reload.rs | 4 +- relayer/src/error.rs | 12 ----- relayer/src/supervisor.rs | 2 +- relayer/src/supervisor/cmd.rs | 2 +- rust-toolchain.toml | 2 +- 15 files changed, 50 insertions(+), 141 deletions(-) create mode 100644 relayer/src/config/error.rs diff --git a/modules/src/clients/ics07_tendermint/client_def.rs b/modules/src/clients/ics07_tendermint/client_def.rs index 2eace19293..351ffffa2a 100644 --- a/modules/src/clients/ics07_tendermint/client_def.rs +++ b/modules/src/clients/ics07_tendermint/client_def.rs @@ -29,19 +29,11 @@ use crate::Height; use crate::downcast; -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct TendermintClient { verifier: ProdVerifier, } -impl Default for TendermintClient { - fn default() -> Self { - Self { - verifier: ProdVerifier::default(), - } - } -} - impl ClientDef for TendermintClient { type Header = Header; type ClientState = ClientState; diff --git a/modules/src/core/ics03_connection/connection.rs b/modules/src/core/ics03_connection/connection.rs index d03e22315e..5c379fe3f0 100644 --- a/modules/src/core/ics03_connection/connection.rs +++ b/modules/src/core/ics03_connection/connection.rs @@ -235,23 +235,13 @@ impl ConnectionEnd { } } -#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Counterparty { client_id: ClientId, pub connection_id: Option, prefix: CommitmentPrefix, } -impl Default for Counterparty { - fn default() -> Self { - Counterparty { - client_id: Default::default(), - connection_id: None, - prefix: Default::default(), - } - } -} - impl Protobuf for Counterparty {} // Converts from the wire format RawCounterparty. Typically used from the relayer side diff --git a/modules/src/core/ics03_connection/events.rs b/modules/src/core/ics03_connection/events.rs index a3a8b73b5e..1ab4dbdcd3 100644 --- a/modules/src/core/ics03_connection/events.rs +++ b/modules/src/core/ics03_connection/events.rs @@ -71,7 +71,7 @@ fn extract_attributes_from_tx(event: &tendermint::abci::Event) -> Result, @@ -80,18 +80,6 @@ pub struct Attributes { pub counterparty_client_id: ClientId, } -impl Default for Attributes { - fn default() -> Self { - Attributes { - height: Default::default(), - connection_id: Default::default(), - client_id: Default::default(), - counterparty_connection_id: Default::default(), - counterparty_client_id: Default::default(), - } - } -} - /// Convert attributes to Tendermint ABCI tags /// /// # Note diff --git a/modules/src/core/ics04_channel/channel.rs b/modules/src/core/ics04_channel/channel.rs index 15e0ad946a..2965a08153 100644 --- a/modules/src/core/ics04_channel/channel.rs +++ b/modules/src/core/ics04_channel/channel.rs @@ -244,21 +244,12 @@ impl ChannelEnd { } } -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] pub struct Counterparty { pub port_id: PortId, pub channel_id: Option, } -impl Default for Counterparty { - fn default() -> Self { - Counterparty { - port_id: Default::default(), - channel_id: None, - } - } -} - impl Counterparty { pub fn new(port_id: PortId, channel_id: Option) -> Self { Self { diff --git a/modules/src/core/ics04_channel/events.rs b/modules/src/core/ics04_channel/events.rs index 8483df271f..972794c8a8 100644 --- a/modules/src/core/ics04_channel/events.rs +++ b/modules/src/core/ics04_channel/events.rs @@ -180,7 +180,7 @@ fn extract_packet_and_write_ack_from_tx( Ok((packet, write_ack)) } -#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Attributes { pub height: Height, pub port_id: PortId, @@ -199,19 +199,6 @@ impl Attributes { } } -impl Default for Attributes { - fn default() -> Self { - Attributes { - height: Default::default(), - port_id: Default::default(), - channel_id: Default::default(), - connection_id: Default::default(), - counterparty_port_id: Default::default(), - counterparty_channel_id: Default::default(), - } - } -} - /// Convert attributes to Tendermint ABCI tags /// /// # Note diff --git a/modules/src/core/ics04_channel/packet.rs b/modules/src/core/ics04_channel/packet.rs index 8273cedb01..12ec013549 100644 --- a/modules/src/core/ics04_channel/packet.rs +++ b/modules/src/core/ics04_channel/packet.rs @@ -54,15 +54,11 @@ impl core::fmt::Display for PacketMsgType { } /// The sequence number of a packet enforces ordering among packets from the same source. -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize, Serialize, PartialOrd, Ord)] +#[derive( + Copy, Clone, Debug, Default, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize, +)] pub struct Sequence(u64); -impl Default for Sequence { - fn default() -> Self { - Sequence(0) - } -} - impl FromStr for Sequence { type Err = Error; diff --git a/modules/src/timestamp.rs b/modules/src/timestamp.rs index ece5c63e67..500ea37377 100644 --- a/modules/src/timestamp.rs +++ b/modules/src/timestamp.rs @@ -20,7 +20,7 @@ pub const ZERO_DURATION: Duration = Duration::from_secs(0); /// a `u64` value and a raw timestamp. In protocol buffer, the timestamp is /// represented as a `u64` Unix timestamp in nanoseconds, with 0 representing the absence /// of timestamp. -#[derive(PartialEq, Eq, Copy, Clone, Debug, Deserialize, Serialize, Hash)] +#[derive(PartialEq, Eq, Copy, Clone, Debug, Default, Deserialize, Serialize, Hash)] pub struct Timestamp { time: Option>, } @@ -241,12 +241,6 @@ impl From