git.delta.rocks / unique-network / refs/commits / 6b7300defa13

difftreelog

Make opal runtime mandatory

Daniel Shiposha2022-03-14parent: #7aeac19.patch.diff
in: master

5 files changed

modifiednode/cli/Cargo.tomldiffbeforeafterboth
252252
253[dependencies.opal-runtime]253[dependencies.opal-runtime]
254path = '../../runtime/opal'254path = '../../runtime/opal'
255optional = true
256255
257[dependencies.up-data-structs]256[dependencies.up-data-structs]
258path = "../../primitives/data-structs"257path = "../../primitives/data-structs"
306unique-rpc = { default-features = false, path = "../rpc" }305unique-rpc = { default-features = false, path = "../rpc" }
307306
308[features]307[features]
309default = ["unique-runtime", "quartz-runtime", "opal-runtime"]308default = ["unique-runtime", "quartz-runtime"]
310runtime-benchmarks = [309runtime-benchmarks = [
311 'unique-runtime/runtime-benchmarks',310 'unique-runtime/runtime-benchmarks',
312 'polkadot-service/runtime-benchmarks',311 'polkadot-service/runtime-benchmarks',
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
35pub type QuartzChainSpec = sc_service::GenericChainSpec<quartz_runtime::GenesisConfig, Extensions>;35pub type QuartzChainSpec = sc_service::GenericChainSpec<quartz_runtime::GenesisConfig, Extensions>;
3636
37/// The `ChainSpec` parameterized for the opal runtime.37/// The `ChainSpec` parameterized for the opal runtime.
38#[cfg(feature = "opal-runtime")]
39pub type OpalChainSpec = sc_service::GenericChainSpec<opal_runtime::GenesisConfig, Extensions>;38pub type OpalChainSpec = sc_service::GenericChainSpec<opal_runtime::GenesisConfig, Extensions>;
4039
41pub enum RuntimeId {40pub enum RuntimeId {
61 return RuntimeId::Quartz;60 return RuntimeId::Quartz;
62 }61 }
6362
64 #[cfg(feature = "opal-runtime")]
65 if self.id().starts_with("opal") {63 if self.id().starts_with("opal") {
66 return RuntimeId::Opal;64 return RuntimeId::Opal;
67 }65 }
modifiednode/cli/src/command.rsdiffbeforeafterboth
44#[cfg(feature = "quartz-runtime")]44#[cfg(feature = "quartz-runtime")]
45use crate::service::QuartzRuntimeExecutor;45use crate::service::QuartzRuntimeExecutor;
4646
47#[cfg(feature = "opal-runtime")]
48use crate::service::OpalRuntimeExecutor;47use crate::service::OpalRuntimeExecutor;
4948
50use codec::Encode;49use codec::Encode;
82 "" | "local" => Box::new(chain_spec::local_testnet_rococo_config()),81 "" | "local" => Box::new(chain_spec::local_testnet_rococo_config()),
83 path => {82 path => {
84 let path = std::path::PathBuf::from(path);83 let path = std::path::PathBuf::from(path);
85 let chain_spec = Box::new(sc_service::GenericChainSpec::<()>::from_json_file(84 let chain_spec = Box::new(chain_spec::OpalChainSpec::from_json_file(
86 path.clone(),85 path.clone(),
87 )?) as Box<dyn sc_service::ChainSpec>;86 )?) as Box<dyn sc_service::ChainSpec>;
8887
93 #[cfg(feature = "quartz-runtime")]92 #[cfg(feature = "quartz-runtime")]
94 RuntimeId::Quartz => Box::new(chain_spec::QuartzChainSpec::from_json_file(path)?),93 RuntimeId::Quartz => Box::new(chain_spec::QuartzChainSpec::from_json_file(path)?),
9594
96 #[cfg(feature = "opal-runtime")]
97 RuntimeId::Opal => Box::new(chain_spec::OpalChainSpec::from_json_file(path)?),95 RuntimeId::Opal => Box::new(chain_spec::OpalChainSpec::from_json_file(path)?),
98
99 RuntimeId::Unknown(chain) => return Err(no_runtime_err!(chain)),96 RuntimeId::Unknown(chain) => return Err(no_runtime_err!(chain)),
147 #[cfg(feature = "quartz-runtime")]144 #[cfg(feature = "quartz-runtime")]
148 RuntimeId::Quartz => &quartz_runtime::VERSION,145 RuntimeId::Quartz => &quartz_runtime::VERSION,
149146
150 #[cfg(feature = "opal-runtime")]
151 RuntimeId::Opal => &opal_runtime::VERSION,147 RuntimeId::Opal => &opal_runtime::VERSION,
152
153 RuntimeId::Unknown(chain) => panic!("{}", no_runtime_err!(chain)),148 RuntimeId::Unknown(chain) => panic!("{}", no_runtime_err!(chain)),
241 runner, $components, $cli, $cmd, $config, $( $code )*236 runner, $components, $cli, $cmd, $config, $( $code )*
242 ),237 ),
243238
244 #[cfg(feature = "opal-runtime")]
245 RuntimeId::Opal => async_run_with_runtime!(239 RuntimeId::Opal => async_run_with_runtime!(
246 opal_runtime::RuntimeApi, OpalRuntimeExecutor,240 opal_runtime::RuntimeApi, OpalRuntimeExecutor,
247 runner, $components, $cli, $cmd, $config, $( $code )*241 runner, $components, $cli, $cmd, $config, $( $code )*
359 #[cfg(feature = "quartz-runtime")]353 #[cfg(feature = "quartz-runtime")]
360 RuntimeId::Quartz => cmd.run::<Block, QuartzRuntimeExecutor>(config),354 RuntimeId::Quartz => cmd.run::<Block, QuartzRuntimeExecutor>(config),
361355
362 #[cfg(feature = "opal-runtime")]
363 RuntimeId::Opal => cmd.run::<Block, OpalRuntimeExecutor>(config),356 RuntimeId::Opal => cmd.run::<Block, OpalRuntimeExecutor>(config),
364
365 RuntimeId::Unknown(chain) => Err(no_runtime_err!(chain).into()),357 RuntimeId::Unknown(chain) => Err(no_runtime_err!(chain).into()),
438 .map(|r| r.0)430 .map(|r| r.0)
439 .map_err(Into::into),431 .map_err(Into::into),
440432
441 #[cfg(feature = "opal-runtime")]
442 RuntimeId::Opal => crate::service::start_node::<433 RuntimeId::Opal => crate::service::start_node::<
443 opal_runtime::Runtime,434 opal_runtime::Runtime,
444 opal_runtime::RuntimeApi,435 opal_runtime::RuntimeApi,
modifiednode/cli/src/service.rsdiffbeforeafterboth
95 }95 }
96}96}
9797
98#[cfg(feature = "opal-runtime")]
99impl NativeExecutionDispatch for OpalRuntimeExecutor {98impl NativeExecutionDispatch for OpalRuntimeExecutor {
100 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;99 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
101100
addednode/rpc/src/lib.rs.expdiffbeforeafterboth

no changes