Unverified Commit 6d68c406 authored by Kian Paimani's avatar Kian Paimani Committed by GitHub
Browse files

Fix wrong deposit amount in council voters. (#2562)

* Fix wrong deposit amount in council voters.

* Fix some build

* make it all compile.. so far.

* Fix

* break build

* Okay fix it again
parent 03f86ff2
Pipeline #129024 canceled with stages
in 11 minutes and 30 seconds
......@@ -121,6 +121,7 @@ try-runtime = [
"polkadot-runtime/try-runtime",
"kusama-runtime/try-runtime",
"westend-runtime/try-runtime",
"rococo-runtime/try-runtime",
]
real-overseer = [
......
......@@ -78,15 +78,16 @@ std = [
"frame-support/std",
"pallet-authorship/std",
"pallet-balances/std",
"sp-runtime/std",
"sp-session/std",
"sp-staking/std",
"pallet-session/std",
"pallet-staking/std",
"frame-system/std",
"pallet-timestamp/std",
"pallet-vesting/std",
"pallet-transaction-payment/std",
"pallet-treasury/std",
"sp-runtime/std",
"sp-session/std",
"sp-staking/std",
"frame-system/std",
"runtime-parachains/std",
"xcm/std",
]
......@@ -98,3 +99,14 @@ runtime-benchmarks = [
"runtime-parachains/runtime-benchmarks",
"pallet-babe/runtime-benchmarks",
]
try-runtime = [
"runtime-parachains/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-session/try-runtime",
"pallet-staking/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-vesting/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
]
......@@ -95,7 +95,6 @@ no_std = []
only-staking = []
std = [
"authority-discovery-primitives/std",
"pallet-authority-discovery/std",
"bitvec/std",
"primitives/std",
"rustc-hex/std",
......@@ -109,6 +108,8 @@ std = [
"sp-std/std",
"sp-io/std",
"frame-support/std",
"frame-executive/std",
"pallet-authority-discovery/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-bounties/std",
......@@ -118,7 +119,6 @@ std = [
"pallet-elections-phragmen/std",
"pallet-election-provider-multi-phase/std",
"pallet-democracy/std",
"frame-executive/std",
"pallet-grandpa/std",
"pallet-identity/std",
"pallet-im-online/std",
......@@ -129,28 +129,29 @@ std = [
"pallet-offences/std",
"pallet-proxy/std",
"pallet-recovery/std",
"sp-runtime/std",
"sp-staking/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-society/std",
"pallet-staking/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"pallet-timestamp/std",
"pallet-tips/std",
"pallet-treasury/std",
"sp-version/std",
"pallet-utility/std",
"pallet-vesting/std",
"pallet-babe/std",
"pallet-randomness-collective-flip/std",
"sp-runtime/std",
"sp-staking/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"sp-version/std",
"serde_derive",
"serde/std",
"log/std",
"pallet-babe/std",
"babe-primitives/std",
"sp-session/std",
"pallet-randomness-collective-flip/std",
"runtime-common/std",
"frame-try-runtime/std",
]
runtime-benchmarks = [
"runtime-common/runtime-benchmarks",
......@@ -187,6 +188,38 @@ runtime-benchmarks = [
try-runtime = [
"frame-executive/try-runtime",
"frame-try-runtime",
"frame-system/try-runtime",
"pallet-authority-discovery/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-bounties/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-collective/try-runtime",
"pallet-elections-phragmen/try-runtime",
"pallet-election-provider-multi-phase/try-runtime",
"pallet-democracy/try-runtime",
"pallet-grandpa/try-runtime",
"pallet-identity/try-runtime",
"pallet-im-online/try-runtime",
"pallet-indices/try-runtime",
"pallet-membership/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nicks/try-runtime",
"pallet-offences/try-runtime",
"pallet-proxy/try-runtime",
"pallet-recovery/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-society/try-runtime",
"pallet-staking/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-tips/try-runtime",
"pallet-treasury/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.
#
......
......@@ -961,13 +961,6 @@ impl pallet_proxy::Config for Runtime {
type AnnouncementDepositFactor = AnnouncementDepositFactor;
}
pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
0
}
}
construct_runtime! {
pub enum Runtime where
Block = Block,
......
......@@ -75,16 +75,16 @@ std = [
"sp-std/std",
"sp-io/std",
"frame-support/std",
"pallet-authorship/std",
"pallet-balances/std",
"sp-runtime/std",
"sp-session/std",
"sp-staking/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-session/std",
"pallet-staking/std",
"frame-system/std",
"pallet-timestamp/std",
"pallet-vesting/std",
"frame-system/std",
"xcm/std",
"xcm-executor/std",
"log/std",
......@@ -95,3 +95,12 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-session/try-runtime",
"pallet-staking/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-vesting/try-runtime",
]
......@@ -94,7 +94,6 @@ no_std = []
only-staking = []
std = [
"authority-discovery-primitives/std",
"pallet-authority-discovery/std",
"bitvec/std",
"primitives/std",
"rustc-hex/std",
......@@ -107,6 +106,8 @@ std = [
"offchain-primitives/std",
"sp-std/std",
"frame-support/std",
"frame-executive/std",
"pallet-authority-discovery/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-bounties/std",
......@@ -116,7 +117,6 @@ std = [
"pallet-elections-phragmen/std",
"pallet-election-provider-multi-phase/std",
"pallet-democracy/std",
"frame-executive/std",
"pallet-grandpa/std",
"pallet-identity/std",
"pallet-im-online/std",
......@@ -126,27 +126,28 @@ std = [
"pallet-nicks/std",
"pallet-offences/std",
"pallet-proxy/std",
"sp-runtime/std",
"sp-staking/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-staking/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"pallet-timestamp/std",
"pallet-treasury/std",
"pallet-tips/std",
"pallet-babe/std",
"pallet-randomness-collective-flip/std",
"pallet-vesting/std",
"pallet-utility/std",
"sp-runtime/std",
"sp-staking/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"sp-version/std",
"serde_derive",
"serde/std",
"log/std",
"pallet-babe/std",
"babe-primitives/std",
"sp-session/std",
"pallet-randomness-collective-flip/std",
"runtime-common/std",
"pallet-vesting/std",
"pallet-utility/std",
"frame-try-runtime/std",
]
runtime-benchmarks = [
"runtime-common/runtime-benchmarks",
......@@ -182,6 +183,36 @@ runtime-benchmarks = [
try-runtime = [
"frame-executive/try-runtime",
"frame-try-runtime",
"frame-system/try-runtime",
"pallet-authority-discovery/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-bounties/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-collective/try-runtime",
"pallet-elections-phragmen/try-runtime",
"pallet-election-provider-multi-phase/try-runtime",
"pallet-democracy/try-runtime",
"pallet-grandpa/try-runtime",
"pallet-identity/try-runtime",
"pallet-im-online/try-runtime",
"pallet-indices/try-runtime",
"pallet-membership/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nicks/try-runtime",
"pallet-offences/try-runtime",
"pallet-proxy/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-staking/try-runtime",
"pallet-timestamp/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",
]
# When enabled, the runtime api will not be build.
#
......
......@@ -966,13 +966,6 @@ impl pallet_proxy::Config for Runtime {
type AnnouncementDepositFactor = AnnouncementDepositFactor;
}
pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
0
}
}
construct_runtime! {
pub enum Runtime where
Block = Block,
......@@ -1085,11 +1078,59 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllModules,
BabeEpochConfigMigrations,
(BabeEpochConfigMigrations, FixPolkadotCouncilVotersDeposit),
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
pub struct FixPolkadotCouncilVotersDeposit;
impl frame_support::traits::OnRuntimeUpgrade for FixPolkadotCouncilVotersDeposit {
fn on_runtime_upgrade() -> Weight {
use pallet_elections_phragmen::Voter;
use frame_support::IterableStorageMap;
let mut updated = 0;
let mut skipped = 0;
let mut correct = 0;
pallet_elections_phragmen::Voting::<Runtime>::translate::<Voter<AccountId, Balance>, _>(
|_who, mut vote| {
if vote.deposit == 5 * CENTS {
// If their deposit is what we set by mistake
vote.deposit = 5 * DOLLARS;
updated += 1;
} else if vote.deposit == 5 * DOLLARS {
correct += 1;
} else {
skipped += 1;
}
Some(vote)
},
);
log::info!(
target: "runtime::polkadot",
"updated {} (updated) + {} (correct) + {} (skipped) voter's deposit.",
updated,
correct,
skipped,
);
BlockWeights::get().max_block
}
#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
use frame_support::IterableStorageMap;
log::info!("Checking FixPolkadotCouncilVotersDeposit post migration");
// no further vote with the wrong 5 CENT deposit shall exist.
assert!(
pallet_elections_phragmen::Voting::<Runtime>::iter().all(
|(_, vote)| vote.deposit != 5 * CENTS
)
);
Ok(())
}
}
#[cfg(not(feature = "disable-runtime-api"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
......
......@@ -67,24 +67,29 @@ default = ["std"]
no_std = []
std = [
"authority-discovery-primitives/std",
"babe-primitives/std",
"parity-scale-codec/std",
"frame-executive/std",
"pallet-authority-discovery/std",
"pallet-authorship/std",
"pallet-babe/std",
"babe-primitives/std",
"pallet-balances/std",
"parity-scale-codec/std",
"frame-executive/std",
"pallet-grandpa/std",
"pallet-sudo/std",
"pallet-indices/std",
"pallet-im-online/std",
"pallet-session/std",
"pallet-staking/std",
"pallet-offences/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"inherents/std",
"frame-support/std",
"polkadot-parachain/std",
"primitives/std",
"runtime-common/std",
"runtime-parachains/std",
"pallet-session/std",
"sp-api/std",
"sp-core/std",
"sp-io/std",
......@@ -92,14 +97,9 @@ std = [
"sp-session/std",
"sp-staking/std",
"sp-std/std",
"pallet-staking/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"offchain-primitives/std",
"pallet-offences/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"block-builder-api/std",
"tx-pool-api/std",
"sp-version/std",
......@@ -129,3 +129,22 @@ runtime-benchmarks = [
"pallet-staking/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
]
try-runtime = [
"frame-executive/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-authority-discovery/try-runtime",
"pallet-authorship/try-runtime",
"pallet-babe/try-runtime",
"pallet-balances/try-runtime",
"pallet-grandpa/try-runtime",
"pallet-sudo/try-runtime",
"pallet-indices/try-runtime",
"pallet-im-online/try-runtime",
"pallet-session/try-runtime",
"pallet-staking/try-runtime",
"pallet-offences/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"runtime-common/try-runtime",
]
......@@ -95,7 +95,6 @@ no_std = []
only-staking = []
std = [
"authority-discovery-primitives/std",
"pallet-authority-discovery/std",
"bitvec/std",
"primitives/std",
"rustc-hex/std",
......@@ -110,6 +109,7 @@ std = [
"sp-std/std",
"sp-io/std",
"frame-support/std",
"pallet-authority-discovery/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-transaction-payment/std",
......@@ -118,7 +118,6 @@ std = [
"pallet-elections-phragmen/std",
"pallet-election-provider-multi-phase/std",
"pallet-democracy/std",
"frame-executive/std",
"pallet-grandpa/std",
"pallet-identity/std",
"pallet-im-online/std",
......@@ -129,28 +128,30 @@ std = [
"pallet-offences/std",
"pallet-proxy/std",
"pallet-recovery/std",
"sp-runtime/std",
"sp-staking/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-society/std",
"pallet-staking/std",
"pallet-sudo/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"pallet-timestamp/std",
"pallet-treasury/std",
"sp-version/std",
"pallet-utility/std",
"pallet-vesting/std",
"pallet-babe/std",
"pallet-randomness-collective-flip/std",
"frame-executive/std",
"sp-runtime/std",
"sp-staking/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"sp-version/std",
"serde_derive",
"serde/std",
"log/std",
"pallet-babe/std",
"babe-primitives/std",
"sp-session/std",
"pallet-randomness-collective-flip/std",
"runtime-common/std",
"frame-try-runtime/std",
]
runtime-benchmarks = [
"runtime-common/runtime-benchmarks",
......@@ -184,7 +185,38 @@ runtime-benchmarks = [
]
try-runtime = [
"frame-executive/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime",
"pallet-authorship/try-runtime",
"pallet-authority-discovery/try-runtime",
"pallet-balances/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-collective/try-runtime",
"pallet-elections-phragmen/try-runtime",
"pallet-election-provider-multi-phase/try-runtime",
"pallet-democracy/try-runtime",
"pallet-grandpa/try-runtime",
"pallet-identity/try-runtime",
"pallet-im-online/try-runtime",
"pallet-indices/try-runtime",
"pallet-membership/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nicks/try-runtime",
"pallet-offences/try-runtime",
"pallet-proxy/try-runtime",
"pallet-recovery/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-society/try-runtime",
"pallet-staking/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-treasury/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.
#
......
......@@ -945,13 +945,6 @@ pub type Executive = frame_executive::Executive<
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
0
}
}
#[cfg(not(feature = "disable-runtime-api"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
......
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