mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
Companion for Substrate#14474 (#2792)
* Companion for Substrate#14474
This removes the requirement to pass the native executor dispatch.
* Fix fix
* Fix
* update lockfile for {"polkadot", "substrate"}
* Fix fix fix
* Fix
---------
Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+298
-493
File diff suppressed because it is too large
Load Diff
@@ -104,8 +104,8 @@ pub fn make_default_justification(header: &TestHeader) -> GrandpaJustification<T
|
||||
// the `finality_grandpa::validate_commit` function has two ways to report an unsuccessful
|
||||
// commit validation:
|
||||
//
|
||||
// 1) to return `Err()` (which only may happen if `finality_grandpa::Chain` implementation
|
||||
// returns an error);
|
||||
// 1) to return `Err()` (which only may happen if `finality_grandpa::Chain` implementation returns
|
||||
// an error);
|
||||
// 2) to return `Ok(validation_result)` if `validation_result.is_valid()` is false.
|
||||
//
|
||||
// Our implementation would just return error in both cases.
|
||||
|
||||
@@ -26,8 +26,8 @@ pub struct MessageDispatchResult<DispatchLevelResult> {
|
||||
/// Unspent dispatch weight. This weight that will be deducted from total delivery transaction
|
||||
/// weight, thus reducing the transaction cost. This shall not be zero in (at least) two cases:
|
||||
///
|
||||
/// 1) if message has been dispatched successfully, but post-dispatch weight is less than
|
||||
/// the weight, declared by the message sender;
|
||||
/// 1) if message has been dispatched successfully, but post-dispatch weight is less than the
|
||||
/// weight, declared by the message sender;
|
||||
/// 2) if message has not been dispatched at all.
|
||||
pub unspent_weight: Weight,
|
||||
/// Fine-grained result of single message dispatch (for better diagnostic purposes)
|
||||
|
||||
@@ -17,7 +17,7 @@ use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
|
||||
use crate::{
|
||||
chain_spec,
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
service::{new_partial, ParachainNativeExecutor},
|
||||
service::new_partial,
|
||||
};
|
||||
|
||||
fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
@@ -194,7 +194,7 @@ pub fn run() -> Result<()> {
|
||||
match cmd {
|
||||
BenchmarkCmd::Pallet(cmd) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
runner.sync_run(|config| cmd.run::<Block, ParachainNativeExecutor>(config))
|
||||
runner.sync_run(|config| cmd.run::<Block, ()>(config))
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features runtime-benchmarks`."
|
||||
@@ -230,15 +230,12 @@ pub fn run() -> Result<()> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
Some(Subcommand::TryRuntime(cmd)) => {
|
||||
use parachain_template_runtime::MILLISECS_PER_BLOCK;
|
||||
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
|
||||
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
|
||||
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
type HostFunctionsOf<E> = ExtendedHostFunctions<
|
||||
sp_io::SubstrateHostFunctions,
|
||||
<E as NativeExecutionDispatch>::ExtendHostFunctions,
|
||||
>;
|
||||
type HostFunctions =
|
||||
(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions);
|
||||
|
||||
// grab the task manager.
|
||||
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
|
||||
@@ -249,12 +246,7 @@ pub fn run() -> Result<()> {
|
||||
let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK);
|
||||
|
||||
runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<ParachainNativeExecutor>, _>(Some(
|
||||
info_provider,
|
||||
)),
|
||||
task_manager,
|
||||
))
|
||||
Ok((cmd.run::<Block, HostFunctions, _>(Some(info_provider)), task_manager))
|
||||
})
|
||||
},
|
||||
#[cfg(not(feature = "try-runtime"))]
|
||||
|
||||
@@ -17,12 +17,7 @@
|
||||
use crate::{
|
||||
chain_spec,
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
service::{
|
||||
new_partial, AssetHubKusamaExecutor, AssetHubPolkadotRuntimeExecutor,
|
||||
AssetHubWestendExecutor, Block, BridgeHubKusamaRuntimeExecutor,
|
||||
BridgeHubPolkadotRuntimeExecutor, BridgeHubRococoRuntimeExecutor,
|
||||
CollectivesPolkadotRuntimeExecutor, GluttonRuntimeExecutor,
|
||||
},
|
||||
service::{new_partial, Block},
|
||||
};
|
||||
use codec::Encode;
|
||||
use cumulus_client_cli::generate_genesis_block;
|
||||
@@ -687,44 +682,7 @@ pub fn run() -> Result<()> {
|
||||
match cmd {
|
||||
BenchmarkCmd::Pallet(cmd) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
runner.sync_run(|config| {
|
||||
match config.chain_spec.runtime() {
|
||||
Runtime::AssetHubKusama =>
|
||||
cmd.run::<Block, AssetHubKusamaExecutor>(config),
|
||||
Runtime::AssetHubWestend => cmd.run::<Block, AssetHubWestendExecutor>(config),
|
||||
Runtime::AssetHubPolkadot =>
|
||||
cmd.run::<Block, AssetHubPolkadotRuntimeExecutor>(config),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
|
||||
cmd.run::<Block, CollectivesPolkadotRuntimeExecutor>(config),
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment =>
|
||||
cmd.run::<Block, BridgeHubPolkadotRuntimeExecutor>(config),
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment =>
|
||||
cmd.run::<Block, BridgeHubKusamaRuntimeExecutor>(config),
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment =>
|
||||
cmd.run::<Block, BridgeHubRococoRuntimeExecutor>(config),
|
||||
_ => Err(format!(
|
||||
"Chain '{:?}' doesn't support benchmarking for bridge_hub_runtime_type: {:?}",
|
||||
config.chain_spec.runtime(),
|
||||
bridge_hub_runtime_type
|
||||
)
|
||||
.into()),
|
||||
},
|
||||
Runtime::Glutton =>
|
||||
cmd.run::<Block, GluttonRuntimeExecutor>(config),
|
||||
_ => Err(format!(
|
||||
"Chain '{:?}' doesn't support benchmarking",
|
||||
config.chain_spec.runtime()
|
||||
)
|
||||
.into()),
|
||||
}
|
||||
})
|
||||
runner.sync_run(|config| cmd.run::<Block, ()>(config))
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features runtime-benchmarks`."
|
||||
@@ -760,7 +718,6 @@ pub fn run() -> Result<()> {
|
||||
},
|
||||
#[cfg(feature = "try-runtime")]
|
||||
Some(Subcommand::TryRuntime(cmd)) => {
|
||||
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
|
||||
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
|
||||
|
||||
// grab the task manager.
|
||||
@@ -769,99 +726,14 @@ pub fn run() -> Result<()> {
|
||||
let task_manager =
|
||||
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
|
||||
.map_err(|e| format!("Error: {:?}", e))?;
|
||||
type HostFunctionsOf<E> = ExtendedHostFunctions<
|
||||
sp_io::SubstrateHostFunctions,
|
||||
<E as NativeExecutionDispatch>::ExtendHostFunctions,
|
||||
>;
|
||||
type HostFunctions =
|
||||
(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions);
|
||||
|
||||
let info_provider = timestamp_with_aura_info(6000);
|
||||
|
||||
match runner.config().chain_spec.runtime() {
|
||||
Runtime::AssetHubKusama => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<AssetHubKusamaExecutor>, _>(Some(
|
||||
info_provider,
|
||||
)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::AssetHubWestend => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<AssetHubWestendExecutor>, _>(Some(
|
||||
info_provider,
|
||||
)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::AssetHubPolkadot => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<AssetHubPolkadotRuntimeExecutor>, _>(Some(
|
||||
info_provider,
|
||||
)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
|
||||
runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<CollectivesPolkadotRuntimeExecutor>, _>(Some(info_provider)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) =>
|
||||
match bridge_hub_runtime_type {
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment =>
|
||||
runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<BridgeHubPolkadotRuntimeExecutor>, _>(Some(info_provider)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<BridgeHubKusamaRuntimeExecutor>, _>(Some(info_provider)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<BridgeHubRococoRuntimeExecutor>, _>(Some(info_provider)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
_ => Err(format!(
|
||||
"Chain '{:?}' doesn't support try-runtime for bridge_hub_runtime_type: {:?}",
|
||||
runner.config().chain_spec.runtime(),
|
||||
bridge_hub_runtime_type
|
||||
)
|
||||
.into()),
|
||||
},
|
||||
Runtime::Shell => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<crate::service::ShellRuntimeExecutor>, _>(Some(info_provider)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::ContractsRococo => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<crate::service::ContractsRococoRuntimeExecutor>, _>(Some(info_provider)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::Glutton => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<crate::service::GluttonRuntimeExecutor>, _>(Some(info_provider)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
_ => Err("Chain doesn't support try-runtime".into()),
|
||||
}
|
||||
Ok((cmd.run::<Block, HostFunctions, _>(Some(info_provider)), task_manager))
|
||||
})
|
||||
},
|
||||
#[cfg(not(feature = "try-runtime"))]
|
||||
Some(Subcommand::TryRuntime) => Err("Try-runtime was not enabled when building the node. \
|
||||
|
||||
Reference in New Issue
Block a user