diff --git a/Cargo.lock b/Cargo.lock index d49b76de1e69..032aa8b5c15d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3277,7 +3277,6 @@ dependencies = [ "pallet-offences", "pallet-offences-benchmarking", "pallet-proxy", - "pallet-randomness-collective-flip", "pallet-recovery", "pallet-scheduler", "pallet-session", @@ -4983,19 +4982,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-randomness-collective-flip" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#97338fc60fdfcf647ba62e108d373e96acafb9c2" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "safe-mix", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-recovery" version = "3.0.0" @@ -6550,7 +6536,6 @@ dependencies = [ "pallet-offences", "pallet-offences-benchmarking", "pallet-proxy", - "pallet-randomness-collective-flip", "pallet-scheduler", "pallet-session", "pallet-session-benchmarking", @@ -6615,7 +6600,6 @@ dependencies = [ "pallet-beefy", "pallet-mmr", "pallet-offences", - "pallet-randomness-collective-flip", "pallet-session", "pallet-staking", "pallet-staking-reward-curve", @@ -6667,7 +6651,6 @@ dependencies = [ "pallet-babe", "pallet-balances", "pallet-offences", - "pallet-randomness-collective-flip", "pallet-session", "pallet-staking", "pallet-staking-reward-curve", @@ -6892,7 +6875,6 @@ dependencies = [ "pallet-mmr-primitives", "pallet-nicks", "pallet-offences", - "pallet-randomness-collective-flip", "pallet-session", "pallet-staking", "pallet-staking-reward-curve", @@ -7848,15 +7830,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "safe-mix" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d3d055a2582e6b00ed7a31c1524040aa391092bf636328350813f3a0605215c" -dependencies = [ - "rustc_version", -] - [[package]] name = "salsa20" version = "0.7.2" @@ -11699,7 +11672,6 @@ dependencies = [ "pallet-offences", "pallet-offences-benchmarking", "pallet-proxy", - "pallet-randomness-collective-flip", "pallet-recovery", "pallet-scheduler", "pallet-session", diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 47dd7f5efe22..27a8b93f4898 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -56,7 +56,6 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-support-test = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/runtime/common/src/slots.rs b/runtime/common/src/slots.rs index 13b62fca03f8..536ebc9b5ace 100644 --- a/runtime/common/src/slots.rs +++ b/runtime/common/src/slots.rs @@ -451,7 +451,6 @@ mod tests { System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Slots: slots::{Pallet, Call, Storage, Event}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, } ); @@ -484,8 +483,6 @@ mod tests { type OnSetCode = (); } - impl pallet_randomness_collective_flip::Config for Test {} - parameter_types! { pub const ExistentialDeposit: u64 = 1; } diff --git a/runtime/kusama/Cargo.toml b/runtime/kusama/Cargo.toml index a72d8fe54239..7f631b5f6eff 100644 --- a/runtime/kusama/Cargo.toml +++ b/runtime/kusama/Cargo.toml @@ -56,7 +56,6 @@ pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "m pallet-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -155,7 +154,6 @@ std = [ "pallet-utility/std", "pallet-vesting/std", "pallet-babe/std", - "pallet-randomness-collective-flip/std", "pallet-xcm/std", "sp-runtime/std", "sp-staking/std", @@ -249,7 +247,6 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-vesting/try-runtime", "pallet-babe/try-runtime", - "pallet-randomness-collective-flip/try-runtime", "runtime-common/try-runtime", ] # When enabled, the runtime api will not be build. diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 3ef60d774a27..71d13bac3ff8 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -192,8 +192,6 @@ impl frame_system::Config for Runtime { type OnSetCode = (); } -impl pallet_randomness_collective_flip::Config for Runtime {} - parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; @@ -1388,7 +1386,6 @@ construct_runtime! { { // Basic stuff; balances is uncallable initially. System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 32, // Must be before session. Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, @@ -1509,28 +1506,18 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPallets, - SetStakingLimits, + RemoveCollectiveFlip, >; /// The payload being signed in the transactions. pub type SignedPayload = generic::SignedPayload; -pub struct SetStakingLimits; -impl frame_support::traits::OnRuntimeUpgrade for SetStakingLimits { +pub struct RemoveCollectiveFlip; +impl frame_support::traits::OnRuntimeUpgrade for RemoveCollectiveFlip { fn on_runtime_upgrade() -> Weight { - // This will be the threshold needed henceforth to become a nominator. All nominators will - // less than this amount bonded are at the risk of being chilled by another reporter. - let min_nominator_bond = UNITS / 10; - // The absolute maximum number of nominators. This number is set rather conservatively, and - // is expected to increase soon after this runtime upgrade via another governance proposal. - // The current Polkadot state has more than 30_000 nominators, therefore no other nominator - // can join. - let max_nominators = 20_000; - >::put(min_nominator_bond); - >::put(max_nominators); - - // we set no limits on validators for now. - - ::DbWeight::get().writes(2) + use frame_support::storage::migration; + // Remove the storage value `RandomMaterial` from removed pallet `RandomnessCollectiveFlip` + migration::remove_storage_prefix(b"RandomnessCollectiveFlip", b"RandomMaterial", b""); + ::DbWeight::get().writes(1) } } diff --git a/runtime/parachains/Cargo.toml b/runtime/parachains/Cargo.toml index a9d68c3a8e61..6350056a6a0c 100644 --- a/runtime/parachains/Cargo.toml +++ b/runtime/parachains/Cargo.toml @@ -49,7 +49,6 @@ keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substra sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-support-test = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/runtime/polkadot/Cargo.toml b/runtime/polkadot/Cargo.toml index e7edad7a52ed..ac479c67fb54 100644 --- a/runtime/polkadot/Cargo.toml +++ b/runtime/polkadot/Cargo.toml @@ -54,7 +54,6 @@ pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "m pallet-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -139,7 +138,6 @@ std = [ "pallet-treasury/std", "pallet-tips/std", "pallet-babe/std", - "pallet-randomness-collective-flip/std", "pallet-vesting/std", "pallet-utility/std", "sp-runtime/std", @@ -222,7 +220,6 @@ try-runtime = [ "pallet-treasury/try-runtime", "pallet-tips/try-runtime", "pallet-babe/try-runtime", - "pallet-randomness-collective-flip/try-runtime", "pallet-vesting/try-runtime", "pallet-utility/try-runtime", "runtime-common/try-runtime", diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index b7b93e36e238..7e6fd0d727aa 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -176,8 +176,6 @@ impl frame_system::Config for Runtime { type OnSetCode = (); } -impl pallet_randomness_collective_flip::Config for Runtime {} - parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; @@ -987,7 +985,6 @@ construct_runtime! { { // Basic stuff; balances is uncallable initially. System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31, Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 1, // Must be before session. @@ -1044,31 +1041,6 @@ construct_runtime! { } } -pub struct GrandpaStoragePrefixMigration; -impl frame_support::traits::OnRuntimeUpgrade for GrandpaStoragePrefixMigration { - fn on_runtime_upgrade() -> frame_support::weights::Weight { - use frame_support::traits::PalletInfo; - let name = ::PalletInfo::name::() - .expect("grandpa is part of pallets in construct_runtime, so it has a name; qed"); - pallet_grandpa::migrations::v3_1::migrate::(name) - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<(), &'static str> { - use frame_support::traits::PalletInfo; - let name = ::PalletInfo::name::() - .expect("grandpa is part of pallets in construct_runtime, so it has a name; qed"); - pallet_grandpa::migrations::v3_1::pre_migration::(name); - Ok(()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade() -> Result<(), &'static str> { - pallet_grandpa::migrations::v3_1::post_migration::(); - Ok(()) - } -} - /// The address format for describing accounts. pub type Address = sp_runtime::MultiAddress; /// Block header type as expected by this runtime. @@ -1099,28 +1071,18 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPallets, - (GrandpaStoragePrefixMigration, SetStakingLimits), + RemoveCollectiveFlip, >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; -pub struct SetStakingLimits; -impl frame_support::traits::OnRuntimeUpgrade for SetStakingLimits { +pub struct RemoveCollectiveFlip; +impl frame_support::traits::OnRuntimeUpgrade for RemoveCollectiveFlip { fn on_runtime_upgrade() -> Weight { - // This will be the threshold needed henceforth to become a nominator. All nominators will - // less than this amount bonded are at the risk of being chilled by another reporter. - let min_nominator_bond = 20 * UNITS; - // The absolute maximum number of nominators. This number is set rather conservatively, and - // is expected to increase soon after this runtime upgrade via another governance proposal. - // The current Polkadot state has more than 30_000 nominators, therefore no other nominator - // can join. - let max_nominators = 20_000; - >::put(min_nominator_bond); - >::put(max_nominators); - - // we set no limits on validators for now. - - ::DbWeight::get().writes(2) + use frame_support::storage::migration; + // Remove the storage value `RandomMaterial` from removed pallet `RandomnessCollectiveFlip` + migration::remove_storage_prefix(b"RandomnessCollectiveFlip", b"RandomMaterial", b""); + ::DbWeight::get().writes(1) } } diff --git a/runtime/test-runtime/Cargo.toml b/runtime/test-runtime/Cargo.toml index dfb9376796b9..dc52f658e628 100644 --- a/runtime/test-runtime/Cargo.toml +++ b/runtime/test-runtime/Cargo.toml @@ -43,7 +43,6 @@ pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "ma pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -114,7 +113,6 @@ std = [ "pallet-babe/std", "babe-primitives/std", "sp-session/std", - "pallet-randomness-collective-flip/std", "runtime-common/std", "log/std", "frame-election-provider-support/std", diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index b00ad0ac8604..2646e189d918 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -161,8 +161,6 @@ impl frame_system::offchain::SendTransactionTypes for Runtime where type Extrinsic = UncheckedExtrinsic; } -impl pallet_randomness_collective_flip::Config for Runtime {} - parameter_types! { pub storage EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS as u64; pub storage ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; @@ -504,7 +502,6 @@ construct_runtime! { { // Basic stuff; balances is uncallable initially. System: frame_system::{Pallet, Call, Storage, Config, Event}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, // Must be before session. Babe: pallet_babe::{Pallet, Call, Storage, Config}, diff --git a/runtime/westend/Cargo.toml b/runtime/westend/Cargo.toml index 834fcbdfd3ee..fe591246d03d 100644 --- a/runtime/westend/Cargo.toml +++ b/runtime/westend/Cargo.toml @@ -55,7 +55,6 @@ pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "m pallet-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -152,7 +151,6 @@ std = [ "pallet-vesting/std", "pallet-xcm/std", "pallet-babe/std", - "pallet-randomness-collective-flip/std", "frame-executive/std", "sp-runtime/std", "sp-staking/std", @@ -239,7 +237,6 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-vesting/try-runtime", "pallet-babe/try-runtime", - "pallet-randomness-collective-flip/try-runtime", "runtime-common/try-runtime", ] # When enabled, the runtime api will not be build. diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 80c44cb1a7f1..7485db28ed37 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -183,8 +183,6 @@ impl frame_system::Config for Runtime { type OnSetCode = (); } -impl pallet_randomness_collective_flip::Config for Runtime {} - parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; @@ -999,7 +997,6 @@ construct_runtime! { { // Basic stuff; balances is uncallable initially. System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 25, // Must be before session. Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, @@ -1101,20 +1098,18 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPallets, - SetStakingLimits, + RemoveCollectiveFlip, >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; -pub struct SetStakingLimits; -impl frame_support::traits::OnRuntimeUpgrade for SetStakingLimits { +pub struct RemoveCollectiveFlip; +impl frame_support::traits::OnRuntimeUpgrade for RemoveCollectiveFlip { fn on_runtime_upgrade() -> Weight { - >::put(1 * UNITS); - >::put(1000); - >::put(10 * UNITS); - >::put(10); - - ::DbWeight::get().writes(4) + use frame_support::storage::migration; + // Remove the storage value `RandomMaterial` from removed pallet `RandomnessCollectiveFlip` + migration::remove_storage_prefix(b"RandomnessCollectiveFlip", b"RandomMaterial", b""); + ::DbWeight::get().writes(1) } }