mirror of
https://github.com/pezkuwichain/pez-solochain-template.git
synced 2026-04-25 04:27:58 +00:00
Update template triggered by workflow_dispatch
This commit is contained in:
@@ -41,11 +41,6 @@ pub enum Subcommand {
|
||||
#[command(subcommand)]
|
||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||
|
||||
/// Try-runtime has migrated to a standalone CLI
|
||||
/// (<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and
|
||||
/// deprecation notice. It will be removed entirely some time after January 2024.
|
||||
TryRuntime,
|
||||
|
||||
/// Db meta columns information.
|
||||
ChainInfo(sc_cli::ChainInfoCmd),
|
||||
}
|
||||
|
||||
+15
-8
@@ -117,7 +117,9 @@ pub fn run() -> sc_cli::Result<()> {
|
||||
)
|
||||
}
|
||||
|
||||
cmd.run::<sp_runtime::traits::HashingFor<Block>, ()>(config)
|
||||
cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(
|
||||
config.chain_spec,
|
||||
))
|
||||
},
|
||||
BenchmarkCmd::Block(cmd) => {
|
||||
let PartialComponents { client, .. } = service::new_partial(&config)?;
|
||||
@@ -168,12 +170,6 @@ pub fn run() -> sc_cli::Result<()> {
|
||||
}
|
||||
})
|
||||
},
|
||||
#[cfg(feature = "try-runtime")]
|
||||
Some(Subcommand::TryRuntime) => Err(try_runtime_cli::DEPRECATION_NOTICE.into()),
|
||||
#[cfg(not(feature = "try-runtime"))]
|
||||
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
|
||||
You can enable it with `--features try-runtime`."
|
||||
.into()),
|
||||
Some(Subcommand::ChainInfo(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|config| cmd.run::<Block>(&config))
|
||||
@@ -181,7 +177,18 @@ pub fn run() -> sc_cli::Result<()> {
|
||||
None => {
|
||||
let runner = cli.create_runner(&cli.run)?;
|
||||
runner.run_node_until_exit(|config| async move {
|
||||
service::new_full(config).map_err(sc_cli::Error::Service)
|
||||
match config.network.network_backend {
|
||||
sc_network::config::NetworkBackendType::Libp2p => service::new_full::<
|
||||
sc_network::NetworkWorker<
|
||||
solochain_template_runtime::opaque::Block,
|
||||
<solochain_template_runtime::opaque::Block as sp_runtime::traits::Block>::Hash,
|
||||
>,
|
||||
>(config)
|
||||
.map_err(sc_cli::Error::Service),
|
||||
sc_network::config::NetworkBackendType::Litep2p =>
|
||||
service::new_full::<sc_network::Litep2pNetworkBackend>(config)
|
||||
.map_err(sc_cli::Error::Service),
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
+20
-5
@@ -124,7 +124,11 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
|
||||
}
|
||||
|
||||
/// Builds a new service for a full client.
|
||||
pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
pub fn new_full<
|
||||
N: sc_network::NetworkBackend<Block, <Block as sp_runtime::traits::Block>::Hash>,
|
||||
>(
|
||||
config: Configuration,
|
||||
) -> Result<TaskManager, ServiceError> {
|
||||
let sc_service::PartialComponents {
|
||||
client,
|
||||
backend,
|
||||
@@ -136,14 +140,24 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
other: (block_import, grandpa_link, mut telemetry),
|
||||
} = new_partial(&config)?;
|
||||
|
||||
let mut net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);
|
||||
let mut net_config = sc_network::config::FullNetworkConfiguration::<
|
||||
Block,
|
||||
<Block as sp_runtime::traits::Block>::Hash,
|
||||
N,
|
||||
>::new(&config.network);
|
||||
let metrics = N::register_notification_metrics(config.prometheus_registry());
|
||||
|
||||
let peer_store_handle = net_config.peer_store_handle();
|
||||
let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name(
|
||||
&client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
|
||||
&config.chain_spec,
|
||||
);
|
||||
let (grandpa_protocol_config, grandpa_notification_service) =
|
||||
sc_consensus_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone());
|
||||
sc_consensus_grandpa::grandpa_peers_set_config::<_, N>(
|
||||
grandpa_protocol_name.clone(),
|
||||
metrics.clone(),
|
||||
peer_store_handle,
|
||||
);
|
||||
net_config.add_notification_protocol(grandpa_protocol_config);
|
||||
|
||||
let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new(
|
||||
@@ -163,6 +177,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
block_announce_validator_builder: None,
|
||||
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
|
||||
block_relay: None,
|
||||
metrics,
|
||||
})?;
|
||||
|
||||
if config.offchain_worker.enabled {
|
||||
@@ -177,7 +192,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
transaction_pool: Some(OffchainTransactionPoolFactory::new(
|
||||
transaction_pool.clone(),
|
||||
)),
|
||||
network_provider: network.clone(),
|
||||
network_provider: Arc::new(network.clone()),
|
||||
enable_http_requests: true,
|
||||
custom_extensions: |_| vec![],
|
||||
})
|
||||
@@ -205,7 +220,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
};
|
||||
|
||||
let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
network: network.clone(),
|
||||
network: Arc::new(network.clone()),
|
||||
client: client.clone(),
|
||||
keystore: keystore_container.keystore(),
|
||||
task_manager: &mut task_manager,
|
||||
|
||||
Reference in New Issue
Block a user