mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Remove state migration from westend runtime. (#6737)
* clean state_trie_migration from westend * update cargo.lock * Revert "clean state_trie_migration from westend" This reverts commit b1d55c688e9a8a2fbd155f0a9ddaba9766ad101c. * cleanup. * use storage_alias * Revert "use storage_alias" This reverts commit 5289745d1592a14db0063d9ee111137473993f41. * Revert "Revert "use storage_alias"" This reverts commit d4c688acdddf29a09c79a4eef52ab4095128e5b3. * Force alias. * magic
This commit is contained in:
Generated
-1
@@ -13357,7 +13357,6 @@ dependencies = [
|
|||||||
"sp-std",
|
"sp-std",
|
||||||
"sp-tracing",
|
"sp-tracing",
|
||||||
"sp-transaction-pool",
|
"sp-transaction-pool",
|
||||||
"sp-trie",
|
|
||||||
"sp-version",
|
"sp-version",
|
||||||
"substrate-wasm-builder",
|
"substrate-wasm-builder",
|
||||||
"tiny-keccak",
|
"tiny-keccak",
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ xcm-builder = { package = "xcm-builder", path = "../../xcm/xcm-builder", default
|
|||||||
hex-literal = "0.3.4"
|
hex-literal = "0.3.4"
|
||||||
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
|
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
|
||||||
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
|
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
serde_json = "1.0.81"
|
serde_json = "1.0.81"
|
||||||
remote-externalities = { git = "https://github.com/paritytech/substrate", branch = "master", package = "frame-remote-externalities" }
|
remote-externalities = { git = "https://github.com/paritytech/substrate", branch = "master", package = "frame-remote-externalities" }
|
||||||
tokio = { version = "1.24.2", features = ["macros"] }
|
tokio = { version = "1.24.2", features = ["macros"] }
|
||||||
|
|||||||
@@ -1097,19 +1097,6 @@ parameter_types! {
|
|||||||
pub const MigrationMaxKeyLen: u32 = 512;
|
pub const MigrationMaxKeyLen: u32 = 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_state_trie_migration::Config for Runtime {
|
|
||||||
type RuntimeEvent = RuntimeEvent;
|
|
||||||
type Currency = Balances;
|
|
||||||
type SignedDepositPerItem = MigrationSignedDepositPerItem;
|
|
||||||
type SignedDepositBase = MigrationSignedDepositBase;
|
|
||||||
type ControlOrigin = EnsureRoot<AccountId>;
|
|
||||||
type SignedFilter = frame_support::traits::NeverEnsureOrigin<AccountId>;
|
|
||||||
|
|
||||||
// Use same weights as substrate ones.
|
|
||||||
type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight<Runtime>;
|
|
||||||
type MaxKeyLen = MigrationMaxKeyLen;
|
|
||||||
}
|
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime where
|
||||||
Block = Block,
|
Block = Block,
|
||||||
@@ -1178,9 +1165,6 @@ construct_runtime! {
|
|||||||
// Fast unstake pallet: extension to staking.
|
// Fast unstake pallet: extension to staking.
|
||||||
FastUnstake: pallet_fast_unstake = 30,
|
FastUnstake: pallet_fast_unstake = 30,
|
||||||
|
|
||||||
// State trie migration pallet, only temporary.
|
|
||||||
StateTrieMigration: pallet_state_trie_migration = 35,
|
|
||||||
|
|
||||||
// Parachains pallets. Start indices at 40 to leave room.
|
// Parachains pallets. Start indices at 40 to leave room.
|
||||||
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 41,
|
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 41,
|
||||||
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 42,
|
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 42,
|
||||||
@@ -1243,7 +1227,7 @@ impl Get<&'static str> for StakingMigrationV11OldPallet {
|
|||||||
///
|
///
|
||||||
/// Should be cleared after every release.
|
/// Should be cleared after every release.
|
||||||
pub type Migrations = (
|
pub type Migrations = (
|
||||||
init_state_migration::InitMigrate,
|
clean_state_migration::CleanMigrate,
|
||||||
// "Use 2D weights in XCM v3" <https://github.com/paritytech/polkadot/pull/6134>
|
// "Use 2D weights in XCM v3" <https://github.com/paritytech/polkadot/pull/6134>
|
||||||
pallet_xcm::migration::v1::MigrateToV1<Runtime>,
|
pallet_xcm::migration::v1::MigrateToV1<Runtime>,
|
||||||
parachains_ump::migration::v1::MigrateToV1<Runtime>,
|
parachains_ump::migration::v1::MigrateToV1<Runtime>,
|
||||||
@@ -1940,43 +1924,47 @@ mod remote_tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod init_state_migration {
|
mod clean_state_migration {
|
||||||
use super::Runtime;
|
use super::Runtime;
|
||||||
use frame_support::traits::OnRuntimeUpgrade;
|
use frame_support::{pallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade};
|
||||||
use pallet_state_trie_migration::{AutoLimits, MigrationLimits, MigrationProcess};
|
use pallet_state_trie_migration::MigrationLimits;
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
use sp_std::prelude::*;
|
use sp_std::prelude::*;
|
||||||
|
|
||||||
|
#[storage_alias]
|
||||||
|
type AutoLimits = StorageValue<StateTrieMigration, Option<MigrationLimits>, ValueQuery>;
|
||||||
|
|
||||||
|
// Actual type of value is `MigrationTask<T>`, putting a dummy
|
||||||
|
// one to avoid the trait constraint on T.
|
||||||
|
// Since we only use `kill` it is fine.
|
||||||
|
#[storage_alias]
|
||||||
|
type MigrationProcess = StorageValue<StateTrieMigration, u32, ValueQuery>;
|
||||||
|
|
||||||
|
#[storage_alias]
|
||||||
|
type SignedMigrationMaxLimits = StorageValue<StateTrieMigration, MigrationLimits, OptionQuery>;
|
||||||
|
|
||||||
/// Initialize an automatic migration process.
|
/// Initialize an automatic migration process.
|
||||||
pub struct InitMigrate;
|
pub struct CleanMigrate;
|
||||||
impl OnRuntimeUpgrade for InitMigrate {
|
|
||||||
|
impl OnRuntimeUpgrade for CleanMigrate {
|
||||||
#[cfg(feature = "try-runtime")]
|
#[cfg(feature = "try-runtime")]
|
||||||
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
|
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
|
||||||
frame_support::ensure!(
|
|
||||||
AutoLimits::<Runtime>::get().is_none(),
|
|
||||||
"Automigration already started."
|
|
||||||
);
|
|
||||||
Ok(Default::default())
|
Ok(Default::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||||
if MigrationProcess::<Runtime>::get() == Default::default() &&
|
MigrationProcess::kill();
|
||||||
AutoLimits::<Runtime>::get().is_none()
|
AutoLimits::kill();
|
||||||
{
|
SignedMigrationMaxLimits::kill();
|
||||||
AutoLimits::<Runtime>::put(Some(MigrationLimits { item: 160, size: 204800 }));
|
<Runtime as frame_system::Config>::DbWeight::get().writes(3)
|
||||||
log::info!("Automatic trie migration started.");
|
|
||||||
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(2, 1)
|
|
||||||
} else {
|
|
||||||
log::info!("Automatic trie migration not started.");
|
|
||||||
<Runtime as frame_system::Config>::DbWeight::get().reads(2)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "try-runtime")]
|
#[cfg(feature = "try-runtime")]
|
||||||
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
|
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
|
||||||
frame_support::ensure!(
|
frame_support::ensure!(
|
||||||
AutoLimits::<Runtime>::get().is_some(),
|
!AutoLimits::exists() && !SignedMigrationMaxLimits::exists(),
|
||||||
"Automigration started."
|
"State migration clean.",
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user