fix clippy issues (#1332)

This commit is contained in:
Svyatoslav Nikolsky
2022-03-01 17:26:02 +03:00
committed by Bastian Köcher
parent e656e0089e
commit bc1dcb7548
7 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ pub type Rococo = PolkadotLike;
/// ///
/// Note that since this is a target sessions may change before/after this time depending on network /// Note that since this is a target sessions may change before/after this time depending on network
/// conditions. /// conditions.
pub const SESSION_LENGTH: BlockNumber = 1 * time_units::HOURS; pub const SESSION_LENGTH: BlockNumber = time_units::HOURS;
// NOTE: This needs to be kept up to date with the Rococo runtime found in the Polkadot repo. // NOTE: This needs to be kept up to date with the Rococo runtime found in the Polkadot repo.
pub const VERSION: RuntimeVersion = RuntimeVersion { pub const VERSION: RuntimeVersion = RuntimeVersion {
+1 -1
View File
@@ -35,7 +35,7 @@ pub type Wococo = PolkadotLike;
/// ///
/// Note that since this is a target sessions may change before/after this time depending on network /// Note that since this is a target sessions may change before/after this time depending on network
/// conditions. /// conditions.
pub const SESSION_LENGTH: BlockNumber = 1 * time_units::MINUTES; pub const SESSION_LENGTH: BlockNumber = time_units::MINUTES;
// We use this to get the account on Wococo (target) which is derived from Rococo's (source) // We use this to get the account on Wococo (target) which is derived from Rococo's (source)
// account. // account.
+3 -4
View File
@@ -346,11 +346,10 @@ where
// we shall not ever see this error in relay, because we are never signing decoded // we shall not ever see this error in relay, because we are never signing decoded
// transactions. Instead we're constructing and signing new transactions. So the error code // transactions. Instead we're constructing and signing new transactions. So the error code
// is kinda random here // is kinda random here
self.additional_signed.ok_or_else(|| { self.additional_signed
frame_support::unsigned::TransactionValidityError::Unknown( .ok_or(frame_support::unsigned::TransactionValidityError::Unknown(
frame_support::unsigned::UnknownTransaction::Custom(0xFF), frame_support::unsigned::UnknownTransaction::Custom(0xFF),
) ))
})
} }
fn pre_dispatch( fn pre_dispatch(
@@ -312,7 +312,7 @@ async fn best_source_block_number_at_target<P: SubstrateFinalitySyncPipeline>(
target_client: &Client<P::TargetChain>, target_client: &Client<P::TargetChain>,
) -> anyhow::Result<BlockNumberOf<P::SourceChain>> { ) -> anyhow::Result<BlockNumberOf<P::SourceChain>> {
Ok(read_client_state::<P::TargetChain, P::SourceChain>( Ok(read_client_state::<P::TargetChain, P::SourceChain>(
&target_client, target_client,
None, None,
P::SourceChain::BEST_FINALIZED_HEADER_ID_METHOD, P::SourceChain::BEST_FINALIZED_HEADER_ID_METHOD,
) )
@@ -346,7 +346,7 @@ async fn find_mandatory_headers_in_range<P: SubstrateFinalitySyncPipeline>(
let mut mandatory_headers = Vec::new(); let mut mandatory_headers = Vec::new();
let mut current = range.0; let mut current = range.0;
while current <= range.1 { while current <= range.1 {
let (header, proof) = finality_source.header_and_finality_proof(current).await?.into(); let (header, proof) = finality_source.header_and_finality_proof(current).await?;
if header.is_mandatory() { if header.is_mandatory() {
match proof { match proof {
Some(proof) => mandatory_headers.push((header, proof)), Some(proof) => mandatory_headers.push((header, proof)),
@@ -412,7 +412,7 @@ fn make_mandatory_headers_batches<
} else { } else {
current_batch_size = new_batch_size; current_batch_size = new_batch_size;
current_batch_weight = new_batch_weight; current_batch_weight = new_batch_weight;
i = i + 1; i += 1;
} }
} }
if !headers_to_submit.is_empty() { if !headers_to_submit.is_empty() {
@@ -18,7 +18,7 @@ use crate::cli::{
bridge::FullBridge, bridge::FullBridge,
encode_call::{self, CliEncodeCall}, encode_call::{self, CliEncodeCall},
estimate_fee::estimate_message_delivery_and_dispatch_fee, estimate_fee::estimate_message_delivery_and_dispatch_fee,
Balance, CliChain, ExplicitOrMaximal, HexBytes, HexLaneId, Origins, SourceConnectionParams, Balance, ExplicitOrMaximal, HexBytes, HexLaneId, Origins, SourceConnectionParams,
SourceSigningParams, TargetConnectionParams, TargetSigningParams, SourceSigningParams, TargetConnectionParams, TargetSigningParams,
}; };
use bp_message_dispatch::{CallOrigin, MessagePayload}; use bp_message_dispatch::{CallOrigin, MessagePayload};
@@ -304,6 +304,7 @@ pub(crate) fn compute_maximal_message_dispatch_weight(maximal_extrinsic_weight:
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::cli::CliChain;
use hex_literal::hex; use hex_literal::hex;
#[async_std::test] #[async_std::test]
@@ -23,7 +23,7 @@ pub fn token_price_metric(token_id: &str) -> Result<FloatJsonValueMetric, Promet
FloatJsonValueMetric::new( FloatJsonValueMetric::new(
format!("https://api.coingecko.com/api/v3/simple/price?ids={}&vs_currencies=btc", token_id), format!("https://api.coingecko.com/api/v3/simple/price?ids={}&vs_currencies=btc", token_id),
format!("$.{}.btc", token_id), format!("$.{}.btc", token_id),
format!("{}_to_base_conversion_rate", token_id.replace("-", "_")), format!("{}_to_base_conversion_rate", token_id.replace('-', "_")),
format!("Rate used to convert from {} to some BASE tokens", token_id.to_uppercase()), format!("Rate used to convert from {} to some BASE tokens", token_id.to_uppercase()),
) )
} }
@@ -334,6 +334,7 @@ where
} }
/// Make messages delivery proof transaction from given proof. /// Make messages delivery proof transaction from given proof.
#[allow(clippy::too_many_arguments)]
fn make_messages_delivery_proof_transaction<P: SubstrateMessageLane>( fn make_messages_delivery_proof_transaction<P: SubstrateMessageLane>(
spec_version: u32, spec_version: u32,
transaction_version: u32, transaction_version: u32,
@@ -443,7 +444,7 @@ where
peer_client.header_by_number(peer_on_self_best_finalized_id.0).await?; peer_client.header_by_number(peer_on_self_best_finalized_id.0).await?;
HeaderId(peer_on_self_best_finalized_id.0, actual_peer_on_self_best_finalized.hash()) HeaderId(peer_on_self_best_finalized_id.0, actual_peer_on_self_best_finalized.hash())
}, },
None => peer_on_self_best_finalized_id.clone(), None => peer_on_self_best_finalized_id,
}; };
Ok(ClientState { Ok(ClientState {