From 10d04f3edadbcdf49436d08f48da4723010bff0f Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Thu, 16 Jun 2022 10:45:06 +0000 Subject: [PATCH] fix: benchmark rmrk-core with opal-runtime --- --- 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", --- 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 \ --- 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 = [] --- 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")] --- 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::(config)) + runner.sync_run(|config| cmd.run::(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") { --- 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; --- a/pallets/proxy-rmrk-core/src/benchmarking.rs +++ b/pallets/proxy-rmrk-core/src/benchmarking.rs @@ -220,7 +220,6 @@ let b in 0..100; let caller: T::AccountId = account("caller", 0, SEED); - ::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get()); create_max_collection::(&caller)?; let collection_id = 0; @@ -381,7 +380,6 @@ add_basic_resource { let caller: T::AccountId = account("caller", 0, SEED); - ::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get()); create_max_collection::(&caller)?; let collection_id = 0; @@ -398,7 +396,6 @@ add_composable_resource { let caller: T::AccountId = account("caller", 0, SEED); - ::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get()); create_max_collection::(&caller)?; let collection_id = 0; @@ -415,7 +412,6 @@ add_slot_resource { let caller: T::AccountId = account("caller", 0, SEED); - ::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get()); create_max_collection::(&caller)?; let collection_id = 0; @@ -432,7 +428,6 @@ remove_resource { let caller: T::AccountId = account("caller", 0, SEED); - ::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get()); create_max_collection::(&caller)?; let collection_id = 0; @@ -448,7 +443,7 @@ resource )?; - let resource_id = 1; + let resource_id = 0; }: _( RawOrigin::Signed(caller), collection_id, @@ -460,8 +455,6 @@ let caller: T::AccountId = account("caller", 0, SEED); let admin: T::AccountId = account("admin", 0, SEED); - ::Currency::deposit_creating(&admin, T::CollectionCreationPrice::get()); - create_max_collection::(&admin)?; let collection_id = 0; @@ -486,7 +479,7 @@ resource )?; - let resource_id = 1; + let resource_id = 0; }: _( RawOrigin::Signed(caller), collection_id, @@ -498,8 +491,6 @@ let caller: T::AccountId = account("caller", 0, SEED); let admin: T::AccountId = account("admin", 0, SEED); - ::Currency::deposit_creating(&admin, T::CollectionCreationPrice::get()); - create_max_collection::(&admin)?; let collection_id = 0; @@ -515,7 +506,7 @@ resource )?; - let resource_id = 1; + let resource_id = 0; let new_owner = >::AccountId(caller.clone()); --- 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)) } } --- 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()) } --- 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 -- gitstuff