From 97c08920fc6b1349cca17b5561193003e944ebb5 Mon Sep 17 00:00:00 2001 From: zjb0807 Date: Tue, 21 May 2024 09:27:20 +0800 Subject: [PATCH] update state version to 1 on karura (#2762) --- Cargo.lock | 2 +- runtime/karura/Cargo.toml | 4 ++++ runtime/karura/src/lib.rs | 26 +++++++++++++++++++++++++- runtime/mandala/Cargo.toml | 4 ---- runtime/mandala/src/lib.rs | 24 ------------------------ 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3e521dc86..ff588a3c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5158,6 +5158,7 @@ dependencies = [ "pallet-proxy", "pallet-scheduler", "pallet-session", + "pallet-state-trie-migration", "pallet-sudo", "pallet-timestamp", "pallet-tips", @@ -6040,7 +6041,6 @@ dependencies = [ "pallet-root-testing", "pallet-scheduler", "pallet-session", - "pallet-state-trie-migration", "pallet-sudo", "pallet-timestamp", "pallet-tips", diff --git a/runtime/karura/Cargo.toml b/runtime/karura/Cargo.toml index 5705405a3..e11746e0a 100644 --- a/runtime/karura/Cargo.toml +++ b/runtime/karura/Cargo.toml @@ -54,6 +54,7 @@ sp-staking = { workspace = true } sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } +pallet-state-trie-migration = { workspace = true, optional = true } # cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -192,6 +193,7 @@ std = [ "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", + "pallet-state-trie-migration/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", @@ -287,6 +289,7 @@ runtime-benchmarks = [ "pallet-utility/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "sp-staking/runtime-benchmarks", + "pallet-state-trie-migration/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", @@ -350,6 +353,7 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", "pallet-utility/try-runtime", + "pallet-state-trie-migration/try-runtime", "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", diff --git a/runtime/karura/src/lib.rs b/runtime/karura/src/lib.rs index 37e1c477f..114e97f64 100644 --- a/runtime/karura/src/lib.rs +++ b/runtime/karura/src/lib.rs @@ -140,7 +140,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { #[cfg(feature = "disable-runtime-api")] apis: sp_version::create_apis_vec![[]], transaction_version: 2, - state_version: 0, + state_version: 1, }; /// The version information used to identify this runtime when compiled @@ -1789,6 +1789,28 @@ impl orml_parameters::Config for Runtime { type WeightInfo = (); } +parameter_types! { + // The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high) + pub MigrationSignedDepositPerItem: Balance = dollar(KAR); + pub MigrationSignedDepositBase: Balance = dollar(KAR); + pub const MigrationMaxKeyLen: u32 = 512; +} + +impl pallet_state_trie_migration::Config for Runtime { + // An origin that can control the whole pallet: should be Root, or a part of your council. + type ControlOrigin = EnsureRootOrTwoThirdsTechnicalCommittee; + // specific account for the migration, can trigger the signed migrations. + type SignedFilter = frame_support::traits::NeverEnsureOrigin; + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type RuntimeHoldReason = RuntimeHoldReason; + type MaxKeyLen = MigrationMaxKeyLen; + type SignedDepositPerItem = MigrationSignedDepositPerItem; + type SignedDepositBase = MigrationSignedDepositBase; + // Replace this with weight based on your runtime. + type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight; +} + construct_runtime!( pub enum Runtime { // Core & Utility @@ -1897,6 +1919,8 @@ construct_runtime!( // Parachain System, always put it at the end ParachainSystem: cumulus_pallet_parachain_system = 30, + StateTrieMigration: pallet_state_trie_migration = 254, + // Temporary Sudo: pallet_sudo = 255, } diff --git a/runtime/mandala/Cargo.toml b/runtime/mandala/Cargo.toml index e066bb211..f8cb1333d 100644 --- a/runtime/mandala/Cargo.toml +++ b/runtime/mandala/Cargo.toml @@ -58,7 +58,6 @@ sp-staking = { workspace = true } sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } -pallet-state-trie-migration = { workspace = true, optional = true } # cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -209,7 +208,6 @@ std = [ "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", - "pallet-state-trie-migration/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", @@ -309,7 +307,6 @@ runtime-benchmarks = [ "pallet-utility/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "sp-staking/runtime-benchmarks", - "pallet-state-trie-migration/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", @@ -383,7 +380,6 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", "pallet-utility/try-runtime", - "pallet-state-trie-migration/try-runtime", "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-parachain-system/try-runtime", diff --git a/runtime/mandala/src/lib.rs b/runtime/mandala/src/lib.rs index 79515d9fb..4ac585424 100644 --- a/runtime/mandala/src/lib.rs +++ b/runtime/mandala/src/lib.rs @@ -1872,28 +1872,6 @@ impl orml_parameters::Config for Runtime { type WeightInfo = (); } -parameter_types! { - // The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high) - pub MigrationSignedDepositPerItem: Balance = dollar(ACA); - pub MigrationSignedDepositBase: Balance = dollar(ACA); - pub const MigrationMaxKeyLen: u32 = 512; -} - -impl pallet_state_trie_migration::Config for Runtime { - // An origin that can control the whole pallet: should be Root, or a part of your council. - type ControlOrigin = EnsureRootOrTwoThirdsTechnicalCommittee; - // specific account for the migration, can trigger the signed migrations. - type SignedFilter = frame_support::traits::NeverEnsureOrigin; - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type RuntimeHoldReason = RuntimeHoldReason; - type MaxKeyLen = MigrationMaxKeyLen; - type SignedDepositPerItem = MigrationSignedDepositPerItem; - type SignedDepositBase = MigrationSignedDepositBase; - // Replace this with weight based on your runtime. - type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight; -} - #[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug)] pub struct ConvertEthereumTx; @@ -2163,8 +2141,6 @@ construct_runtime!( // Parachain System, always put it at the end ParachainSystem: cumulus_pallet_parachain_system = 160, - StateTrieMigration: pallet_state_trie_migration = 254, - // Dev Sudo: pallet_sudo = 255, }