diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 913199f7e0919..8f67e6e7d9496 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -836,7 +836,7 @@ pub mod pallet { if Self::request_version_notify(dest).is_ok() { // TODO: correct weights. weight_used.saturating_accrue(T::DbWeight::get().reads_writes(1, 1)); - break; + break } } } @@ -884,9 +884,8 @@ pub mod pallet { timeout, maybe_match_querier: Some(Location::here().into()), }, - VersionNotifier { origin, is_active } => { - QueryStatus::VersionNotifier { origin, is_active } - }, + VersionNotifier { origin, is_active } => + QueryStatus::VersionNotifier { origin, is_active }, Ready { response, at } => QueryStatus::Ready { response, at }, } } @@ -1690,9 +1689,8 @@ impl Pallet { fees, weight_limit, )?, - TransferType::RemoteReserve(_) => { - return Err(Error::::InvalidAssetUnsupportedReserve.into()) - }, + TransferType::RemoteReserve(_) => + return Err(Error::::InvalidAssetUnsupportedReserve.into()), }; FeesHandling::Separate { local_xcm, remote_xcm } }; @@ -2241,7 +2239,7 @@ impl Pallet { } weight_used.saturating_accrue(sv_migrate_weight); if weight_used.any_gte(weight_cutoff) { - return (weight_used, Some(stage)); + return (weight_used, Some(stage)) } } } @@ -2255,7 +2253,7 @@ impl Pallet { } weight_used.saturating_accrue(vn_migrate_weight); if weight_used.any_gte(weight_cutoff) { - return (weight_used, Some(stage)); + return (weight_used, Some(stage)) } } } @@ -2277,7 +2275,7 @@ impl Pallet { // We don't early return here since we need to be certain that we // make some progress. weight_used.saturating_accrue(vnt_already_notified_weight); - continue; + continue }, }; let response = Response::Version(xcm_version); @@ -2303,7 +2301,7 @@ impl Pallet { weight_used.saturating_accrue(vnt_notify_weight); if weight_used.any_gte(weight_cutoff) { let last = Some(iter.last_raw_key().into()); - return (weight_used, Some(NotifyCurrentTargets(last))); + return (weight_used, Some(NotifyCurrentTargets(last))) } } stage = MigrateAndNotifyOldTargets; @@ -2321,9 +2319,9 @@ impl Pallet { }); weight_used.saturating_accrue(vnt_migrate_fail_weight); if weight_used.any_gte(weight_cutoff) { - return (weight_used, Some(stage)); + return (weight_used, Some(stage)) } - continue; + continue }, }; @@ -2364,7 +2362,7 @@ impl Pallet { weight_used.saturating_accrue(vnt_notify_migrate_weight); } if weight_used.any_gte(weight_cutoff) { - return (weight_used, Some(stage)); + return (weight_used, Some(stage)) } } } @@ -2690,7 +2688,7 @@ impl Pallet { // if migration has been already scheduled, everything is ok and data will be eventually // migrated if CurrentMigration::::exists() { - return Ok(()); + return Ok(()) } // if migration has NOT been scheduled yet, we need to check all operational data @@ -2987,7 +2985,7 @@ impl VersionChangeNotifier for Pallet { impl DropAssets for Pallet { fn drop_assets(origin: &Location, assets: AssetsInHolding, _context: &XcmContext) -> Weight { if assets.is_empty() { - return Weight::zero(); + return Weight::zero() } let versioned = VersionedAssets::from(Assets::from(assets)); let hash = BlakeTwo256::hash_of(&(&origin, &versioned)); @@ -3011,12 +3009,11 @@ impl ClaimAssets for Pallet { ) -> bool { let mut versioned = VersionedAssets::from(assets.clone()); match ticket.unpack() { - (0, [GeneralIndex(i)]) => { + (0, [GeneralIndex(i)]) => versioned = match versioned.into_version(*i as u32) { Ok(v) => v, Err(()) => return false, - } - }, + }, (0, []) => (), _ => return false, }; @@ -3031,7 +3028,7 @@ impl ClaimAssets for Pallet { origin: origin.clone(), assets: versioned, }); - return true; + return true } } @@ -3042,17 +3039,15 @@ impl OnResponse for Pallet { querier: Option<&Location>, ) -> bool { match Queries::::get(query_id) { - Some(QueryStatus::Pending { responder, maybe_match_querier, .. }) => { - Location::try_from(responder).map_or(false, |r| origin == &r) - && maybe_match_querier.map_or(true, |match_querier| { + Some(QueryStatus::Pending { responder, maybe_match_querier, .. }) => + Location::try_from(responder).map_or(false, |r| origin == &r) && + maybe_match_querier.map_or(true, |match_querier| { Location::try_from(match_querier).map_or(false, |match_querier| { querier.map_or(false, |q| q == &match_querier) }) - }) - }, - Some(QueryStatus::VersionNotifier { origin: r, .. }) => { - Location::try_from(r).map_or(false, |r| origin == &r) - }, + }), + Some(QueryStatus::VersionNotifier { origin: r, .. }) => + Location::try_from(r).map_or(false, |r| origin == &r), _ => false, } } @@ -3079,7 +3074,7 @@ impl OnResponse for Pallet { query_id, expected_location: Some(o), }); - return Weight::zero(); + return Weight::zero() }, _ => { Self::deposit_event(Event::InvalidResponder { @@ -3088,7 +3083,7 @@ impl OnResponse for Pallet { expected_location: None, }); // TODO #3735: Correct weight for this. - return Weight::zero(); + return Weight::zero() }, }; // TODO #3735: Check max_weight is correct. @@ -3121,7 +3116,7 @@ impl OnResponse for Pallet { origin: origin.clone(), query_id, }); - return Weight::zero(); + return Weight::zero() }, }; if querier.map_or(true, |q| q != &match_querier) { @@ -3131,7 +3126,7 @@ impl OnResponse for Pallet { expected_querier: match_querier, maybe_actual_querier: querier.cloned(), }); - return Weight::zero(); + return Weight::zero() } } let responder = match Location::try_from(responder) { @@ -3141,7 +3136,7 @@ impl OnResponse for Pallet { origin: origin.clone(), query_id, }); - return Weight::zero(); + return Weight::zero() }, }; if origin != responder { @@ -3150,7 +3145,7 @@ impl OnResponse for Pallet { query_id, expected_location: Some(responder), }); - return Weight::zero(); + return Weight::zero() } return match maybe_notify { Some((pallet_index, call_index)) => { @@ -3172,7 +3167,7 @@ impl OnResponse for Pallet { max_budgeted_weight: max_weight, }; Self::deposit_event(e); - return Weight::zero(); + return Weight::zero() } let dispatch_origin = Origin::Response(origin.clone()).into(); match call.dispatch(dispatch_origin) { @@ -3209,7 +3204,7 @@ impl OnResponse for Pallet { Queries::::insert(query_id, QueryStatus::Ready { response, at }); Weight::zero() }, - }; + } }, _ => { let e = Event::UnexpectedResponse { origin: origin.clone(), query_id }; @@ -3318,9 +3313,7 @@ where caller.try_into().and_then(|o| match o { Origin::Xcm(ref location) if F::contains(&location.clone().try_into().map_err(|_| o.clone().into())?) => - { - Ok(location.clone().try_into().map_err(|_| o.clone().into())?) - }, + Ok(location.clone().try_into().map_err(|_| o.clone().into())?), Origin::Xcm(location) => Err(Origin::Xcm(location).into()), o => Err(o.into()), }) diff --git a/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs b/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs index 50d17655e1243..3d57c61d16168 100644 --- a/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs +++ b/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs @@ -224,14 +224,14 @@ fn run_input(xcm_messages: [XcmMessage; 5]) { |execute_with| { execute_with(|| { #[cfg(feature = "try-runtime")] - parachain::AllPalletsWithSystem::try_state(Default::default()).unwrap(); + parachain::AllPalletsWithSystem::try_state(Default::default(), All).unwrap(); parachain::AllPalletsWithSystem::integrity_test(); }); }, ); Relay::execute_with(|| { #[cfg(feature = "try-runtime")] - relay_chain::AllPalletsWithSystem::try_state(Default::default()).unwrap(); + relay_chain::AllPalletsWithSystem::try_state(Default::default(), All).unwrap(); relay_chain::AllPalletsWithSystem::integrity_test(); }); } diff --git a/substrate/frame/delegated-staking/src/mock.rs b/substrate/frame/delegated-staking/src/mock.rs index bd566bd5a3140..e8eefae62a582 100644 --- a/substrate/frame/delegated-staking/src/mock.rs +++ b/substrate/frame/delegated-staking/src/mock.rs @@ -320,8 +320,8 @@ pub(crate) fn start_era(era: sp_staking::EraIndex) { } pub(crate) fn eq_stake(who: AccountId, total: Balance, active: Balance) -> bool { - Staking::stake(&who).unwrap() == Stake { total, active } - && get_agent_ledger(&who).ledger.stakeable_balance() == total + Staking::stake(&who).unwrap() == Stake { total, active } && + get_agent_ledger(&who).ledger.stakeable_balance() == total } pub(crate) fn get_agent_ledger(agent: &AccountId) -> AgentLedgerOuter { diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index a1764526efd33..192fb451d24e5 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -365,7 +365,7 @@ impl< // Check if there are any forbidden non-inherents in the block. if mode == ExtrinsicInclusionMode::OnlyInherents && extrinsics.len() > num_inherents { - return Err("Only inherents allowed".into()); + return Err("Only inherents allowed".into()) } let try_apply_extrinsic = |uxt: Block::Extrinsic| -> ApplyExtrinsicResult { @@ -390,7 +390,7 @@ impl< let r = Applyable::apply::(xt, &dispatch_info, encoded_len)?; if r.is_err() && dispatch_info.class == DispatchClass::Mandatory { - return Err(InvalidTransaction::BadMandatory.into()); + return Err(InvalidTransaction::BadMandatory.into()) } >::note_applied_extrinsic(&r, dispatch_info); @@ -406,7 +406,7 @@ impl< e, err, ); - break; + break } } @@ -776,7 +776,7 @@ impl< /// ongoing MBMs. fn on_idle_hook(block_number: NumberFor) { if ::MultiBlockMigrator::ongoing() { - return; + return } let weight = >::block_weight(); @@ -860,7 +860,7 @@ impl< // The entire block should be discarded if an inherent fails to apply. Otherwise // it may open an attack vector. if r.is_err() && dispatch_info.class == DispatchClass::Mandatory { - return Err(InvalidTransaction::BadMandatory.into()); + return Err(InvalidTransaction::BadMandatory.into()) } >::note_applied_extrinsic(&r, dispatch_info); @@ -930,7 +930,7 @@ impl< }; if dispatch_info.class == DispatchClass::Mandatory { - return Err(InvalidTransaction::MandatoryValidation.into()); + return Err(InvalidTransaction::MandatoryValidation.into()) } within_span! { diff --git a/substrate/frame/support/procedural/src/pallet/expand/hooks.rs b/substrate/frame/support/procedural/src/pallet/expand/hooks.rs index e412581d11a6a..37fde65688335 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/hooks.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/hooks.rs @@ -143,222 +143,222 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream { }; quote::quote_spanned!(span => - #hooks_impl - - impl<#type_impl_gen> - #frame_support::traits::OnFinalize<#frame_system::pallet_prelude::BlockNumberFor::> - for #pallet_ident<#type_use_gen> #where_clause - { - fn on_finalize(n: #frame_system::pallet_prelude::BlockNumberFor::) { - #frame_support::__private::sp_tracing::enter_span!( - #frame_support::__private::sp_tracing::trace_span!("on_finalize") - ); - < - Self as #frame_support::traits::Hooks< - #frame_system::pallet_prelude::BlockNumberFor:: - > - >::on_finalize(n) - } + #hooks_impl + + impl<#type_impl_gen> + #frame_support::traits::OnFinalize<#frame_system::pallet_prelude::BlockNumberFor::> + for #pallet_ident<#type_use_gen> #where_clause + { + fn on_finalize(n: #frame_system::pallet_prelude::BlockNumberFor::) { + #frame_support::__private::sp_tracing::enter_span!( + #frame_support::__private::sp_tracing::trace_span!("on_finalize") + ); + < + Self as #frame_support::traits::Hooks< + #frame_system::pallet_prelude::BlockNumberFor:: + > + >::on_finalize(n) } + } - impl<#type_impl_gen> - #frame_support::traits::OnIdle<#frame_system::pallet_prelude::BlockNumberFor::> - for #pallet_ident<#type_use_gen> #where_clause - { - fn on_idle( - n: #frame_system::pallet_prelude::BlockNumberFor::, - remaining_weight: #frame_support::weights::Weight - ) -> #frame_support::weights::Weight { - < - Self as #frame_support::traits::Hooks< - #frame_system::pallet_prelude::BlockNumberFor:: - > - >::on_idle(n, remaining_weight) - } + impl<#type_impl_gen> + #frame_support::traits::OnIdle<#frame_system::pallet_prelude::BlockNumberFor::> + for #pallet_ident<#type_use_gen> #where_clause + { + fn on_idle( + n: #frame_system::pallet_prelude::BlockNumberFor::, + remaining_weight: #frame_support::weights::Weight + ) -> #frame_support::weights::Weight { + < + Self as #frame_support::traits::Hooks< + #frame_system::pallet_prelude::BlockNumberFor:: + > + >::on_idle(n, remaining_weight) } + } - impl<#type_impl_gen> - #frame_support::traits::OnPoll<#frame_system::pallet_prelude::BlockNumberFor::> - for #pallet_ident<#type_use_gen> #where_clause - { - fn on_poll( - n: #frame_system::pallet_prelude::BlockNumberFor::, - weight: &mut #frame_support::weights::WeightMeter - ) { - < - Self as #frame_support::traits::Hooks< - #frame_system::pallet_prelude::BlockNumberFor:: - > - >::on_poll(n, weight); - } + impl<#type_impl_gen> + #frame_support::traits::OnPoll<#frame_system::pallet_prelude::BlockNumberFor::> + for #pallet_ident<#type_use_gen> #where_clause + { + fn on_poll( + n: #frame_system::pallet_prelude::BlockNumberFor::, + weight: &mut #frame_support::weights::WeightMeter + ) { + < + Self as #frame_support::traits::Hooks< + #frame_system::pallet_prelude::BlockNumberFor:: + > + >::on_poll(n, weight); } + } - impl<#type_impl_gen> - #frame_support::traits::OnInitialize<#frame_system::pallet_prelude::BlockNumberFor::> - for #pallet_ident<#type_use_gen> #where_clause - { - fn on_initialize( - n: #frame_system::pallet_prelude::BlockNumberFor:: - ) -> #frame_support::weights::Weight { - #frame_support::__private::sp_tracing::enter_span!( - #frame_support::__private::sp_tracing::trace_span!("on_initialize") - ); - < - Self as #frame_support::traits::Hooks< - #frame_system::pallet_prelude::BlockNumberFor:: - > - >::on_initialize(n) - } + impl<#type_impl_gen> + #frame_support::traits::OnInitialize<#frame_system::pallet_prelude::BlockNumberFor::> + for #pallet_ident<#type_use_gen> #where_clause + { + fn on_initialize( + n: #frame_system::pallet_prelude::BlockNumberFor:: + ) -> #frame_support::weights::Weight { + #frame_support::__private::sp_tracing::enter_span!( + #frame_support::__private::sp_tracing::trace_span!("on_initialize") + ); + < + Self as #frame_support::traits::Hooks< + #frame_system::pallet_prelude::BlockNumberFor:: + > + >::on_initialize(n) } + } - impl<#type_impl_gen> - #frame_support::traits::BeforeAllRuntimeMigrations - for #pallet_ident<#type_use_gen> #where_clause - { - fn before_all_runtime_migrations() -> #frame_support::weights::Weight { - use #frame_support::traits::{Get, PalletInfoAccess}; - use #frame_support::__private::hashing::twox_128; - use #frame_support::storage::unhashed::contains_prefixed_key; - #frame_support::__private::sp_tracing::enter_span!( - #frame_support::__private::sp_tracing::trace_span!("before_all") - ); + impl<#type_impl_gen> + #frame_support::traits::BeforeAllRuntimeMigrations + for #pallet_ident<#type_use_gen> #where_clause + { + fn before_all_runtime_migrations() -> #frame_support::weights::Weight { + use #frame_support::traits::{Get, PalletInfoAccess}; + use #frame_support::__private::hashing::twox_128; + use #frame_support::storage::unhashed::contains_prefixed_key; + #frame_support::__private::sp_tracing::enter_span!( + #frame_support::__private::sp_tracing::trace_span!("before_all") + ); - // Check if the pallet has any keys set, including the storage version. If there are - // no keys set, the pallet was just added to the runtime and needs to have its - // version initialized. - let pallet_hashed_prefix = ::name_hash(); - let exists = contains_prefixed_key(&pallet_hashed_prefix); - if !exists { - #initialize_on_chain_storage_version - ::DbWeight::get().reads_writes(1, 1) - } else { - ::DbWeight::get().reads(1) - } + // Check if the pallet has any keys set, including the storage version. If there are + // no keys set, the pallet was just added to the runtime and needs to have its + // version initialized. + let pallet_hashed_prefix = ::name_hash(); + let exists = contains_prefixed_key(&pallet_hashed_prefix); + if !exists { + #initialize_on_chain_storage_version + ::DbWeight::get().reads_writes(1, 1) + } else { + ::DbWeight::get().reads(1) } } + } - impl<#type_impl_gen> - #frame_support::traits::OnRuntimeUpgrade - for #pallet_ident<#type_use_gen> #where_clause - { - fn on_runtime_upgrade() -> #frame_support::weights::Weight { - #frame_support::__private::sp_tracing::enter_span!( - #frame_support::__private::sp_tracing::trace_span!("on_runtime_update") - ); + impl<#type_impl_gen> + #frame_support::traits::OnRuntimeUpgrade + for #pallet_ident<#type_use_gen> #where_clause + { + fn on_runtime_upgrade() -> #frame_support::weights::Weight { + #frame_support::__private::sp_tracing::enter_span!( + #frame_support::__private::sp_tracing::trace_span!("on_runtime_update") + ); - // log info about the upgrade. - #log_runtime_upgrade + // log info about the upgrade. + #log_runtime_upgrade - < - Self as #frame_support::traits::Hooks< - #frame_system::pallet_prelude::BlockNumberFor:: - > - >::on_runtime_upgrade() - } + < + Self as #frame_support::traits::Hooks< + #frame_system::pallet_prelude::BlockNumberFor:: + > + >::on_runtime_upgrade() + } - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<#frame_support::__private::sp_std::vec::Vec, #frame_support::sp_runtime::TryRuntimeError> { - < - Self - as - #frame_support::traits::Hooks<#frame_system::pallet_prelude::BlockNumberFor::> - >::pre_upgrade() - } + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result<#frame_support::__private::sp_std::vec::Vec, #frame_support::sp_runtime::TryRuntimeError> { + < + Self + as + #frame_support::traits::Hooks<#frame_system::pallet_prelude::BlockNumberFor::> + >::pre_upgrade() + } - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: #frame_support::__private::sp_std::vec::Vec) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { - #post_storage_version_check + #[cfg(feature = "try-runtime")] + fn post_upgrade(state: #frame_support::__private::sp_std::vec::Vec) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { + #post_storage_version_check + + < + Self + as + #frame_support::traits::Hooks<#frame_system::pallet_prelude::BlockNumberFor::> + >::post_upgrade(state) + } + } - < - Self - as - #frame_support::traits::Hooks<#frame_system::pallet_prelude::BlockNumberFor::> - >::post_upgrade(state) - } + impl<#type_impl_gen> + #frame_support::traits::OffchainWorker<#frame_system::pallet_prelude::BlockNumberFor::> + for #pallet_ident<#type_use_gen> #where_clause + { + fn offchain_worker(n: #frame_system::pallet_prelude::BlockNumberFor::) { + < + Self as #frame_support::traits::Hooks< + #frame_system::pallet_prelude::BlockNumberFor:: + > + >::offchain_worker(n) } + } + // Integrity tests are only required for when `std` is enabled. + #frame_support::std_enabled! { impl<#type_impl_gen> - #frame_support::traits::OffchainWorker<#frame_system::pallet_prelude::BlockNumberFor::> - for #pallet_ident<#type_use_gen> #where_clause + #frame_support::traits::IntegrityTest + for #pallet_ident<#type_use_gen> #where_clause { - fn offchain_worker(n: #frame_system::pallet_prelude::BlockNumberFor::) { - < - Self as #frame_support::traits::Hooks< - #frame_system::pallet_prelude::BlockNumberFor:: - > - >::offchain_worker(n) - } - } - - // Integrity tests are only required for when `std` is enabled. - #frame_support::std_enabled! { - impl<#type_impl_gen> - #frame_support::traits::IntegrityTest - for #pallet_ident<#type_use_gen> #where_clause - { - fn integrity_test() { - #frame_support::__private::sp_io::TestExternalities::default().execute_with(|| { - < - Self as #frame_support::traits::Hooks< - #frame_system::pallet_prelude::BlockNumberFor:: - > - >::integrity_test() - }); - } + fn integrity_test() { + #frame_support::__private::sp_io::TestExternalities::default().execute_with(|| { + < + Self as #frame_support::traits::Hooks< + #frame_system::pallet_prelude::BlockNumberFor:: + > + >::integrity_test() + }); } } + } - #[cfg(feature = "try-runtime")] - impl<#type_impl_gen> - #frame_support::traits::TryState<#frame_system::pallet_prelude::BlockNumberFor::> - for #pallet_ident<#type_use_gen> #where_clause - { - fn try_state( - n: #frame_system::pallet_prelude::BlockNumberFor::, - _s: #frame_support::traits::TryStateSelect - ) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { - #frame_support::__private::log::info!( + #[cfg(feature = "try-runtime")] + impl<#type_impl_gen> + #frame_support::traits::TryState<#frame_system::pallet_prelude::BlockNumberFor::> + for #pallet_ident<#type_use_gen> #where_clause + { + fn try_state( + n: #frame_system::pallet_prelude::BlockNumberFor::, + _s: #frame_support::traits::TryStateSelect + ) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { + #frame_support::__private::log::info!( + target: #frame_support::LOG_TARGET, + "🩺 Running {:?} try-state checks", + #pallet_name, + ); + < + Self as #frame_support::traits::Hooks< + #frame_system::pallet_prelude::BlockNumberFor:: + > + >::try_state(n).map_err(|err| { + #frame_support::__private::log::error!( target: #frame_support::LOG_TARGET, - "🩺 Running {:?} try-state checks", + "❌ {:?} try_state checks failed: {:?}", #pallet_name, + err ); - < - Self as #frame_support::traits::Hooks< - #frame_system::pallet_prelude::BlockNumberFor:: - > - >::try_state(n).map_err(|err| { - #frame_support::__private::log::error!( - target: #frame_support::LOG_TARGET, - "❌ {:?} try_state checks failed: {:?}", - #pallet_name, - err - ); - err - }) - } + err + }) } + } - // Implement `TryStateLogic` for `Pallet` - #[cfg(feature = "try-runtime")] - impl<#type_impl_gen> #frame_support::traits::TryStateLogic<#frame_system::pallet_prelude::BlockNumberFor> - for #pallet_ident<#type_use_gen> - #where_clause - { - fn try_state(n: frame_system::pallet_prelude::BlockNumberFor) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { - >>::try_state(n, #frame_support::traits::TryStateSelect::All) - } + // Implement `TryStateLogic` for `Pallet` + #[cfg(feature = "try-runtime")] + impl<#type_impl_gen> #frame_support::traits::TryStateLogic<#frame_system::pallet_prelude::BlockNumberFor> + for #pallet_ident<#type_use_gen> + #where_clause + { + fn try_state(n: frame_system::pallet_prelude::BlockNumberFor) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { + >>::try_state(n, #frame_support::traits::TryStateSelect::All) } + } - // Implement `IdentifiableTryStateLogic` for `Pallet` - #[cfg(feature = "try-runtime")] - impl<#type_impl_gen> #frame_support::traits::IdentifiableTryStateLogic> - for #pallet_ident<#type_use_gen> - #where_clause - { - fn matches_id(id: &[u8]) -> bool { - ::name().as_bytes() == id - } + // Implement `IdentifiableTryStateLogic` for `Pallet` + #[cfg(feature = "try-runtime")] + impl<#type_impl_gen> #frame_support::traits::IdentifiableTryStateLogic> + for #pallet_ident<#type_use_gen> + #where_clause + { + fn matches_id(id: &[u8]) -> bool { + ::name().as_bytes() == id } + } ) } diff --git a/substrate/frame/support/src/traits/try_runtime/mod.rs b/substrate/frame/support/src/traits/try_runtime/mod.rs index 5205c0cb4dc93..dcf323fd01deb 100644 --- a/substrate/frame/support/src/traits/try_runtime/mod.rs +++ b/substrate/frame/support/src/traits/try_runtime/mod.rs @@ -248,7 +248,7 @@ where "Detected errors while executing `try_state` checks. See logs for more \ info." .into(), - ); + ) } Ok(()) diff --git a/substrate/primitives/io/src/lib.rs b/substrate/primitives/io/src/lib.rs index 79bb93e8f5143..c8675a9a90bd2 100644 --- a/substrate/primitives/io/src/lib.rs +++ b/substrate/primitives/io/src/lib.rs @@ -836,7 +836,7 @@ pub trait Crypto { use ed25519_dalek::Verifier; let Ok(public_key) = ed25519_dalek::VerifyingKey::from_bytes(&pub_key.0) else { - return false; + return false }; let sig = ed25519_dalek::Signature::from_bytes(&sig.0);