difftreelog
feat benchmark property calls
in: master
30 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5913,6 +5913,7 @@
dependencies = [
"evm-coder",
"fp-evm-mapping",
+ "frame-benchmarking",
"frame-support",
"frame-system",
"pallet-evm",
@@ -6649,6 +6650,7 @@
"frame-support",
"frame-system",
"pallet-common",
+ "pallet-evm",
"parity-scale-codec 3.1.2",
"scale-info",
"sp-std",
Makefilediffbeforeafterboth--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,10 @@
bench-evm-migration:
make _bench PALLET=evm-migration
+.PHONY: bench-common
+bench-common:
+ make _bench PALLET=common
+
.PHONY: bench-unique
bench-unique:
make _bench PALLET=unique
pallets/common/Cargo.tomldiffbeforeafterboth--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -25,6 +25,7 @@
scale-info = { version = "2.0.1", default-features = false, features = [
"derive",
] }
+frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
[features]
default = ["std"]
@@ -37,4 +38,6 @@
"up-data-structs/std",
"pallet-evm/std",
]
-runtime-benchmarks = []
+runtime-benchmarks = [
+ "frame-benchmarking"
+]
pallets/common/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -15,11 +15,13 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use sp_std::vec::Vec;
-use crate::{Config, CollectionHandle};
+use crate::{Config, CollectionHandle, Pallet};
+use pallet_evm::account::CrossAccountId;
+use frame_benchmarking::{benchmarks, account};
use up_data_structs::{
- CollectionMode, CreateCollectionData, CollectionId, MAX_COLLECTION_NAME_LENGTH,
- MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, OFFCHAIN_SCHEMA_LIMIT,
- CONST_ON_CHAIN_SCHEMA_LIMIT,
+ CollectionMode, CreateCollectionData, CollectionId, Property, PropertyKey, PropertyValue,
+ MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
+ OFFCHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT, MAX_PROPERTIES_PER_ITEM,
};
use frame_support::{
traits::{Currency, Get},
@@ -29,6 +31,8 @@
use core::convert::TryInto;
use sp_runtime::DispatchError;
+const SEED: u32 = 1;
+
pub fn create_data<const S: u32>() -> BoundedVec<u8, ConstU32<S>> {
create_var_data::<S>(S)
}
@@ -52,6 +56,22 @@
.try_into()
.unwrap()
}
+pub fn property_key(id: usize) -> PropertyKey {
+ #[cfg(not(feature = "std"))]
+ use alloc::string::ToString;
+ let mut data = create_data();
+ // No DerefMut available for .fill
+ for i in 0..data.len() {
+ data[i] = b'0';
+ }
+ let bytes = id.to_string();
+ let len = data.len();
+ data[len - bytes.len()..].copy_from_slice(&bytes.as_bytes());
+ data
+}
+pub fn property_value() -> PropertyValue {
+ create_data()
+}
pub fn create_collection_raw<T: Config, R>(
owner: T::AccountId,
@@ -83,6 +103,14 @@
.and_then(CollectionHandle::try_get)
.map(cast)
}
+fn create_collection<T: Config>(owner: T::AccountId) -> Result<CollectionHandle<T>, DispatchError> {
+ create_collection_raw(
+ owner,
+ CollectionMode::NFT,
+ |owner, data| <Pallet<T>>::init_collection(owner, data),
+ |h| h,
+ )
+}
/// Helper macros, which handles all benchmarking preparation in semi-declarative way
///
@@ -125,3 +153,31 @@
};
() => {}
}
+
+benchmarks! {
+ set_collection_properties {
+ let b in 0..MAX_PROPERTIES_PER_ITEM;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub;
+ };
+ let props = (0..b).map(|p| Property {
+ key: property_key(p as usize),
+ value: property_value(),
+ }).collect::<Vec<_>>();
+ }: {<Pallet<T>>::set_collection_properties(&collection, &owner, props)?}
+
+ delete_collection_properties {
+ let b in 0..MAX_PROPERTIES_PER_ITEM;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub;
+ };
+ let props = (0..b).map(|p| Property {
+ key: property_key(p as usize),
+ value: property_value(),
+ }).collect::<Vec<_>>();
+ <Pallet<T>>::set_collection_properties(&collection, &owner, props)?;
+ let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();
+ }: {<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete)?}
+}
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -16,6 +16,8 @@
#![cfg_attr(not(feature = "std"), no_std)]
+extern crate alloc;
+
use core::ops::{Deref, DerefMut};
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
use sp_std::vec::Vec;
@@ -85,6 +87,9 @@
pub mod dispatch;
pub mod erc;
pub mod eth;
+pub mod weights;
+
+pub type SelfWeightOf<T> = <T as Config>::WeightInfo;
#[must_use = "Should call submit_logs or save, otherwise some data will be lost for evm side"]
pub struct CollectionHandle<T: Config> {
@@ -186,11 +191,13 @@
use frame_support::traits::Currency;
use up_data_structs::{TokenId, mapping::TokenAddressMapping};
use scale_info::TypeInfo;
+ use weights::WeightInfo;
#[pallet::config]
pub trait Config:
frame_system::Config + pallet_evm_coder_substrate::Config + TypeInfo + account::Config
{
+ type WeightInfo: WeightInfo;
type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;
type Currency: Currency<Self::AccountId>;
@@ -804,7 +811,7 @@
pub fn set_scoped_collection_properties(
collection: &CollectionHandle<T>,
scope: PropertyScope,
- properties: impl Iterator<Item=Property>,
+ properties: impl Iterator<Item = Property>,
) -> DispatchResult {
CollectionProperties::<T>::try_mutate(collection.id, |stored_properties| {
stored_properties.try_scoped_set_from_iter(scope, properties)
@@ -903,10 +910,11 @@
Ok(())
}
- pub fn get_collection_property(collection_id: CollectionId, key: &PropertyKey) -> Option<PropertyValue> {
- Self::collection_properties(collection_id)
- .get(key)
- .cloned()
+ pub fn get_collection_property(
+ collection_id: CollectionId,
+ key: &PropertyKey,
+ ) -> Option<PropertyValue> {
+ Self::collection_properties(collection_id).get(key).cloned()
}
pub fn bytes_keys_to_property_keys(
@@ -1131,7 +1139,7 @@
/// Worst cases
pub trait CommonWeightInfo<CrossAccountId> {
fn create_item() -> Weight;
- fn create_multiple_items(amount: u32) -> Weight;
+ fn create_multiple_items(amount: &[CreateItemData]) -> Weight;
fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;
fn burn_item() -> Weight;
fn set_collection_properties(amount: u32) -> Weight;
pallets/common/src/weights.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/common/src/weights.rs
@@ -0,0 +1,79 @@
+// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
+
+//! Autogenerated weights for pallet_common
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-05-23, STEPS: `50`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+
+// Executed Command:
+// target/release/unique-collator
+// benchmark
+// pallet
+// --pallet
+// pallet-common
+// --wasm-execution
+// compiled
+// --extrinsic
+// *
+// --template
+// .maintain/frame-weight-template.hbs
+// --steps=50
+// --repeat=1
+// --heap-pages=4096
+// --output=./pallets/common/src/weights.rs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for pallet_common.
+pub trait WeightInfo {
+ fn set_collection_properties(b: u32, ) -> Weight;
+ fn delete_collection_properties(b: u32, ) -> Weight;
+}
+
+/// Weights for pallet_common using the Substrate node and recommended hardware.
+pub struct SubstrateWeight<T>(PhantomData<T>);
+impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
+ // Storage: Common CollectionProperties (r:1 w:1)
+ fn set_collection_properties(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 142_818_000
+ .saturating_add((2_786_252_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(1 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ }
+ // Storage: Common CollectionProperties (r:1 w:1)
+ fn delete_collection_properties(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 101_087_000
+ .saturating_add((2_739_521_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(1 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ }
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ // Storage: Common CollectionProperties (r:1 w:1)
+ fn set_collection_properties(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 142_818_000
+ .saturating_add((2_786_252_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ }
+ // Storage: Common CollectionProperties (r:1 w:1)
+ fn delete_collection_properties(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 101_087_000
+ .saturating_add((2_739_521_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ }
+}
pallets/fungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -40,7 +40,7 @@
owner: sub; collection: collection(owner);
sender: cross_from_sub(owner); to: cross_sub;
};
- }: {<Pallet<T>>::create_item(&collection, &sender, (to, 200))?}
+ }: {<Pallet<T>>::create_item(&collection, &sender, (to, 200), &Unlimited)?}
create_multiple_items_ex {
let b in 0..MAX_ITEMS_PER_BATCH;
@@ -52,14 +52,14 @@
bench_init!(to: cross_sub(i););
(to, 200)
}).collect::<BTreeMap<_, _>>().try_into().unwrap();
- }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+ }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
burn_item {
bench_init!{
owner: sub; collection: collection(owner);
owner: cross_from_sub; burner: cross_sub;
};
- <Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200))?;
+ <Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;
}: {<Pallet<T>>::burn(&collection, &burner, 100)?}
transfer {
@@ -67,15 +67,15 @@
owner: sub; collection: collection(owner);
owner: cross_from_sub; sender: cross_sub; to: cross_sub;
};
- <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
- }: {<Pallet<T>>::transfer(&collection, &sender, &to, 200)?}
+ <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
+ }: {<Pallet<T>>::transfer(&collection, &sender, &to, 200, &Unlimited)?}
approve {
bench_init!{
owner: sub; collection: collection(owner);
owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
};
- <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
+ <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, 100)?}
transfer_from {
@@ -83,7 +83,7 @@
owner: sub; collection: collection(owner);
owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
};
- <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
+ <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
<Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;
}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100, &Unlimited)?}
@@ -92,7 +92,7 @@
owner: sub; collection: collection(owner);
owner: cross_from_sub; sender: cross_sub; burner: cross_sub;
};
- <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
+ <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
<Pallet<T>>::set_allowance(&collection, &sender, &burner, 200)?;
}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, 100, &Unlimited)?}
}
pallets/fungible/src/common.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/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use sp_runtime::ArithmeticError;23use sp_std::{vec::Vec, vec};24use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};2526use crate::{27 Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,28};2930pub struct CommonWeights<T: Config>(PhantomData<T>);31impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {32 fn create_item() -> Weight {33 <SelfWeightOf<T>>::create_item()34 }3536 fn create_multiple_items(_amount: u32) -> Weight {37 Self::create_item()38 }3940 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {41 match data {42 CreateItemExData::Fungible(f) => {43 <SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)44 }45 _ => 0,46 }47 }4849 fn burn_item() -> Weight {50 <SelfWeightOf<T>>::burn_item()51 }5253 fn set_collection_properties(amount: u32) -> Weight {54 <SelfWeightOf<T>>::set_collection_properties(amount)55 }5657 fn delete_collection_properties(amount: u32) -> Weight {58 <SelfWeightOf<T>>::delete_collection_properties(amount)59 }6061 fn set_token_properties(amount: u32) -> Weight {62 <SelfWeightOf<T>>::set_token_properties(amount)63 }6465 fn delete_token_properties(amount: u32) -> Weight {66 <SelfWeightOf<T>>::delete_token_properties(amount)67 }6869 fn set_property_permissions(amount: u32) -> Weight {70 <SelfWeightOf<T>>::set_property_permissions(amount)71 }7273 fn transfer() -> Weight {74 <SelfWeightOf<T>>::transfer()75 }7677 fn approve() -> Weight {78 <SelfWeightOf<T>>::approve()79 }8081 fn transfer_from() -> Weight {82 <SelfWeightOf<T>>::transfer_from()83 }8485 fn burn_from() -> Weight {86 <SelfWeightOf<T>>::burn_from()87 }88}8990impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {91 fn create_item(92 &self,93 sender: T::CrossAccountId,94 to: T::CrossAccountId,95 data: up_data_structs::CreateItemData,96 nesting_budget: &dyn Budget,97 ) -> DispatchResultWithPostInfo {98 match data {99 up_data_structs::CreateItemData::Fungible(data) => with_weight(100 <Pallet<T>>::create_item(self, &sender, (to, data.value), nesting_budget),101 <CommonWeights<T>>::create_item(),102 ),103 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),104 }105 }106107 fn create_multiple_items(108 &self,109 sender: T::CrossAccountId,110 to: T::CrossAccountId,111 data: Vec<up_data_structs::CreateItemData>,112 nesting_budget: &dyn Budget,113 ) -> DispatchResultWithPostInfo {114 let mut sum: u128 = 0;115 for data in data {116 match data {117 up_data_structs::CreateItemData::Fungible(data) => {118 sum = sum119 .checked_add(data.value)120 .ok_or(ArithmeticError::Overflow)?;121 }122 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),123 }124 }125126 with_weight(127 <Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),128 <CommonWeights<T>>::create_item(),129 )130 }131132 fn create_multiple_items_ex(133 &self,134 sender: <T>::CrossAccountId,135 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,136 nesting_budget: &dyn Budget,137 ) -> DispatchResultWithPostInfo {138 let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);139 let data = match data {140 up_data_structs::CreateItemExData::Fungible(f) => f,141 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),142 };143144 with_weight(145 <Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),146 weight,147 )148 }149150 fn burn_item(151 &self,152 sender: T::CrossAccountId,153 token: TokenId,154 amount: u128,155 ) -> DispatchResultWithPostInfo {156 ensure!(157 token == TokenId::default(),158 <Error<T>>::FungibleItemsHaveNoId159 );160161 with_weight(162 <Pallet<T>>::burn(self, &sender, amount),163 <CommonWeights<T>>::burn_item(),164 )165 }166167 fn transfer(168 &self,169 from: T::CrossAccountId,170 to: T::CrossAccountId,171 token: TokenId,172 amount: u128,173 nesting_budget: &dyn Budget,174 ) -> DispatchResultWithPostInfo {175 ensure!(176 token == TokenId::default(),177 <Error<T>>::FungibleItemsHaveNoId178 );179180 with_weight(181 <Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),182 <CommonWeights<T>>::transfer(),183 )184 }185186 fn approve(187 &self,188 sender: T::CrossAccountId,189 spender: T::CrossAccountId,190 token: TokenId,191 amount: u128,192 ) -> DispatchResultWithPostInfo {193 ensure!(194 token == TokenId::default(),195 <Error<T>>::FungibleItemsHaveNoId196 );197198 with_weight(199 <Pallet<T>>::set_allowance(self, &sender, &spender, amount),200 <CommonWeights<T>>::approve(),201 )202 }203204 fn transfer_from(205 &self,206 sender: T::CrossAccountId,207 from: T::CrossAccountId,208 to: T::CrossAccountId,209 token: TokenId,210 amount: u128,211 nesting_budget: &dyn Budget,212 ) -> DispatchResultWithPostInfo {213 ensure!(214 token == TokenId::default(),215 <Error<T>>::FungibleItemsHaveNoId216 );217218 with_weight(219 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),220 <CommonWeights<T>>::transfer_from(),221 )222 }223224 fn burn_from(225 &self,226 sender: T::CrossAccountId,227 from: T::CrossAccountId,228 token: TokenId,229 amount: u128,230 nesting_budget: &dyn Budget,231 ) -> DispatchResultWithPostInfo {232 ensure!(233 token == TokenId::default(),234 <Error<T>>::FungibleItemsHaveNoId235 );236237 with_weight(238 <Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),239 <CommonWeights<T>>::burn_from(),240 )241 }242243 fn set_collection_properties(244 &self,245 _sender: T::CrossAccountId,246 _property: Vec<Property>,247 ) -> DispatchResultWithPostInfo {248 fail!(<Error<T>>::SettingPropertiesNotAllowed)249 }250251 fn delete_collection_properties(252 &self,253 _sender: &T::CrossAccountId,254 _property_keys: Vec<PropertyKey>,255 ) -> DispatchResultWithPostInfo {256 fail!(<Error<T>>::SettingPropertiesNotAllowed)257 }258259 fn set_token_properties(260 &self,261 _sender: T::CrossAccountId,262 _token_id: TokenId,263 _property: Vec<Property>,264 ) -> DispatchResultWithPostInfo {265 fail!(<Error<T>>::SettingPropertiesNotAllowed)266 }267268 fn set_property_permissions(269 &self,270 _sender: &T::CrossAccountId,271 _property_permissions: Vec<PropertyKeyPermission>,272 ) -> DispatchResultWithPostInfo {273 fail!(<Error<T>>::SettingPropertiesNotAllowed)274 }275276 fn delete_token_properties(277 &self,278 _sender: T::CrossAccountId,279 _token_id: TokenId,280 _property_keys: Vec<PropertyKey>,281 ) -> DispatchResultWithPostInfo {282 fail!(<Error<T>>::SettingPropertiesNotAllowed)283 }284285 fn check_nesting(286 &self,287 _sender: <T>::CrossAccountId,288 _from: (CollectionId, TokenId),289 _under: TokenId,290 _budget: &dyn Budget,291 ) -> sp_runtime::DispatchResult {292 fail!(<Error<T>>::FungibleDisallowsNesting)293 }294295 fn collection_tokens(&self) -> Vec<TokenId> {296 vec![TokenId::default()]297 }298299 fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {300 if <Balance<T>>::get((self.id, account)) != 0 {301 vec![TokenId::default()]302 } else {303 vec![]304 }305 }306307 fn token_exists(&self, token: TokenId) -> bool {308 token == TokenId::default()309 }310311 fn last_token_id(&self) -> TokenId {312 TokenId::default()313 }314315 fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {316 None317 }318 fn const_metadata(&self, _token: TokenId) -> Vec<u8> {319 Vec::new()320 }321322 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {323 None324 }325326 fn token_properties(327 &self,328 _token_id: TokenId,329 _keys: Option<Vec<PropertyKey>>,330 ) -> Vec<Property> {331 Vec::new()332 }333334 fn total_supply(&self) -> u32 {335 1336 }337338 fn account_balance(&self, account: T::CrossAccountId) -> u32 {339 if <Balance<T>>::get((self.id, account)) != 0 {340 1341 } else {342 0343 }344 }345346 fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {347 if token != TokenId::default() {348 return 0;349 }350 <Balance<T>>::get((self.id, account))351 }352353 fn allowance(354 &self,355 sender: T::CrossAccountId,356 spender: T::CrossAccountId,357 token: TokenId,358 ) -> u128 {359 if token != TokenId::default() {360 return 0;361 }362 <Allowance<T>>::get((self.id, sender, spender))363 }364}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 core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use sp_runtime::ArithmeticError;23use sp_std::{vec::Vec, vec};24use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};2526use crate::{27 Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,28};2930pub struct CommonWeights<T: Config>(PhantomData<T>);31impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {32 fn create_item() -> Weight {33 <SelfWeightOf<T>>::create_item()34 }3536 fn create_multiple_items(_data: &[CreateItemData]) -> Weight {37 // All items minted for the same user, so it works same as create_item38 Self::create_item()39 }4041 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {42 match data {43 CreateItemExData::Fungible(f) => {44 <SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)45 }46 _ => 0,47 }48 }4950 fn burn_item() -> Weight {51 <SelfWeightOf<T>>::burn_item()52 }5354 fn set_collection_properties(amount: u32) -> Weight {55 // Error56 057 }5859 fn delete_collection_properties(amount: u32) -> Weight {60 // Error61 062 }6364 fn set_token_properties(amount: u32) -> Weight {65 // Error66 067 }6869 fn delete_token_properties(amount: u32) -> Weight {70 // Error71 072 }7374 fn set_property_permissions(amount: u32) -> Weight {75 // Error76 077 }7879 fn transfer() -> Weight {80 <SelfWeightOf<T>>::transfer()81 }8283 fn approve() -> Weight {84 <SelfWeightOf<T>>::approve()85 }8687 fn transfer_from() -> Weight {88 <SelfWeightOf<T>>::transfer_from()89 }9091 fn burn_from() -> Weight {92 <SelfWeightOf<T>>::burn_from()93 }94}9596impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {97 fn create_item(98 &self,99 sender: T::CrossAccountId,100 to: T::CrossAccountId,101 data: up_data_structs::CreateItemData,102 nesting_budget: &dyn Budget,103 ) -> DispatchResultWithPostInfo {104 match data {105 up_data_structs::CreateItemData::Fungible(data) => with_weight(106 <Pallet<T>>::create_item(self, &sender, (to, data.value), nesting_budget),107 <CommonWeights<T>>::create_item(),108 ),109 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),110 }111 }112113 fn create_multiple_items(114 &self,115 sender: T::CrossAccountId,116 to: T::CrossAccountId,117 data: Vec<up_data_structs::CreateItemData>,118 nesting_budget: &dyn Budget,119 ) -> DispatchResultWithPostInfo {120 let mut sum: u128 = 0;121 for data in data {122 match data {123 up_data_structs::CreateItemData::Fungible(data) => {124 sum = sum125 .checked_add(data.value)126 .ok_or(ArithmeticError::Overflow)?;127 }128 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),129 }130 }131132 with_weight(133 <Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),134 <CommonWeights<T>>::create_item(),135 )136 }137138 fn create_multiple_items_ex(139 &self,140 sender: <T>::CrossAccountId,141 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,142 nesting_budget: &dyn Budget,143 ) -> DispatchResultWithPostInfo {144 let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);145 let data = match data {146 up_data_structs::CreateItemExData::Fungible(f) => f,147 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),148 };149150 with_weight(151 <Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),152 weight,153 )154 }155156 fn burn_item(157 &self,158 sender: T::CrossAccountId,159 token: TokenId,160 amount: u128,161 ) -> DispatchResultWithPostInfo {162 ensure!(163 token == TokenId::default(),164 <Error<T>>::FungibleItemsHaveNoId165 );166167 with_weight(168 <Pallet<T>>::burn(self, &sender, amount),169 <CommonWeights<T>>::burn_item(),170 )171 }172173 fn transfer(174 &self,175 from: T::CrossAccountId,176 to: T::CrossAccountId,177 token: TokenId,178 amount: u128,179 nesting_budget: &dyn Budget,180 ) -> DispatchResultWithPostInfo {181 ensure!(182 token == TokenId::default(),183 <Error<T>>::FungibleItemsHaveNoId184 );185186 with_weight(187 <Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),188 <CommonWeights<T>>::transfer(),189 )190 }191192 fn approve(193 &self,194 sender: T::CrossAccountId,195 spender: T::CrossAccountId,196 token: TokenId,197 amount: u128,198 ) -> DispatchResultWithPostInfo {199 ensure!(200 token == TokenId::default(),201 <Error<T>>::FungibleItemsHaveNoId202 );203204 with_weight(205 <Pallet<T>>::set_allowance(self, &sender, &spender, amount),206 <CommonWeights<T>>::approve(),207 )208 }209210 fn transfer_from(211 &self,212 sender: T::CrossAccountId,213 from: T::CrossAccountId,214 to: T::CrossAccountId,215 token: TokenId,216 amount: u128,217 nesting_budget: &dyn Budget,218 ) -> DispatchResultWithPostInfo {219 ensure!(220 token == TokenId::default(),221 <Error<T>>::FungibleItemsHaveNoId222 );223224 with_weight(225 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),226 <CommonWeights<T>>::transfer_from(),227 )228 }229230 fn burn_from(231 &self,232 sender: T::CrossAccountId,233 from: T::CrossAccountId,234 token: TokenId,235 amount: u128,236 nesting_budget: &dyn Budget,237 ) -> DispatchResultWithPostInfo {238 ensure!(239 token == TokenId::default(),240 <Error<T>>::FungibleItemsHaveNoId241 );242243 with_weight(244 <Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),245 <CommonWeights<T>>::burn_from(),246 )247 }248249 fn set_collection_properties(250 &self,251 _sender: T::CrossAccountId,252 _property: Vec<Property>,253 ) -> DispatchResultWithPostInfo {254 fail!(<Error<T>>::SettingPropertiesNotAllowed)255 }256257 fn delete_collection_properties(258 &self,259 _sender: &T::CrossAccountId,260 _property_keys: Vec<PropertyKey>,261 ) -> DispatchResultWithPostInfo {262 fail!(<Error<T>>::SettingPropertiesNotAllowed)263 }264265 fn set_token_properties(266 &self,267 _sender: T::CrossAccountId,268 _token_id: TokenId,269 _property: Vec<Property>,270 ) -> DispatchResultWithPostInfo {271 fail!(<Error<T>>::SettingPropertiesNotAllowed)272 }273274 fn set_property_permissions(275 &self,276 _sender: &T::CrossAccountId,277 _property_permissions: Vec<PropertyKeyPermission>,278 ) -> DispatchResultWithPostInfo {279 fail!(<Error<T>>::SettingPropertiesNotAllowed)280 }281282 fn delete_token_properties(283 &self,284 _sender: T::CrossAccountId,285 _token_id: TokenId,286 _property_keys: Vec<PropertyKey>,287 ) -> DispatchResultWithPostInfo {288 fail!(<Error<T>>::SettingPropertiesNotAllowed)289 }290291 fn check_nesting(292 &self,293 _sender: <T>::CrossAccountId,294 _from: (CollectionId, TokenId),295 _under: TokenId,296 _budget: &dyn Budget,297 ) -> sp_runtime::DispatchResult {298 fail!(<Error<T>>::FungibleDisallowsNesting)299 }300301 fn collection_tokens(&self) -> Vec<TokenId> {302 vec![TokenId::default()]303 }304305 fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {306 if <Balance<T>>::get((self.id, account)) != 0 {307 vec![TokenId::default()]308 } else {309 vec![]310 }311 }312313 fn token_exists(&self, token: TokenId) -> bool {314 token == TokenId::default()315 }316317 fn last_token_id(&self) -> TokenId {318 TokenId::default()319 }320321 fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {322 None323 }324 fn const_metadata(&self, _token: TokenId) -> Vec<u8> {325 Vec::new()326 }327328 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {329 None330 }331332 fn token_properties(333 &self,334 _token_id: TokenId,335 _keys: Option<Vec<PropertyKey>>,336 ) -> Vec<Property> {337 Vec::new()338 }339340 fn total_supply(&self) -> u32 {341 1342 }343344 fn account_balance(&self, account: T::CrossAccountId) -> u32 {345 if <Balance<T>>::get((self.id, account)) != 0 {346 1347 } else {348 0349 }350 }351352 fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {353 if token != TokenId::default() {354 return 0;355 }356 <Balance<T>>::get((self.id, account))357 }358359 fn allowance(360 &self,361 sender: T::CrossAccountId,362 spender: T::CrossAccountId,363 token: TokenId,364 ) -> u128 {365 if token != TokenId::default() {366 return 0;367 }368 <Allowance<T>>::get((self.id, sender, spender))369 }370}pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -35,11 +35,6 @@
fn create_item() -> Weight;
fn create_multiple_items_ex(b: u32, ) -> Weight;
fn burn_item() -> Weight;
- fn set_collection_properties(amount: u32) -> Weight;
- fn delete_collection_properties(amount: u32) -> Weight;
- fn set_token_properties(amount: u32) -> Weight;
- fn delete_token_properties(amount: u32) -> Weight;
- fn set_property_permissions(amount: u32) -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -73,33 +68,8 @@
(15_565_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
- }
-
- fn set_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn delete_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn set_token_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn delete_token_properties(_amount: u32) -> Weight {
- // Error
- 0
}
- fn set_property_permissions(_amount: u32) -> Weight {
- // Error
- 0
- }
-
// Storage: Fungible Balance (r:2 w:2)
fn transfer() -> Weight {
(17_713_000 as Weight)
@@ -156,31 +126,6 @@
(15_565_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
- }
-
- fn set_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn delete_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn set_token_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn delete_token_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn set_property_permissions(_amount: u32) -> Weight {
- // Error
- 0
}
// Storage: Fungible Balance (r:2 w:2)
pallets/nonfungible/Cargo.tomldiffbeforeafterboth--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -49,4 +49,5 @@
'frame-benchmarking',
'frame-support/runtime-benchmarks',
'frame-system/runtime-benchmarks',
+ 'up-data-structs/runtime-benchmarks',
]
pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -18,24 +18,35 @@
use crate::{Pallet, Config, NonfungibleHandle};
use sp_std::prelude::*;
-use pallet_common::benchmarking::{create_collection_raw, create_data, create_var_data};
+use pallet_common::benchmarking::{create_collection_raw, create_data, property_key, property_value};
use frame_benchmarking::{benchmarks, account};
-use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, CUSTOM_DATA_LIMIT, budget::Unlimited};
+use up_data_structs::{
+ CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, CUSTOM_DATA_LIMIT,
+ budget::Unlimited,
+};
use pallet_common::bench_init;
-use core::convert::TryInto;
const SEED: u32 = 1;
fn create_max_item_data<T: Config>(owner: T::CrossAccountId) -> CreateItemData<T> {
let const_data = create_data::<CUSTOM_DATA_LIMIT>();
- CreateItemData::<T> { const_data, owner }
+ CreateItemData::<T> {
+ const_data,
+ owner,
+ properties: Default::default(),
+ }
}
fn create_max_item<T: Config>(
collection: &NonfungibleHandle<T>,
sender: &T::CrossAccountId,
owner: T::CrossAccountId,
) -> Result<TokenId, DispatchError> {
- <Pallet<T>>::create_item(&collection, sender, create_max_item_data::<T>(owner))?;
+ <Pallet<T>>::create_item(
+ &collection,
+ sender,
+ create_max_item_data::<T>(owner),
+ &Unlimited,
+ )?;
Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))
}
@@ -65,7 +76,7 @@
sender: cross_from_sub(owner); to: cross_sub;
};
let data = (0..b).map(|_| create_max_item_data::<T>(to.clone())).collect();
- }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+ }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
create_multiple_items_ex {
let b in 0..MAX_ITEMS_PER_BATCH;
@@ -77,7 +88,7 @@
bench_init!(to: cross_sub(i););
create_max_item_data::<T>(to)
}).collect();
- }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+ }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
burn_item {
bench_init!{
@@ -93,7 +104,7 @@
owner: cross_from_sub; sender: cross_sub; receiver: cross_sub;
};
let item = create_max_item(&collection, &owner, sender.clone())?;
- }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item)?}
+ }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, &Unlimited)?}
approve {
bench_init!{
@@ -120,4 +131,66 @@
let item = create_max_item(&collection, &owner, sender.clone())?;
<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;
}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?}
+
+ set_property_permissions {
+ let b in 0..MAX_PROPERTIES_PER_ITEM;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub;
+ };
+ let perms = (0..b).map(|k| PropertyKeyPermission {
+ key: property_key(k as usize),
+ permission: PropertyPermission {
+ mutable: false,
+ collection_admin: false,
+ token_owner: false,
+ },
+ }).collect::<Vec<_>>();
+ }: {<Pallet<T>>::set_property_permissions(&collection, &owner, perms)?}
+
+ set_token_properties {
+ let b in 0..MAX_PROPERTIES_PER_ITEM;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub;
+ };
+ let perms = (0..b).map(|k| PropertyKeyPermission {
+ key: property_key(k as usize),
+ permission: PropertyPermission {
+ mutable: false,
+ collection_admin: true,
+ token_owner: true,
+ },
+ }).collect::<Vec<_>>();
+ <Pallet<T>>::set_property_permissions(&collection, &owner, perms)?;
+ let props = (0..b).map(|k| Property {
+ key: property_key(k as usize),
+ value: property_value(),
+ }).collect::<Vec<_>>();
+ let item = create_max_item(&collection, &owner, owner.clone())?;
+ }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props)?}
+
+ delete_token_properties {
+ let b in 0..MAX_PROPERTIES_PER_ITEM;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub;
+ };
+ let perms = (0..b).map(|k| PropertyKeyPermission {
+ key: property_key(k as usize),
+ permission: PropertyPermission {
+ mutable: true,
+ collection_admin: true,
+ token_owner: true,
+ },
+ }).collect::<Vec<_>>();
+ <Pallet<T>>::set_property_permissions(&collection, &owner, perms)?;
+ let props = (0..b).map(|k| Property {
+ key: property_key(k as usize),
+ value: property_value(),
+ }).collect::<Vec<_>>();
+ let item = create_max_item(&collection, &owner, owner.clone())?;
+ <Pallet<T>>::set_token_properties(&collection, &owner, item, props)?;
+ let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
+ }: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete)?}
}
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -21,7 +21,9 @@
TokenId, CreateItemExData, CollectionId, budget::Budget, Property, PropertyKey,
PropertyKeyPermission, PropertyValue,
};
-use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
+use pallet_common::{
+ CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,
+};
use sp_runtime::DispatchError;
use sp_std::vec::Vec;
@@ -38,13 +40,33 @@
fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {
match data {
- CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),
+ CreateItemExData::NFT(t) => {
+ <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32)
+ + t.iter()
+ .map(|t| {
+ if t.properties.len() > 0 {
+ Self::set_token_properties(t.properties.len() as u32)
+ } else {
+ 0
+ }
+ })
+ .sum::<u64>()
+ }
_ => 0,
}
}
- fn create_multiple_items(amount: u32) -> Weight {
- <SelfWeightOf<T>>::create_multiple_items(amount)
+ fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {
+ <SelfWeightOf<T>>::create_multiple_items(data.len() as u32)
+ + data
+ .iter()
+ .filter_map(|t| match t {
+ up_data_structs::CreateItemData::NFT(n) if n.properties.len() > 0 => {
+ Some(Self::set_token_properties(n.properties.len() as u32))
+ }
+ _ => None,
+ })
+ .sum::<u64>()
}
fn burn_item() -> Weight {
@@ -52,11 +74,11 @@
}
fn set_collection_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::set_collection_properties(amount)
+ <pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
}
fn delete_collection_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::delete_collection_properties(amount)
+ <pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
}
fn set_token_properties(amount: u32) -> Weight {
@@ -128,15 +150,15 @@
data: Vec<up_data_structs::CreateItemData>,
nesting_budget: &dyn Budget,
) -> DispatchResultWithPostInfo {
+ let weight = <CommonWeights<T>>::create_multiple_items(&data);
let data = data
.into_iter()
.map(|d| map_create_data::<T>(d, &to))
.collect::<Result<Vec<_>, DispatchError>>()?;
- let amount = data.len();
with_weight(
<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),
- <CommonWeights<T>>::create_multiple_items(amount as u32),
+ weight,
)
}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -18,7 +18,7 @@
use erc::ERC721Events;
use evm_coder::ToLog;
-use frame_support::{BoundedVec, ensure, fail, transactional};
+use frame_support::{BoundedVec, ensure, fail, transactional, storage::with_transaction};
use up_data_structs::{
AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission,
@@ -32,7 +32,7 @@
use pallet_structure::Pallet as PalletStructure;
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
use sp_core::H160;
-use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
+use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
use sp_std::{vec::Vec, vec};
use core::ops::Deref;
use sp_std::collections::btree_map::BTreeMap;
@@ -600,28 +600,37 @@
// =========
+ with_transaction(|| {
+ for (i, data) in data.iter().enumerate() {
+ let token = first_token + i as u32 + 1;
+
+ <TokenData<T>>::insert(
+ (collection.id, token),
+ ItemData {
+ const_data: data.const_data.clone(),
+ owner: data.owner.clone(),
+ },
+ );
+
+ if let Err(e) = Self::set_token_properties(
+ collection,
+ sender,
+ TokenId(token),
+ data.properties.clone().into_inner(),
+ ) {
+ return TransactionOutcome::Rollback(Err(e));
+ }
+ }
+ TransactionOutcome::Commit(Ok(()))
+ })?;
+
<TokensMinted<T>>::insert(collection.id, tokens_minted);
for (account, balance) in balances {
<AccountBalance<T>>::insert((collection.id, account), balance);
}
for (i, data) in data.into_iter().enumerate() {
let token = first_token + i as u32 + 1;
-
- <TokenData<T>>::insert(
- (collection.id, token),
- ItemData {
- const_data: data.const_data,
- owner: data.owner.clone(),
- },
- );
<Owned<T>>::insert((collection.id, &data.owner, token), true);
-
- Self::set_token_properties(
- collection,
- sender,
- TokenId(token),
- data.properties.into_inner(),
- )?;
<PalletEvm<T>>::deposit_log(
ERC721Events::Transfer {
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -151,10 +151,35 @@
// Storage: Nonfungible AccountBalance (r:1 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
fn burn_from() -> Weight {
- (27_580_000 as Weight)
- .saturating_add(T::DbWeight::get().reads(4 as Weight))
- .saturating_add(T::DbWeight::get().writes(5 as Weight))
}
+ // Storage: Common CollectionPropertyPermissions (r:1 w:1)
+ fn set_property_permissions(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 3_432_000
+ .saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(1 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ }
+ // Storage: Common CollectionPropertyPermissions (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ fn set_token_properties(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 158_583_000
+ .saturating_add((4_707_700_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(3 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ }
+ // Storage: Common CollectionPropertyPermissions (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ fn delete_token_properties(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 169_018_000
+ .saturating_add((4_783_967_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(3 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ }
}
// For backwards compatibility and tests
@@ -260,8 +285,33 @@
// Storage: Nonfungible AccountBalance (r:1 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
fn burn_from() -> Weight {
- (27_580_000 as Weight)
- .saturating_add(RocksDbWeight::get().reads(4 as Weight))
- .saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
+ // Storage: Common CollectionPropertyPermissions (r:1 w:1)
+ fn set_property_permissions(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 3_432_000
+ .saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ }
+ // Storage: Common CollectionPropertyPermissions (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ fn set_token_properties(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 158_583_000
+ .saturating_add((4_707_700_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ }
+ // Storage: Common CollectionPropertyPermissions (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ fn delete_token_properties(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 169_018_000
+ .saturating_add((4_783_967_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ }
}
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -18,7 +18,7 @@
use crate::{Pallet, Config, RefungibleHandle};
use sp_std::prelude::*;
-use pallet_common::benchmarking::{create_collection_raw, create_data, create_var_data};
+use pallet_common::benchmarking::{create_collection_raw, create_data};
use frame_benchmarking::{benchmarks, account};
use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, CUSTOM_DATA_LIMIT, budget::Unlimited};
use pallet_common::bench_init;
@@ -46,7 +46,7 @@
users: impl IntoIterator<Item = (T::CrossAccountId, u128)>,
) -> Result<TokenId, DispatchError> {
let data: CreateRefungibleExData<T::CrossAccountId> = create_max_item_data(users);
- <Pallet<T>>::create_item(&collection, sender, data)?;
+ <Pallet<T>>::create_item(&collection, sender, data, &Unlimited)?;
Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))
}
@@ -73,7 +73,7 @@
sender: cross_from_sub(owner); to: cross_sub;
};
let data = (0..b).map(|_| create_max_item_data([(to.clone(), 200)])).collect();
- }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+ }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
create_multiple_items_ex_multiple_items {
let b in 0..MAX_ITEMS_PER_BATCH;
@@ -85,7 +85,7 @@
bench_init!(to: cross_sub(t););
create_max_item_data([(to, 200)])
}).collect();
- }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+ }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
create_multiple_items_ex_multiple_owners {
let b in 0..MAX_ITEMS_PER_BATCH;
@@ -97,7 +97,7 @@
bench_init!(to: cross_sub(u););
(to, 200)
}))].try_into().unwrap();
- }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+ }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
// Other user left, token data is kept
burn_item_partial {
@@ -122,7 +122,7 @@
sender: cross_from_sub(owner); receiver: cross_sub;
};
let item = create_max_item(&collection, &sender, [(sender.clone(), 200), (receiver.clone(), 200)])?;
- }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100)?}
+ }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100, &Unlimited)?}
// Target account is created
transfer_creating {
bench_init!{
@@ -130,7 +130,7 @@
sender: cross_from_sub(owner); receiver: cross_sub;
};
let item = create_max_item(&collection, &sender, [(sender.clone(), 200)])?;
- }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100)?}
+ }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100, &Unlimited)?}
// Source account is destroyed
transfer_removing {
bench_init!{
@@ -138,7 +138,7 @@
sender: cross_from_sub(owner); receiver: cross_sub;
};
let item = create_max_item(&collection, &sender, [(sender.clone(), 200), (receiver.clone(), 200)])?;
- }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200)?}
+ }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200, &Unlimited)?}
// Source account destroyed, target created
transfer_creating_removing {
bench_init!{
@@ -146,7 +146,7 @@
sender: cross_from_sub(owner); receiver: cross_sub;
};
let item = create_max_item(&collection, &sender, [(sender.clone(), 200)])?;
- }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200)?}
+ }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200, &Unlimited)?}
approve {
bench_init!{
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -20,7 +20,7 @@
use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};
use up_data_structs::{
CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,
- PropertyKey, PropertyValue, PropertyKeyPermission,
+ PropertyKey, PropertyValue, PropertyKeyPermission, CreateItemData,
};
use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
use sp_runtime::DispatchError;
@@ -46,8 +46,8 @@
<SelfWeightOf<T>>::create_item()
}
- fn create_multiple_items(amount: u32) -> Weight {
- <SelfWeightOf<T>>::create_multiple_items(amount)
+ fn create_multiple_items(data: &[CreateItemData]) -> Weight {
+ <SelfWeightOf<T>>::create_multiple_items(data.len() as u32)
}
fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {
@@ -66,12 +66,14 @@
max_weight_of!(burn_item_partial(), burn_item_fully())
}
- fn set_collection_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::set_collection_properties(amount)
+ fn set_collection_properties(_amount: u32) -> Weight {
+ // Error
+ 0
}
- fn delete_collection_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::delete_collection_properties(amount)
+ fn delete_collection_properties(_amount: u32) -> Weight {
+ // Error
+ 0
}
fn set_token_properties(amount: u32) -> Weight {
@@ -156,15 +158,15 @@
data: Vec<up_data_structs::CreateItemData>,
nesting_budget: &dyn Budget,
) -> DispatchResultWithPostInfo {
+ let weight = <CommonWeights<T>>::create_multiple_items(&data);
let data = data
.into_iter()
.map(|d| map_create_data::<T>(d, &to))
.collect::<Result<Vec<_>, DispatchError>>()?;
- let amount = data.len();
with_weight(
<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),
- <CommonWeights<T>>::create_multiple_items(amount as u32),
+ weight,
)
}
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -38,8 +38,6 @@
fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;
fn burn_item_partial() -> Weight;
fn burn_item_fully() -> Weight;
- fn set_collection_properties(amount: u32) -> Weight;
- fn delete_collection_properties(amount: u32) -> Weight;
fn set_token_properties(amount: u32) -> Weight;
fn delete_token_properties(amount: u32) -> Weight;
fn set_property_permissions(amount: u32) -> Weight;
@@ -132,16 +130,6 @@
(32_489_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
- }
-
- fn set_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn delete_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
}
fn set_token_properties(_amount: u32) -> Weight {
@@ -320,16 +308,6 @@
(32_489_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
- }
-
- fn set_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
- }
-
- fn delete_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
}
fn set_token_properties(_amount: u32) -> Weight {
pallets/structure/Cargo.tomldiffbeforeafterboth--- a/pallets/structure/Cargo.toml
+++ b/pallets/structure/Cargo.toml
@@ -16,6 +16,7 @@
"derive",
] }
up-data-structs = { path = "../../primitives/data-structs", default-features = false }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
[features]
default = ["std"]
@@ -28,5 +29,6 @@
"scale-info/std",
"parity-scale-codec/std",
"up-data-structs/std",
+ "pallet-evm/std",
]
runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']
pallets/structure/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/structure/src/benchmarking.rs
+++ b/pallets/structure/src/benchmarking.rs
@@ -2,8 +2,10 @@
use frame_benchmarking::{benchmarks, account};
use frame_support::traits::{Currency, Get};
-use up_data_structs::{CreateCollectionData, CollectionMode, CreateItemData, CreateNftData};
-use pallet_common::CrossAccountId;
+use up_data_structs::{
+ CreateCollectionData, CollectionMode, CreateItemData, CreateNftData, budget::Unlimited,
+};
+use pallet_evm::account::CrossAccountId;
const SEED: u32 = 1;
@@ -20,9 +22,9 @@
let dispatch = T::CollectionDispatch::dispatch(CollectionHandle::try_get(CollectionId(1))?);
let dispatch = dispatch.as_dyn();
- dispatch.create_item(caller_cross.clone(), caller_cross.clone(), CreateItemData::NFT(CreateNftData::default()))?;
+ dispatch.create_item(caller_cross.clone(), caller_cross.clone(), CreateItemData::NFT(CreateNftData::default()), &Unlimited)?;
}: {
let parent = <Pallet<T>>::find_parent(CollectionId(1), TokenId(1))?;
- assert!(matches!(parent, Parent::Normal(_)))
+ assert!(matches!(parent, Parent::User(_)))
}
}
pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -687,7 +687,7 @@
/// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
///
/// * owner: Address, initial owner of the NFT.
- #[weight = T::CommonWeightInfo::create_multiple_items(items_data.len() as u32)]
+ #[weight = T::CommonWeightInfo::create_multiple_items(&items_data)]
#[transactional]
pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {
ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
primitives/data-structs/Cargo.tomldiffbeforeafterboth--- a/primitives/data-structs/Cargo.toml
+++ b/primitives/data-structs/Cargo.toml
@@ -42,3 +42,4 @@
]
serde1 = ["serde"]
limit-testing = []
+runtime-benchmarks = []
\ No newline at end of file
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -861,7 +861,9 @@
) -> Result<(), PropertiesError> {
let value_len = value.len();
- if self.consumed_space as usize + value_len > self.space_limit as usize {
+ if self.consumed_space as usize + value_len > self.space_limit as usize
+ && !cfg!(feature = "runtime-benchmarks")
+ {
return Err(PropertiesError::NoSpaceForProperty);
}
runtime/common/src/eth_sponsoring.rsdiffbeforeafterboth--- a/runtime/common/src/eth_sponsoring.rs
+++ b/runtime/common/src/eth_sponsoring.rs
@@ -50,16 +50,20 @@
CollectionMode::NFT => {
let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;
match call {
- UniqueNFTCall::TokenProperties(
- TokenPropertiesCall::SetProperty { token_id, key, value, .. },
- ) => {
+ UniqueNFTCall::TokenProperties(TokenPropertiesCall::SetProperty {
+ token_id,
+ key,
+ value,
+ ..
+ }) => {
let token_id: TokenId = token_id.try_into().ok()?;
withdraw_set_token_property::<T>(
&collection,
&who,
&token_id,
key.len() + value.len(),
- ).map(|()| sponsor)
+ )
+ .map(|()| sponsor)
}
UniqueNFTCall::ERC721UniqueExtensions(
ERC721UniqueExtensionsCall::Transfer { token_id, .. },
runtime/common/src/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -776,6 +776,7 @@
let mut list = Vec::<BenchmarkList>::new();
list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
+ list_benchmark!(list, extra, pallet_common, Common);
list_benchmark!(list, extra, pallet_unique, Unique);
list_benchmark!(list, extra, pallet_structure, Structure);
list_benchmark!(list, extra, pallet_inflation, Inflation);
@@ -814,6 +815,7 @@
let params = (&config, &allowlist);
add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
+ add_benchmark!(params, batches, pallet_common, Common);
add_benchmark!(params, batches, pallet_unique, Unique);
add_benchmark!(params, batches, pallet_structure, Structure);
add_benchmark!(params, batches, pallet_inflation, Inflation);
runtime/common/src/sponsoring.rsdiffbeforeafterboth--- a/runtime/common/src/sponsoring.rs
+++ b/runtime/common/src/sponsoring.rs
@@ -29,8 +29,8 @@
use pallet_evm::account::CrossAccountId;
use pallet_unique::{
Call as UniqueCall, Config as UniqueConfig, FungibleApproveBasket, RefungibleApproveBasket,
- NftApproveBasket, CreateItemBasket, ReFungibleTransferBasket,
- FungibleTransferBasket, NftTransferBasket, TokenPropertyBasket,
+ NftApproveBasket, CreateItemBasket, ReFungibleTransferBasket, FungibleTransferBasket,
+ NftTransferBasket, TokenPropertyBasket,
};
use pallet_fungible::Config as FungibleConfig;
use pallet_nonfungible::Config as NonfungibleConfig;
@@ -247,7 +247,7 @@
&T::CrossAccountId::from_sub(who.clone()),
&token_id,
// No overflow may happen, as data larger than usize can't reach here
- properties.iter().map(|p| p.key.len() + p.value.len()).sum()
+ properties.iter().map(|p| p.key.len() + p.value.len()).sum(),
)
.map(|()| sponsor)
}
runtime/common/src/weights.rsdiffbeforeafterboth--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -21,7 +21,7 @@
use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};
use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};
use pallet_refungible::{Config as RefungibleConfig, common::CommonWeights as RefungibleWeights};
-use up_data_structs::CreateItemExData;
+use up_data_structs::{CreateItemExData, CreateItemData};
macro_rules! max_weight_of {
($method:ident ( $($args:tt)* )) => {
@@ -42,8 +42,8 @@
dispatch_weight::<T>() + max_weight_of!(create_item())
}
- fn create_multiple_items(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(create_multiple_items(amount))
+ fn create_multiple_items(data: &[CreateItemData]) -> Weight {
+ dispatch_weight::<T>() + max_weight_of!(create_multiple_items(data))
}
fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -875,6 +875,7 @@
}
impl pallet_common::Config for Runtime {
+ type WeightInfo = pallet_common::weights::SubstrateWeight<Self>;
type Event = Event;
type Currency = Balances;
type CollectionCreationPrice = CollectionCreationPrice;
runtime/tests/src/lib.rsdiffbeforeafterboth--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -212,6 +212,7 @@
}
impl pallet_common::Config for Test {
+ type WeightInfo = ();
type Event = ();
type Currency = Balances;
type CollectionCreationPrice = CollectionCreationPrice;
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -39,6 +39,7 @@
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',
+ 'up-data-structs/runtime-benchmarks',
]
try-runtime = [
'frame-try-runtime',
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -66,7 +66,12 @@
WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
},
};
-use unique_runtime_common::dispatch::{CollectionDispatchT, CollectionDispatch};
+use unique_runtime_common::{
+ dispatch::{CollectionDispatchT, CollectionDispatch},
+ weights::CommonWeights,
+ sponsoring::UniqueSponsorshipHandler,
+ eth_sponsoring::UniqueEthSponsorshipHandler,
+};
use up_data_structs::*;
// use pallet_contracts::weights::WeightInfo;
// #[cfg(any(feature = "std", test))]
@@ -846,6 +851,7 @@
}
impl pallet_common::Config for Runtime {
+ type WeightInfo = pallet_common::weights::SubstrateWeight<Self>;
type Event = Event;
type Currency = Balances;
type CollectionCreationPrice = CollectionCreationPrice;
@@ -881,6 +887,7 @@
impl pallet_unique::Config for Runtime {
type Event = Event;
type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
+ type CommonWeightInfo = CommonWeights<Self>;
}
parameter_types! {
@@ -902,11 +909,11 @@
// }
type EvmSponsorshipHandler = (
- pallet_unique::UniqueEthSponsorshipHandler<Runtime>,
+ UniqueEthSponsorshipHandler<Runtime>,
pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
);
type SponsorshipHandler = (
- pallet_unique::UniqueSponsorshipHandler<Runtime>,
+ UniqueSponsorshipHandler<Runtime>,
//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
);