From 1bf72ff96b09a421b818a46cffb162b184bc8f8b Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Fri, 27 Oct 2023 16:20:53 +0200 Subject: [PATCH] Fix various clippy and compilation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In my previous commit I’ve introduced a new build warning. Motivation for this commit was to fix it and while I’m at it address some other issues as well. However, turns out there’s too many warnings I care to deal with so this addresses only some of the warnings. --- contracts/pallet-ibc/docs/routing.md | 4 +- contracts/pallet-ibc/ping/src/lib.rs | 22 ++++---- contracts/pallet-ibc/src/client.rs | 3 +- contracts/pallet-ibc/src/ics20/mod.rs | 45 ++++++++-------- contracts/pallet-ibc/src/lib.rs | 1 - contracts/pallet-ibc/src/routing.rs | 2 +- contracts/pallet-ibc/src/weight.rs | 54 +++++++++---------- hyperspace/core/src/substrate/default.rs | 6 +-- hyperspace/metrics/src/data.rs | 34 ++++++------ hyperspace/parachain/src/finality_protocol.rs | 1 - hyperspace/parachain/src/lib.rs | 3 +- hyperspace/parachain/src/provider.rs | 2 +- hyperspace/parachain/src/utils.rs | 5 +- .../applications/transfer/acknowledgement.rs | 2 +- ibc/modules/src/timestamp.rs | 5 +- ibc/proto/src/google.rs | 5 +- light-clients/ics10-grandpa-cw/src/client.rs | 3 +- light-clients/ics13-near/src/types.rs | 5 +- utils/parachain-node/runtime/src/lib.rs | 9 ++-- .../runtime/src/weights/block_weights.rs | 2 +- .../runtime/src/weights/extrinsic_weights.rs | 2 +- utils/subxt/codegen/bin/main.rs | 2 +- utils/subxt/codegen/src/lib.rs | 2 +- 23 files changed, 106 insertions(+), 113 deletions(-) diff --git a/contracts/pallet-ibc/docs/routing.md b/contracts/pallet-ibc/docs/routing.md index 47496f286..2dc086aaf 100644 --- a/contracts/pallet-ibc/docs/routing.md +++ b/contracts/pallet-ibc/docs/routing.md @@ -44,7 +44,7 @@ pub struct IbcModule(PhantomData); impl Default for IbcModule { fn default() -> Self { - Self(PhantomData::default()) + Self(PhantomData) } } @@ -214,7 +214,7 @@ impl Module for IbcModule { pub struct WeightHandler(PhantomData); impl Default for WeightHandler { fn default() -> Self { - Self(PhantomData::default()) + Self(PhantomData) } } diff --git a/contracts/pallet-ibc/ping/src/lib.rs b/contracts/pallet-ibc/ping/src/lib.rs index a69af7c29..e399575d7 100644 --- a/contracts/pallet-ibc/ping/src/lib.rs +++ b/contracts/pallet-ibc/ping/src/lib.rs @@ -139,7 +139,7 @@ pub struct IbcModule(PhantomData); impl Default for IbcModule { fn default() -> Self { - Self(PhantomData::default()) + Self(PhantomData) } } @@ -305,37 +305,37 @@ impl Module for IbcModule { pub struct WeightHandler(PhantomData); impl Default for WeightHandler { fn default() -> Self { - Self(PhantomData::default()) + Self(PhantomData) } } impl CallbackWeight for WeightHandler { fn on_chan_open_init(&self) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_open_try(&self) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_open_ack(&self, _port_id: &PortId, _channel_id: &ChannelId) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_open_confirm(&self, _port_id: &PortId, _channel_id: &ChannelId) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_close_init(&self, _port_id: &PortId, _channel_id: &ChannelId) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_close_confirm(&self, _port_id: &PortId, _channel_id: &ChannelId) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_recv_packet(&self, _packet: &Packet) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_acknowledgement_packet( @@ -343,10 +343,10 @@ impl CallbackWeight for WeightHandler { _packet: &Packet, _acknowledgement: &Acknowledgement, ) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_timeout_packet(&self, _packet: &Packet) -> Weight { - Weight::from_ref_time(0) + Weight::default() } } diff --git a/contracts/pallet-ibc/src/client.rs b/contracts/pallet-ibc/src/client.rs index b97db2ddb..177562c6d 100644 --- a/contracts/pallet-ibc/src/client.rs +++ b/contracts/pallet-ibc/src/client.rs @@ -125,8 +125,7 @@ where let cs_state = consensus_heights .into_iter() .filter(|prev_height| prev_height < &height) - .rev() - .next() + .next_back() .and_then(|prev_height| self.consensus_state(client_id, prev_height).ok()); Ok(cs_state) } diff --git a/contracts/pallet-ibc/src/ics20/mod.rs b/contracts/pallet-ibc/src/ics20/mod.rs index c54487a4e..c46a0d4f2 100644 --- a/contracts/pallet-ibc/src/ics20/mod.rs +++ b/contracts/pallet-ibc/src/ics20/mod.rs @@ -54,7 +54,7 @@ pub struct IbcModule(PhantomData); impl Default for IbcModule { fn default() -> Self { - Self(PhantomData::default()) + Self(PhantomData) } } @@ -468,7 +468,7 @@ pub struct WeightHandler(PhantomData); impl Default for WeightHandler { fn default() -> Self { - Self(PhantomData::default()) + Self(PhantomData) } } @@ -640,27 +640,26 @@ pub enum MemoType { impl Forward { pub fn get_memo(&self) -> Result { if self.substrate.unwrap_or_default() { - let xcm = MemoXcm { receiver: self.receiver.clone(), para_id: self.para_id.clone() }; + let xcm = MemoXcm { receiver: self.receiver.clone(), para_id: self.para_id }; return Ok(MemoType::XCM(xcm)) } - let ibc = - MemoIbc { - receiver: self.receiver.clone(), - port: self - .port - .clone() - .ok_or(Ics20Error::implementation_specific("Failed to get port".to_string()))?, - channel: self.channel.clone().ok_or(Ics20Error::implementation_specific( - "Failed to get channel".to_string(), - ))?, - timeout: self.timeout.clone().ok_or(Ics20Error::implementation_specific( - "Failed to get timeout".to_string(), - ))?, - retries: self.retries.clone().ok_or(Ics20Error::implementation_specific( - "Failed to get retries".to_string(), - ))?, - }; - return Ok(MemoType::IBC(ibc)) + Ok(MemoType::IBC(MemoIbc { + receiver: self.receiver.clone(), + port: self + .port + .clone() + .ok_or(Ics20Error::implementation_specific("Failed to get port".to_string()))?, + channel: self + .channel + .clone() + .ok_or(Ics20Error::implementation_specific("Failed to get channel".to_string()))?, + timeout: self + .timeout + .ok_or(Ics20Error::implementation_specific("Failed to get timeout".to_string()))?, + retries: self + .retries + .ok_or(Ics20Error::implementation_specific("Failed to get retries".to_string()))?, + })) } } @@ -800,7 +799,7 @@ where to: account_to.clone(), para_id: memo_forward.para_id, amount, - asset_id: asset_id.clone().into(), + asset_id: asset_id.clone(), }); Ics20Error::implementation_specific( "Faield to execute SubstrateMultihopXcmHandler::transfer_xcm.".to_string(), @@ -812,7 +811,7 @@ where to: account_to.clone(), para_id: memo_forward.para_id, amount, - asset_id: asset_id.clone().into(), + asset_id: asset_id.clone(), }); return Ok(()) diff --git a/contracts/pallet-ibc/src/lib.rs b/contracts/pallet-ibc/src/lib.rs index 4f1e045ff..25562ae9f 100644 --- a/contracts/pallet-ibc/src/lib.rs +++ b/contracts/pallet-ibc/src/lib.rs @@ -14,7 +14,6 @@ overflowing_literals, path_statements, patterns_in_fns_without_body, - private_in_public, unconditional_recursion, unused_allocation, unused_comparisons, diff --git a/contracts/pallet-ibc/src/routing.rs b/contracts/pallet-ibc/src/routing.rs index 059f4e8d4..db83cda0f 100644 --- a/contracts/pallet-ibc/src/routing.rs +++ b/contracts/pallet-ibc/src/routing.rs @@ -20,7 +20,7 @@ pub(crate) struct Context { impl Default for Context { fn default() -> Self { - Self { _pd: PhantomData::default(), router: IbcRouter::default() } + Self { _pd: PhantomData, router: IbcRouter::default() } } } diff --git a/contracts/pallet-ibc/src/weight.rs b/contracts/pallet-ibc/src/weight.rs index cbf7672bb..a166d2957 100644 --- a/contracts/pallet-ibc/src/weight.rs +++ b/contracts/pallet-ibc/src/weight.rs @@ -46,111 +46,111 @@ pub trait WeightInfo { impl WeightInfo for () { fn create_client() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn conn_open_init() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn update_tendermint_client(i: u32) -> Weight { - Weight::from_ref_time(3 * i as u64 * WEIGHT_REF_TIME_PER_MILLIS) + Weight::from_parts(3 * i as u64 * WEIGHT_REF_TIME_PER_MILLIS, 0) } fn conn_try_open_tendermint() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn conn_open_ack_tendermint() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn conn_open_confirm_tendermint() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn channel_open_init() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn channel_open_try_tendermint() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn channel_open_ack_tendermint() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn channel_open_confirm_tendermint() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn channel_close_init() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn channel_close_confirm_tendermint() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn recv_packet_tendermint(_i: u32) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn ack_packet_tendermint(_i: u32, _j: u32) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn timeout_packet_tendermint(_i: u32) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn transfer() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_open_init() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_open_try() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_recv_packet() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_open_ack() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_open_confirm() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_close_init() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_chan_close_confirm() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_acknowledgement_packet() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn on_timeout_packet() -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn update_grandpa_client(_i: u32, _j: u32) -> Weight { - Weight::from_ref_time(0) + Weight::default() } fn packet_cleanup(_i: u32) -> Weight { - Weight::from_ref_time(0) + Weight::default() } } diff --git a/hyperspace/core/src/substrate/default.rs b/hyperspace/core/src/substrate/default.rs index 3fe95e3e4..cfa54f8f7 100644 --- a/hyperspace/core/src/substrate/default.rs +++ b/hyperspace/core/src/substrate/default.rs @@ -11,9 +11,9 @@ use self::parachain_subxt::api::{ }; use super::{unimplemented, DummyBeefyAuthoritySet}; use crate::{ - define_any_wrapper, define_beefy_authority_set, define_event_record, define_events, - define_head_data, define_ibc_event_wrapper, define_id, define_para_lifecycle, - define_runtime_call, define_runtime_event, define_runtime_storage, define_runtime_transactions, + define_any_wrapper, define_event_record, define_events, define_head_data, + define_ibc_event_wrapper, define_id, define_para_lifecycle, define_runtime_call, + define_runtime_event, define_runtime_storage, define_runtime_transactions, define_send_ping_params, define_transfer_params, }; use async_trait::async_trait; diff --git a/hyperspace/metrics/src/data.rs b/hyperspace/metrics/src/data.rs index e643010d1..fdc79ddd9 100644 --- a/hyperspace/metrics/src/data.rs +++ b/hyperspace/metrics/src/data.rs @@ -174,7 +174,7 @@ impl Metrics { number_of_received_acknowledge_packets: register( Counter::with_opts( Opts::new( - format!("hyperspace_number_of_acknowledge_packet_events"), + "hyperspace_number_of_acknowledge_packet_events".to_string(), "Total number of 'acknowledge packet' events.", ) .const_label("name", prefix.to_string()), @@ -184,7 +184,7 @@ impl Metrics { number_of_received_timeouts: register( Counter::with_opts( Opts::new( - format!("hyperspace_number_of_timeout_packet_events"), + "hyperspace_number_of_timeout_packet_events".to_string(), "Total number of 'timeout packet' events.", ) .const_label("name", prefix.to_string()), @@ -196,7 +196,7 @@ impl Metrics { number_of_sent_packets: register( Counter::with_opts( Opts::new( - format!("hyperspace_number_of_sent_packets"), + "hyperspace_number_of_sent_packets".to_string(), "Total number of sent packets", ) .const_label("name", prefix.to_string()), @@ -206,7 +206,7 @@ impl Metrics { number_of_sent_acknowledgments: register( Counter::with_opts( Opts::new( - format!("hyperspace_number_of_sent_acknowledgments"), + "hyperspace_number_of_sent_acknowledgments".to_string(), "Total number of sent acknowledgments", ) .const_label("name", prefix.to_string()), @@ -216,7 +216,7 @@ impl Metrics { number_of_sent_timeout_packets: register( Counter::with_opts( Opts::new( - format!("hyperspace_number_of_timed_out_packets"), + "hyperspace_number_of_timed_out_packets".to_string(), "Total number of timed out packets", ) .const_label("name", prefix.to_string()), @@ -226,7 +226,7 @@ impl Metrics { number_of_undelivered_packets: register( Gauge::with_opts( Opts::new( - format!("hyperspace_number_of_undelivered_packets"), + "hyperspace_number_of_undelivered_packets".to_string(), "Number of undelivered packets over time", ) .const_label("name", prefix.to_string()), @@ -236,7 +236,7 @@ impl Metrics { number_of_undelivered_acknowledgements: register( Gauge::with_opts( Opts::new( - format!("hyperspace_number_of_undelivered_acknowledgements"), + "hyperspace_number_of_undelivered_acknowledgements".to_string(), "Number of undelivered acknowledgements over time", ) .const_label("name", prefix.to_string()), @@ -246,7 +246,7 @@ impl Metrics { gas_cost_for_sent_tx_bundle: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_gas_cost_for_sent_tx_bundle"), + "hyperspace_gas_cost_for_sent_tx_bundle".to_string(), "Gas cost for every sent tx bundle", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -257,7 +257,7 @@ impl Metrics { transaction_length_for_sent_tx_bundle: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_transaction_length_for_sent_tx_bundle"), + "hyperspace_transaction_length_for_sent_tx_bundle".to_string(), "Transaction length for every sent tx bundle", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -269,7 +269,7 @@ impl Metrics { send_packet_event_time: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_send_packet_event_time"), + "hyperspace_send_packet_event_time".to_string(), "Time it takes to process a 'send packet' event", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -280,7 +280,7 @@ impl Metrics { receive_packet_event_time: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_receive_packet_event_time"), + "hyperspace_receive_packet_event_time".to_string(), "Time it takes to process a 'receive packet' event", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -291,7 +291,7 @@ impl Metrics { acknowledge_packet_event_time: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_acknowledge_packet_event_time"), + "hyperspace_acknowledge_packet_event_time".to_string(), "Time it takes to process a 'acknowledge packet' event", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -302,7 +302,7 @@ impl Metrics { sent_packet_time: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_sent_packet_time"), + "hyperspace_sent_packet_time".to_string(), "Time it takes to send and receive a packet", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -313,7 +313,7 @@ impl Metrics { sent_acknowledgment_time: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_sent_acknowledgment_time"), + "hyperspace_sent_acknowledgment_time".to_string(), "Time it takes to send and receive an acknowledgment", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -324,7 +324,7 @@ impl Metrics { sent_timeout_packet_time: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_sent_timeout_packet_time"), + "hyperspace_sent_timeout_packet_time".to_string(), "Time it takes to send and receive a timeout packet", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -335,7 +335,7 @@ impl Metrics { sent_update_client_time: register( Histogram::with_opts( HistogramOpts::new( - format!("hyperspace_sent_update_client_time"), + "hyperspace_sent_update_client_time".to_string(), "Average time between client updates", ) .buckets(vec![1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0]) @@ -346,7 +346,7 @@ impl Metrics { latest_processed_height: register( Gauge::with_opts( Opts::new( - format!("hyperspace_latest_processed_height"), + "hyperspace_latest_processed_height".to_string(), "Latest processed finalized height", ) .const_label("name", prefix.to_string()), diff --git a/hyperspace/parachain/src/finality_protocol.rs b/hyperspace/parachain/src/finality_protocol.rs index 7e3cbb8ea..66a65b71f 100644 --- a/hyperspace/parachain/src/finality_protocol.rs +++ b/hyperspace/parachain/src/finality_protocol.rs @@ -55,7 +55,6 @@ use std::{ time::Duration, }; -use beefy_prover::helpers::unsafe_arc_cast; use grandpa_prover::{ GrandpaJustification, GrandpaProver, JustificationNotification, PROCESS_BLOCKS_BATCH_SIZE, }; diff --git a/hyperspace/parachain/src/lib.rs b/hyperspace/parachain/src/lib.rs index 349623ca8..efeb6d137 100644 --- a/hyperspace/parachain/src/lib.rs +++ b/hyperspace/parachain/src/lib.rs @@ -16,7 +16,6 @@ use std::{ collections::{BTreeMap, HashSet}, - f32::consts::E, path::PathBuf, str::FromStr, sync::{Arc, Mutex}, @@ -75,7 +74,7 @@ use sp_runtime::{ use ss58_registry::Ss58AddressFormat; use subxt::{ config::{Header as HeaderT, Header}, - tx::{Signer, TxPayload}, + tx::TxPayload, }; use tokio::sync::Mutex as AsyncMutex; diff --git a/hyperspace/parachain/src/provider.rs b/hyperspace/parachain/src/provider.rs index 2e30a97b6..cd515fc5c 100644 --- a/hyperspace/parachain/src/provider.rs +++ b/hyperspace/parachain/src/provider.rs @@ -46,7 +46,7 @@ use ibc_proto::{ }; use ibc_rpc::{IbcApiClient, PacketInfo}; use ics11_beefy::client_state::ClientState as BeefyClientState; -use light_client_common::config::{AsInnerEvent, Config, IbcEventsT, RuntimeStorage}; +use light_client_common::config::{AsInnerEvent, IbcEventsT, RuntimeStorage}; use pallet_ibc::{ light_clients::{AnyClientState, AnyConsensusState, HostFunctionsManager}, HostConsensusProof, diff --git a/hyperspace/parachain/src/utils.rs b/hyperspace/parachain/src/utils.rs index b7819899a..b931ef08c 100644 --- a/hyperspace/parachain/src/utils.rs +++ b/hyperspace/parachain/src/utils.rs @@ -15,12 +15,10 @@ use crate::Error; use beefy_light_client_primitives::{ClientState, MmrUpdateProof}; use beefy_primitives::known_payloads::MMR_ROOT_ID; -use beefy_prover::helpers::unsafe_arc_cast; use codec::Decode; use frame_support::pallet_prelude::{DispatchClass, Weight}; use frame_system::limits::BlockWeights; use sp_core::H256; -use std::sync::Arc; pub fn get_updated_client_state( mut client_state: ClientState, @@ -53,12 +51,11 @@ pub async fn fetch_max_extrinsic_weight( .expect("System pallet should exist") .constant_by_name("BlockWeights") .expect("constatn BlockWeights should exist"); - let bw_value = block_weights.value().to_vec(); let weights = BlockWeights::decode(&mut &block_weights.value()[..])?; let extrinsic_weights = weights.per_class.get(DispatchClass::Normal); let max_extrinsic_weight = extrinsic_weights .max_extrinsic .or(extrinsic_weights.max_total) - .unwrap_or(Weight::from_ref_time(u64::MAX)); + .unwrap_or(Weight::from_parts(u64::MAX, 0)); Ok(max_extrinsic_weight.ref_time()) } diff --git a/ibc/modules/src/applications/transfer/acknowledgement.rs b/ibc/modules/src/applications/transfer/acknowledgement.rs index 1892c8b43..7a3b65745 100644 --- a/ibc/modules/src/applications/transfer/acknowledgement.rs +++ b/ibc/modules/src/applications/transfer/acknowledgement.rs @@ -43,7 +43,7 @@ impl Acknowledgement { } pub fn is_successful(&self) -> bool { - !matches!(self, Self::Error(s)) + !matches!(self, Self::Error(_)) } pub fn into_result(self) -> Result { diff --git a/ibc/modules/src/timestamp.rs b/ibc/modules/src/timestamp.rs index ec919cc7e..a21875212 100644 --- a/ibc/modules/src/timestamp.rs +++ b/ibc/modules/src/timestamp.rs @@ -44,11 +44,10 @@ pub struct Timestamp { // TODO: derive when tendermint::Time supports it: // https://github.com/informalsystems/tendermint-rs/pull/1054 -#[allow(clippy::derive_hash_xor_eq)] +#[allow(clippy::derived_hash_with_manual_eq)] impl Hash for Timestamp { fn hash(&self, state: &mut H) { - let odt: Option = self.time.map(Into::into); - odt.hash(state); + self.time.map(OffsetDateTime::from).hash(state); } } diff --git a/ibc/proto/src/google.rs b/ibc/proto/src/google.rs index 3446b452e..31b9405c7 100644 --- a/ibc/proto/src/google.rs +++ b/ibc/proto/src/google.rs @@ -140,9 +140,8 @@ pub mod protobuf { #[cfg(feature = "std")] impl Eq for Timestamp {} - #[cfg(feature = "std")] - #[allow(clippy::derive_hash_xor_eq)] // Derived logic is correct: comparing the 2 fields for equality - impl std::hash::Hash for Timestamp { + #[allow(clippy::derived_hash_with_manual_eq)] // Derived logic is correct: comparing the 2 fields for equality + impl core::hash::Hash for Timestamp { fn hash(&self, state: &mut H) { self.seconds.hash(state); self.nanos.hash(state); diff --git a/light-clients/ics10-grandpa-cw/src/client.rs b/light-clients/ics10-grandpa-cw/src/client.rs index 649aa7025..368af2e56 100644 --- a/light-clients/ics10-grandpa-cw/src/client.rs +++ b/light-clients/ics10-grandpa-cw/src/client.rs @@ -142,8 +142,7 @@ impl<'a, H: HostFunctions
> ClientReader for Context<' .load(self.storage(), client_id.as_bytes().to_owned()) .unwrap_or_default() .range(..height) - .rev() - .next() + .next_back() .map(|height| self.consensus_state(client_id, *height)) .transpose() } diff --git a/light-clients/ics13-near/src/types.rs b/light-clients/ics13-near/src/types.rs index aab86a04b..f851ed84d 100644 --- a/light-clients/ics13-near/src/types.rs +++ b/light-clients/ics13-near/src/types.rs @@ -277,7 +277,10 @@ impl BorshDeserialize for PublicKey { fn read_key_type(rd: &mut R) -> io::Result<()> { match u8::deserialize_reader(rd)? { 8 => Ok(()), - key_type => Err(io::ErrorKind::InvalidData.into()), + key_type => Err(io::Error::new( + io::ErrorKind::InvalidData, + format!("Unrecognised key type: {key_type}"), + )), } } diff --git a/utils/parachain-node/runtime/src/lib.rs b/utils/parachain-node/runtime/src/lib.rs index 846e144b4..50c41e30c 100644 --- a/utils/parachain-node/runtime/src/lib.rs +++ b/utils/parachain-node/runtime/src/lib.rs @@ -259,9 +259,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -const MAXIMUM_BLOCK_WEIGHT: Weight = - Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(2)) - .set_proof_size(cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64); +const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, +); /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] @@ -761,7 +762,7 @@ impl TryFrom for MemoData { type Error = >::Error; fn try_from(value: RawMemo) -> Result { - Ok(value.0.try_into()?) + value.0.try_into() } } diff --git a/utils/parachain-node/runtime/src/weights/block_weights.rs b/utils/parachain-node/runtime/src/weights/block_weights.rs index 66279be1b..c9e34d626 100644 --- a/utils/parachain-node/runtime/src/weights/block_weights.rs +++ b/utils/parachain-node/runtime/src/weights/block_weights.rs @@ -23,7 +23,7 @@ pub mod constants { parameter_types! { /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); + pub const BlockExecutionWeight: Weight = Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000), 0); } #[cfg(test)] diff --git a/utils/parachain-node/runtime/src/weights/extrinsic_weights.rs b/utils/parachain-node/runtime/src/weights/extrinsic_weights.rs index 488686708..463fe1e93 100644 --- a/utils/parachain-node/runtime/src/weights/extrinsic_weights.rs +++ b/utils/parachain-node/runtime/src/weights/extrinsic_weights.rs @@ -23,7 +23,7 @@ pub mod constants { parameter_types! { /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); + pub const ExtrinsicBaseWeight: Weight = Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000), 0); } #[cfg(test)] diff --git a/utils/subxt/codegen/bin/main.rs b/utils/subxt/codegen/bin/main.rs index d405c55c5..ca31acf78 100644 --- a/utils/subxt/codegen/bin/main.rs +++ b/utils/subxt/codegen/bin/main.rs @@ -43,7 +43,7 @@ fn format_uri(uri: Uri) -> anyhow::Result { _ => None, }; - let scheme = uri.scheme_str().unwrap_or(&"wss"); + let scheme = uri.scheme_str().unwrap_or("wss"); let authority = uri.authority().ok_or_else(|| anyhow!("No authority in {uri}"))?; let port = match authority.port_u16() { None => default_port(scheme) diff --git a/utils/subxt/codegen/src/lib.rs b/utils/subxt/codegen/src/lib.rs index 7f4699392..d2336b543 100644 --- a/utils/subxt/codegen/src/lib.rs +++ b/utils/subxt/codegen/src/lib.rs @@ -53,7 +53,7 @@ pub fn codegen(encoded: &mut I) -> anyhow::Result { .collect::, _>>()?; // let mut derives = DerivesRegistry::new(); let mut derives = DerivesRegistry::with_default_derives(&crate_path); - derives.extend_for_all(p.into_iter(), []); + derives.extend_for_all(p, []); let type_subsitutes = TypeSubstitutes::with_default_substitutes(&crate_path); let runtime_api = generator