Reduce Westend deposit requirements (#1341)

* Switch branch

* Return chain ops parts in new_chain_ops

* Remove where param from new_chain_ops

* Add task manager to new_chain_ops return

* Revert branch switch

* Revert "Revert branch switch"

This reverts commit 7c7900c047abd794ddc759aa092811db4961a7a6.

* network/test/src/lib: Adjust network worker polling

Companion for https://github.com/paritytech/substrate/pull/6552.

* Fix adder parachain

* Fix collator tests

* Revert branch switch

* Bump everything

- Remove old migration code
- Reduce deposit requried for westend

* Reapply fixes

* Bump locl

* Fix for #6550

* Fix message

Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
Gavin Wood
2020-07-03 15:35:36 +02:00
committed by GitHub
parent e7bb3aef39
commit 79954ae589
34 changed files with 299 additions and 222 deletions
+171 -156
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -4,7 +4,7 @@ path = "src/main.rs"
[package]
name = "polkadot"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "polkadot-availability-store"
description = "Persistent database for parachain data"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-cli"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot Relay-chain Client Node"
edition = "2018"
+6 -6
View File
@@ -30,19 +30,19 @@ fn get_exec_name() -> Option<String> {
}
impl SubstrateCli for Cli {
fn impl_name() -> &'static str { "Parity Polkadot" }
fn impl_name() -> String { "Parity Polkadot".into() }
fn impl_version() -> &'static str { env!("SUBSTRATE_CLI_IMPL_VERSION") }
fn impl_version() -> String { env!("SUBSTRATE_CLI_IMPL_VERSION").into() }
fn description() -> &'static str { env!("CARGO_PKG_DESCRIPTION") }
fn description() -> String { env!("CARGO_PKG_DESCRIPTION").into() }
fn author() -> &'static str { env!("CARGO_PKG_AUTHORS") }
fn author() -> String { env!("CARGO_PKG_AUTHORS").into() }
fn support_url() -> &'static str { "https://github.com/paritytech/polkadot/issues/new" }
fn support_url() -> String { "https://github.com/paritytech/polkadot/issues/new".into() }
fn copyright_start_year() -> i32 { 2017 }
fn executable_name() -> &'static str { "polkadot" }
fn executable_name() -> String { "polkadot".into() }
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
let id = if id == "" {
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-collator"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Collator node implementation"
edition = "2018"
+16 -12
View File
@@ -373,12 +373,15 @@ fn build_collator_service<P, C, R, Extrinsic>(
/// Async function that will run the collator node with the given `RelayChainContext` and `ParachainContext`
/// built by the given `BuildParachainContext` and arguments to the underlying polkadot node.
pub async fn start_collator<P>(
pub fn start_collator<P>(
build_parachain_context: P,
para_id: ParaId,
key: Arc<CollatorPair>,
config: Configuration,
) -> Result<(), polkadot_service::Error>
) -> Result<
(Pin<Box<dyn Future<Output = ()> + Send>>, sc_service::TaskManager),
polkadot_service::Error
>
where
P: 'static + BuildParachainContext,
P::ParachainContext: Send + 'static,
@@ -400,14 +403,15 @@ where
None,
)?;
let spawn_handle = task_manager.spawn_handle();
build_collator_service(
let future = build_collator_service(
spawn_handle,
handlers,
client,
para_id,
key,
build_parachain_context
)?.await;
)?;
Ok((future.boxed(), task_manager))
} else if config.chain_spec.is_westend() {
let (task_manager, client, handlers) = service::westend_new_full(
config,
@@ -418,14 +422,15 @@ where
None,
)?;
let spawn_handle = task_manager.spawn_handle();
build_collator_service(
let future = build_collator_service(
spawn_handle,
handlers,
client,
para_id,
key,
build_parachain_context
)?.await;
)?;
Ok((future.boxed(), task_manager))
} else {
let (task_manager, client, handles) = service::polkadot_new_full(
config,
@@ -436,17 +441,16 @@ where
None,
)?;
let spawn_handle = task_manager.spawn_handle();
build_collator_service(
let future = build_collator_service(
spawn_handle,
handles,
client,
para_id,
key,
build_parachain_context,
)?.await;
build_parachain_context
)?;
Ok((future.boxed(), task_manager))
}
Ok(())
}
#[cfg(not(feature = "service-rewr"))]
@@ -506,7 +510,7 @@ mod tests {
fn check_send<T: Send>(_: T) {}
let cli = Cli::from_iter(&["-dev"]);
let task_executor = |_, _| unimplemented!();
let task_executor = |_, _| {};
let config = cli.create_configuration(&cli.run.base, task_executor.into()).unwrap();
check_send(start_collator(
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-erasure-coding"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-network"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot-specific networking protocol"
edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-network-test"
version = "0.8.13"
version = "0.8.14"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
+3 -3
View File
@@ -758,13 +758,13 @@ pub trait TestNetFactory: Sized {
futures::executor::block_on(futures::future::poll_fn::<(), _>(|cx| self.poll_until_idle(cx)));
}
/// Polls the testnet. Processes all the pending actions and returns `NotReady`.
/// Polls the testnet. Processes all the pending actions.
fn poll(&mut self, cx: &mut FutureContext) {
self.mut_peers(|peers| {
for peer in peers {
trace!(target: "sync", "-- Polling {}", peer.id());
if let Poll::Ready(res) = Pin::new(&mut peer.network).poll(cx) {
res.unwrap();
if let Poll::Ready(()) = peer.network.poll_unpin(cx) {
panic!("NetworkWorker has terminated unexpectedly.")
}
trace!(target: "sync", "-- Polling complete {}", peer.id());
+1
View File
@@ -31,6 +31,7 @@ sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "mas
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa_primitives = { package = "sp-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
+13 -5
View File
@@ -34,10 +34,11 @@ use polkadot_subsystem::{
Subsystem, SubsystemContext, SpawnedSubsystem,
messages::{CandidateValidationMessage, CandidateBackingMessage},
};
use sp_trie::PrefixedMemoryDB;
pub use service::{
Role, PruningMode, TransactionPoolOptions, Error, RuntimeGenesis,
TFullClient, TLightClient, TFullBackend, TLightBackend, TFullCallExecutor, TLightCallExecutor,
Configuration, ChainSpec, ServiceBuilderCommand, ServiceComponents, TaskManager,
Configuration, ChainSpec, ServiceComponents, TaskManager,
};
pub use service::config::{DatabaseConfig, PrometheusConfig};
pub use sc_executor::NativeExecutionDispatch;
@@ -576,18 +577,25 @@ macro_rules! new_light {
}
/// Builds a new object suitable for chain operations.
pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration)
-> Result<impl ServiceBuilderCommand<Block=Block>, ServiceError>
pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
(
Arc<service::TFullClient<Block, Runtime, Dispatch>>,
Arc<TFullBackend<Block>>,
consensus_common::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
TaskManager,
),
ServiceError
>
where
Runtime: ConstructRuntimeApi<Block, service::TFullClient<Block, Runtime, Dispatch>> + Send + Sync + 'static,
Runtime::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<TFullBackend<Block>, Block>>,
Dispatch: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
<Runtime::RuntimeApi as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
config.keystore = service::config::KeystoreConfig::InMemory;
Ok(new_full_start!(config, Runtime, Dispatch).0)
let (builder, _, _, _) = new_full_start!(config, Runtime, Dispatch);
Ok(builder.to_chain_ops_parts())
}
/// Create a new Polkadot service for a full node.
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-parachain"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Types and utilities for creating and working with parachains"
edition = "2018"
@@ -1,6 +1,6 @@
[package]
name = "test-parachain-adder"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which adds to a number as its state transition"
edition = "2018"
@@ -28,7 +28,7 @@ use primitives::{
};
use collator::{ParachainContext, Network, BuildParachainContext, Cli, SubstrateCli};
use parking_lot::Mutex;
use futures::future::{Ready, ready, TryFutureExt};
use futures::future::{Ready, ready, FutureExt};
const GENESIS: AdderHead = AdderHead {
number: 0,
@@ -135,12 +135,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let cli = Cli::from_iter(&["-dev"]);
let runner = cli.create_runner(&cli.run.base)?;
runner.async_run(|config| {
collator::start_collator(
let (future, task_manager) = collator::start_collator(
context,
id,
key,
config,
).map_err(|e| e.into())
)?;
Ok((future.map(Ok), task_manager))
})?;
Ok(())
@@ -1,6 +1,6 @@
[package]
name = "test-parachain-halt"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which executes forever"
edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-primitives"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-rpc"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-runtime-common"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
+1 -1
View File
@@ -333,7 +333,7 @@ pub trait Trait: CreateSignedTransaction<Call<Self>> + attestations::Trait + ses
}
/// Origin for the parachains module.
#[derive(PartialEq, Eq, Clone)]
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
#[cfg_attr(feature = "std", derive(Debug))]
pub enum Origin {
/// It comes from a parachain.
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "kusama-runtime"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
+8 -2
View File
@@ -152,8 +152,10 @@ impl system::Trait for Runtime {
impl scheduler::Trait for Runtime {
type Event = Event;
type Origin = Origin;
type PalletsOrigin = OriginCaller;
type Call = Call;
type MaximumWeight = MaximumBlockWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
}
parameter_types! {
@@ -373,6 +375,7 @@ impl democracy::Trait for Runtime {
type PreimageByteDeposit = PreimageByteDeposit;
type Slash = Treasury;
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = MaxVotes;
type OperationalPreimageOrigin = collective::EnsureMember<AccountId, CouncilCollective>;
}
@@ -891,8 +894,11 @@ impl proxy::Trait for Runtime {
pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
treasury::Module::<Runtime>::migrate_retract_tip_for_tip_new();
500_000_000
if scheduler::Module::<Runtime>::migrate_v1_to_t2() {
<Runtime as system::Trait>::MaximumBlockWeight::get()
} else {
<Runtime as system::Trait>::DbWeight::get().reads(1) + 500_000_000
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-runtime"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
+22 -1
View File
@@ -183,8 +183,10 @@ impl system::Trait for Runtime {
impl scheduler::Trait for Runtime {
type Event = Event;
type Origin = Origin;
type PalletsOrigin = OriginCaller;
type Call = Call;
type MaximumWeight = MaximumBlockWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
}
parameter_types! {
@@ -442,6 +444,7 @@ impl democracy::Trait for Runtime {
type OperationalPreimageOrigin = collective::EnsureMember<AccountId, CouncilCollective>;
type Slash = Treasury;
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = MaxVotes;
}
@@ -893,6 +896,17 @@ impl proxy::Trait for Runtime {
type MaxProxies = MaxProxies;
}
pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
if scheduler::Module::<Runtime>::migrate_v1_to_t2() {
<Runtime as system::Trait>::MaximumBlockWeight::get()
} else {
<Runtime as system::Trait>::DbWeight::get().reads(1)
}
}
}
construct_runtime! {
pub enum Runtime where
Block = Block,
@@ -990,7 +1004,14 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signatu
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Nonce, Call>;
/// Executive: handles dispatch to the various modules.
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;
pub type Executive = executive::Executive<
Runtime,
Block,
system::ChainContext<Runtime>,
Runtime,
AllModules,
CustomOnRuntimeUpgrade
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-test-runtime"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "westend-runtime"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
+1 -1
View File
@@ -24,7 +24,7 @@ pub mod currency {
pub const MILLICENTS: Balance = CENTS / 1_000;
pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 20 * DOLLARS + (bytes as Balance) * 100 * MILLICENTS
items as Balance * 1 * DOLLARS + (bytes as Balance) * 5 * MILLICENTS
}
}
+4 -1
View File
@@ -58,6 +58,7 @@ use im_online::sr25519::AuthorityId as ImOnlineId;
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
use session::historical as session_historical;
use system::EnsureRoot;
#[cfg(feature = "std")]
pub use staking::StakerStatus;
@@ -141,8 +142,10 @@ impl system::Trait for Runtime {
impl scheduler::Trait for Runtime {
type Event = Event;
type Origin = Origin;
type PalletsOrigin = OriginCaller;
type Call = Call;
type MaximumWeight = MaximumBlockWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
}
parameter_types! {
@@ -288,7 +291,7 @@ impl staking::Trait for Runtime {
type BondingDuration = BondingDuration;
type SlashDeferDuration = SlashDeferDuration;
// A majority of the council can cancel the slash.
type SlashCancelOrigin = system::EnsureRoot<AccountId>;
type SlashCancelOrigin = EnsureRoot<AccountId>;
type SessionInterface = Self;
type RewardCurve = RewardCurve;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
+2 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-service"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
@@ -31,6 +31,7 @@ sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "mas
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa_primitives = { package = "sp-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
+13 -5
View File
@@ -29,10 +29,11 @@ use service::{error::Error as ServiceError, ServiceBuilder};
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
use sc_executor::native_executor_instance;
use log::info;
use sp_trie::PrefixedMemoryDB;
pub use service::{
Role, PruningMode, TransactionPoolOptions, Error, RuntimeGenesis, RpcHandlers,
TFullClient, TLightClient, TFullBackend, TLightBackend, TFullCallExecutor, TLightCallExecutor,
Configuration, ChainSpec, ServiceBuilderCommand, ServiceComponents, TaskManager,
Configuration, ChainSpec, ServiceComponents, TaskManager,
};
pub use service::config::{DatabaseConfig, PrometheusConfig};
pub use sc_executor::NativeExecutionDispatch;
@@ -634,18 +635,25 @@ macro_rules! new_light {
}
/// Builds a new object suitable for chain operations.
pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration)
-> Result<impl ServiceBuilderCommand<Block=Block>, ServiceError>
pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
(
Arc<service::TFullClient<Block, Runtime, Dispatch>>,
Arc<TFullBackend<Block>>,
consensus_common::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
TaskManager,
),
ServiceError
>
where
Runtime: ConstructRuntimeApi<Block, service::TFullClient<Block, Runtime, Dispatch>> + Send + Sync + 'static,
Runtime::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<TFullBackend<Block>, Block>>,
Dispatch: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
<Runtime::RuntimeApi as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
config.keystore = service::config::KeystoreConfig::InMemory;
Ok(new_full_start!(config, Runtime, Dispatch).0)
let (builder, _, _, _) = new_full_start!(config, Runtime, Dispatch);
Ok(builder.to_chain_ops_parts())
}
/// Create a new Polkadot service for a full node.
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-statement-table"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
+2 -1
View File
@@ -1,10 +1,11 @@
[package]
name = "polkadot-validation"
version = "0.8.13"
version = "0.8.14"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
ansi_term = "0.12.1"
futures = "0.3.4"
futures-timer = "2.0"
parking_lot = "0.9.0"
@@ -43,6 +43,7 @@ use sp_api::{ProvideRuntimeApi, ApiExt};
use runtime_primitives::traits::HashFor;
use availability_store::Store as AvailabilityStore;
use ansi_term::Colour;
use log::{warn, error, info, debug, trace};
use super::{Network, Collators, SharedTable, TableRouter};
@@ -373,12 +374,18 @@ impl<N, P, SP, CF> ParachainValidationInstances<N, P, SP, CF> where
sign_with.as_ref().map(|k| k.public()),
)?;
info!(
"Starting parachain attestation session on top of parent {:?}. Local parachain duty is {:?}",
parent_hash,
local_duty,
);
if let Some(ref duty) = local_duty {
info!(
"✍️ Starting parachain attestation session (parent: {}) with active duty {}",
parent_hash,
Colour::Red.bold().paint(format!("{:?}", duty)),
);
} else {
debug!(
"✍️ Starting parachain attestation session (parent: {}). No local duty..",
parent_hash,
);
}
let active_parachains = self.client.runtime_api().active_parachains(&id)?;
debug!(target: "validation", "Active parachains: {:?}", active_parachains);