fix clippy issues (#991)

This commit is contained in:
Svyatoslav Nikolsky
2021-06-08 14:33:48 +03:00
committed by Bastian Köcher
parent cab4c7cd05
commit 812e782904
14 changed files with 32 additions and 27 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ impl BridgeInstance for RialtoPoA {
.into_iter()
.map(|header| {
(
into_substrate_ethereum_header(&header.header()),
into_substrate_ethereum_header(header.header()),
into_substrate_ethereum_receipts(header.extra()),
)
})
@@ -65,7 +65,7 @@ impl BridgeInstance for RialtoPoA {
fn build_unsigned_header_call(&self, header: QueuedEthereumHeader) -> Call {
let pallet_call = rialto_runtime::BridgeEthPoACall::import_unsigned_header(
into_substrate_ethereum_header(&header.header()),
into_substrate_ethereum_header(header.header()),
into_substrate_ethereum_receipts(header.extra()),
);
+6 -6
View File
@@ -60,7 +60,7 @@ async fn run_command(matches: &clap::ArgMatches<'_>) {
match matches.subcommand() {
("eth-to-sub", Some(eth_to_sub_matches)) => {
log::info!(target: "bridge", "Starting ETH ➡ SUB relay.");
if ethereum_sync_loop::run(match ethereum_sync_params(&eth_to_sub_matches) {
if ethereum_sync_loop::run(match ethereum_sync_params(eth_to_sub_matches) {
Ok(ethereum_sync_params) => ethereum_sync_params,
Err(err) => {
log::error!(target: "bridge", "Error parsing parameters: {}", err);
@@ -75,7 +75,7 @@ async fn run_command(matches: &clap::ArgMatches<'_>) {
}
("sub-to-eth", Some(sub_to_eth_matches)) => {
log::info!(target: "bridge", "Starting SUB ➡ ETH relay.");
if substrate_sync_loop::run(match substrate_sync_params(&sub_to_eth_matches) {
if substrate_sync_loop::run(match substrate_sync_params(sub_to_eth_matches) {
Ok(substrate_sync_params) => substrate_sync_params,
Err(err) => {
log::error!(target: "bridge", "Error parsing parameters: {}", err);
@@ -90,7 +90,7 @@ async fn run_command(matches: &clap::ArgMatches<'_>) {
}
("eth-deploy-contract", Some(eth_deploy_matches)) => {
log::info!(target: "bridge", "Deploying ETH contracts.");
ethereum_deploy_contract::run(match ethereum_deploy_contract_params(&eth_deploy_matches) {
ethereum_deploy_contract::run(match ethereum_deploy_contract_params(eth_deploy_matches) {
Ok(ethereum_deploy_params) => ethereum_deploy_params,
Err(err) => {
log::error!(target: "bridge", "Error during contract deployment: {}", err);
@@ -101,7 +101,7 @@ async fn run_command(matches: &clap::ArgMatches<'_>) {
}
("eth-submit-exchange-tx", Some(eth_exchange_submit_matches)) => {
log::info!(target: "bridge", "Submitting ETH ➡ SUB exchange transaction.");
ethereum_exchange_submit::run(match ethereum_exchange_submit_params(&eth_exchange_submit_matches) {
ethereum_exchange_submit::run(match ethereum_exchange_submit_params(eth_exchange_submit_matches) {
Ok(eth_exchange_submit_params) => eth_exchange_submit_params,
Err(err) => {
log::error!(target: "bridge", "Error submitting Eethereum exchange transaction: {}", err);
@@ -112,7 +112,7 @@ async fn run_command(matches: &clap::ArgMatches<'_>) {
}
("eth-exchange-sub", Some(eth_exchange_matches)) => {
log::info!(target: "bridge", "Starting ETH ➡ SUB exchange transactions relay.");
ethereum_exchange::run(match ethereum_exchange_params(&eth_exchange_matches) {
ethereum_exchange::run(match ethereum_exchange_params(eth_exchange_matches) {
Ok(eth_exchange_params) => eth_exchange_params,
Err(err) => {
log::error!(target: "bridge", "Error relaying Ethereum transactions proofs: {}", err);
@@ -285,7 +285,7 @@ fn ethereum_exchange_submit_params(matches: &clap::ArgMatches) -> Result<Ethereu
let eth_nonce = matches
.value_of("eth-nonce")
.map(|eth_nonce| {
relay_ethereum_client::types::U256::from_dec_str(&eth_nonce)
relay_ethereum_client::types::U256::from_dec_str(eth_nonce)
.map_err(|e| format!("Failed to parse eth-nonce: {}", e))
})
.transpose()?;
@@ -129,7 +129,7 @@ pub(crate) fn preprocess_call<Source: CliEncodeCall + CliChain, Target: CliEncod
} => {
if remark_payload.is_none() {
*remark_payload = Some(HexBytes(generate_remark_payload(
&remark_size,
remark_size,
compute_maximal_message_arguments_size(Source::max_extrinsic_size(), Target::max_extrinsic_size()),
)));
}
@@ -80,7 +80,7 @@ impl SendMessage {
let target_sign = target_sign.to_keypair::<Target>()?;
encode_call::preprocess_call::<Source, Target>(message, bridge.bridge_instance_index());
let target_call = Target::encode_call(&message)?;
let target_call = Target::encode_call(message)?;
let payload = {
let target_call_weight = prepare_call_dispatch_weight(
+3 -3
View File
@@ -324,7 +324,7 @@ async fn wait_transaction_mined<P: TransactionProofPipeline>(
source_tx_hash: &TransactionHashOf<P>,
) -> Result<(HeaderId<P>, usize), String> {
loop {
let source_header_and_tx = source_client.transaction_block(&source_tx_hash).await.map_err(|err| {
let source_header_and_tx = source_client.transaction_block(source_tx_hash).await.map_err(|err| {
format!(
"Error retrieving transaction {} from {} node: {:?}",
source_tx_hash,
@@ -363,7 +363,7 @@ async fn wait_header_imported<P: TransactionProofPipeline>(
source_header_id: &HeaderId<P>,
) -> Result<(), String> {
loop {
let is_header_known = target_client.is_header_known(&source_header_id).await.map_err(|err| {
let is_header_known = target_client.is_header_known(source_header_id).await.map_err(|err| {
format!(
"Failed to check existence of header {}/{} on {} node: {:?}",
source_header_id.0,
@@ -406,7 +406,7 @@ async fn wait_header_finalized<P: TransactionProofPipeline>(
) -> Result<(), String> {
loop {
let is_header_finalized = target_client
.is_header_finalized(&source_header_id)
.is_header_finalized(source_header_id)
.await
.map_err(|err| {
format!(
+1 -1
View File
@@ -215,7 +215,7 @@ async fn run_loop_iteration<P: TransactionProofPipeline>(
state.best_processed_header_number = state.best_processed_header_number + One::one();
storage.set_state(state);
if let Some(ref exchange_loop_metrics) = exchange_loop_metrics {
if let Some(exchange_loop_metrics) = exchange_loop_metrics {
exchange_loop_metrics.update::<P>(
state.best_processed_header_number,
best_finalized_header_id.0,
+4 -4
View File
@@ -295,7 +295,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
&mut self.orphan,
&mut self.known_headers,
HeaderStatus::Orphan,
&id,
id,
);
return;
}
@@ -305,7 +305,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
&mut self.maybe_extra,
&mut self.known_headers,
HeaderStatus::MaybeExtra,
&id,
id,
);
}
@@ -324,7 +324,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
destination_queue,
&mut self.known_headers,
destination_status,
&id,
id,
|header| header,
);
}
@@ -654,7 +654,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
// remember that the header itself is synced
// (condition is here to avoid duplicate log messages)
if !id_processed {
set_header_status::<P>(&mut self.known_headers, &id, HeaderStatus::Synced);
set_header_status::<P>(&mut self.known_headers, id, HeaderStatus::Synced);
}
// now let's move all descendants from maybe_orphan && orphan queues to
@@ -567,7 +567,7 @@ where
.as_ref()
.and_then(|best_finalized_source_header_id_at_best_target| {
strategy
.select_nonces_to_deliver(&race_state)
.select_nonces_to_deliver(race_state)
.map(|(nonces_range, proof_parameters)| {
(
best_finalized_source_header_id_at_best_target.clone(),