difftreelog
fix benchmark rmrk-core with opal-runtime
in: master
10 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8558,11 +8558,14 @@
"fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
+ "frame-benchmarking",
"frame-executive",
"frame-support",
"frame-system",
+ "frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
+ "hex-literal",
"log",
"orml-vesting",
"pallet-aura",
Makefilediffbeforeafterboth--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@
.PHONY: _bench
_bench:
- cargo run --release --features runtime-benchmarks,unique-runtime -- \
+ cargo run --release --features runtime-benchmarks,$(RUNTIME) -- \
benchmark pallet --pallet pallet-$(if $(PALLET),$(PALLET),$(error Must set PALLET)) \
--wasm-execution compiled --extrinsic '*' \
--template .maintain/frame-weight-template.hbs --steps=50 --repeat=80 --heap-pages=4096 \
node/cli/Cargo.tomldiffbeforeafterboth--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -323,7 +323,9 @@
[features]
default = []
runtime-benchmarks = [
- 'unique-runtime/runtime-benchmarks',
+ 'unique-runtime?/runtime-benchmarks',
+ 'quartz-runtime?/runtime-benchmarks',
+ 'opal-runtime/runtime-benchmarks',
'polkadot-service/runtime-benchmarks',
]
try-runtime = []
node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -26,13 +26,13 @@
use unique_runtime_common::types::*;
#[cfg(feature = "unique-runtime")]
-use unique_runtime as default_runtime;
+pub use unique_runtime as default_runtime;
#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]
-use quartz_runtime as default_runtime;
+pub use quartz_runtime as default_runtime;
#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]
-use opal_runtime as default_runtime;
+pub use opal_runtime as default_runtime;
/// The `ChainSpec` parameterized for the unique runtime.
#[cfg(feature = "unique-runtime")]
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -33,7 +33,7 @@
// limitations under the License.
use crate::{
- chain_spec::{self, RuntimeId, RuntimeIdentification, ServiceId, ServiceIdentification},
+ chain_spec::{self, RuntimeId, RuntimeIdentification, ServiceId, ServiceIdentification, default_runtime},
cli::{Cli, RelayChainCli, Subcommand},
service::{new_partial, start_node, start_dev_node},
};
@@ -44,7 +44,7 @@
#[cfg(feature = "quartz-runtime")]
use crate::service::QuartzRuntimeExecutor;
-use crate::service::OpalRuntimeExecutor;
+use crate::service::{OpalRuntimeExecutor, DefaultRuntimeExecutor};
use codec::Encode;
use cumulus_primitives_core::ParaId;
@@ -372,7 +372,6 @@
Ok(())
}
- #[cfg(feature = "unique-runtime")]
Some(Subcommand::Benchmark(cmd)) => {
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
let runner = cli.create_runner(cmd)?;
@@ -380,7 +379,7 @@
match cmd {
BenchmarkCmd::Pallet(cmd) => {
if cfg!(feature = "runtime-benchmarks") {
- runner.sync_run(|config| cmd.run::<Block, UniqueRuntimeExecutor>(config))
+ runner.sync_run(|config| cmd.run::<Block, DefaultRuntimeExecutor>(config))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
@@ -389,16 +388,16 @@
}
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
let partials = new_partial::<
- unique_runtime::RuntimeApi,
- UniqueRuntimeExecutor,
+ default_runtime::RuntimeApi,
+ DefaultRuntimeExecutor,
_,
>(&config, crate::service::parachain_build_import_queue)?;
cmd.run(partials.client)
}),
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
let partials = new_partial::<
- unique_runtime::RuntimeApi,
- UniqueRuntimeExecutor,
+ default_runtime::RuntimeApi,
+ DefaultRuntimeExecutor,
_,
>(&config, crate::service::parachain_build_import_queue)?;
let db = partials.backend.expose_db();
@@ -411,10 +410,6 @@
}
BenchmarkCmd::Overhead(_) => Err("Unsupported benchmarking command".into()),
}
- }
- #[cfg(not(feature = "unique-runtime"))]
- Some(Subcommand::Benchmark(..)) => {
- Err("benchmarking is only available with unique runtime enabled".into())
}
Some(Subcommand::TryRuntime(cmd)) => {
if cfg!(feature = "try-runtime") {
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -77,13 +77,21 @@
#[cfg(feature = "quartz-runtime")]
/// Quartz native executor instance.
-
pub struct QuartzRuntimeExecutor;
/// Opal native executor instance.
pub struct OpalRuntimeExecutor;
#[cfg(feature = "unique-runtime")]
+pub type DefaultRuntimeExecutor = UniqueRuntimeExecutor;
+
+#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]
+pub type DefaultRuntimeExecutor = QuartzRuntimeExecutor;
+
+#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]
+pub type DefaultRuntimeExecutor = OpalRuntimeExecutor;
+
+#[cfg(feature = "unique-runtime")]
impl NativeExecutionDispatch for UniqueRuntimeExecutor {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
pallets/proxy-rmrk-core/src/benchmarking.rsdiffbeforeafterboth1use sp_std::vec;23use frame_benchmarking::{benchmarks, account};4use frame_system::RawOrigin;5use frame_support::{6 traits::{Currency, Get},7 BoundedVec,8};9use sp_runtime::Permill;1011use up_data_structs::*;1213use super::*;1415const SEED: u32 = 1;1617fn create_data<S: Get<u32>>() -> BoundedVec<u8, S> {18 vec![b'A'; S::get() as usize].try_into().expect("size == S")19}2021fn create_u32_array<S: Get<u32>>() -> BoundedVec<u32, S> {22 vec![0; S::get() as usize].try_into().expect("size == S")23}2425fn create_basic_resource() -> RmrkBasicResource {26 RmrkBasicResource {27 src: Some(create_data()),28 metadata: Some(create_data()),29 license: Some(create_data()),30 thumb: Some(create_data()),31 }32}3334fn create_composable_resource() -> RmrkComposableResource {35 RmrkComposableResource {36 parts: create_u32_array(),37 base: 100,38 src: Some(create_data()),39 metadata: Some(create_data()),40 license: Some(create_data()),41 thumb: Some(create_data()),42 }43}4445fn create_slot_resource() -> RmrkSlotResource {46 RmrkSlotResource {47 base: 100,48 slot: 200,49 src: Some(create_data()),50 metadata: Some(create_data()),51 license: Some(create_data()),52 thumb: Some(create_data()),53 }54}5556fn create_max_resource_types_array<S: Get<u32>>(num: usize) -> BoundedVec<RmrkResourceTypes, S> {57 vec![RmrkResourceTypes::Composable(create_composable_resource()); num]58 .try_into()59 .expect("num <= S")60}6162fn create_max_collection<T: Config>(owner: &T::AccountId) -> DispatchResult {63 <T as pallet_common::Config>::Currency::deposit_creating(64 owner,65 T::CollectionCreationPrice::get(),66 );6768 let metadata = create_data();69 let max = None;70 let symbol = create_data();7172 <Pallet<T>>::create_collection(73 RawOrigin::Signed(owner.clone()).into(),74 metadata,75 max,76 symbol,77 )78}7980fn create_nft<T: Config>(owner: &T::AccountId, collection_id: RmrkCollectionId) -> DispatchResult {81 let royalty_recipient = Some(owner.clone());82 let royalty_amount = Some(Permill::from_percent(25));83 let metadata = create_data();84 let transferable = true;8586 <Pallet<T>>::mint_nft(87 RawOrigin::Signed(owner.clone()).into(),88 owner.clone(),89 collection_id,90 royalty_recipient,91 royalty_amount,92 metadata,93 transferable,94 None,95 )96}9798struct NftBuilder {99 collection_id: RmrkCollectionId,100 current_nft_id: RmrkNftId,101}102103impl NftBuilder {104 fn new(collection_id: RmrkCollectionId) -> Self {105 Self {106 collection_id,107 current_nft_id: 0,108 }109 }110111 fn current_nft_id(&self) -> RmrkNftId {112 self.current_nft_id113 }114115 fn build<T: Config>(&mut self, owner: &T::AccountId) -> Result<RmrkNftId, DispatchError> {116 create_nft::<T>(owner, self.collection_id)?;117 self.current_nft_id += 1;118119 Ok(self.current_nft_id)120 }121122 fn build_tower<T: Config>(123 &mut self,124 owner: &T::AccountId,125 height: u32,126 ) -> Result<(RmrkNftId, RmrkNftId), DispatchError> {127 self.build::<T>(owner)?;128129 let root_nft_id = self.current_nft_id;130 let mut prev_nft_id = root_nft_id;131132 for _ in 0..height {133 self.build::<T>(owner)?;134135 let new_owner =136 <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(137 self.collection_id,138 prev_nft_id,139 );140141 <Pallet<T>>::send(142 RawOrigin::Signed(owner.clone()).into(),143 self.collection_id,144 self.current_nft_id,145 new_owner,146 )?;147148 prev_nft_id = self.current_nft_id;149 }150151 let deepest_nft_id = self.current_nft_id;152153 Ok((root_nft_id, deepest_nft_id))154 }155156 fn build_wide_tree<T: Config>(157 &mut self,158 owner: &T::AccountId,159 width: u32,160 ) -> Result<RmrkNftId, DispatchError> {161 self.build::<T>(owner)?;162163 let root_nft_id = self.current_nft_id;164165 let root_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(166 self.collection_id,167 root_nft_id,168 );169170 for _ in 0..width {171 self.build::<T>(owner)?;172173 <Pallet<T>>::send(174 RawOrigin::Signed(owner.clone()).into(),175 self.collection_id,176 self.current_nft_id,177 root_owner.clone(),178 )?;179 }180181 Ok(root_nft_id)182 }183}184185benchmarks! {186 create_collection {187 let caller = account("caller", 0, SEED);188 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());189 let metadata = create_data();190 let max = None;191 let symbol = create_data();192 }: _(RawOrigin::Signed(caller), metadata, max, symbol)193194 destroy_collection {195 let caller = account("caller", 0, SEED);196197 create_max_collection::<T>(&caller)?;198 let collection_id = 0;199 }: _(RawOrigin::Signed(caller), collection_id)200201 change_collection_issuer {202 let caller: T::AccountId = account("caller", 0, SEED);203204 create_max_collection::<T>(&caller)?;205 let collection_id = 0;206207 let new_owner: T::AccountId = account("new_owner", 0, SEED);208209 let new_owner_source = T::Lookup::unlookup(new_owner);210 }: _(RawOrigin::Signed(caller), collection_id, new_owner_source)211212 lock_collection {213 let caller: T::AccountId = account("caller", 0, SEED);214215 create_max_collection::<T>(&caller)?;216 let collection_id = 0;217 }: _(RawOrigin::Signed(caller), collection_id)218219 mint_nft {220 let b in 0..100;221222 let caller: T::AccountId = account("caller", 0, SEED);223 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());224225 create_max_collection::<T>(&caller)?;226 let collection_id = 0;227 let owner = caller.clone();228229 let royalty_recipient = Some(caller.clone());230 let royalty_amount = Some(Permill::from_percent(25));231 let metadata = create_data();232 let transferable = true;233 }: _(234 RawOrigin::Signed(caller),235 owner,236 collection_id,237 royalty_recipient,238 royalty_amount,239 metadata,240 transferable,241 Some(create_max_resource_types_array(b as usize))242 )243244 burn_nft {245 let b in 0..200;246247 let caller: T::AccountId = account("caller", 0, SEED);248 create_max_collection::<T>(&caller)?;249 let collection_id = 0;250251 let mut nft_builder = NftBuilder::new(collection_id);252 let root_nft_id = nft_builder.build_wide_tree::<T>(&caller, b)?;253 let max_burns = b + 1;254 }: _(255 RawOrigin::Signed(caller),256 collection_id,257 root_nft_id,258 max_burns259 )260261 send {262 let caller: T::AccountId = account("caller", 0, SEED);263 create_max_collection::<T>(&caller)?;264 let collection_id = 0;265266 let mut nft_builder = NftBuilder::new(collection_id);267 let src_nft_id = nft_builder.build::<T>(&caller)?;268 let (_, target_nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 2)?;269 }: _(270 RawOrigin::Signed(caller),271 collection_id,272 src_nft_id,273 <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(collection_id, target_nft_id)274 )275276 accept_nft {277 let caller: T::AccountId = account("caller", 0, SEED);278 let sender: T::AccountId = account("sender", 0, SEED);279280 create_max_collection::<T>(&sender)?;281 let src_collection_id = 0;282283 create_max_collection::<T>(&caller)?;284 let target_collection_id = 1;285286 let mut src_nft_builder = NftBuilder::new(src_collection_id);287 let src_nft_id = src_nft_builder.build::<T>(&sender)?;288289 let mut target_nft_builder = NftBuilder::new(target_collection_id);290 let fake_target_nft_id = target_nft_builder.build::<T>(&caller)?;291 let (_, target_nft_id) = target_nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;292293 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(294 target_collection_id,295 fake_target_nft_id296 );297298 let actual_new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(299 target_collection_id,300 target_nft_id301 );302303 <Pallet<T>>::send(304 RawOrigin::Signed(sender.clone()).into(),305 src_collection_id,306 src_nft_id,307 new_owner,308 )?;309 }: _(310 RawOrigin::Signed(caller),311 src_collection_id,312 src_nft_id,313 actual_new_owner314 )315316 reject_nft {317 let caller: T::AccountId = account("caller", 0, SEED);318 let sender: T::AccountId = account("sender", 0, SEED);319320 create_max_collection::<T>(&sender)?;321 let src_collection_id = 0;322323 create_max_collection::<T>(&caller)?;324 let target_collection_id = 1;325326 let mut src_nft_builder = NftBuilder::new(src_collection_id);327 let (src_root_nft_id, _) = src_nft_builder.build_tower::<T>(&sender, NESTING_BUDGET - 1)?;328329 let mut target_nft_builder = NftBuilder::new(target_collection_id);330 let target_nft_id = target_nft_builder.build::<T>(&caller)?;331332 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(333 target_collection_id,334 target_nft_id335 );336337 <Pallet<T>>::send(338 RawOrigin::Signed(sender.clone()).into(),339 src_collection_id,340 src_root_nft_id,341 new_owner,342 )?;343 }: _(344 RawOrigin::Signed(caller),345 src_collection_id,346 src_root_nft_id347 )348349 set_property {350 let caller: T::AccountId = account("caller", 0, SEED);351 create_max_collection::<T>(&caller)?;352 let collection_id = 0;353354 let mut nft_builder = NftBuilder::new(collection_id);355 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;356357 let key = create_data();358 let value = create_data();359 }: _(360 RawOrigin::Signed(caller),361 collection_id,362 Some(nft_id),363 key,364 value365 )366367 set_priority {368 let caller: T::AccountId = account("caller", 0, SEED);369 create_max_collection::<T>(&caller)?;370 let collection_id = 0;371372 let mut nft_builder = NftBuilder::new(collection_id);373 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;374 let priorities = create_u32_array();375 }: _(376 RawOrigin::Signed(caller),377 collection_id,378 nft_id,379 priorities380 )381382 add_basic_resource {383 let caller: T::AccountId = account("caller", 0, SEED);384 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());385386 create_max_collection::<T>(&caller)?;387 let collection_id = 0;388389 let mut nft_builder = NftBuilder::new(collection_id);390 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;391 let resource = create_basic_resource();392 }: _(393 RawOrigin::Signed(caller),394 collection_id,395 nft_id,396 resource397 )398399 add_composable_resource {400 let caller: T::AccountId = account("caller", 0, SEED);401 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());402403 create_max_collection::<T>(&caller)?;404 let collection_id = 0;405406 let mut nft_builder = NftBuilder::new(collection_id);407 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;408 let resource = create_composable_resource();409 }: _(410 RawOrigin::Signed(caller),411 collection_id,412 nft_id,413 resource414 )415416 add_slot_resource {417 let caller: T::AccountId = account("caller", 0, SEED);418 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());419420 create_max_collection::<T>(&caller)?;421 let collection_id = 0;422423 let mut nft_builder = NftBuilder::new(collection_id);424 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;425 let resource = create_slot_resource();426 }: _(427 RawOrigin::Signed(caller),428 collection_id,429 nft_id,430 resource431 )432433 remove_resource {434 let caller: T::AccountId = account("caller", 0, SEED);435 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());436437 create_max_collection::<T>(&caller)?;438 let collection_id = 0;439440 let mut nft_builder = NftBuilder::new(collection_id);441 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;442 let resource = create_basic_resource();443444 <Pallet<T>>::add_basic_resource(445 RawOrigin::Signed(caller.clone()).into(),446 collection_id,447 nft_id,448 resource449 )?;450451 let resource_id = 1;452 }: _(453 RawOrigin::Signed(caller),454 collection_id,455 nft_id,456 resource_id457 )458459 accept_resource {460 let caller: T::AccountId = account("caller", 0, SEED);461 let admin: T::AccountId = account("admin", 0, SEED);462463 <T as pallet_common::Config>::Currency::deposit_creating(&admin, T::CollectionCreationPrice::get());464465 create_max_collection::<T>(&admin)?;466 let collection_id = 0;467468 let mut nft_builder = NftBuilder::new(collection_id);469 let root_nft_id = 1;470 let (_, nested_nft_id) = nft_builder.build_tower::<T>(&admin, NESTING_BUDGET - 1)?;471 let resource = create_basic_resource();472473 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::AccountId(caller.clone());474475 <Pallet<T>>::send(476 RawOrigin::Signed(admin.clone()).into(),477 collection_id,478 root_nft_id,479 new_owner,480 )?;481482 <Pallet<T>>::add_basic_resource(483 RawOrigin::Signed(admin.clone()).into(),484 collection_id,485 nested_nft_id,486 resource487 )?;488489 let resource_id = 1;490 }: _(491 RawOrigin::Signed(caller),492 collection_id,493 nested_nft_id,494 resource_id495 )496497 accept_resource_removal {498 let caller: T::AccountId = account("caller", 0, SEED);499 let admin: T::AccountId = account("admin", 0, SEED);500501 <T as pallet_common::Config>::Currency::deposit_creating(&admin, T::CollectionCreationPrice::get());502503 create_max_collection::<T>(&admin)?;504 let collection_id = 0;505506 let mut nft_builder = NftBuilder::new(collection_id);507 let root_nft_id = 1;508 let (_, nested_nft_id) = nft_builder.build_tower::<T>(&admin, NESTING_BUDGET - 1)?;509 let resource = create_basic_resource();510511 <Pallet<T>>::add_basic_resource(512 RawOrigin::Signed(admin.clone()).into(),513 collection_id,514 nested_nft_id,515 resource516 )?;517518 let resource_id = 1;519520 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::AccountId(caller.clone());521522 <Pallet<T>>::send(523 RawOrigin::Signed(admin.clone()).into(),524 collection_id,525 root_nft_id,526 new_owner,527 )?;528529 <Pallet<T>>::remove_resource(530 RawOrigin::Signed(admin).into(),531 collection_id,532 nested_nft_id,533 resource_id534 )?;535 }: _(536 RawOrigin::Signed(caller),537 collection_id,538 nested_nft_id,539 resource_id540 )541}1use sp_std::vec;23use frame_benchmarking::{benchmarks, account};4use frame_system::RawOrigin;5use frame_support::{6 traits::{Currency, Get},7 BoundedVec,8};9use sp_runtime::Permill;1011use up_data_structs::*;1213use super::*;1415const SEED: u32 = 1;1617fn create_data<S: Get<u32>>() -> BoundedVec<u8, S> {18 vec![b'A'; S::get() as usize].try_into().expect("size == S")19}2021fn create_u32_array<S: Get<u32>>() -> BoundedVec<u32, S> {22 vec![0; S::get() as usize].try_into().expect("size == S")23}2425fn create_basic_resource() -> RmrkBasicResource {26 RmrkBasicResource {27 src: Some(create_data()),28 metadata: Some(create_data()),29 license: Some(create_data()),30 thumb: Some(create_data()),31 }32}3334fn create_composable_resource() -> RmrkComposableResource {35 RmrkComposableResource {36 parts: create_u32_array(),37 base: 100,38 src: Some(create_data()),39 metadata: Some(create_data()),40 license: Some(create_data()),41 thumb: Some(create_data()),42 }43}4445fn create_slot_resource() -> RmrkSlotResource {46 RmrkSlotResource {47 base: 100,48 slot: 200,49 src: Some(create_data()),50 metadata: Some(create_data()),51 license: Some(create_data()),52 thumb: Some(create_data()),53 }54}5556fn create_max_resource_types_array<S: Get<u32>>(num: usize) -> BoundedVec<RmrkResourceTypes, S> {57 vec![RmrkResourceTypes::Composable(create_composable_resource()); num]58 .try_into()59 .expect("num <= S")60}6162fn create_max_collection<T: Config>(owner: &T::AccountId) -> DispatchResult {63 <T as pallet_common::Config>::Currency::deposit_creating(64 owner,65 T::CollectionCreationPrice::get(),66 );6768 let metadata = create_data();69 let max = None;70 let symbol = create_data();7172 <Pallet<T>>::create_collection(73 RawOrigin::Signed(owner.clone()).into(),74 metadata,75 max,76 symbol,77 )78}7980fn create_nft<T: Config>(owner: &T::AccountId, collection_id: RmrkCollectionId) -> DispatchResult {81 let royalty_recipient = Some(owner.clone());82 let royalty_amount = Some(Permill::from_percent(25));83 let metadata = create_data();84 let transferable = true;8586 <Pallet<T>>::mint_nft(87 RawOrigin::Signed(owner.clone()).into(),88 owner.clone(),89 collection_id,90 royalty_recipient,91 royalty_amount,92 metadata,93 transferable,94 None,95 )96}9798struct NftBuilder {99 collection_id: RmrkCollectionId,100 current_nft_id: RmrkNftId,101}102103impl NftBuilder {104 fn new(collection_id: RmrkCollectionId) -> Self {105 Self {106 collection_id,107 current_nft_id: 0,108 }109 }110111 fn current_nft_id(&self) -> RmrkNftId {112 self.current_nft_id113 }114115 fn build<T: Config>(&mut self, owner: &T::AccountId) -> Result<RmrkNftId, DispatchError> {116 create_nft::<T>(owner, self.collection_id)?;117 self.current_nft_id += 1;118119 Ok(self.current_nft_id)120 }121122 fn build_tower<T: Config>(123 &mut self,124 owner: &T::AccountId,125 height: u32,126 ) -> Result<(RmrkNftId, RmrkNftId), DispatchError> {127 self.build::<T>(owner)?;128129 let root_nft_id = self.current_nft_id;130 let mut prev_nft_id = root_nft_id;131132 for _ in 0..height {133 self.build::<T>(owner)?;134135 let new_owner =136 <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(137 self.collection_id,138 prev_nft_id,139 );140141 <Pallet<T>>::send(142 RawOrigin::Signed(owner.clone()).into(),143 self.collection_id,144 self.current_nft_id,145 new_owner,146 )?;147148 prev_nft_id = self.current_nft_id;149 }150151 let deepest_nft_id = self.current_nft_id;152153 Ok((root_nft_id, deepest_nft_id))154 }155156 fn build_wide_tree<T: Config>(157 &mut self,158 owner: &T::AccountId,159 width: u32,160 ) -> Result<RmrkNftId, DispatchError> {161 self.build::<T>(owner)?;162163 let root_nft_id = self.current_nft_id;164165 let root_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(166 self.collection_id,167 root_nft_id,168 );169170 for _ in 0..width {171 self.build::<T>(owner)?;172173 <Pallet<T>>::send(174 RawOrigin::Signed(owner.clone()).into(),175 self.collection_id,176 self.current_nft_id,177 root_owner.clone(),178 )?;179 }180181 Ok(root_nft_id)182 }183}184185benchmarks! {186 create_collection {187 let caller = account("caller", 0, SEED);188 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());189 let metadata = create_data();190 let max = None;191 let symbol = create_data();192 }: _(RawOrigin::Signed(caller), metadata, max, symbol)193194 destroy_collection {195 let caller = account("caller", 0, SEED);196197 create_max_collection::<T>(&caller)?;198 let collection_id = 0;199 }: _(RawOrigin::Signed(caller), collection_id)200201 change_collection_issuer {202 let caller: T::AccountId = account("caller", 0, SEED);203204 create_max_collection::<T>(&caller)?;205 let collection_id = 0;206207 let new_owner: T::AccountId = account("new_owner", 0, SEED);208209 let new_owner_source = T::Lookup::unlookup(new_owner);210 }: _(RawOrigin::Signed(caller), collection_id, new_owner_source)211212 lock_collection {213 let caller: T::AccountId = account("caller", 0, SEED);214215 create_max_collection::<T>(&caller)?;216 let collection_id = 0;217 }: _(RawOrigin::Signed(caller), collection_id)218219 mint_nft {220 let b in 0..100;221222 let caller: T::AccountId = account("caller", 0, SEED);223224 create_max_collection::<T>(&caller)?;225 let collection_id = 0;226 let owner = caller.clone();227228 let royalty_recipient = Some(caller.clone());229 let royalty_amount = Some(Permill::from_percent(25));230 let metadata = create_data();231 let transferable = true;232 }: _(233 RawOrigin::Signed(caller),234 owner,235 collection_id,236 royalty_recipient,237 royalty_amount,238 metadata,239 transferable,240 Some(create_max_resource_types_array(b as usize))241 )242243 burn_nft {244 let b in 0..200;245246 let caller: T::AccountId = account("caller", 0, SEED);247 create_max_collection::<T>(&caller)?;248 let collection_id = 0;249250 let mut nft_builder = NftBuilder::new(collection_id);251 let root_nft_id = nft_builder.build_wide_tree::<T>(&caller, b)?;252 let max_burns = b + 1;253 }: _(254 RawOrigin::Signed(caller),255 collection_id,256 root_nft_id,257 max_burns258 )259260 send {261 let caller: T::AccountId = account("caller", 0, SEED);262 create_max_collection::<T>(&caller)?;263 let collection_id = 0;264265 let mut nft_builder = NftBuilder::new(collection_id);266 let src_nft_id = nft_builder.build::<T>(&caller)?;267 let (_, target_nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 2)?;268 }: _(269 RawOrigin::Signed(caller),270 collection_id,271 src_nft_id,272 <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(collection_id, target_nft_id)273 )274275 accept_nft {276 let caller: T::AccountId = account("caller", 0, SEED);277 let sender: T::AccountId = account("sender", 0, SEED);278279 create_max_collection::<T>(&sender)?;280 let src_collection_id = 0;281282 create_max_collection::<T>(&caller)?;283 let target_collection_id = 1;284285 let mut src_nft_builder = NftBuilder::new(src_collection_id);286 let src_nft_id = src_nft_builder.build::<T>(&sender)?;287288 let mut target_nft_builder = NftBuilder::new(target_collection_id);289 let fake_target_nft_id = target_nft_builder.build::<T>(&caller)?;290 let (_, target_nft_id) = target_nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;291292 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(293 target_collection_id,294 fake_target_nft_id295 );296297 let actual_new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(298 target_collection_id,299 target_nft_id300 );301302 <Pallet<T>>::send(303 RawOrigin::Signed(sender.clone()).into(),304 src_collection_id,305 src_nft_id,306 new_owner,307 )?;308 }: _(309 RawOrigin::Signed(caller),310 src_collection_id,311 src_nft_id,312 actual_new_owner313 )314315 reject_nft {316 let caller: T::AccountId = account("caller", 0, SEED);317 let sender: T::AccountId = account("sender", 0, SEED);318319 create_max_collection::<T>(&sender)?;320 let src_collection_id = 0;321322 create_max_collection::<T>(&caller)?;323 let target_collection_id = 1;324325 let mut src_nft_builder = NftBuilder::new(src_collection_id);326 let (src_root_nft_id, _) = src_nft_builder.build_tower::<T>(&sender, NESTING_BUDGET - 1)?;327328 let mut target_nft_builder = NftBuilder::new(target_collection_id);329 let target_nft_id = target_nft_builder.build::<T>(&caller)?;330331 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(332 target_collection_id,333 target_nft_id334 );335336 <Pallet<T>>::send(337 RawOrigin::Signed(sender.clone()).into(),338 src_collection_id,339 src_root_nft_id,340 new_owner,341 )?;342 }: _(343 RawOrigin::Signed(caller),344 src_collection_id,345 src_root_nft_id346 )347348 set_property {349 let caller: T::AccountId = account("caller", 0, SEED);350 create_max_collection::<T>(&caller)?;351 let collection_id = 0;352353 let mut nft_builder = NftBuilder::new(collection_id);354 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;355356 let key = create_data();357 let value = create_data();358 }: _(359 RawOrigin::Signed(caller),360 collection_id,361 Some(nft_id),362 key,363 value364 )365366 set_priority {367 let caller: T::AccountId = account("caller", 0, SEED);368 create_max_collection::<T>(&caller)?;369 let collection_id = 0;370371 let mut nft_builder = NftBuilder::new(collection_id);372 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;373 let priorities = create_u32_array();374 }: _(375 RawOrigin::Signed(caller),376 collection_id,377 nft_id,378 priorities379 )380381 add_basic_resource {382 let caller: T::AccountId = account("caller", 0, SEED);383384 create_max_collection::<T>(&caller)?;385 let collection_id = 0;386387 let mut nft_builder = NftBuilder::new(collection_id);388 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;389 let resource = create_basic_resource();390 }: _(391 RawOrigin::Signed(caller),392 collection_id,393 nft_id,394 resource395 )396397 add_composable_resource {398 let caller: T::AccountId = account("caller", 0, SEED);399400 create_max_collection::<T>(&caller)?;401 let collection_id = 0;402403 let mut nft_builder = NftBuilder::new(collection_id);404 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;405 let resource = create_composable_resource();406 }: _(407 RawOrigin::Signed(caller),408 collection_id,409 nft_id,410 resource411 )412413 add_slot_resource {414 let caller: T::AccountId = account("caller", 0, SEED);415416 create_max_collection::<T>(&caller)?;417 let collection_id = 0;418419 let mut nft_builder = NftBuilder::new(collection_id);420 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;421 let resource = create_slot_resource();422 }: _(423 RawOrigin::Signed(caller),424 collection_id,425 nft_id,426 resource427 )428429 remove_resource {430 let caller: T::AccountId = account("caller", 0, SEED);431432 create_max_collection::<T>(&caller)?;433 let collection_id = 0;434435 let mut nft_builder = NftBuilder::new(collection_id);436 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;437 let resource = create_basic_resource();438439 <Pallet<T>>::add_basic_resource(440 RawOrigin::Signed(caller.clone()).into(),441 collection_id,442 nft_id,443 resource444 )?;445446 let resource_id = 0;447 }: _(448 RawOrigin::Signed(caller),449 collection_id,450 nft_id,451 resource_id452 )453454 accept_resource {455 let caller: T::AccountId = account("caller", 0, SEED);456 let admin: T::AccountId = account("admin", 0, SEED);457458 create_max_collection::<T>(&admin)?;459 let collection_id = 0;460461 let mut nft_builder = NftBuilder::new(collection_id);462 let root_nft_id = 1;463 let (_, nested_nft_id) = nft_builder.build_tower::<T>(&admin, NESTING_BUDGET - 1)?;464 let resource = create_basic_resource();465466 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::AccountId(caller.clone());467468 <Pallet<T>>::send(469 RawOrigin::Signed(admin.clone()).into(),470 collection_id,471 root_nft_id,472 new_owner,473 )?;474475 <Pallet<T>>::add_basic_resource(476 RawOrigin::Signed(admin.clone()).into(),477 collection_id,478 nested_nft_id,479 resource480 )?;481482 let resource_id = 0;483 }: _(484 RawOrigin::Signed(caller),485 collection_id,486 nested_nft_id,487 resource_id488 )489490 accept_resource_removal {491 let caller: T::AccountId = account("caller", 0, SEED);492 let admin: T::AccountId = account("admin", 0, SEED);493494 create_max_collection::<T>(&admin)?;495 let collection_id = 0;496497 let mut nft_builder = NftBuilder::new(collection_id);498 let root_nft_id = 1;499 let (_, nested_nft_id) = nft_builder.build_tower::<T>(&admin, NESTING_BUDGET - 1)?;500 let resource = create_basic_resource();501502 <Pallet<T>>::add_basic_resource(503 RawOrigin::Signed(admin.clone()).into(),504 collection_id,505 nested_nft_id,506 resource507 )?;508509 let resource_id = 0;510511 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::AccountId(caller.clone());512513 <Pallet<T>>::send(514 RawOrigin::Signed(admin.clone()).into(),515 collection_id,516 root_nft_id,517 new_owner,518 )?;519520 <Pallet<T>>::remove_resource(521 RawOrigin::Signed(admin).into(),522 collection_id,523 nested_nft_id,524 resource_id525 )?;526 }: _(527 RawOrigin::Signed(caller),528 collection_id,529 nested_nft_id,530 resource_id531 )532}pallets/proxy-rmrk-core/src/weights.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-core/src/weights.rs
+++ b/pallets/proxy-rmrk-core/src/weights.rs
@@ -3,7 +3,7 @@
//! Autogenerated weights for pallet_proxy_rmrk_core
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2022-06-14, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2022-06-16, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
@@ -19,7 +19,7 @@
// --template
// .maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=200
+// --repeat=80
// --heap-pages=4096
// --output=./pallets/proxy-rmrk-core/src/weights.rs
@@ -64,7 +64,7 @@
// Storage: Common CollectionById (r:0 w:1)
// Storage: RmrkCore UniqueCollectionId (r:0 w:1)
fn create_collection() -> Weight {
- (41_277_000 as Weight)
+ (41_768_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
}
@@ -77,7 +77,7 @@
// Storage: Nonfungible TokensBurnt (r:0 w:1)
// Storage: Common AdminAmount (r:0 w:1)
fn destroy_collection() -> Weight {
- (43_371_000 as Weight)
+ (43_402_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
@@ -85,7 +85,7 @@
// Storage: Common CollectionById (r:1 w:1)
// Storage: Common CollectionProperties (r:1 w:0)
fn change_collection_issuer() -> Weight {
- (21_891_000 as Weight)
+ (21_711_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -95,7 +95,7 @@
// Storage: Nonfungible TokensMinted (r:1 w:0)
// Storage: Nonfungible TokensBurnt (r:1 w:0)
fn lock_collection() -> Weight {
- (23_144_000 as Weight)
+ (23_204_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -107,18 +107,15 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
- // Storage: Common CreatedCollectionCount (r:1 w:1)
- // Storage: Common DestroyedCollectionCount (r:1 w:0)
- // Storage: System Account (r:2 w:2)
- // Storage: Common CollectionPropertyPermissions (r:0 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:2 w:2)
fn mint_nft(b: u32, ) -> Weight {
- (68_329_000 as Weight)
- // Standard Error: 3_000
- .saturating_add((21_470_000 as Weight).saturating_mul(b as Weight))
- .saturating_add(T::DbWeight::get().reads(12 as Weight))
+ (44_655_000 as Weight)
+ // Standard Error: 2_000
+ .saturating_add((10_953_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
- .saturating_add(T::DbWeight::get().writes(12 as Weight))
- .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))
+ .saturating_add(T::DbWeight::get().writes(5 as Weight))
+ .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
// Storage: Common CollectionProperties (r:1 w:0)
@@ -132,8 +129,8 @@
// Storage: Nonfungible TokenProperties (r:0 w:1)
fn burn_nft(b: u32, ) -> Weight {
(0 as Weight)
- // Standard Error: 959_000
- .saturating_add((305_872_000 as Weight).saturating_mul(b as Weight))
+ // Standard Error: 3_677_000
+ .saturating_add((357_082_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
@@ -149,7 +146,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn send() -> Weight {
- (71_405_000 as Weight)
+ (73_968_000 as Weight)
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
@@ -163,22 +160,22 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn accept_nft() -> Weight {
- (79_159_000 as Weight)
+ (81_954_000 as Weight)
.saturating_add(T::DbWeight::get().reads(15 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
// Storage: Common CollectionProperties (r:1 w:0)
// Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:5)
// Storage: Nonfungible TokenProperties (r:1 w:5)
- // Storage: Nonfungible TokenData (r:5 w:5)
// Storage: Nonfungible TokenChildren (r:9 w:4)
// Storage: Nonfungible TokensBurnt (r:1 w:1)
// Storage: Nonfungible AccountBalance (r:5 w:5)
// Storage: Nonfungible Allowance (r:5 w:0)
// Storage: Nonfungible Owned (r:0 w:5)
fn reject_nft() -> Weight {
- (238_179_000 as Weight)
+ (250_041_000 as Weight)
.saturating_add(T::DbWeight::get().reads(29 as Weight))
.saturating_add(T::DbWeight::get().writes(25 as Weight))
}
@@ -188,7 +185,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_property() -> Weight {
- (47_770_000 as Weight)
+ (48_631_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -198,100 +195,72 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_priority() -> Weight {
- (46_679_000 as Weight)
+ (47_830_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:1 w:1)
- // Storage: Common CollectionById (r:1 w:1)
- // Storage: Nonfungible TokenData (r:5 w:1)
- // Storage: Nonfungible TokenProperties (r:2 w:2)
- // Storage: Common CreatedCollectionCount (r:1 w:1)
- // Storage: Common DestroyedCollectionCount (r:1 w:0)
- // Storage: System Account (r:2 w:2)
- // Storage: Nonfungible TokensMinted (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Owned (r:0 w:1)
- // Storage: Common CollectionPropertyPermissions (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn add_basic_resource() -> Weight {
- (100_770_000 as Weight)
- .saturating_add(T::DbWeight::get().reads(16 as Weight))
- .saturating_add(T::DbWeight::get().writes(12 as Weight))
+ (54_773_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(10 as Weight))
+ .saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:1 w:1)
- // Storage: Common CollectionById (r:1 w:1)
- // Storage: Nonfungible TokenData (r:5 w:1)
- // Storage: Nonfungible TokenProperties (r:2 w:2)
- // Storage: Common CreatedCollectionCount (r:1 w:1)
- // Storage: Common DestroyedCollectionCount (r:1 w:0)
- // Storage: System Account (r:2 w:2)
- // Storage: Nonfungible TokensMinted (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Owned (r:0 w:1)
- // Storage: Common CollectionPropertyPermissions (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn add_composable_resource() -> Weight {
- (101_791_000 as Weight)
- .saturating_add(T::DbWeight::get().reads(16 as Weight))
- .saturating_add(T::DbWeight::get().writes(12 as Weight))
+ (55_214_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(10 as Weight))
+ .saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:1 w:1)
- // Storage: Common CollectionById (r:1 w:1)
- // Storage: Nonfungible TokenData (r:5 w:1)
- // Storage: Nonfungible TokenProperties (r:2 w:2)
- // Storage: Common CreatedCollectionCount (r:1 w:1)
- // Storage: Common DestroyedCollectionCount (r:1 w:0)
- // Storage: System Account (r:2 w:2)
- // Storage: Nonfungible TokensMinted (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Owned (r:0 w:1)
- // Storage: Common CollectionPropertyPermissions (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn add_slot_resource() -> Weight {
- (101_610_000 as Weight)
- .saturating_add(T::DbWeight::get().reads(16 as Weight))
- .saturating_add(T::DbWeight::get().writes(12 as Weight))
+ (54_863_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(10 as Weight))
+ .saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:2 w:0)
- // Storage: Common CollectionById (r:2 w:0)
- // Storage: Nonfungible TokenProperties (r:1 w:1)
- // Storage: Nonfungible TokenData (r:6 w:1)
- // Storage: Nonfungible TokenChildren (r:1 w:0)
- // Storage: Nonfungible TokensBurnt (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Allowance (r:1 w:0)
- // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
+ // Storage: Nonfungible TokenData (r:5 w:0)
fn remove_resource() -> Weight {
- (80_571_000 as Weight)
- .saturating_add(T::DbWeight::get().reads(16 as Weight))
- .saturating_add(T::DbWeight::get().writes(5 as Weight))
+ (46_848_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(9 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
// Storage: Common CollectionProperties (r:1 w:0)
// Storage: Common CollectionById (r:1 w:0)
// Storage: Nonfungible TokenData (r:5 w:0)
- // Storage: Nonfungible TokenProperties (r:2 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn accept_resource() -> Weight {
- (54_733_000 as Weight)
- .saturating_add(T::DbWeight::get().reads(10 as Weight))
+ (45_635_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:2 w:0)
- // Storage: Common CollectionById (r:2 w:0)
- // Storage: Nonfungible TokenData (r:6 w:1)
- // Storage: Nonfungible TokenProperties (r:2 w:1)
- // Storage: Nonfungible TokenChildren (r:1 w:0)
- // Storage: Nonfungible TokensBurnt (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Allowance (r:1 w:0)
- // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:0)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn accept_resource_removal() -> Weight {
- (84_138_000 as Weight)
- .saturating_add(T::DbWeight::get().reads(17 as Weight))
- .saturating_add(T::DbWeight::get().writes(5 as Weight))
+ (45_535_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(9 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
@@ -306,7 +275,7 @@
// Storage: Common CollectionById (r:0 w:1)
// Storage: RmrkCore UniqueCollectionId (r:0 w:1)
fn create_collection() -> Weight {
- (41_277_000 as Weight)
+ (41_768_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
}
@@ -319,7 +288,7 @@
// Storage: Nonfungible TokensBurnt (r:0 w:1)
// Storage: Common AdminAmount (r:0 w:1)
fn destroy_collection() -> Weight {
- (43_371_000 as Weight)
+ (43_402_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
@@ -327,7 +296,7 @@
// Storage: Common CollectionById (r:1 w:1)
// Storage: Common CollectionProperties (r:1 w:0)
fn change_collection_issuer() -> Weight {
- (21_891_000 as Weight)
+ (21_711_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -337,7 +306,7 @@
// Storage: Nonfungible TokensMinted (r:1 w:0)
// Storage: Nonfungible TokensBurnt (r:1 w:0)
fn lock_collection() -> Weight {
- (23_144_000 as Weight)
+ (23_204_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -349,18 +318,15 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
- // Storage: Common CreatedCollectionCount (r:1 w:1)
- // Storage: Common DestroyedCollectionCount (r:1 w:0)
- // Storage: System Account (r:2 w:2)
- // Storage: Common CollectionPropertyPermissions (r:0 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:2 w:2)
fn mint_nft(b: u32, ) -> Weight {
- (68_329_000 as Weight)
- // Standard Error: 3_000
- .saturating_add((21_470_000 as Weight).saturating_mul(b as Weight))
- .saturating_add(RocksDbWeight::get().reads(12 as Weight))
+ (44_655_000 as Weight)
+ // Standard Error: 2_000
+ .saturating_add((10_953_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
- .saturating_add(RocksDbWeight::get().writes(12 as Weight))
- .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(5 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
// Storage: Common CollectionProperties (r:1 w:0)
@@ -374,8 +340,8 @@
// Storage: Nonfungible TokenProperties (r:0 w:1)
fn burn_nft(b: u32, ) -> Weight {
(0 as Weight)
- // Standard Error: 959_000
- .saturating_add((305_872_000 as Weight).saturating_mul(b as Weight))
+ // Standard Error: 3_677_000
+ .saturating_add((357_082_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
@@ -391,7 +357,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn send() -> Weight {
- (71_405_000 as Weight)
+ (73_968_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
@@ -405,22 +371,22 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn accept_nft() -> Weight {
- (79_159_000 as Weight)
+ (81_954_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(15 as Weight))
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
// Storage: Common CollectionProperties (r:1 w:0)
// Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:5)
// Storage: Nonfungible TokenProperties (r:1 w:5)
- // Storage: Nonfungible TokenData (r:5 w:5)
// Storage: Nonfungible TokenChildren (r:9 w:4)
// Storage: Nonfungible TokensBurnt (r:1 w:1)
// Storage: Nonfungible AccountBalance (r:5 w:5)
// Storage: Nonfungible Allowance (r:5 w:0)
// Storage: Nonfungible Owned (r:0 w:5)
fn reject_nft() -> Weight {
- (238_179_000 as Weight)
+ (250_041_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(29 as Weight))
.saturating_add(RocksDbWeight::get().writes(25 as Weight))
}
@@ -430,7 +396,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_property() -> Weight {
- (47_770_000 as Weight)
+ (48_631_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -440,99 +406,71 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_priority() -> Weight {
- (46_679_000 as Weight)
+ (47_830_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:1 w:1)
- // Storage: Common CollectionById (r:1 w:1)
- // Storage: Nonfungible TokenData (r:5 w:1)
- // Storage: Nonfungible TokenProperties (r:2 w:2)
- // Storage: Common CreatedCollectionCount (r:1 w:1)
- // Storage: Common DestroyedCollectionCount (r:1 w:0)
- // Storage: System Account (r:2 w:2)
- // Storage: Nonfungible TokensMinted (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Owned (r:0 w:1)
- // Storage: Common CollectionPropertyPermissions (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn add_basic_resource() -> Weight {
- (100_770_000 as Weight)
- .saturating_add(RocksDbWeight::get().reads(16 as Weight))
- .saturating_add(RocksDbWeight::get().writes(12 as Weight))
+ (54_773_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(10 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:1 w:1)
- // Storage: Common CollectionById (r:1 w:1)
- // Storage: Nonfungible TokenData (r:5 w:1)
- // Storage: Nonfungible TokenProperties (r:2 w:2)
- // Storage: Common CreatedCollectionCount (r:1 w:1)
- // Storage: Common DestroyedCollectionCount (r:1 w:0)
- // Storage: System Account (r:2 w:2)
- // Storage: Nonfungible TokensMinted (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Owned (r:0 w:1)
- // Storage: Common CollectionPropertyPermissions (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn add_composable_resource() -> Weight {
- (101_791_000 as Weight)
- .saturating_add(RocksDbWeight::get().reads(16 as Weight))
- .saturating_add(RocksDbWeight::get().writes(12 as Weight))
+ (55_214_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(10 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:1 w:1)
- // Storage: Common CollectionById (r:1 w:1)
- // Storage: Nonfungible TokenData (r:5 w:1)
- // Storage: Nonfungible TokenProperties (r:2 w:2)
- // Storage: Common CreatedCollectionCount (r:1 w:1)
- // Storage: Common DestroyedCollectionCount (r:1 w:0)
- // Storage: System Account (r:2 w:2)
- // Storage: Nonfungible TokensMinted (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Owned (r:0 w:1)
- // Storage: Common CollectionPropertyPermissions (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:0)
+ // Storage: Nonfungible TokenProperties (r:1 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn add_slot_resource() -> Weight {
- (101_610_000 as Weight)
- .saturating_add(RocksDbWeight::get().reads(16 as Weight))
- .saturating_add(RocksDbWeight::get().writes(12 as Weight))
+ (54_863_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(10 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:2 w:0)
- // Storage: Common CollectionById (r:2 w:0)
- // Storage: Nonfungible TokenProperties (r:1 w:1)
- // Storage: Nonfungible TokenData (r:6 w:1)
- // Storage: Nonfungible TokenChildren (r:1 w:0)
- // Storage: Nonfungible TokensBurnt (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Allowance (r:1 w:0)
- // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
+ // Storage: Nonfungible TokenData (r:5 w:0)
fn remove_resource() -> Weight {
- (80_571_000 as Weight)
- .saturating_add(RocksDbWeight::get().reads(16 as Weight))
- .saturating_add(RocksDbWeight::get().writes(5 as Weight))
+ (46_848_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(9 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
// Storage: Common CollectionProperties (r:1 w:0)
// Storage: Common CollectionById (r:1 w:0)
// Storage: Nonfungible TokenData (r:5 w:0)
- // Storage: Nonfungible TokenProperties (r:2 w:1)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn accept_resource() -> Weight {
- (54_733_000 as Weight)
- .saturating_add(RocksDbWeight::get().reads(10 as Weight))
+ (45_635_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
- // Storage: Common CollectionProperties (r:2 w:0)
- // Storage: Common CollectionById (r:2 w:0)
- // Storage: Nonfungible TokenData (r:6 w:1)
- // Storage: Nonfungible TokenProperties (r:2 w:1)
- // Storage: Nonfungible TokenChildren (r:1 w:0)
- // Storage: Nonfungible TokensBurnt (r:1 w:1)
- // Storage: Nonfungible AccountBalance (r:1 w:1)
- // Storage: Nonfungible Allowance (r:1 w:0)
- // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:5 w:0)
+ // Storage: Nonfungible TokenSysProperties (r:1 w:1)
fn accept_resource_removal() -> Weight {
- (84_138_000 as Weight)
- .saturating_add(RocksDbWeight::get().reads(17 as Weight))
- .saturating_add(RocksDbWeight::get().writes(5 as Weight))
+ (45_535_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(9 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
}
runtime/common/src/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -454,6 +454,10 @@
list_benchmark!(list, extra, pallet_refungible, Refungible);
list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);
+
+ #[cfg(not(feature = "unique-runtime"))]
+ list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);
+
// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
let storage_info = AllPalletsReversedWithSystemFirst::storage_info();
@@ -498,6 +502,10 @@
add_benchmark!(params, batches, pallet_refungible, Refungible);
add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);
+
+ #[cfg(not(feature = "unique-runtime"))]
+ add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);
+
// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -16,7 +16,7 @@
targets = ['x86_64-unknown-linux-gnu']
[features]
-default = ['std']
+default = ['std', 'unique-runtime']
runtime-benchmarks = [
'hex-literal',
'frame-benchmarking',
@@ -119,6 +119,7 @@
"orml-vesting/std",
]
limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
+unique-runtime = []
################################################################################
# Substrate Dependencies