Skip to content

Commit

Permalink
fix clippy issues (#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik authored and bkchr committed Apr 10, 2024
1 parent e656e00 commit bc1dcb7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bridges/primitives/chain-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// 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.
pub const VERSION: RuntimeVersion = RuntimeVersion {
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-wococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// 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)
// account.
Expand Down
7 changes: 3 additions & 4 deletions bridges/primitives/polkadot-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,10 @@ where
// 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
// is kinda random here
self.additional_signed.ok_or_else(|| {
frame_support::unsigned::TransactionValidityError::Unknown(
self.additional_signed
.ok_or(frame_support::unsigned::TransactionValidityError::Unknown(
frame_support::unsigned::UnknownTransaction::Custom(0xFF),
)
})
))
}

fn pre_dispatch(
Expand Down
6 changes: 3 additions & 3 deletions bridges/relays/bin-substrate/src/cli/reinit_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ async fn best_source_block_number_at_target<P: SubstrateFinalitySyncPipeline>(
target_client: &Client<P::TargetChain>,
) -> anyhow::Result<BlockNumberOf<P::SourceChain>> {
Ok(read_client_state::<P::TargetChain, P::SourceChain>(
&target_client,
target_client,
None,
P::SourceChain::BEST_FINALIZED_HEADER_ID_METHOD,
)
Expand Down Expand Up @@ -346,7 +346,7 @@ async fn find_mandatory_headers_in_range<P: SubstrateFinalitySyncPipeline>(
let mut mandatory_headers = Vec::new();
let mut current = range.0;
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() {
match proof {
Some(proof) => mandatory_headers.push((header, proof)),
Expand Down Expand Up @@ -412,7 +412,7 @@ fn make_mandatory_headers_batches<
} else {
current_batch_size = new_batch_size;
current_batch_weight = new_batch_weight;
i = i + 1;
i += 1;
}
}
if !headers_to_submit.is_empty() {
Expand Down
3 changes: 2 additions & 1 deletion bridges/relays/bin-substrate/src/cli/send_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::cli::{
bridge::FullBridge,
encode_call::{self, CliEncodeCall},
estimate_fee::estimate_message_delivery_and_dispatch_fee,
Balance, CliChain, ExplicitOrMaximal, HexBytes, HexLaneId, Origins, SourceConnectionParams,
Balance, ExplicitOrMaximal, HexBytes, HexLaneId, Origins, SourceConnectionParams,
SourceSigningParams, TargetConnectionParams, TargetSigningParams,
};
use bp_message_dispatch::{CallOrigin, MessagePayload};
Expand Down Expand Up @@ -304,6 +304,7 @@ pub(crate) fn compute_maximal_message_dispatch_weight(maximal_extrinsic_weight:
#[cfg(test)]
mod tests {
use super::*;
use crate::cli::CliChain;
use hex_literal::hex;

#[async_std::test]
Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/lib-substrate-relay/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn token_price_metric(token_id: &str) -> Result<FloatJsonValueMetric, Promet
FloatJsonValueMetric::new(
format!("https://api.coingecko.com/api/v3/simple/price?ids={}&vs_currencies=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()),
)
}
3 changes: 2 additions & 1 deletion bridges/relays/lib-substrate-relay/src/messages_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ where
}

/// Make messages delivery proof transaction from given proof.
#[allow(clippy::too_many_arguments)]
fn make_messages_delivery_proof_transaction<P: SubstrateMessageLane>(
spec_version: u32,
transaction_version: u32,
Expand Down Expand Up @@ -443,7 +444,7 @@ where
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())
},
None => peer_on_self_best_finalized_id.clone(),
None => peer_on_self_best_finalized_id,
};

Ok(ClientState {
Expand Down

0 comments on commit bc1dcb7

Please sign in to comment.