git.delta.rocks / unique-network / refs/commits / 8bbc6aebf29e

difftreelog

Merge pull request #197 from UniqueNetwork/feature/CORE-167

kozyrevdev2021-10-04parents: #511eef6 #854f33e.patch.diff
in: master
Limits logic fixed. Tests added

5 files changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -306,9 +306,6 @@
 		/// Amount of collections destroyed, used for total amount tracking with
 		/// CreatedCollectionCount
 		DestroyedCollectionCount: u32;
-		/// Total amount of account owned tokens (NFTs + RFTs + unique fungibles)
-		/// Account id (real)
-		pub AccountItemCount get(fn account_item_count): map hasher(twox_64_concat) T::AccountId => u32;
 		//#endregion
 
 		//#region Basic collections
@@ -1125,6 +1122,7 @@
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 
 			let collection = Self::get_collection(collection_id)?;
+			Self::meta_update_check(&sender, &collection, item_id)?;
 
 			Self::set_variable_meta_data_internal(&sender, &collection, item_id, data)?;
 
@@ -1647,11 +1645,19 @@
 		collection.consume_sload()?;
 		let account_items: u32 =
 			<AddressTokens<T>>::get(collection_id, recipient.as_sub()).len() as u32;
-		ensure!(
-			collection.limits.account_token_ownership_limit > account_items,
-			Error::<T>::AccountTokenLimitExceeded
-		);
 
+		// zero limit means collection limit is disabled
+		// otherwise get lower value
+		let limit = if collection.limits.account_token_ownership_limit == 0
+			|| collection.limits.account_token_ownership_limit > ACCOUNT_TOKEN_OWNERSHIP_LIMIT
+		{
+			ACCOUNT_TOKEN_OWNERSHIP_LIMIT
+		} else {
+			collection.limits.account_token_ownership_limit
+		};
+
+		ensure!(limit > account_items, Error::<T>::AccountTokenLimitExceeded);
+
 		// preliminary transfer check
 		ensure!(collection.transfers_enabled, Error::<T>::TransferNotAllowed);
 
@@ -1674,12 +1680,23 @@
 			as u32)
 			.checked_add(amount)
 			.ok_or(Error::<T>::AccountTokenLimitExceeded)?;
+
+		// zero limit means collection limit is disabled
+		// otherwise get lower value
+		let account_token_limit = if collection.limits.account_token_ownership_limit == 0
+			|| collection.limits.account_token_ownership_limit > ACCOUNT_TOKEN_OWNERSHIP_LIMIT
+		{
+			ACCOUNT_TOKEN_OWNERSHIP_LIMIT
+		} else {
+			collection.limits.account_token_ownership_limit
+		};
+
 		ensure!(
 			collection.limits.token_limit >= total_items,
 			Error::<T>::CollectionTokenLimitExceeded
 		);
 		ensure!(
-			collection.limits.account_token_ownership_limit >= account_items,
+			account_token_limit >= account_items,
 			Error::<T>::AccountTokenLimitExceeded
 		);
 
@@ -2409,32 +2426,19 @@
 		item_index: TokenId,
 		owner: &T::CrossAccountId,
 	) -> DispatchResult {
-		// add to account limit
 		collection.consume_sload()?;
-		if <AccountItemCount<T>>::contains_key(owner.as_sub()) {
-			// bound Owned tokens by a single address
+		let list_exists = <AddressTokens<T>>::contains_key(collection.id, owner.as_sub());
+		if list_exists {
 			collection.consume_sload()?;
-			let count = <AccountItemCount<T>>::get(owner.as_sub());
+			let mut list = <AddressTokens<T>>::get(collection.id, owner.as_sub());
+
+			// bound Owned tokens by a single address in collection
+			let account_items: u32 = list.len() as u32;
 			ensure!(
-				count < ACCOUNT_TOKEN_OWNERSHIP_LIMIT,
+				account_items < ACCOUNT_TOKEN_OWNERSHIP_LIMIT,
 				Error::<T>::AddressOwnershipLimitExceeded
 			);
 
-			collection.consume_sstore()?;
-			<AccountItemCount<T>>::insert(
-				owner.as_sub(),
-				count.checked_add(1).ok_or(Error::<T>::NumOverflow)?,
-			);
-		} else {
-			collection.consume_sstore()?;
-			<AccountItemCount<T>>::insert(owner.as_sub(), 1);
-		}
-
-		collection.consume_sload()?;
-		let list_exists = <AddressTokens<T>>::contains_key(collection.id, owner.as_sub());
-		if list_exists {
-			collection.consume_sload()?;
-			let mut list = <AddressTokens<T>>::get(collection.id, owner.as_sub());
 			let item_contains = list.contains(&item_index.clone());
 
 			if !item_contains {
@@ -2457,16 +2461,6 @@
 		item_index: TokenId,
 		owner: &T::CrossAccountId,
 	) -> DispatchResult {
-		// update counter
-		collection.consume_sload()?;
-		collection.consume_sstore()?;
-		<AccountItemCount<T>>::insert(
-			owner.as_sub(),
-			<AccountItemCount<T>>::get(owner.as_sub())
-				.checked_sub(1)
-				.ok_or(Error::<T>::NumOverflow)?,
-		);
-
 		collection.consume_sload()?;
 		let list_exists = <AddressTokens<T>>::contains_key(collection.id, owner.as_sub());
 		if list_exists {
modifiedpallets/nft/src/sponsorship.rsdiffbeforeafterboth
--- a/pallets/nft/src/sponsorship.rs
+++ b/pallets/nft/src/sponsorship.rs
@@ -61,10 +61,15 @@
 			sponsor_transfer = match collection_mode {
 				CollectionMode::NFT => {
 					// get correct limit
-					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
-						collection_limits.sponsor_transfer_timeout
+					let limit: u32 = if collection_limits.sponsor_transfer_timeout != 0 {
+						if collection_limits.sponsor_transfer_timeout > NFT_SPONSOR_TRANSFER_TIMEOUT
+						{
+							collection_limits.sponsor_transfer_timeout
+						} else {
+							NFT_SPONSOR_TRANSFER_TIMEOUT
+						}
 					} else {
-						NFT_SPONSOR_TRANSFER_TIMEOUT
+						0
 					};
 
 					let mut sponsored = true;
@@ -83,13 +88,18 @@
 				}
 				CollectionMode::Fungible(_) => {
 					// get correct limit
-					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
-						collection_limits.sponsor_transfer_timeout
+					let limit: u32 = if collection_limits.sponsor_transfer_timeout != 0 {
+						if collection_limits.sponsor_transfer_timeout
+							> FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
+						{
+							collection_limits.sponsor_transfer_timeout
+						} else {
+							FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
+						}
 					} else {
-						FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
+						0
 					};
 
-					let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
 					let mut sponsored = true;
 					if FungibleTransferBasket::<T>::contains_key(collection_id, who) {
 						let last_tx_block = FungibleTransferBasket::<T>::get(collection_id, who);
@@ -106,10 +116,16 @@
 				}
 				CollectionMode::ReFungible => {
 					// get correct limit
-					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
-						collection_limits.sponsor_transfer_timeout
+					let limit: u32 = if collection_limits.sponsor_transfer_timeout != 0 {
+						if collection_limits.sponsor_transfer_timeout
+							> REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
+						{
+							collection_limits.sponsor_transfer_timeout
+						} else {
+							REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
+						}
 					} else {
-						REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
+						0
 					};
 
 					let mut sponsored = true;
modifiedpallets/nft/src/tests.rsdiffbeforeafterboth
--- a/pallets/nft/src/tests.rs
+++ b/pallets/nft/src/tests.rs
@@ -1789,7 +1789,7 @@
 		let data = default_nft_data();
 		assert_noop!(
 			TemplateModule::create_item(origin1, 1, account(1), data.into()),
-			Error::<Test>::AddressOwnershipLimitExceeded
+			Error::<Test>::AccountTokenLimitExceeded
 		);
 	});
 }
@@ -2016,11 +2016,11 @@
 		let data = default_nft_data();
 		create_test_item(1, &data.into());
 
-		TemplateModule::set_meta_update_permission_flag(
+		assert_ok!(TemplateModule::set_meta_update_permission_flag(
 			origin1.clone(),
 			collection_id,
 			MetaUpdatePermission::ItemOwner,
-		);
+		));
 
 		let variable_data = b"ten chars.".to_vec();
 		assert_ok!(TemplateModule::set_variable_meta_data(
@@ -2042,20 +2042,17 @@
 #[test]
 fn set_variable_meta_data_on_nft_with_item_owner_permission_flag_neg() {
 	new_test_ext().execute_with(|| {
-		// default_limits();
-
-		let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
+		let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
 
 		let origin1 = Origin::signed(1);
-		let origin2 = Origin::signed(2);
 
 		assert_ok!(TemplateModule::set_mint_permission(
-			origin2.clone(),
+			origin1.clone(),
 			collection_id,
 			true
 		));
 		assert_ok!(TemplateModule::add_to_white_list(
-			origin2.clone(),
+			origin1.clone(),
 			collection_id,
 			account(1)
 		));
@@ -2064,226 +2061,226 @@
 		create_test_item(1, &data.into());
 
 		assert_ok!(TemplateModule::set_meta_update_permission_flag(
-			origin2.clone(),
+			origin1.clone(),
 			collection_id,
 			MetaUpdatePermission::ItemOwner,
 		));
 
-		let variable_data = b"ten chars.++".to_vec();
+		let variable_data = b"1234567890123".to_vec();
 		assert_noop!(
 			TemplateModule::set_variable_meta_data(
-				origin2,
+				origin1,
 				collection_id,
 				1,
 				variable_data.clone()
 			),
 			Error::<Test>::TokenVariableDataLimitExceeded
 		);
+	})
+}
 
-		#[test]
-		fn collection_transfer_flag_works() {
-			new_test_ext().execute_with(|| {
-				let origin1 = Origin::signed(1);
+#[test]
+fn collection_transfer_flag_works() {
+	new_test_ext().execute_with(|| {
+		let origin1 = Origin::signed(1);
 
-				let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-				assert_ok!(TemplateModule::set_transfers_enabled_flag(origin1, 1, true));
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		assert_ok!(TemplateModule::set_transfers_enabled_flag(origin1, 1, true));
 
-				let data = default_nft_data();
-				create_test_item(collection_id, &data.into());
-				assert_eq!(TemplateModule::balance_count(1, 1), 1);
-				assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+		assert_eq!(TemplateModule::balance_count(1, 1), 1);
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
 
-				let origin1 = Origin::signed(1);
+		let origin1 = Origin::signed(1);
 
-				// default scenario
-				assert_ok!(TemplateModule::transfer(origin1, account(2), 1, 1, 1000));
-				assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(2));
-				assert_eq!(TemplateModule::balance_count(1, 1), 0);
-				assert_eq!(TemplateModule::balance_count(1, 2), 1);
+		// default scenario
+		assert_ok!(TemplateModule::transfer(origin1, account(2), 1, 1, 1000));
+		assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(2));
+		assert_eq!(TemplateModule::balance_count(1, 1), 0);
+		assert_eq!(TemplateModule::balance_count(1, 2), 1);
 
-				assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
-			});
-		}
+		assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
+	});
+}
 
-		#[test]
-		fn set_variable_meta_data_on_nft_with_admin_flag() {
-			new_test_ext().execute_with(|| {
-				// default_limits();
+#[test]
+fn set_variable_meta_data_on_nft_with_admin_flag() {
+	new_test_ext().execute_with(|| {
+		// default_limits();
 
-				let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
+		let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
 
-				let origin1 = Origin::signed(1);
-				let origin2 = Origin::signed(2);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-				assert_ok!(TemplateModule::set_mint_permission(
-					origin2.clone(),
-					collection_id,
-					true
-				));
-				assert_ok!(TemplateModule::add_to_white_list(
-					origin2.clone(),
-					collection_id,
-					account(1)
-				));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin2.clone(),
+			collection_id,
+			true
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin2.clone(),
+			collection_id,
+			account(1)
+		));
 
-				assert_ok!(TemplateModule::add_collection_admin(
-					origin2.clone(),
-					collection_id,
-					account(1)
-				));
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin2.clone(),
+			collection_id,
+			account(1)
+		));
 
-				let data = default_nft_data();
-				create_test_item(1, &data.into());
+		let data = default_nft_data();
+		create_test_item(1, &data.into());
 
-				assert_ok!(TemplateModule::set_meta_update_permission_flag(
-					origin2.clone(),
-					collection_id,
-					MetaUpdatePermission::Admin,
-				));
+		assert_ok!(TemplateModule::set_meta_update_permission_flag(
+			origin2.clone(),
+			collection_id,
+			MetaUpdatePermission::Admin,
+		));
 
-				let variable_data = b"test set_variable_meta_data method.".to_vec();
-				assert_ok!(TemplateModule::set_variable_meta_data(
-					origin1,
-					collection_id,
-					1,
-					variable_data.clone()
-				));
+		let variable_data = b"test.".to_vec();
+		assert_ok!(TemplateModule::set_variable_meta_data(
+			origin1,
+			collection_id,
+			1,
+			variable_data.clone()
+		));
 
-				assert_eq!(
-					TemplateModule::nft_item_id(collection_id, 1)
-						.unwrap()
-						.variable_data,
-					variable_data
-				);
-			});
-		}
+		assert_eq!(
+			TemplateModule::nft_item_id(collection_id, 1)
+				.unwrap()
+				.variable_data,
+			variable_data
+		);
+	});
+}
 
-		#[test]
-		fn set_variable_meta_data_on_nft_with_admin_flag_neg() {
-			new_test_ext().execute_with(|| {
-				// default_limits();
+#[test]
+fn set_variable_meta_data_on_nft_with_admin_flag_neg() {
+	new_test_ext().execute_with(|| {
+		// default_limits();
 
-				let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
+		let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
 
-				let origin1 = Origin::signed(1);
-				let origin2 = Origin::signed(2);
+		let origin1 = Origin::signed(1);
+		let origin2 = Origin::signed(2);
 
-				assert_ok!(TemplateModule::set_mint_permission(
-					origin2.clone(),
-					collection_id,
-					true
-				));
-				assert_ok!(TemplateModule::add_to_white_list(
-					origin2.clone(),
-					collection_id,
-					account(1)
-				));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin2.clone(),
+			collection_id,
+			true
+		));
+		assert_ok!(TemplateModule::add_to_white_list(
+			origin2.clone(),
+			collection_id,
+			account(1)
+		));
 
-				let data = default_nft_data();
-				create_test_item(1, &data.into());
+		let data = default_nft_data();
+		create_test_item(1, &data.into());
 
-				assert_ok!(TemplateModule::set_meta_update_permission_flag(
-					origin2.clone(),
-					collection_id,
-					MetaUpdatePermission::Admin,
-				));
+		assert_ok!(TemplateModule::set_meta_update_permission_flag(
+			origin2.clone(),
+			collection_id,
+			MetaUpdatePermission::Admin,
+		));
 
-				let variable_data = b"test set_variable_meta_data method.".to_vec();
-				assert_noop!(
-					TemplateModule::set_variable_meta_data(
-						origin1,
-						collection_id,
-						1,
-						variable_data.clone()
-					),
-					Error::<Test>::NoPermission
-				);
-			});
-		}
+		let variable_data = b"test.".to_vec();
+		assert_noop!(
+			TemplateModule::set_variable_meta_data(
+				origin1,
+				collection_id,
+				1,
+				variable_data.clone()
+			),
+			Error::<Test>::NoPermission
+		);
+	});
+}
 
-		#[test]
-		fn set_variable_meta_flag_after_freeze() {
-			new_test_ext().execute_with(|| {
-				// default_limits();
+#[test]
+fn set_variable_meta_flag_after_freeze() {
+	new_test_ext().execute_with(|| {
+		// default_limits();
 
-				let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
+		let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
 
-				let origin2 = Origin::signed(2);
+		let origin2 = Origin::signed(2);
 
-				assert_ok!(TemplateModule::set_meta_update_permission_flag(
-					origin2.clone(),
-					collection_id,
-					MetaUpdatePermission::None,
-				));
-				assert_noop!(
-					TemplateModule::set_meta_update_permission_flag(
-						origin2.clone(),
-						collection_id,
-						MetaUpdatePermission::Admin
-					),
-					Error::<Test>::MetadataFlagFrozen
-				);
-			});
-		}
+		assert_ok!(TemplateModule::set_meta_update_permission_flag(
+			origin2.clone(),
+			collection_id,
+			MetaUpdatePermission::None,
+		));
+		assert_noop!(
+			TemplateModule::set_meta_update_permission_flag(
+				origin2.clone(),
+				collection_id,
+				MetaUpdatePermission::Admin
+			),
+			Error::<Test>::MetadataFlagFrozen
+		);
+	});
+}
 
-		#[test]
-		fn set_variable_meta_data_on_nft_with_none_flag_neg() {
-			new_test_ext().execute_with(|| {
-				// default_limits();
+#[test]
+fn set_variable_meta_data_on_nft_with_none_flag_neg() {
+	new_test_ext().execute_with(|| {
+		// default_limits();
 
-				let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
-				let origin1 = Origin::signed(1);
+		let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
+		let origin1 = Origin::signed(1);
 
-				let data = default_nft_data();
-				create_test_item(1, &data.into());
+		let data = default_nft_data();
+		create_test_item(1, &data.into());
 
-				assert_ok!(TemplateModule::set_meta_update_permission_flag(
-					origin1.clone(),
-					collection_id,
-					MetaUpdatePermission::None,
-				));
+		assert_ok!(TemplateModule::set_meta_update_permission_flag(
+			origin1.clone(),
+			collection_id,
+			MetaUpdatePermission::None,
+		));
 
-				let variable_data = b"test set_variable_meta_data method.".to_vec();
-				assert_noop!(
-					TemplateModule::set_variable_meta_data(
-						origin1.clone(),
-						collection_id,
-						1,
-						variable_data.clone()
-					),
-					Error::<Test>::MetadataUpdateDenied
-				);
-			});
-		}
+		let variable_data = b"test.".to_vec();
+		assert_noop!(
+			TemplateModule::set_variable_meta_data(
+				origin1.clone(),
+				collection_id,
+				1,
+				variable_data.clone()
+			),
+			Error::<Test>::MetadataUpdateDenied
+		);
+	});
+}
 
-		#[test]
-		fn collection_transfer_flag_works_neg() {
-			new_test_ext().execute_with(|| {
-				let origin1 = Origin::signed(1);
+#[test]
+fn collection_transfer_flag_works_neg() {
+	new_test_ext().execute_with(|| {
+		let origin1 = Origin::signed(1);
 
-				let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-				assert_ok!(TemplateModule::set_transfers_enabled_flag(
-					origin1, 1, false
-				));
+		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+		assert_ok!(TemplateModule::set_transfers_enabled_flag(
+			origin1, 1, false
+		));
 
-				let data = default_nft_data();
-				create_test_item(collection_id, &data.into());
-				assert_eq!(TemplateModule::balance_count(1, 1), 1);
-				assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+		assert_eq!(TemplateModule::balance_count(1, 1), 1);
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
 
-				let origin1 = Origin::signed(1);
+		let origin1 = Origin::signed(1);
 
-				// default scenario
-				assert_noop!(
-					TemplateModule::transfer(origin1, account(2), 1, 1, 1000),
-					Error::<Test>::TransferNotAllowed
-				);
-				assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(1));
-				assert_eq!(TemplateModule::balance_count(1, 1), 1);
-				assert_eq!(TemplateModule::balance_count(1, 2), 0);
+		// default scenario
+		assert_noop!(
+			TemplateModule::transfer(origin1, account(2), 1, 1, 1000),
+			Error::<Test>::TransferNotAllowed
+		);
+		assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(1));
+		assert_eq!(TemplateModule::balance_count(1, 1), 1);
+		assert_eq!(TemplateModule::balance_count(1, 2), 0);
 
-				assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
-			});
-		}
+		assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
 	});
 }
addedtests/src/limits.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -811,6 +811,17 @@
 }
 
 export async function
+getFreeBalance(account: IKeyringPair) : Promise<BigNumber>
+{
+  let balance = new BigNumber(0) ;
+  await usingApi(async (api) => { 
+    balance = new BigNumber((await api.query.system.account(account.address)).data.free.toString());  
+  });
+
+  return balance;
+}
+
+export async function
 scheduleTransferExpectSuccess(
   collectionId: number,
   tokenId: number,
@@ -884,8 +895,11 @@
     if (type === 'ReFungible') {
       const nftItemData =
         (await api.query.nft.reFungibleItemList(collectionId, tokenId)).toJSON() as unknown as IReFungibleTokenDataType;
-      expect(nftItemData.Owner[0].Owner).to.be.deep.equal(to);
-      expect(nftItemData.Owner[0].Fraction.toString()).to.be.equal(value.toString());
+      const expectedOwner = toSubstrateAddress(to);
+      const ownerIndex = nftItemData.Owner.findIndex(v => toSubstrateAddress(v.Owner as any as string) == expectedOwner);
+      expect(ownerIndex).to.not.equal(-1);
+      expect(nftItemData.Owner[ownerIndex].Owner).to.be.deep.equal(normalizeAccountId(to));
+      expect(nftItemData.Owner[ownerIndex].Fraction).to.be.greaterThanOrEqual(value as number);
     }
   });
 }
@@ -1190,7 +1204,6 @@
 export async function waitNewBlocks(blocksCount = 1): Promise<void> {
   await usingApi(async (api) => {
     const promise = new Promise<void>(async (resolve) => {
-
       const unsubscribe = await api.rpc.chain.subscribeNewHeads(() => {
         if (blocksCount > 0) {
           blocksCount--;