mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 00:58:02 +00:00
companion for try-runtime revamp (#1997)
* companion for try-rutnime revamp * Fixes Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Generated
+265
-255
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,7 @@ sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch =
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -231,14 +231,20 @@ pub fn run() -> Result<()> {
|
||||
Some(Subcommand::TryRuntime(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
|
||||
type HostFunctionsOf<E> = ExtendedHostFunctions<
|
||||
sp_io::SubstrateHostFunctions,
|
||||
<E as NativeExecutionDispatch>::ExtendHostFunctions,
|
||||
>;
|
||||
|
||||
// grab the task manager.
|
||||
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
|
||||
let task_manager =
|
||||
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
|
||||
.map_err(|e| format!("Error: {:?}", e))?;
|
||||
|
||||
runner.async_run(|config| {
|
||||
Ok((cmd.run::<Block, ParachainNativeExecutor>(config), task_manager))
|
||||
runner.async_run(|_| {
|
||||
Ok((cmd.run::<Block, HostFunctionsOf<ParachainNativeExecutor>>(), task_manager))
|
||||
})
|
||||
},
|
||||
#[cfg(not(feature = "try-runtime"))]
|
||||
|
||||
@@ -632,21 +632,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade parachain-template.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::parachain-template", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -803,21 +803,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade statemine.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::statemine", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -816,21 +816,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade statemint.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::statemint", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -776,21 +776,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade westmint.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::westmint", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -551,21 +551,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade bridge-hub-kusama.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::bridge-hub-kusama", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -580,21 +580,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade bridge-hub-rococo.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::bridge-hub-rococo", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -715,21 +715,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade collectives-polkadot.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::collectives-polkadot", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -580,21 +580,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade contracts");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::contracts", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -696,21 +696,20 @@ impl_runtime_apis! {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade penpal.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
|
||||
let weight = Executive::try_runtime_upgrade(checks).unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight {
|
||||
log::info!(
|
||||
target: "runtime::penpal", "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}",
|
||||
block.header.number,
|
||||
block.header.hash(),
|
||||
state_root_check,
|
||||
select,
|
||||
);
|
||||
Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed")
|
||||
fn execute_block(
|
||||
block: Block,
|
||||
state_root_check: bool,
|
||||
signature_check: bool,
|
||||
select: frame_try_runtime::TryStateSelect,
|
||||
) -> Weight {
|
||||
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
|
||||
// have a backtrace here.
|
||||
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -682,43 +682,52 @@ pub fn run() -> Result<()> {
|
||||
let task_manager =
|
||||
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
|
||||
.map_err(|e| format!("Error: {:?}", e))?;
|
||||
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
|
||||
type HostFunctionsOf<E> = ExtendedHostFunctions<
|
||||
sp_io::SubstrateHostFunctions,
|
||||
<E as NativeExecutionDispatch>::ExtendHostFunctions,
|
||||
>;
|
||||
|
||||
match runner.config().chain_spec.runtime() {
|
||||
Runtime::Statemine => runner.async_run(|config| {
|
||||
Ok((cmd.run::<Block, StatemineRuntimeExecutor>(config), task_manager))
|
||||
Runtime::Statemine => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<StatemineRuntimeExecutor>>(),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::Westmint => runner.async_run(|config| {
|
||||
Ok((cmd.run::<Block, WestmintRuntimeExecutor>(config), task_manager))
|
||||
Runtime::Westmint => runner.async_run(|_| {
|
||||
Ok((cmd.run::<Block, HostFunctionsOf<WestmintRuntimeExecutor>>(), task_manager))
|
||||
}),
|
||||
Runtime::Statemint => runner.async_run(|config| {
|
||||
Ok((cmd.run::<Block, StatemintRuntimeExecutor>(config), task_manager))
|
||||
Runtime::Statemint => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<StatemintRuntimeExecutor>>(),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
|
||||
runner.async_run(|config| {
|
||||
runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, CollectivesPolkadotRuntimeExecutor>(config),
|
||||
cmd.run::<Block, HostFunctionsOf<CollectivesPolkadotRuntimeExecutor>>(),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment =>
|
||||
runner.async_run(|config| {
|
||||
Ok((
|
||||
cmd.run::<Block, BridgeHubKusamaRuntimeExecutor>(config),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<BridgeHubKusamaRuntimeExecutor>>(),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment =>
|
||||
runner.async_run(|config| {
|
||||
Ok((
|
||||
cmd.run::<Block, BridgeHubRococoRuntimeExecutor>(config),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<BridgeHubRococoRuntimeExecutor>>(),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
_ => Err(format!(
|
||||
"Chain '{:?}' doesn't support try-runtime for bridge_hub_runtime_type: {:?}",
|
||||
runner.config().chain_spec.runtime(),
|
||||
@@ -726,15 +735,15 @@ pub fn run() -> Result<()> {
|
||||
)
|
||||
.into()),
|
||||
},
|
||||
Runtime::Shell => runner.async_run(|config| {
|
||||
Runtime::Shell => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, crate::service::ShellRuntimeExecutor>(config),
|
||||
cmd.run::<Block, HostFunctionsOf<crate::service::ShellRuntimeExecutor>>(),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::ContractsRococo => runner.async_run(|config| {
|
||||
Runtime::ContractsRococo => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, crate::service::ContractsRococoRuntimeExecutor>(config),
|
||||
cmd.run::<Block, HostFunctionsOf<crate::service::ContractsRococoRuntimeExecutor>>(),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user