cargo +nightly fmt --all (#1192)

This commit is contained in:
Svyatoslav Nikolsky
2021-10-25 12:08:14 +03:00
committed by Bastian Köcher
parent 5842968273
commit 6396239e18
12 changed files with 30 additions and 29 deletions
+10 -8
View File
@@ -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();
@@ -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();
@@ -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)
@@ -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)
@@ -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);
@@ -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)
@@ -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>(
@@ -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 _,
},
)
})
@@ -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>(
@@ -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",
@@ -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.
@@ -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.
@@ -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: {}",
@@ -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)
@@ -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)
@@ -444,7 +444,7 @@ where
);
return None
}
},
_ => (),
}