difftreelog
fix clippy warnings
in: master
12 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -10145,6 +10145,7 @@
"sp-runtime",
"sp-session",
"sp-std",
+ "sp-storage",
"sp-transaction-pool",
"sp-version",
"staging-xcm",
@@ -14897,6 +14898,7 @@
"sp-runtime",
"sp-session",
"sp-std",
+ "sp-storage",
"sp-transaction-pool",
"sp-version",
"staging-xcm",
node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -238,7 +238,7 @@
vesting: VestingConfig { vesting: vec![] },
parachain_info: ParachainInfoConfig {
parachain_id: $id.into(),
- Default::default()
+ ..Default::default()
},
aura: AuraConfig {
authorities: $initial_invulnerables
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -399,6 +399,7 @@
Some(Subcommand::TryRuntime(cmd)) => {
use std::{future::Future, pin::Pin};
+ use polkadot_cli::Block;
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
node/cli/src/rpc.rsdiffbeforeafterboth--- a/node/cli/src/rpc.rs
+++ b/node/cli/src/rpc.rs
@@ -67,7 +67,7 @@
}
/// Instantiate all Full RPC extensions.
-pub fn create_full<C, P, SC, R, A, B>(
+pub fn create_full<C, P, SC, R, B>(
io: &mut RpcModule<()>,
deps: FullDeps<C, P, SC>,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>
@@ -244,7 +244,7 @@
EthFilter::new(
client.clone(),
eth_backend,
- graph.clone(),
+ graph,
filter_pool,
500_usize, // max stored filters
max_past_logs,
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -498,7 +498,7 @@
select_chain,
};
- create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_handle, full_deps)?;
+ create_full::<_, _, _, Runtime, _>(&mut rpc_handle, full_deps)?;
let eth_deps = EthDeps {
client,
@@ -547,7 +547,7 @@
config: parachain_config,
keystore: params.keystore_container.keystore(),
backend: backend.clone(),
- network: network.clone(),
+ network,
sync_service: sync_service.clone(),
system_rpc_tx,
telemetry: telemetry.as_mut(),
@@ -600,19 +600,21 @@
if validator {
start_consensus(
client.clone(),
- backend.clone(),
- prometheus_registry.as_ref(),
- telemetry.as_ref().map(|t| t.handle()),
- &task_manager,
- relay_chain_interface.clone(),
transaction_pool,
- sync_service.clone(),
- params.keystore_container.keystore(),
- overseer_handle,
- relay_chain_slot_duration,
- para_id,
- collator_key.expect("cli args do not allow this"),
- announce_block,
+ StartConsensusParameters {
+ backend: backend.clone(),
+ prometheus_registry: prometheus_registry.as_ref(),
+ telemetry: telemetry.as_ref().map(|t| t.handle()),
+ task_manager: &task_manager,
+ relay_chain_interface: relay_chain_interface.clone(),
+ sync_oracle: sync_service,
+ keystore: params.keystore_container.keystore(),
+ overseer_handle,
+ relay_chain_slot_duration,
+ para_id,
+ collator_key: collator_key.expect("cli args do not allow this"),
+ announce_block,
+ }
)?;
}
@@ -670,16 +672,12 @@
.map_err(Into::into)
}
-pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(
- client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
+pub struct StartConsensusParameters<'a> {
backend: Arc<FullBackend>,
- prometheus_registry: Option<&Registry>,
+ prometheus_registry: Option<&'a Registry>,
telemetry: Option<TelemetryHandle>,
- task_manager: &TaskManager,
+ task_manager: &'a TaskManager,
relay_chain_interface: Arc<dyn RelayChainInterface>,
- transaction_pool: Arc<
- sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
- >,
sync_oracle: Arc<SyncingService<Block>>,
keystore: KeystorePtr,
overseer_handle: OverseerHandle,
@@ -687,6 +685,14 @@
para_id: ParaId,
collator_key: CollatorPair,
announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
+}
+
+pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(
+ client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
+ transaction_pool: Arc<
+ sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
+ >,
+ parameters: StartConsensusParameters<'_>,
) -> Result<(), sc_service::Error>
where
ExecutorDispatch: NativeExecutionDispatch + 'static,
@@ -697,6 +703,20 @@
RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
Runtime: RuntimeInstance,
{
+ let StartConsensusParameters {
+ backend,
+ prometheus_registry,
+ telemetry,
+ task_manager,
+ relay_chain_interface,
+ sync_oracle,
+ keystore,
+ overseer_handle,
+ relay_chain_slot_duration,
+ para_id,
+ collator_key,
+ announce_block,
+ } = parameters;
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
@@ -704,7 +724,7 @@
client.clone(),
transaction_pool,
prometheus_registry,
- telemetry.clone(),
+ telemetry,
);
let proposer = Proposer::new(proposer_factory);
@@ -1043,7 +1063,7 @@
select_chain,
};
- create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_module, full_deps)?;
+ create_full::<_, _, _, Runtime, _>(&mut rpc_module, full_deps)?;
let eth_deps = EthDeps {
client,
pallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/benchmarking.rs
+++ b/pallets/app-promotion/src/benchmarking.rs
@@ -161,7 +161,7 @@
T::RelayBlockNumberProvider::set_block_number(30_000.into());
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), Some(b as u8));
+ _(RawOrigin::Signed(pallet_admin), Some(b as u8));
Ok(())
}
@@ -178,7 +178,7 @@
#[extrinsic_call]
_(
- RawOrigin::Signed(caller.clone()),
+ RawOrigin::Signed(caller),
share * <T as Config>::Currency::total_balance(&caller),
);
@@ -211,7 +211,7 @@
.collect::<Result<Vec<_>, _>>()?;
#[extrinsic_call]
- _(RawOrigin::Signed(caller.clone()));
+ _(RawOrigin::Signed(caller));
Ok(())
}
@@ -242,7 +242,7 @@
#[extrinsic_call]
_(
- RawOrigin::Signed(caller.clone()),
+ RawOrigin::Signed(caller),
Into::<BalanceOf<T>>::into(1000u128) * T::Nominal::get(),
);
@@ -268,7 +268,7 @@
let collection = create_nft_collection::<T>(caller)?;
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), collection);
+ _(RawOrigin::Signed(pallet_admin), collection);
Ok(())
}
@@ -296,7 +296,7 @@
)?;
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), collection);
+ _(RawOrigin::Signed(pallet_admin), collection);
Ok(())
}
@@ -319,7 +319,7 @@
<EvmMigrationPallet<T>>::finish(RawOrigin::Root.into(), address, data)?;
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), address);
+ _(RawOrigin::Signed(pallet_admin), address);
Ok(())
}
@@ -346,7 +346,7 @@
)?;
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), address);
+ _(RawOrigin::Signed(pallet_admin), address);
Ok(())
}
pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -75,7 +75,7 @@
#[block]
{
- create_max_item(&collection, &sender, to.clone())?;
+ create_max_item(&collection, &sender, to)?;
}
Ok(())
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -82,7 +82,7 @@
#[block]
{
- create_max_item(&collection, &sender, [(to.clone(), 200)])?;
+ create_max_item(&collection, &sender, [(to, 200)])?;
}
Ok(())
pallets/unique/src/benchmarking.rsdiffbeforeafterboth1// 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/>.1617#![cfg(feature = "runtime-benchmarks")]1819use frame_benchmarking::v2::{account, benchmarks, BenchmarkError};20use frame_support::traits::{fungible::Balanced, tokens::Precision, Get};21use frame_system::RawOrigin;22use pallet_common::{23 benchmarking::{create_data, create_u16_data},24 erc::CrossAccountId,25 Config as CommonConfig,26};27use sp_runtime::DispatchError;28use sp_std::vec;29use up_data_structs::{30 CollectionId, CollectionLimits, CollectionMode, MAX_COLLECTION_DESCRIPTION_LENGTH,31 MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,32};3334use super::*;35use crate::Pallet;3637const SEED: u32 = 1;3839fn create_collection_helper<T: Config>(40 owner: T::AccountId,41 mode: CollectionMode,42) -> Result<CollectionId, DispatchError> {43 let _ = <T as CommonConfig>::Currency::deposit(44 &owner,45 T::CollectionCreationPrice::get(),46 Precision::Exact,47 )48 .unwrap();49 let col_name = create_u16_data::<{ MAX_COLLECTION_NAME_LENGTH }>();50 let col_desc = create_u16_data::<{ MAX_COLLECTION_DESCRIPTION_LENGTH }>();51 let token_prefix = create_data::<{ MAX_TOKEN_PREFIX_LENGTH }>();52 <Pallet<T>>::create_collection(53 RawOrigin::Signed(owner).into(),54 col_name,55 col_desc,56 token_prefix,57 mode,58 )?;59 Ok(<pallet_common::CreatedCollectionCount<T>>::get())60}61pub fn create_nft_collection<T: Config>(62 owner: T::AccountId,63) -> Result<CollectionId, DispatchError> {64 create_collection_helper::<T>(owner, CollectionMode::NFT)65}6667#[benchmarks]68mod benchmarks {69 use super::*;7071 #[benchmark]72 fn create_collection() -> Result<(), BenchmarkError> {73 let col_name = create_u16_data::<{ MAX_COLLECTION_NAME_LENGTH }>();74 let col_desc = create_u16_data::<{ MAX_COLLECTION_DESCRIPTION_LENGTH }>();75 let token_prefix = create_data::<{ MAX_TOKEN_PREFIX_LENGTH }>();76 let mode: CollectionMode = CollectionMode::NFT;77 let caller: T::AccountId = account("caller", 0, SEED);78 let _ = <T as CommonConfig>::Currency::deposit(79 &caller,80 T::CollectionCreationPrice::get(),81 Precision::Exact,82 )83 .unwrap();8485 #[extrinsic_call]86 _(87 RawOrigin::Signed(caller.clone()),88 col_name,89 col_desc,90 token_prefix,91 mode,92 );9394 assert_eq!(95 <pallet_common::CollectionById<T>>::get(CollectionId(1))96 .unwrap()97 .owner,98 caller99 );100101 Ok(())102 }103104 #[benchmark]105 fn destroy_collection() -> Result<(), BenchmarkError> {106 let caller: T::AccountId = account("caller", 0, SEED);107 let collection = create_nft_collection::<T>(caller.clone())?;108109 #[extrinsic_call]110 _(RawOrigin::Signed(caller.clone()), collection);111112 Ok(())113 }114115 #[benchmark]116 fn add_to_allow_list() -> Result<(), BenchmarkError> {117 let caller: T::AccountId = account("caller", 0, SEED);118 let allowlist_account: T::AccountId = account("admin", 0, SEED);119 let collection = create_nft_collection::<T>(caller.clone())?;120121 #[extrinsic_call]122 _(123 RawOrigin::Signed(caller.clone()),124 collection,125 T::CrossAccountId::from_sub(allowlist_account),126 );127128 Ok(())129 }130131 #[benchmark]132 fn remove_from_allow_list() -> Result<(), BenchmarkError> {133 let caller: T::AccountId = account("caller", 0, SEED);134 let allowlist_account: T::AccountId = account("admin", 0, SEED);135 let collection = create_nft_collection::<T>(caller.clone())?;136 <Pallet<T>>::add_to_allow_list(137 RawOrigin::Signed(caller.clone()).into(),138 collection,139 T::CrossAccountId::from_sub(allowlist_account.clone()),140 )?;141142 #[extrinsic_call]143 _(144 RawOrigin::Signed(caller.clone()),145 collection,146 T::CrossAccountId::from_sub(allowlist_account),147 );148149 Ok(())150 }151152 #[benchmark]153 fn change_collection_owner() -> Result<(), BenchmarkError> {154 let caller: T::AccountId = account("caller", 0, SEED);155 let collection = create_nft_collection::<T>(caller.clone())?;156 let new_owner: T::AccountId = account("admin", 0, SEED);157158 #[extrinsic_call]159 _(RawOrigin::Signed(caller.clone()), collection, new_owner);160161 Ok(())162 }163164 #[benchmark]165 fn add_collection_admin() -> Result<(), BenchmarkError> {166 let caller: T::AccountId = account("caller", 0, SEED);167 let collection = create_nft_collection::<T>(caller.clone())?;168 let new_admin: T::AccountId = account("admin", 0, SEED);169170 #[extrinsic_call]171 _(172 RawOrigin::Signed(caller.clone()),173 collection,174 T::CrossAccountId::from_sub(new_admin),175 );176177 Ok(())178 }179180 #[benchmark]181 fn remove_collection_admin() -> Result<(), BenchmarkError> {182 let caller: T::AccountId = account("caller", 0, SEED);183 let collection = create_nft_collection::<T>(caller.clone())?;184 let new_admin: T::AccountId = account("admin", 0, SEED);185 <Pallet<T>>::add_collection_admin(186 RawOrigin::Signed(caller.clone()).into(),187 collection,188 T::CrossAccountId::from_sub(new_admin.clone()),189 )?;190191 #[extrinsic_call]192 _(193 RawOrigin::Signed(caller.clone()),194 collection,195 T::CrossAccountId::from_sub(new_admin),196 );197198 Ok(())199 }200201 #[benchmark]202 fn set_collection_sponsor() -> Result<(), BenchmarkError> {203 let caller: T::AccountId = account("caller", 0, SEED);204 let collection = create_nft_collection::<T>(caller.clone())?;205206 #[extrinsic_call]207 _(208 RawOrigin::Signed(caller.clone()),209 collection,210 caller.clone(),211 );212213 Ok(())214 }215216 #[benchmark]217 fn confirm_sponsorship() -> Result<(), BenchmarkError> {218 let caller: T::AccountId = account("caller", 0, SEED);219 let collection = create_nft_collection::<T>(caller.clone())?;220 <Pallet<T>>::set_collection_sponsor(221 RawOrigin::Signed(caller.clone()).into(),222 collection,223 caller.clone(),224 )?;225226 #[extrinsic_call]227 _(RawOrigin::Signed(caller.clone()), collection);228229 Ok(())230 }231232 #[benchmark]233 fn remove_collection_sponsor() -> Result<(), BenchmarkError> {234 let caller: T::AccountId = account("caller", 0, SEED);235 let collection = create_nft_collection::<T>(caller.clone())?;236 <Pallet<T>>::set_collection_sponsor(237 RawOrigin::Signed(caller.clone()).into(),238 collection,239 caller.clone(),240 )?;241 <Pallet<T>>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), collection)?;242243 #[extrinsic_call]244 _(RawOrigin::Signed(caller.clone()), collection);245246 Ok(())247 }248249 #[benchmark]250 fn set_transfers_enabled_flag() -> Result<(), BenchmarkError> {251 let caller: T::AccountId = account("caller", 0, SEED);252 let collection = create_nft_collection::<T>(caller.clone())?;253254 #[extrinsic_call]255 _(RawOrigin::Signed(caller.clone()), collection, false);256257 Ok(())258 }259260 #[benchmark]261 fn set_collection_limits() -> Result<(), BenchmarkError> {262 let caller: T::AccountId = account("caller", 0, SEED);263 let collection = create_nft_collection::<T>(caller.clone())?;264265 let cl = CollectionLimits {266 account_token_ownership_limit: Some(0),267 sponsored_data_size: Some(0),268 token_limit: Some(1),269 sponsor_transfer_timeout: Some(0),270 sponsor_approve_timeout: None,271 owner_can_destroy: Some(true),272 owner_can_transfer: Some(true),273 sponsored_data_rate_limit: None,274 transfers_enabled: Some(true),275 };276277 #[extrinsic_call]278 set_collection_limits(RawOrigin::Signed(caller.clone()), collection, cl);279280 Ok(())281 }282283 #[benchmark]284 fn force_repair_collection() -> Result<(), BenchmarkError> {285 let caller: T::AccountId = account("caller", 0, SEED);286 let collection = create_nft_collection::<T>(caller)?;287288 #[extrinsic_call]289 _(RawOrigin::Root, collection);290291 Ok(())292 }293}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/>.1617#![cfg(feature = "runtime-benchmarks")]1819use frame_benchmarking::v2::{account, benchmarks, BenchmarkError};20use frame_support::traits::{fungible::Balanced, tokens::Precision, Get};21use frame_system::RawOrigin;22use pallet_common::{23 benchmarking::{create_data, create_u16_data},24 erc::CrossAccountId,25 Config as CommonConfig,26};27use sp_runtime::DispatchError;28use sp_std::vec;29use up_data_structs::{30 CollectionId, CollectionLimits, CollectionMode, MAX_COLLECTION_DESCRIPTION_LENGTH,31 MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,32};3334use super::*;35use crate::Pallet;3637const SEED: u32 = 1;3839fn create_collection_helper<T: Config>(40 owner: T::AccountId,41 mode: CollectionMode,42) -> Result<CollectionId, DispatchError> {43 let _ = <T as CommonConfig>::Currency::deposit(44 &owner,45 T::CollectionCreationPrice::get(),46 Precision::Exact,47 )48 .unwrap();49 let col_name = create_u16_data::<{ MAX_COLLECTION_NAME_LENGTH }>();50 let col_desc = create_u16_data::<{ MAX_COLLECTION_DESCRIPTION_LENGTH }>();51 let token_prefix = create_data::<{ MAX_TOKEN_PREFIX_LENGTH }>();52 <Pallet<T>>::create_collection(53 RawOrigin::Signed(owner).into(),54 col_name,55 col_desc,56 token_prefix,57 mode,58 )?;59 Ok(<pallet_common::CreatedCollectionCount<T>>::get())60}61pub fn create_nft_collection<T: Config>(62 owner: T::AccountId,63) -> Result<CollectionId, DispatchError> {64 create_collection_helper::<T>(owner, CollectionMode::NFT)65}6667#[benchmarks]68mod benchmarks {69 use super::*;7071 #[benchmark]72 fn create_collection() -> Result<(), BenchmarkError> {73 let col_name = create_u16_data::<{ MAX_COLLECTION_NAME_LENGTH }>();74 let col_desc = create_u16_data::<{ MAX_COLLECTION_DESCRIPTION_LENGTH }>();75 let token_prefix = create_data::<{ MAX_TOKEN_PREFIX_LENGTH }>();76 let mode: CollectionMode = CollectionMode::NFT;77 let caller: T::AccountId = account("caller", 0, SEED);78 let _ = <T as CommonConfig>::Currency::deposit(79 &caller,80 T::CollectionCreationPrice::get(),81 Precision::Exact,82 )83 .unwrap();8485 #[extrinsic_call]86 _(87 RawOrigin::Signed(caller.clone()),88 col_name,89 col_desc,90 token_prefix,91 mode,92 );9394 assert_eq!(95 <pallet_common::CollectionById<T>>::get(CollectionId(1))96 .unwrap()97 .owner,98 caller99 );100101 Ok(())102 }103104 #[benchmark]105 fn destroy_collection() -> Result<(), BenchmarkError> {106 let caller: T::AccountId = account("caller", 0, SEED);107 let collection = create_nft_collection::<T>(caller.clone())?;108109 #[extrinsic_call]110 _(RawOrigin::Signed(caller), collection);111112 Ok(())113 }114115 #[benchmark]116 fn add_to_allow_list() -> Result<(), BenchmarkError> {117 let caller: T::AccountId = account("caller", 0, SEED);118 let allowlist_account: T::AccountId = account("admin", 0, SEED);119 let collection = create_nft_collection::<T>(caller.clone())?;120121 #[extrinsic_call]122 _(123 RawOrigin::Signed(caller),124 collection,125 T::CrossAccountId::from_sub(allowlist_account),126 );127128 Ok(())129 }130131 #[benchmark]132 fn remove_from_allow_list() -> Result<(), BenchmarkError> {133 let caller: T::AccountId = account("caller", 0, SEED);134 let allowlist_account: T::AccountId = account("admin", 0, SEED);135 let collection = create_nft_collection::<T>(caller.clone())?;136 <Pallet<T>>::add_to_allow_list(137 RawOrigin::Signed(caller.clone()).into(),138 collection,139 T::CrossAccountId::from_sub(allowlist_account.clone()),140 )?;141142 #[extrinsic_call]143 _(144 RawOrigin::Signed(caller),145 collection,146 T::CrossAccountId::from_sub(allowlist_account),147 );148149 Ok(())150 }151152 #[benchmark]153 fn change_collection_owner() -> Result<(), BenchmarkError> {154 let caller: T::AccountId = account("caller", 0, SEED);155 let collection = create_nft_collection::<T>(caller.clone())?;156 let new_owner: T::AccountId = account("admin", 0, SEED);157158 #[extrinsic_call]159 _(RawOrigin::Signed(caller), collection, new_owner);160161 Ok(())162 }163164 #[benchmark]165 fn add_collection_admin() -> Result<(), BenchmarkError> {166 let caller: T::AccountId = account("caller", 0, SEED);167 let collection = create_nft_collection::<T>(caller.clone())?;168 let new_admin: T::AccountId = account("admin", 0, SEED);169170 #[extrinsic_call]171 _(172 RawOrigin::Signed(caller),173 collection,174 T::CrossAccountId::from_sub(new_admin),175 );176177 Ok(())178 }179180 #[benchmark]181 fn remove_collection_admin() -> Result<(), BenchmarkError> {182 let caller: T::AccountId = account("caller", 0, SEED);183 let collection = create_nft_collection::<T>(caller.clone())?;184 let new_admin: T::AccountId = account("admin", 0, SEED);185 <Pallet<T>>::add_collection_admin(186 RawOrigin::Signed(caller.clone()).into(),187 collection,188 T::CrossAccountId::from_sub(new_admin.clone()),189 )?;190191 #[extrinsic_call]192 _(193 RawOrigin::Signed(caller),194 collection,195 T::CrossAccountId::from_sub(new_admin),196 );197198 Ok(())199 }200201 #[benchmark]202 fn set_collection_sponsor() -> Result<(), BenchmarkError> {203 let caller: T::AccountId = account("caller", 0, SEED);204 let collection = create_nft_collection::<T>(caller.clone())?;205206 #[extrinsic_call]207 _(RawOrigin::Signed(caller), collection, caller.clone());208209 Ok(())210 }211212 #[benchmark]213 fn confirm_sponsorship() -> Result<(), BenchmarkError> {214 let caller: T::AccountId = account("caller", 0, SEED);215 let collection = create_nft_collection::<T>(caller.clone())?;216 <Pallet<T>>::set_collection_sponsor(217 RawOrigin::Signed(caller.clone()).into(),218 collection,219 caller.clone(),220 )?;221222 #[extrinsic_call]223 _(RawOrigin::Signed(caller), collection);224225 Ok(())226 }227228 #[benchmark]229 fn remove_collection_sponsor() -> Result<(), BenchmarkError> {230 let caller: T::AccountId = account("caller", 0, SEED);231 let collection = create_nft_collection::<T>(caller.clone())?;232 <Pallet<T>>::set_collection_sponsor(233 RawOrigin::Signed(caller.clone()).into(),234 collection,235 caller.clone(),236 )?;237 <Pallet<T>>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), collection)?;238239 #[extrinsic_call]240 _(RawOrigin::Signed(caller), collection);241242 Ok(())243 }244245 #[benchmark]246 fn set_transfers_enabled_flag() -> Result<(), BenchmarkError> {247 let caller: T::AccountId = account("caller", 0, SEED);248 let collection = create_nft_collection::<T>(caller.clone())?;249250 #[extrinsic_call]251 _(RawOrigin::Signed(caller), collection, false);252253 Ok(())254 }255256 #[benchmark]257 fn set_collection_limits() -> Result<(), BenchmarkError> {258 let caller: T::AccountId = account("caller", 0, SEED);259 let collection = create_nft_collection::<T>(caller.clone())?;260261 let cl = CollectionLimits {262 account_token_ownership_limit: Some(0),263 sponsored_data_size: Some(0),264 token_limit: Some(1),265 sponsor_transfer_timeout: Some(0),266 sponsor_approve_timeout: None,267 owner_can_destroy: Some(true),268 owner_can_transfer: Some(true),269 sponsored_data_rate_limit: None,270 transfers_enabled: Some(true),271 };272273 #[extrinsic_call]274 set_collection_limits(RawOrigin::Signed(caller), collection, cl);275276 Ok(())277 }278279 #[benchmark]280 fn force_repair_collection() -> Result<(), BenchmarkError> {281 let caller: T::AccountId = account("caller", 0, SEED);282 let collection = create_nft_collection::<T>(caller)?;283284 #[extrinsic_call]285 _(RawOrigin::Root, collection);286287 Ok(())288 }289}runtime/common/config/xcm/foreignassets.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -77,19 +77,18 @@
let here_id =
ConvertAssetId::convert(&AssetId::NativeAssetId(NativeCurrency::Here)).unwrap();
- if asset_id.clone() == parent_id {
+ if *asset_id == parent_id {
return Some(MultiLocation::parent());
}
- if asset_id.clone() == here_id {
+ if *asset_id == here_id {
return Some(MultiLocation::new(
1,
X1(Parachain(ParachainInfo::get().into())),
));
}
- let fid =
- <AssetId as TryAsForeign<AssetId, ForeignAssetId>>::try_as_foreign(asset_id.clone())?;
+ let fid = <AssetId as TryAsForeign<AssetId, ForeignAssetId>>::try_as_foreign(*asset_id)?;
XcmForeignAssetIdMapping::<Runtime>::get_multi_location(fid)
}
}
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -271,6 +271,7 @@
sp-runtime = { workspace = true }
sp-session = { workspace = true }
sp-std = { workspace = true }
+sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
staging-xcm = { workspace = true }
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -274,6 +274,7 @@
sp-runtime = { workspace = true }
sp-session = { workspace = true }
sp-std = { workspace = true }
+sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
staging-xcm = { workspace = true }