Skip to content

Commit 3cbbf1e

Browse files
authored
update state version to 1 on acala (#2799)
* update state version to 1 on acala * add migration to clean StateTrieMigration * fix
1 parent 613470c commit 3cbbf1e

File tree

5 files changed

+39
-35
lines changed

5 files changed

+39
-35
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/acala/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ sp-staking = { workspace = true }
5555
sp-std = { workspace = true }
5656
sp-transaction-pool = { workspace = true }
5757
sp-version = { workspace = true }
58+
pallet-state-trie-migration = { workspace = true, optional = true }
5859

5960
# cumulus
6061
cumulus-pallet-aura-ext = { workspace = true }
@@ -199,6 +200,7 @@ std = [
199200
"sp-transaction-pool/std",
200201
"sp-version/std",
201202
"substrate-wasm-builder",
203+
"pallet-state-trie-migration/std",
202204

203205
"cumulus-pallet-aura-ext/std",
204206
"cumulus-pallet-parachain-system/std",
@@ -295,6 +297,7 @@ runtime-benchmarks = [
295297
"pallet-utility/runtime-benchmarks",
296298
"sp-runtime/runtime-benchmarks",
297299
"sp-staking/runtime-benchmarks",
300+
"pallet-state-trie-migration/runtime-benchmarks",
298301

299302
"cumulus-pallet-parachain-system/runtime-benchmarks",
300303
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
@@ -355,6 +358,7 @@ try-runtime = [
355358
"pallet-transaction-payment/try-runtime",
356359
"pallet-treasury/try-runtime",
357360
"pallet-utility/try-runtime",
361+
"pallet-state-trie-migration/try-runtime",
358362

359363
"cumulus-pallet-aura-ext/try-runtime",
360364
"cumulus-pallet-parachain-system/try-runtime",

runtime/acala/src/lib.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
132132
impl_version: 0,
133133
apis: RUNTIME_API_VERSIONS,
134134
transaction_version: 3,
135-
state_version: 0,
135+
state_version: 1,
136136
};
137137

138138
/// The version information used to identify this runtime when compiled
@@ -1831,6 +1831,32 @@ impl orml_parameters::Config for Runtime {
18311831
type WeightInfo = ();
18321832
}
18331833

1834+
frame_support::ord_parameter_types! {
1835+
pub const MigController: AccountId = AccountId::from(hex_literal::hex!("ec68c9ec1f6233f3d8169e06e2c94df703c45c05eef923169bf2703b08797315"));
1836+
}
1837+
1838+
parameter_types! {
1839+
// 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)
1840+
pub MigrationSignedDepositPerItem: Balance = dollar(ACA);
1841+
pub MigrationSignedDepositBase: Balance = dollar(ACA);
1842+
pub const MigrationMaxKeyLen: u32 = 512;
1843+
}
1844+
1845+
impl pallet_state_trie_migration::Config for Runtime {
1846+
// An origin that can control the whole pallet: should be Root, or a part of your council.
1847+
type ControlOrigin = EnsureRootOrTwoThirdsTechnicalCommittee;
1848+
// specific account for the migration, can trigger the signed migrations.
1849+
type SignedFilter = frame_system::EnsureSignedBy<MigController, AccountId>;
1850+
type RuntimeEvent = RuntimeEvent;
1851+
type Currency = Balances;
1852+
type RuntimeHoldReason = RuntimeHoldReason;
1853+
type MaxKeyLen = MigrationMaxKeyLen;
1854+
type SignedDepositPerItem = MigrationSignedDepositPerItem;
1855+
type SignedDepositBase = MigrationSignedDepositBase;
1856+
// Replace this with weight based on your runtime.
1857+
type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight<Runtime>;
1858+
}
1859+
18341860
construct_runtime!(
18351861
pub enum Runtime {
18361862
// Core & Utility
@@ -1940,6 +1966,8 @@ construct_runtime!(
19401966
// Parachain System, always put it at the end
19411967
ParachainSystem: cumulus_pallet_parachain_system = 30,
19421968

1969+
StateTrieMigration: pallet_state_trie_migration = 254,
1970+
19431971
// Temporary
19441972
Sudo: pallet_sudo = 255,
19451973
}

runtime/karura/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ sp-staking = { workspace = true }
5555
sp-std = { workspace = true }
5656
sp-transaction-pool = { workspace = true }
5757
sp-version = { workspace = true }
58-
pallet-state-trie-migration = { workspace = true, optional = true }
5958

6059
# cumulus
6160
cumulus-pallet-aura-ext = { workspace = true }
@@ -201,7 +200,6 @@ std = [
201200
"sp-transaction-pool/std",
202201
"sp-version/std",
203202
"substrate-wasm-builder",
204-
"pallet-state-trie-migration/std",
205203

206204
"cumulus-pallet-aura-ext/std",
207205
"cumulus-pallet-parachain-system/std",
@@ -300,7 +298,6 @@ runtime-benchmarks = [
300298
"pallet-utility/runtime-benchmarks",
301299
"sp-runtime/runtime-benchmarks",
302300
"sp-staking/runtime-benchmarks",
303-
"pallet-state-trie-migration/runtime-benchmarks",
304301

305302
"cumulus-pallet-parachain-system/runtime-benchmarks",
306303
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
@@ -361,7 +358,6 @@ try-runtime = [
361358
"pallet-transaction-payment/try-runtime",
362359
"pallet-treasury/try-runtime",
363360
"pallet-utility/try-runtime",
364-
"pallet-state-trie-migration/try-runtime",
365361

366362
"cumulus-pallet-aura-ext/try-runtime",
367363
"cumulus-pallet-parachain-system/try-runtime",

runtime/karura/src/lib.rs

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,32 +1838,6 @@ impl orml_parameters::Config for Runtime {
18381838
type WeightInfo = ();
18391839
}
18401840

1841-
frame_support::ord_parameter_types! {
1842-
pub const MigController: AccountId = AccountId::from(hex_literal::hex!("ec68c9ec1f6233f3d8169e06e2c94df703c45c05eef923169bf2703b08797315"));
1843-
}
1844-
1845-
parameter_types! {
1846-
// 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)
1847-
pub MigrationSignedDepositPerItem: Balance = dollar(KAR);
1848-
pub MigrationSignedDepositBase: Balance = dollar(KAR);
1849-
pub const MigrationMaxKeyLen: u32 = 512;
1850-
}
1851-
1852-
impl pallet_state_trie_migration::Config for Runtime {
1853-
// An origin that can control the whole pallet: should be Root, or a part of your council.
1854-
type ControlOrigin = EnsureRootOrTwoThirdsTechnicalCommittee;
1855-
// specific account for the migration, can trigger the signed migrations.
1856-
type SignedFilter = frame_system::EnsureSignedBy<MigController, AccountId>;
1857-
type RuntimeEvent = RuntimeEvent;
1858-
type Currency = Balances;
1859-
type RuntimeHoldReason = RuntimeHoldReason;
1860-
type MaxKeyLen = MigrationMaxKeyLen;
1861-
type SignedDepositPerItem = MigrationSignedDepositPerItem;
1862-
type SignedDepositBase = MigrationSignedDepositBase;
1863-
// Replace this with weight based on your runtime.
1864-
type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight<Runtime>;
1865-
}
1866-
18671841
construct_runtime!(
18681842
pub enum Runtime {
18691843
// Core & Utility
@@ -1974,8 +1948,6 @@ construct_runtime!(
19741948
// Parachain System, always put it at the end
19751949
ParachainSystem: cumulus_pallet_parachain_system = 30,
19761950

1977-
StateTrieMigration: pallet_state_trie_migration = 254,
1978-
19791951
// Temporary
19801952
Sudo: pallet_sudo = 255,
19811953
}
@@ -2022,8 +1994,12 @@ pub type Executive = frame_executive::Executive<
20221994
Migrations,
20231995
>;
20241996

1997+
parameter_types! {
1998+
pub const StateTrieMigrationName: &'static str = "StateTrieMigration";
1999+
}
2000+
20252001
#[allow(unused_parens)]
2026-
type Migrations = ();
2002+
type Migrations = (frame_support::migrations::RemovePallet<StateTrieMigrationName, RocksDbWeight>);
20272003

20282004
#[cfg(feature = "runtime-benchmarks")]
20292005
#[macro_use]

0 commit comments

Comments
 (0)