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
--- a/pallets/app-promotion/Cargo.toml
+++ b/pallets/app-promotion/Cargo.toml
@@ -9,7 +9,7 @@
 license = 'GPLv3'
 name = 'pallet-app-promotion'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.1.5'
+version = '0.1.6'
 
 [package.metadata.docs.rs]
 targets = ['x86_64-unknown-linux-gnu']
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
before · pallets/nonfungible/CHANGELOG.md
1# Change Log23All notable changes to this project will be documented in this file.45<!-- bureaucrate goes here -->67## [0.1.14] - 2023-03-2889### Fixed1011- The weight of `transfer` and `transfer_from`.1213## [0.1.13] - 2023-01-201415### Fixed1617- The weight of properties when creating an item.1819## [0.1.12] - 2022-12-162021### Added2223- The function `tokenPropertyPermissions` and `setTokenPropertyPermissions` to `TokenProperties` interface.2425### Changed2627- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.2829## [0.1.11] - 2022-12-013031### Added3233- The functions `mintCross` to `ERC721UniqueExtensions` interface.3435## [0.1.10] - 2022-11-183637### Added3839- The functions `description`, `crossOwnerOf`, `tokenProperties` to `ERC721UniqueExtensions` interface.4041## [0.1.9] - 2022-11-144243### Changed4445- Added `transfer_cross` in eth functions.4647## [v0.1.8] - 2022-11-114849### Changed5051- Added `delete_properties` in eth functions. The `delete_property` function is now deprecated.5253## [v0.1.7] - 2022-11-025455### Changed5657- Use named structure `EthCrossAccount` in eth functions.5859## [v0.1.6] - 2022-20-106061### Change6263- Added `set_properties` method for `TokenProperties` interface.6465## [v0.1.5] - 2022-08-246667### Change6869- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.7071## [v0.1.4] 2022-08-167273### Other changes7475- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a7677- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf87879- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d9758081New methods allows to call `remove_prefix` with limit multiple times82in the same block83However, we don't use prefix removal limits, so upgrade is84straightforward8586Upstream-Change: https://github.com/paritytech/substrate/pull/114908788- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b8990## [0.1.2] - 2022-07-259192### Changed9394- New `token_uri` retrieval logic:9596      If the collection has a `url` property and it is not empty, it is returned.97      Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.9899      If the property `baseURI` is empty or absent, return "" (empty string)100      otherwise, if property `suffix` present and is non-empty, return concatenation of baseURI and suffix101      otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).102103## [0.1.1] - 2022-07-14104105### Added106107- Implementation of RPC method `token_owners`.108  For reasons of compatibility with this pallet, returns only one owner if token exists.109  This was an internal request to improve the web interface and support fractionalization event.
after · pallets/nonfungible/CHANGELOG.md
1# Change Log23All notable changes to this project will be documented in this file.45<!-- bureaucrate goes here -->6## [0.1.14] - 2023-04-1978- ### Fixed910- Useless `on_runtime_upgrade()` has been removed1112## [0.1.14] - 2023-03-281314### Fixed1516- The weight of `transfer` and `transfer_from`.1718## [0.1.13] - 2023-01-201920### Fixed2122- The weight of properties when creating an item.2324## [0.1.12] - 2022-12-162526### Added2728- The function `tokenPropertyPermissions` and `setTokenPropertyPermissions` to `TokenProperties` interface.2930### Changed3132- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.3334## [0.1.11] - 2022-12-013536### Added3738- The functions `mintCross` to `ERC721UniqueExtensions` interface.3940## [0.1.10] - 2022-11-184142### Added4344- The functions `description`, `crossOwnerOf`, `tokenProperties` to `ERC721UniqueExtensions` interface.4546## [0.1.9] - 2022-11-144748### Changed4950- Added `transfer_cross` in eth functions.5152## [v0.1.8] - 2022-11-115354### Changed5556- Added `delete_properties` in eth functions. The `delete_property` function is now deprecated.5758## [v0.1.7] - 2022-11-025960### Changed6162- Use named structure `EthCrossAccount` in eth functions.6364## [v0.1.6] - 2022-20-106566### Change6768- Added `set_properties` method for `TokenProperties` interface.6970## [v0.1.5] - 2022-08-247172### Change7374- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.7576## [v0.1.4] 2022-08-167778### Other changes7980- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a8182- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf88384- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d9758586New methods allows to call `remove_prefix` with limit multiple times87in the same block88However, we don't use prefix removal limits, so upgrade is89straightforward9091Upstream-Change: <https://github.com/paritytech/substrate/pull/11490>9293- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b9495## [0.1.2] - 2022-07-259697### Changed9899- New `token_uri` retrieval logic:100101      If the collection has a `url` property and it is not empty, it is returned.102      Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.103104      If the property `baseURI` is empty or absent, return "" (empty string)105      otherwise, if property `suffix` present and is non-empty, return concatenation of baseURI and suffix106      otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).107108## [0.1.1] - 2022-07-14109110### Added111112- Implementation of RPC method `token_owners`.113  For reasons of compatibility with this pallet, returns only one owner if token exists.114  This was an internal request to improve the web interface and support fractionalization event.
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>>();
 		}
 	}
 }