mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Remove already triggered migrations (#2764)
* Remove BabeEpochConfigMigrations * Remove remaining migrations * Remove unused migration definitions
This commit is contained in:
@@ -1036,18 +1036,6 @@ impl pallet_babe::migrations::BabePalletPrefix for Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BabeEpochConfigMigrations;
|
||||
impl frame_support::traits::OnRuntimeUpgrade for BabeEpochConfigMigrations {
|
||||
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||
pallet_babe::migrations::add_epoch_configuration::<Runtime>(
|
||||
babe_primitives::BabeEpochConfiguration {
|
||||
allowed_slots: babe_primitives::AllowedSlots::PrimaryAndSecondaryPlainSlots,
|
||||
..BABE_GENESIS_EPOCH_CONFIG
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block header type as expected by this runtime.
|
||||
@@ -1079,24 +1067,11 @@ pub type Executive = frame_executive::Executive<
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPallets,
|
||||
(BabeEpochConfigMigrations, KillOffchainPhragmenStorageTest),
|
||||
(),
|
||||
>;
|
||||
/// The payload being signed in the transactions.
|
||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||
|
||||
/// This is only for testing. The main migration is inside staking's `on_runtime_upgrade`.
|
||||
pub struct KillOffchainPhragmenStorageTest;
|
||||
impl frame_support::traits::OnRuntimeUpgrade for KillOffchainPhragmenStorageTest {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<(), &'static str> {
|
||||
pallet_staking::migrations::v6::pre_migrate::<Runtime>()
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -1030,15 +1030,6 @@ impl pallet_babe::migrations::BabePalletPrefix for Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BabeEpochConfigMigrations;
|
||||
impl frame_support::traits::OnRuntimeUpgrade for BabeEpochConfigMigrations {
|
||||
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||
pallet_babe::migrations::add_epoch_configuration::<Runtime>(
|
||||
BABE_GENESIS_EPOCH_CONFIG,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block header type as expected by this runtime.
|
||||
@@ -1071,59 +1062,11 @@ pub type Executive = frame_executive::Executive<
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPallets,
|
||||
(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 {
|
||||
|
||||
@@ -809,15 +809,6 @@ impl pallet_babe::migrations::BabePalletPrefix for Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BabeEpochConfigMigrations;
|
||||
impl frame_support::traits::OnRuntimeUpgrade for BabeEpochConfigMigrations {
|
||||
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||
pallet_babe::migrations::add_epoch_configuration::<Runtime>(
|
||||
BABE_GENESIS_EPOCH_CONFIG,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block header type as expected by this runtime.
|
||||
@@ -849,7 +840,7 @@ pub type Executive = frame_executive::Executive<
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPallets,
|
||||
(BabeEpochConfigMigrations, UpgradeSessionKeys),
|
||||
(),
|
||||
>;
|
||||
/// The payload being signed in transactions.
|
||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||
|
||||
Reference in New Issue
Block a user