git.delta.rocks / unique-network / refs/commits / 4efe3bf847ba

difftreelog

Merge pull request #920 from UniqueNetwork/fix/on-runtime-upgrade

Yaroslav Bolyukin2023-04-20parents: #2eecdab #81e4404.patch.diff
in: master

9 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5996,7 +5996,7 @@
 
 [[package]]
 name = "pallet-app-promotion"
-version = "0.1.5"
+version = "0.1.6"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -167,6 +167,8 @@
 					.map(|k| (k, 1 << 100))
 					.collect(),
 			},
+			common: Default::default(),
+			nonfungible: Default::default(),
 			treasury: Default::default(),
 			tokens: TokensConfig { balances: vec![] },
 			sudo: SudoConfig {
@@ -225,6 +227,8 @@
 					.expect("WASM binary was not build, please build it!")
 					.to_vec(),
 			},
+			common: Default::default(),
+			nonfungible: Default::default(),
 			balances: BalancesConfig {
 				balances: $endowed_accounts
 					.iter()
modifiedpallets/app-promotion/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/app-promotion/CHANGELOG.md
+++ b/pallets/app-promotion/CHANGELOG.md
@@ -3,6 +3,11 @@
 All notable changes to this project will be documented in this file.
 
 <!-- bureaucrate goes here -->
+## [0.1.6] - 2023-04-19
+
+- ### Fixed
+
+- Useless `on_runtime_upgrade()` has been removed
 
 ## [0.1.5] - 2023-02-14
 
modifiedpallets/app-promotion/Cargo.tomldiffbeforeafterboth
before · pallets/app-promotion/Cargo.toml
1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6description = 'Unique App Promotion Pallet'7edition = '2021'8homepage = 'https://unique.network'9license = 'GPLv3'10name = 'pallet-app-promotion'11repository = 'https://github.com/UniqueNetwork/unique-chain'12version = '0.1.5'1314[package.metadata.docs.rs]15targets = ['x86_64-unknown-linux-gnu']1617[features]18default = ['std']19runtime-benchmarks = [20	'frame-benchmarking',21	'frame-support/runtime-benchmarks',22	'frame-system/runtime-benchmarks',23	# 'pallet-unique/runtime-benchmarks',24]25std = [26	'codec/std',27	'frame-benchmarking/std',28	'frame-support/std',29	'frame-system/std',30	'pallet-balances/std',31	'pallet-evm/std',32	'sp-core/std',33	'sp-runtime/std',34	'sp-std/std',3536]37try-runtime = ["frame-support/try-runtime"]3839[dependencies]40################################################################################41# Substrate Dependencies4243# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.44codec = { workspace = true, package = "parity-scale-codec" }4546scale-info = { workspace = true }4748frame-benchmarking = { workspace = true, optional = true }49frame-support = { workspace = true }50frame-system = { workspace = true }51pallet-balances = { workspace = true }52pallet-evm = { workspace = true }53sp-core = { workspace = true }54sp-runtime = { workspace = true }55sp-std = { workspace = true }5657################################################################################58# local dependencies5960pallet-common = { workspace = true }61pallet-configuration = { workspace = true }62pallet-evm-contract-helpers = { workspace = true }63pallet-evm-migration = { workspace = true }64pallet-unique = { workspace = true }65up-data-structs = { workspace = true }6667# [dev-dependencies]6869################################################################################70# Other7172log = { version = "0.4.16", default-features = false }
modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -263,10 +263,6 @@
 	pub type PreviousCalculatedRecord<T: Config> =
 		StorageValue<Value = (T::AccountId, T::BlockNumber), QueryKind = OptionQuery>;
 
-	#[pallet::storage]
-	pub(crate) type UpgradedToReserves<T: Config> =
-		StorageValue<Value = bool, QueryKind = ValueQuery>;
-
 	#[pallet::hooks]
 	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
 		/// Block overflow is impossible due to the fact that the unstake algorithm in on_initialize
@@ -289,12 +285,6 @@
 			}
 
 			<T as Config>::WeightInfo::on_initialize(counter)
-		}
-
-		fn on_runtime_upgrade() -> Weight {
-			<UpgradedToReserves<T>>::kill();
-
-			T::DbWeight::get().reads_writes(0, 1)
 		}
 	}
 
modifiedpallets/common/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/common/CHANGELOG.md
+++ b/pallets/common/CHANGELOG.md
@@ -3,7 +3,12 @@
 All notable changes to this project will be documented in this file.
 
 <!-- bureaucrate goes here -->
+## [0.1.14] - 2023-04-19
+
+- ### Fixed
 
+- Useless `on_runtime_upgrade()` has been removed
+
 ## [0.1.14] - 2023-03-28
 
 ### Added
@@ -82,7 +87,7 @@
 However, we don't use prefix removal limits, so upgrade is
 straightforward
 
-Upstream-Change: https://github.com/paritytech/substrate/pull/11490
+Upstream-Change: <https://github.com/paritytech/substrate/pull/11490>
 
 - build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
 
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -420,10 +420,11 @@
 
 #[frame_support::pallet]
 pub mod pallet {
+	use core::marker::PhantomData;
+
 	use super::*;
 	use dispatch::CollectionDispatch;
 	use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key, traits::StorageVersion};
-	use frame_system::pallet_prelude::*;
 	use frame_support::traits::Currency;
 	use up_data_structs::{TokenId, mapping::TokenAddressMapping};
 	use scale_info::TypeInfo;
@@ -479,6 +480,23 @@
 		}
 	}
 
+	#[pallet::genesis_config]
+	pub struct GenesisConfig<T>(PhantomData<T>);
+
+	#[cfg(feature = "std")]
+	impl<T: Config> Default for GenesisConfig<T> {
+		fn default() -> Self {
+			Self(Default::default())
+		}
+	}
+
+	#[pallet::genesis_build]
+	impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
+		fn build(&self) {
+			StorageVersion::new(1).put::<Pallet<T>>();
+		}
+	}
+
 	impl<T: Config> Pallet<T> {
 		/// Helper function that handles deposit events
 		pub fn deposit_event(event: Event<T>) {
@@ -869,15 +887,6 @@
 		),
 		QueryKind = OptionQuery,
 	>;
-
-	#[pallet::hooks]
-	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
-		fn on_runtime_upgrade() -> Weight {
-			StorageVersion::new(1).put::<Pallet<T>>();
-
-			Weight::zero()
-		}
-	}
 }
 
 impl<T: Config> Pallet<T> {
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/nonfungible/CHANGELOG.md
+++ b/pallets/nonfungible/CHANGELOG.md
@@ -3,7 +3,12 @@
 All notable changes to this project will be documented in this file.
 
 <!-- bureaucrate goes here -->
+## [0.1.14] - 2023-04-19
+
+- ### Fixed
 
+- Useless `on_runtime_upgrade()` has been removed
+
 ## [0.1.14] - 2023-03-28
 
 ### Fixed
@@ -83,7 +88,7 @@
 However, we don't use prefix removal limits, so upgrade is
 straightforward
 
-Upstream-Change: https://github.com/paritytech/substrate/pull/11490
+Upstream-Change: <https://github.com/paritytech/substrate/pull/11490>
 
 - build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
 
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -283,13 +283,20 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Upgrade from the old schema to properties.
-	#[pallet::hooks]
-	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
-		fn on_runtime_upgrade() -> Weight {
-			StorageVersion::new(1).put::<Pallet<T>>();
+	#[pallet::genesis_config]
+	pub struct GenesisConfig<T>(PhantomData<T>);
 
-			Weight::zero()
+	#[cfg(feature = "std")]
+	impl<T: Config> Default for GenesisConfig<T> {
+		fn default() -> Self {
+			Self(Default::default())
+		}
+	}
+
+	#[pallet::genesis_build]
+	impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
+		fn build(&self) {
+			StorageVersion::new(1).put::<Pallet<T>>();
 		}
 	}
 }