From 80d58647ab739ded28879477db1120b079993e79 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Tue, 21 Sep 2021 19:08:21 +0100 Subject: [PATCH] companion for substrate#9788 (#3858) * companion for https://github.com/paritytech/substrate/pull/9788 * fmt * Some fixes * final fixes * fix a few small things * update Substrate Co-authored-by: parity-processbot <> --- polkadot/runtime/kusama/src/lib.rs | 9 ++++++--- polkadot/runtime/parachains/src/hrmp.rs | 5 +++-- polkadot/runtime/polkadot/src/lib.rs | 10 +++++++--- polkadot/runtime/westend/src/lib.rs | 9 ++++++--- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index 0837d2caf1..86ef70dc98 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -2016,10 +2016,13 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade() -> Result<(Weight, Weight), sp_runtime::RuntimeString> { + fn on_runtime_upgrade() -> (Weight, Weight) { log::info!("try-runtime::on_runtime_upgrade kusama."); - let weight = Executive::try_runtime_upgrade()?; - Ok((weight, BlockWeights::get().max_block)) + let weight = Executive::try_runtime_upgrade().unwrap(); + (weight, BlockWeights::get().max_block) + } + fn execute_block_no_check(block: Block) -> Weight { + Executive::execute_block_no_check(block) } } diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index f087dfd3a4..373bb3d662 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -143,8 +143,9 @@ impl fmt::Debug for OutboundHrmpAcceptanceErr { "more HRMP messages than permitted by config ({} > {})", sent, permitted, ), - NotSorted { idx } => - write!(fmt, "the HRMP messages are not sorted (first unsorted is at index {})", idx,), + NotSorted { idx } => { + write!(fmt, "the HRMP messages are not sorted (first unsorted is at index {})", idx,) + }, NoSuchChannel { idx, channel_id } => write!( fmt, "the HRMP message at index {} is sent to a non existent channel {:?}->{:?}", diff --git a/polkadot/runtime/polkadot/src/lib.rs b/polkadot/runtime/polkadot/src/lib.rs index a69e28554e..ca9747c957 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -1593,10 +1593,14 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade() -> Result<(Weight, Weight), sp_runtime::RuntimeString> { + fn on_runtime_upgrade() -> (Weight, Weight) { log::info!("try-runtime::on_runtime_upgrade polkadot."); - let weight = Executive::try_runtime_upgrade()?; - Ok((weight, BlockWeights::get().max_block)) + let weight = Executive::try_runtime_upgrade().unwrap(); + (weight, BlockWeights::get().max_block) + } + + fn execute_block_no_check(block: Block) -> Weight { + Executive::execute_block_no_check(block) } } diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 3ce1ef1def..31b9342dc6 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -1441,10 +1441,13 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade() -> Result<(Weight, Weight), sp_runtime::RuntimeString> { + fn on_runtime_upgrade() -> (Weight, Weight) { log::info!("try-runtime::on_runtime_upgrade westend."); - let weight = Executive::try_runtime_upgrade()?; - Ok((weight, BlockWeights::get().max_block)) + let weight = Executive::try_runtime_upgrade().unwrap(); + (weight, BlockWeights::get().max_block) + } + fn execute_block_no_check(block: Block) -> Weight { + Executive::execute_block_no_check(block) } }