update dependencies (#1229)

This commit is contained in:
Antonio Dropulic
2021-11-30 14:43:43 +01:00
committed by Bastian Köcher
parent 26c5a35d7a
commit 7b30098a12
18 changed files with 60 additions and 211 deletions
@@ -186,7 +186,6 @@ fn testnet_genesis(
GenesisConfig { GenesisConfig {
system: SystemConfig { system: SystemConfig {
code: WASM_BINARY.expect("Millau development WASM not available").to_vec(), code: WASM_BINARY.expect("Millau development WASM not available").to_vec(),
changes_trie_config: Default::default(),
}, },
balances: BalancesConfig { balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(), balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(),
+3 -7
View File
@@ -20,7 +20,7 @@ use crate::{
service::new_partial, service::new_partial,
}; };
use millau_runtime::{Block, RuntimeApi}; use millau_runtime::{Block, RuntimeApi};
use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli}; use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents; use sc_service::PartialComponents;
impl SubstrateCli for Cli { impl SubstrateCli for Cli {
@@ -72,7 +72,7 @@ impl SubstrateCli for Cli {
pub fn run() -> sc_cli::Result<()> { pub fn run() -> sc_cli::Result<()> {
let cli = Cli::from_args(); let cli = Cli::from_args();
// make sure to set correct crypto version. // make sure to set correct crypto version.
sp_core::crypto::set_default_ss58_version(sp_core::crypto::Ss58AddressFormat::Custom( sp_core::crypto::set_default_ss58_version(sp_core::crypto::Ss58AddressFormat::custom(
millau_runtime::SS58Prefix::get() as u16, millau_runtime::SS58Prefix::get() as u16,
)); ));
@@ -146,11 +146,7 @@ pub fn run() -> sc_cli::Result<()> {
None => { None => {
let runner = cli.create_runner(&cli.run)?; let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move { runner.run_node_until_exit(|config| async move {
match config.role { service::new_full(config).map_err(sc_cli::Error::Service)
Role::Light => service::new_light(config),
_ => service::new_full(config),
}
.map_err(sc_cli::Error::Service)
}) })
}, },
} }
+24 -162
View File
@@ -29,10 +29,10 @@
// ===================================================================================== // =====================================================================================
use millau_runtime::{self, opaque::Block, RuntimeApi}; use millau_runtime::{self, opaque::Block, RuntimeApi};
use sc_client_api::{ExecutorProvider, RemoteBackend}; use sc_client_api::ExecutorProvider;
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
pub use sc_executor::NativeElseWasmExecutor; pub use sc_executor::NativeElseWasmExecutor;
use sc_finality_grandpa::SharedVoterState;
use sc_keystore::LocalKeystore; use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager}; use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker}; use sc_telemetry::{Telemetry, TelemetryWorker};
@@ -40,13 +40,16 @@ use sp_consensus::SlotData;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
type Executor = NativeElseWasmExecutor<ExecutorDispatch>;
// Our native executor instance. // Our native executor instance.
pub struct ExecutorDispatch; pub struct ExecutorDispatch;
impl sc_executor::NativeExecutionDispatch for ExecutorDispatch { impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
/// Only enable the benchmarking host functions when we actually want to benchmark.
#[cfg(feature = "runtime-benchmarks")]
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
/// Otherwise we only use the default Substrate host functions.
#[cfg(not(feature = "runtime-benchmarks"))]
type ExtendHostFunctions = ();
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> { fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
millau_runtime::api::dispatch(method, data) millau_runtime::api::dispatch(method, data)
@@ -62,7 +65,6 @@ type FullClient =
type FullBackend = sc_service::TFullBackend<Block>; type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>; type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
#[allow(clippy::type_complexity)]
pub fn new_partial( pub fn new_partial(
config: &Configuration, config: &Configuration,
) -> Result< ) -> Result<
@@ -86,7 +88,7 @@ pub fn new_partial(
ServiceError, ServiceError,
> { > {
if config.keystore_remote.is_some() { if config.keystore_remote.is_some() {
return Err(ServiceError::Other("Remote Keystores are not supported.".to_string())) return Err(ServiceError::Other(format!("Remote Keystores are not supported.")))
} }
let telemetry = config let telemetry = config
@@ -107,15 +109,15 @@ pub fn new_partial(
); );
let (client, backend, keystore_container, task_manager) = let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, Executor>( sc_service::new_full_parts::<Block, RuntimeApi, _>(
config, &config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor, executor,
)?; )?;
let client = Arc::new(client); let client = Arc::new(client);
let telemetry = telemetry.map(|(worker, telemetry)| { let telemetry = telemetry.map(|(worker, telemetry)| {
task_manager.spawn_handle().spawn("telemetry", worker.run()); task_manager.spawn_handle().spawn("telemetry", None, worker.run());
telemetry telemetry
}); });
@@ -175,7 +177,7 @@ pub fn new_partial(
}) })
} }
fn remote_keystore(_url: &str) -> Result<Arc<LocalKeystore>, &'static str> { fn remote_keystore(_url: &String) -> Result<Arc<LocalKeystore>, &'static str> {
// FIXME: here would the concrete keystore be built, // FIXME: here would the concrete keystore be built,
// must return a concrete type (NOT `LocalKeystore`) that // must return a concrete type (NOT `LocalKeystore`) that
// implements `CryptoStore` and `SyncCryptoStore` // implements `CryptoStore` and `SyncCryptoStore`
@@ -210,7 +212,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new( let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
backend.clone(), backend.clone(),
grandpa_link.shared_authority_set().clone(), grandpa_link.shared_authority_set().clone(),
vec![], Vec::default(),
)); ));
let (network, system_rpc_tx, network_starter) = let (network, system_rpc_tx, network_starter) =
@@ -220,7 +222,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
transaction_pool: transaction_pool.clone(), transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(), spawn_handle: task_manager.spawn_handle(),
import_queue, import_queue,
on_demand: None,
block_announce_validator_builder: None, block_announce_validator_builder: None,
warp_sync: Some(warp_sync), warp_sync: Some(warp_sync),
})?; })?;
@@ -240,7 +241,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
let name = config.network.node_name.clone(); let name = config.network.node_name.clone();
let enable_grandpa = !config.disable_grandpa; let enable_grandpa = !config.disable_grandpa;
let prometheus_registry = config.prometheus_registry().cloned(); let prometheus_registry = config.prometheus_registry().cloned();
let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty(); let shared_voter_state = SharedVoterState::empty();
let rpc_extensions_builder = { let rpc_extensions_builder = {
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider; use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
@@ -291,8 +292,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
task_manager: &mut task_manager, task_manager: &mut task_manager,
transaction_pool: transaction_pool.clone(), transaction_pool: transaction_pool.clone(),
rpc_extensions_builder, rpc_extensions_builder,
on_demand: None,
remote_blockchain: None,
backend, backend,
system_rpc_tx, system_rpc_tx,
config, config,
@@ -317,17 +316,18 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _, _, _>( let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _, _, _>(
StartAuraParams { StartAuraParams {
slot_duration, slot_duration,
client, client: client.clone(),
select_chain, select_chain,
block_import, block_import,
proposer_factory, proposer_factory,
create_inherent_data_providers: move |_, ()| async move { create_inherent_data_providers: move |_, ()| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration( let slot =
*timestamp, sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
raw_slot_duration, *timestamp,
); raw_slot_duration,
);
Ok((timestamp, slot)) Ok((timestamp, slot))
}, },
@@ -345,7 +345,9 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
// the AURA authoring task is considered essential, i.e. if it // the AURA authoring task is considered essential, i.e. if it
// fails we take down the service with it. // fails we take down the service with it.
task_manager.spawn_essential_handle().spawn_blocking("aura", aura); task_manager
.spawn_essential_handle()
.spawn_blocking("aura", Some("block-authoring"), aura);
} }
// if the node isn't actively participating in consensus then it doesn't // if the node isn't actively participating in consensus then it doesn't
@@ -385,6 +387,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
// if it fails we take down the service with it. // if it fails we take down the service with it.
task_manager.spawn_essential_handle().spawn_blocking( task_manager.spawn_essential_handle().spawn_blocking(
"grandpa-voter", "grandpa-voter",
None,
sc_finality_grandpa::run_grandpa_voter(grandpa_config)?, sc_finality_grandpa::run_grandpa_voter(grandpa_config)?,
); );
} }
@@ -392,144 +395,3 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
network_starter.start_network(); network_starter.start_network();
Ok(task_manager) Ok(task_manager)
} }
/// Builds a new service for a light client.
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let telemetry = config
.telemetry_endpoints
.clone()
.filter(|x| !x.is_empty())
.map(|endpoints| -> Result<_, sc_telemetry::Error> {
let worker = TelemetryWorker::new(16)?;
let telemetry = worker.handle().new_telemetry(endpoints);
Ok((worker, telemetry))
})
.transpose()?;
let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
);
let (client, backend, keystore_container, mut task_manager, on_demand) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(
&config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;
let mut telemetry = telemetry.map(|(worker, telemetry)| {
task_manager.spawn_handle().spawn("telemetry", worker.run());
telemetry
});
config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config());
let select_chain = sc_consensus::LongestChain::new(backend.clone());
let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(
config.transaction_pool.clone(),
config.prometheus_registry(),
task_manager.spawn_essential_handle(),
client.clone(),
on_demand.clone(),
));
let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
client.clone(),
&(client.clone() as Arc<_>),
select_chain,
telemetry.as_ref().map(|x| x.handle()),
)?;
let slot_duration = sc_consensus_aura::slot_duration(&*client)?.slot_duration();
let import_queue =
sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(ImportQueueParams {
block_import: grandpa_block_import.clone(),
justification_import: Some(Box::new(grandpa_block_import)),
client: client.clone(),
create_inherent_data_providers: move |_, ()| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
let slot =
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
*timestamp,
slot_duration,
);
Ok((timestamp, slot))
},
spawner: &task_manager.spawn_essential_handle(),
can_author_with: sp_consensus::NeverCanAuthor,
registry: config.prometheus_registry(),
check_for_equivocation: Default::default(),
telemetry: telemetry.as_ref().map(|x| x.handle()),
})?;
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
vec![],
));
let (network, system_rpc_tx, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue,
on_demand: Some(on_demand.clone()),
block_announce_validator_builder: None,
warp_sync: Some(warp_sync),
})?;
if config.offchain_worker.enabled {
sc_service::build_offchain_workers(
&config,
task_manager.spawn_handle(),
client.clone(),
network.clone(),
);
}
let enable_grandpa = !config.disable_grandpa;
if enable_grandpa {
let name = config.network.node_name.clone();
let config = sc_finality_grandpa::Config {
gossip_duration: std::time::Duration::from_millis(333),
justification_period: 512,
name: Some(name),
observer_enabled: false,
keystore: None,
local_role: config.role.clone(),
telemetry: telemetry.as_ref().map(|x| x.handle()),
};
task_manager.spawn_handle().spawn_blocking(
"grandpa-observer",
sc_finality_grandpa::run_grandpa_observer(config, grandpa_link, network.clone())?,
);
}
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
remote_blockchain: Some(backend.remote_blockchain()),
transaction_pool,
task_manager: &mut task_manager,
on_demand: Some(on_demand),
rpc_extensions_builder: Box::new(|_, _| Ok(())),
config,
client,
keystore: keystore_container.sync_keystore(),
backend,
network,
system_rpc_tx,
telemetry: telemetry.as_mut(),
})?;
network_starter.start_network();
Ok(task_manager)
}
-3
View File
@@ -100,9 +100,6 @@ pub type Hash = bp_millau::Hash;
/// Hashing algorithm used by the chain. /// Hashing algorithm used by the chain.
pub type Hashing = bp_millau::Hasher; pub type Hashing = bp_millau::Hasher;
/// Digest item type.
pub type DigestItem = generic::DigestItem<Hash>;
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats /// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades /// of data like extrinsics, allowing for them to continue syncing the network through upgrades
@@ -151,7 +151,6 @@ fn testnet_genesis(
code: rialto_parachain_runtime::WASM_BINARY code: rialto_parachain_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!") .expect("WASM binary was not build, please build it!")
.to_vec(), .to_vec(),
changes_trie_config: Default::default(),
}, },
balances: rialto_parachain_runtime::BalancesConfig { balances: rialto_parachain_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
@@ -103,6 +103,9 @@ pub struct Cli {
#[structopt(subcommand)] #[structopt(subcommand)]
pub subcommand: Option<Subcommand>, pub subcommand: Option<Subcommand>,
#[structopt(long)]
pub parachain_id: Option<u32>,
#[structopt(flatten)] #[structopt(flatten)]
pub run: cumulus_client_cli::RunCmd, pub run: cumulus_client_cli::RunCmd,
@@ -77,7 +77,7 @@ impl SubstrateCli for Cli {
} }
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> { fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
load_spec(id, self.run.parachain_id.unwrap_or(2000).into()) load_spec(id, self.parachain_id.unwrap_or(2000).into())
} }
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion { fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
@@ -153,7 +153,7 @@ macro_rules! construct_async_run {
/// Parse command line arguments into service configuration. /// Parse command line arguments into service configuration.
pub fn run() -> Result<()> { pub fn run() -> Result<()> {
let cli = Cli::from_args(); let cli = Cli::from_args();
sp_core::crypto::set_default_ss58_version(sp_core::crypto::Ss58AddressFormat::Custom( sp_core::crypto::set_default_ss58_version(sp_core::crypto::Ss58AddressFormat::custom(
rialto_parachain_runtime::SS58Prefix::get() as u16, rialto_parachain_runtime::SS58Prefix::get() as u16,
)); ));
@@ -273,7 +273,7 @@ pub fn run() -> Result<()> {
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()), [RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
); );
let id = ParaId::from(cli.run.parachain_id.or(para_id).expect("Missing ParaId")); let id = ParaId::from(cli.parachain_id.or(para_id).expect("Missing ParaId"));
let parachain_account = let parachain_account =
AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id); AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);
@@ -147,7 +147,7 @@ where
let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle()); let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle());
let telemetry = telemetry.map(|(worker, telemetry)| { let telemetry = telemetry.map(|(worker, telemetry)| {
task_manager.spawn_handle().spawn("telemetry", worker.run()); task_manager.spawn_handle().spawn("telemetry", None, worker.run());
telemetry telemetry
}); });
@@ -283,7 +283,6 @@ where
transaction_pool: transaction_pool.clone(), transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(), spawn_handle: task_manager.spawn_handle(),
import_queue: import_queue.clone(), import_queue: import_queue.clone(),
on_demand: None,
block_announce_validator_builder: Some(Box::new(|_| block_announce_validator)), block_announce_validator_builder: Some(Box::new(|_| block_announce_validator)),
warp_sync: None, warp_sync: None,
})?; })?;
@@ -292,8 +291,6 @@ where
let rpc_extensions_builder = Box::new(move |_, _| Ok(rpc_ext_builder(rpc_client.clone()))); let rpc_extensions_builder = Box::new(move |_, _| Ok(rpc_ext_builder(rpc_client.clone())));
sc_service::spawn_tasks(sc_service::SpawnTasksParams { sc_service::spawn_tasks(sc_service::SpawnTasksParams {
on_demand: None,
remote_blockchain: None,
rpc_extensions_builder, rpc_extensions_builder,
client: client.clone(), client: client.clone(),
transaction_pool: transaction_pool.clone(), transaction_pool: transaction_pool.clone(),
-1
View File
@@ -88,7 +88,6 @@ polkadot-node-core-bitfield-signing = { git = "https://github.com/paritytech/pol
polkadot-node-core-candidate-validation = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-core-candidate-validation = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-core-chain-api = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-core-chain-api = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-core-chain-selection = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-core-chain-selection = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-core-dispute-participation = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-core-parachains-inherent = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-core-parachains-inherent = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-core-provisioner = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-core-provisioner = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" }
@@ -207,7 +207,6 @@ fn testnet_genesis(
GenesisConfig { GenesisConfig {
system: SystemConfig { system: SystemConfig {
code: WASM_BINARY.expect("Rialto development WASM not available").to_vec(), code: WASM_BINARY.expect("Rialto development WASM not available").to_vec(),
changes_trie_config: Default::default(),
}, },
balances: BalancesConfig { balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(), balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(),
+1 -1
View File
@@ -70,7 +70,7 @@ impl SubstrateCli for Cli {
/// Parse and run command line arguments /// Parse and run command line arguments
pub fn run() -> sc_cli::Result<()> { pub fn run() -> sc_cli::Result<()> {
let cli = Cli::from_args(); let cli = Cli::from_args();
sp_core::crypto::set_default_ss58_version(sp_core::crypto::Ss58AddressFormat::Custom( sp_core::crypto::set_default_ss58_version(sp_core::crypto::Ss58AddressFormat::custom(
rialto_runtime::SS58Prefix::get() as u16, rialto_runtime::SS58Prefix::get() as u16,
)); ));
+1 -4
View File
@@ -63,8 +63,7 @@ pub use polkadot_node_core_candidate_validation::CandidateValidationSubsystem;
pub use polkadot_node_core_chain_api::ChainApiSubsystem; pub use polkadot_node_core_chain_api::ChainApiSubsystem;
pub use polkadot_node_core_chain_selection::ChainSelectionSubsystem; pub use polkadot_node_core_chain_selection::ChainSelectionSubsystem;
pub use polkadot_node_core_dispute_coordinator::DisputeCoordinatorSubsystem; pub use polkadot_node_core_dispute_coordinator::DisputeCoordinatorSubsystem;
pub use polkadot_node_core_dispute_participation::DisputeParticipationSubsystem; pub use polkadot_node_core_provisioner::ProvisionerSubsystem;
pub use polkadot_node_core_provisioner::ProvisioningSubsystem as ProvisionerSubsystem;
pub use polkadot_node_core_runtime_api::RuntimeApiSubsystem; pub use polkadot_node_core_runtime_api::RuntimeApiSubsystem;
pub use polkadot_statement_distribution::StatementDistribution as StatementDistributionSubsystem; pub use polkadot_statement_distribution::StatementDistribution as StatementDistributionSubsystem;
@@ -160,7 +159,6 @@ pub fn prepared_overseer_builder<Spawner, RuntimeClient>(
ApprovalVotingSubsystem, ApprovalVotingSubsystem,
GossipSupportSubsystem<AuthorityDiscoveryService>, GossipSupportSubsystem<AuthorityDiscoveryService>,
DisputeCoordinatorSubsystem, DisputeCoordinatorSubsystem,
DisputeParticipationSubsystem,
DisputeDistributionSubsystem<AuthorityDiscoveryService>, DisputeDistributionSubsystem<AuthorityDiscoveryService>,
ChainSelectionSubsystem, ChainSelectionSubsystem,
>, >,
@@ -249,7 +247,6 @@ where
keystore.clone(), keystore.clone(),
Metrics::register(registry)?, Metrics::register(registry)?,
)) ))
.dispute_participation(DisputeParticipationSubsystem::new())
.dispute_distribution(DisputeDistributionSubsystem::new( .dispute_distribution(DisputeDistributionSubsystem::new(
keystore, keystore,
dispute_req_receiver, dispute_req_receiver,
+7 -6
View File
@@ -226,7 +226,7 @@ where
let client = Arc::new(client); let client = Arc::new(client);
let telemetry = telemetry.map(|(worker, telemetry)| { let telemetry = telemetry.map(|(worker, telemetry)| {
task_manager.spawn_handle().spawn("telemetry", worker.run()); task_manager.spawn_handle().spawn("telemetry", None, worker.run());
telemetry telemetry
}); });
@@ -474,7 +474,6 @@ where
transaction_pool: transaction_pool.clone(), transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(), spawn_handle: task_manager.spawn_handle(),
import_queue, import_queue,
on_demand: None,
block_announce_validator_builder: None, block_announce_validator_builder: None,
warp_sync: Some(warp_sync), warp_sync: Some(warp_sync),
})?; })?;
@@ -533,8 +532,6 @@ where
rpc_extensions_builder: Box::new(rpc_extensions_builder), rpc_extensions_builder: Box::new(rpc_extensions_builder),
transaction_pool: transaction_pool.clone(), transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager, task_manager: &mut task_manager,
on_demand: None,
remote_blockchain: None,
system_rpc_tx, system_rpc_tx,
telemetry: telemetry.as_mut(), telemetry: telemetry.as_mut(),
})?; })?;
@@ -574,7 +571,9 @@ where
prometheus_registry.clone(), prometheus_registry.clone(),
); );
task_manager.spawn_handle().spawn("authority-discovery-worker", worker.run()); task_manager
.spawn_handle()
.spawn("authority-discovery-worker", None, worker.run());
Some(service) Some(service)
} else { } else {
None None
@@ -619,6 +618,7 @@ where
let handle = handle.clone(); let handle = handle.clone();
task_manager.spawn_essential_handle().spawn_blocking( task_manager.spawn_essential_handle().spawn_blocking(
"overseer", "overseer",
None,
Box::pin(async move { Box::pin(async move {
use futures::{pin_mut, select, FutureExt}; use futures::{pin_mut, select, FutureExt};
@@ -705,7 +705,7 @@ where
}; };
let babe = sc_consensus_babe::start_babe(babe_config)?; let babe = sc_consensus_babe::start_babe(babe_config)?;
task_manager.spawn_essential_handle().spawn_blocking("babe", babe); task_manager.spawn_essential_handle().spawn_blocking("babe", None, babe);
} }
// if the node isn't actively participating in consensus then it doesn't // if the node isn't actively participating in consensus then it doesn't
@@ -751,6 +751,7 @@ where
task_manager.spawn_essential_handle().spawn_blocking( task_manager.spawn_essential_handle().spawn_blocking(
"grandpa-voter", "grandpa-voter",
None,
sc_finality_grandpa::run_grandpa_voter(grandpa_config)?, sc_finality_grandpa::run_grandpa_voter(grandpa_config)?,
); );
} }
+7 -3
View File
@@ -101,9 +101,6 @@ pub type Hash = bp_rialto::Hash;
/// Hashing algorithm used by the chain. /// Hashing algorithm used by the chain.
pub type Hashing = bp_rialto::Hasher; pub type Hashing = bp_rialto::Hasher;
/// Digest item type.
pub type DigestItem = generic::DigestItem<Hash>;
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats /// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades /// of data like extrinsics, allowing for them to continue syncing the network through upgrades
@@ -675,6 +672,13 @@ impl_runtime_apis! {
polkadot_runtime_parachains::runtime_api_impl::v1::persisted_validation_data::<Runtime>(para_id, assumption) polkadot_runtime_parachains::runtime_api_impl::v1::persisted_validation_data::<Runtime>(para_id, assumption)
} }
fn assumed_validation_data(
para_id: polkadot_primitives::v1::Id,
expected_persisted_validation_data_hash: Hash,
) -> Option<(polkadot_primitives::v1::PersistedValidationData<Hash, BlockNumber>, polkadot_primitives::v1::ValidationCodeHash)> {
polkadot_runtime_parachains::runtime_api_impl::v1::assumed_validation_data::<Runtime>(para_id, expected_persisted_validation_data_hash)
}
fn check_validation_outputs( fn check_validation_outputs(
para_id: polkadot_primitives::v1::Id, para_id: polkadot_primitives::v1::Id,
outputs: polkadot_primitives::v1::CandidateCommitments, outputs: polkadot_primitives::v1::CandidateCommitments,
+3 -1
View File
@@ -71,7 +71,9 @@ impl parachains_paras::Config for Runtime {
type WeightInfo = parachains_paras::TestWeightInfo; type WeightInfo = parachains_paras::TestWeightInfo;
} }
impl parachains_paras_inherent::Config for Runtime {} impl parachains_paras_inherent::Config for Runtime {
type WeightInfo = parachains_paras_inherent::TestWeightInfo;
}
impl parachains_scheduler::Config for Runtime {} impl parachains_scheduler::Config for Runtime {}
+5 -11
View File
@@ -620,9 +620,7 @@ pub fn initialize_for_benchmarks<T: Config<I>, I: 'static>(header: BridgedHeader
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::mock::{ use crate::mock::{run_test, test_header, Origin, TestHeader, TestNumber, TestRuntime};
run_test, test_header, Origin, TestHash, TestHeader, TestNumber, TestRuntime,
};
use bp_test_utils::{ use bp_test_utils::{
authority_list, make_default_justification, make_justification_for_header, authority_list, make_default_justification, make_justification_for_header,
JustificationGeneratorParams, ALICE, BOB, JustificationGeneratorParams, ALICE, BOB,
@@ -672,19 +670,17 @@ mod tests {
let _ = Pallet::<TestRuntime>::on_initialize(current_number); let _ = Pallet::<TestRuntime>::on_initialize(current_number);
} }
fn change_log(delay: u64) -> Digest<TestHash> { fn change_log(delay: u64) -> Digest {
let consensus_log = let consensus_log =
ConsensusLog::<TestNumber>::ScheduledChange(sp_finality_grandpa::ScheduledChange { ConsensusLog::<TestNumber>::ScheduledChange(sp_finality_grandpa::ScheduledChange {
next_authorities: vec![(ALICE.into(), 1), (BOB.into(), 1)], next_authorities: vec![(ALICE.into(), 1), (BOB.into(), 1)],
delay, delay,
}); });
Digest::<TestHash> { Digest { logs: vec![DigestItem::Consensus(GRANDPA_ENGINE_ID, consensus_log.encode())] }
logs: vec![DigestItem::Consensus(GRANDPA_ENGINE_ID, consensus_log.encode())],
}
} }
fn forced_change_log(delay: u64) -> Digest<TestHash> { fn forced_change_log(delay: u64) -> Digest {
let consensus_log = ConsensusLog::<TestNumber>::ForcedChange( let consensus_log = ConsensusLog::<TestNumber>::ForcedChange(
delay, delay,
sp_finality_grandpa::ScheduledChange { sp_finality_grandpa::ScheduledChange {
@@ -693,9 +689,7 @@ mod tests {
}, },
); );
Digest::<TestHash> { Digest { logs: vec![DigestItem::Consensus(GRANDPA_ENGINE_ID, consensus_log.encode())] }
logs: vec![DigestItem::Consensus(GRANDPA_ENGINE_ID, consensus_log.encode())],
}
} }
#[test] #[test]
-1
View File
@@ -29,7 +29,6 @@ use sp_runtime::{
pub type AccountId = u64; pub type AccountId = u64;
pub type TestHeader = crate::BridgedHeader<TestRuntime, ()>; pub type TestHeader = crate::BridgedHeader<TestRuntime, ()>;
pub type TestNumber = crate::BridgedBlockNumber<TestRuntime, ()>; pub type TestNumber = crate::BridgedBlockNumber<TestRuntime, ()>;
pub type TestHash = crate::BridgedBlockHash<TestRuntime, ()>;
type Block = frame_system::mocking::MockBlock<TestRuntime>; type Block = frame_system::mocking::MockBlock<TestRuntime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
@@ -401,7 +401,8 @@ impl SwapTokens {
.await?; .await?;
if token_swap_state != None { if token_swap_state != None {
return Err(anyhow::format_err!( return Err(anyhow::format_err!(
"Confirmed token swap state has been changed to {:?} unexpectedly" "Confirmed token swap state has been changed to {:?} unexpectedly",
token_swap_state
)) ))
} }
} else { } else {