Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Backport all v0.6 changes to master... (#552)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gavofyork authored and bkchr committed Nov 8, 2019
1 parent 403f530 commit 1142297
Show file tree
Hide file tree
Showing 21 changed files with 378 additions and 532 deletions.
798 changes: 326 additions & 472 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion availability-store/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[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"

Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[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"
Expand Down
2 changes: 1 addition & 1 deletion collator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-collator"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Collator node implementation"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion erasure-coding/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-erasure-coding"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[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"
Expand Down
2 changes: 1 addition & 1 deletion network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[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"
Expand Down
2 changes: 1 addition & 1 deletion parachain/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[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"
Expand Down
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-primitives"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-rpc"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-runtime"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
Expand Down Expand Up @@ -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" }
Expand Down
44 changes: 16 additions & 28 deletions runtime/src/crowdfund.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")?;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
26 changes: 15 additions & 11 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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()),
}
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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>;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/parachains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ mod tests {
}

impl staking::Trait for Test {
type OnRewardMinted = ();
type RewardRemainder = ();
type CurrencyToVote = ();
type Event = ();
type Currency = balances::Module<Test>;
Expand Down
2 changes: 1 addition & 1 deletion service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-service"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
6 changes: 3 additions & 3 deletions service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion statement-table/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-statement-table"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion test-parachains/adder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[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"
Expand Down
2 changes: 1 addition & 1 deletion test-parachains/halt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[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"
Expand Down
2 changes: 1 addition & 1 deletion validation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-validation"
version = "0.6.6"
version = "0.6.10"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down

0 comments on commit 1142297

Please sign in to comment.