git.delta.rocks / unique-network / refs/commits / 9425c0a8f17b

difftreelog

fix warnings

Grigoriy Simonov2023-09-22parent: #a3eb5c5.patch.diff
in: master

6 files changed

modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -425,7 +425,7 @@
 				.map(|cfg| &cfg.registry);
 			let task_manager =
 				sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
-					.map_err(|e| format!("Error: {:?}", e))?;
+					.map_err(|e| format!("Error: {e:?}"))?;
 			let info_provider = Some(timestamp_with_aura_info(12000));
 
 			runner.async_run(|config| -> Result<(Pin<Box<dyn Future<Output = _>>>, _)> {
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -119,7 +119,7 @@
 		} else if self.sub == Default::default() {
 			Ok(Some(T::CrossAccountId::from_eth(self.eth)))
 		} else {
-			Err(format!("All fields of cross account is non zeroed {:?}", self).into())
+			Err(format!("All fields of cross account is non zeroed {self:?}").into())
 		}
 	}
 
modifiedpallets/scheduler-v2/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/benchmarking.rs
+++ b/pallets/scheduler-v2/src/benchmarking.rs
@@ -136,8 +136,10 @@
 	let bound = EncodedCall::bound() as u32;
 	let mut len = match maybe_lookup_len {
 		Some(len) => {
-			len.min(<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get() - 2)
-				.max(bound) - 3
+			len.clamp(
+				bound,
+				<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get() - 2,
+			) - 3
 		}
 		None => bound.saturating_sub(4),
 	};
modifiedruntime/common/tests/mod.rsdiffbeforeafterboth
before · runtime/common/tests/mod.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_runtime::{BuildStorage, Storage};18use sp_core::{Public, Pair};19use up_common::types::AuraId;20use crate::{Runtime, GenesisConfig, ParachainInfoConfig, RuntimeEvent, System};2122pub use sp_runtime::AccountId32 as AccountId;23pub type Balance = u128;2425pub mod xcm;2627#[cfg(any(feature = "opal-runtime", feature = "quartz-runtime"))]28/// PARA_ID for Opal/Sapphire/Quartz29const PARA_ID: u32 = 2095;3031#[cfg(feature = "unique-runtime")]32/// PARA_ID for Unique33const PARA_ID: u32 = 2037;3435fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {36	TPublic::Pair::from_string(&format!("//{}", seed), None)37		.expect("static values are valid; qed")38		.public()39}4041fn last_events(n: usize) -> Vec<RuntimeEvent> {42	System::events()43		.into_iter()44		.map(|e| e.event)45		.rev()46		.take(n)47		.rev()48		.collect()49}5051fn new_test_ext(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities {52	let mut storage = make_basic_storage();5354	pallet_balances::GenesisConfig::<Runtime> { balances }55		.assimilate_storage(&mut storage)56		.unwrap();5758	let mut ext = sp_io::TestExternalities::new(storage);59	ext.execute_with(|| System::set_block_number(1));60	ext61}6263#[cfg(feature = "collator-selection")]64fn make_basic_storage() -> Storage {65	use sp_core::{sr25519};66	use sp_runtime::traits::{IdentifyAccount, Verify};67	use crate::{AccountId, Signature, SessionKeys, CollatorSelectionConfig, SessionConfig};6869	type AccountPublic = <Signature as Verify>::Signer;7071	fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId72	where73		AccountPublic: From<<TPublic::Pair as Pair>::Public>,74	{75		AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()76	}7778	let accounts = ["Alice", "Bob"];79	let keys = accounts80		.iter()81		.map(|&acc| {82			let account_id = get_account_id_from_seed::<sr25519::Public>(acc);83			(84				account_id.clone(),85				account_id,86				SessionKeys {87					aura: get_from_seed::<AuraId>(acc),88				},89			)90		})91		.collect::<Vec<_>>();92	let invulnerables = accounts93		.iter()94		.map(|acc| get_account_id_from_seed::<sr25519::Public>(acc))95		.collect::<Vec<_>>();9697	let cfg = GenesisConfig {98		collator_selection: CollatorSelectionConfig { invulnerables },99		session: SessionConfig { keys },100		parachain_info: ParachainInfoConfig {101			parachain_id: PARA_ID.into(),102		},103		..GenesisConfig::default()104	};105106	cfg.build_storage().unwrap()107}108109#[cfg(not(feature = "collator-selection"))]110fn make_basic_storage() -> Storage {111	use crate::AuraConfig;112113	let cfg = GenesisConfig {114		aura: AuraConfig {115			authorities: vec![116				get_from_seed::<AuraId>("Alice"),117				get_from_seed::<AuraId>("Bob"),118			],119		},120		parachain_info: ParachainInfoConfig {121			parachain_id: PARA_ID.into(),122		},123		..GenesisConfig::default()124	};125126	cfg.build_storage().unwrap().into()127}
after · runtime/common/tests/mod.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_runtime::{BuildStorage, Storage};18use sp_core::{Public, Pair};19use up_common::types::AuraId;20use crate::{Runtime, GenesisConfig, ParachainInfoConfig, RuntimeEvent, System};2122pub use sp_runtime::AccountId32 as AccountId;23pub type Balance = u128;2425pub mod xcm;2627#[cfg(any(feature = "opal-runtime", feature = "quartz-runtime"))]28/// PARA_ID for Opal/Sapphire/Quartz29const PARA_ID: u32 = 2095;3031#[cfg(feature = "unique-runtime")]32/// PARA_ID for Unique33const PARA_ID: u32 = 2037;3435fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {36	TPublic::Pair::from_string(&format!("//{seed}"), None)37		.expect("static values are valid; qed")38		.public()39}4041fn last_events(n: usize) -> Vec<RuntimeEvent> {42	System::events()43		.into_iter()44		.map(|e| e.event)45		.rev()46		.take(n)47		.rev()48		.collect()49}5051fn new_test_ext(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities {52	let mut storage = make_basic_storage();5354	pallet_balances::GenesisConfig::<Runtime> { balances }55		.assimilate_storage(&mut storage)56		.unwrap();5758	let mut ext = sp_io::TestExternalities::new(storage);59	ext.execute_with(|| System::set_block_number(1));60	ext61}6263#[cfg(feature = "collator-selection")]64fn make_basic_storage() -> Storage {65	use sp_core::{sr25519};66	use sp_runtime::traits::{IdentifyAccount, Verify};67	use crate::{AccountId, Signature, SessionKeys, CollatorSelectionConfig, SessionConfig};6869	type AccountPublic = <Signature as Verify>::Signer;7071	fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId72	where73		AccountPublic: From<<TPublic::Pair as Pair>::Public>,74	{75		AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()76	}7778	let accounts = ["Alice", "Bob"];79	let keys = accounts80		.iter()81		.map(|&acc| {82			let account_id = get_account_id_from_seed::<sr25519::Public>(acc);83			(84				account_id.clone(),85				account_id,86				SessionKeys {87					aura: get_from_seed::<AuraId>(acc),88				},89			)90		})91		.collect::<Vec<_>>();92	let invulnerables = accounts93		.iter()94		.map(|acc| get_account_id_from_seed::<sr25519::Public>(acc))95		.collect::<Vec<_>>();9697	let cfg = GenesisConfig {98		collator_selection: CollatorSelectionConfig { invulnerables },99		session: SessionConfig { keys },100		parachain_info: ParachainInfoConfig {101			parachain_id: PARA_ID.into(),102		},103		..GenesisConfig::default()104	};105106	cfg.build_storage().unwrap()107}108109#[cfg(not(feature = "collator-selection"))]110fn make_basic_storage() -> Storage {111	use crate::AuraConfig;112113	let cfg = GenesisConfig {114		aura: AuraConfig {115			authorities: vec![116				get_from_seed::<AuraId>("Alice"),117				get_from_seed::<AuraId>("Bob"),118			],119		},120		parachain_info: ParachainInfoConfig {121			parachain_id: PARA_ID.into(),122		},123		..GenesisConfig::default()124	};125126	cfg.build_storage().unwrap().into()127}
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -18,7 +18,7 @@
 import {IKeyringPair} from '@polkadot/types/types';
 import {Contract} from 'web3-eth-contract';
 import {ITokenPropertyPermission} from '../util/playgrounds/types';
-import { CREATE_COLLECTION_DATA_DEFAULTS, CollectionMode, CreateCollectionData, TokenPermissionField } from './util/playgrounds/types';
+import {CREATE_COLLECTION_DATA_DEFAULTS, CollectionMode, CreateCollectionData, TokenPermissionField} from './util/playgrounds/types';
 
 describe('Check ERC721 token URI for NFT', () => {
   let donor: IKeyringPair;
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -18,7 +18,7 @@
 import {expect, itEth, usingEthPlaygrounds} from './util';
 import {IKeyringPair} from '@polkadot/types/types';
 import {ITokenPropertyPermission} from '../util/playgrounds/types';
-import { CREATE_COLLECTION_DATA_DEFAULTS, TokenPermissionField } from './util/playgrounds/types';
+import {CREATE_COLLECTION_DATA_DEFAULTS, TokenPermissionField} from './util/playgrounds/types';
 
 describe('Refungible: Plain calls', () => {
   let donor: IKeyringPair;