git.delta.rocks / unique-network / refs/commits / 8545aff0545e

difftreelog

feat use state_version = 1

Yaroslav Bolyukin2023-05-31parent: #fbb698d.patch.diff
in: master

10 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5892,6 +5892,7 @@
  "pallet-preimage",
  "pallet-refungible",
  "pallet-session",
+ "pallet-state-trie-migration",
  "pallet-structure",
  "pallet-sudo",
  "pallet-template-transaction-payment",
@@ -9395,6 +9396,7 @@
  "pallet-preimage",
  "pallet-refungible",
  "pallet-session",
+ "pallet-state-trie-migration",
  "pallet-structure",
  "pallet-sudo",
  "pallet-template-transaction-payment",
@@ -13812,6 +13814,7 @@
  "pallet-preimage",
  "pallet-refungible",
  "pallet-session",
+ "pallet-state-trie-migration",
  "pallet-structure",
  "pallet-sudo",
  "pallet-template-transaction-payment",
modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -107,6 +107,7 @@
 pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
 pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
 pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
+pallet-state-trie-migration = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
 pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
 pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
 pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -31,7 +31,7 @@
 use sp_arithmetic::traits::One;
 use frame_system::{
 	limits::{BlockLength, BlockWeights},
-	EnsureRoot,
+	EnsureRoot, EnsureNever,
 };
 use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};
 use crate::{
@@ -116,6 +116,22 @@
 }
 
 parameter_types! {
+	pub const MigrationMaxKeyLen: u32 = 512;
+}
+
+impl pallet_state_trie_migration::Config for Runtime {
+	type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight<Self>;
+	type RuntimeEvent = RuntimeEvent;
+	type Currency = Balances;
+	type SignedDepositPerItem = ();
+	type SignedDepositBase = ();
+	type ControlOrigin = EnsureRoot<AccountId>;
+	// Only root can perform this migration
+	type SignedFilter = EnsureNever<AccountId>;
+	type MaxKeyLen = MigrationMaxKeyLen;
+}
+
+parameter_types! {
 	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
 }
 
modifiedruntime/common/construct_runtime.rsdiffbeforeafterboth
--- a/runtime/common/construct_runtime.rs
+++ b/runtime/common/construct_runtime.rs
@@ -25,6 +25,7 @@
 				UncheckedExtrinsic = UncheckedExtrinsic
 			{
 				System: frame_system = 0,
+				StateTrieMigration: pallet_state_trie_migration = 1,
 
 				ParachainSystem: cumulus_pallet_parachain_system = 20,
 				ParachainInfo: parachain_info = 21,
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
after · runtime/opal/Cargo.toml
1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Opal Runtime'8edition = '2021'9homepage = 'https://unique.network'10license = 'GPLv3'11name = 'opal-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version.workspace = true1415[package.metadata.docs.rs]16targets = ['x86_64-unknown-linux-gnu']1718[features]19default = ['opal-runtime', 'std']20limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']21opal-runtime = ['app-promotion', 'collator-selection', 'foreign-assets', 'pallet-test-utils', 'preimage', 'refungible']22pov-estimate = []23runtime-benchmarks = [24	"pallet-preimage/runtime-benchmarks",25	'cumulus-pallet-parachain-system/runtime-benchmarks',26	'frame-benchmarking',27	'frame-support/runtime-benchmarks',28	'frame-system-benchmarking',29	'frame-system/runtime-benchmarks',30	'hex-literal',31	'pallet-app-promotion/runtime-benchmarks',32	'pallet-balances/runtime-benchmarks',33	'pallet-collator-selection/runtime-benchmarks',34	'pallet-common/runtime-benchmarks',35	'pallet-configuration/runtime-benchmarks',36	'pallet-ethereum/runtime-benchmarks',37	'pallet-evm-coder-substrate/runtime-benchmarks',38	'pallet-evm-migration/runtime-benchmarks',39	'pallet-foreign-assets/runtime-benchmarks',40	'pallet-fungible/runtime-benchmarks',41	'pallet-identity/runtime-benchmarks',42	'pallet-inflation/runtime-benchmarks',43	'pallet-maintenance/runtime-benchmarks',44	'pallet-nonfungible/runtime-benchmarks',45	'pallet-refungible/runtime-benchmarks',46	'pallet-structure/runtime-benchmarks',47	'pallet-timestamp/runtime-benchmarks',48	'pallet-unique-scheduler-v2/runtime-benchmarks',49	'pallet-unique/runtime-benchmarks',50	'pallet-xcm/runtime-benchmarks',51	'sp-runtime/runtime-benchmarks',52	'xcm-builder/runtime-benchmarks',53]54std = [55	'codec/std',56	'cumulus-pallet-aura-ext/std',57	'cumulus-pallet-parachain-system/std',58	'cumulus-pallet-xcm/std',59	'cumulus-pallet-xcmp-queue/std',60	'cumulus-primitives-core/std',61	'cumulus-primitives-utility/std',62	'frame-executive/std',63	'frame-support/std',64	'frame-system-rpc-runtime-api/std',65	'frame-system/std',66	'frame-try-runtime/std',67	'pallet-aura/std',68	'pallet-balances/std',69	# 'pallet-contracts/std',70	# 'pallet-contracts-primitives/std',71	# 'pallet-contracts-rpc-runtime-api/std',72	# 'pallet-contract-helpers/std',73	"pallet-authorship/std",74	"pallet-preimage/std",75	"pallet-session/std",76	"pallet-state-trie-migration/std",77	"sp-consensus-aura/std",78	'app-promotion-rpc/std',79	'evm-coder/std',80	'fp-rpc/std',81	'fp-self-contained/std',82	'pallet-app-promotion/std',83	'pallet-balances-adapter/std',84	'pallet-base-fee/std',85	'pallet-charge-transaction/std',86	'pallet-collator-selection/std',87	'pallet-common/std',88	'pallet-configuration/std',89	'pallet-ethereum/std',90	'pallet-evm-coder-substrate/std',91	'pallet-evm-contract-helpers/std',92	'pallet-evm-migration/std',93	'pallet-evm-transaction-payment/std',94	'pallet-evm/std',95	'pallet-fungible/std',96	'pallet-identity/std',97	'pallet-inflation/std',98	'pallet-nonfungible/std',99	'pallet-refungible/std',100	'pallet-structure/std',101	'pallet-sudo/std',102	'pallet-timestamp/std',103	'pallet-transaction-payment-rpc-runtime-api/std',104	'pallet-transaction-payment/std',105	'pallet-treasury/std',106	'pallet-unique-scheduler-v2/std',107	'pallet-unique/std',108	'parachain-info/std',109	'serde',110	'sp-api/std',111	'sp-block-builder/std',112	'sp-core/std',113	'sp-inherents/std',114	'sp-io/std',115	'sp-offchain/std',116	'sp-runtime/std',117	'sp-session/std',118	'sp-std/std',119	'sp-transaction-pool/std',120	'sp-version/std',121	'up-common/std',122	'up-data-structs/std',123	'up-pov-estimate-rpc/std',124	'up-rpc/std',125	'up-sponsorship/std',126	'xcm-builder/std',127	'xcm-executor/std',128	'xcm/std',129130	"orml-tokens/std",131	"orml-traits/std",132	"orml-vesting/std",133	"orml-xcm-support/std",134	"orml-xtokens/std",135	"pallet-foreign-assets/std",136137	'pallet-maintenance/std',138	'pallet-test-utils/std',139]140try-runtime = [141	"pallet-authorship/try-runtime",142	"pallet-collator-selection/try-runtime",143	"pallet-identity/try-runtime",144	"pallet-preimage/try-runtime",145	"pallet-session/try-runtime",146	'cumulus-pallet-aura-ext/try-runtime',147	'cumulus-pallet-dmp-queue/try-runtime',148	'cumulus-pallet-parachain-system/try-runtime',149	'cumulus-pallet-xcm/try-runtime',150	'cumulus-pallet-xcmp-queue/try-runtime',151	'fp-self-contained/try-runtime',152	'frame-executive/try-runtime',153	'frame-support/try-runtime',154	'frame-system/try-runtime',155	'frame-try-runtime',156	'frame-try-runtime?/try-runtime',157	'orml-tokens/try-runtime',158	'orml-vesting/try-runtime',159	'orml-xtokens/try-runtime',160	'pallet-app-promotion/try-runtime',161	'pallet-aura/try-runtime',162	'pallet-balances/try-runtime',163	'pallet-balances-adapter/try-runtime',164	'pallet-base-fee/try-runtime',165	'pallet-charge-transaction/try-runtime',166	'pallet-common/try-runtime',167	'pallet-configuration/try-runtime',168	'pallet-ethereum/try-runtime',169	'pallet-evm-coder-substrate/try-runtime',170	'pallet-evm-contract-helpers/try-runtime',171	'pallet-evm-migration/try-runtime',172	'pallet-evm-transaction-payment/try-runtime',173	'pallet-evm/try-runtime',174	'pallet-foreign-assets/try-runtime',175	'pallet-fungible/try-runtime',176	'pallet-inflation/try-runtime',177	'pallet-maintenance/try-runtime',178	'pallet-nonfungible/try-runtime',179	'pallet-refungible/try-runtime',180	'pallet-structure/try-runtime',181	'pallet-sudo/try-runtime',182	'pallet-test-utils/try-runtime',183	'pallet-timestamp/try-runtime',184	'pallet-transaction-payment/try-runtime',185	'pallet-treasury/try-runtime',186	'pallet-unique-scheduler-v2/try-runtime',187	'pallet-unique/try-runtime',188	'pallet-xcm/try-runtime',189	'parachain-info/try-runtime',190]191192app-promotion = []193collator-selection = []194foreign-assets = []195pallet-test-utils = []196preimage = []197refungible = []198scheduler = []199200################################################################################201# local dependencies202203[dependencies]204# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.205codec = { workspace = true, package = "parity-scale-codec" }206207cumulus-pallet-aura-ext = { workspace = true }208cumulus-pallet-dmp-queue = { workspace = true }209cumulus-pallet-parachain-system = { workspace = true }210cumulus-pallet-xcm = { workspace = true }211cumulus-pallet-xcmp-queue = { workspace = true }212cumulus-primitives-core = { workspace = true }213cumulus-primitives-timestamp = { workspace = true }214cumulus-primitives-utility = { workspace = true }215frame-executive = { workspace = true }216frame-support = { workspace = true }217frame-system = { workspace = true }218frame-system-rpc-runtime-api = { workspace = true }219orml-tokens = { workspace = true }220orml-traits = { workspace = true }221orml-vesting = { workspace = true }222orml-xcm-support = { workspace = true }223orml-xtokens = { workspace = true }224pallet-aura = { workspace = true }225pallet-authorship = { workspace = true }226pallet-balances = { features = ["insecure_zero_ed"], workspace = true }227pallet-preimage = { workspace = true }228pallet-session = { workspace = true }229pallet-state-trie-migration = { workspace = true }230pallet-sudo = { workspace = true }231pallet-timestamp = { workspace = true }232pallet-transaction-payment = { workspace = true }233pallet-transaction-payment-rpc-runtime-api = { workspace = true }234pallet-treasury = { workspace = true }235pallet-xcm = { workspace = true }236parachain-info = { workspace = true }237polkadot-parachain = { workspace = true }238smallvec = { workspace = true }239sp-api = { workspace = true }240sp-arithmetic = { workspace = true }241sp-block-builder = { workspace = true }242sp-consensus-aura = { workspace = true }243sp-core = { workspace = true }244sp-inherents = { workspace = true }245sp-io = { workspace = true }246sp-offchain = { workspace = true }247sp-runtime = { workspace = true }248sp-session = { workspace = true }249sp-std = { workspace = true }250sp-transaction-pool = { workspace = true }251sp-version = { workspace = true }252xcm = { workspace = true }253xcm-builder = { workspace = true }254xcm-executor = { workspace = true }255256app-promotion-rpc = { workspace = true }257derivative = { workspace = true }258evm-coder = { workspace = true }259fp-evm = { workspace = true }260fp-rpc = { workspace = true }261fp-self-contained = { workspace = true }262log = { workspace = true }263num_enum = { workspace = true }264pallet-app-promotion = { workspace = true }265pallet-balances-adapter = { workspace = true }266pallet-base-fee = { workspace = true }267pallet-charge-transaction = { workspace = true }268pallet-collator-selection = { workspace = true }269pallet-common = { workspace = true }270pallet-configuration = { workspace = true }271pallet-ethereum = { workspace = true }272pallet-evm = { workspace = true }273pallet-evm-coder-substrate = { workspace = true }274pallet-evm-contract-helpers = { workspace = true }275pallet-evm-migration = { workspace = true }276pallet-evm-precompile-simple = { workspace = true }277pallet-evm-transaction-payment = { workspace = true }278pallet-foreign-assets = { workspace = true }279pallet-fungible = { workspace = true }280pallet-identity = { workspace = true }281pallet-inflation = { workspace = true }282pallet-maintenance = { workspace = true }283pallet-nonfungible = { workspace = true }284pallet-refungible = { workspace = true }285pallet-structure = { workspace = true }286pallet-unique = { workspace = true }287pallet-unique-scheduler-v2 = { workspace = true }288precompile-utils-macro = { workspace = true }289scale-info = { workspace = true }290up-common = { workspace = true }291up-data-structs = { workspace = true }292up-pov-estimate-rpc = { workspace = true }293up-rpc = { workspace = true }294up-sponsorship = { workspace = true }295296################################################################################297# Optional dependencies298299frame-benchmarking = { workspace = true, optional = true }300frame-system-benchmarking = { workspace = true, optional = true }301frame-try-runtime = { workspace = true, optional = true }302hex-literal = { workspace = true, optional = true }303serde = { workspace = true, optional = true }304305################################################################################306# Test dependencies307308pallet-test-utils = { workspace = true }309310################################################################################311# Other Dependencies312313impl-trait-for-tuples = { workspace = true }314315[build-dependencies]316substrate-wasm-builder = { workspace = true }
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -56,7 +56,7 @@
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 3,
-	state_version: 0,
+	state_version: 1,
 };
 
 parameter_types! {
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -75,6 +75,7 @@
 	"pallet-identity/std",
 	"pallet-preimage/std",
 	"pallet-session/std",
+	"pallet-state-trie-migration/std",
 	"sp-consensus-aura/std",
 	'app-promotion-rpc/std',
 	'evm-coder/std',
@@ -217,6 +218,7 @@
 pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
 pallet-preimage = { workspace = true }
 pallet-session = { workspace = true }
+pallet-state-trie-migration = { workspace = true }
 pallet-sudo = { workspace = true }
 pallet-timestamp = { workspace = true }
 pallet-transaction-payment = { workspace = true }
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -59,7 +59,7 @@
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 3,
-	state_version: 0,
+	state_version: 1,
 };
 
 parameter_types! {
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -72,6 +72,7 @@
 	"pallet-identity/std",
 	"pallet-preimage/std",
 	"pallet-session/std",
+	"pallet-state-trie-migration/std",
 	"sp-consensus-aura/std",
 	'app-promotion-rpc/std',
 	'evm-coder/std',
@@ -216,6 +217,7 @@
 pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
 pallet-preimage = { workspace = true }
 pallet-session = { workspace = true }
+pallet-state-trie-migration = { workspace = true }
 pallet-sudo = { workspace = true }
 pallet-timestamp = { workspace = true }
 pallet-transaction-payment = { workspace = true }
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -56,7 +56,7 @@
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 3,
-	state_version: 0,
+	state_version: 1,
 };
 
 parameter_types! {