Update Substrate & Polkadot (#540)

This commit is contained in:
Bastian Köcher
2021-07-20 16:11:56 +02:00
committed by GitHub
parent 3086b319de
commit 8d21ce602c
18 changed files with 680 additions and 532 deletions
+621 -474
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -33,7 +33,7 @@ use polkadot_node_primitives::{
BlockData, Collation, CollationGenerationConfig, CollationResult, PoV, BlockData, Collation, CollationGenerationConfig, CollationResult, PoV,
}; };
use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProtocolMessage}; use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProtocolMessage};
use polkadot_overseer::OverseerHandler; use polkadot_overseer::Handle as OverseerHandle;
use polkadot_primitives::v1::{CollatorPair, Hash as PHash, HeadData, Id as ParaId}; use polkadot_primitives::v1::{CollatorPair, Hash as PHash, HeadData, Id as ParaId};
use codec::{Decode, Encode}; use codec::{Decode, Encode};
@@ -275,7 +275,7 @@ pub struct StartCollatorParams<Block: BlockT, RA, BS, Spawner> {
pub runtime_api: Arc<RA>, pub runtime_api: Arc<RA>,
pub block_status: Arc<BS>, pub block_status: Arc<BS>,
pub announce_block: Arc<dyn Fn(Block::Hash, Option<Vec<u8>>) + Send + Sync>, pub announce_block: Arc<dyn Fn(Block::Hash, Option<Vec<u8>>) + Send + Sync>,
pub overseer_handler: OverseerHandler, pub overseer_handle: OverseerHandle,
pub spawner: Spawner, pub spawner: Spawner,
pub key: CollatorPair, pub key: CollatorPair,
pub parachain_consensus: Box<dyn ParachainConsensus<Block>>, pub parachain_consensus: Box<dyn ParachainConsensus<Block>>,
@@ -287,7 +287,7 @@ pub async fn start_collator<Block, RA, BS, Spawner>(
para_id, para_id,
block_status, block_status,
announce_block, announce_block,
mut overseer_handler, mut overseer_handle,
spawner, spawner,
key, key,
parachain_consensus, parachain_consensus,
@@ -321,14 +321,14 @@ pub async fn start_collator<Block, RA, BS, Spawner>(
}), }),
}; };
overseer_handler overseer_handle
.send_msg( .send_msg(
CollationGenerationMessage::Initialize(config), CollationGenerationMessage::Initialize(config),
"StartCollator", "StartCollator",
) )
.await; .await;
overseer_handler overseer_handle
.send_msg(CollatorProtocolMessage::CollateOn(para_id), "StartCollator") .send_msg(CollatorProtocolMessage::CollateOn(para_id), "StartCollator")
.await; .await;
} }
@@ -420,7 +420,7 @@ mod tests {
runtime_api: client.clone(), runtime_api: client.clone(),
block_status: client.clone(), block_status: client.clone(),
announce_block: Arc::new(announce_block), announce_block: Arc::new(announce_block),
overseer_handler: handler, overseer_handle: handler,
spawner, spawner,
para_id, para_id,
key: CollatorPair::generate().0, key: CollatorPair::generate().0,
@@ -18,7 +18,7 @@ use sp_runtime::traits::Block as BlockT;
use polkadot_node_primitives::AvailableData; use polkadot_node_primitives::AvailableData;
use polkadot_node_subsystem::messages::AvailabilityRecoveryMessage; use polkadot_node_subsystem::messages::AvailabilityRecoveryMessage;
use polkadot_overseer::OverseerHandler; use polkadot_overseer::Handle as OverseerHandle;
use futures::{channel::oneshot, stream::FuturesUnordered, Future, FutureExt, StreamExt}; use futures::{channel::oneshot, stream::FuturesUnordered, Future, FutureExt, StreamExt};
@@ -34,15 +34,15 @@ pub(crate) struct ActiveCandidateRecovery<Block: BlockT> {
>, >,
/// The block hashes of the candidates currently being recovered. /// The block hashes of the candidates currently being recovered.
candidates: HashSet<Block::Hash>, candidates: HashSet<Block::Hash>,
overseer_handler: OverseerHandler, overseer_handle: OverseerHandle,
} }
impl<Block: BlockT> ActiveCandidateRecovery<Block> { impl<Block: BlockT> ActiveCandidateRecovery<Block> {
pub fn new(overseer_handler: OverseerHandler) -> Self { pub fn new(overseer_handle: OverseerHandle) -> Self {
Self { Self {
recoveries: Default::default(), recoveries: Default::default(),
candidates: Default::default(), candidates: Default::default(),
overseer_handler, overseer_handle,
} }
} }
@@ -54,7 +54,7 @@ impl<Block: BlockT> ActiveCandidateRecovery<Block> {
) { ) {
let (tx, rx) = oneshot::channel(); let (tx, rx) = oneshot::channel();
self.overseer_handler self.overseer_handle
.send_msg( .send_msg(
AvailabilityRecoveryMessage::RecoverAvailableData( AvailabilityRecoveryMessage::RecoverAvailableData(
pending_candidate.receipt, pending_candidate.receipt,
+4 -3
View File
@@ -54,7 +54,7 @@ use sp_runtime::{
}; };
use polkadot_node_primitives::{AvailableData, POV_BOMB_LIMIT}; use polkadot_node_primitives::{AvailableData, POV_BOMB_LIMIT};
use polkadot_overseer::OverseerHandler; use polkadot_overseer::Handle as OverseerHandle;
use polkadot_primitives::v1::{ use polkadot_primitives::v1::{
Block as PBlock, CandidateReceipt, CommittedCandidateReceipt, Id as ParaId, ParachainHost, Block as PBlock, CandidateReceipt, CommittedCandidateReceipt, Id as ParaId, ParachainHost,
SessionIndex, SessionIndex,
@@ -117,7 +117,7 @@ where
{ {
/// Create a new instance. /// Create a new instance.
pub fn new( pub fn new(
overseer_handler: OverseerHandler, overseer_handle: OverseerHandle,
relay_chain_slot_duration: Duration, relay_chain_slot_duration: Duration,
parachain_client: Arc<PC>, parachain_client: Arc<PC>,
parachain_import_queue: IQ, parachain_import_queue: IQ,
@@ -127,7 +127,7 @@ where
Self { Self {
pending_candidates: HashMap::new(), pending_candidates: HashMap::new(),
next_candidate_to_recover: Default::default(), next_candidate_to_recover: Default::default(),
active_candidate_recovery: ActiveCandidateRecovery::new(overseer_handler), active_candidate_recovery: ActiveCandidateRecovery::new(overseer_handle),
relay_chain_slot_duration, relay_chain_slot_duration,
waiting_for_parent: HashMap::new(), waiting_for_parent: HashMap::new(),
parachain_client, parachain_client,
@@ -354,6 +354,7 @@ where
origin: None, origin: None,
skip_execution: false, skip_execution: false,
state: None, state: None,
indexed_body: None,
}); });
if let Some(waiting) = self.waiting_for_parent.remove(&block_hash) { if let Some(waiting) = self.waiting_for_parent.remove(&block_hash) {
+5 -5
View File
@@ -20,7 +20,7 @@
use cumulus_client_consensus_common::ParachainConsensus; use cumulus_client_consensus_common::ParachainConsensus;
use cumulus_primitives_core::{CollectCollationInfo, ParaId}; use cumulus_primitives_core::{CollectCollationInfo, ParaId};
use polkadot_overseer::OverseerHandler; use polkadot_overseer::Handle as OverseerHandle;
use polkadot_primitives::v1::{Block as PBlock, CollatorPair}; use polkadot_primitives::v1::{Block as PBlock, CollatorPair};
use polkadot_service::{AbstractClient, Client as PClient, ClientHandle, RuntimeApiCollection}; use polkadot_service::{AbstractClient, Client as PClient, ClientHandle, RuntimeApiCollection};
use sc_client_api::{ use sc_client_api::{
@@ -124,7 +124,7 @@ where
client: client.clone(), client: client.clone(),
import_queue, import_queue,
task_manager, task_manager,
overseer_handler: relay_chain_full_node overseer_handle: relay_chain_full_node
.overseer_handler .overseer_handler
.clone() .clone()
.ok_or_else(|| "Polkadot full node did not provided an `OverseerHandler`!")?, .ok_or_else(|| "Polkadot full node did not provided an `OverseerHandler`!")?,
@@ -135,7 +135,7 @@ where
runtime_api: client.clone(), runtime_api: client.clone(),
block_status, block_status,
announce_block, announce_block,
overseer_handler: relay_chain_full_node overseer_handle: relay_chain_full_node
.overseer_handler .overseer_handler
.clone() .clone()
.ok_or_else(|| "Polkadot full node did not provided an `OverseerHandler`!")?, .ok_or_else(|| "Polkadot full node did not provided an `OverseerHandler`!")?,
@@ -248,7 +248,7 @@ struct StartPoVRecovery<'a, Block: BlockT, Client, IQ> {
para_id: ParaId, para_id: ParaId,
client: Arc<Client>, client: Arc<Client>,
task_manager: &'a mut TaskManager, task_manager: &'a mut TaskManager,
overseer_handler: OverseerHandler, overseer_handle: OverseerHandle,
import_queue: IQ, import_queue: IQ,
_phantom: PhantomData<Block>, _phantom: PhantomData<Block>,
} }
@@ -276,7 +276,7 @@ where
PClient: AbstractClient<PBlock, PBackend, Api = Api> + 'static, PClient: AbstractClient<PBlock, PBackend, Api = Api> + 'static,
{ {
let pov_recovery = cumulus_client_pov_recovery::PoVRecovery::new( let pov_recovery = cumulus_client_pov_recovery::PoVRecovery::new(
self.overseer_handler, self.overseer_handle,
sc_consensus_babe::Config::get_or_compute(&*client)?.slot_duration(), sc_consensus_babe::Config::get_or_compute(&*client)?.slot_duration(),
self.client, self.client,
self.import_queue, self.import_queue,
+16 -16
View File
@@ -16,25 +16,25 @@ targets = ['x86_64-unknown-linux-gnu']
log = { version = "0.4.0", default-features = false } log = { version = "0.4.0", default-features = false }
codec = { default-features = false, features = ['derive'], package = 'parity-scale-codec', version = '2.0.0' } codec = { default-features = false, features = ['derive'], package = 'parity-scale-codec', version = '2.0.0' }
serde = { version = "1.0.119", default-features = false } serde = { version = "1.0.119", default-features = false }
sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-staking = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-staking = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
pallet-authorship = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } pallet-authorship = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
pallet-session = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } pallet-session = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate', branch = "master" }
[dev-dependencies] [dev-dependencies]
sp-core = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-core = { git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-io = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-io = { git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-tracing = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-tracing = { git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-runtime = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-runtime = { git = 'https://github.com/paritytech/substrate', branch = "master" }
pallet-timestamp = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } pallet-timestamp = { git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-consensus-aura = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '0.9.0' } sp-consensus-aura = { git = 'https://github.com/paritytech/substrate', branch = "master" }
pallet-balances = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } pallet-balances = { git = 'https://github.com/paritytech/substrate', branch = "master" }
pallet-aura = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } pallet-aura = { git = 'https://github.com/paritytech/substrate', branch = "master" }
[features] [features]
default = ['std'] default = ['std']
@@ -55,7 +55,7 @@ parameter_types! {
} }
impl system::Config for Test { impl system::Config for Test {
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
type DbWeight = (); type DbWeight = ();
+1 -1
View File
@@ -396,7 +396,7 @@ mod tests {
type OnNewAccount = (); type OnNewAccount = ();
type OnKilledAccount = (); type OnKilledAccount = ();
type DbWeight = (); type DbWeight = ();
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type SystemWeightInfo = (); type SystemWeightInfo = ();
type SS58Prefix = (); type SS58Prefix = ();
type OnSetCode = (); type OnSetCode = ();
@@ -88,7 +88,7 @@ impl frame_system::Config for Test {
type OnNewAccount = (); type OnNewAccount = ();
type OnKilledAccount = (); type OnKilledAccount = ();
type DbWeight = (); type DbWeight = ();
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type SystemWeightInfo = (); type SystemWeightInfo = ();
type SS58Prefix = (); type SS58Prefix = ();
type OnSetCode = ParachainSetCode<Self>; type OnSetCode = ParachainSetCode<Self>;
+10 -10
View File
@@ -13,19 +13,19 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-staking = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-staking = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate', branch = "master" }
pallet-session = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } pallet-session = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master" }
[dev-dependencies] [dev-dependencies]
serde = { version = "1.0.119" } serde = { version = "1.0.119" }
codec = { package = "parity-scale-codec", version = "2.0.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", features = [ "derive" ] }
sp-core = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-core = { git = 'https://github.com/paritytech/substrate', branch = "master" }
[features] [features]
default = ["std"] default = ["std"]
+3 -3
View File
@@ -25,11 +25,11 @@ xcm-executor = { git = "https://github.com/paritytech/polkadot", default-feature
cumulus-primitives-core = { path = "../../primitives/core", default-features = false } cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
[dev-dependencies] [dev-dependencies]
sp-core = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-core = { git = 'https://github.com/paritytech/substrate', branch = "master" }
sp-io = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } sp-io = { git = 'https://github.com/paritytech/substrate', branch = "master" }
cumulus-pallet-parachain-system = { path = "../parachain-system" } cumulus-pallet-parachain-system = { path = "../parachain-system" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master" } xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master" }
pallet-balances = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } pallet-balances = { git = 'https://github.com/paritytech/substrate', branch = "master" }
[features] [features]
default = [ "std" ] default = [ "std" ]
+1 -1
View File
@@ -53,7 +53,7 @@ parameter_types! {
type AccountId = u64; type AccountId = u64;
impl frame_system::Config for Test { impl frame_system::Config for Test {
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
type DbWeight = (); type DbWeight = ();
@@ -179,7 +179,7 @@ impl frame_system::Config for Runtime {
type OnNewAccount = (); type OnNewAccount = ();
type OnKilledAccount = (); type OnKilledAccount = ();
type DbWeight = (); type DbWeight = ();
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type SystemWeightInfo = (); type SystemWeightInfo = ();
type BlockWeights = RuntimeBlockWeights; type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength; type BlockLength = RuntimeBlockLength;
+1 -1
View File
@@ -145,7 +145,7 @@ impl frame_system::Config for Runtime {
type OnNewAccount = (); type OnNewAccount = ();
type OnKilledAccount = (); type OnKilledAccount = ();
type DbWeight = (); type DbWeight = ();
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type SystemWeightInfo = (); type SystemWeightInfo = ();
type BlockWeights = RuntimeBlockWeights; type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength; type BlockLength = RuntimeBlockLength;
@@ -99,7 +99,7 @@ mod tests {
} }
impl frame_system::Config for Test { impl frame_system::Config for Test {
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type Origin = Origin; type Origin = Origin;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
@@ -145,7 +145,7 @@ parameter_types! {
// Configure FRAME pallets to include in runtime. // Configure FRAME pallets to include in runtime.
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type BlockWeights = RuntimeBlockWeights; type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength; type BlockLength = RuntimeBlockLength;
type AccountId = AccountId; type AccountId = AccountId;
@@ -145,7 +145,7 @@ parameter_types! {
// Configure FRAME pallets to include in runtime. // Configure FRAME pallets to include in runtime.
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type BlockWeights = RuntimeBlockWeights; type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength; type BlockLength = RuntimeBlockLength;
type AccountId = AccountId; type AccountId = AccountId;
+1 -1
View File
@@ -184,7 +184,7 @@ impl frame_system::Config for Runtime {
type OnNewAccount = (); type OnNewAccount = ();
type OnKilledAccount = (); type OnKilledAccount = ();
type DbWeight = (); type DbWeight = ();
type BaseCallFilter = (); type BaseCallFilter = frame_support::traits::AllowAll;
type SystemWeightInfo = (); type SystemWeightInfo = ();
type BlockWeights = RuntimeBlockWeights; type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength; type BlockLength = RuntimeBlockLength;