diff --git a/polkadot/node/service/Cargo.toml b/polkadot/node/service/Cargo.toml index 679c72f515..36b84d909c 100644 --- a/polkadot/node/service/Cargo.toml +++ b/polkadot/node/service/Cargo.toml @@ -121,6 +121,7 @@ try-runtime = [ "polkadot-runtime/try-runtime", "kusama-runtime/try-runtime", "westend-runtime/try-runtime", + "rococo-runtime/try-runtime", ] real-overseer = [ diff --git a/polkadot/runtime/common/Cargo.toml b/polkadot/runtime/common/Cargo.toml index 13ce1f6236..30dcae2cde 100644 --- a/polkadot/runtime/common/Cargo.toml +++ b/polkadot/runtime/common/Cargo.toml @@ -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", +] diff --git a/polkadot/runtime/kusama/Cargo.toml b/polkadot/runtime/kusama/Cargo.toml index 155b8b66f7..5c2fec3e69 100644 --- a/polkadot/runtime/kusama/Cargo.toml +++ b/polkadot/runtime/kusama/Cargo.toml @@ -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. # diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index 04058cd36b..40d2dac9a3 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -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, diff --git a/polkadot/runtime/parachains/Cargo.toml b/polkadot/runtime/parachains/Cargo.toml index 520fc5bcbe..8899f96dc5 100644 --- a/polkadot/runtime/parachains/Cargo.toml +++ b/polkadot/runtime/parachains/Cargo.toml @@ -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", +] diff --git a/polkadot/runtime/polkadot/Cargo.toml b/polkadot/runtime/polkadot/Cargo.toml index 60e53e30ad..1dc4c5f615 100644 --- a/polkadot/runtime/polkadot/Cargo.toml +++ b/polkadot/runtime/polkadot/Cargo.toml @@ -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. # diff --git a/polkadot/runtime/polkadot/src/lib.rs b/polkadot/runtime/polkadot/src/lib.rs index ea7a2aca82..950f72a40c 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -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, AllModules, - BabeEpochConfigMigrations, + (BabeEpochConfigMigrations, FixPolkadotCouncilVotersDeposit), >; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; +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::::translate::, _>( + |_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::::iter().all( + |(_, vote)| vote.deposit != 5 * CENTS + ) + ); + + Ok(()) + } +} + #[cfg(not(feature = "disable-runtime-api"))] sp_api::impl_runtime_apis! { impl sp_api::Core for Runtime { diff --git a/polkadot/runtime/rococo/Cargo.toml b/polkadot/runtime/rococo/Cargo.toml index 29e471ea68..b109aa2b46 100644 --- a/polkadot/runtime/rococo/Cargo.toml +++ b/polkadot/runtime/rococo/Cargo.toml @@ -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", +] diff --git a/polkadot/runtime/westend/Cargo.toml b/polkadot/runtime/westend/Cargo.toml index 16a2308d95..183c5453a1 100644 --- a/polkadot/runtime/westend/Cargo.toml +++ b/polkadot/runtime/westend/Cargo.toml @@ -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. # diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index fd2f5748e1..fbd93ba866 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -945,13 +945,6 @@ pub type Executive = frame_executive::Executive< /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; -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 for Runtime {