Skip to content

Commit

Permalink
cargo +nightly fmt --all (#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik authored and bkchr committed Apr 10, 2024
1 parent 5842968 commit 6396239
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 29 deletions.
4 changes: 1 addition & 3 deletions bridges/bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ pub use frame_support::{

pub use frame_system::Call as SystemCall;
pub use pallet_balances::Call as BalancesCall;
pub use pallet_bridge_grandpa::{
Call as BridgeGrandpaRialtoCall, Call as BridgeGrandpaWestendCall,
};
pub use pallet_bridge_grandpa::Call as BridgeGrandpaCall;
pub use pallet_bridge_messages::Call as MessagesCall;
pub use pallet_sudo::Call as SudoCall;
pub use pallet_timestamp::Call as TimestampCall;
Expand Down
1 change: 1 addition & 0 deletions bridges/modules/ethereum/src/validators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ impl<'a> Validators<'a> {
}

let receipts = receipts.ok_or(Error::MissingTransactionsReceipts)?;
#[allow(clippy::question_mark)]
if header.check_receipts_root(&receipts).is_err() {
return Err(Error::TransactionsReceiptsMismatch)
}
Expand Down
1 change: 1 addition & 0 deletions bridges/modules/ethereum/src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub fn accept_aura_header_into_pool<S: Storage, CT: ChainTime>(
// the heaviest, but rare operation - we do not want invalid receipts in the pool
if let Some(receipts) = receipts {
log::trace!(target: "runtime", "Got receipts! {:?}", receipts);
#[allow(clippy::question_mark)]
if header.check_receipts_root(receipts).is_err() {
return Err(Error::TransactionsReceiptsMismatch)
}
Expand Down
1 change: 1 addition & 0 deletions bridges/modules/token-swap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ pub mod pallet {
/// Violating rule#1 will lead to losing your `source_balance_at_this_chain` tokens.
/// Violating other rules will lead to losing message fees for this and other transactions +
/// losing fees for message transfer.
#[allow(clippy::boxed_local)]
#[pallet::weight(
T::WeightInfo::create_swap()
.saturating_add(T::WeightInfo::send_message_weight(
Expand Down
18 changes: 10 additions & 8 deletions bridges/relays/bin-substrate/src/chains/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,11 @@ mod rococo_tests {
Box::new(header.clone()),
justification.clone(),
);
let expected = millau_runtime::BridgeGrandpaRialtoCall::<millau_runtime::Runtime>::submit_finality_proof(
Box::new(header),
justification,
);
let expected =
millau_runtime::BridgeGrandpaCall::<millau_runtime::Runtime>::submit_finality_proof(
Box::new(header),
justification,
);

// when
let actual_encoded = actual.encode();
Expand Down Expand Up @@ -335,10 +336,11 @@ mod westend_tests {
header.clone(),
justification.clone(),
);
let expected = millau_runtime::BridgeGrandpaRialtoCall::<millau_runtime::Runtime>::submit_finality_proof(
Box::new(header),
justification,
);
let expected =
millau_runtime::BridgeGrandpaCall::<millau_runtime::Runtime>::submit_finality_proof(
Box::new(header),
justification,
);

// when
let actual_encoded = actual.encode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl SubstrateFinalitySyncPipeline for RialtoFinalityToMillau {
header: RialtoSyncHeader,
proof: GrandpaJustification<bp_rialto::Header>,
) -> Bytes {
let call = millau_runtime::BridgeGrandpaRialtoCall::<
let call = millau_runtime::BridgeGrandpaCall::<
millau_runtime::Runtime,
millau_runtime::RialtoGrandpaInstance,
>::submit_finality_proof(Box::new(header.into_inner()), proof)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl SubstrateFinalitySyncPipeline for WestendFinalityToMillau {
header: WestendSyncHeader,
proof: GrandpaJustification<bp_westend::Header>,
) -> Bytes {
let call = millau_runtime::BridgeGrandpaWestendCall::<
let call = millau_runtime::BridgeGrandpaCall::<
millau_runtime::Runtime,
millau_runtime::WestendGrandpaInstance,
>::submit_finality_proof(Box::new(header.into_inner()), proof)
Expand Down
4 changes: 2 additions & 2 deletions bridges/relays/bin-substrate/src/cli/init_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ macro_rules! select_bridge {
fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>,
) -> <Target as Chain>::Call {
let initialize_call = millau_runtime::BridgeGrandpaRialtoCall::<
let initialize_call = millau_runtime::BridgeGrandpaCall::<
millau_runtime::Runtime,
millau_runtime::RialtoGrandpaInstance,
>::initialize(init_data);
Expand All @@ -95,7 +95,7 @@ macro_rules! select_bridge {
// our deployments may fail, because we need to initialize both Rialto -> Millau
// and Westend -> Millau bridge. => since there's single possible sudo account,
// one of transaction may fail with duplicate nonce error
millau_runtime::BridgeGrandpaWestendCall::<
millau_runtime::BridgeGrandpaCall::<
millau_runtime::Runtime,
millau_runtime::WestendGrandpaInstance,
>::initialize(init_data)
Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/bin-substrate/src/cli/register_parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl RegisterParachain {

// step 1: reserve a parachain id
let relay_genesis_hash = *relay_client.genesis_hash();
let relay_sudo_account: AccountIdOf<Relaychain> = relay_sign.public().clone().into();
let relay_sudo_account: AccountIdOf<Relaychain> = relay_sign.public().into();
let reserve_parachain_id_call: CallOf<Relaychain> = ParaRegistrarCall::reserve().into();
let reserve_parachain_signer = relay_sign.clone();
wait_until_transaction_is_finalized::<Relaychain>(
Expand Down
6 changes: 3 additions & 3 deletions bridges/relays/bin-substrate/src/cli/resubmit_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ impl ResubmitTransactions {
transaction: None,
resubmitted: 0,
stalled_for: Zero::zero(),
stalled_for_limit: self.stalled_blocks.into(),
tip_step: self.tip_step.cast().into(),
tip_limit: self.tip_limit.cast().into(),
stalled_for_limit: self.stalled_blocks as _,
tip_step: self.tip_step.cast() as _,
tip_limit: self.tip_limit.cast() as _,
},
)
})
Expand Down
16 changes: 7 additions & 9 deletions bridges/relays/lib-substrate-relay/src/headers_initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use num_traits::{One, Zero};
use relay_substrate_client::{Chain, Client};
use sp_core::Bytes;
use sp_finality_grandpa::AuthorityList as GrandpaAuthoritiesSet;
use sp_runtime::traits::{Header as HeaderT, Header};
use sp_runtime::traits::Header as HeaderT;

/// Submit headers-bridge initialization transaction.
pub async fn initialize<SourceChain: Chain, TargetChain: Chain>(
Expand Down Expand Up @@ -79,7 +79,7 @@ async fn do_initialize<SourceChain: Chain, TargetChain: Chain>(
prepare_initialize_transaction: impl FnOnce(TargetChain::Index, InitializationData<SourceChain::Header>) -> Bytes
+ Send
+ 'static,
) -> Result<TargetChain::Hash, Error<SourceChain::Hash, <SourceChain::Header as Header>::Number>> {
) -> Result<TargetChain::Hash, Error<SourceChain::Hash, <SourceChain::Header as HeaderT>::Number>> {
let initialization_data = prepare_initialization_data(source_client).await?;
log::info!(
target: "bridge",
Expand All @@ -103,7 +103,7 @@ async fn prepare_initialization_data<SourceChain: Chain>(
source_client: Client<SourceChain>,
) -> Result<
InitializationData<SourceChain::Header>,
Error<SourceChain::Hash, <SourceChain::Header as Header>::Number>,
Error<SourceChain::Hash, <SourceChain::Header as HeaderT>::Number>,
> {
// In ideal world we just need to get best finalized header and then to read GRANDPA authorities
// set (`pallet_grandpa::CurrentSetId` + `GrandpaApi::grandpa_authorities()`) at this header.
Expand All @@ -121,7 +121,7 @@ async fn prepare_initialization_data<SourceChain: Chain>(
.await
.map_err(|e| Error::ReadJustification(SourceChain::NAME, e))
.and_then(|justification| {
justification.ok_or_else(|| Error::ReadJustificationStreamEnded(SourceChain::NAME))
justification.ok_or(Error::ReadJustificationStreamEnded(SourceChain::NAME))
})?;

// Read initial header.
Expand Down Expand Up @@ -174,9 +174,7 @@ async fn prepare_initialization_data<SourceChain: Chain>(
let mut initial_authorities_set_id = 0;
let mut min_possible_block_number = SourceChain::BlockNumber::zero();
let authorities_for_verification = VoterSet::new(authorities_for_verification.clone())
.ok_or_else(|| {
Error::ReadInvalidAuthorities(SourceChain::NAME, authorities_for_verification)
})?;
.ok_or(Error::ReadInvalidAuthorities(SourceChain::NAME, authorities_for_verification))?;
loop {
log::trace!(
target: "bridge", "Trying {} GRANDPA authorities set id: {}",
Expand Down Expand Up @@ -222,7 +220,7 @@ async fn prepare_initialization_data<SourceChain: Chain>(
async fn source_header<SourceChain: Chain>(
source_client: &Client<SourceChain>,
header_hash: SourceChain::Hash,
) -> Result<SourceChain::Header, Error<SourceChain::Hash, <SourceChain::Header as Header>::Number>>
) -> Result<SourceChain::Header, Error<SourceChain::Hash, <SourceChain::Header as HeaderT>::Number>>
{
source_client
.header_by_hash(header_hash)
Expand All @@ -234,7 +232,7 @@ async fn source_header<SourceChain: Chain>(
async fn source_authorities_set<SourceChain: Chain>(
source_client: &Client<SourceChain>,
header_hash: SourceChain::Hash,
) -> Result<GrandpaAuthoritiesSet, Error<SourceChain::Hash, <SourceChain::Header as Header>::Number>>
) -> Result<GrandpaAuthoritiesSet, Error<SourceChain::Hash, <SourceChain::Header as HeaderT>::Number>>
{
let raw_authorities_set = source_client
.grandpa_authorities_set(header_hash)
Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/messages/src/message_race_delivery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ where
);

return None
}
},
_ => (),
}

Expand Down

0 comments on commit 6396239

Please sign in to comment.