Commit 1142297b authored by Gavin Wood's avatar Gavin Wood Committed by Bastian Köcher
Browse files

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
parent 403f5306
Pipeline #56256 passed with stages
in 44 minutes and 25 seconds
This diff is collapsed.
......@@ -4,7 +4,7 @@ path = "src/main.rs"
[package]
name = "polkadot"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
edition = "2018"
......
[package]
name = "polkadot-availability-store"
description = "Persistent database for parachain data"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-cli"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
edition = "2018"
......
[package]
name = "polkadot-collator"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Collator node implementation"
edition = "2018"
......
[package]
name = "polkadot-erasure-coding"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-executor"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
edition = "2018"
......
[package]
name = "polkadot-network"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot-specific networking protocol"
edition = "2018"
......
[package]
name = "polkadot-parachain"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Types and utilities for creating and working with parachains"
edition = "2018"
......
[package]
name = "polkadot-primitives"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-rpc"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-runtime"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
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" }
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" }
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" }
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" }
......
......@@ -67,8 +67,9 @@
//! funds ultimately end up in module's fund sub-account.
use srml_support::{
decl_module, decl_storage, decl_event, storage::child, ensure,
traits::{Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement}
decl_module, decl_storage, decl_event, storage::child, ensure, traits::{
Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement::AllowDeath
}
};
use system::ensure_signed;
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");
let deposit = T::SubmissionDeposit::get();
let imb = T::Currency::withdraw(
&owner,
deposit,
WithdrawReason::Transfer.into(),
ExistenceRequirement::AllowDeath,
)?;
let transfer = WithdrawReason::Transfer.into();
let imb = T::Currency::withdraw(&owner, deposit, transfer, AllowDeath)?;
let index = FundCount::get();
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();
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 = balance.saturating_add(value);
......@@ -375,12 +372,10 @@ decl_module! {
ensure!(balance > Zero::zero(), "no contributions stored");
// Avoid using transfer to ensure we don't pay any fees.
let _ = T::Currency::resolve_into_existing(&who, T::Currency::withdraw(
&Self::fund_account_id(index),
balance,
WithdrawReason::Transfer.into(),
ExistenceRequirement::AllowDeath
)?);
let fund_account = &Self::fund_account_id(index);
let transfer = WithdrawReason::Transfer.into();
let imbalance = T::Currency::withdraw(fund_account, balance, transfer, AllowDeath)?;
let _ = T::Currency::resolve_into_existing(&who, imbalance);
Self::contribution_kill(index, &who);
fund.raised = fund.raised.saturating_sub(balance);
......@@ -404,19 +399,12 @@ decl_module! {
let account = Self::fund_account_id(index);
// Avoid using transfer to ensure we don't pay any fees.
let _ = T::Currency::resolve_into_existing(&fund.owner, T::Currency::withdraw(
&account,
fund.deposit,
WithdrawReason::Transfer.into(),
ExistenceRequirement::AllowDeath
)?);
T::OrphanedFunds::on_unbalanced(T::Currency::withdraw(
&account,
fund.raised,
WithdrawReason::Transfer.into(),
ExistenceRequirement::AllowDeath
)?);
let transfer = WithdrawReason::Transfer.into();
let imbalance = T::Currency::withdraw(&account, fund.deposit, transfer, AllowDeath)?;
let _ = T::Currency::resolve_into_existing(&fund.owner, imbalance);
let imbalance = T::Currency::withdraw(&account, fund.raised, transfer, AllowDeath)?;
T::OrphanedFunds::on_unbalanced(imbalance);
Self::crowdfund_kill(index);
<Funds<T>>::remove(index);
......
......@@ -99,7 +99,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 1,
spec_version: 1012,
spec_version: 1017,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
};
......@@ -129,12 +129,9 @@ impl SignedExtension for OnlyStakingAndClaims {
-> TransactionValidity
{
match call {
Call::Staking(_) | Call::Claims(_) | Call::Sudo(_) | Call::Session(_)
| Call::ElectionsPhragmen(_) | Call::TechnicalMembership(_)
| Call::TechnicalCommittee(_) | Call::Nicks(_)
=>
Ok(Default::default()),
_ => Err(InvalidTransaction::Custom(ValidityError::NoPermission.into()).into()),
Call::Balances(_) | Call::Slots(_) | Call::Registrar(_) | Call::Democracy(_)
=> Err(InvalidTransaction::Custom(ValidityError::NoPermission.into()).into()),
_ => Ok(Default::default()),
}
}
}
......@@ -306,7 +303,7 @@ parameter_types! {
}
impl staking::Trait for Runtime {
type OnRewardMinted = Treasury;
type RewardRemainder = Treasury;
type CurrencyToVote = CurrencyToVoteHandler;
type Event = Event;
type Currency = Balances;
......@@ -323,7 +320,8 @@ parameter_types! {
// KUSAMA: These values are 1/4 of what we expect for the mainnet.
pub const LaunchPeriod: 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 EnactmentPeriod: BlockNumber = 8 * 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.
type ExternalOrigin = collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>;
/// 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
/// (NTB) vote.
type ExternalDefaultOrigin = collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>;
......@@ -366,7 +365,7 @@ impl collective::Trait<CouncilCollective> for Runtime {
parameter_types! {
pub const CandidacyBond: Balance = 100 * 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 DesiredRunnersUp: u32 = 7;
}
......@@ -432,12 +431,17 @@ impl offences::Trait for Runtime {
type SubmitTransaction = TransactionSubmitter<ImOnlineId, Runtime, UncheckedExtrinsic>;
parameter_types! {
pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_BLOCKS as _;
}
impl im_online::Trait for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type Call = Call;
type SubmitTransaction = SubmitTransaction;
type ReportUnresponsiveness = Offences;
type SessionDuration = SessionDuration;
}
impl grandpa::Trait for Runtime {
......
......@@ -1046,7 +1046,7 @@ mod tests {
}
impl staking::Trait for Test {
type OnRewardMinted = ();
type RewardRemainder = ();
type CurrencyToVote = ();
type Event = ();
type Currency = balances::Module<Test>;
......
[package]
name = "polkadot-service"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
......@@ -91,7 +91,7 @@ macro_rules! new_full_start {
let select_chain = select_chain.take()
.ok_or_else(|| service::Error::SelectChainRequired)?;
let (grandpa_block_import, grandpa_link) =
grandpa::block_import::<_, _, _, RuntimeApi, _, _>(
grandpa::block_import::<_, _, _, RuntimeApi, _>(
client.clone(), &*client, select_chain
)?;
let justification_import = grandpa_block_import.clone();
......@@ -342,8 +342,8 @@ pub fn new_light(config: Configuration<CustomConfiguration, GenesisConfig>)
let fetch_checker = fetcher
.map(|fetcher| fetcher.checker().clone())
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
let grandpa_block_import = grandpa::light_block_import::<_, _, _, RuntimeApi, _>(
client.clone(), backend, Arc::new(fetch_checker), client.clone()
let grandpa_block_import = grandpa::light_block_import::<_, _, _, RuntimeApi>(
client.clone(), backend, &*client, Arc::new(fetch_checker)
)?;
let finality_proof_import = grandpa_block_import.clone();
......
[package]
name = "polkadot-statement-table"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "adder"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which adds to a number as its state transition"
edition = "2018"
......
[package]
name = "halt"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which executes forever"
edition = "2018"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment