mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
ChainSpec trait (#5185)
* ChainSpec trait * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Added docs * Fixed build * Fixed build Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -56,7 +56,7 @@ pub struct Extensions {
|
||||
}
|
||||
|
||||
/// Specialized `ChainSpec`.
|
||||
pub type ChainSpec = sc_service::ChainSpec<
|
||||
pub type ChainSpec = sc_service::GenericChainSpec<
|
||||
GenesisConfig,
|
||||
Extensions,
|
||||
>;
|
||||
|
||||
@@ -46,7 +46,7 @@ where
|
||||
cmd.update_config(&mut config, load_spec, &version)?;
|
||||
|
||||
let client = sc_service::new_full_client::<
|
||||
node_runtime::Block, node_runtime::RuntimeApi, node_executor::Executor, _, _,
|
||||
node_runtime::Block, node_runtime::RuntimeApi, node_executor::Executor,
|
||||
>(&config)?;
|
||||
let inspect = node_inspect::Inspector::<node_runtime::Block>::new(client);
|
||||
|
||||
@@ -56,7 +56,7 @@ where
|
||||
cmd.init(&version)?;
|
||||
cmd.update_config(&mut config, load_spec, &version)?;
|
||||
|
||||
cmd.run::<_, _, node_runtime::Block, node_executor::Executor>(config)
|
||||
cmd.run::<node_runtime::Block, node_executor::Executor>(config)
|
||||
},
|
||||
Some(Subcommand::Factory(cli_args)) => {
|
||||
cli_args.shared_params.init(&version)?;
|
||||
@@ -108,7 +108,7 @@ where
|
||||
subcommand.update_config(&mut config, load_spec, &version)?;
|
||||
subcommand.run(
|
||||
config,
|
||||
|config: service::NodeConfiguration| Ok(new_full_start!(config).0),
|
||||
|config: sc_service::Configuration| Ok(new_full_start!(config).0),
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ impl ChainSpec {
|
||||
}
|
||||
}
|
||||
|
||||
fn load_spec(id: &str) -> Result<Option<chain_spec::ChainSpec>, String> {
|
||||
fn load_spec(id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
Ok(match ChainSpec::from(id) {
|
||||
Some(spec) => Some(spec.load()?),
|
||||
None => None,
|
||||
Some(spec) => Box::new(spec.load()?),
|
||||
None => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(id))?),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use sc_client::{self, LongestChain};
|
||||
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider};
|
||||
use node_executor;
|
||||
use node_primitives::Block;
|
||||
use node_runtime::{GenesisConfig, RuntimeApi};
|
||||
use node_runtime::RuntimeApi;
|
||||
use sc_service::{
|
||||
AbstractService, ServiceBuilder, config::Configuration, error::{Error as ServiceError},
|
||||
};
|
||||
@@ -270,11 +270,8 @@ type ConcreteTransactionPool = sc_transaction_pool::BasicPool<
|
||||
ConcreteBlock
|
||||
>;
|
||||
|
||||
/// A specialized configuration object for setting up the node..
|
||||
pub type NodeConfiguration = Configuration<GenesisConfig, crate::chain_spec::Extensions>;
|
||||
|
||||
/// Builds a new service for a full client.
|
||||
pub fn new_full(config: NodeConfiguration)
|
||||
pub fn new_full(config: Configuration)
|
||||
-> Result<
|
||||
Service<
|
||||
ConcreteBlock,
|
||||
@@ -296,7 +293,7 @@ pub fn new_full(config: NodeConfiguration)
|
||||
}
|
||||
|
||||
/// Builds a new service for a light client.
|
||||
pub fn new_light(config: NodeConfiguration)
|
||||
pub fn new_light(config: Configuration)
|
||||
-> Result<impl AbstractService, ServiceError> {
|
||||
type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
|
||||
let inherent_data_providers = InherentDataProviders::new();
|
||||
|
||||
Reference in New Issue
Block a user