mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Update Substrate (#623)
* Update to latest Substrate master (#615) * Update to latest Substrate master * Remove unneeded patch + warning * Update `Cargo.lock` * Fix tests * Update again * Bump Substrate (#616) * Update lock * Fix * Few fixes * Bump to latest Substrate * Fixes * fix pre-tx-pool compilation * more compilation fixes * Updates for the injection period - Liberal slash-refunding - Instant unbonding * *: Enable refactored authority discovery (#624) * *: Enable authority discovery module * *: List authority discovery id after parachain validator id Make sure existing key types don't change their order by appending the authority discovery id instead of injecting it between im online id and parachain validator id. * *: Gate authority discovery module behind feature flag * cli/src/lib.rs: Fix warnings * cli/src/lib.rs: Shorten line length * Bump Substrate * Bump Substrate * Line widths * Line widths again * Revert bump.
This commit is contained in:
Generated
+397
-408
File diff suppressed because it is too large
Load Diff
+1
-4
@@ -4,7 +4,7 @@ path = "src/main.rs"
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "polkadot"
|
name = "polkadot"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@@ -47,6 +47,3 @@ maintenance = { status = "actively-developed" }
|
|||||||
[profile.release]
|
[profile.release]
|
||||||
# Polkadot runtime requires unwinding.
|
# Polkadot runtime requires unwinding.
|
||||||
panic = "unwind"
|
panic = "unwind"
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
zstd-sys = { git = "https://github.com/bkchr/zstd-rs.git", branch = "bkchr-export-include-paths2" }
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-availability-store"
|
name = "polkadot-availability-store"
|
||||||
description = "Persistent database for parachain data"
|
description = "Persistent database for parachain data"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
@@ -11,6 +11,6 @@ parking_lot = "0.9.0"
|
|||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] }
|
codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] }
|
||||||
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
kvdb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" }
|
kvdb = { git = "https://github.com/paritytech/parity-common", rev="03a2ba08f47f4af4219280e660a1ea92cb8896bd" }
|
||||||
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" }
|
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="03a2ba08f47f4af4219280e660a1ea92cb8896bd" }
|
||||||
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" }
|
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="03a2ba08f47f4af4219280e660a1ea92cb8896bd" }
|
||||||
|
|||||||
@@ -76,7 +76,15 @@ impl Store {
|
|||||||
/// Create a new `Store` with given config on disk.
|
/// Create a new `Store` with given config on disk.
|
||||||
pub fn new(config: Config) -> io::Result<Self> {
|
pub fn new(config: Config) -> io::Result<Self> {
|
||||||
let mut db_config = DatabaseConfig::with_columns(Some(columns::NUM_COLUMNS));
|
let mut db_config = DatabaseConfig::with_columns(Some(columns::NUM_COLUMNS));
|
||||||
db_config.memory_budget = config.cache_size;
|
|
||||||
|
if let Some(cache_size) = config.cache_size {
|
||||||
|
let mut memory_budget = std::collections::HashMap::new();
|
||||||
|
for i in 0..columns::NUM_COLUMNS {
|
||||||
|
memory_budget.insert(Some(i), cache_size / columns::NUM_COLUMNS as usize);
|
||||||
|
}
|
||||||
|
|
||||||
|
db_config.memory_budget = memory_budget;
|
||||||
|
}
|
||||||
|
|
||||||
let path = config.path.to_str().ok_or_else(|| io::Error::new(
|
let path = config.path.to_str().ok_or_else(|| io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-cli"
|
name = "polkadot-cli"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Polkadot node implementation in Rust."
|
description = "Polkadot node implementation in Rust."
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
+22
-2
@@ -87,20 +87,40 @@ struct ValidationWorkerCommand {
|
|||||||
pub mem_id: String,
|
pub mem_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, StructOpt, Clone)]
|
||||||
|
struct PolkadotSubParams {
|
||||||
|
#[structopt(long = "enable-authority-discovery")]
|
||||||
|
pub authority_discovery_enabled: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
cli::impl_augment_clap!(PolkadotSubParams);
|
||||||
|
|
||||||
/// Parses polkadot specific CLI arguments and run the service.
|
/// Parses polkadot specific CLI arguments and run the service.
|
||||||
pub fn run<W>(worker: W, version: cli::VersionInfo) -> error::Result<()> where
|
pub fn run<W>(worker: W, version: cli::VersionInfo) -> error::Result<()> where
|
||||||
W: Worker,
|
W: Worker,
|
||||||
{
|
{
|
||||||
match cli::parse_and_prepare::<PolkadotSubCommands, NoCustom, _>(&version, "parity-polkadot", std::env::args()) {
|
match cli::parse_and_prepare::<PolkadotSubCommands, PolkadotSubParams, _>(
|
||||||
|
&version,
|
||||||
|
"parity-polkadot",
|
||||||
|
std::env::args(),
|
||||||
|
) {
|
||||||
cli::ParseAndPrepare::Run(cmd) => cmd.run(load_spec, worker,
|
cli::ParseAndPrepare::Run(cmd) => cmd.run(load_spec, worker,
|
||||||
|worker, _cli_args, _custom_args, mut config| {
|
|worker, _cli_args, custom_args, mut config| {
|
||||||
info!("{}", version.name);
|
info!("{}", version.name);
|
||||||
info!(" version {}", config.full_version());
|
info!(" version {}", config.full_version());
|
||||||
info!(" by {}, 2017-2019", version.author);
|
info!(" by {}, 2017-2019", version.author);
|
||||||
info!("Chain specification: {}", config.chain_spec.name());
|
info!("Chain specification: {}", config.chain_spec.name());
|
||||||
|
if config.chain_spec.name().starts_with("Kusama") {
|
||||||
|
info!("----------------------------");
|
||||||
|
info!("This chain is not in any way");
|
||||||
|
info!(" endorsed by the ");
|
||||||
|
info!(" KUSAMA FOUNDATION ");
|
||||||
|
info!("----------------------------");
|
||||||
|
}
|
||||||
info!("Node name: {}", config.name);
|
info!("Node name: {}", config.name);
|
||||||
info!("Roles: {}", display_role(&config));
|
info!("Roles: {}", display_role(&config));
|
||||||
config.custom = worker.configuration();
|
config.custom = worker.configuration();
|
||||||
|
config.custom.authority_discovery_enabled = custom_args.authority_discovery_enabled;
|
||||||
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
|
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
|
||||||
match config.roles {
|
match config.roles {
|
||||||
service::Roles::LIGHT =>
|
service::Roles::LIGHT =>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-collator"
|
name = "polkadot-collator"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Collator node implementation"
|
description = "Collator node implementation"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-erasure-coding"
|
name = "polkadot-erasure-coding"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-executor"
|
name = "polkadot-executor"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Polkadot node implementation in Rust."
|
description = "Polkadot node implementation in Rust."
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-network"
|
name = "polkadot-network"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Polkadot-specific networking protocol"
|
description = "Polkadot-specific networking protocol"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@@ -20,6 +20,7 @@ futures03 = { package = "futures", version = "0.3.1", features = ["compat"] }
|
|||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
exit-future = "0.1.4"
|
exit-future = "0.1.4"
|
||||||
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
|
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
//! will be noted as non-beneficial to Substrate's peer-set management utility.
|
//! will be noted as non-beneficial to Substrate's peer-set management utility.
|
||||||
|
|
||||||
use sr_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
|
use sr_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
|
||||||
use substrate_client::error::Error as ClientError;
|
use sp_blockchain::Error as ClientError;
|
||||||
use substrate_network::{config::Roles, PeerId};
|
use substrate_network::{config::Roles, PeerId};
|
||||||
use substrate_network::consensus_gossip::{
|
use substrate_network::consensus_gossip::{
|
||||||
self as network_gossip, ValidationResult as GossipValidationResult,
|
self as network_gossip, ValidationResult as GossipValidationResult,
|
||||||
@@ -792,9 +792,10 @@ mod tests {
|
|||||||
|
|
||||||
{
|
{
|
||||||
let mut message_allowed = validator.message_allowed();
|
let mut message_allowed = validator.message_allowed();
|
||||||
assert!(message_allowed(&peer_a, MessageIntent::Broadcast { previous_attempts: 0 }, &topic_a, &encoded));
|
let intent = MessageIntent::Broadcast;
|
||||||
assert!(!message_allowed(&peer_a, MessageIntent::Broadcast { previous_attempts: 0 }, &topic_b, &encoded));
|
assert!(message_allowed(&peer_a, intent, &topic_a, &encoded));
|
||||||
assert!(!message_allowed(&peer_a, MessageIntent::Broadcast { previous_attempts: 0 }, &topic_c, &encoded));
|
assert!(!message_allowed(&peer_a, intent, &topic_b, &encoded));
|
||||||
|
assert!(!message_allowed(&peer_a, intent, &topic_c, &encoded));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,7 +901,7 @@ mod tests {
|
|||||||
|
|
||||||
{
|
{
|
||||||
let mut message_allowed = validator.message_allowed();
|
let mut message_allowed = validator.message_allowed();
|
||||||
assert!(!message_allowed(&peer_a, MessageIntent::Broadcast { previous_attempts: 0 }, &topic_a, &encoded[..]));
|
assert!(!message_allowed(&peer_a, MessageIntent::Broadcast, &topic_a, &encoded[..]));
|
||||||
}
|
}
|
||||||
|
|
||||||
validator
|
validator
|
||||||
@@ -913,7 +914,7 @@ mod tests {
|
|||||||
.note_aware_under_leaf(&hash_a, c_hash);
|
.note_aware_under_leaf(&hash_a, c_hash);
|
||||||
{
|
{
|
||||||
let mut message_allowed = validator.message_allowed();
|
let mut message_allowed = validator.message_allowed();
|
||||||
assert!(message_allowed(&peer_a, MessageIntent::Broadcast { previous_attempts: 0 }, &topic_a, &encoded[..]));
|
assert!(message_allowed(&peer_a, MessageIntent::Broadcast, &topic_a, &encoded[..]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,8 +1007,9 @@ mod tests {
|
|||||||
}).encode();
|
}).encode();
|
||||||
|
|
||||||
let mut allowed = validator.inner.message_allowed();
|
let mut allowed = validator.inner.message_allowed();
|
||||||
assert!(allowed(&peer_a, MessageIntent::Broadcast { previous_attempts: 0 }, &root_a_topic, &message[..]));
|
let intent = MessageIntent::Broadcast;
|
||||||
assert!(!allowed(&peer_b, MessageIntent::Broadcast { previous_attempts: 0 }, &root_a_topic, &message[..]));
|
assert!(allowed(&peer_a, intent, &root_a_topic, &message[..]));
|
||||||
|
assert!(!allowed(&peer_b, intent, &root_a_topic, &message[..]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1077,8 +1079,9 @@ mod tests {
|
|||||||
}).encode();
|
}).encode();
|
||||||
|
|
||||||
let mut allowed = validator.inner.message_allowed();
|
let mut allowed = validator.inner.message_allowed();
|
||||||
assert!(!allowed(&peer_a, MessageIntent::Broadcast { previous_attempts: 0 }, &root_a_topic, &message[..]));
|
let intent = MessageIntent::Broadcast;
|
||||||
assert!(!allowed(&peer_b, MessageIntent::Broadcast { previous_attempts: 0 }, &root_a_topic, &message[..]));
|
assert!(!allowed(&peer_a, intent, &root_a_topic, &message[..]));
|
||||||
|
assert!(!allowed(&peer_b, intent, &root_a_topic, &message[..]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// peer A gets updated to the chain head. now we'll attempt to broadcast
|
// peer A gets updated to the chain head. now we'll attempt to broadcast
|
||||||
@@ -1115,8 +1118,9 @@ mod tests {
|
|||||||
}).encode();
|
}).encode();
|
||||||
|
|
||||||
let mut allowed = validator.inner.message_allowed();
|
let mut allowed = validator.inner.message_allowed();
|
||||||
assert!(allowed(&peer_a, MessageIntent::Broadcast { previous_attempts: 0 }, &root_a_topic, &message[..]));
|
let intent = MessageIntent::Broadcast;
|
||||||
assert!(!allowed(&peer_b, MessageIntent::Broadcast { previous_attempts: 0 }, &root_a_topic, &message[..]));
|
assert!(allowed(&peer_a, intent, &root_a_topic, &message[..]));
|
||||||
|
assert!(!allowed(&peer_b, intent, &root_a_topic, &message[..]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
use sr_primitives::traits::{BlakeTwo256, Hash as HashT};
|
use sr_primitives::traits::{BlakeTwo256, Hash as HashT};
|
||||||
use polkadot_primitives::Hash;
|
use polkadot_primitives::Hash;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use substrate_client::error::Error as ClientError;
|
use sp_blockchain::Error as ClientError;
|
||||||
use super::{MAX_CHAIN_HEADS, GossipValidationResult, LeavesVec, ChainContext};
|
use super::{MAX_CHAIN_HEADS, GossipValidationResult, LeavesVec, ChainContext};
|
||||||
|
|
||||||
/// Construct a topic for a message queue root deterministically.
|
/// Construct a topic for a message queue root deterministically.
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ impl<P, E: Clone, N: NetworkService, T: Clone> Clone for Router<P, E, N, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<P: ProvideRuntimeApi + Send + Sync + 'static, E, N, T> Router<P, E, N, T> where
|
impl<P: ProvideRuntimeApi + Send + Sync + 'static, E, N, T> Router<P, E, N, T> where
|
||||||
P::Api: ParachainHost<Block, Error = substrate_client::error::Error>,
|
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
|
||||||
N: NetworkService,
|
N: NetworkService,
|
||||||
T: Clone + Executor + Send + 'static,
|
T: Clone + Executor + Send + 'static,
|
||||||
E: Future<Item=(),Error=()> + Clone + Send + 'static,
|
E: Future<Item=(),Error=()> + Clone + Send + 'static,
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ impl crate::gossip::ChainContext for TestChainContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn leaf_unrouted_roots(&self, leaf: &Hash, with_queue_root: &mut dyn FnMut(&Hash))
|
fn leaf_unrouted_roots(&self, leaf: &Hash, with_queue_root: &mut dyn FnMut(&Hash))
|
||||||
-> Result<(), substrate_client::error::Error>
|
-> Result<(), sp_blockchain::Error>
|
||||||
{
|
{
|
||||||
for root in self.ingress_roots.get(leaf).into_iter().flat_map(|roots| roots) {
|
for root in self.ingress_roots.get(leaf).into_iter().flat_map(|roots| roots) {
|
||||||
with_queue_root(root)
|
with_queue_root(root)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ use polkadot_primitives::parachain::{
|
|||||||
FeeSchedule, HeadData, Retriable, CollatorId
|
FeeSchedule, HeadData, Retriable, CollatorId
|
||||||
};
|
};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use substrate_client::error::Result as ClientResult;
|
use sp_blockchain::Result as ClientResult;
|
||||||
use sr_api::{Core, RuntimeVersion, StorageProof, ApiExt};
|
use sr_api::{Core, RuntimeVersion, StorageProof, ApiExt};
|
||||||
use sr_primitives::traits::{ApiRef, ProvideRuntimeApi};
|
use sr_primitives::traits::{ApiRef, ProvideRuntimeApi};
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ impl Core<Block> for RuntimeApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ApiExt<Block> for RuntimeApi {
|
impl ApiExt<Block> for RuntimeApi {
|
||||||
type Error = substrate_client::error::Error;
|
type Error = sp_blockchain::Error;
|
||||||
|
|
||||||
fn map_api_result<F: FnOnce(&Self) -> Result<R, E>, R, E>(
|
fn map_api_result<F: FnOnce(&Self) -> Result<R, E>, R, E>(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ impl<P, E, N, T> ValidationNetwork<P, E, N, T> where N: NetworkService {
|
|||||||
/// A long-lived network which can create parachain statement routing processes on demand.
|
/// A long-lived network which can create parachain statement routing processes on demand.
|
||||||
impl<P, E, N, T> ParachainNetwork for ValidationNetwork<P, E, N, T> where
|
impl<P, E, N, T> ParachainNetwork for ValidationNetwork<P, E, N, T> where
|
||||||
P: ProvideRuntimeApi + Send + Sync + 'static,
|
P: ProvideRuntimeApi + Send + Sync + 'static,
|
||||||
P::Api: ParachainHost<Block, Error = substrate_client::error::Error>,
|
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
|
||||||
E: Clone + Future<Item=(),Error=()> + Send + Sync + 'static,
|
E: Clone + Future<Item=(),Error=()> + Send + Sync + 'static,
|
||||||
N: NetworkService,
|
N: NetworkService,
|
||||||
T: Clone + Executor + Send + Sync + 'static,
|
T: Clone + Executor + Send + Sync + 'static,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-parachain"
|
name = "polkadot-parachain"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Types and utilities for creating and working with parachains"
|
description = "Types and utilities for creating and working with parachains"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-primitives"
|
name = "polkadot-primitives"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-rpc"
|
name = "polkadot-rpc"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
@@ -10,8 +10,8 @@ jsonrpc-core = "14.0.3"
|
|||||||
polkadot-primitives = { path = "../primitives" }
|
polkadot-primitives = { path = "../primitives" }
|
||||||
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
substrate-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
substrate-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
transaction_pool = { package = "substrate-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
txpool-api = { package = "sp-transaction-pool-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
frame-system-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
polkadot-runtime = { path = "../runtime" }
|
polkadot-runtime = { path = "../runtime" }
|
||||||
|
|
||||||
|
|||||||
+31
-6
@@ -22,30 +22,55 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use polkadot_primitives::{Block, AccountId, Nonce, Balance};
|
use polkadot_primitives::{Block, AccountId, Nonce, Balance};
|
||||||
use sr_primitives::traits::ProvideRuntimeApi;
|
use sr_primitives::traits::ProvideRuntimeApi;
|
||||||
use transaction_pool::txpool::{ChainApi, Pool};
|
use txpool_api::TransactionPool;
|
||||||
use polkadot_runtime::UncheckedExtrinsic;
|
use polkadot_runtime::UncheckedExtrinsic;
|
||||||
|
|
||||||
/// A type representing all RPC extensions.
|
/// A type representing all RPC extensions.
|
||||||
pub type RpcExtension = jsonrpc_core::IoHandler<substrate_rpc::Metadata>;
|
pub type RpcExtension = jsonrpc_core::IoHandler<substrate_rpc::Metadata>;
|
||||||
|
|
||||||
/// Instantiate all RPC extensions.
|
/// Instantiate all RPC extensions.
|
||||||
pub fn create<C, P>(client: Arc<C>, pool: Arc<Pool<P>>) -> RpcExtension where
|
pub fn create_full<C, P>(client: Arc<C>, pool: Arc<P>) -> RpcExtension where
|
||||||
C: ProvideRuntimeApi,
|
C: ProvideRuntimeApi,
|
||||||
C: client::blockchain::HeaderBackend<Block>,
|
C: client::blockchain::HeaderBackend<Block>,
|
||||||
C: Send + Sync + 'static,
|
C: Send + Sync + 'static,
|
||||||
C::Api: frame_system_rpc::AccountNonceApi<Block, AccountId, Nonce>,
|
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
||||||
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance, UncheckedExtrinsic>,
|
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance, UncheckedExtrinsic>,
|
||||||
P: ChainApi + Sync + Send + 'static,
|
P: TransactionPool + Sync + Send + 'static,
|
||||||
{
|
{
|
||||||
use frame_system_rpc::{System, SystemApi};
|
use frame_rpc_system::{FullSystem, SystemApi};
|
||||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||||
|
|
||||||
let mut io = jsonrpc_core::IoHandler::default();
|
let mut io = jsonrpc_core::IoHandler::default();
|
||||||
io.extend_with(
|
io.extend_with(
|
||||||
SystemApi::to_delegate(System::new(client.clone(), pool))
|
SystemApi::to_delegate(FullSystem::new(client.clone(), pool))
|
||||||
);
|
);
|
||||||
io.extend_with(
|
io.extend_with(
|
||||||
TransactionPaymentApi::to_delegate(TransactionPayment::new(client))
|
TransactionPaymentApi::to_delegate(TransactionPayment::new(client))
|
||||||
);
|
);
|
||||||
io
|
io
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Instantiate all RPC extensions for light node.
|
||||||
|
pub fn create_light<C, P, F>(
|
||||||
|
client: Arc<C>,
|
||||||
|
remote_blockchain: Arc<dyn client::light::blockchain::RemoteBlockchain<Block>>,
|
||||||
|
fetcher: Arc<F>,
|
||||||
|
pool: Arc<P>,
|
||||||
|
) -> RpcExtension
|
||||||
|
where
|
||||||
|
C: ProvideRuntimeApi,
|
||||||
|
C: client::blockchain::HeaderBackend<Block>,
|
||||||
|
C: Send + Sync + 'static,
|
||||||
|
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
||||||
|
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance, UncheckedExtrinsic>,
|
||||||
|
P: TransactionPool + Sync + Send + 'static,
|
||||||
|
F: client::light::fetcher::Fetcher<Block> + 'static,
|
||||||
|
{
|
||||||
|
use frame_rpc_system::{LightSystem, SystemApi};
|
||||||
|
|
||||||
|
let mut io = jsonrpc_core::IoHandler::default();
|
||||||
|
io.extend_with(
|
||||||
|
SystemApi::<AccountId, Nonce>::to_delegate(LightSystem::new(client, remote_blockchain, fetcher, pool))
|
||||||
|
);
|
||||||
|
io
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-runtime"
|
name = "polkadot-runtime"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
@@ -27,7 +27,7 @@ substrate-primitives = { git = "https://github.com/paritytech/substrate", defaul
|
|||||||
substrate-serializer = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
substrate-serializer = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
substrate-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
substrate-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
version = { package = "sr-version", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
version = { package = "sr-version", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
tx-pool-api = { package = "substrate-transaction-pool-runtime-api", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
tx-pool-api = { package = "sp-transaction-pool-runtime-api", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
block-builder-api = { package = "substrate-block-builder-runtime-api", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
block-builder-api = { package = "substrate-block-builder-runtime-api", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
|
|
||||||
authority-discovery = { package = "pallet-authority-discovery", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
authority-discovery = { package = "pallet-authority-discovery", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ use frame_support::{
|
|||||||
weights::{Weight, DispatchInfo},
|
weights::{Weight, DispatchInfo},
|
||||||
};
|
};
|
||||||
use im_online::sr25519::AuthorityId as ImOnlineId;
|
use im_online::sr25519::AuthorityId as ImOnlineId;
|
||||||
|
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||||
use system::offchain::TransactionSubmitter;
|
use system::offchain::TransactionSubmitter;
|
||||||
use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
|
use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
spec_name: create_runtime_str!("kusama"),
|
spec_name: create_runtime_str!("kusama"),
|
||||||
impl_name: create_runtime_str!("parity-kusama"),
|
impl_name: create_runtime_str!("parity-kusama"),
|
||||||
authoring_version: 2,
|
authoring_version: 2,
|
||||||
spec_version: 1019,
|
spec_version: 1020,
|
||||||
impl_version: 0,
|
impl_version: 0,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
};
|
};
|
||||||
@@ -258,6 +259,7 @@ impl_opaque_keys! {
|
|||||||
pub babe: Babe,
|
pub babe: Babe,
|
||||||
pub im_online: ImOnline,
|
pub im_online: ImOnline,
|
||||||
pub parachain_validator: Parachains,
|
pub parachain_validator: Parachains,
|
||||||
|
pub authority_discovery: AuthorityDiscovery,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +300,9 @@ parameter_types! {
|
|||||||
pub const SessionsPerEra: SessionIndex = 6;
|
pub const SessionsPerEra: SessionIndex = 6;
|
||||||
// 28 eras for unbonding (28 days).
|
// 28 eras for unbonding (28 days).
|
||||||
// KUSAMA: This value is 1/4 of what we expect for the mainnet.
|
// KUSAMA: This value is 1/4 of what we expect for the mainnet.
|
||||||
pub const BondingDuration: staking::EraIndex = 7;
|
// KUSAMA-launch: 0 for managing the spooning injection.
|
||||||
|
pub const BondingDuration: staking::EraIndex = 0;
|
||||||
|
pub const SlashDeferDuration: staking::EraIndex = 7;
|
||||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,6 +315,11 @@ impl staking::Trait for Runtime {
|
|||||||
type Reward = ();
|
type Reward = ();
|
||||||
type SessionsPerEra = SessionsPerEra;
|
type SessionsPerEra = SessionsPerEra;
|
||||||
type BondingDuration = BondingDuration;
|
type BondingDuration = BondingDuration;
|
||||||
|
type SlashDeferDuration = SlashDeferDuration;
|
||||||
|
// A super-majority of the council can cancel the slash.
|
||||||
|
// KUSAMA-launch: Any council member can remove a slash.
|
||||||
|
// type SlashCancelOrigin = collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>;
|
||||||
|
type SlashCancelOrigin = collective::EnsureMember<AccountId, CouncilCollective>;
|
||||||
type SessionInterface = Self;
|
type SessionInterface = Self;
|
||||||
type Time = Timestamp;
|
type Time = Timestamp;
|
||||||
type RewardCurve = RewardCurve;
|
type RewardCurve = RewardCurve;
|
||||||
@@ -429,6 +438,8 @@ impl offences::Trait for Runtime {
|
|||||||
type OnOffenceHandler = Staking;
|
type OnOffenceHandler = Staking;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl authority_discovery::Trait for Runtime {}
|
||||||
|
|
||||||
type SubmitTransaction = TransactionSubmitter<ImOnlineId, Runtime, UncheckedExtrinsic>;
|
type SubmitTransaction = TransactionSubmitter<ImOnlineId, Runtime, UncheckedExtrinsic>;
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -568,6 +579,7 @@ construct_runtime!(
|
|||||||
FinalityTracker: finality_tracker::{Module, Call, Inherent},
|
FinalityTracker: finality_tracker::{Module, Call, Inherent},
|
||||||
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
||||||
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
|
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
|
||||||
|
AuthorityDiscovery: authority_discovery::{Module, Call, Config},
|
||||||
|
|
||||||
// Governance stuff; uncallable initially.
|
// Governance stuff; uncallable initially.
|
||||||
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
|
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
|
||||||
@@ -730,6 +742,12 @@ sr_api::impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl authority_discovery_primitives::AuthorityDiscoveryApi<Block> for Runtime {
|
||||||
|
fn authorities() -> Vec<AuthorityDiscoveryId> {
|
||||||
|
AuthorityDiscovery::authorities()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl substrate_session::SessionKeys<Block> for Runtime {
|
impl substrate_session::SessionKeys<Block> for Runtime {
|
||||||
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
||||||
SessionKeys::generate(seed)
|
SessionKeys::generate(seed)
|
||||||
|
|||||||
@@ -1040,6 +1040,7 @@ mod tests {
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const SessionsPerEra: sr_staking_primitives::SessionIndex = 6;
|
pub const SessionsPerEra: sr_staking_primitives::SessionIndex = 6;
|
||||||
pub const BondingDuration: staking::EraIndex = 28;
|
pub const BondingDuration: staking::EraIndex = 28;
|
||||||
|
pub const SlashDeferDuration: staking::EraIndex = 7;
|
||||||
pub const AttestationPeriod: BlockNumber = 100;
|
pub const AttestationPeriod: BlockNumber = 100;
|
||||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||||
}
|
}
|
||||||
@@ -1053,6 +1054,8 @@ mod tests {
|
|||||||
type Reward = ();
|
type Reward = ();
|
||||||
type SessionsPerEra = SessionsPerEra;
|
type SessionsPerEra = SessionsPerEra;
|
||||||
type BondingDuration = BondingDuration;
|
type BondingDuration = BondingDuration;
|
||||||
|
type SlashDeferDuration = SlashDeferDuration;
|
||||||
|
type SlashCancelOrigin = system::EnsureRoot<Self::AccountId>;
|
||||||
type SessionInterface = Self;
|
type SessionInterface = Self;
|
||||||
type Time = timestamp::Module<Test>;
|
type Time = timestamp::Module<Test>;
|
||||||
type RewardCurve = RewardCurve;
|
type RewardCurve = RewardCurve;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-service"
|
name = "polkadot-service"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@ parking_lot = "0.9.0"
|
|||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
futures = "0.1.29"
|
futures = "0.1.29"
|
||||||
|
futures03 = { package = "futures", version = "0.3.1", features = ["compat"] }
|
||||||
exit-future = "0.1.4"
|
exit-future = "0.1.4"
|
||||||
slog = "2.5.2"
|
slog = "2.5.2"
|
||||||
hex-literal = "0.2.1"
|
hex-literal = "0.2.1"
|
||||||
@@ -34,11 +35,13 @@ grandpa_primitives = { package = "substrate-finality-grandpa-primitives", git =
|
|||||||
inherents = { package = "substrate-inherents", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
inherents = { package = "substrate-inherents", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
service = { package = "substrate-service", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
service = { package = "substrate-service", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
telemetry = { package = "substrate-telemetry", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
telemetry = { package = "substrate-telemetry", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
transaction_pool = { package = "substrate-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
txpool = { package = "sc-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
|
txpool-api = { package = "sp-transaction-pool-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
substrate-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
substrate-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
pallet-babe = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
pallet-babe = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
pallet-staking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
pallet-staking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
im-online = { package = "pallet-im-online", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
im-online = { package = "pallet-im-online", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
authority-discovery = { package = "substrate-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
authority-discovery = { package = "substrate-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
|
authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
babe = { package = "substrate-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
babe = { package = "substrate-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
babe-primitives = { package = "substrate-consensus-babe-primitives", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
babe-primitives = { package = "substrate-consensus-babe-primitives", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
use primitives::{Pair, Public, crypto::UncheckedInto, sr25519};
|
use primitives::{Pair, Public, crypto::UncheckedInto, sr25519};
|
||||||
use polkadot_primitives::{AccountId, AccountPublic, parachain::ValidatorId};
|
use polkadot_primitives::{AccountId, AccountPublic, parachain::ValidatorId};
|
||||||
use polkadot_runtime::{
|
use polkadot_runtime::{
|
||||||
GenesisConfig, CouncilConfig, DemocracyConfig, SystemConfig, SessionConfig, StakingConfig,
|
AuthorityDiscoveryConfig, GenesisConfig, CouncilConfig, DemocracyConfig, SystemConfig,
|
||||||
BalancesConfig, SessionKeys, TechnicalCommitteeConfig, SudoConfig, IndicesConfig, StakerStatus,
|
SessionConfig, StakingConfig, BalancesConfig, SessionKeys, TechnicalCommitteeConfig, SudoConfig,
|
||||||
WASM_BINARY, ClaimsConfig, ParachainsConfig, RegistrarConfig
|
IndicesConfig, StakerStatus, WASM_BINARY, ClaimsConfig, ParachainsConfig, RegistrarConfig
|
||||||
};
|
};
|
||||||
use polkadot_runtime::constants::currency::DOTS;
|
use polkadot_runtime::constants::currency::DOTS;
|
||||||
use sr_primitives::{traits::IdentifyAccount, Perbill};
|
use sr_primitives::{traits::IdentifyAccount, Perbill};
|
||||||
@@ -30,6 +30,7 @@ use hex_literal::hex;
|
|||||||
use babe_primitives::AuthorityId as BabeId;
|
use babe_primitives::AuthorityId as BabeId;
|
||||||
use grandpa::AuthorityId as GrandpaId;
|
use grandpa::AuthorityId as GrandpaId;
|
||||||
use im_online::sr25519::{AuthorityId as ImOnlineId};
|
use im_online::sr25519::{AuthorityId as ImOnlineId};
|
||||||
|
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||||
use pallet_staking::Forcing;
|
use pallet_staking::Forcing;
|
||||||
|
|
||||||
const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
||||||
@@ -46,15 +47,17 @@ fn session_keys(
|
|||||||
babe: BabeId,
|
babe: BabeId,
|
||||||
grandpa: GrandpaId,
|
grandpa: GrandpaId,
|
||||||
im_online: ImOnlineId,
|
im_online: ImOnlineId,
|
||||||
parachain_validator: ValidatorId
|
parachain_validator: ValidatorId,
|
||||||
|
authority_discovery: AuthorityDiscoveryId
|
||||||
) -> SessionKeys {
|
) -> SessionKeys {
|
||||||
SessionKeys { babe, grandpa, im_online, parachain_validator }
|
SessionKeys { babe, grandpa, im_online, parachain_validator, authority_discovery }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn staging_testnet_config_genesis() -> GenesisConfig {
|
fn staging_testnet_config_genesis() -> GenesisConfig {
|
||||||
// subkey inspect "$SECRET"
|
// subkey inspect "$SECRET"
|
||||||
let endowed_accounts = vec![
|
let endowed_accounts = vec![
|
||||||
hex!["12b782529c22032ed4694e0f6e7d486be7daa6d12088f6bc74d593b3900b8438"].into(), // 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
|
// 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
|
||||||
|
hex!["12b782529c22032ed4694e0f6e7d486be7daa6d12088f6bc74d593b3900b8438"].into(),
|
||||||
];
|
];
|
||||||
|
|
||||||
// for i in 1 2 3 4; do for j in stash controller; do subkey inspect "$SECRET//$i//$j"; done; done
|
// for i in 1 2 3 4; do for j in stash controller; do subkey inspect "$SECRET//$i//$j"; done; done
|
||||||
@@ -62,34 +65,74 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
|
|||||||
// for i in 1 2 3 4; do for j in grandpa; do subkey --ed25519 inspect "$SECRET//$i//$j"; done; done
|
// for i in 1 2 3 4; do for j in grandpa; do subkey --ed25519 inspect "$SECRET//$i//$j"; done; done
|
||||||
// for i in 1 2 3 4; do for j in im_online; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
|
// for i in 1 2 3 4; do for j in im_online; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
|
||||||
// for i in 1 2 3 4; do for j in parachains; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
|
// for i in 1 2 3 4; do for j in parachains; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
|
||||||
let initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId)> = vec![(
|
let initial_authorities: Vec<(
|
||||||
hex!["32a5718e87d16071756d4b1370c411bbbb947eb62f0e6e0b937d5cbfc0ea633b"].into(), // 5DD7Q4VEfPTLEdn11CnThoHT5f9xKCrnofWJL5SsvpTghaAT
|
AccountId,
|
||||||
hex!["bee39fe862c85c91aaf343e130d30b643c6ea0b4406a980206f1df8331f7093b"].into(), // 5GNzaEqhrZAtUQhbMe2gn9jBuNWfamWFZHULryFwBUXyd1cG
|
AccountId,
|
||||||
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(), // 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
|
BabeId,
|
||||||
hex!["76620f7c98bce8619979c2b58cf2b0aff71824126d2b039358729dad993223db"].unchecked_into(), // 5EjvdwATjyFFikdZibVvx1q5uBHhphS2Mnsq5c7yfaYK25vm
|
GrandpaId,
|
||||||
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(), // 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
|
ImOnlineId,
|
||||||
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(), // 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
|
ValidatorId,
|
||||||
|
AuthorityDiscoveryId
|
||||||
|
)> = vec![(
|
||||||
|
// 5DD7Q4VEfPTLEdn11CnThoHT5f9xKCrnofWJL5SsvpTghaAT
|
||||||
|
hex!["32a5718e87d16071756d4b1370c411bbbb947eb62f0e6e0b937d5cbfc0ea633b"].into(),
|
||||||
|
// 5GNzaEqhrZAtUQhbMe2gn9jBuNWfamWFZHULryFwBUXyd1cG
|
||||||
|
hex!["bee39fe862c85c91aaf343e130d30b643c6ea0b4406a980206f1df8331f7093b"].into(),
|
||||||
|
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
|
||||||
|
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
|
||||||
|
// 5EjvdwATjyFFikdZibVvx1q5uBHhphS2Mnsq5c7yfaYK25vm
|
||||||
|
hex!["76620f7c98bce8619979c2b58cf2b0aff71824126d2b039358729dad993223db"].unchecked_into(),
|
||||||
|
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
|
||||||
|
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
|
||||||
|
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
|
||||||
|
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
|
||||||
|
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
|
||||||
|
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
|
||||||
),(
|
),(
|
||||||
hex!["b496c98a405ceab59b9e970e59ef61acd7765a19b704e02ab06c1cdfe171e40f"].into(), // 5G9VGb8ESBeS8Ca4or43RfhShzk9y7T5iTmxHk5RJsjZwsRx
|
// 5G9VGb8ESBeS8Ca4or43RfhShzk9y7T5iTmxHk5RJsjZwsRx
|
||||||
hex!["86d3a7571dd60139d297e55d8238d0c977b2e208c5af088f7f0136b565b0c103"].into(), // 5F7V9Y5FcxKXe1aroqvPeRiUmmeQwTFcL3u9rrPXcMuMiCNx
|
hex!["b496c98a405ceab59b9e970e59ef61acd7765a19b704e02ab06c1cdfe171e40f"].into(),
|
||||||
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(), // 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
|
// 5F7V9Y5FcxKXe1aroqvPeRiUmmeQwTFcL3u9rrPXcMuMiCNx
|
||||||
hex!["e2234d661bee4a04c38392c75d1566200aa9e6ae44dd98ee8765e4cc9af63cb7"].unchecked_into(), // 5HBDAaybNqjmY7ww8ZcZZY1L5LHxvpnyfqJwoB7HhR6raTmG
|
hex!["86d3a7571dd60139d297e55d8238d0c977b2e208c5af088f7f0136b565b0c103"].into(),
|
||||||
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(), // 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
|
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
|
||||||
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(), // 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
|
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
|
||||||
|
// 5HBDAaybNqjmY7ww8ZcZZY1L5LHxvpnyfqJwoB7HhR6raTmG
|
||||||
|
hex!["e2234d661bee4a04c38392c75d1566200aa9e6ae44dd98ee8765e4cc9af63cb7"].unchecked_into(),
|
||||||
|
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
|
||||||
|
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
|
||||||
|
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
|
||||||
|
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
|
||||||
|
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
|
||||||
|
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
|
||||||
),(
|
),(
|
||||||
hex!["ae12f70078a22882bf5135d134468f77301927aa67c376e8c55b7ff127ace115"].into(), // 5FzwpgGvk2kk9agow6KsywLYcPzjYc8suKej2bne5G5b9YU3
|
// 5FzwpgGvk2kk9agow6KsywLYcPzjYc8suKej2bne5G5b9YU3
|
||||||
hex!["7addb914ec8486bbc60643d2647685dcc06373401fa80e09813b630c5831d54b"].into(), // 5EqoZhVC2BcsM4WjvZNidu2muKAbu5THQTBKe3EjvxXkdP7A
|
hex!["ae12f70078a22882bf5135d134468f77301927aa67c376e8c55b7ff127ace115"].into(),
|
||||||
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(), // 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
|
// 5EqoZhVC2BcsM4WjvZNidu2muKAbu5THQTBKe3EjvxXkdP7A
|
||||||
hex!["5b57ed1443c8967f461db1f6eb2ada24794d163a668f1cf9d9ce3235dfad8799"].unchecked_into(), // 5E8ULLQrDAtWhfnVfZmX41Yux86zNAwVJYguWJZVWrJvdhBe
|
hex!["7addb914ec8486bbc60643d2647685dcc06373401fa80e09813b630c5831d54b"].into(),
|
||||||
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(), // 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
|
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
|
||||||
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(), // 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
|
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
|
||||||
|
// 5E8ULLQrDAtWhfnVfZmX41Yux86zNAwVJYguWJZVWrJvdhBe
|
||||||
|
hex!["5b57ed1443c8967f461db1f6eb2ada24794d163a668f1cf9d9ce3235dfad8799"].unchecked_into(),
|
||||||
|
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
|
||||||
|
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
|
||||||
|
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
|
||||||
|
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
|
||||||
|
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
|
||||||
|
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
|
||||||
),(
|
),(
|
||||||
hex!["0867dbb49721126df589db100dda728dc3b475cbf414dad8f72a1d5e84897252"].into(), // 5CFj6Kg9rmVn1vrqpyjau2ztyBzKeVdRKwNPiA3tqhB5HPqq
|
// 5CFj6Kg9rmVn1vrqpyjau2ztyBzKeVdRKwNPiA3tqhB5HPqq
|
||||||
hex!["26ab2b4b2eba2263b1e55ceb48f687bb0018130a88df0712fbdaf6a347d50e2a"].into(), // 5CwQXP6nvWzigFqNhh2jvCaW9zWVzkdveCJY3tz2MhXMjTon
|
hex!["0867dbb49721126df589db100dda728dc3b475cbf414dad8f72a1d5e84897252"].into(),
|
||||||
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(), // 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
|
// 5CwQXP6nvWzigFqNhh2jvCaW9zWVzkdveCJY3tz2MhXMjTon
|
||||||
hex!["e60d23f49e93c1c1f2d7c115957df5bbd7faf5ebf138d1e9d02e8b39a1f63df0"].unchecked_into(), // 5HGLmrZsiTFTPp3QoS1W8w9NxByt8PVq79reqvdxNcQkByqK
|
hex!["26ab2b4b2eba2263b1e55ceb48f687bb0018130a88df0712fbdaf6a347d50e2a"].into(),
|
||||||
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(), // 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
|
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
|
||||||
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(), // 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
|
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
|
||||||
|
// 5HGLmrZsiTFTPp3QoS1W8w9NxByt8PVq79reqvdxNcQkByqK
|
||||||
|
hex!["e60d23f49e93c1c1f2d7c115957df5bbd7faf5ebf138d1e9d02e8b39a1f63df0"].unchecked_into(),
|
||||||
|
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
|
||||||
|
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
|
||||||
|
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
|
||||||
|
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
|
||||||
|
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
|
||||||
|
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
|
||||||
)];
|
)];
|
||||||
|
|
||||||
const ENDOWMENT: u128 = 1_000_000 * DOTS;
|
const ENDOWMENT: u128 = 1_000_000 * DOTS;
|
||||||
@@ -115,7 +158,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
|
|||||||
session: Some(SessionConfig {
|
session: Some(SessionConfig {
|
||||||
keys: initial_authorities.iter().map(|x| (
|
keys: initial_authorities.iter().map(|x| (
|
||||||
x.0.clone(),
|
x.0.clone(),
|
||||||
session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone()),
|
session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone(), x.6.clone()),
|
||||||
)).collect::<Vec<_>>(),
|
)).collect::<Vec<_>>(),
|
||||||
}),
|
}),
|
||||||
staking: Some(StakingConfig {
|
staking: Some(StakingConfig {
|
||||||
@@ -141,6 +184,9 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
|
|||||||
babe: Some(Default::default()),
|
babe: Some(Default::default()),
|
||||||
grandpa: Some(Default::default()),
|
grandpa: Some(Default::default()),
|
||||||
im_online: Some(Default::default()),
|
im_online: Some(Default::default()),
|
||||||
|
authority_discovery: Some(AuthorityDiscoveryConfig {
|
||||||
|
keys: vec![],
|
||||||
|
}),
|
||||||
parachains: Some(ParachainsConfig {
|
parachains: Some(ParachainsConfig {
|
||||||
authorities: vec![],
|
authorities: vec![],
|
||||||
}),
|
}),
|
||||||
@@ -194,7 +240,8 @@ pub fn get_authority_keys_from_seed(seed: &str) -> (
|
|||||||
BabeId,
|
BabeId,
|
||||||
GrandpaId,
|
GrandpaId,
|
||||||
ImOnlineId,
|
ImOnlineId,
|
||||||
ValidatorId
|
ValidatorId,
|
||||||
|
AuthorityDiscoveryId
|
||||||
) {
|
) {
|
||||||
(
|
(
|
||||||
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", seed)),
|
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", seed)),
|
||||||
@@ -203,12 +250,13 @@ pub fn get_authority_keys_from_seed(seed: &str) -> (
|
|||||||
get_from_seed::<GrandpaId>(seed),
|
get_from_seed::<GrandpaId>(seed),
|
||||||
get_from_seed::<ImOnlineId>(seed),
|
get_from_seed::<ImOnlineId>(seed),
|
||||||
get_from_seed::<ValidatorId>(seed),
|
get_from_seed::<ValidatorId>(seed),
|
||||||
|
get_from_seed::<AuthorityDiscoveryId>(seed),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to create GenesisConfig for testing
|
/// Helper function to create GenesisConfig for testing
|
||||||
pub fn testnet_genesis(
|
pub fn testnet_genesis(
|
||||||
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId)>,
|
initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ImOnlineId, ValidatorId, AuthorityDiscoveryId)>,
|
||||||
root_key: AccountId,
|
root_key: AccountId,
|
||||||
endowed_accounts: Option<Vec<AccountId>>,
|
endowed_accounts: Option<Vec<AccountId>>,
|
||||||
) -> GenesisConfig {
|
) -> GenesisConfig {
|
||||||
@@ -247,7 +295,7 @@ pub fn testnet_genesis(
|
|||||||
session: Some(SessionConfig {
|
session: Some(SessionConfig {
|
||||||
keys: initial_authorities.iter().map(|x| (
|
keys: initial_authorities.iter().map(|x| (
|
||||||
x.0.clone(),
|
x.0.clone(),
|
||||||
session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone()),
|
session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone(), x.6.clone()),
|
||||||
)).collect::<Vec<_>>(),
|
)).collect::<Vec<_>>(),
|
||||||
}),
|
}),
|
||||||
staking: Some(StakingConfig {
|
staking: Some(StakingConfig {
|
||||||
@@ -275,6 +323,9 @@ pub fn testnet_genesis(
|
|||||||
babe: Some(Default::default()),
|
babe: Some(Default::default()),
|
||||||
grandpa: Some(Default::default()),
|
grandpa: Some(Default::default()),
|
||||||
im_online: Some(Default::default()),
|
im_online: Some(Default::default()),
|
||||||
|
authority_discovery: Some(AuthorityDiscoveryConfig {
|
||||||
|
keys: vec![],
|
||||||
|
}),
|
||||||
parachains: Some(ParachainsConfig {
|
parachains: Some(ParachainsConfig {
|
||||||
authorities: vec![],
|
authorities: vec![],
|
||||||
}),
|
}),
|
||||||
|
|||||||
+53
-13
@@ -26,7 +26,6 @@ use polkadot_primitives::{parachain, Hash, BlockId};
|
|||||||
use polkadot_runtime::GenesisConfig;
|
use polkadot_runtime::GenesisConfig;
|
||||||
use polkadot_network::{gossip::{self as network_gossip, Known}, validation::ValidationNetwork};
|
use polkadot_network::{gossip::{self as network_gossip, Known}, validation::ValidationNetwork};
|
||||||
use service::{error::{Error as ServiceError}, Configuration, ServiceBuilder};
|
use service::{error::{Error as ServiceError}, Configuration, ServiceBuilder};
|
||||||
use transaction_pool::txpool::{Pool as TransactionPool};
|
|
||||||
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
|
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
|
||||||
use inherents::InherentDataProviders;
|
use inherents::InherentDataProviders;
|
||||||
use log::info;
|
use log::info;
|
||||||
@@ -55,6 +54,9 @@ pub struct CustomConfiguration {
|
|||||||
|
|
||||||
/// Maximal `block_data` size.
|
/// Maximal `block_data` size.
|
||||||
pub max_block_data_size: Option<u64>,
|
pub max_block_data_size: Option<u64>,
|
||||||
|
|
||||||
|
/// Whether to enable or disable the authority discovery module.
|
||||||
|
pub authority_discovery_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CustomConfiguration {
|
impl Default for CustomConfiguration {
|
||||||
@@ -62,12 +64,13 @@ impl Default for CustomConfiguration {
|
|||||||
Self {
|
Self {
|
||||||
collating_for: None,
|
collating_for: None,
|
||||||
max_block_data_size: None,
|
max_block_data_size: None,
|
||||||
|
authority_discovery_enabled: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Chain API type for the transaction pool.
|
/// Chain API type for the transaction pool.
|
||||||
pub type TxChainApi<Backend, Executor> = transaction_pool::FullChainApi<
|
pub type TxChainApi<Backend, Executor> = txpool::FullChainApi<
|
||||||
client::Client<Backend, Executor, Block, RuntimeApi>,
|
client::Client<Backend, Executor, Block, RuntimeApi>,
|
||||||
Block,
|
Block,
|
||||||
>;
|
>;
|
||||||
@@ -86,9 +89,13 @@ macro_rules! new_full_start {
|
|||||||
.with_select_chain(|_, backend| {
|
.with_select_chain(|_, backend| {
|
||||||
Ok(client::LongestChain::new(backend.clone()))
|
Ok(client::LongestChain::new(backend.clone()))
|
||||||
})?
|
})?
|
||||||
.with_transaction_pool(|config, client|
|
.with_transaction_pool(|config, client, _fetcher| {
|
||||||
Ok(transaction_pool::txpool::Pool::new(config, transaction_pool::FullChainApi::new(client)))
|
let pool_api = txpool::FullChainApi::new(client.clone());
|
||||||
)?
|
let pool = txpool::BasicPool::new(config, pool_api);
|
||||||
|
let maintainer = txpool::FullBasicPoolMaintainer::new(pool.pool().clone(), client);
|
||||||
|
let maintainable_pool = txpool_api::MaintainableTransactionPool::new(pool, maintainer);
|
||||||
|
Ok(maintainable_pool)
|
||||||
|
})?
|
||||||
.with_import_queue(|_config, client, mut select_chain, _| {
|
.with_import_queue(|_config, client, mut select_chain, _| {
|
||||||
let select_chain = select_chain.take()
|
let select_chain = select_chain.take()
|
||||||
.ok_or_else(|| service::Error::SelectChainRequired)?;
|
.ok_or_else(|| service::Error::SelectChainRequired)?;
|
||||||
@@ -118,8 +125,9 @@ macro_rules! new_full_start {
|
|||||||
import_setup = Some((block_import, grandpa_link, babe_link));
|
import_setup = Some((block_import, grandpa_link, babe_link));
|
||||||
Ok(import_queue)
|
Ok(import_queue)
|
||||||
})?
|
})?
|
||||||
.with_rpc_extensions(|client, pool, _backend| -> polkadot_rpc::RpcExtension {
|
.with_rpc_extensions(|client, pool, _backend, _fetcher, _remote_blockchain|
|
||||||
polkadot_rpc::create(client, pool)
|
-> Result<polkadot_rpc::RpcExtension, _> {
|
||||||
|
Ok(polkadot_rpc::create_full(client, pool))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
(builder, import_setup, inherent_data_providers)
|
(builder, import_setup, inherent_data_providers)
|
||||||
@@ -143,6 +151,11 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
|
|||||||
>, ServiceError>
|
>, ServiceError>
|
||||||
{
|
{
|
||||||
use substrate_network::DhtEvent;
|
use substrate_network::DhtEvent;
|
||||||
|
use futures03::{
|
||||||
|
compat::Stream01CompatExt,
|
||||||
|
stream::StreamExt,
|
||||||
|
future::{FutureExt, TryFutureExt},
|
||||||
|
};
|
||||||
|
|
||||||
let is_collator = config.custom.collating_for.is_some();
|
let is_collator = config.custom.collating_for.is_some();
|
||||||
let is_authority = config.roles.is_authority() && !is_collator;
|
let is_authority = config.roles.is_authority() && !is_collator;
|
||||||
@@ -155,6 +168,7 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
|
|||||||
};
|
};
|
||||||
let disable_grandpa = config.disable_grandpa;
|
let disable_grandpa = config.disable_grandpa;
|
||||||
let name = config.name.clone();
|
let name = config.name.clone();
|
||||||
|
let authority_discovery_enabled = config.custom.authority_discovery_enabled;
|
||||||
|
|
||||||
// sentry nodes announce themselves as authorities to the network
|
// sentry nodes announce themselves as authorities to the network
|
||||||
// and should run the same protocols authorities do, but it should
|
// and should run the same protocols authorities do, but it should
|
||||||
@@ -168,7 +182,7 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
|
|||||||
// event per authority within the current authority set. This estimates the
|
// event per authority within the current authority set. This estimates the
|
||||||
// authority set size to be somewhere below 10 000 thereby setting the channel
|
// authority set size to be somewhere below 10 000 thereby setting the channel
|
||||||
// buffer size to 10 000.
|
// buffer size to 10 000.
|
||||||
let (dht_event_tx, _dht_event_rx) = mpsc::channel::<DhtEvent>(10000);
|
let (dht_event_tx, dht_event_rx) = mpsc::channel::<DhtEvent>(10000);
|
||||||
|
|
||||||
let service = builder
|
let service = builder
|
||||||
.with_network_protocol(|config| Ok(PolkadotProtocol::new(config.custom.collating_for.clone())))?
|
.with_network_protocol(|config| Ok(PolkadotProtocol::new(config.custom.collating_for.clone())))?
|
||||||
@@ -273,6 +287,21 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
|
|||||||
|
|
||||||
let babe = babe::start_babe(babe_config)?;
|
let babe = babe::start_babe(babe_config)?;
|
||||||
service.spawn_essential_task(babe);
|
service.spawn_essential_task(babe);
|
||||||
|
|
||||||
|
if authority_discovery_enabled {
|
||||||
|
let future03_dht_event_rx = dht_event_rx.compat()
|
||||||
|
.map(|x| x.expect("<mpsc::channel::Receiver as Stream> never returns an error; qed"))
|
||||||
|
.boxed();
|
||||||
|
let authority_discovery = authority_discovery::AuthorityDiscovery::new(
|
||||||
|
service.client(),
|
||||||
|
service.network(),
|
||||||
|
service.keystore(),
|
||||||
|
future03_dht_event_rx,
|
||||||
|
);
|
||||||
|
let future01_authority_discovery = authority_discovery.map(|x| Ok(x)).compat();
|
||||||
|
|
||||||
|
service.spawn_task(future01_authority_discovery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
@@ -337,9 +366,15 @@ pub fn new_light(config: Configuration<CustomConfiguration, GenesisConfig>)
|
|||||||
.with_select_chain(|_, backend| {
|
.with_select_chain(|_, backend| {
|
||||||
Ok(LongestChain::new(backend.clone()))
|
Ok(LongestChain::new(backend.clone()))
|
||||||
})?
|
})?
|
||||||
.with_transaction_pool(|config, client|
|
.with_transaction_pool(|config, client, fetcher| {
|
||||||
Ok(TransactionPool::new(config, transaction_pool::FullChainApi::new(client)))
|
let fetcher = fetcher
|
||||||
)?
|
.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
|
||||||
|
let pool_api = txpool::LightChainApi::new(client.clone(), fetcher.clone());
|
||||||
|
let pool = txpool::BasicPool::new(config, pool_api);
|
||||||
|
let maintainer = txpool::LightBasicPoolMaintainer::with_defaults(pool.pool().clone(), client, fetcher);
|
||||||
|
let maintainable_pool = txpool_api::MaintainableTransactionPool::new(pool, maintainer);
|
||||||
|
Ok(maintainable_pool)
|
||||||
|
})?
|
||||||
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _| {
|
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _| {
|
||||||
let fetch_checker = fetcher
|
let fetch_checker = fetcher
|
||||||
.map(|fetcher| fetcher.checker().clone())
|
.map(|fetcher| fetcher.checker().clone())
|
||||||
@@ -376,8 +411,13 @@ pub fn new_light(config: Configuration<CustomConfiguration, GenesisConfig>)
|
|||||||
.with_finality_proof_provider(|client, backend|
|
.with_finality_proof_provider(|client, backend|
|
||||||
Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, client)) as _)
|
Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, client)) as _)
|
||||||
)?
|
)?
|
||||||
.with_rpc_extensions(|client, pool, _backend| -> polkadot_rpc::RpcExtension {
|
.with_rpc_extensions(|client, pool, _backend, fetcher, remote_blockchain|
|
||||||
polkadot_rpc::create(client, pool)
|
-> Result<polkadot_rpc::RpcExtension, _> {
|
||||||
|
let fetcher = fetcher
|
||||||
|
.ok_or_else(|| "Trying to start node RPC without active fetcher")?;
|
||||||
|
let remote_blockchain = remote_blockchain
|
||||||
|
.ok_or_else(|| "Trying to start node RPC without active remote blockchain")?;
|
||||||
|
Ok(polkadot_rpc::create_light(client, remote_blockchain, fetcher, pool))
|
||||||
})?
|
})?
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-statement-table"
|
name = "polkadot-statement-table"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "adder"
|
name = "adder"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Test parachain which adds to a number as its state transition"
|
description = "Test parachain which adds to a number as its state transition"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "halt"
|
name = "halt"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
description = "Test parachain which executes forever"
|
description = "Test parachain which executes forever"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "polkadot-validation"
|
name = "polkadot-validation"
|
||||||
version = "0.6.17"
|
version = "0.7.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
@@ -25,8 +25,9 @@ grandpa = { package = "substrate-finality-grandpa", git = "https://github.com/pa
|
|||||||
inherents = { package = "substrate-inherents", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
inherents = { package = "substrate-inherents", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
consensus = { package = "substrate-consensus-common", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
consensus = { package = "substrate-consensus-common", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
transaction_pool = { package = "substrate-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
txpool-api = { package = "sp-transaction-pool-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
client = { package = "substrate-client-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
|
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
sr-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
sr-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
block-builder = { package = "substrate-block-builder", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
block-builder = { package = "substrate-block-builder", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||||
|
|||||||
@@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
use std::{thread, time::{Duration, Instant}, sync::Arc};
|
use std::{thread, time::{Duration, Instant}, sync::Arc};
|
||||||
|
|
||||||
use client::{error::Result as ClientResult, BlockchainEvents, BlockBody};
|
use client::{BlockchainEvents, BlockBody};
|
||||||
|
use sp_blockchain::{HeaderBackend, Result as ClientResult};
|
||||||
use block_builder::BlockBuilderApi;
|
use block_builder::BlockBuilderApi;
|
||||||
use client::blockchain::HeaderBackend;
|
|
||||||
use consensus::SelectChain;
|
use consensus::SelectChain;
|
||||||
use availability_store::Store as AvailabilityStore;
|
use availability_store::Store as AvailabilityStore;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
@@ -127,7 +127,7 @@ pub(crate) fn start<C, N, P, SC>(
|
|||||||
P::Api: ParachainHost<Block> +
|
P::Api: ParachainHost<Block> +
|
||||||
BlockBuilderApi<Block> +
|
BlockBuilderApi<Block> +
|
||||||
BabeApi<Block> +
|
BabeApi<Block> +
|
||||||
ApiExt<Block, Error = client::error::Error>,
|
ApiExt<Block, Error = sp_blockchain::Error>,
|
||||||
N: Network + Send + Sync + 'static,
|
N: Network + Send + Sync + 'static,
|
||||||
N::TableRouter: Send + 'static,
|
N::TableRouter: Send + 'static,
|
||||||
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ impl<C: Collators, P> CollationFetch<C, P> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<C: Collators, P: ProvideRuntimeApi> Future for CollationFetch<C, P>
|
impl<C: Collators, P: ProvideRuntimeApi> Future for CollationFetch<C, P>
|
||||||
where P::Api: ParachainHost<Block, Error = client::error::Error>,
|
where P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
|
||||||
{
|
{
|
||||||
type Item = (Collation, OutgoingMessages);
|
type Item = (Collation, OutgoingMessages);
|
||||||
type Error = C::Error;
|
type Error = C::Error;
|
||||||
@@ -142,7 +142,7 @@ impl<C: Collators, P: ProvideRuntimeApi> Future for CollationFetch<C, P>
|
|||||||
#[derive(Debug, derive_more::Display, derive_more::From)]
|
#[derive(Debug, derive_more::Display, derive_more::From)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Client error
|
/// Client error
|
||||||
Client(client::error::Error),
|
Client(sp_blockchain::Error),
|
||||||
/// Wasm validation error
|
/// Wasm validation error
|
||||||
WasmValidation(wasm_executor::Error),
|
WasmValidation(wasm_executor::Error),
|
||||||
/// Collated for inactive parachain
|
/// Collated for inactive parachain
|
||||||
@@ -393,7 +393,7 @@ pub fn validate_collation<P>(
|
|||||||
max_block_data_size: Option<u64>,
|
max_block_data_size: Option<u64>,
|
||||||
) -> Result<OutgoingMessages, Error> where
|
) -> Result<OutgoingMessages, Error> where
|
||||||
P: ProvideRuntimeApi,
|
P: ProvideRuntimeApi,
|
||||||
P::Api: ParachainHost<Block, Error = client::error::Error>,
|
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
|
||||||
{
|
{
|
||||||
use parachain::{IncomingMessage, ValidationParams};
|
use parachain::{IncomingMessage, ValidationParams};
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use polkadot_primitives::parachain::ValidatorId;
|
|||||||
#[derive(Debug, derive_more::Display, derive_more::From)]
|
#[derive(Debug, derive_more::Display, derive_more::From)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Client error
|
/// Client error
|
||||||
Client(client::error::Error),
|
Client(sp_blockchain::Error),
|
||||||
/// Consensus error
|
/// Consensus error
|
||||||
Consensus(consensus::error::Error),
|
Consensus(consensus::error::Error),
|
||||||
#[display(fmt = "Invalid duty roster length: expected {}, got {}", expected, got)]
|
#[display(fmt = "Invalid duty roster length: expected {}, got {}", expected, got)]
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ pub type Result<T> = std::result::Result<T, Error>;
|
|||||||
#[derive(Debug, derive_more::Display, derive_more::From)]
|
#[derive(Debug, derive_more::Display, derive_more::From)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Client error
|
/// Client error
|
||||||
Client(client::error::Error),
|
Client(sp_blockchain::Error),
|
||||||
/// Too many parachain candidates in proposal
|
/// Too many parachain candidates in proposal
|
||||||
#[display(fmt = "Proposal included {} candidates for {} parachains", expected, got)]
|
#[display(fmt = "Proposal included {} candidates for {} parachains", expected, got)]
|
||||||
TooManyCandidates { expected: usize, got: usize },
|
TooManyCandidates { expected: usize, got: usize },
|
||||||
|
|||||||
@@ -40,9 +40,8 @@ use std::{
|
|||||||
|
|
||||||
use babe_primitives::BabeApi;
|
use babe_primitives::BabeApi;
|
||||||
use client::{BlockchainEvents, BlockBody};
|
use client::{BlockchainEvents, BlockBody};
|
||||||
use client::blockchain::HeaderBackend;
|
use sp_blockchain::HeaderBackend;
|
||||||
use block_builder::BlockBuilderApi;
|
use block_builder::BlockBuilderApi;
|
||||||
use client::error as client_error;
|
|
||||||
use codec::Encode;
|
use codec::Encode;
|
||||||
use consensus::SelectChain;
|
use consensus::SelectChain;
|
||||||
use availability_store::Store as AvailabilityStore;
|
use availability_store::Store as AvailabilityStore;
|
||||||
@@ -57,7 +56,7 @@ use primitives::Pair;
|
|||||||
use runtime_primitives::traits::{ProvideRuntimeApi, DigestFor};
|
use runtime_primitives::traits::{ProvideRuntimeApi, DigestFor};
|
||||||
use futures_timer::Delay;
|
use futures_timer::Delay;
|
||||||
use async_std::stream::{interval, Interval};
|
use async_std::stream::{interval, Interval};
|
||||||
use transaction_pool::txpool::{Pool, ChainApi as PoolChainApi};
|
use txpool_api::{TransactionPool, InPoolTransaction};
|
||||||
|
|
||||||
use attestation_service::ServiceHandle;
|
use attestation_service::ServiceHandle;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
@@ -258,7 +257,7 @@ impl<C, N, P> ParachainValidation<C, N, P> where
|
|||||||
C: Collators + Send + 'static,
|
C: Collators + Send + 'static,
|
||||||
N: Network,
|
N: Network,
|
||||||
P: ProvideRuntimeApi + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
P: ProvideRuntimeApi + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
||||||
P::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = client_error::Error>,
|
P::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = sp_blockchain::Error>,
|
||||||
<C::Collation as IntoFuture>::Future: Send + 'static,
|
<C::Collation as IntoFuture>::Future: Send + 'static,
|
||||||
N::TableRouter: Send + 'static,
|
N::TableRouter: Send + 'static,
|
||||||
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
||||||
@@ -427,9 +426,9 @@ struct AttestationTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Polkadot proposer factory.
|
/// Polkadot proposer factory.
|
||||||
pub struct ProposerFactory<C, N, P, SC, TxApi: PoolChainApi> {
|
pub struct ProposerFactory<C, N, P, SC, TxPool: TransactionPool> {
|
||||||
parachain_validation: Arc<ParachainValidation<C, N, P>>,
|
parachain_validation: Arc<ParachainValidation<C, N, P>>,
|
||||||
transaction_pool: Arc<Pool<TxApi>>,
|
transaction_pool: Arc<TxPool>,
|
||||||
keystore: KeyStorePtr,
|
keystore: KeyStorePtr,
|
||||||
_service_handle: ServiceHandle,
|
_service_handle: ServiceHandle,
|
||||||
babe_slot_duration: u64,
|
babe_slot_duration: u64,
|
||||||
@@ -437,7 +436,7 @@ pub struct ProposerFactory<C, N, P, SC, TxApi: PoolChainApi> {
|
|||||||
max_block_data_size: Option<u64>,
|
max_block_data_size: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, N, P, SC, TxApi> ProposerFactory<C, N, P, SC, TxApi> where
|
impl<C, N, P, SC, TxPool> ProposerFactory<C, N, P, SC, TxPool> where
|
||||||
C: Collators + Send + Sync + 'static,
|
C: Collators + Send + Sync + 'static,
|
||||||
<C::Collation as IntoFuture>::Future: Send + 'static,
|
<C::Collation as IntoFuture>::Future: Send + 'static,
|
||||||
P: BlockchainEvents<Block> + BlockBody<Block>,
|
P: BlockchainEvents<Block> + BlockBody<Block>,
|
||||||
@@ -445,11 +444,11 @@ impl<C, N, P, SC, TxApi> ProposerFactory<C, N, P, SC, TxApi> where
|
|||||||
P::Api: ParachainHost<Block> +
|
P::Api: ParachainHost<Block> +
|
||||||
BlockBuilderApi<Block> +
|
BlockBuilderApi<Block> +
|
||||||
BabeApi<Block> +
|
BabeApi<Block> +
|
||||||
ApiExt<Block, Error = client_error::Error>,
|
ApiExt<Block, Error = sp_blockchain::Error>,
|
||||||
N: Network + Send + Sync + 'static,
|
N: Network + Send + Sync + 'static,
|
||||||
N::TableRouter: Send + 'static,
|
N::TableRouter: Send + 'static,
|
||||||
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
||||||
TxApi: PoolChainApi,
|
TxPool: TransactionPool,
|
||||||
SC: SelectChain<Block> + 'static,
|
SC: SelectChain<Block> + 'static,
|
||||||
{
|
{
|
||||||
/// Create a new proposer factory.
|
/// Create a new proposer factory.
|
||||||
@@ -458,7 +457,7 @@ impl<C, N, P, SC, TxApi> ProposerFactory<C, N, P, SC, TxApi> where
|
|||||||
_select_chain: SC,
|
_select_chain: SC,
|
||||||
network: N,
|
network: N,
|
||||||
collators: C,
|
collators: C,
|
||||||
transaction_pool: Arc<Pool<TxApi>>,
|
transaction_pool: Arc<TxPool>,
|
||||||
thread_pool: TaskExecutor,
|
thread_pool: TaskExecutor,
|
||||||
keystore: KeyStorePtr,
|
keystore: KeyStorePtr,
|
||||||
availability_store: AvailabilityStore,
|
availability_store: AvailabilityStore,
|
||||||
@@ -496,21 +495,21 @@ impl<C, N, P, SC, TxApi> ProposerFactory<C, N, P, SC, TxApi> where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, N, P, SC, TxApi> consensus::Environment<Block> for ProposerFactory<C, N, P, SC, TxApi> where
|
impl<C, N, P, SC, TxPool> consensus::Environment<Block> for ProposerFactory<C, N, P, SC, TxPool> where
|
||||||
C: Collators + Send + 'static,
|
C: Collators + Send + 'static,
|
||||||
N: Network,
|
N: Network,
|
||||||
TxApi: PoolChainApi<Block=Block> + 'static,
|
TxPool: TransactionPool<Block=Block> + 'static,
|
||||||
P: ProvideRuntimeApi + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
P: ProvideRuntimeApi + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
||||||
P::Api: ParachainHost<Block> +
|
P::Api: ParachainHost<Block> +
|
||||||
BlockBuilderApi<Block> +
|
BlockBuilderApi<Block> +
|
||||||
BabeApi<Block> +
|
BabeApi<Block> +
|
||||||
ApiExt<Block, Error = client_error::Error>,
|
ApiExt<Block, Error = sp_blockchain::Error>,
|
||||||
<C::Collation as IntoFuture>::Future: Send + 'static,
|
<C::Collation as IntoFuture>::Future: Send + 'static,
|
||||||
N::TableRouter: Send + 'static,
|
N::TableRouter: Send + 'static,
|
||||||
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
|
||||||
SC: SelectChain<Block>,
|
SC: SelectChain<Block>,
|
||||||
{
|
{
|
||||||
type Proposer = Proposer<P, TxApi>;
|
type Proposer = Proposer<P, TxPool>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn init(
|
fn init(
|
||||||
@@ -545,7 +544,7 @@ pub struct LocalDuty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The Polkadot proposer logic.
|
/// The Polkadot proposer logic.
|
||||||
pub struct Proposer<C: Send + Sync, TxApi: PoolChainApi> where
|
pub struct Proposer<C: Send + Sync, TxPool: TransactionPool> where
|
||||||
C: ProvideRuntimeApi + HeaderBackend<Block>,
|
C: ProvideRuntimeApi + HeaderBackend<Block>,
|
||||||
{
|
{
|
||||||
client: Arc<C>,
|
client: Arc<C>,
|
||||||
@@ -553,17 +552,17 @@ pub struct Proposer<C: Send + Sync, TxApi: PoolChainApi> where
|
|||||||
parent_id: BlockId,
|
parent_id: BlockId,
|
||||||
parent_number: BlockNumber,
|
parent_number: BlockNumber,
|
||||||
tracker: Arc<AttestationTracker>,
|
tracker: Arc<AttestationTracker>,
|
||||||
transaction_pool: Arc<Pool<TxApi>>,
|
transaction_pool: Arc<TxPool>,
|
||||||
slot_duration: u64,
|
slot_duration: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, TxApi> consensus::Proposer<Block> for Proposer<C, TxApi> where
|
impl<C, TxPool> consensus::Proposer<Block> for Proposer<C, TxPool> where
|
||||||
TxApi: PoolChainApi<Block=Block> + 'static,
|
TxPool: TransactionPool<Block=Block> + 'static,
|
||||||
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
|
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
|
||||||
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = client_error::Error>,
|
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = sp_blockchain::Error>,
|
||||||
{
|
{
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Create = Either<CreateProposal<C, TxApi>, future::Ready<Result<Block, Error>>>;
|
type Create = Either<CreateProposal<C, TxPool>, future::Ready<Result<Block, Error>>>;
|
||||||
|
|
||||||
fn propose(&mut self,
|
fn propose(&mut self,
|
||||||
inherent_data: InherentData,
|
inherent_data: InherentData,
|
||||||
@@ -688,14 +687,14 @@ impl ProposalTiming {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future which resolves upon the creation of a proposal.
|
/// Future which resolves upon the creation of a proposal.
|
||||||
pub struct CreateProposal<C: Send + Sync, TxApi: PoolChainApi> {
|
pub struct CreateProposal<C: Send + Sync, TxPool> {
|
||||||
state: CreateProposalState<C, TxApi>,
|
state: CreateProposalState<C, TxPool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Current status of the proposal future.
|
/// Current status of the proposal future.
|
||||||
enum CreateProposalState<C: Send + Sync, TxApi: PoolChainApi> {
|
enum CreateProposalState<C: Send + Sync, TxPool> {
|
||||||
/// Pending inclusion, with given proposal data.
|
/// Pending inclusion, with given proposal data.
|
||||||
Pending(CreateProposalData<C, TxApi>),
|
Pending(CreateProposalData<C, TxPool>),
|
||||||
/// Represents the state when we switch from pending to fired.
|
/// Represents the state when we switch from pending to fired.
|
||||||
Switching,
|
Switching,
|
||||||
/// Block proposing has fired.
|
/// Block proposing has fired.
|
||||||
@@ -703,12 +702,12 @@ enum CreateProposalState<C: Send + Sync, TxApi: PoolChainApi> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Inner data of the create proposal.
|
/// Inner data of the create proposal.
|
||||||
struct CreateProposalData<C: Send + Sync, TxApi: PoolChainApi> {
|
struct CreateProposalData<C: Send + Sync, TxPool> {
|
||||||
parent_hash: Hash,
|
parent_hash: Hash,
|
||||||
parent_number: BlockNumber,
|
parent_number: BlockNumber,
|
||||||
parent_id: BlockId,
|
parent_id: BlockId,
|
||||||
client: Arc<C>,
|
client: Arc<C>,
|
||||||
transaction_pool: Arc<Pool<TxApi>>,
|
transaction_pool: Arc<TxPool>,
|
||||||
table: Arc<SharedTable>,
|
table: Arc<SharedTable>,
|
||||||
timing: ProposalTiming,
|
timing: ProposalTiming,
|
||||||
believed_minimum_timestamp: u64,
|
believed_minimum_timestamp: u64,
|
||||||
@@ -717,10 +716,10 @@ struct CreateProposalData<C: Send + Sync, TxApi: PoolChainApi> {
|
|||||||
deadline: Instant,
|
deadline: Instant,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, TxApi> CreateProposalData<C, TxApi> where
|
impl<C, TxPool> CreateProposalData<C, TxPool> where
|
||||||
TxApi: PoolChainApi<Block=Block>,
|
TxPool: TransactionPool<Block=Block>,
|
||||||
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync,
|
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync,
|
||||||
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = client_error::Error>,
|
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = sp_blockchain::Error>,
|
||||||
{
|
{
|
||||||
fn propose_with(mut self, candidates: Vec<AttestedCandidate>) -> Result<Block, Error> {
|
fn propose_with(mut self, candidates: Vec<AttestedCandidate>) -> Result<Block, Error> {
|
||||||
use block_builder::BlockBuilder;
|
use block_builder::BlockBuilder;
|
||||||
@@ -755,7 +754,7 @@ impl<C, TxApi> CreateProposalData<C, TxApi> where
|
|||||||
|
|
||||||
let ready_iter = self.transaction_pool.ready();
|
let ready_iter = self.transaction_pool.ready();
|
||||||
for ready in ready_iter.take(MAX_TRANSACTIONS) {
|
for ready in ready_iter.take(MAX_TRANSACTIONS) {
|
||||||
let encoded_size = ready.data.encode().len();
|
let encoded_size = ready.data().encode().len();
|
||||||
if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE {
|
if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -764,18 +763,20 @@ impl<C, TxApi> CreateProposalData<C, TxApi> where
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
match block_builder.push(ready.data.clone()) {
|
match block_builder.push(ready.data().clone()) {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
debug!("[{:?}] Pushed to the block.", ready.hash);
|
debug!("[{:?}] Pushed to the block.", ready.hash());
|
||||||
pending_size += encoded_size;
|
pending_size += encoded_size;
|
||||||
}
|
}
|
||||||
Err(client_error::Error::ApplyExtrinsicFailed(e)) if e.exhausted_resources() => {
|
Err(sp_blockchain::Error::ApplyExtrinsicFailed(sp_blockchain::ApplyExtrinsicFailed::Validity(e)))
|
||||||
|
if e.exhausted_resources() =>
|
||||||
|
{
|
||||||
debug!("Block is full, proceed with proposing.");
|
debug!("Block is full, proceed with proposing.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
trace!(target: "transaction-pool", "Invalid transaction: {}", e);
|
trace!(target: "transaction-pool", "Invalid transaction: {}", e);
|
||||||
unqueue_invalid.push(ready.hash.clone());
|
unqueue_invalid.push(ready.hash().clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -809,10 +810,10 @@ impl<C, TxApi> CreateProposalData<C, TxApi> where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, TxApi> futures03::Future for CreateProposal<C, TxApi> where
|
impl<C, TxPool> futures03::Future for CreateProposal<C, TxPool> where
|
||||||
TxApi: PoolChainApi<Block=Block> + 'static,
|
TxPool: TransactionPool<Block=Block> + 'static,
|
||||||
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
|
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
|
||||||
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = client_error::Error>,
|
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = sp_blockchain::Error>,
|
||||||
{
|
{
|
||||||
type Output = Result<Block, Error>;
|
type Output = Result<Block, Error>;
|
||||||
|
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ impl<Fetch: Future> ParachainWork<Fetch> {
|
|||||||
>
|
>
|
||||||
where
|
where
|
||||||
P: Send + Sync + 'static,
|
P: Send + Sync + 'static,
|
||||||
P::Api: ParachainHost<Block, Error = client::error::Error>,
|
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
|
||||||
{
|
{
|
||||||
let max_block_data_size = self.max_block_data_size;
|
let max_block_data_size = self.max_block_data_size;
|
||||||
let validate = move |id: &_, collation: &_| {
|
let validate = move |id: &_, collation: &_| {
|
||||||
|
|||||||
Reference in New Issue
Block a user