mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-28 20:17:25 +00:00
fix clippy issues (#991)
This commit is contained in:
committed by
Bastian Köcher
parent
cab4c7cd05
commit
812e782904
@@ -87,7 +87,7 @@ pub fn new_partial(
|
||||
.transpose()?;
|
||||
|
||||
let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
|
||||
&config,
|
||||
config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
@@ -89,7 +89,7 @@ pub fn new_partial(
|
||||
.transpose()?;
|
||||
|
||||
let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
|
||||
&config,
|
||||
config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
@@ -151,7 +151,7 @@ pub fn verify_substrate_finality_proof(
|
||||
let best_set = best_set?;
|
||||
|
||||
let verify_result = sc_finality_grandpa::GrandpaJustification::<Block>::decode_and_verify_finalizes(
|
||||
&raw_finality_proof,
|
||||
raw_finality_proof,
|
||||
(finality_target_hash, finality_target_number),
|
||||
best_set_id,
|
||||
&best_set,
|
||||
|
||||
@@ -415,9 +415,14 @@ pub mod pallet {
|
||||
let set_id = authority_set.set_id;
|
||||
|
||||
Ok(
|
||||
verify_justification::<BridgedHeader<T, I>>((hash, number), set_id, &voter_set, &justification).map_err(
|
||||
verify_justification::<BridgedHeader<T, I>>((hash, number), set_id, &voter_set, justification).map_err(
|
||||
|e| {
|
||||
log::error!(target: "runtime::bridge-grandpa", "Received invalid justification for {:?}: {:?}", hash, e);
|
||||
log::error!(
|
||||
target: "runtime::bridge-grandpa",
|
||||
"Received invalid justification for {:?}: {:?}",
|
||||
hash,
|
||||
e,
|
||||
);
|
||||
<Error<T, I>>::InvalidJustification
|
||||
},
|
||||
)?,
|
||||
|
||||
@@ -245,7 +245,7 @@ impl AuraHeader {
|
||||
|
||||
/// Get step this header is generated for.
|
||||
pub fn step(&self) -> Option<u64> {
|
||||
self.seal.get(0).map(|x| Rlp::new(&x)).and_then(|x| x.as_val().ok())
|
||||
self.seal.get(0).map(|x| Rlp::new(x)).and_then(|x| x.as_val().ok())
|
||||
}
|
||||
|
||||
/// Get header author' signature.
|
||||
@@ -496,7 +496,7 @@ pub fn transaction_decode_rlp(raw_tx: &[u8]) -> Result<Transaction, DecoderError
|
||||
let message = unsigned.message(chain_id);
|
||||
|
||||
// recover tx sender
|
||||
let sender_public = sp_io::crypto::secp256k1_ecdsa_recover(&signature, &message.as_fixed_bytes())
|
||||
let sender_public = sp_io::crypto::secp256k1_ecdsa_recover(&signature, message.as_fixed_bytes())
|
||||
.map_err(|_| rlp::DecoderError::Custom("Failed to recover transaction sender"))?;
|
||||
let sender_address = public_to_address(&sender_public);
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ pub fn make_justification_for_header<H: HeaderT>(params: JustificationGeneratorP
|
||||
for (i, (id, _weight)) in authorities.iter().enumerate() {
|
||||
// Assign authorities to sign pre-commits in a round-robin fashion
|
||||
let target = unsigned_precommits[i % forks as usize];
|
||||
let precommit = signed_precommit::<H>(&id, target, round, set_id);
|
||||
let precommit = signed_precommit::<H>(id, target, round, set_id);
|
||||
|
||||
precommits.push(precommit);
|
||||
}
|
||||
|
||||
@@ -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()),
|
||||
);
|
||||
|
||||
|
||||
@@ -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(ð_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(ð_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(ð_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(ð_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(ð_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(
|
||||
|
||||
@@ -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!(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user