Backport all v0.6 changes to master... (#552)

* Bump Substrate and versions (#531)

* Bump versions

* Build fix.

* Enable governance (#536)

* Enable governance

* Tweak a few parameters

* Bump substrate, versions. (#538)

* Bump substrate, versions.

* Build fix

* Bump rpc deps (#537)

* Update to latest sub

* Revert branch update

* Update.

* Update tests.

* Ignore warnings in tests.

* Revert substrate (#540)

* Version bump

* Bump Substrate, versions. (#542)

* Bump Substrate, versions.

Also revert the enabling of democracy

* Build fix

* Bump Substrate (#544)

* Bump Substrate

* Fix

* A few tidyups

* Bump Substrate (#547)

* Bump Substrate

* Another bump

* Fixed build for new block_import API

* Enable grandpa migration. (#549)

* Enable grandpa migration.

* Bump runtime version
This commit is contained in:
Gavin Wood
2019-11-08 11:49:04 +01:00
committed by Bastian Köcher
parent 88150e83d2
commit bd79b34bb3
21 changed files with 379 additions and 533 deletions
+328 -474
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] [package]
name = "polkadot" name = "polkadot"
version = "0.6.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs" build = "build.rs"
edition = "2018" edition = "2018"
+1 -1
View File
@@ -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.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-cli" name = "polkadot-cli"
version = "0.6.6" version = "0.6.10"
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 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-collator" name = "polkadot-collator"
version = "0.6.6" version = "0.6.10"
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 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-erasure-coding" name = "polkadot-erasure-coding"
version = "0.6.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-executor" name = "polkadot-executor"
version = "0.6.6" version = "0.6.10"
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 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-network" name = "polkadot-network"
version = "0.6.6" version = "0.6.10"
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"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-parachain" name = "polkadot-parachain"
version = "0.6.6" version = "0.6.10"
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 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-primitives" name = "polkadot-primitives"
version = "0.6.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-rpc" name = "polkadot-rpc"
version = "0.6.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-runtime" name = "polkadot-runtime"
version = "0.6.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
@@ -39,7 +39,7 @@ democracy = { package = "srml-democracy", git = "https://github.com/paritytech/s
elections-phragmen = { package = "srml-elections-phragmen", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" } elections-phragmen = { package = "srml-elections-phragmen", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
executive = { package = "srml-executive", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" } executive = { package = "srml-executive", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
finality-tracker = { package = "srml-finality-tracker", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" } finality-tracker = { package = "srml-finality-tracker", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
grandpa = { package = "srml-grandpa", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" } grandpa = { package = "srml-grandpa", git = "https://github.com/paritytech/substrate", default-features = false, features = ["migrate-authorities"], branch = "polkadot-master" }
im-online = { package = "srml-im-online", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" } im-online = { package = "srml-im-online", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
indices = { package = "srml-indices", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" } indices = { package = "srml-indices", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
membership = { package = "srml-membership", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" } membership = { package = "srml-membership", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
+15 -27
View File
@@ -67,8 +67,9 @@
//! funds ultimately end up in module's fund sub-account. //! funds ultimately end up in module's fund sub-account.
use srml_support::{ use srml_support::{
decl_module, decl_storage, decl_event, storage::child, ensure, decl_module, decl_storage, decl_event, storage::child, ensure, traits::{
traits::{Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement} Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement::AllowDeath
}
}; };
use system::ensure_signed; use system::ensure_signed;
use sr_primitives::{ModuleId, weights::SimpleDispatchInfo, use sr_primitives::{ModuleId, weights::SimpleDispatchInfo,
@@ -204,12 +205,8 @@ decl_module! {
ensure!(end > <system::Module<T>>::block_number(), "end must be in the future"); ensure!(end > <system::Module<T>>::block_number(), "end must be in the future");
let deposit = T::SubmissionDeposit::get(); let deposit = T::SubmissionDeposit::get();
let imb = T::Currency::withdraw( let transfer = WithdrawReason::Transfer.into();
&owner, let imb = T::Currency::withdraw(&owner, deposit, transfer, AllowDeath)?;
deposit,
WithdrawReason::Transfer.into(),
ExistenceRequirement::AllowDeath,
)?;
let index = FundCount::get(); let index = FundCount::get();
let next_index = index.checked_add(1).ok_or("overflow when adding fund")?; let next_index = index.checked_add(1).ok_or("overflow when adding fund")?;
@@ -250,7 +247,7 @@ decl_module! {
let now = <system::Module<T>>::block_number(); let now = <system::Module<T>>::block_number();
ensure!(fund.end > now, "contribution period ended"); ensure!(fund.end > now, "contribution period ended");
T::Currency::transfer(&who, &Self::fund_account_id(index), value)?; T::Currency::transfer(&who, &Self::fund_account_id(index), value, AllowDeath)?;
let balance = Self::contribution_get(index, &who); let balance = Self::contribution_get(index, &who);
let balance = balance.saturating_add(value); let balance = balance.saturating_add(value);
@@ -375,12 +372,10 @@ decl_module! {
ensure!(balance > Zero::zero(), "no contributions stored"); ensure!(balance > Zero::zero(), "no contributions stored");
// Avoid using transfer to ensure we don't pay any fees. // Avoid using transfer to ensure we don't pay any fees.
let _ = T::Currency::resolve_into_existing(&who, T::Currency::withdraw( let fund_account = &Self::fund_account_id(index);
&Self::fund_account_id(index), let transfer = WithdrawReason::Transfer.into();
balance, let imbalance = T::Currency::withdraw(fund_account, balance, transfer, AllowDeath)?;
WithdrawReason::Transfer.into(), let _ = T::Currency::resolve_into_existing(&who, imbalance);
ExistenceRequirement::AllowDeath
)?);
Self::contribution_kill(index, &who); Self::contribution_kill(index, &who);
fund.raised = fund.raised.saturating_sub(balance); fund.raised = fund.raised.saturating_sub(balance);
@@ -404,19 +399,12 @@ decl_module! {
let account = Self::fund_account_id(index); let account = Self::fund_account_id(index);
// Avoid using transfer to ensure we don't pay any fees. // Avoid using transfer to ensure we don't pay any fees.
let _ = T::Currency::resolve_into_existing(&fund.owner, T::Currency::withdraw( let transfer = WithdrawReason::Transfer.into();
&account, let imbalance = T::Currency::withdraw(&account, fund.deposit, transfer, AllowDeath)?;
fund.deposit, let _ = T::Currency::resolve_into_existing(&fund.owner, imbalance);
WithdrawReason::Transfer.into(),
ExistenceRequirement::AllowDeath
)?);
T::OrphanedFunds::on_unbalanced(T::Currency::withdraw( let imbalance = T::Currency::withdraw(&account, fund.raised, transfer, AllowDeath)?;
&account, T::OrphanedFunds::on_unbalanced(imbalance);
fund.raised,
WithdrawReason::Transfer.into(),
ExistenceRequirement::AllowDeath
)?);
Self::crowdfund_kill(index); Self::crowdfund_kill(index);
<Funds<T>>::remove(index); <Funds<T>>::remove(index);
+15 -11
View File
@@ -99,7 +99,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: 1, authoring_version: 1,
spec_version: 1012, spec_version: 1017,
impl_version: 0, impl_version: 0,
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
}; };
@@ -129,12 +129,9 @@ impl SignedExtension for OnlyStakingAndClaims {
-> TransactionValidity -> TransactionValidity
{ {
match call { match call {
Call::Staking(_) | Call::Claims(_) | Call::Sudo(_) | Call::Session(_) Call::Balances(_) | Call::Slots(_) | Call::Registrar(_) | Call::Democracy(_)
| Call::ElectionsPhragmen(_) | Call::TechnicalMembership(_) => Err(InvalidTransaction::Custom(ValidityError::NoPermission.into()).into()),
| Call::TechnicalCommittee(_) | Call::Nicks(_) _ => Ok(Default::default()),
=>
Ok(Default::default()),
_ => Err(InvalidTransaction::Custom(ValidityError::NoPermission.into()).into()),
} }
} }
} }
@@ -306,7 +303,7 @@ parameter_types! {
} }
impl staking::Trait for Runtime { impl staking::Trait for Runtime {
type OnRewardMinted = Treasury; type RewardRemainder = Treasury;
type CurrencyToVote = CurrencyToVoteHandler; type CurrencyToVote = CurrencyToVoteHandler;
type Event = Event; type Event = Event;
type Currency = Balances; type Currency = Balances;
@@ -323,7 +320,8 @@ parameter_types! {
// KUSAMA: These values are 1/4 of what we expect for the mainnet. // KUSAMA: These values are 1/4 of what we expect for the mainnet.
pub const LaunchPeriod: BlockNumber = 7 * DAYS; pub const LaunchPeriod: BlockNumber = 7 * DAYS;
pub const VotingPeriod: BlockNumber = 7 * DAYS; pub const VotingPeriod: BlockNumber = 7 * DAYS;
pub const EmergencyVotingPeriod: BlockNumber = 3 * HOURS; // KUSAMA: This is a bit short; should be increased to 3 hours.
pub const EmergencyVotingPeriod: BlockNumber = 1 * HOURS;
pub const MinimumDeposit: Balance = 100 * DOLLARS; pub const MinimumDeposit: Balance = 100 * DOLLARS;
pub const EnactmentPeriod: BlockNumber = 8 * DAYS; pub const EnactmentPeriod: BlockNumber = 8 * DAYS;
pub const CooloffPeriod: BlockNumber = 7 * DAYS; pub const CooloffPeriod: BlockNumber = 7 * DAYS;
@@ -341,7 +339,8 @@ impl democracy::Trait for Runtime {
/// A straight majority of the council can decide what their next motion is. /// A straight majority of the council can decide what their next motion is.
type ExternalOrigin = collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>; type ExternalOrigin = collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>;
/// A super-majority can have the next scheduled referendum be a straight majority-carries vote. /// A super-majority can have the next scheduled referendum be a straight majority-carries vote.
type ExternalMajorityOrigin = collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>; // KUSAMA: A majority can have the next scheduled legislation be majority-carries.
type ExternalMajorityOrigin = collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>;
/// A unanimous council can have the next scheduled referendum be a straight default-carries /// A unanimous council can have the next scheduled referendum be a straight default-carries
/// (NTB) vote. /// (NTB) vote.
type ExternalDefaultOrigin = collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>; type ExternalDefaultOrigin = collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>;
@@ -366,7 +365,7 @@ impl collective::Trait<CouncilCollective> for Runtime {
parameter_types! { parameter_types! {
pub const CandidacyBond: Balance = 100 * DOLLARS; pub const CandidacyBond: Balance = 100 * DOLLARS;
pub const VotingBond: Balance = 5 * DOLLARS; pub const VotingBond: Balance = 5 * DOLLARS;
pub const TermDuration: BlockNumber = 10 * MINUTES; pub const TermDuration: BlockNumber = 2 * HOURS;
pub const DesiredMembers: u32 = 13; pub const DesiredMembers: u32 = 13;
pub const DesiredRunnersUp: u32 = 7; pub const DesiredRunnersUp: u32 = 7;
} }
@@ -432,12 +431,17 @@ impl offences::Trait for Runtime {
type SubmitTransaction = TransactionSubmitter<ImOnlineId, Runtime, UncheckedExtrinsic>; type SubmitTransaction = TransactionSubmitter<ImOnlineId, Runtime, UncheckedExtrinsic>;
parameter_types! {
pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_BLOCKS as _;
}
impl im_online::Trait for Runtime { impl im_online::Trait for Runtime {
type AuthorityId = ImOnlineId; type AuthorityId = ImOnlineId;
type Event = Event; type Event = Event;
type Call = Call; type Call = Call;
type SubmitTransaction = SubmitTransaction; type SubmitTransaction = SubmitTransaction;
type ReportUnresponsiveness = Offences; type ReportUnresponsiveness = Offences;
type SessionDuration = SessionDuration;
} }
impl grandpa::Trait for Runtime { impl grandpa::Trait for Runtime {
+1 -1
View File
@@ -1046,7 +1046,7 @@ mod tests {
} }
impl staking::Trait for Test { impl staking::Trait for Test {
type OnRewardMinted = (); type RewardRemainder = ();
type CurrencyToVote = (); type CurrencyToVote = ();
type Event = (); type Event = ();
type Currency = balances::Module<Test>; type Currency = balances::Module<Test>;
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-service" name = "polkadot-service"
version = "0.6.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+3 -3
View File
@@ -91,7 +91,7 @@ macro_rules! new_full_start {
let select_chain = select_chain.take() let select_chain = select_chain.take()
.ok_or_else(|| service::Error::SelectChainRequired)?; .ok_or_else(|| service::Error::SelectChainRequired)?;
let (grandpa_block_import, grandpa_link) = let (grandpa_block_import, grandpa_link) =
grandpa::block_import::<_, _, _, RuntimeApi, _, _>( grandpa::block_import::<_, _, _, RuntimeApi, _>(
client.clone(), &*client, select_chain client.clone(), &*client, select_chain
)?; )?;
let justification_import = grandpa_block_import.clone(); let justification_import = grandpa_block_import.clone();
@@ -342,8 +342,8 @@ pub fn new_light(config: Configuration<CustomConfiguration, GenesisConfig>)
let fetch_checker = fetcher let fetch_checker = fetcher
.map(|fetcher| fetcher.checker().clone()) .map(|fetcher| fetcher.checker().clone())
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?; .ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
let grandpa_block_import = grandpa::light_block_import::<_, _, _, RuntimeApi, _>( let grandpa_block_import = grandpa::light_block_import::<_, _, _, RuntimeApi>(
client.clone(), backend, Arc::new(fetch_checker), client.clone() client.clone(), backend, &*client, Arc::new(fetch_checker)
)?; )?;
let finality_proof_import = grandpa_block_import.clone(); let finality_proof_import = grandpa_block_import.clone();
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-statement-table" name = "polkadot-statement-table"
version = "0.6.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "adder" name = "adder"
version = "0.6.6" version = "0.6.10"
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 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "halt" name = "halt"
version = "0.6.6" version = "0.6.10"
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 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-validation" name = "polkadot-validation"
version = "0.6.6" version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"