Unverified Commit 869a130b authored by André Silva's avatar André Silva Committed by GitHub
Browse files

runtime: remove randomness collective flip pallet (#3347)



* runtime: remove randomness collective flip pallet

* add storage migration to remove key

Co-Authored-By: parity-processbot <>
Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>
parent 8d8d2a6e
Pipeline #143748 canceled with stages
in 5 minutes and 46 seconds
......@@ -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"
......@@ -6551,7 +6537,6 @@ dependencies = [
"pallet-offences",
"pallet-offences-benchmarking",
"pallet-proxy",
"pallet-randomness-collective-flip",
"pallet-scheduler",
"pallet-session",
"pallet-session-benchmarking",
......@@ -6616,7 +6601,6 @@ dependencies = [
"pallet-beefy",
"pallet-mmr",
"pallet-offences",
"pallet-randomness-collective-flip",
"pallet-session",
"pallet-staking",
"pallet-staking-reward-curve",
......@@ -6668,7 +6652,6 @@ dependencies = [
"pallet-babe",
"pallet-balances",
"pallet-offences",
"pallet-randomness-collective-flip",
"pallet-session",
"pallet-staking",
"pallet-staking-reward-curve",
......@@ -6893,7 +6876,6 @@ dependencies = [
"pallet-mmr-primitives",
"pallet-nicks",
"pallet-offences",
"pallet-randomness-collective-flip",
"pallet-session",
"pallet-staking",
"pallet-staking-reward-curve",
......@@ -7849,15 +7831,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"
......@@ -11700,7 +11673,6 @@ dependencies = [
"pallet-offences",
"pallet-offences-benchmarking",
"pallet-proxy",
"pallet-randomness-collective-flip",
"pallet-recovery",
"pallet-scheduler",
"pallet-session",
......
......@@ -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" }
......
......@@ -451,7 +451,6 @@ mod tests {
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Slots: slots::{Pallet, Call, Storage, Event<T>},
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;
}
......
......@@ -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.
......
......@@ -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<T>} = 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>,
Runtime,
AllPallets,
SetStakingLimits,
RemoveCollectiveFlip,
>;
/// The payload being signed in the transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
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;
<pallet_staking::MinNominatorBond<Runtime>>::put(min_nominator_bond);
<pallet_staking::MaxNominatorsCount<Runtime>>::put(max_nominators);
// we set no limits on validators for now.
<Runtime as frame_system::Config>::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"");
<Runtime as frame_system::Config>::DbWeight::get().writes(1)
}
}
......
......@@ -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" }
......
......@@ -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",
......
......@@ -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<T>} = 0,
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 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 = <Runtime as frame_system::Config>::PalletInfo::name::<Grandpa>()
.expect("grandpa is part of pallets in construct_runtime, so it has a name; qed");
pallet_grandpa::migrations::v3_1::migrate::<Runtime, Grandpa, _>(name)
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
use frame_support::traits::PalletInfo;
let name = <Runtime as frame_system::Config>::PalletInfo::name::<Grandpa>()
.expect("grandpa is part of pallets in construct_runtime, so it has a name; qed");
pallet_grandpa::migrations::v3_1::pre_migration::<Runtime, Grandpa, _>(name);
Ok(())
}
#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_grandpa::migrations::v3_1::post_migration::<Grandpa>();
Ok(())
}
}
/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
......@@ -1099,28 +1071,18 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
(GrandpaStoragePrefixMigration, SetStakingLimits),
RemoveCollectiveFlip,
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
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;
<pallet_staking::MinNominatorBond<Runtime>>::put(min_nominator_bond);
<pallet_staking::MaxNominatorsCount<Runtime>>::put(max_nominators);
// we set no limits on validators for now.
<Runtime as frame_system::Config>::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"");
<Runtime as frame_system::Config>::DbWeight::get().writes(1)
}
}
......
......@@ -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",
......
......@@ -161,8 +161,6 @@ impl<C> frame_system::offchain::SendTransactionTypes<C> 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<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage},
// Must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config},
......
......@@ -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.
......
......@@ -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<T>} = 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>,
Runtime,
AllPallets,
SetStakingLimits,
RemoveCollectiveFlip,
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
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 {
<pallet_staking::MinNominatorBond<Runtime>>::put(1 * UNITS);
<pallet_staking::MaxNominatorsCount<Runtime>>::put(1000);
<pallet_staking::MinValidatorBond<Runtime>>::put(10 * UNITS);
<pallet_staking::MaxValidatorsCount<Runtime>>::put(10);
<Runtime as frame_system::Config>::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"");
<Runtime as frame_system::Config>::DbWeight::get().writes(1)
}
}
......
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