mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 16:21:02 +00:00
Westend Mark II (#983)
* Initial draft * More work * Build * Docs * Insert westend keys * Add badBlock to fork from old chain * Updated spec to reset westend * Use raw spec * Fix spec format and use westend2 for both id's * Correct public key for bootnode 3 * Build * Extra space * Fix build * Lock * Update lock * Fixes * Fix for he startup text * Bump Co-authored-by: Gav Wood <gavin@parity.io>
This commit is contained in:
@@ -31,9 +31,9 @@ use inherents::InherentDataProviders;
|
||||
use sc_executor::native_executor_instance;
|
||||
use log::info;
|
||||
pub use service::{
|
||||
AbstractService, Role, PruningMode, TransactionPoolOptions, Error, RuntimeGenesis, ServiceBuilderCommand,
|
||||
AbstractService, Role, PruningMode, TransactionPoolOptions, Error, RuntimeGenesis,
|
||||
TFullClient, TLightClient, TFullBackend, TLightBackend, TFullCallExecutor, TLightCallExecutor,
|
||||
Configuration, ChainSpec,
|
||||
Configuration, ChainSpec, ServiceBuilderCommand,
|
||||
};
|
||||
pub use service::config::{DatabaseConfig, PrometheusConfig};
|
||||
pub use sc_executor::NativeExecutionDispatch;
|
||||
@@ -45,12 +45,13 @@ pub use consensus_common::SelectChain;
|
||||
pub use polkadot_primitives::parachain::{CollatorId, ParachainHost};
|
||||
pub use polkadot_primitives::Block;
|
||||
pub use sp_runtime::traits::{Block as BlockT, self as runtime_traits, BlakeTwo256};
|
||||
pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec};
|
||||
pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec};
|
||||
#[cfg(not(target_os = "unknown"))]
|
||||
pub use consensus::run_validation_worker;
|
||||
pub use codec::Codec;
|
||||
pub use polkadot_runtime;
|
||||
pub use kusama_runtime;
|
||||
pub use westend_runtime;
|
||||
use prometheus_endpoint::Registry;
|
||||
|
||||
native_executor_instance!(
|
||||
@@ -67,6 +68,13 @@ native_executor_instance!(
|
||||
frame_benchmarking::benchmarking::HostFunctions,
|
||||
);
|
||||
|
||||
native_executor_instance!(
|
||||
pub WestendExecutor,
|
||||
westend_runtime::api::dispatch,
|
||||
westend_runtime::native_version,
|
||||
frame_benchmarking::benchmarking::HostFunctions,
|
||||
);
|
||||
|
||||
/// A set of APIs that polkadot-like runtimes must implement.
|
||||
pub trait RuntimeApiCollection<Extrinsic: codec::Codec + Send + Sync + 'static> :
|
||||
sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
|
||||
@@ -108,15 +116,21 @@ pub trait RuntimeExtrinsic: codec::Codec + Send + Sync + 'static {}
|
||||
impl<E> RuntimeExtrinsic for E where E: codec::Codec + Send + Sync + 'static {}
|
||||
|
||||
/// Can be called for a `Configuration` to check if it is a configuration for the `Kusama` network.
|
||||
pub trait IsKusama {
|
||||
pub trait IdentifyVariant {
|
||||
/// Returns if this is a configuration for the `Kusama` network.
|
||||
fn is_kusama(&self) -> bool;
|
||||
|
||||
/// Returns if this is a configuration for the `Westend` network.
|
||||
fn is_westend(&self) -> bool;
|
||||
}
|
||||
|
||||
impl IsKusama for Box<dyn ChainSpec> {
|
||||
impl IdentifyVariant for Box<dyn ChainSpec> {
|
||||
fn is_kusama(&self) -> bool {
|
||||
self.id().starts_with("kusama") || self.id().starts_with("ksm")
|
||||
}
|
||||
fn is_westend(&self) -> bool {
|
||||
self.id().starts_with("westend") || self.id().starts_with("wnd")
|
||||
}
|
||||
}
|
||||
|
||||
// If we're using prometheus, use a registry with a prefix of `polkadot`.
|
||||
@@ -272,6 +286,37 @@ pub fn kusama_new_full(
|
||||
)
|
||||
}
|
||||
|
||||
/// Create a new Kusama service for a full node.
|
||||
#[cfg(feature = "full-node")]
|
||||
pub fn westend_new_full(
|
||||
config: Configuration,
|
||||
collating_for: Option<(CollatorId, parachain::Id)>,
|
||||
max_block_data_size: Option<u64>,
|
||||
authority_discovery_enabled: bool,
|
||||
slot_duration: u64,
|
||||
grandpa_pause: Option<(u32, u32)>,
|
||||
)
|
||||
-> Result<(
|
||||
impl AbstractService<
|
||||
Block = Block,
|
||||
RuntimeApi = westend_runtime::RuntimeApi,
|
||||
Backend = TFullBackend<Block>,
|
||||
SelectChain = LongestChain<TFullBackend<Block>, Block>,
|
||||
CallExecutor = TFullCallExecutor<Block, KusamaExecutor>,
|
||||
>,
|
||||
FullNodeHandles,
|
||||
), ServiceError>
|
||||
{
|
||||
new_full(
|
||||
config,
|
||||
collating_for,
|
||||
max_block_data_size,
|
||||
authority_discovery_enabled,
|
||||
slot_duration,
|
||||
grandpa_pause,
|
||||
)
|
||||
}
|
||||
|
||||
/// Handles to other sub-services that full nodes instantiate, which consumers
|
||||
/// of the node may use.
|
||||
#[cfg(feature = "full-node")]
|
||||
@@ -576,6 +621,21 @@ pub fn kusama_new_light(
|
||||
new_light(config)
|
||||
}
|
||||
|
||||
/// Create a new Westend service for a light client.
|
||||
pub fn westend_new_light(
|
||||
config: Configuration,
|
||||
)
|
||||
-> Result<impl AbstractService<
|
||||
Block = Block,
|
||||
RuntimeApi = westend_runtime::RuntimeApi,
|
||||
Backend = TLightBackend<Block>,
|
||||
SelectChain = LongestChain<TLightBackend<Block>, Block>,
|
||||
CallExecutor = TLightCallExecutor<Block, KusamaExecutor>,
|
||||
>, ServiceError>
|
||||
{
|
||||
new_light(config)
|
||||
}
|
||||
|
||||
// We can't use service::TLightClient due to
|
||||
// Rust bug: https://github.com/rust-lang/rust/issues/43580
|
||||
type TLocalLightClient<Runtime, Dispatch> = Client<
|
||||
|
||||
Reference in New Issue
Block a user