difftreelog
Merge pull request #1000 from UniqueNetwork/fix/minting-prop-weight
in: master
Refactor property writing + dev mode enhancements
42 files changed
.docker/Dockerfile-chain-devdiffbeforeafterboth--- a/.docker/Dockerfile-chain-dev
+++ b/.docker/Dockerfile-chain-dev
@@ -21,7 +21,7 @@
WORKDIR /dev_chain
-RUN cargo build --release
+RUN cargo build --profile integration-tests --features=${NETWORK}-runtime
RUN echo "$NETWORK"
-CMD cargo run --release --features=${NETWORK}-runtime -- --dev -linfo --rpc-cors=all --unsafe-rpc-external
+CMD cargo run --profile integration-tests --features=${NETWORK}-runtime -- --dev -linfo --rpc-cors=all --unsafe-rpc-external
.docker/Dockerfile-uniquediffbeforeafterboth--- a/.docker/Dockerfile-unique
+++ b/.docker/Dockerfile-unique
@@ -47,7 +47,7 @@
--mount=type=cache,target=/unique_parachain/unique-chain/target \
cd unique-chain && \
echo "Using runtime features '$RUNTIME_FEATURES'" && \
- CARGO_INCREMENTAL=0 cargo build --release --features="$RUNTIME_FEATURES" --locked && \
+ CARGO_INCREMENTAL=0 cargo build --profile integration-tests --features="$RUNTIME_FEATURES" --locked && \
mv ./target/release/unique-collator /unique_parachain/unique-chain/ && \
cd target/release/wbuild && find . -name "*.wasm" -exec sh -c 'mkdir -p "../../../wasm/$(dirname {})"; cp {} "../../../wasm/{}"' \;
.docker/docker-compose.gov.j2diffbeforeafterboth--- a/.docker/docker-compose.gov.j2
+++ b/.docker/docker-compose.gov.j2
@@ -21,4 +21,4 @@
options:
max-size: "1m"
max-file: "3"
- command: cargo run --release --features={{ NETWORK }}-runtime,gov-test-timings -- --dev -linfo --rpc-cors=all --unsafe-rpc-external
+ command: cargo run --profile integration-tests --features={{ NETWORK }}-runtime,gov-test-timings -- --dev -linfo --rpc-cors=all --unsafe-rpc-external
Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,6 +24,10 @@
lto = true
opt-level = 3
+[profile.integration-tests]
+inherits = "release"
+debug-assertions = true
+
[workspace.dependencies]
# Unique
app-promotion-rpc = { path = "primitives/app_promotion_rpc", default-features = false }
Makefilediffbeforeafterboth--- a/Makefile
+++ b/Makefile
@@ -90,7 +90,7 @@
.PHONY: _bench
_bench:
- cargo run --release --features runtime-benchmarks,$(RUNTIME) -- \
+ cargo run --profile production --features runtime-benchmarks,$(RUNTIME) -- \
benchmark pallet --pallet pallet-$(if $(PALLET),$(PALLET),$(error Must set PALLET)) \
--wasm-execution compiled --extrinsic '*' \
$(if $(TEMPLATE),$(TEMPLATE),--template=.maintain/frame-weight-template.hbs) --steps=50 --repeat=80 --heap-pages=4096 \
node/cli/src/cli.rsdiffbeforeafterboth--- a/node/cli/src/cli.rs
+++ b/node/cli/src/cli.rs
@@ -80,10 +80,20 @@
/// an empty block will be sealed automatically
/// after the `--idle-autoseal-interval` milliseconds.
///
- /// The default interval is 500 milliseconds
+ /// The default interval is 500 milliseconds.
#[structopt(default_value = "500", long)]
pub idle_autoseal_interval: u64,
+ /// Disable auto-sealing blocks on new transactions in the `--dev` mode.
+ #[structopt(long)]
+ pub disable_autoseal_on_tx: bool,
+
+ /// Finalization delay (in seconds) of auto-sealed blocks in the `--dev` mode.
+ ///
+ /// Disabled by default.
+ #[structopt(long)]
+ pub autoseal_finalization_delay: Option<u64>,
+
/// Disable automatic hardware benchmarks.
///
/// By default these benchmarks are automatically ran at startup and measure
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -62,7 +62,6 @@
use sc_service::config::{BasePath, PrometheusConfig};
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
-use std::{time::Duration};
use up_common::types::opaque::{Block, RuntimeId};
@@ -480,15 +479,13 @@
if is_dev_service {
info!("Running Dev service");
-
- let autoseal_interval = Duration::from_millis(cli.idle_autoseal_interval);
let mut config = config;
config.state_pruning = Some(sc_service::PruningMode::ArchiveAll);
return start_node_using_chain_runtime! {
- start_dev_node(config, autoseal_interval).map_err(Into::into)
+ start_dev_node(config, cli.idle_autoseal_interval, cli.autoseal_finalization_delay, cli.disable_autoseal_on_tx).map_err(Into::into)
};
};
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -169,9 +169,9 @@
}
impl AutosealInterval {
- pub fn new(config: &Configuration, interval: Duration) -> Self {
+ pub fn new(config: &Configuration, interval: u64) -> Self {
let _tokio_runtime = config.tokio_handle.enter();
- let interval = tokio::time::interval(interval);
+ let interval = tokio::time::interval(Duration::from_millis(interval));
Self { interval }
}
@@ -885,7 +885,9 @@
/// the parachain inherent
pub fn start_dev_node<Runtime, RuntimeApi, ExecutorDispatch>(
config: Configuration,
- autoseal_interval: Duration,
+ autoseal_interval: u64,
+ autoseal_finalize_delay: Option<u64>,
+ disable_autoseal_on_tx: bool,
) -> sc_service::error::Result<TaskManager>
where
Runtime: RuntimeInstance + Send + Sync + 'static,
@@ -912,7 +914,10 @@
+ sp_consensus_aura::AuraApi<Block, AuraId>,
ExecutorDispatch: NativeExecutionDispatch + 'static,
{
- use sc_consensus_manual_seal::{run_manual_seal, EngineCommand, ManualSealParams};
+ use sc_consensus_manual_seal::{
+ run_manual_seal, run_delayed_finalize, EngineCommand, ManualSealParams,
+ DelayedFinalizeParams,
+ };
use fc_consensus::FrontierBlockImport;
let sc_service::PartialComponents {
@@ -980,20 +985,22 @@
.pool()
.validated_pool()
.import_notification_stream()
+ .filter(move |_| futures::future::ready(!disable_autoseal_on_tx))
.map(|_| EngineCommand::SealNewBlock {
create_empty: true,
- finalize: false, // todo:collator finalize true
+ finalize: false,
parent_hash: None,
sender: None,
}),
);
let autoseal_interval = Box::pin(AutosealInterval::new(&config, autoseal_interval));
+
let idle_commands_stream: Box<
dyn Stream<Item = EngineCommand<Hash>> + Send + Sync + Unpin,
> = Box::new(autoseal_interval.map(|_| EngineCommand::SealNewBlock {
create_empty: true,
- finalize: false, // todo:collator finalize true
+ finalize: false,
parent_hash: None,
sender: None,
}));
@@ -1003,6 +1010,20 @@
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
let client_set_aside_for_cidp = client.clone();
+ if let Some(delay_sec) = autoseal_finalize_delay {
+ let spawn_handle = task_manager.spawn_handle();
+
+ task_manager.spawn_essential_handle().spawn_blocking(
+ "finalization_task",
+ Some("block-authoring"),
+ run_delayed_finalize(DelayedFinalizeParams {
+ client: client.clone(),
+ delay_sec,
+ spawn_handle,
+ }),
+ );
+ }
+
task_manager.spawn_essential_handle().spawn_blocking(
"authorship_task",
Some("block-authoring"),
pallets/app-promotion/src/weights.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/weights.rs
+++ b/pallets/app-promotion/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_app_promotion
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/app-promotion/src/weights.rs
@@ -48,25 +48,29 @@
/// Weights for pallet_app_promotion using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
+ /// Storage: Maintenance Enabled (r:1 w:0)
+ /// Proof: Maintenance Enabled (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
/// Storage: AppPromotion PendingUnstake (r:1 w:1)
/// Proof: AppPromotion PendingUnstake (max_values: None, max_size: Some(157), added: 2632, mode: MaxEncodedLen)
- /// Storage: Balances Locks (r:3 w:3)
- /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
+ /// Storage: Balances Freezes (r:3 w:3)
+ /// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
/// Storage: System Account (r:3 w:3)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ /// Storage: Balances Locks (r:3 w:0)
+ /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 3]`.
fn on_initialize(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `180 + b * (277 ±0)`
- // Estimated: `5602 + b * (6377 ±0)`
- // Minimum execution time: 3_724_000 picoseconds.
- Weight::from_parts(4_538_653, 5602)
- // Standard Error: 14_774
- .saturating_add(Weight::from_parts(10_368_686, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(1_u64))
- .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(b.into())))
+ // Measured: `222 + b * (285 ±0)`
+ // Estimated: `3622 + b * (3774 ±0)`
+ // Minimum execution time: 4_107_000 picoseconds.
+ Weight::from_parts(4_751_973, 3622)
+ // Standard Error: 4_668
+ .saturating_add(Weight::from_parts(10_570_330, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 6377).saturating_mul(b.into()))
+ .saturating_add(Weight::from_parts(0, 3774).saturating_mul(b.into()))
}
/// Storage: AppPromotion Admin (r:0 w:1)
/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
@@ -74,8 +78,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 5_426_000 picoseconds.
- Weight::from_parts(6_149_000, 0)
+ // Minimum execution time: 3_459_000 picoseconds.
+ Weight::from_parts(3_627_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: AppPromotion Admin (r:1 w:0)
@@ -90,24 +94,26 @@
/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
/// Storage: System Account (r:101 w:101)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
- /// Storage: Balances Locks (r:100 w:100)
+ /// Storage: Balances Freezes (r:100 w:100)
+ /// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
+ /// Storage: Balances Locks (r:100 w:0)
/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
/// Storage: AppPromotion TotalStaked (r:1 w:1)
/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
/// The range of component `b` is `[1, 100]`.
fn payout_stakers(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `531 + b * (633 ±0)`
- // Estimated: `16194 + b * (32560 ±0)`
- // Minimum execution time: 84_632_000 picoseconds.
- Weight::from_parts(800_384, 16194)
- // Standard Error: 19_457
- .saturating_add(Weight::from_parts(49_393_958, 0).saturating_mul(b.into()))
+ // Measured: `564 + b * (641 ±0)`
+ // Estimated: `3593 + b * (25550 ±0)`
+ // Minimum execution time: 73_245_000 picoseconds.
+ Weight::from_parts(74_196_000, 3593)
+ // Standard Error: 8_231
+ .saturating_add(Weight::from_parts(49_090_053, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(7_u64))
- .saturating_add(T::DbWeight::get().reads((12_u64).saturating_mul(b.into())))
+ .saturating_add(T::DbWeight::get().reads((13_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(3_u64))
.saturating_add(T::DbWeight::get().writes((12_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 32560).saturating_mul(b.into()))
+ .saturating_add(Weight::from_parts(0, 25550).saturating_mul(b.into()))
}
/// Storage: AppPromotion StakesPerAccount (r:1 w:1)
/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
@@ -115,7 +121,9 @@
/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
- /// Storage: Balances Locks (r:1 w:1)
+ /// Storage: Balances Freezes (r:1 w:1)
+ /// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
+ /// Storage: Balances Locks (r:1 w:0)
/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
/// Storage: ParachainSystem ValidationData (r:1 w:0)
/// Proof Skipped: ParachainSystem ValidationData (max_values: Some(1), max_size: None, mode: Measured)
@@ -125,11 +133,11 @@
/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn stake() -> Weight {
// Proof Size summary in bytes:
- // Measured: `356`
- // Estimated: `20260`
- // Minimum execution time: 24_750_000 picoseconds.
- Weight::from_parts(25_157_000, 20260)
- .saturating_add(T::DbWeight::get().reads(7_u64))
+ // Measured: `389`
+ // Estimated: `4764`
+ // Minimum execution time: 21_088_000 picoseconds.
+ Weight::from_parts(21_639_000, 4764)
+ .saturating_add(T::DbWeight::get().reads(8_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
@@ -144,10 +152,10 @@
/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
fn unstake_all() -> Weight {
// Proof Size summary in bytes:
- // Measured: `796`
- // Estimated: `35720`
- // Minimum execution time: 53_670_000 picoseconds.
- Weight::from_parts(54_376_000, 35720)
+ // Measured: `829`
+ // Estimated: `29095`
+ // Minimum execution time: 42_086_000 picoseconds.
+ Weight::from_parts(43_149_000, 29095)
.saturating_add(T::DbWeight::get().reads(14_u64))
.saturating_add(T::DbWeight::get().writes(13_u64))
}
@@ -163,10 +171,10 @@
/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
fn unstake_partial() -> Weight {
// Proof Size summary in bytes:
- // Measured: `796`
- // Estimated: `39234`
- // Minimum execution time: 58_317_000 picoseconds.
- Weight::from_parts(59_059_000, 39234)
+ // Measured: `829`
+ // Estimated: `29095`
+ // Minimum execution time: 46_458_000 picoseconds.
+ Weight::from_parts(47_333_000, 29095)
.saturating_add(T::DbWeight::get().reads(15_u64))
.saturating_add(T::DbWeight::get().writes(13_u64))
}
@@ -176,10 +184,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn sponsor_collection() -> Weight {
// Proof Size summary in bytes:
- // Measured: `1027`
- // Estimated: `5842`
- // Minimum execution time: 18_117_000 picoseconds.
- Weight::from_parts(18_634_000, 5842)
+ // Measured: `1060`
+ // Estimated: `4325`
+ // Minimum execution time: 12_827_000 picoseconds.
+ Weight::from_parts(13_610_000, 4325)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -189,10 +197,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn stop_sponsoring_collection() -> Weight {
// Proof Size summary in bytes:
- // Measured: `1059`
- // Estimated: `5842`
- // Minimum execution time: 16_999_000 picoseconds.
- Weight::from_parts(17_417_000, 5842)
+ // Measured: `1092`
+ // Estimated: `4325`
+ // Minimum execution time: 11_899_000 picoseconds.
+ Weight::from_parts(12_303_000, 4325)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -204,8 +212,8 @@
// Proof Size summary in bytes:
// Measured: `198`
// Estimated: `1517`
- // Minimum execution time: 14_438_000 picoseconds.
- Weight::from_parts(14_931_000, 1517)
+ // Minimum execution time: 10_226_000 picoseconds.
+ Weight::from_parts(10_549_000, 1517)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -215,10 +223,10 @@
/// Proof: EvmContractHelpers Sponsoring (max_values: None, max_size: Some(62), added: 2537, mode: MaxEncodedLen)
fn stop_sponsoring_contract() -> Weight {
// Proof Size summary in bytes:
- // Measured: `363`
- // Estimated: `5044`
- // Minimum execution time: 14_786_000 picoseconds.
- Weight::from_parts(15_105_000, 5044)
+ // Measured: `396`
+ // Estimated: `3527`
+ // Minimum execution time: 10_528_000 picoseconds.
+ Weight::from_parts(10_842_000, 3527)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -226,25 +234,29 @@
// For backwards compatibility and tests
impl WeightInfo for () {
+ /// Storage: Maintenance Enabled (r:1 w:0)
+ /// Proof: Maintenance Enabled (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
/// Storage: AppPromotion PendingUnstake (r:1 w:1)
/// Proof: AppPromotion PendingUnstake (max_values: None, max_size: Some(157), added: 2632, mode: MaxEncodedLen)
- /// Storage: Balances Locks (r:3 w:3)
- /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
+ /// Storage: Balances Freezes (r:3 w:3)
+ /// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
/// Storage: System Account (r:3 w:3)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ /// Storage: Balances Locks (r:3 w:0)
+ /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 3]`.
fn on_initialize(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `180 + b * (277 ±0)`
- // Estimated: `5602 + b * (6377 ±0)`
- // Minimum execution time: 3_724_000 picoseconds.
- Weight::from_parts(4_538_653, 5602)
- // Standard Error: 14_774
- .saturating_add(Weight::from_parts(10_368_686, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(1_u64))
- .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(b.into())))
+ // Measured: `222 + b * (285 ±0)`
+ // Estimated: `3622 + b * (3774 ±0)`
+ // Minimum execution time: 4_107_000 picoseconds.
+ Weight::from_parts(4_751_973, 3622)
+ // Standard Error: 4_668
+ .saturating_add(Weight::from_parts(10_570_330, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 6377).saturating_mul(b.into()))
+ .saturating_add(Weight::from_parts(0, 3774).saturating_mul(b.into()))
}
/// Storage: AppPromotion Admin (r:0 w:1)
/// Proof: AppPromotion Admin (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
@@ -252,8 +264,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 5_426_000 picoseconds.
- Weight::from_parts(6_149_000, 0)
+ // Minimum execution time: 3_459_000 picoseconds.
+ Weight::from_parts(3_627_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: AppPromotion Admin (r:1 w:0)
@@ -268,24 +280,26 @@
/// Proof: AppPromotion Staked (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen)
/// Storage: System Account (r:101 w:101)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
- /// Storage: Balances Locks (r:100 w:100)
+ /// Storage: Balances Freezes (r:100 w:100)
+ /// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
+ /// Storage: Balances Locks (r:100 w:0)
/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
/// Storage: AppPromotion TotalStaked (r:1 w:1)
/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
/// The range of component `b` is `[1, 100]`.
fn payout_stakers(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `531 + b * (633 ±0)`
- // Estimated: `16194 + b * (32560 ±0)`
- // Minimum execution time: 84_632_000 picoseconds.
- Weight::from_parts(800_384, 16194)
- // Standard Error: 19_457
- .saturating_add(Weight::from_parts(49_393_958, 0).saturating_mul(b.into()))
+ // Measured: `564 + b * (641 ±0)`
+ // Estimated: `3593 + b * (25550 ±0)`
+ // Minimum execution time: 73_245_000 picoseconds.
+ Weight::from_parts(74_196_000, 3593)
+ // Standard Error: 8_231
+ .saturating_add(Weight::from_parts(49_090_053, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(7_u64))
- .saturating_add(RocksDbWeight::get().reads((12_u64).saturating_mul(b.into())))
+ .saturating_add(RocksDbWeight::get().reads((13_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(3_u64))
.saturating_add(RocksDbWeight::get().writes((12_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 32560).saturating_mul(b.into()))
+ .saturating_add(Weight::from_parts(0, 25550).saturating_mul(b.into()))
}
/// Storage: AppPromotion StakesPerAccount (r:1 w:1)
/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
@@ -293,7 +307,9 @@
/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
- /// Storage: Balances Locks (r:1 w:1)
+ /// Storage: Balances Freezes (r:1 w:1)
+ /// Proof: Balances Freezes (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
+ /// Storage: Balances Locks (r:1 w:0)
/// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen)
/// Storage: ParachainSystem ValidationData (r:1 w:0)
/// Proof Skipped: ParachainSystem ValidationData (max_values: Some(1), max_size: None, mode: Measured)
@@ -303,11 +319,11 @@
/// Proof: AppPromotion TotalStaked (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn stake() -> Weight {
// Proof Size summary in bytes:
- // Measured: `356`
- // Estimated: `20260`
- // Minimum execution time: 24_750_000 picoseconds.
- Weight::from_parts(25_157_000, 20260)
- .saturating_add(RocksDbWeight::get().reads(7_u64))
+ // Measured: `389`
+ // Estimated: `4764`
+ // Minimum execution time: 21_088_000 picoseconds.
+ Weight::from_parts(21_639_000, 4764)
+ .saturating_add(RocksDbWeight::get().reads(8_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
/// Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)
@@ -322,10 +338,10 @@
/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
fn unstake_all() -> Weight {
// Proof Size summary in bytes:
- // Measured: `796`
- // Estimated: `35720`
- // Minimum execution time: 53_670_000 picoseconds.
- Weight::from_parts(54_376_000, 35720)
+ // Measured: `829`
+ // Estimated: `29095`
+ // Minimum execution time: 42_086_000 picoseconds.
+ Weight::from_parts(43_149_000, 29095)
.saturating_add(RocksDbWeight::get().reads(14_u64))
.saturating_add(RocksDbWeight::get().writes(13_u64))
}
@@ -341,10 +357,10 @@
/// Proof: AppPromotion StakesPerAccount (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
fn unstake_partial() -> Weight {
// Proof Size summary in bytes:
- // Measured: `796`
- // Estimated: `39234`
- // Minimum execution time: 58_317_000 picoseconds.
- Weight::from_parts(59_059_000, 39234)
+ // Measured: `829`
+ // Estimated: `29095`
+ // Minimum execution time: 46_458_000 picoseconds.
+ Weight::from_parts(47_333_000, 29095)
.saturating_add(RocksDbWeight::get().reads(15_u64))
.saturating_add(RocksDbWeight::get().writes(13_u64))
}
@@ -354,10 +370,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn sponsor_collection() -> Weight {
// Proof Size summary in bytes:
- // Measured: `1027`
- // Estimated: `5842`
- // Minimum execution time: 18_117_000 picoseconds.
- Weight::from_parts(18_634_000, 5842)
+ // Measured: `1060`
+ // Estimated: `4325`
+ // Minimum execution time: 12_827_000 picoseconds.
+ Weight::from_parts(13_610_000, 4325)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -367,10 +383,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn stop_sponsoring_collection() -> Weight {
// Proof Size summary in bytes:
- // Measured: `1059`
- // Estimated: `5842`
- // Minimum execution time: 16_999_000 picoseconds.
- Weight::from_parts(17_417_000, 5842)
+ // Measured: `1092`
+ // Estimated: `4325`
+ // Minimum execution time: 11_899_000 picoseconds.
+ Weight::from_parts(12_303_000, 4325)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -382,8 +398,8 @@
// Proof Size summary in bytes:
// Measured: `198`
// Estimated: `1517`
- // Minimum execution time: 14_438_000 picoseconds.
- Weight::from_parts(14_931_000, 1517)
+ // Minimum execution time: 10_226_000 picoseconds.
+ Weight::from_parts(10_549_000, 1517)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -393,10 +409,10 @@
/// Proof: EvmContractHelpers Sponsoring (max_values: None, max_size: Some(62), added: 2537, mode: MaxEncodedLen)
fn stop_sponsoring_contract() -> Weight {
// Proof Size summary in bytes:
- // Measured: `363`
- // Estimated: `5044`
- // Minimum execution time: 14_786_000 picoseconds.
- Weight::from_parts(15_105_000, 5044)
+ // Measured: `396`
+ // Estimated: `3527`
+ // Minimum execution time: 10_528_000 picoseconds.
+ Weight::from_parts(10_842_000, 3527)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
pallets/balances-adapter/src/common.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/common.rs
+++ b/pallets/balances-adapter/src/common.rs
@@ -172,6 +172,18 @@
fail!(<pallet_common::Error<T>>::UnsupportedOperation);
}
+ fn get_token_properties_raw(
+ &self,
+ _token_id: TokenId,
+ ) -> Option<up_data_structs::TokenProperties> {
+ // No token properties are defined on fungibles
+ None
+ }
+
+ fn set_token_properties_raw(&self, _token_id: TokenId, _map: up_data_structs::TokenProperties) {
+ // No token properties are defined on fungibles
+ }
+
fn set_token_property_permissions(
&self,
_sender: &<T>::CrossAccountId,
@@ -277,6 +289,15 @@
Err(up_data_structs::TokenOwnerError::MultipleOwners)
}
+ fn check_token_indirect_owner(
+ &self,
+ _token: TokenId,
+ _maybe_owner: &<T>::CrossAccountId,
+ _nesting_budget: &dyn up_data_structs::budget::Budget,
+ ) -> Result<bool, frame_support::sp_runtime::DispatchError> {
+ Ok(false)
+ }
+
fn token_owners(&self, _token: TokenId) -> Vec<<T>::CrossAccountId> {
vec![]
}
pallets/balances-adapter/src/erc.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/erc.rs
+++ b/pallets/balances-adapter/src/erc.rs
@@ -25,7 +25,7 @@
}
fn approve(&mut self, _caller: Caller, _spender: Address, _amount: U256) -> Result<bool> {
- Err("Approve not supported".into())
+ Err("approve not supported".into())
}
fn balance_of(&self, owner: Address) -> Result<U256> {
pallets/collator-selection/src/weights.rsdiffbeforeafterboth--- a/pallets/collator-selection/src/weights.rs
+++ b/pallets/collator-selection/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_collator_selection
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/collator-selection/src/weights.rs
@@ -57,11 +57,11 @@
fn add_invulnerable(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `403 + b * (45 ±0)`
- // Estimated: `7485 + b * (45 ±0)`
- // Minimum execution time: 14_147_000 picoseconds.
- Weight::from_parts(15_313_627, 7485)
- // Standard Error: 1_744
- .saturating_add(Weight::from_parts(178_890, 0).saturating_mul(b.into()))
+ // Estimated: `3873 + b * (45 ±0)`
+ // Minimum execution time: 10_975_000 picoseconds.
+ Weight::from_parts(11_362_608, 3873)
+ // Standard Error: 411
+ .saturating_add(Weight::from_parts(152_014, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(Weight::from_parts(0, 45).saturating_mul(b.into()))
@@ -73,10 +73,10 @@
// Proof Size summary in bytes:
// Measured: `96 + b * (32 ±0)`
// Estimated: `1806`
- // Minimum execution time: 9_426_000 picoseconds.
- Weight::from_parts(9_693_408, 1806)
- // Standard Error: 1_638
- .saturating_add(Weight::from_parts(227_917, 0).saturating_mul(b.into()))
+ // Minimum execution time: 6_369_000 picoseconds.
+ Weight::from_parts(6_604_933, 1806)
+ // Standard Error: 424
+ .saturating_add(Weight::from_parts(145_929, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -86,18 +86,20 @@
/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
/// Storage: Configuration CollatorSelectionLicenseBondOverride (r:1 w:0)
/// Proof: Configuration CollatorSelectionLicenseBondOverride (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
+ /// Storage: Balances Holds (r:1 w:1)
+ /// Proof: Balances Holds (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
/// The range of component `c` is `[1, 9]`.
fn get_license(c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `610 + c * (26 ±0)`
- // Estimated: `9099 + c * (28 ±0)`
- // Minimum execution time: 22_741_000 picoseconds.
- Weight::from_parts(24_210_604, 9099)
- // Standard Error: 2_703
- .saturating_add(Weight::from_parts(255_686, 0).saturating_mul(c.into()))
- .saturating_add(T::DbWeight::get().reads(3_u64))
- .saturating_add(T::DbWeight::get().writes(1_u64))
- .saturating_add(Weight::from_parts(0, 28).saturating_mul(c.into()))
+ // Measured: `668 + c * (46 ±0)`
+ // Estimated: `4131 + c * (47 ±0)`
+ // Minimum execution time: 23_857_000 picoseconds.
+ Weight::from_parts(25_984_655, 4131)
+ // Standard Error: 4_364
+ .saturating_add(Weight::from_parts(521_198, 0).saturating_mul(c.into()))
+ .saturating_add(T::DbWeight::get().reads(4_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ .saturating_add(Weight::from_parts(0, 47).saturating_mul(c.into()))
}
/// Storage: CollatorSelection LicenseDepositOf (r:1 w:0)
/// Proof: CollatorSelection LicenseDepositOf (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen)
@@ -114,12 +116,12 @@
/// The range of component `c` is `[1, 7]`.
fn onboard(c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `445 + c * (54 ±0)`
- // Estimated: `10119`
- // Minimum execution time: 20_397_000 picoseconds.
- Weight::from_parts(21_415_013, 10119)
- // Standard Error: 4_086
- .saturating_add(Weight::from_parts(252_810, 0).saturating_mul(c.into()))
+ // Measured: `414 + c * (54 ±0)`
+ // Estimated: `3529`
+ // Minimum execution time: 14_337_000 picoseconds.
+ Weight::from_parts(14_827_525, 3529)
+ // Standard Error: 1_210
+ .saturating_add(Weight::from_parts(298_748, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -127,15 +129,15 @@
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
/// Proof: CollatorSelection LastAuthoredBlock (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen)
- /// The range of component `c` is `[1, 10]`.
+ /// The range of component `c` is `[1, 8]`.
fn offboard(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `111 + c * (32 ±0)`
// Estimated: `1806`
- // Minimum execution time: 10_543_000 picoseconds.
- Weight::from_parts(11_227_541, 1806)
- // Standard Error: 1_699
- .saturating_add(Weight::from_parts(181_030, 0).saturating_mul(c.into()))
+ // Minimum execution time: 7_320_000 picoseconds.
+ Weight::from_parts(7_646_004, 1806)
+ // Standard Error: 479
+ .saturating_add(Weight::from_parts(160_089, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -143,37 +145,41 @@
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: CollatorSelection LicenseDepositOf (r:1 w:1)
/// Proof: CollatorSelection LicenseDepositOf (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen)
+ /// Storage: Balances Holds (r:1 w:1)
+ /// Proof: Balances Holds (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
/// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
/// Proof: CollatorSelection LastAuthoredBlock (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen)
- /// The range of component `c` is `[1, 10]`.
+ /// The range of component `c` is `[1, 8]`.
fn release_license(c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `306 + c * (61 ±0)`
- // Estimated: `5335`
- // Minimum execution time: 22_214_000 picoseconds.
- Weight::from_parts(24_373_981, 5335)
- // Standard Error: 8_018
- .saturating_add(Weight::from_parts(405_404, 0).saturating_mul(c.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
- .saturating_add(T::DbWeight::get().writes(3_u64))
+ // Measured: `328 + c * (103 ±0)`
+ // Estimated: `3834`
+ // Minimum execution time: 22_821_000 picoseconds.
+ Weight::from_parts(23_668_202, 3834)
+ // Standard Error: 6_654
+ .saturating_add(Weight::from_parts(844_978, 0).saturating_mul(c.into()))
+ .saturating_add(T::DbWeight::get().reads(3_u64))
+ .saturating_add(T::DbWeight::get().writes(4_u64))
}
/// Storage: CollatorSelection Candidates (r:1 w:1)
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: CollatorSelection LicenseDepositOf (r:1 w:1)
/// Proof: CollatorSelection LicenseDepositOf (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen)
+ /// Storage: Balances Holds (r:1 w:1)
+ /// Proof: Balances Holds (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
/// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
/// Proof: CollatorSelection LastAuthoredBlock (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen)
- /// The range of component `c` is `[1, 10]`.
+ /// The range of component `c` is `[1, 8]`.
fn force_release_license(c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `306 + c * (61 ±0)`
- // Estimated: `5335`
- // Minimum execution time: 22_159_000 picoseconds.
- Weight::from_parts(24_200_796, 5335)
- // Standard Error: 8_328
- .saturating_add(Weight::from_parts(312_138, 0).saturating_mul(c.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
- .saturating_add(T::DbWeight::get().writes(3_u64))
+ // Measured: `328 + c * (103 ±0)`
+ // Estimated: `3834`
+ // Minimum execution time: 22_462_000 picoseconds.
+ Weight::from_parts(23_215_875, 3834)
+ // Standard Error: 6_450
+ .saturating_add(Weight::from_parts(830_887, 0).saturating_mul(c.into()))
+ .saturating_add(T::DbWeight::get().reads(3_u64))
+ .saturating_add(T::DbWeight::get().writes(4_u64))
}
/// Storage: System Account (r:2 w:2)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
@@ -184,9 +190,9 @@
fn note_author() -> Weight {
// Proof Size summary in bytes:
// Measured: `155`
- // Estimated: `7729`
- // Minimum execution time: 16_520_000 picoseconds.
- Weight::from_parts(16_933_000, 7729)
+ // Estimated: `6196`
+ // Minimum execution time: 17_624_000 picoseconds.
+ Weight::from_parts(18_025_000, 6196)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -194,32 +200,34 @@
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: Configuration CollatorSelectionKickThresholdOverride (r:1 w:0)
/// Proof: Configuration CollatorSelectionKickThresholdOverride (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
- /// Storage: CollatorSelection LastAuthoredBlock (r:10 w:0)
+ /// Storage: CollatorSelection LastAuthoredBlock (r:8 w:0)
/// Proof: CollatorSelection LastAuthoredBlock (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen)
/// Storage: CollatorSelection Invulnerables (r:1 w:0)
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: System BlockWeight (r:1 w:1)
/// Proof: System BlockWeight (max_values: Some(1), max_size: Some(48), added: 543, mode: MaxEncodedLen)
- /// Storage: CollatorSelection LicenseDepositOf (r:9 w:9)
+ /// Storage: CollatorSelection LicenseDepositOf (r:7 w:7)
/// Proof: CollatorSelection LicenseDepositOf (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen)
- /// Storage: System Account (r:10 w:10)
+ /// Storage: Balances Holds (r:7 w:7)
+ /// Proof: Balances Holds (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
+ /// Storage: System Account (r:8 w:8)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
- /// The range of component `r` is `[1, 10]`.
- /// The range of component `c` is `[1, 10]`.
+ /// The range of component `r` is `[1, 8]`.
+ /// The range of component `c` is `[1, 8]`.
fn new_session(r: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `562 + r * (190 ±0) + c * (83 ±0)`
- // Estimated: `91818518943723 + c * (2519 ±0) + r * (5142 ±1)`
- // Minimum execution time: 16_153_000 picoseconds.
- Weight::from_parts(16_601_000, 91818518943723)
- // Standard Error: 119_095
- .saturating_add(Weight::from_parts(10_660_813, 0).saturating_mul(c.into()))
+ // Measured: `725 + c * (84 ±0) + r * (254 ±0)`
+ // Estimated: `6196 + c * (2519 ±0) + r * (2844 ±0)`
+ // Minimum execution time: 11_318_000 picoseconds.
+ Weight::from_parts(11_615_000, 6196)
+ // Standard Error: 69_557
+ .saturating_add(Weight::from_parts(13_016_275, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into()))
- .saturating_add(Weight::from_parts(0, 5142).saturating_mul(r.into()))
+ .saturating_add(Weight::from_parts(0, 2844).saturating_mul(r.into()))
}
}
@@ -235,11 +243,11 @@
fn add_invulnerable(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `403 + b * (45 ±0)`
- // Estimated: `7485 + b * (45 ±0)`
- // Minimum execution time: 14_147_000 picoseconds.
- Weight::from_parts(15_313_627, 7485)
- // Standard Error: 1_744
- .saturating_add(Weight::from_parts(178_890, 0).saturating_mul(b.into()))
+ // Estimated: `3873 + b * (45 ±0)`
+ // Minimum execution time: 10_975_000 picoseconds.
+ Weight::from_parts(11_362_608, 3873)
+ // Standard Error: 411
+ .saturating_add(Weight::from_parts(152_014, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(Weight::from_parts(0, 45).saturating_mul(b.into()))
@@ -251,10 +259,10 @@
// Proof Size summary in bytes:
// Measured: `96 + b * (32 ±0)`
// Estimated: `1806`
- // Minimum execution time: 9_426_000 picoseconds.
- Weight::from_parts(9_693_408, 1806)
- // Standard Error: 1_638
- .saturating_add(Weight::from_parts(227_917, 0).saturating_mul(b.into()))
+ // Minimum execution time: 6_369_000 picoseconds.
+ Weight::from_parts(6_604_933, 1806)
+ // Standard Error: 424
+ .saturating_add(Weight::from_parts(145_929, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -264,18 +272,20 @@
/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
/// Storage: Configuration CollatorSelectionLicenseBondOverride (r:1 w:0)
/// Proof: Configuration CollatorSelectionLicenseBondOverride (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
+ /// Storage: Balances Holds (r:1 w:1)
+ /// Proof: Balances Holds (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
/// The range of component `c` is `[1, 9]`.
fn get_license(c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `610 + c * (26 ±0)`
- // Estimated: `9099 + c * (28 ±0)`
- // Minimum execution time: 22_741_000 picoseconds.
- Weight::from_parts(24_210_604, 9099)
- // Standard Error: 2_703
- .saturating_add(Weight::from_parts(255_686, 0).saturating_mul(c.into()))
- .saturating_add(RocksDbWeight::get().reads(3_u64))
- .saturating_add(RocksDbWeight::get().writes(1_u64))
- .saturating_add(Weight::from_parts(0, 28).saturating_mul(c.into()))
+ // Measured: `668 + c * (46 ±0)`
+ // Estimated: `4131 + c * (47 ±0)`
+ // Minimum execution time: 23_857_000 picoseconds.
+ Weight::from_parts(25_984_655, 4131)
+ // Standard Error: 4_364
+ .saturating_add(Weight::from_parts(521_198, 0).saturating_mul(c.into()))
+ .saturating_add(RocksDbWeight::get().reads(4_u64))
+ .saturating_add(RocksDbWeight::get().writes(2_u64))
+ .saturating_add(Weight::from_parts(0, 47).saturating_mul(c.into()))
}
/// Storage: CollatorSelection LicenseDepositOf (r:1 w:0)
/// Proof: CollatorSelection LicenseDepositOf (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen)
@@ -292,12 +302,12 @@
/// The range of component `c` is `[1, 7]`.
fn onboard(c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `445 + c * (54 ±0)`
- // Estimated: `10119`
- // Minimum execution time: 20_397_000 picoseconds.
- Weight::from_parts(21_415_013, 10119)
- // Standard Error: 4_086
- .saturating_add(Weight::from_parts(252_810, 0).saturating_mul(c.into()))
+ // Measured: `414 + c * (54 ±0)`
+ // Estimated: `3529`
+ // Minimum execution time: 14_337_000 picoseconds.
+ Weight::from_parts(14_827_525, 3529)
+ // Standard Error: 1_210
+ .saturating_add(Weight::from_parts(298_748, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -305,15 +315,15 @@
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
/// Proof: CollatorSelection LastAuthoredBlock (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen)
- /// The range of component `c` is `[1, 10]`.
+ /// The range of component `c` is `[1, 8]`.
fn offboard(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `111 + c * (32 ±0)`
// Estimated: `1806`
- // Minimum execution time: 10_543_000 picoseconds.
- Weight::from_parts(11_227_541, 1806)
- // Standard Error: 1_699
- .saturating_add(Weight::from_parts(181_030, 0).saturating_mul(c.into()))
+ // Minimum execution time: 7_320_000 picoseconds.
+ Weight::from_parts(7_646_004, 1806)
+ // Standard Error: 479
+ .saturating_add(Weight::from_parts(160_089, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -321,37 +331,41 @@
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: CollatorSelection LicenseDepositOf (r:1 w:1)
/// Proof: CollatorSelection LicenseDepositOf (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen)
+ /// Storage: Balances Holds (r:1 w:1)
+ /// Proof: Balances Holds (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
/// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
/// Proof: CollatorSelection LastAuthoredBlock (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen)
- /// The range of component `c` is `[1, 10]`.
+ /// The range of component `c` is `[1, 8]`.
fn release_license(c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `306 + c * (61 ±0)`
- // Estimated: `5335`
- // Minimum execution time: 22_214_000 picoseconds.
- Weight::from_parts(24_373_981, 5335)
- // Standard Error: 8_018
- .saturating_add(Weight::from_parts(405_404, 0).saturating_mul(c.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
- .saturating_add(RocksDbWeight::get().writes(3_u64))
+ // Measured: `328 + c * (103 ±0)`
+ // Estimated: `3834`
+ // Minimum execution time: 22_821_000 picoseconds.
+ Weight::from_parts(23_668_202, 3834)
+ // Standard Error: 6_654
+ .saturating_add(Weight::from_parts(844_978, 0).saturating_mul(c.into()))
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
+ .saturating_add(RocksDbWeight::get().writes(4_u64))
}
/// Storage: CollatorSelection Candidates (r:1 w:1)
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: CollatorSelection LicenseDepositOf (r:1 w:1)
/// Proof: CollatorSelection LicenseDepositOf (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen)
+ /// Storage: Balances Holds (r:1 w:1)
+ /// Proof: Balances Holds (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
/// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
/// Proof: CollatorSelection LastAuthoredBlock (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen)
- /// The range of component `c` is `[1, 10]`.
+ /// The range of component `c` is `[1, 8]`.
fn force_release_license(c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `306 + c * (61 ±0)`
- // Estimated: `5335`
- // Minimum execution time: 22_159_000 picoseconds.
- Weight::from_parts(24_200_796, 5335)
- // Standard Error: 8_328
- .saturating_add(Weight::from_parts(312_138, 0).saturating_mul(c.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
- .saturating_add(RocksDbWeight::get().writes(3_u64))
+ // Measured: `328 + c * (103 ±0)`
+ // Estimated: `3834`
+ // Minimum execution time: 22_462_000 picoseconds.
+ Weight::from_parts(23_215_875, 3834)
+ // Standard Error: 6_450
+ .saturating_add(Weight::from_parts(830_887, 0).saturating_mul(c.into()))
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
+ .saturating_add(RocksDbWeight::get().writes(4_u64))
}
/// Storage: System Account (r:2 w:2)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
@@ -362,9 +376,9 @@
fn note_author() -> Weight {
// Proof Size summary in bytes:
// Measured: `155`
- // Estimated: `7729`
- // Minimum execution time: 16_520_000 picoseconds.
- Weight::from_parts(16_933_000, 7729)
+ // Estimated: `6196`
+ // Minimum execution time: 17_624_000 picoseconds.
+ Weight::from_parts(18_025_000, 6196)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -372,32 +386,34 @@
/// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: Configuration CollatorSelectionKickThresholdOverride (r:1 w:0)
/// Proof: Configuration CollatorSelectionKickThresholdOverride (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
- /// Storage: CollatorSelection LastAuthoredBlock (r:10 w:0)
+ /// Storage: CollatorSelection LastAuthoredBlock (r:8 w:0)
/// Proof: CollatorSelection LastAuthoredBlock (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen)
/// Storage: CollatorSelection Invulnerables (r:1 w:0)
/// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(321), added: 816, mode: MaxEncodedLen)
/// Storage: System BlockWeight (r:1 w:1)
/// Proof: System BlockWeight (max_values: Some(1), max_size: Some(48), added: 543, mode: MaxEncodedLen)
- /// Storage: CollatorSelection LicenseDepositOf (r:9 w:9)
+ /// Storage: CollatorSelection LicenseDepositOf (r:7 w:7)
/// Proof: CollatorSelection LicenseDepositOf (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen)
- /// Storage: System Account (r:10 w:10)
+ /// Storage: Balances Holds (r:7 w:7)
+ /// Proof: Balances Holds (max_values: None, max_size: Some(369), added: 2844, mode: MaxEncodedLen)
+ /// Storage: System Account (r:8 w:8)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
- /// The range of component `r` is `[1, 10]`.
- /// The range of component `c` is `[1, 10]`.
+ /// The range of component `r` is `[1, 8]`.
+ /// The range of component `c` is `[1, 8]`.
fn new_session(r: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `562 + r * (190 ±0) + c * (83 ±0)`
- // Estimated: `91818518943723 + c * (2519 ±0) + r * (5142 ±1)`
- // Minimum execution time: 16_153_000 picoseconds.
- Weight::from_parts(16_601_000, 91818518943723)
- // Standard Error: 119_095
- .saturating_add(Weight::from_parts(10_660_813, 0).saturating_mul(c.into()))
+ // Measured: `725 + c * (84 ±0) + r * (254 ±0)`
+ // Estimated: `6196 + c * (2519 ±0) + r * (2844 ±0)`
+ // Minimum execution time: 11_318_000 picoseconds.
+ Weight::from_parts(11_615_000, 6196)
+ // Standard Error: 69_557
+ .saturating_add(Weight::from_parts(13_016_275, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c.into())))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into()))
- .saturating_add(Weight::from_parts(0, 5142).saturating_mul(r.into()))
+ .saturating_add(Weight::from_parts(0, 2844).saturating_mul(r.into()))
}
}
pallets/common/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -22,8 +22,9 @@
use frame_benchmarking::{benchmarks, account};
use up_data_structs::{
CollectionMode, CreateCollectionData, CollectionId, Property, PropertyKey, PropertyValue,
- CollectionPermissions, NestingPermissions, AccessMode, MAX_COLLECTION_NAME_LENGTH,
- MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, MAX_PROPERTIES_PER_ITEM,
+ CollectionPermissions, NestingPermissions, AccessMode, PropertiesPermissionMap,
+ MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
+ MAX_PROPERTIES_PER_ITEM,
};
use frame_support::{
traits::{Get, fungible::Balanced, Imbalance, tokens::Precision},
@@ -123,6 +124,16 @@
)
}
+pub fn load_is_admin_and_property_permissions<T: Config>(
+ collection: &CollectionHandle<T>,
+ sender: &T::CrossAccountId,
+) -> (bool, PropertiesPermissionMap) {
+ (
+ collection.is_owner_or_admin(sender),
+ <Pallet<T>>::property_permissions(collection.id),
+ )
+}
+
/// Helper macros, which handles all benchmarking preparation in semi-declarative way
///
/// `name` is a substrate account
@@ -215,4 +226,12 @@
assert_eq!(collection_handle.permissions.access(), AccessMode::AllowList);
}: {collection_handle.check_allowlist(&sender)?;}
+
+ init_token_properties_common {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ sender: sub;
+ sender: cross_from_sub(sender);
+ };
+ }: {load_is_admin_and_property_permissions(&collection, &sender);}
}
pallets/common/src/lib.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! # Common pallet18//!19//! The Common pallet provides functionality for handling collections.20//!21//! ## Overview22//!23//! The Common pallet provides an interface for common collection operations for different collection types24//! (see [CommonCollectionOperations]), as well as a generic dispatcher for these, see [dispatch] module.25//! It also provides this functionality to EVM, see [erc] and [eth] modules.26//!27//! The Common pallet provides functions for:28//!29//! - Setting and approving collection sponsor.30//! - Get\set\delete allow list.31//! - Get\set\delete collection properties.32//! - Get\set\delete collection property permissions.33//! - Get\set\delete token property permissions.34//! - Get\set\delete collection administrators.35//! - Checking access permissions.36//!37//! ### Terminology38//! **Collection sponsor** - For the collection, you can set a sponsor, at whose expense it will39//! be possible to mint tokens.40//!41//! **Allow list** - List of users who have the right to minting tokens.42//!43//! **Collection properties** - Collection properties are simply key-value stores where various44//! metadata can be placed.45//!46//! **Permissions on token properties** - For each property in the token can be set permission47//! to change, see [`PropertyPermission`].48//!49//! **Collection administrator** - For a collection, you can set administrators who have the right50//! to most actions on the collection.5152#![warn(missing_docs)]53#![cfg_attr(not(feature = "std"), no_std)]54extern crate alloc;5556use core::{57 ops::{Deref, DerefMut},58 slice::from_ref,59};60use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};61use sp_std::vec::Vec;62use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};63use evm_coder::ToLog;64use frame_support::{65 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Weight, PostDispatchInfo},66 ensure,67 traits::{68 Get,69 fungible::{Balanced, Debt, Inspect},70 tokens::{Imbalance, Precision, Preservation},71 },72 dispatch::Pays,73 transactional, fail,74};75use up_data_structs::{76 AccessMode, COLLECTION_NUMBER_LIMIT, Collection, RpcCollection, RpcCollectionFlags,77 CollectionId, CreateItemData, MAX_TOKEN_PREFIX_LENGTH, COLLECTION_ADMINS_LIMIT, TokenId,78 TokenChild, CollectionStats, MAX_TOKEN_OWNERSHIP, CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT,79 FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT,80 CUSTOM_DATA_LIMIT, CollectionLimits, CreateCollectionData, SponsorshipState, CreateItemExData,81 SponsoringRateLimit, budget::Budget, PhantomType, Property,82 CollectionProperties as CollectionPropertiesT, TokenProperties, PropertiesPermissionMap,83 PropertyKey, PropertyValue, PropertyPermission, PropertiesError, TokenOwnerError,84 PropertyKeyPermission, TokenData, TrySetProperty, PropertyScope, CollectionPermissions,85};86use up_pov_estimate_rpc::PovInfo;8788pub use pallet::*;89use sp_core::H160;90use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, traits::Zero};9192#[cfg(feature = "runtime-benchmarks")]93pub mod benchmarking;94pub mod dispatch;95pub mod erc;96pub mod eth;97pub mod helpers;98#[allow(missing_docs)]99pub mod weights;100/// Weight info.101pub type SelfWeightOf<T> = <T as Config>::WeightInfo;102103/// Collection handle contains information about collection data and id.104/// Also provides functionality to count consumed gas.105///106/// CollectionHandle is used as a generic wrapper for collections of all types (except native fungible).107/// It allows to perform common operations and queries on any collection type,108/// both completely general for all, as well as their respective implementations of [`CommonCollectionOperations`].109#[must_use = "Should call submit_logs or save, otherwise some data will be lost for evm side"]110pub struct CollectionHandle<T: Config> {111 /// Collection id112 pub id: CollectionId,113 collection: Collection<T::AccountId>,114 /// Substrate recorder for counting consumed gas115 pub recorder: SubstrateRecorder<T>,116}117118impl<T: Config> WithRecorder<T> for CollectionHandle<T> {119 fn recorder(&self) -> &SubstrateRecorder<T> {120 &self.recorder121 }122 fn into_recorder(self) -> SubstrateRecorder<T> {123 self.recorder124 }125}126127impl<T: Config> CollectionHandle<T> {128 /// Same as [CollectionHandle::new] but with an explicit gas limit.129 pub fn new_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {130 Self::new_with_recorder(id, SubstrateRecorder::new(gas_limit))131 }132133 /// Same as [CollectionHandle::new] but with an existed [`SubstrateRecorder`].134 pub fn new_with_recorder(id: CollectionId, recorder: SubstrateRecorder<T>) -> Option<Self> {135 <CollectionById<T>>::get(id).map(|collection| Self {136 id,137 collection,138 recorder,139 })140 }141142 /// Retrives collection data from storage and creates collection handle with default parameters.143 /// If collection not found return `None`144 pub fn new(id: CollectionId) -> Option<Self> {145 Self::new_with_gas_limit(id, u64::MAX)146 }147148 /// Same as [`CollectionHandle::new`] but if collection not found [CollectionNotFound](Error::CollectionNotFound) returned.149 pub fn try_get(id: CollectionId) -> Result<Self, DispatchError> {150 Ok(Self::new(id).ok_or(<Error<T>>::CollectionNotFound)?)151 }152153 /// Consume gas for reading.154 pub fn consume_store_reads(155 &self,156 reads: u64,157 ) -> pallet_evm_coder_substrate::execution::Result<()> {158 self.recorder().consume_store_reads(reads)159 }160161 /// Consume gas for writing.162 pub fn consume_store_writes(163 &self,164 writes: u64,165 ) -> pallet_evm_coder_substrate::execution::Result<()> {166 self.recorder().consume_store_writes(writes)167 }168169 /// Consume gas for reading and writing.170 pub fn consume_store_reads_and_writes(171 &self,172 reads: u64,173 writes: u64,174 ) -> pallet_evm_coder_substrate::execution::Result<()> {175 self.recorder()176 .consume_store_reads_and_writes(reads, writes)177 }178179 /// Save collection to storage.180 pub fn save(&self) -> DispatchResult {181 <CollectionById<T>>::insert(self.id, &self.collection);182 Ok(())183 }184185 /// Set collection sponsor.186 ///187 /// Unique collections allows sponsoring for certain actions.188 /// This method allows you to set the sponsor of the collection.189 /// In order for sponsorship to become active, it must be confirmed through [`Self::confirm_sponsorship`].190 pub fn set_sponsor(191 &mut self,192 sender: &T::CrossAccountId,193 sponsor: T::AccountId,194 ) -> DispatchResult {195 self.check_is_internal()?;196 self.check_is_owner_or_admin(sender)?;197198 self.collection.sponsorship = SponsorshipState::Unconfirmed(sponsor.clone());199200 <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(self.id, sponsor));201 <PalletEvm<T>>::deposit_log(202 erc::CollectionHelpersEvents::CollectionChanged {203 collection_id: eth::collection_id_to_address(self.id),204 }205 .to_log(T::ContractAddress::get()),206 );207208 self.save()209 }210211 /// Force set `sponsor`.212 ///213 /// Differs from [`set_sponsor`][`Self::set_sponsor`] in that confirmation214 /// from the `sponsor` is not required.215 ///216 /// # Arguments217 ///218 /// * `sponsor`: ID of the account of the sponsor-to-be.219 pub fn force_set_sponsor(&mut self, sponsor: T::AccountId) -> DispatchResult {220 self.check_is_internal()?;221222 self.collection.sponsorship = SponsorshipState::Confirmed(sponsor.clone());223224 <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(self.id, sponsor.clone()));225 <Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(self.id, sponsor));226 <PalletEvm<T>>::deposit_log(227 erc::CollectionHelpersEvents::CollectionChanged {228 collection_id: eth::collection_id_to_address(self.id),229 }230 .to_log(T::ContractAddress::get()),231 );232233 self.save()234 }235236 /// Confirm sponsorship237 ///238 /// In order for the sponsorship to become active, the user set as the sponsor must confirm their participation.239 /// Before confirming sponsorship, the user must be specified as the sponsor of the collection via [`Self::set_sponsor`].240 pub fn confirm_sponsorship(&mut self, sender: &T::AccountId) -> DispatchResult {241 self.check_is_internal()?;242 ensure!(243 self.collection.sponsorship.pending_sponsor() == Some(sender),244 Error::<T>::ConfirmSponsorshipFail245 );246247 self.collection.sponsorship = SponsorshipState::Confirmed(sender.clone());248249 <Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(self.id, sender.clone()));250 <PalletEvm<T>>::deposit_log(251 erc::CollectionHelpersEvents::CollectionChanged {252 collection_id: eth::collection_id_to_address(self.id),253 }254 .to_log(T::ContractAddress::get()),255 );256257 self.save()258 }259260 /// Remove collection sponsor.261 pub fn remove_sponsor(&mut self, sender: &T::CrossAccountId) -> DispatchResult {262 self.check_is_internal()?;263 self.check_is_owner_or_admin(sender)?;264265 self.collection.sponsorship = SponsorshipState::Disabled;266267 <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorRemoved(self.id));268 <PalletEvm<T>>::deposit_log(269 erc::CollectionHelpersEvents::CollectionChanged {270 collection_id: eth::collection_id_to_address(self.id),271 }272 .to_log(T::ContractAddress::get()),273 );274 self.save()275 }276277 /// Force remove `sponsor`.278 ///279 /// Differs from `remove_sponsor` in that280 /// it doesn't require consent from the `owner` of the collection.281 pub fn force_remove_sponsor(&mut self) -> DispatchResult {282 self.check_is_internal()?;283284 self.collection.sponsorship = SponsorshipState::Disabled;285286 <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorRemoved(self.id));287 <PalletEvm<T>>::deposit_log(288 erc::CollectionHelpersEvents::CollectionChanged {289 collection_id: eth::collection_id_to_address(self.id),290 }291 .to_log(T::ContractAddress::get()),292 );293 self.save()294 }295296 /// Checks that the collection was created with, and must be operated upon through **Unique API**.297 /// Now check only the `external` flag and if it's **true**, then return [`Error::CollectionIsExternal`] error.298 pub fn check_is_internal(&self) -> DispatchResult {299 if self.flags.external {300 return Err(<Error<T>>::CollectionIsExternal)?;301 }302303 Ok(())304 }305306 /// Checks that the collection was created with, and must be operated upon through an **assimilated API**.307 /// Now check only the `external` flag and if it's **false**, then return [`Error::CollectionIsInternal`] error.308 pub fn check_is_external(&self) -> DispatchResult {309 if !self.flags.external {310 return Err(<Error<T>>::CollectionIsInternal)?;311 }312313 Ok(())314 }315}316317impl<T: Config> Deref for CollectionHandle<T> {318 type Target = Collection<T::AccountId>;319320 fn deref(&self) -> &Self::Target {321 &self.collection322 }323}324325impl<T: Config> DerefMut for CollectionHandle<T> {326 fn deref_mut(&mut self) -> &mut Self::Target {327 &mut self.collection328 }329}330331impl<T: Config> CollectionHandle<T> {332 /// Checks if the `user` is the owner of the collection.333 pub fn check_is_owner(&self, user: &T::CrossAccountId) -> DispatchResult {334 ensure!(*user.as_sub() == self.owner, <Error<T>>::NoPermission);335 Ok(())336 }337338 /// Returns **true** if the `user` is the owner or administrator of the collection.339 pub fn is_owner_or_admin(&self, user: &T::CrossAccountId) -> bool {340 *user.as_sub() == self.owner || <IsAdmin<T>>::get((self.id, user))341 }342343 /// Checks if the `user` is the owner or administrator of the collection.344 pub fn check_is_owner_or_admin(&self, user: &T::CrossAccountId) -> DispatchResult {345 ensure!(self.is_owner_or_admin(user), <Error<T>>::NoPermission);346 Ok(())347 }348349 /// Returns **true** if350 /// * the `user`is a collection owner or admin351 /// * the collection limits allow the owner/admins to transfer/burn any collection token352 pub fn ignores_token_restrictions(&self, user: &T::CrossAccountId) -> bool {353 self.limits.owner_can_transfer() && self.is_owner_or_admin(user)354 }355356 /// Return **true** if `user` does not have enough token parts, and he can ignore such restrictions.357 pub fn ignores_owned_amount(&self, user: &T::CrossAccountId) -> bool {358 self.limits.owner_can_transfer() && self.is_owner_or_admin(user)359 }360361 /// Checks if the user is in the allow list. If not [Error::AddressNotInAllowlist] returns.362 pub fn check_allowlist(&self, user: &T::CrossAccountId) -> DispatchResult {363 ensure!(364 <Allowlist<T>>::get((self.id, user)),365 <Error<T>>::AddressNotInAllowlist366 );367 Ok(())368 }369370 /// Changes collection owner to another account371 /// #### Store read/writes372 /// 1 writes373 pub fn change_owner(374 &mut self,375 caller: T::CrossAccountId,376 new_owner: T::CrossAccountId,377 ) -> DispatchResult {378 self.check_is_internal()?;379 self.check_is_owner(&caller)?;380 self.collection.owner = new_owner.as_sub().clone();381382 <Pallet<T>>::deposit_event(Event::<T>::CollectionOwnerChanged(383 self.id,384 new_owner.as_sub().clone(),385 ));386 <PalletEvm<T>>::deposit_log(387 erc::CollectionHelpersEvents::CollectionChanged {388 collection_id: eth::collection_id_to_address(self.id),389 }390 .to_log(T::ContractAddress::get()),391 );392393 self.save()394 }395}396397#[frame_support::pallet]398pub mod pallet {399400 use super::*;401 use dispatch::CollectionDispatch;402 use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key, traits::StorageVersion};403 use up_data_structs::{TokenId, mapping::TokenAddressMapping};404 use scale_info::TypeInfo;405 use weights::WeightInfo;406407 #[pallet::config]408 pub trait Config:409 frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::Config + TypeInfo410 {411 /// Weight information for functions of this pallet.412 type WeightInfo: WeightInfo;413414 /// Events compatible with [`frame_system::Config::Event`].415 type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;416417 /// Handler of accounts and payment.418 type Currency: Balanced<Self::AccountId> + Inspect<Self::AccountId>;419420 /// Set price to create a collection.421 #[pallet::constant]422 type CollectionCreationPrice: Get<423 <<Self as Config>::Currency as Inspect<Self::AccountId>>::Balance,424 >;425426 /// Dispatcher of operations on collections.427 type CollectionDispatch: CollectionDispatch<Self>;428429 /// Account which holds the chain's treasury.430 type TreasuryAccountId: Get<Self::AccountId>;431432 /// Address under which the CollectionHelper contract would be available.433 #[pallet::constant]434 type ContractAddress: Get<H160>;435436 /// Mapper for token addresses to Ethereum addresses.437 type EvmTokenAddressMapping: TokenAddressMapping<H160>;438439 /// Mapper for token addresses to [`CrossAccountId`].440 type CrossTokenAddressMapping: TokenAddressMapping<Self::CrossAccountId>;441 }442443 const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);444 /// Collection id for native fungible collction.445 pub const NATIVE_FUNGIBLE_COLLECTION_ID: CollectionId = CollectionId(0);446447 #[pallet::pallet]448 #[pallet::storage_version(STORAGE_VERSION)]449 pub struct Pallet<T>(_);450451 #[pallet::extra_constants]452 impl<T: Config> Pallet<T> {453 /// Maximum admins per collection.454 pub fn collection_admins_limit() -> u32 {455 COLLECTION_ADMINS_LIMIT456 }457 }458459 #[pallet::genesis_config]460 pub struct GenesisConfig<T>(PhantomData<T>);461462 #[cfg(feature = "std")]463 impl<T: Config> Default for GenesisConfig<T> {464 fn default() -> Self {465 Self(Default::default())466 }467 }468469 #[pallet::genesis_build]470 impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {471 fn build(&self) {472 StorageVersion::new(1).put::<Pallet<T>>();473 }474 }475476 impl<T: Config> Pallet<T> {477 /// Helper function that handles deposit events478 pub fn deposit_event(event: Event<T>) {479 let event = <T as Config>::RuntimeEvent::from(event);480 let event = event.into();481 <frame_system::Pallet<T>>::deposit_event(event)482 }483 }484485 #[pallet::event]486 pub enum Event<T: Config> {487 /// New collection was created488 CollectionCreated(489 /// Globally unique identifier of newly created collection.490 CollectionId,491 /// [`CollectionMode`] converted into _u8_.492 u8,493 /// Collection owner.494 T::AccountId,495 ),496497 /// New collection was destroyed498 CollectionDestroyed(499 /// Globally unique identifier of collection.500 CollectionId,501 ),502503 /// New item was created.504 ItemCreated(505 /// Id of the collection where item was created.506 CollectionId,507 /// Id of an item. Unique within the collection.508 TokenId,509 /// Owner of newly created item510 T::CrossAccountId,511 /// Always 1 for NFT512 u128,513 ),514515 /// Collection item was burned.516 ItemDestroyed(517 /// Id of the collection where item was destroyed.518 CollectionId,519 /// Identifier of burned NFT.520 TokenId,521 /// Which user has destroyed its tokens.522 T::CrossAccountId,523 /// Amount of token pieces destroed. Always 1 for NFT.524 u128,525 ),526527 /// Item was transferred528 Transfer(529 /// Id of collection to which item is belong.530 CollectionId,531 /// Id of an item.532 TokenId,533 /// Original owner of item.534 T::CrossAccountId,535 /// New owner of item.536 T::CrossAccountId,537 /// Amount of token pieces transfered. Always 1 for NFT.538 u128,539 ),540541 /// Amount pieces of token owned by `sender` was approved for `spender`.542 Approved(543 /// Id of collection to which item is belong.544 CollectionId,545 /// Id of an item.546 TokenId,547 /// Original owner of item.548 T::CrossAccountId,549 /// Id for which the approval was granted.550 T::CrossAccountId,551 /// Amount of token pieces transfered. Always 1 for NFT.552 u128,553 ),554555 /// A `sender` approves operations on all owned tokens for `spender`.556 ApprovedForAll(557 /// Id of collection to which item is belong.558 CollectionId,559 /// Owner of a wallet.560 T::CrossAccountId,561 /// Id for which operator status was granted or rewoked.562 T::CrossAccountId,563 /// Is operator status granted or revoked?564 bool,565 ),566567 /// The colletion property has been added or edited.568 CollectionPropertySet(569 /// Id of collection to which property has been set.570 CollectionId,571 /// The property that was set.572 PropertyKey,573 ),574575 /// The property has been deleted.576 CollectionPropertyDeleted(577 /// Id of collection to which property has been deleted.578 CollectionId,579 /// The property that was deleted.580 PropertyKey,581 ),582583 /// The token property has been added or edited.584 TokenPropertySet(585 /// Identifier of the collection whose token has the property set.586 CollectionId,587 /// The token for which the property was set.588 TokenId,589 /// The property that was set.590 PropertyKey,591 ),592593 /// The token property has been deleted.594 TokenPropertyDeleted(595 /// Identifier of the collection whose token has the property deleted.596 CollectionId,597 /// The token for which the property was deleted.598 TokenId,599 /// The property that was deleted.600 PropertyKey,601 ),602603 /// The token property permission of a collection has been set.604 PropertyPermissionSet(605 /// ID of collection to which property permission has been set.606 CollectionId,607 /// The property permission that was set.608 PropertyKey,609 ),610611 /// Address was added to the allow list.612 AllowListAddressAdded(613 /// ID of the affected collection.614 CollectionId,615 /// Address of the added account.616 T::CrossAccountId,617 ),618619 /// Address was removed from the allow list.620 AllowListAddressRemoved(621 /// ID of the affected collection.622 CollectionId,623 /// Address of the removed account.624 T::CrossAccountId,625 ),626627 /// Collection admin was added.628 CollectionAdminAdded(629 /// ID of the affected collection.630 CollectionId,631 /// Admin address.632 T::CrossAccountId,633 ),634635 /// Collection admin was removed.636 CollectionAdminRemoved(637 /// ID of the affected collection.638 CollectionId,639 /// Removed admin address.640 T::CrossAccountId,641 ),642643 /// Collection limits were set.644 CollectionLimitSet(645 /// ID of the affected collection.646 CollectionId,647 ),648649 /// Collection owned was changed.650 CollectionOwnerChanged(651 /// ID of the affected collection.652 CollectionId,653 /// New owner address.654 T::AccountId,655 ),656657 /// Collection permissions were set.658 CollectionPermissionSet(659 /// ID of the affected collection.660 CollectionId,661 ),662663 /// Collection sponsor was set.664 CollectionSponsorSet(665 /// ID of the affected collection.666 CollectionId,667 /// New sponsor address.668 T::AccountId,669 ),670671 /// New sponsor was confirm.672 SponsorshipConfirmed(673 /// ID of the affected collection.674 CollectionId,675 /// New sponsor address.676 T::AccountId,677 ),678679 /// Collection sponsor was removed.680 CollectionSponsorRemoved(681 /// ID of the affected collection.682 CollectionId,683 ),684 }685686 #[pallet::error]687 pub enum Error<T> {688 /// This collection does not exist.689 CollectionNotFound,690 /// Sender parameter and item owner must be equal.691 MustBeTokenOwner,692 /// No permission to perform action693 NoPermission,694 /// Destroying only empty collections is allowed695 CantDestroyNotEmptyCollection,696 /// Collection is not in mint mode.697 PublicMintingNotAllowed,698 /// Address is not in allow list.699 AddressNotInAllowlist,700701 /// Collection name can not be longer than 63 char.702 CollectionNameLimitExceeded,703 /// Collection description can not be longer than 255 char.704 CollectionDescriptionLimitExceeded,705 /// Token prefix can not be longer than 15 char.706 CollectionTokenPrefixLimitExceeded,707 /// Total collections bound exceeded.708 TotalCollectionsLimitExceeded,709 /// Exceeded max admin count710 CollectionAdminCountExceeded,711 /// Collection limit bounds per collection exceeded712 CollectionLimitBoundsExceeded,713 /// Tried to enable permissions which are only permitted to be disabled714 OwnerPermissionsCantBeReverted,715 /// Collection settings not allowing items transferring716 TransferNotAllowed,717 /// Account token limit exceeded per collection718 AccountTokenLimitExceeded,719 /// Collection token limit exceeded720 CollectionTokenLimitExceeded,721 /// Metadata flag frozen722 MetadataFlagFrozen,723724 /// Item does not exist725 TokenNotFound,726 /// Item is balance not enough727 TokenValueTooLow,728 /// Requested value is more than the approved729 ApprovedValueTooLow,730 /// Tried to approve more than owned731 CantApproveMoreThanOwned,732 /// Only spending from eth mirror could be approved733 AddressIsNotEthMirror,734735 /// Can't transfer tokens to ethereum zero address736 AddressIsZero,737738 /// The operation is not supported739 UnsupportedOperation,740741 /// Insufficient funds to perform an action742 NotSufficientFounds,743744 /// User does not satisfy the nesting rule745 UserIsNotAllowedToNest,746 /// Only tokens from specific collections may nest tokens under this one747 SourceCollectionIsNotAllowedToNest,748749 /// Tried to store more data than allowed in collection field750 CollectionFieldSizeExceeded,751752 /// Tried to store more property data than allowed753 NoSpaceForProperty,754755 /// Tried to store more property keys than allowed756 PropertyLimitReached,757758 /// Property key is too long759 PropertyKeyIsTooLong,760761 /// Only ASCII letters, digits, and symbols `_`, `-`, and `.` are allowed762 InvalidCharacterInPropertyKey,763764 /// Empty property keys are forbidden765 EmptyPropertyKey,766767 /// Tried to access an external collection with an internal API768 CollectionIsExternal,769770 /// Tried to access an internal collection with an external API771 CollectionIsInternal,772773 /// This address is not set as sponsor, use setCollectionSponsor first.774 ConfirmSponsorshipFail,775776 /// The user is not an administrator.777 UserIsNotCollectionAdmin,778 }779780 /// Storage of the count of created collections. Essentially contains the last collection ID.781 #[pallet::storage]782 pub type CreatedCollectionCount<T> = StorageValue<Value = CollectionId, QueryKind = ValueQuery>;783784 /// Storage of the count of deleted collections.785 #[pallet::storage]786 pub type DestroyedCollectionCount<T> =787 StorageValue<Value = CollectionId, QueryKind = ValueQuery>;788789 /// Storage of collection info.790 #[pallet::storage]791 pub type CollectionById<T> = StorageMap<792 Hasher = Blake2_128Concat,793 Key = CollectionId,794 Value = Collection<<T as frame_system::Config>::AccountId>,795 QueryKind = OptionQuery,796 >;797798 /// Storage of collection properties.799 #[pallet::storage]800 #[pallet::getter(fn collection_properties)]801 pub type CollectionProperties<T> = StorageMap<802 Hasher = Blake2_128Concat,803 Key = CollectionId,804 Value = CollectionPropertiesT,805 QueryKind = ValueQuery,806 >;807808 /// Storage of token property permissions of a collection.809 #[pallet::storage]810 #[pallet::getter(fn property_permissions)]811 pub type CollectionPropertyPermissions<T> = StorageMap<812 Hasher = Blake2_128Concat,813 Key = CollectionId,814 Value = PropertiesPermissionMap,815 QueryKind = ValueQuery,816 >;817818 /// Storage of the amount of collection admins.819 #[pallet::storage]820 pub type AdminAmount<T> = StorageMap<821 Hasher = Blake2_128Concat,822 Key = CollectionId,823 Value = u32,824 QueryKind = ValueQuery,825 >;826827 /// List of collection admins.828 #[pallet::storage]829 pub type IsAdmin<T: Config> = StorageNMap<830 Key = (831 Key<Blake2_128Concat, CollectionId>,832 Key<Blake2_128Concat, T::CrossAccountId>,833 ),834 Value = bool,835 QueryKind = ValueQuery,836 >;837838 /// Allowlisted collection users.839 #[pallet::storage]840 pub type Allowlist<T: Config> = StorageNMap<841 Key = (842 Key<Blake2_128Concat, CollectionId>,843 Key<Blake2_128Concat, T::CrossAccountId>,844 ),845 Value = bool,846 QueryKind = ValueQuery,847 >;848849 /// Not used by code, exists only to provide some types to metadata.850 #[pallet::storage]851 pub type DummyStorageValue<T: Config> = StorageValue<852 Value = (853 CollectionStats,854 CollectionId,855 TokenId,856 TokenChild,857 PhantomType<(858 TokenData<T::CrossAccountId>,859 RpcCollection<T::AccountId>,860 // PoV Estimate Info861 PovInfo,862 )>,863 ),864 QueryKind = OptionQuery,865 >;866}867868/// Represents the change mode for the token property.869pub enum SetPropertyMode {870 /// The token already exists.871 ExistingToken,872873 /// New token.874 NewToken {875 /// The creator of the token is the recipient.876 mint_target_is_sender: bool,877 },878}879880/// Value representation with delayed initialization time.881pub struct LazyValue<T, F: FnOnce() -> T> {882 value: Option<T>,883 f: Option<F>,884}885886impl<T, F: FnOnce() -> T> LazyValue<T, F> {887 /// Create a new LazyValue.888 pub fn new(f: F) -> Self {889 Self {890 value: None,891 f: Some(f),892 }893 }894895 /// Get the value. If it call furst time the value will be initialized.896 pub fn value(&mut self) -> &T {897 if self.value.is_none() {898 self.value = Some(self.f.take().unwrap()())899 }900901 self.value.as_ref().unwrap()902 }903904 /// Is value initialized.905 pub fn has_value(&self) -> bool {906 self.value.is_some()907 }908}909910fn check_token_permissions<T, FCA, FTO, FTE>(911 collection_admin_permitted: bool,912 token_owner_permitted: bool,913 is_collection_admin: &mut LazyValue<bool, FCA>,914 is_token_owner: &mut LazyValue<Result<bool, DispatchError>, FTO>,915 is_token_exist: &mut LazyValue<bool, FTE>,916) -> DispatchResult917where918 T: Config,919 FCA: FnOnce() -> bool,920 FTO: FnOnce() -> Result<bool, DispatchError>,921 FTE: FnOnce() -> bool,922{923 if !(collection_admin_permitted && *is_collection_admin.value()924 || token_owner_permitted && (*is_token_owner.value())?)925 {926 fail!(<Error<T>>::NoPermission);927 }928929 let token_certainly_exist = is_token_owner.has_value() && (*is_token_owner.value())?;930 if !token_certainly_exist && !is_token_exist.value() {931 fail!(<Error<T>>::TokenNotFound);932 }933 Ok(())934}935936impl<T: Config> Pallet<T> {937 /// Enshure that receiver address is correct.938 ///939 /// Ethereum receiver 0x0000000000000000000000000000000000000000 is reserved, and shouldn't own tokens.940 pub fn ensure_correct_receiver(receiver: &T::CrossAccountId) -> DispatchResult {941 ensure!(942 &T::CrossAccountId::from_eth(H160([0; 20])) != receiver,943 <Error<T>>::AddressIsZero944 );945 Ok(())946 }947948 /// Get a vector of collection admins.949 pub fn adminlist(collection: CollectionId) -> Vec<T::CrossAccountId> {950 <IsAdmin<T>>::iter_prefix((collection,))951 .map(|(a, _)| a)952 .collect()953 }954955 /// Get a vector of users allowed to mint tokens.956 pub fn allowlist(collection: CollectionId) -> Vec<T::CrossAccountId> {957 <Allowlist<T>>::iter_prefix((collection,))958 .map(|(a, _)| a)959 .collect()960 }961962 /// Is `user` allowed to mint token in `collection`.963 pub fn allowed(collection: CollectionId, user: T::CrossAccountId) -> bool {964 <Allowlist<T>>::get((collection, user))965 }966967 /// Get statistics of collections.968 pub fn collection_stats() -> CollectionStats {969 let created = <CreatedCollectionCount<T>>::get();970 let destroyed = <DestroyedCollectionCount<T>>::get();971 CollectionStats {972 created: created.0,973 destroyed: destroyed.0,974 alive: created.0 - destroyed.0,975 }976 }977978 /// Get the effective limits for the collection.979 pub fn effective_collection_limits(collection: CollectionId) -> Option<CollectionLimits> {980 let collection = <CollectionById<T>>::get(collection)?;981 let limits = collection.limits;982 let effective_limits = CollectionLimits {983 account_token_ownership_limit: Some(limits.account_token_ownership_limit()),984 sponsored_data_size: Some(limits.sponsored_data_size()),985 sponsored_data_rate_limit: Some(986 limits987 .sponsored_data_rate_limit988 .unwrap_or(SponsoringRateLimit::SponsoringDisabled),989 ),990 token_limit: Some(limits.token_limit()),991 sponsor_transfer_timeout: Some(limits.sponsor_transfer_timeout(992 match collection.mode {993 CollectionMode::NFT => NFT_SPONSOR_TRANSFER_TIMEOUT,994 CollectionMode::Fungible(_) => FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,995 CollectionMode::ReFungible => REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,996 },997 )),998 sponsor_approve_timeout: Some(limits.sponsor_approve_timeout()),999 owner_can_transfer: Some(limits.owner_can_transfer()),1000 owner_can_destroy: Some(limits.owner_can_destroy()),1001 transfers_enabled: Some(limits.transfers_enabled()),1002 };10031004 Some(effective_limits)1005 }10061007 /// Returns information about the `collection` adapted for rpc.1008 pub fn rpc_collection(collection: CollectionId) -> Option<RpcCollection<T::AccountId>> {1009 let Collection {1010 name,1011 description,1012 owner,1013 mode,1014 token_prefix,1015 sponsorship,1016 limits,1017 permissions,1018 flags,1019 } = <CollectionById<T>>::get(collection)?;10201021 let token_property_permissions = <CollectionPropertyPermissions<T>>::get(collection)1022 .into_iter()1023 .map(|(key, permission)| PropertyKeyPermission { key, permission })1024 .collect();10251026 let properties = <CollectionProperties<T>>::get(collection)1027 .into_iter()1028 .map(|(key, value)| Property { key, value })1029 .collect();10301031 let permissions = CollectionPermissions {1032 access: Some(permissions.access()),1033 mint_mode: Some(permissions.mint_mode()),1034 nesting: Some(permissions.nesting().clone()),1035 };10361037 Some(RpcCollection {1038 name: name.into_inner(),1039 description: description.into_inner(),1040 owner,1041 mode,1042 token_prefix: token_prefix.into_inner(),1043 sponsorship,1044 limits,1045 permissions,1046 token_property_permissions,1047 properties,1048 read_only: flags.external,10491050 flags: RpcCollectionFlags {1051 foreign: flags.foreign,1052 erc721metadata: flags.erc721metadata,1053 },1054 })1055 }1056}10571058macro_rules! limit_default {1059 ($old:ident, $new:ident, $($field:ident $(($arg:expr))? => $check:expr),* $(,)?) => {{1060 $(1061 if let Some($new) = $new.$field {1062 let $old = $old.$field($($arg)?);1063 let _ = $new;1064 let _ = $old;1065 $check1066 } else {1067 $new.$field = $old.$field1068 }1069 )*1070 }};1071}1072macro_rules! limit_default_clone {1073 ($old:ident, $new:ident, $($field:ident $(($arg:expr))? => $check:expr),* $(,)?) => {{1074 $(1075 if let Some($new) = $new.$field.clone() {1076 let $old = $old.$field($($arg)?);1077 let _ = $new;1078 let _ = $old;1079 $check1080 } else {1081 $new.$field = $old.$field.clone()1082 }1083 )*1084 }};1085}10861087impl<T: Config> Pallet<T> {1088 /// Create new collection.1089 ///1090 /// * `owner` - The owner of the collection.1091 /// * `data` - Description of the created collection.1092 /// * `flags` - Extra flags to store.1093 pub fn init_collection(1094 owner: T::CrossAccountId,1095 payer: T::CrossAccountId,1096 data: CreateCollectionData<T::CrossAccountId>,1097 ) -> Result<CollectionId, DispatchError> {1098 ensure!(data.flags.is_allowed_for_user(), <Error<T>>::NoPermission);1099 Self::init_collection_internal(owner, payer, data)1100 }11011102 /// Initializes the collection with ForeignCollection flag. Returns [CollectionId] on success, [DispatchError] otherwise.1103 pub fn init_foreign_collection(1104 owner: T::CrossAccountId,1105 payer: T::CrossAccountId,1106 mut data: CreateCollectionData<T::CrossAccountId>,1107 ) -> Result<CollectionId, DispatchError> {1108 data.flags.foreign = true;1109 let id = Self::init_collection_internal(owner, payer, data)?;1110 Ok(id)1111 }11121113 fn init_collection_internal(1114 owner: T::CrossAccountId,1115 payer: T::CrossAccountId,1116 data: CreateCollectionData<T::CrossAccountId>,1117 ) -> Result<CollectionId, DispatchError> {1118 {1119 ensure!(1120 data.token_prefix.len() <= MAX_TOKEN_PREFIX_LENGTH as usize,1121 Error::<T>::CollectionTokenPrefixLimitExceeded1122 );1123 }11241125 let created_count = <CreatedCollectionCount<T>>::get()1126 .01127 .checked_add(1)1128 .ok_or(ArithmeticError::Overflow)?;1129 let destroyed_count = <DestroyedCollectionCount<T>>::get().0;1130 let id = CollectionId(created_count);11311132 // bound Total number of collections1133 ensure!(1134 created_count - destroyed_count <= COLLECTION_NUMBER_LIMIT,1135 <Error<T>>::TotalCollectionsLimitExceeded1136 );11371138 // =========11391140 let collection = Collection {1141 owner: owner.as_sub().clone(),1142 name: data.name,1143 mode: data.mode.clone(),1144 description: data.description,1145 token_prefix: data.token_prefix,1146 sponsorship: data1147 .pending_sponsor1148 .map(|sponsor| SponsorshipState::Unconfirmed(sponsor.as_sub().clone()))1149 .unwrap_or_default(),1150 limits: data1151 .limits1152 .map(|limits| Self::clamp_limits(data.mode.clone(), &Default::default(), limits))1153 .unwrap_or_else(|| Ok(CollectionLimits::default()))?,1154 permissions: data1155 .permissions1156 .map(|permissions| {1157 Self::clamp_permissions(data.mode.clone(), &Default::default(), permissions)1158 })1159 .unwrap_or_else(|| Ok(CollectionPermissions::default()))?,1160 flags: data.flags,1161 };11621163 let mut collection_properties = CollectionPropertiesT::new();1164 collection_properties1165 .try_set_from_iter(data.properties.into_iter())1166 .map_err(<Error<T>>::from)?;11671168 CollectionProperties::<T>::insert(id, collection_properties);11691170 let mut token_props_permissions = PropertiesPermissionMap::new();1171 token_props_permissions1172 .try_set_from_iter(data.token_property_permissions.into_iter())1173 .map_err(<Error<T>>::from)?;11741175 CollectionPropertyPermissions::<T>::insert(id, token_props_permissions);11761177 let mut admin_amount = 0u32;1178 for admin in data.admin_list.iter() {1179 if !<IsAdmin<T>>::get((id, admin)) {1180 <IsAdmin<T>>::insert((id, admin), true);1181 admin_amount = admin_amount1182 .checked_add(1)1183 .ok_or(<Error<T>>::CollectionAdminCountExceeded)?;1184 }1185 }1186 ensure!(1187 admin_amount <= Self::collection_admins_limit(),1188 <Error<T>>::CollectionAdminCountExceeded,1189 );1190 <AdminAmount<T>>::insert(id, admin_amount);11911192 // Take a (non-refundable) deposit of collection creation1193 {1194 let mut imbalance = <Debt<T::AccountId, <T as Config>::Currency>>::zero();1195 imbalance.subsume(<T as Config>::Currency::deposit(1196 &T::TreasuryAccountId::get(),1197 T::CollectionCreationPrice::get(),1198 Precision::Exact,1199 )?);1200 let credit =1201 <T as Config>::Currency::settle(payer.as_sub(), imbalance, Preservation::Preserve)1202 .map_err(|_| Error::<T>::NotSufficientFounds)?;12031204 debug_assert!(credit.peek().is_zero())1205 }12061207 <CreatedCollectionCount<T>>::put(created_count);1208 <Pallet<T>>::deposit_event(Event::CollectionCreated(1209 id,1210 data.mode.id(),1211 owner.as_sub().clone(),1212 ));1213 <PalletEvm<T>>::deposit_log(1214 erc::CollectionHelpersEvents::CollectionCreated {1215 owner: *owner.as_eth(),1216 collection_id: eth::collection_id_to_address(id),1217 }1218 .to_log(T::ContractAddress::get()),1219 );1220 <CollectionById<T>>::insert(id, collection);1221 Ok(id)1222 }12231224 /// Destroy collection.1225 ///1226 /// * `collection` - Collection handler.1227 /// * `sender` - The owner or administrator of the collection.1228 pub fn destroy_collection(1229 collection: CollectionHandle<T>,1230 sender: &T::CrossAccountId,1231 ) -> DispatchResult {1232 ensure!(1233 collection.limits.owner_can_destroy(),1234 <Error<T>>::NoPermission,1235 );1236 collection.check_is_owner(sender)?;12371238 let destroyed_collections = <DestroyedCollectionCount<T>>::get()1239 .01240 .checked_add(1)1241 .ok_or(ArithmeticError::Overflow)?;12421243 // =========12441245 <DestroyedCollectionCount<T>>::put(destroyed_collections);1246 <CollectionById<T>>::remove(collection.id);1247 <AdminAmount<T>>::remove(collection.id);1248 let _ = <IsAdmin<T>>::clear_prefix((collection.id,), u32::MAX, None);1249 let _ = <Allowlist<T>>::clear_prefix((collection.id,), u32::MAX, None);1250 <CollectionProperties<T>>::remove(collection.id);12511252 <Pallet<T>>::deposit_event(Event::CollectionDestroyed(collection.id));12531254 <PalletEvm<T>>::deposit_log(1255 erc::CollectionHelpersEvents::CollectionDestroyed {1256 collection_id: eth::collection_id_to_address(collection.id),1257 }1258 .to_log(T::ContractAddress::get()),1259 );1260 Ok(())1261 }12621263 /// This function sets or removes a collection properties according to1264 /// `properties_updates` contents:1265 /// * sets a property under the <key> with the value provided `(<key>, Some(<value>))`1266 /// * removes a property under the <key> if the value is `None` `(<key>, None)`.1267 ///1268 /// This function fires an event for each property change.1269 /// In case of an error, all the changes (including the events) will be reverted1270 /// since the function is transactional.1271 #[transactional]1272 fn modify_collection_properties(1273 collection: &CollectionHandle<T>,1274 sender: &T::CrossAccountId,1275 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,1276 ) -> DispatchResult {1277 collection.check_is_owner_or_admin(sender)?;12781279 let mut stored_properties = <CollectionProperties<T>>::get(collection.id);12801281 for (key, value) in properties_updates {1282 match value {1283 Some(value) => {1284 stored_properties1285 .try_set(key.clone(), value)1286 .map_err(<Error<T>>::from)?;12871288 Self::deposit_event(Event::CollectionPropertySet(collection.id, key));1289 <PalletEvm<T>>::deposit_log(1290 erc::CollectionHelpersEvents::CollectionChanged {1291 collection_id: eth::collection_id_to_address(collection.id),1292 }1293 .to_log(T::ContractAddress::get()),1294 );1295 }1296 None => {1297 stored_properties.remove(&key).map_err(<Error<T>>::from)?;12981299 Self::deposit_event(Event::CollectionPropertyDeleted(collection.id, key));1300 <PalletEvm<T>>::deposit_log(1301 erc::CollectionHelpersEvents::CollectionChanged {1302 collection_id: eth::collection_id_to_address(collection.id),1303 }1304 .to_log(T::ContractAddress::get()),1305 );1306 }1307 }1308 }13091310 <CollectionProperties<T>>::set(collection.id, stored_properties);13111312 Ok(())1313 }13141315 /// A batch operation to add, edit or remove properties for a token.1316 /// It sets or removes a token's properties according to1317 /// `properties_updates` contents:1318 /// * sets a property under the <key> with the value provided `(<key>, Some(<value>))`1319 /// * removes a property under the <key> if the value is `None` `(<key>, None)`.1320 ///1321 /// All affected properties should have `mutable` permission1322 /// to be **deleted** or to be **set more than once**,1323 /// and the sender should have permission to edit those properties.1324 ///1325 /// This function fires an event for each property change.1326 /// In case of an error, all the changes (including the events) will be reverted1327 /// since the function is transactional.1328 #[allow(clippy::too_many_arguments)]1329 pub fn modify_token_properties<FTO, FTE>(1330 collection: &CollectionHandle<T>,1331 sender: &T::CrossAccountId,1332 token_id: TokenId,1333 is_token_exist: &mut LazyValue<bool, FTE>,1334 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,1335 mut stored_properties: TokenProperties,1336 is_token_owner: &mut LazyValue<Result<bool, DispatchError>, FTO>,1337 set_token_properties: impl FnOnce(TokenProperties),1338 log: evm_coder::ethereum::Log,1339 ) -> DispatchResult1340 where1341 FTO: FnOnce() -> Result<bool, DispatchError>,1342 FTE: FnOnce() -> bool,1343 {1344 let mut is_collection_admin = LazyValue::new(|| collection.is_owner_or_admin(sender));1345 let permissions = Self::property_permissions(collection.id);13461347 let mut changed = false;1348 for (key, value) in properties_updates {1349 let permission = permissions1350 .get(&key)1351 .cloned()1352 .unwrap_or_else(PropertyPermission::none);13531354 let property_exists = stored_properties.get(&key).is_some();13551356 match permission {1357 PropertyPermission { mutable: false, .. } if property_exists => {1358 return Err(<Error<T>>::NoPermission.into());1359 }13601361 PropertyPermission {1362 collection_admin,1363 token_owner,1364 ..1365 } => check_token_permissions::<T, _, FTO, FTE>(1366 collection_admin,1367 token_owner,1368 &mut is_collection_admin,1369 is_token_owner,1370 is_token_exist,1371 )?,1372 }13731374 match value {1375 Some(value) => {1376 stored_properties1377 .try_set(key.clone(), value)1378 .map_err(<Error<T>>::from)?;13791380 Self::deposit_event(Event::TokenPropertySet(collection.id, token_id, key));1381 }1382 None => {1383 stored_properties.remove(&key).map_err(<Error<T>>::from)?;13841385 Self::deposit_event(Event::TokenPropertyDeleted(collection.id, token_id, key));1386 }1387 }13881389 changed = true;1390 }13911392 if changed {1393 <PalletEvm<T>>::deposit_log(log);1394 }13951396 set_token_properties(stored_properties);13971398 Ok(())1399 }14001401 /// Sets or unsets the approval of a given operator.1402 ///1403 /// The `operator` is allowed to transfer all token pieces of the `owner` on their behalf.1404 /// - `owner`: Token owner1405 /// - `operator`: Operator1406 /// - `approve`: Should operator status be granted or revoked?1407 pub fn set_allowance_for_all(1408 collection: &CollectionHandle<T>,1409 owner: &T::CrossAccountId,1410 operator: &T::CrossAccountId,1411 approve: bool,1412 set_allowance: impl FnOnce(),1413 log: evm_coder::ethereum::Log,1414 ) -> DispatchResult {1415 if collection.permissions.access() == AccessMode::AllowList {1416 collection.check_allowlist(owner)?;1417 collection.check_allowlist(operator)?;1418 }14191420 Self::ensure_correct_receiver(operator)?;14211422 set_allowance();14231424 <PalletEvm<T>>::deposit_log(log);1425 Self::deposit_event(Event::ApprovedForAll(1426 collection.id,1427 owner.clone(),1428 operator.clone(),1429 approve,1430 ));1431 Ok(())1432 }14331434 /// Set collection property.1435 ///1436 /// * `collection` - Collection handler.1437 /// * `sender` - The owner or administrator of the collection.1438 /// * `property` - The property to set.1439 pub fn set_collection_property(1440 collection: &CollectionHandle<T>,1441 sender: &T::CrossAccountId,1442 property: Property,1443 ) -> DispatchResult {1444 Self::set_collection_properties(collection, sender, [property].into_iter())1445 }14461447 /// Set a scoped collection property, where the scope is a special prefix1448 /// prohibiting a user access to change the property directly.1449 ///1450 /// * `collection_id` - ID of the collection for which the property is being set.1451 /// * `scope` - Property scope.1452 /// * `property` - The property to set.1453 pub fn set_scoped_collection_property(1454 collection_id: CollectionId,1455 scope: PropertyScope,1456 property: Property,1457 ) -> DispatchResult {1458 CollectionProperties::<T>::try_mutate(collection_id, |properties| {1459 properties.try_scoped_set(scope, property.key, property.value)1460 })1461 .map_err(<Error<T>>::from)?;14621463 Ok(())1464 }14651466 /// Set scoped collection properties, where the scope is a special prefix1467 /// prohibiting a user access to change the properties directly.1468 ///1469 /// * `collection_id` - ID of the collection for which the properties is being set.1470 /// * `scope` - Property scope.1471 /// * `properties` - The properties to set.1472 pub fn set_scoped_collection_properties(1473 collection_id: CollectionId,1474 scope: PropertyScope,1475 properties: impl Iterator<Item = Property>,1476 ) -> DispatchResult {1477 CollectionProperties::<T>::try_mutate(collection_id, |stored_properties| {1478 stored_properties.try_scoped_set_from_iter(scope, properties)1479 })1480 .map_err(<Error<T>>::from)?;14811482 Ok(())1483 }14841485 /// Set collection properties.1486 ///1487 /// * `collection` - Collection handler.1488 /// * `sender` - The owner or administrator of the collection.1489 /// * `properties` - The properties to set.1490 pub fn set_collection_properties(1491 collection: &CollectionHandle<T>,1492 sender: &T::CrossAccountId,1493 properties: impl Iterator<Item = Property>,1494 ) -> DispatchResult {1495 Self::modify_collection_properties(1496 collection,1497 sender,1498 properties.map(|property| (property.key, Some(property.value))),1499 )1500 }15011502 /// Delete collection property.1503 ///1504 /// * `collection` - Collection handler.1505 /// * `sender` - The owner or administrator of the collection.1506 /// * `property` - The property to delete.1507 pub fn delete_collection_property(1508 collection: &CollectionHandle<T>,1509 sender: &T::CrossAccountId,1510 property_key: PropertyKey,1511 ) -> DispatchResult {1512 Self::delete_collection_properties(collection, sender, [property_key].into_iter())1513 }15141515 /// Delete collection properties.1516 ///1517 /// * `collection` - Collection handler.1518 /// * `sender` - The owner or administrator of the collection.1519 /// * `properties` - The properties to delete.1520 pub fn delete_collection_properties(1521 collection: &CollectionHandle<T>,1522 sender: &T::CrossAccountId,1523 property_keys: impl Iterator<Item = PropertyKey>,1524 ) -> DispatchResult {1525 Self::modify_collection_properties(collection, sender, property_keys.map(|key| (key, None)))1526 }15271528 /// Set collection propetry permission without any checks.1529 ///1530 /// Used for migrations.1531 ///1532 /// * `collection` - Collection handler.1533 /// * `property_permissions` - Property permissions.1534 pub fn set_property_permission_unchecked(1535 collection: CollectionId,1536 property_permission: PropertyKeyPermission,1537 ) -> DispatchResult {1538 <CollectionPropertyPermissions<T>>::try_mutate(collection, |permissions| {1539 permissions.try_set(property_permission.key, property_permission.permission)1540 })1541 .map_err(<Error<T>>::from)?;1542 Ok(())1543 }15441545 /// Set collection property permission.1546 ///1547 /// * `collection` - Collection handler.1548 /// * `sender` - The owner or administrator of the collection.1549 /// * `property_permission` - Property permission.1550 pub fn set_property_permission(1551 collection: &CollectionHandle<T>,1552 sender: &T::CrossAccountId,1553 property_permission: PropertyKeyPermission,1554 ) -> DispatchResult {1555 Self::set_scoped_property_permission(1556 collection,1557 sender,1558 PropertyScope::None,1559 property_permission,1560 )1561 }15621563 /// Set collection property permission with scope.1564 ///1565 /// * `collection` - Collection handler.1566 /// * `sender` - The owner or administrator of the collection.1567 /// * `scope` - Property scope.1568 /// * `property_permission` - Property permission.1569 pub fn set_scoped_property_permission(1570 collection: &CollectionHandle<T>,1571 sender: &T::CrossAccountId,1572 scope: PropertyScope,1573 property_permission: PropertyKeyPermission,1574 ) -> DispatchResult {1575 collection.check_is_owner_or_admin(sender)?;15761577 let all_permissions = CollectionPropertyPermissions::<T>::get(collection.id);1578 let current_permission = all_permissions.get(&property_permission.key);1579 if matches![1580 current_permission,1581 Some(PropertyPermission { mutable: false, .. })1582 ] {1583 return Err(<Error<T>>::NoPermission.into());1584 }15851586 CollectionPropertyPermissions::<T>::try_mutate(collection.id, |permissions| {1587 let property_permission = property_permission.clone();1588 permissions.try_scoped_set(1589 scope,1590 property_permission.key,1591 property_permission.permission,1592 )1593 })1594 .map_err(<Error<T>>::from)?;15951596 Self::deposit_event(Event::PropertyPermissionSet(1597 collection.id,1598 property_permission.key,1599 ));1600 <PalletEvm<T>>::deposit_log(1601 erc::CollectionHelpersEvents::CollectionChanged {1602 collection_id: eth::collection_id_to_address(collection.id),1603 }1604 .to_log(T::ContractAddress::get()),1605 );16061607 Ok(())1608 }16091610 /// Set token property permission.1611 ///1612 /// * `collection` - Collection handler.1613 /// * `sender` - The owner or administrator of the collection.1614 /// * `property_permissions` - Property permissions.1615 #[transactional]1616 pub fn set_token_property_permissions(1617 collection: &CollectionHandle<T>,1618 sender: &T::CrossAccountId,1619 property_permissions: Vec<PropertyKeyPermission>,1620 ) -> DispatchResult {1621 Self::set_scoped_token_property_permissions(1622 collection,1623 sender,1624 PropertyScope::None,1625 property_permissions,1626 )1627 }16281629 /// Set token property permission with scope.1630 ///1631 /// * `collection` - Collection handler.1632 /// * `sender` - The owner or administrator of the collection.1633 /// * `scope` - Property scope.1634 /// * `property_permissions` - Property permissions.1635 #[transactional]1636 pub fn set_scoped_token_property_permissions(1637 collection: &CollectionHandle<T>,1638 sender: &T::CrossAccountId,1639 scope: PropertyScope,1640 property_permissions: Vec<PropertyKeyPermission>,1641 ) -> DispatchResult {1642 for prop_pemission in property_permissions {1643 Self::set_scoped_property_permission(collection, sender, scope, prop_pemission)?;1644 }16451646 Ok(())1647 }16481649 /// Get collection property.1650 pub fn get_collection_property(1651 collection_id: CollectionId,1652 key: &PropertyKey,1653 ) -> Option<PropertyValue> {1654 Self::collection_properties(collection_id).get(key).cloned()1655 }16561657 /// Convert byte vector to property key vector.1658 pub fn bytes_keys_to_property_keys(1659 keys: Vec<Vec<u8>>,1660 ) -> Result<Vec<PropertyKey>, DispatchError> {1661 keys.into_iter()1662 .map(|key| -> Result<PropertyKey, DispatchError> {1663 key.try_into()1664 .map_err(|_| <Error<T>>::PropertyKeyIsTooLong.into())1665 })1666 .collect::<Result<Vec<PropertyKey>, DispatchError>>()1667 }16681669 /// Get properties according to given keys.1670 pub fn filter_collection_properties(1671 collection_id: CollectionId,1672 keys: Option<Vec<PropertyKey>>,1673 ) -> Result<Vec<Property>, DispatchError> {1674 let properties = Self::collection_properties(collection_id);16751676 let properties = keys1677 .map(|keys| {1678 keys.into_iter()1679 .filter_map(|key| {1680 properties.get(&key).map(|value| Property {1681 key,1682 value: value.clone(),1683 })1684 })1685 .collect()1686 })1687 .unwrap_or_else(|| {1688 properties1689 .into_iter()1690 .map(|(key, value)| Property { key, value })1691 .collect()1692 });16931694 Ok(properties)1695 }16961697 /// Get property permissions according to given keys.1698 pub fn filter_property_permissions(1699 collection_id: CollectionId,1700 keys: Option<Vec<PropertyKey>>,1701 ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {1702 let permissions = Self::property_permissions(collection_id);17031704 let key_permissions = keys1705 .map(|keys| {1706 keys.into_iter()1707 .filter_map(|key| {1708 permissions1709 .get(&key)1710 .map(|permission| PropertyKeyPermission {1711 key,1712 permission: permission.clone(),1713 })1714 })1715 .collect()1716 })1717 .unwrap_or_else(|| {1718 permissions1719 .into_iter()1720 .map(|(key, permission)| PropertyKeyPermission { key, permission })1721 .collect()1722 });17231724 Ok(key_permissions)1725 }17261727 /// Toggle `user` participation in the `collection`'s allow list.1728 /// #### Store read/writes1729 /// 1 writes1730 pub fn toggle_allowlist(1731 collection: &CollectionHandle<T>,1732 sender: &T::CrossAccountId,1733 user: &T::CrossAccountId,1734 allowed: bool,1735 ) -> DispatchResult {1736 collection.check_is_owner_or_admin(sender)?;17371738 // =========17391740 if allowed {1741 <Allowlist<T>>::insert((collection.id, user), true);1742 Self::deposit_event(Event::<T>::AllowListAddressAdded(1743 collection.id,1744 user.clone(),1745 ));1746 } else {1747 <Allowlist<T>>::remove((collection.id, user));1748 Self::deposit_event(Event::<T>::AllowListAddressRemoved(1749 collection.id,1750 user.clone(),1751 ));1752 }17531754 <PalletEvm<T>>::deposit_log(1755 erc::CollectionHelpersEvents::CollectionChanged {1756 collection_id: eth::collection_id_to_address(collection.id),1757 }1758 .to_log(T::ContractAddress::get()),1759 );17601761 Ok(())1762 }17631764 /// Toggle `user` participation in the `collection`'s admin list.1765 /// #### Store read/writes1766 /// 2 reads, 2 writes1767 pub fn toggle_admin(1768 collection: &CollectionHandle<T>,1769 sender: &T::CrossAccountId,1770 user: &T::CrossAccountId,1771 admin: bool,1772 ) -> DispatchResult {1773 collection.check_is_internal()?;1774 collection.check_is_owner(sender)?;17751776 let is_admin = <IsAdmin<T>>::get((collection.id, user));1777 if is_admin == admin {1778 if admin {1779 return Ok(());1780 } else {1781 return Err(Error::<T>::UserIsNotCollectionAdmin.into());1782 }1783 }1784 let amount = <AdminAmount<T>>::get(collection.id);17851786 // =========17871788 if admin {1789 let amount = amount1790 .checked_add(1)1791 .ok_or(<Error<T>>::CollectionAdminCountExceeded)?;1792 ensure!(1793 amount <= Self::collection_admins_limit(),1794 <Error<T>>::CollectionAdminCountExceeded,1795 );17961797 <AdminAmount<T>>::insert(collection.id, amount);1798 <IsAdmin<T>>::insert((collection.id, user), true);17991800 Self::deposit_event(Event::<T>::CollectionAdminAdded(1801 collection.id,1802 user.clone(),1803 ));1804 } else {1805 <AdminAmount<T>>::insert(collection.id, amount.saturating_sub(1));1806 <IsAdmin<T>>::remove((collection.id, user));18071808 Self::deposit_event(Event::<T>::CollectionAdminRemoved(1809 collection.id,1810 user.clone(),1811 ));1812 }18131814 <PalletEvm<T>>::deposit_log(1815 erc::CollectionHelpersEvents::CollectionChanged {1816 collection_id: eth::collection_id_to_address(collection.id),1817 }1818 .to_log(T::ContractAddress::get()),1819 );18201821 Ok(())1822 }18231824 /// Update collection limits.1825 pub fn update_limits(1826 user: &T::CrossAccountId,1827 collection: &mut CollectionHandle<T>,1828 new_limit: CollectionLimits,1829 ) -> DispatchResult {1830 collection.check_is_internal()?;1831 collection.check_is_owner_or_admin(user)?;18321833 collection.limits =1834 Self::clamp_limits(collection.mode.clone(), &collection.limits, new_limit)?;18351836 Self::deposit_event(Event::<T>::CollectionLimitSet(collection.id));1837 <PalletEvm<T>>::deposit_log(1838 erc::CollectionHelpersEvents::CollectionChanged {1839 collection_id: eth::collection_id_to_address(collection.id),1840 }1841 .to_log(T::ContractAddress::get()),1842 );18431844 collection.save()1845 }18461847 /// Merge set fields from `new_limit` to `old_limit`.1848 fn clamp_limits(1849 mode: CollectionMode,1850 old_limit: &CollectionLimits,1851 mut new_limit: CollectionLimits,1852 ) -> Result<CollectionLimits, DispatchError> {1853 let limits = old_limit;1854 limit_default!(old_limit, new_limit,1855 account_token_ownership_limit => ensure!(1856 new_limit <= MAX_TOKEN_OWNERSHIP,1857 <Error<T>>::CollectionLimitBoundsExceeded,1858 ),1859 sponsored_data_size => ensure!(1860 new_limit <= CUSTOM_DATA_LIMIT,1861 <Error<T>>::CollectionLimitBoundsExceeded,1862 ),18631864 sponsored_data_rate_limit => {},1865 token_limit => ensure!(1866 old_limit >= new_limit && new_limit > 0,1867 <Error<T>>::CollectionTokenLimitExceeded1868 ),18691870 sponsor_transfer_timeout(match mode {1871 CollectionMode::NFT => NFT_SPONSOR_TRANSFER_TIMEOUT,1872 CollectionMode::Fungible(_) => FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1873 CollectionMode::ReFungible => REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,1874 }) => ensure!(1875 new_limit <= MAX_SPONSOR_TIMEOUT,1876 <Error<T>>::CollectionLimitBoundsExceeded,1877 ),1878 sponsor_approve_timeout => {},1879 owner_can_transfer => ensure!(1880 !limits.owner_can_transfer_instaled() ||1881 old_limit || !new_limit,1882 <Error<T>>::OwnerPermissionsCantBeReverted,1883 ),1884 owner_can_destroy => ensure!(1885 old_limit || !new_limit,1886 <Error<T>>::OwnerPermissionsCantBeReverted,1887 ),1888 transfers_enabled => {},1889 );1890 Ok(new_limit)1891 }18921893 /// Update collection permissions.1894 pub fn update_permissions(1895 user: &T::CrossAccountId,1896 collection: &mut CollectionHandle<T>,1897 new_permission: CollectionPermissions,1898 ) -> DispatchResult {1899 collection.check_is_internal()?;1900 collection.check_is_owner_or_admin(user)?;1901 collection.permissions = Self::clamp_permissions(1902 collection.mode.clone(),1903 &collection.permissions,1904 new_permission,1905 )?;19061907 Self::deposit_event(Event::<T>::CollectionPermissionSet(collection.id));1908 <PalletEvm<T>>::deposit_log(1909 erc::CollectionHelpersEvents::CollectionChanged {1910 collection_id: eth::collection_id_to_address(collection.id),1911 }1912 .to_log(T::ContractAddress::get()),1913 );19141915 collection.save()1916 }19171918 /// Merge set fields from `new_permission` to `old_permission`.1919 fn clamp_permissions(1920 _mode: CollectionMode,1921 old_permission: &CollectionPermissions,1922 mut new_permission: CollectionPermissions,1923 ) -> Result<CollectionPermissions, DispatchError> {1924 limit_default_clone!(old_permission, new_permission,1925 access => {},1926 mint_mode => {},1927 nesting => { /* todo check for permissive, if only it gets out of benchmarks */ },1928 );1929 Ok(new_permission)1930 }19311932 /// Repair possibly broken properties of a collection.1933 pub fn repair_collection(collection_id: CollectionId) -> DispatchResult {1934 CollectionProperties::<T>::mutate(collection_id, |properties| {1935 properties.recompute_consumed_space();1936 });19371938 Ok(())1939 }1940}19411942/// Indicates unsupported methods by returning [Error::UnsupportedOperation].1943#[macro_export]1944macro_rules! unsupported {1945 ($runtime:path) => {1946 Err($crate::Error::<$runtime>::UnsupportedOperation.into())1947 };1948}19491950/// Return weights for various worst-case operations.1951pub trait CommonWeightInfo<CrossAccountId> {1952 /// Weight of item creation.1953 fn create_item(data: &CreateItemData) -> Weight {1954 Self::create_multiple_items(from_ref(data))1955 }19561957 /// Weight of items creation.1958 fn create_multiple_items(amount: &[CreateItemData]) -> Weight;19591960 /// Weight of items creation.1961 fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;19621963 /// The weight of the burning item.1964 fn burn_item() -> Weight;19651966 /// Property setting weight.1967 ///1968 /// * `amount`- The number of properties to set.1969 fn set_collection_properties(amount: u32) -> Weight;19701971 /// Collection property deletion weight.1972 ///1973 /// * `amount`- The number of properties to set.1974 fn delete_collection_properties(amount: u32) -> Weight;19751976 /// Token property setting weight.1977 ///1978 /// * `amount`- The number of properties to set.1979 fn set_token_properties(amount: u32) -> Weight;19801981 /// Token property deletion weight.1982 ///1983 /// * `amount`- The number of properties to delete.1984 fn delete_token_properties(amount: u32) -> Weight;19851986 /// Token property permissions set weight.1987 ///1988 /// * `amount`- The number of property permissions to set.1989 fn set_token_property_permissions(amount: u32) -> Weight;19901991 /// Transfer price of the token or its parts.1992 fn transfer() -> Weight;19931994 /// The price of setting the permission of the operation from another user.1995 fn approve() -> Weight;19961997 /// The price of setting the permission of the operation from another user for eth mirror.1998 fn approve_from() -> Weight;19992000 /// Transfer price from another user.2001 fn transfer_from() -> Weight;20022003 /// The price of burning a token from another user.2004 fn burn_from() -> Weight;20052006 /// Differs from burn_item in case of Fungible and Refungible, as it should burn2007 /// whole users's balance.2008 ///2009 /// This method shouldn't be used directly, as it doesn't count breadth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead2010 fn burn_recursively_self_raw() -> Weight;20112012 /// Cost of iterating over `amount` children while burning, without counting child burning itself.2013 ///2014 /// This method shouldn't be used directly, as it doesn't count depth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead2015 fn burn_recursively_breadth_raw(amount: u32) -> Weight;20162017 /// The price of recursive burning a token.2018 ///2019 /// `max_selfs` - The maximum burning weight of the token itself.2020 /// `max_breadth` - The maximum number of nested tokens to burn.2021 fn burn_recursively(max_selfs: u32, max_breadth: u32) -> Weight {2022 Self::burn_recursively_self_raw()2023 .saturating_mul(max_selfs.max(1) as u64)2024 .saturating_add(Self::burn_recursively_breadth_raw(max_breadth))2025 }20262027 /// The price of retrieving token owner2028 fn token_owner() -> Weight;20292030 /// The price of setting approval for all2031 fn set_allowance_for_all() -> Weight;20322033 /// The price of repairing an item.2034 fn force_repair_item() -> Weight;2035}20362037/// Weight info extension trait for refungible pallet.2038pub trait RefungibleExtensionsWeightInfo {2039 /// Weight of token repartition.2040 fn repartition() -> Weight;2041}20422043/// Common collection operations.2044///2045/// It wraps methods in Fungible, Nonfungible and Refungible pallets2046/// and adds weight info.2047pub trait CommonCollectionOperations<T: Config> {2048 /// Create token.2049 ///2050 /// * `sender` - The user who mint the token and pays for the transaction.2051 /// * `to` - The user who will own the token.2052 /// * `data` - Token data.2053 /// * `nesting_budget` - A budget that can be spent on nesting tokens.2054 fn create_item(2055 &self,2056 sender: T::CrossAccountId,2057 to: T::CrossAccountId,2058 data: CreateItemData,2059 nesting_budget: &dyn Budget,2060 ) -> DispatchResultWithPostInfo;20612062 /// Create multiple tokens.2063 ///2064 /// * `sender` - The user who mint the token and pays for the transaction.2065 /// * `to` - The user who will own the token.2066 /// * `data` - Token data.2067 /// * `nesting_budget` - A budget that can be spent on nesting tokens.2068 fn create_multiple_items(2069 &self,2070 sender: T::CrossAccountId,2071 to: T::CrossAccountId,2072 data: Vec<CreateItemData>,2073 nesting_budget: &dyn Budget,2074 ) -> DispatchResultWithPostInfo;20752076 /// Create multiple tokens.2077 ///2078 /// * `sender` - The user who mint the token and pays for the transaction.2079 /// * `to` - The user who will own the token.2080 /// * `data` - Token data.2081 /// * `nesting_budget` - A budget that can be spent on nesting tokens.2082 fn create_multiple_items_ex(2083 &self,2084 sender: T::CrossAccountId,2085 data: CreateItemExData<T::CrossAccountId>,2086 nesting_budget: &dyn Budget,2087 ) -> DispatchResultWithPostInfo;20882089 /// Burn token.2090 ///2091 /// * `sender` - The user who owns the token.2092 /// * `token` - Token id that will burned.2093 /// * `amount` - The number of parts of the token that will be burned.2094 fn burn_item(2095 &self,2096 sender: T::CrossAccountId,2097 token: TokenId,2098 amount: u128,2099 ) -> DispatchResultWithPostInfo;21002101 /// Burn token and all nested tokens recursievly.2102 ///2103 /// * `sender` - The user who owns the token.2104 /// * `token` - Token id that will burned.2105 /// * `self_budget` - The budget that can be spent on burning tokens.2106 /// * `breadth_budget` - The budget that can be spent on burning nested tokens.2107 fn burn_item_recursively(2108 &self,2109 sender: T::CrossAccountId,2110 token: TokenId,2111 self_budget: &dyn Budget,2112 breadth_budget: &dyn Budget,2113 ) -> DispatchResultWithPostInfo;21142115 /// Set collection properties.2116 ///2117 /// * `sender` - Must be either the owner of the collection or its admin.2118 /// * `properties` - Properties to be set.2119 fn set_collection_properties(2120 &self,2121 sender: T::CrossAccountId,2122 properties: Vec<Property>,2123 ) -> DispatchResultWithPostInfo;21242125 /// Delete collection properties.2126 ///2127 /// * `sender` - Must be either the owner of the collection or its admin.2128 /// * `properties` - The properties to be removed.2129 fn delete_collection_properties(2130 &self,2131 sender: &T::CrossAccountId,2132 property_keys: Vec<PropertyKey>,2133 ) -> DispatchResultWithPostInfo;21342135 /// Set token properties.2136 ///2137 /// The appropriate [`PropertyPermission`] for the token property2138 /// must be set with [`Self::set_token_property_permissions`].2139 ///2140 /// * `sender` - Must be either the owner of the token or its admin.2141 /// * `token_id` - The token for which the properties are being set.2142 /// * `properties` - Properties to be set.2143 /// * `budget` - Budget for setting properties.2144 fn set_token_properties(2145 &self,2146 sender: T::CrossAccountId,2147 token_id: TokenId,2148 properties: Vec<Property>,2149 budget: &dyn Budget,2150 ) -> DispatchResultWithPostInfo;21512152 /// Remove token properties.2153 ///2154 /// The appropriate [`PropertyPermission`] for the token property2155 /// must be set with [`Self::set_token_property_permissions`].2156 ///2157 /// * `sender` - Must be either the owner of the token or its admin.2158 /// * `token_id` - The token for which the properties are being remove.2159 /// * `property_keys` - Keys to remove corresponding properties.2160 /// * `budget` - Budget for removing properties.2161 fn delete_token_properties(2162 &self,2163 sender: T::CrossAccountId,2164 token_id: TokenId,2165 property_keys: Vec<PropertyKey>,2166 budget: &dyn Budget,2167 ) -> DispatchResultWithPostInfo;21682169 /// Set token property permissions.2170 ///2171 /// * `sender` - Must be either the owner of the token or its admin.2172 /// * `token_id` - The token for which the properties are being set.2173 /// * `property_permissions` - Property permissions to be set.2174 /// * `budget` - Budget for setting properties.2175 fn set_token_property_permissions(2176 &self,2177 sender: &T::CrossAccountId,2178 property_permissions: Vec<PropertyKeyPermission>,2179 ) -> DispatchResultWithPostInfo;21802181 /// Transfer amount of token pieces.2182 ///2183 /// * `sender` - Donor user.2184 /// * `to` - Recepient user.2185 /// * `token` - The token of which parts are being sent.2186 /// * `amount` - The number of parts of the token that will be transferred.2187 /// * `budget` - The maximum budget that can be spent on the transfer.2188 fn transfer(2189 &self,2190 sender: T::CrossAccountId,2191 to: T::CrossAccountId,2192 token: TokenId,2193 amount: u128,2194 budget: &dyn Budget,2195 ) -> DispatchResultWithPostInfo;21962197 /// Grant access to another account to transfer parts of the token owned by the calling user via [Self::transfer_from].2198 ///2199 /// * `sender` - The user who grants access to the token.2200 /// * `spender` - The user to whom the rights are granted.2201 /// * `token` - The token to which access is granted.2202 /// * `amount` - The amount of pieces that another user can dispose of.2203 fn approve(2204 &self,2205 sender: T::CrossAccountId,2206 spender: T::CrossAccountId,2207 token: TokenId,2208 amount: u128,2209 ) -> DispatchResultWithPostInfo;22102211 /// Grant access to another account to transfer parts of the token owned by the calling user's eth mirror via [Self::transfer_from].2212 ///2213 /// * `sender` - The user who grants access to the token.2214 /// * `from` - Spender's eth mirror.2215 /// * `to` - The user to whom the rights are granted.2216 /// * `token` - The token to which access is granted.2217 /// * `amount` - The amount of pieces that another user can dispose of.2218 fn approve_from(2219 &self,2220 sender: T::CrossAccountId,2221 from: T::CrossAccountId,2222 to: T::CrossAccountId,2223 token: TokenId,2224 amount: u128,2225 ) -> DispatchResultWithPostInfo;22262227 /// Send parts of a token owned by another user.2228 ///2229 /// Before calling this method, you must grant rights to the calling user via [`Self::approve`].2230 ///2231 /// * `sender` - The user who must have access to the token (see [`Self::approve`]).2232 /// * `from` - The user who owns the token.2233 /// * `to` - Recepient user.2234 /// * `token` - The token of which parts are being sent.2235 /// * `amount` - The number of parts of the token that will be transferred.2236 /// * `budget` - The maximum budget that can be spent on the transfer.2237 fn transfer_from(2238 &self,2239 sender: T::CrossAccountId,2240 from: T::CrossAccountId,2241 to: T::CrossAccountId,2242 token: TokenId,2243 amount: u128,2244 budget: &dyn Budget,2245 ) -> DispatchResultWithPostInfo;22462247 /// Burn parts of a token owned by another user.2248 ///2249 /// Before calling this method, you must grant rights to the calling user via [`Self::approve`].2250 ///2251 /// * `sender` - The user who must have access to the token (see [`Self::approve`]).2252 /// * `from` - The user who owns the token.2253 /// * `token` - The token of which parts are being sent.2254 /// * `amount` - The number of parts of the token that will be transferred.2255 /// * `budget` - The maximum budget that can be spent on the burn.2256 fn burn_from(2257 &self,2258 sender: T::CrossAccountId,2259 from: T::CrossAccountId,2260 token: TokenId,2261 amount: u128,2262 budget: &dyn Budget,2263 ) -> DispatchResultWithPostInfo;22642265 /// Check permission to nest token.2266 ///2267 /// * `sender` - The user who initiated the check.2268 /// * `from` - The token that is checked for embedding.2269 /// * `under` - Token under which to check.2270 /// * `budget` - The maximum budget that can be spent on the check.2271 fn check_nesting(2272 &self,2273 sender: T::CrossAccountId,2274 from: (CollectionId, TokenId),2275 under: TokenId,2276 budget: &dyn Budget,2277 ) -> DispatchResult;22782279 /// Nest one token into another.2280 ///2281 /// * `under` - Token holder.2282 /// * `to_nest` - Nested token.2283 fn nest(&self, under: TokenId, to_nest: (CollectionId, TokenId));22842285 /// Unnest token.2286 ///2287 /// * `under` - Token holder.2288 /// * `to_nest` - Token to unnest.2289 fn unnest(&self, under: TokenId, to_nest: (CollectionId, TokenId));22902291 /// Get all user tokens.2292 ///2293 /// * `account` - Account for which you need to get tokens.2294 fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId>;22952296 /// Get all the tokens in the collection.2297 fn collection_tokens(&self) -> Vec<TokenId>;22982299 /// Check if the token exists.2300 ///2301 /// * `token` - Id token to check.2302 fn token_exists(&self, token: TokenId) -> bool;23032304 /// Get the id of the last minted token.2305 fn last_token_id(&self) -> TokenId;23062307 /// Get the owner of the token.2308 ///2309 /// * `token` - The token for which you need to find out the owner.2310 fn token_owner(&self, token: TokenId) -> Result<T::CrossAccountId, TokenOwnerError>;23112312 /// Returns 10 tokens owners in no particular order.2313 ///2314 /// * `token` - The token for which you need to find out the owners.2315 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId>;23162317 /// Get the value of the token property by key.2318 ///2319 /// * `token` - Token with the property to get.2320 /// * `key` - Property name.2321 fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue>;23222323 /// Get a set of token properties by key vector.2324 ///2325 /// * `token` - Token with the property to get.2326 /// * `keys` - Vector of property keys. If this parameter is [None](sp_std::result::Result),2327 /// then all properties are returned.2328 fn token_properties(&self, token: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property>;23292330 /// Amount of unique collection tokens2331 fn total_supply(&self) -> u32;23322333 /// Amount of different tokens account has.2334 ///2335 /// * `account` - The account for which need to get the balance.2336 fn account_balance(&self, account: T::CrossAccountId) -> u32;23372338 /// Amount of specific token account have.2339 fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128;23402341 /// Amount of token pieces2342 fn total_pieces(&self, token: TokenId) -> Option<u128>;23432344 /// Get the number of parts of the token that a trusted user can manage.2345 ///2346 /// * `sender` - Trusted user.2347 /// * `spender` - Owner of the token.2348 /// * `token` - The token for which to get the value.2349 fn allowance(2350 &self,2351 sender: T::CrossAccountId,2352 spender: T::CrossAccountId,2353 token: TokenId,2354 ) -> u128;23552356 /// Get extension for RFT collection.2357 fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>>;23582359 /// The `operator` is allowed to transfer all tokens of the `owner` on their behalf.2360 /// * `owner` - Token owner2361 /// * `operator` - Operator2362 /// * `approve` - Should operator status be granted or revoked?2363 fn set_allowance_for_all(2364 &self,2365 owner: T::CrossAccountId,2366 operator: T::CrossAccountId,2367 approve: bool,2368 ) -> DispatchResultWithPostInfo;23692370 /// Tells whether the given `owner` approves the `operator`.2371 fn allowance_for_all(&self, owner: T::CrossAccountId, operator: T::CrossAccountId) -> bool;23722373 /// Repairs a possibly broken item.2374 fn repair_item(&self, token: TokenId) -> DispatchResultWithPostInfo;2375}23762377/// Extension for RFT collection.2378pub trait RefungibleExtensions<T>2379where2380 T: Config,2381{2382 /// Change the number of parts of the token.2383 ///2384 /// When the value changes down, this function is equivalent to burning parts of the token.2385 ///2386 /// * `sender` - The user calling the repartition operation. Must be the owner of the token.2387 /// * `token` - The token for which you want to change the number of parts.2388 /// * `amount` - The new value of the parts of the token.2389 fn repartition(2390 &self,2391 sender: &T::CrossAccountId,2392 token: TokenId,2393 amount: u128,2394 ) -> DispatchResultWithPostInfo;2395}23962397/// Merge [`DispatchResult`] with [`Weight`] into [`DispatchResultWithPostInfo`].2398///2399/// Used for [`CommonCollectionOperations`] implementations and flexible enough to do so.2400pub fn with_weight(res: DispatchResult, weight: Weight) -> DispatchResultWithPostInfo {2401 let post_info = PostDispatchInfo {2402 actual_weight: Some(weight),2403 pays_fee: Pays::Yes,2404 };2405 match res {2406 Ok(()) => Ok(post_info),2407 Err(error) => Err(DispatchErrorWithPostInfo { post_info, error }),2408 }2409}24102411impl<T: Config> From<PropertiesError> for Error<T> {2412 fn from(error: PropertiesError) -> Self {2413 match error {2414 PropertiesError::NoSpaceForProperty => Self::NoSpaceForProperty,2415 PropertiesError::PropertyLimitReached => Self::PropertyLimitReached,2416 PropertiesError::InvalidCharacterInPropertyKey => Self::InvalidCharacterInPropertyKey,2417 PropertiesError::PropertyKeyIsTooLong => Self::PropertyKeyIsTooLong,2418 PropertiesError::EmptyPropertyKey => Self::EmptyPropertyKey,2419 }2420 }2421}24222423#[cfg(any(feature = "tests", test))]2424#[allow(missing_docs)]2425pub mod tests {2426 use crate::{DispatchResult, DispatchError, LazyValue, Config};24272428 const fn to_bool(u: u8) -> bool {2429 u != 02430 }24312432 #[derive(Debug)]2433 pub struct TestCase {2434 pub collection_admin: bool,2435 pub is_collection_admin: bool,2436 pub token_owner: bool,2437 pub is_token_owner: bool,2438 pub no_permission: bool,2439 }24402441 impl TestCase {2442 const fn new(2443 collection_admin: u8,2444 is_collection_admin: u8,2445 token_owner: u8,2446 is_token_owner: u8,2447 no_permission: u8,2448 ) -> Self {2449 Self {2450 collection_admin: to_bool(collection_admin),2451 is_collection_admin: to_bool(is_collection_admin),2452 token_owner: to_bool(token_owner),2453 is_token_owner: to_bool(is_token_owner),2454 no_permission: to_bool(no_permission),2455 }2456 }2457 }24582459 #[rustfmt::skip]2460 pub const TABLE: [TestCase; 16] = [2461 // ┌╴collection_admin2462 // │ ┌╴is_collection_admin2463 // │ │ ┌╴token_owner2464 // │ │ │ ┌╴is_token_ownership2465 // │ │ │ │ ┌╴no_permission2466 /* 0*/ TestCase::new(0, 0, 0, 0, 1),2467 /* 1*/ TestCase::new(0, 0, 0, 1, 1),2468 /* 2*/ TestCase::new(0, 0, 1, 0, 1),2469 /* 3*/ TestCase::new(0, 0, 1, 1, 0),2470 /* 4*/ TestCase::new(0, 1, 0, 0, 1),2471 /* 5*/ TestCase::new(0, 1, 0, 1, 1),2472 /* 6*/ TestCase::new(0, 1, 1, 0, 1),2473 /* 7*/ TestCase::new(0, 1, 1, 1, 0),2474 /* 8*/ TestCase::new(1, 0, 0, 0, 1),2475 /* 9*/ TestCase::new(1, 0, 0, 1, 1),2476 /* 10*/ TestCase::new(1, 0, 1, 0, 1),2477 /* 11*/ TestCase::new(1, 0, 1, 1, 0),2478 /* 12*/ TestCase::new(1, 1, 0, 0, 0),2479 /* 13*/ TestCase::new(1, 1, 0, 1, 0),2480 /* 14*/ TestCase::new(1, 1, 1, 0, 0),2481 /* 15*/ TestCase::new(1, 1, 1, 1, 0),2482 ];24832484 pub fn check_token_permissions<T, FCA, FTO, FTE>(2485 collection_admin_permitted: bool,2486 token_owner_permitted: bool,2487 is_collection_admin: &mut LazyValue<bool, FCA>,2488 check_token_ownership: &mut LazyValue<Result<bool, DispatchError>, FTO>,2489 check_token_existence: &mut LazyValue<bool, FTE>,2490 ) -> DispatchResult2491 where2492 T: Config,2493 FCA: FnOnce() -> bool,2494 FTO: FnOnce() -> Result<bool, DispatchError>,2495 FTE: FnOnce() -> bool,2496 {2497 crate::check_token_permissions::<T, FCA, FTO, FTE>(2498 collection_admin_permitted,2499 token_owner_permitted,2500 is_collection_admin,2501 check_token_ownership,2502 check_token_existence,2503 )2504 }2505}pallets/common/src/weights.rsdiffbeforeafterboth--- a/pallets/common/src/weights.rs
+++ b/pallets/common/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_common
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/common/src/weights.rs
@@ -36,6 +36,7 @@
fn set_collection_properties(b: u32, ) -> Weight;
fn delete_collection_properties(b: u32, ) -> Weight;
fn check_accesslist() -> Weight;
+ fn init_token_properties_common() -> Weight;
}
/// Weights for pallet_common using the Substrate node and recommended hardware.
@@ -46,12 +47,12 @@
/// The range of component `b` is `[0, 64]`.
fn set_collection_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `265`
+ // Measured: `298`
// Estimated: `44457`
- // Minimum execution time: 6_805_000 picoseconds.
- Weight::from_parts(6_965_000, 44457)
- // Standard Error: 20_175
- .saturating_add(Weight::from_parts(6_191_369, 0).saturating_mul(b.into()))
+ // Minimum execution time: 4_987_000 picoseconds.
+ Weight::from_parts(5_119_000, 44457)
+ // Standard Error: 7_609
+ .saturating_add(Weight::from_parts(5_750_459, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -60,12 +61,12 @@
/// The range of component `b` is `[0, 64]`.
fn delete_collection_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `270 + b * (33030 ±0)`
+ // Measured: `303 + b * (33030 ±0)`
// Estimated: `44457`
- // Minimum execution time: 6_284_000 picoseconds.
- Weight::from_parts(6_416_000, 44457)
- // Standard Error: 81_929
- .saturating_add(Weight::from_parts(23_972_425, 0).saturating_mul(b.into()))
+ // Minimum execution time: 4_923_000 picoseconds.
+ Weight::from_parts(5_074_000, 44457)
+ // Standard Error: 36_651
+ .saturating_add(Weight::from_parts(23_145_677, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -73,12 +74,24 @@
/// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
fn check_accesslist() -> Weight {
// Proof Size summary in bytes:
- // Measured: `340`
+ // Measured: `373`
// Estimated: `3535`
- // Minimum execution time: 5_205_000 picoseconds.
- Weight::from_parts(5_438_000, 3535)
+ // Minimum execution time: 4_271_000 picoseconds.
+ Weight::from_parts(4_461_000, 3535)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
+ /// Storage: Common IsAdmin (r:1 w:0)
+ /// Proof: Common IsAdmin (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
+ /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
+ /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ fn init_token_properties_common() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `326`
+ // Estimated: `20191`
+ // Minimum execution time: 5_889_000 picoseconds.
+ Weight::from_parts(6_138_000, 20191)
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ }
}
// For backwards compatibility and tests
@@ -88,12 +101,12 @@
/// The range of component `b` is `[0, 64]`.
fn set_collection_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `265`
+ // Measured: `298`
// Estimated: `44457`
- // Minimum execution time: 6_805_000 picoseconds.
- Weight::from_parts(6_965_000, 44457)
- // Standard Error: 20_175
- .saturating_add(Weight::from_parts(6_191_369, 0).saturating_mul(b.into()))
+ // Minimum execution time: 4_987_000 picoseconds.
+ Weight::from_parts(5_119_000, 44457)
+ // Standard Error: 7_609
+ .saturating_add(Weight::from_parts(5_750_459, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -102,12 +115,12 @@
/// The range of component `b` is `[0, 64]`.
fn delete_collection_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `270 + b * (33030 ±0)`
+ // Measured: `303 + b * (33030 ±0)`
// Estimated: `44457`
- // Minimum execution time: 6_284_000 picoseconds.
- Weight::from_parts(6_416_000, 44457)
- // Standard Error: 81_929
- .saturating_add(Weight::from_parts(23_972_425, 0).saturating_mul(b.into()))
+ // Minimum execution time: 4_923_000 picoseconds.
+ Weight::from_parts(5_074_000, 44457)
+ // Standard Error: 36_651
+ .saturating_add(Weight::from_parts(23_145_677, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -115,11 +128,23 @@
/// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
fn check_accesslist() -> Weight {
// Proof Size summary in bytes:
- // Measured: `340`
+ // Measured: `373`
// Estimated: `3535`
- // Minimum execution time: 5_205_000 picoseconds.
- Weight::from_parts(5_438_000, 3535)
+ // Minimum execution time: 4_271_000 picoseconds.
+ Weight::from_parts(4_461_000, 3535)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
+ /// Storage: Common IsAdmin (r:1 w:0)
+ /// Proof: Common IsAdmin (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
+ /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
+ /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ fn init_token_properties_common() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `326`
+ // Estimated: `20191`
+ // Minimum execution time: 5_889_000 picoseconds.
+ Weight::from_parts(6_138_000, 20191)
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ }
}
pallets/configuration/src/weights.rsdiffbeforeafterboth--- a/pallets/configuration/src/weights.rs
+++ b/pallets/configuration/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_configuration
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/configuration/src/weights.rs
@@ -50,19 +50,23 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 1_725_000 picoseconds.
- Weight::from_parts(1_853_000, 0)
+ // Minimum execution time: 990_000 picoseconds.
+ Weight::from_parts(1_090_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Configuration MinGasPriceOverride (r:0 w:1)
/// Proof: Configuration MinGasPriceOverride (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
+ /// Storage: unknown `0xc1fef3b7207c11a52df13c12884e772609bc3a1e532c9cb85d57feed02cbff8e` (r:0 w:1)
+ /// Proof Skipped: unknown `0xc1fef3b7207c11a52df13c12884e772609bc3a1e532c9cb85d57feed02cbff8e` (r:0 w:1)
+ /// Storage: unknown `0xc1fef3b7207c11a52df13c12884e77263864ade243c642793ebcfe9e16f454ca` (r:0 w:1)
+ /// Proof Skipped: unknown `0xc1fef3b7207c11a52df13c12884e77263864ade243c642793ebcfe9e16f454ca` (r:0 w:1)
fn set_min_gas_price_override() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 1_802_000 picoseconds.
- Weight::from_parts(1_903_000, 0)
- .saturating_add(T::DbWeight::get().writes(1_u64))
+ // Minimum execution time: 1_469_000 picoseconds.
+ Weight::from_parts(1_565_000, 0)
+ .saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: Configuration AppPromomotionConfigurationOverride (r:0 w:1)
/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
@@ -70,8 +74,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 2_048_000 picoseconds.
- Weight::from_parts(2_157_000, 0)
+ // Minimum execution time: 1_027_000 picoseconds.
+ Weight::from_parts(1_098_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Configuration CollatorSelectionDesiredCollatorsOverride (r:0 w:1)
@@ -80,8 +84,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 7_622_000 picoseconds.
- Weight::from_parts(8_014_000, 0)
+ // Minimum execution time: 4_149_000 picoseconds.
+ Weight::from_parts(4_326_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Configuration CollatorSelectionLicenseBondOverride (r:0 w:1)
@@ -90,8 +94,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_981_000 picoseconds.
- Weight::from_parts(5_811_000, 0)
+ // Minimum execution time: 2_758_000 picoseconds.
+ Weight::from_parts(2_911_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Configuration CollatorSelectionKickThresholdOverride (r:0 w:1)
@@ -100,8 +104,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_664_000 picoseconds.
- Weight::from_parts(4_816_000, 0)
+ // Minimum execution time: 2_695_000 picoseconds.
+ Weight::from_parts(2_829_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
@@ -114,19 +118,23 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 1_725_000 picoseconds.
- Weight::from_parts(1_853_000, 0)
+ // Minimum execution time: 990_000 picoseconds.
+ Weight::from_parts(1_090_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Configuration MinGasPriceOverride (r:0 w:1)
/// Proof: Configuration MinGasPriceOverride (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
+ /// Storage: unknown `0xc1fef3b7207c11a52df13c12884e772609bc3a1e532c9cb85d57feed02cbff8e` (r:0 w:1)
+ /// Proof Skipped: unknown `0xc1fef3b7207c11a52df13c12884e772609bc3a1e532c9cb85d57feed02cbff8e` (r:0 w:1)
+ /// Storage: unknown `0xc1fef3b7207c11a52df13c12884e77263864ade243c642793ebcfe9e16f454ca` (r:0 w:1)
+ /// Proof Skipped: unknown `0xc1fef3b7207c11a52df13c12884e77263864ade243c642793ebcfe9e16f454ca` (r:0 w:1)
fn set_min_gas_price_override() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 1_802_000 picoseconds.
- Weight::from_parts(1_903_000, 0)
- .saturating_add(RocksDbWeight::get().writes(1_u64))
+ // Minimum execution time: 1_469_000 picoseconds.
+ Weight::from_parts(1_565_000, 0)
+ .saturating_add(RocksDbWeight::get().writes(3_u64))
}
/// Storage: Configuration AppPromomotionConfigurationOverride (r:0 w:1)
/// Proof: Configuration AppPromomotionConfigurationOverride (max_values: Some(1), max_size: Some(17), added: 512, mode: MaxEncodedLen)
@@ -134,8 +142,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 2_048_000 picoseconds.
- Weight::from_parts(2_157_000, 0)
+ // Minimum execution time: 1_027_000 picoseconds.
+ Weight::from_parts(1_098_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Configuration CollatorSelectionDesiredCollatorsOverride (r:0 w:1)
@@ -144,8 +152,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 7_622_000 picoseconds.
- Weight::from_parts(8_014_000, 0)
+ // Minimum execution time: 4_149_000 picoseconds.
+ Weight::from_parts(4_326_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Configuration CollatorSelectionLicenseBondOverride (r:0 w:1)
@@ -154,8 +162,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_981_000 picoseconds.
- Weight::from_parts(5_811_000, 0)
+ // Minimum execution time: 2_758_000 picoseconds.
+ Weight::from_parts(2_911_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Configuration CollatorSelectionKickThresholdOverride (r:0 w:1)
@@ -164,8 +172,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_664_000 picoseconds.
- Weight::from_parts(4_816_000, 0)
+ // Minimum execution time: 2_695_000 picoseconds.
+ Weight::from_parts(2_829_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}
pallets/evm-migration/src/weights.rsdiffbeforeafterboth--- a/pallets/evm-migration/src/weights.rs
+++ b/pallets/evm-migration/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_evm_migration
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/evm-migration/src/weights.rs
@@ -52,9 +52,9 @@
fn begin() -> Weight {
// Proof Size summary in bytes:
// Measured: `94`
- // Estimated: `10646`
- // Minimum execution time: 8_519_000 picoseconds.
- Weight::from_parts(8_729_000, 10646)
+ // Estimated: `3593`
+ // Minimum execution time: 6_131_000 picoseconds.
+ Weight::from_parts(6_351_000, 3593)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -66,11 +66,11 @@
fn set_data(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `96`
- // Estimated: `3590`
- // Minimum execution time: 6_062_000 picoseconds.
- Weight::from_parts(7_193_727, 3590)
- // Standard Error: 1_844
- .saturating_add(Weight::from_parts(876_826, 0).saturating_mul(b.into()))
+ // Estimated: `3494`
+ // Minimum execution time: 4_522_000 picoseconds.
+ Weight::from_parts(4_569_839, 3494)
+ // Standard Error: 253
+ .saturating_add(Weight::from_parts(743_780, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(b.into())))
}
@@ -79,12 +79,14 @@
/// Storage: EVM AccountCodes (r:0 w:1)
/// Proof Skipped: EVM AccountCodes (max_values: None, max_size: None, mode: Measured)
/// The range of component `b` is `[0, 80]`.
- fn finish(_b: u32, ) -> Weight {
+ fn finish(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `96`
- // Estimated: `3590`
- // Minimum execution time: 7_452_000 picoseconds.
- Weight::from_parts(8_531_888, 3590)
+ // Estimated: `3494`
+ // Minimum execution time: 5_329_000 picoseconds.
+ Weight::from_parts(5_677_312, 3494)
+ // Standard Error: 22
+ .saturating_add(Weight::from_parts(1_369, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -93,20 +95,20 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 1_377_000 picoseconds.
- Weight::from_parts(3_388_877, 0)
- // Standard Error: 1_205
- .saturating_add(Weight::from_parts(696_701, 0).saturating_mul(b.into()))
+ // Minimum execution time: 890_000 picoseconds.
+ Weight::from_parts(1_279_871, 0)
+ // Standard Error: 112
+ .saturating_add(Weight::from_parts(408_968, 0).saturating_mul(b.into()))
}
/// The range of component `b` is `[0, 200]`.
fn insert_events(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 1_671_000 picoseconds.
- Weight::from_parts(4_402_497, 0)
- // Standard Error: 723
- .saturating_add(Weight::from_parts(1_338_678, 0).saturating_mul(b.into()))
+ // Minimum execution time: 896_000 picoseconds.
+ Weight::from_parts(1_975_680, 0)
+ // Standard Error: 117
+ .saturating_add(Weight::from_parts(1_003_721, 0).saturating_mul(b.into()))
}
}
@@ -121,9 +123,9 @@
fn begin() -> Weight {
// Proof Size summary in bytes:
// Measured: `94`
- // Estimated: `10646`
- // Minimum execution time: 8_519_000 picoseconds.
- Weight::from_parts(8_729_000, 10646)
+ // Estimated: `3593`
+ // Minimum execution time: 6_131_000 picoseconds.
+ Weight::from_parts(6_351_000, 3593)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -135,11 +137,11 @@
fn set_data(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `96`
- // Estimated: `3590`
- // Minimum execution time: 6_062_000 picoseconds.
- Weight::from_parts(7_193_727, 3590)
- // Standard Error: 1_844
- .saturating_add(Weight::from_parts(876_826, 0).saturating_mul(b.into()))
+ // Estimated: `3494`
+ // Minimum execution time: 4_522_000 picoseconds.
+ Weight::from_parts(4_569_839, 3494)
+ // Standard Error: 253
+ .saturating_add(Weight::from_parts(743_780, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(b.into())))
}
@@ -148,12 +150,14 @@
/// Storage: EVM AccountCodes (r:0 w:1)
/// Proof Skipped: EVM AccountCodes (max_values: None, max_size: None, mode: Measured)
/// The range of component `b` is `[0, 80]`.
- fn finish(_b: u32, ) -> Weight {
+ fn finish(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `96`
- // Estimated: `3590`
- // Minimum execution time: 7_452_000 picoseconds.
- Weight::from_parts(8_531_888, 3590)
+ // Estimated: `3494`
+ // Minimum execution time: 5_329_000 picoseconds.
+ Weight::from_parts(5_677_312, 3494)
+ // Standard Error: 22
+ .saturating_add(Weight::from_parts(1_369, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -162,20 +166,20 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 1_377_000 picoseconds.
- Weight::from_parts(3_388_877, 0)
- // Standard Error: 1_205
- .saturating_add(Weight::from_parts(696_701, 0).saturating_mul(b.into()))
+ // Minimum execution time: 890_000 picoseconds.
+ Weight::from_parts(1_279_871, 0)
+ // Standard Error: 112
+ .saturating_add(Weight::from_parts(408_968, 0).saturating_mul(b.into()))
}
/// The range of component `b` is `[0, 200]`.
fn insert_events(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 1_671_000 picoseconds.
- Weight::from_parts(4_402_497, 0)
- // Standard Error: 723
- .saturating_add(Weight::from_parts(1_338_678, 0).saturating_mul(b.into()))
+ // Minimum execution time: 896_000 picoseconds.
+ Weight::from_parts(1_975_680, 0)
+ // Standard Error: 117
+ .saturating_add(Weight::from_parts(1_003_721, 0).saturating_mul(b.into()))
}
}
pallets/foreign-assets/src/weights.rsdiffbeforeafterboth--- a/pallets/foreign-assets/src/weights.rs
+++ b/pallets/foreign-assets/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_foreign_assets
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/foreign-assets/src/weights.rs
@@ -56,6 +56,8 @@
/// Proof: ForeignAssets AssetMetadatas (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen)
/// Storage: ForeignAssets AssetBinding (r:1 w:1)
/// Proof: ForeignAssets AssetBinding (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
+ /// Storage: Common AdminAmount (r:0 w:1)
+ /// Proof: Common AdminAmount (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen)
/// Storage: Common CollectionPropertyPermissions (r:0 w:1)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Common CollectionProperties (r:0 w:1)
@@ -65,11 +67,11 @@
fn register_foreign_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `286`
- // Estimated: `25838`
- // Minimum execution time: 37_778_000 picoseconds.
- Weight::from_parts(38_334_000, 25838)
+ // Estimated: `6196`
+ // Minimum execution time: 33_294_000 picoseconds.
+ Weight::from_parts(34_011_000, 6196)
.saturating_add(T::DbWeight::get().reads(9_u64))
- .saturating_add(T::DbWeight::get().writes(11_u64))
+ .saturating_add(T::DbWeight::get().writes(12_u64))
}
/// Storage: ForeignAssets ForeignAssetLocations (r:1 w:1)
/// Proof: ForeignAssets ForeignAssetLocations (max_values: None, max_size: Some(614), added: 3089, mode: MaxEncodedLen)
@@ -78,9 +80,9 @@
fn update_foreign_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `197`
- // Estimated: `7615`
- // Minimum execution time: 13_739_000 picoseconds.
- Weight::from_parts(22_366_000, 7615)
+ // Estimated: `4079`
+ // Minimum execution time: 9_296_000 picoseconds.
+ Weight::from_parts(9_594_000, 4079)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -104,6 +106,8 @@
/// Proof: ForeignAssets AssetMetadatas (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen)
/// Storage: ForeignAssets AssetBinding (r:1 w:1)
/// Proof: ForeignAssets AssetBinding (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
+ /// Storage: Common AdminAmount (r:0 w:1)
+ /// Proof: Common AdminAmount (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen)
/// Storage: Common CollectionPropertyPermissions (r:0 w:1)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Common CollectionProperties (r:0 w:1)
@@ -113,11 +117,11 @@
fn register_foreign_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `286`
- // Estimated: `25838`
- // Minimum execution time: 37_778_000 picoseconds.
- Weight::from_parts(38_334_000, 25838)
+ // Estimated: `6196`
+ // Minimum execution time: 33_294_000 picoseconds.
+ Weight::from_parts(34_011_000, 6196)
.saturating_add(RocksDbWeight::get().reads(9_u64))
- .saturating_add(RocksDbWeight::get().writes(11_u64))
+ .saturating_add(RocksDbWeight::get().writes(12_u64))
}
/// Storage: ForeignAssets ForeignAssetLocations (r:1 w:1)
/// Proof: ForeignAssets ForeignAssetLocations (max_values: None, max_size: Some(614), added: 3089, mode: MaxEncodedLen)
@@ -126,9 +130,9 @@
fn update_foreign_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `197`
- // Estimated: `7615`
- // Minimum execution time: 13_739_000 picoseconds.
- Weight::from_parts(22_366_000, 7615)
+ // Estimated: `4079`
+ // Minimum execution time: 9_296_000 picoseconds.
+ Weight::from_parts(9_594_000, 4079)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -25,7 +25,7 @@
weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf,
};
use pallet_structure::Error as StructureError;
-use sp_runtime::ArithmeticError;
+use sp_runtime::{ArithmeticError, DispatchError};
use sp_std::{vec::Vec, vec};
use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};
@@ -364,6 +364,18 @@
fail!(<Error<T>>::SettingPropertiesNotAllowed)
}
+ fn get_token_properties_raw(
+ &self,
+ _token_id: TokenId,
+ ) -> Option<up_data_structs::TokenProperties> {
+ // No token properties are defined on fungibles
+ None
+ }
+
+ fn set_token_properties_raw(&self, _token_id: TokenId, _map: up_data_structs::TokenProperties) {
+ // No token properties are defined on fungibles
+ }
+
fn check_nesting(
&self,
_sender: <T>::CrossAccountId,
@@ -402,6 +414,15 @@
Err(TokenOwnerError::MultipleOwners)
}
+ fn check_token_indirect_owner(
+ &self,
+ _token: TokenId,
+ _maybe_owner: &T::CrossAccountId,
+ _nesting_budget: &dyn Budget,
+ ) -> Result<bool, DispatchError> {
+ Ok(false)
+ }
+
/// Returns 10 tokens owners in no particular order.
fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {
<Pallet<T>>::token_owners(self.id, token).unwrap_or_default()
pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_fungible
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/fungible/src/weights.rs
@@ -54,9 +54,9 @@
fn create_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
- // Estimated: `7035`
- // Minimum execution time: 10_168_000 picoseconds.
- Weight::from_parts(10_453_000, 7035)
+ // Estimated: `3542`
+ // Minimum execution time: 7_228_000 picoseconds.
+ Weight::from_parts(7_472_000, 3542)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -68,11 +68,11 @@
fn create_multiple_items_ex(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
- // Estimated: `4483 + b * (2552 ±0)`
- // Minimum execution time: 3_248_000 picoseconds.
- Weight::from_parts(12_455_981, 4483)
- // Standard Error: 2_698
- .saturating_add(Weight::from_parts(3_426_148, 0).saturating_mul(b.into()))
+ // Estimated: `3493 + b * (2552 ±0)`
+ // Minimum execution time: 2_398_000 picoseconds.
+ Weight::from_parts(4_432_908, 3493)
+ // Standard Error: 263
+ .saturating_add(Weight::from_parts(2_617_422, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
@@ -86,9 +86,9 @@
fn burn_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `197`
- // Estimated: `7035`
- // Minimum execution time: 12_717_000 picoseconds.
- Weight::from_parts(13_031_000, 7035)
+ // Estimated: `3542`
+ // Minimum execution time: 9_444_000 picoseconds.
+ Weight::from_parts(9_742_000, 3542)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -98,8 +98,8 @@
// Proof Size summary in bytes:
// Measured: `182`
// Estimated: `6094`
- // Minimum execution time: 13_640_000 picoseconds.
- Weight::from_parts(13_935_000, 6094)
+ // Minimum execution time: 9_553_000 picoseconds.
+ Weight::from_parts(9_852_000, 6094)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -111,8 +111,8 @@
// Proof Size summary in bytes:
// Measured: `182`
// Estimated: `3542`
- // Minimum execution time: 11_769_000 picoseconds.
- Weight::from_parts(12_072_000, 3542)
+ // Minimum execution time: 8_435_000 picoseconds.
+ Weight::from_parts(8_714_000, 3542)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -124,8 +124,8 @@
// Proof Size summary in bytes:
// Measured: `170`
// Estimated: `3542`
- // Minimum execution time: 11_603_000 picoseconds.
- Weight::from_parts(12_003_000, 3542)
+ // Minimum execution time: 8_475_000 picoseconds.
+ Weight::from_parts(8_735_000, 3542)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -135,8 +135,8 @@
// Proof Size summary in bytes:
// Measured: `210`
// Estimated: `3558`
- // Minimum execution time: 5_682_000 picoseconds.
- Weight::from_parts(5_892_000, 3558)
+ // Minimum execution time: 4_426_000 picoseconds.
+ Weight::from_parts(4_604_000, 3558)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: Fungible Allowance (r:0 w:1)
@@ -145,8 +145,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 6_415_000 picoseconds.
- Weight::from_parts(6_599_000, 0)
+ // Minimum execution time: 4_130_000 picoseconds.
+ Weight::from_parts(4_275_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Fungible Allowance (r:1 w:1)
@@ -158,9 +158,9 @@
fn burn_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `315`
- // Estimated: `10593`
- // Minimum execution time: 20_257_000 picoseconds.
- Weight::from_parts(20_625_000, 10593)
+ // Estimated: `3558`
+ // Minimum execution time: 14_878_000 picoseconds.
+ Weight::from_parts(15_263_000, 3558)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -175,9 +175,9 @@
fn create_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
- // Estimated: `7035`
- // Minimum execution time: 10_168_000 picoseconds.
- Weight::from_parts(10_453_000, 7035)
+ // Estimated: `3542`
+ // Minimum execution time: 7_228_000 picoseconds.
+ Weight::from_parts(7_472_000, 3542)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -189,11 +189,11 @@
fn create_multiple_items_ex(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
- // Estimated: `4483 + b * (2552 ±0)`
- // Minimum execution time: 3_248_000 picoseconds.
- Weight::from_parts(12_455_981, 4483)
- // Standard Error: 2_698
- .saturating_add(Weight::from_parts(3_426_148, 0).saturating_mul(b.into()))
+ // Estimated: `3493 + b * (2552 ±0)`
+ // Minimum execution time: 2_398_000 picoseconds.
+ Weight::from_parts(4_432_908, 3493)
+ // Standard Error: 263
+ .saturating_add(Weight::from_parts(2_617_422, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(1_u64))
@@ -207,9 +207,9 @@
fn burn_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `197`
- // Estimated: `7035`
- // Minimum execution time: 12_717_000 picoseconds.
- Weight::from_parts(13_031_000, 7035)
+ // Estimated: `3542`
+ // Minimum execution time: 9_444_000 picoseconds.
+ Weight::from_parts(9_742_000, 3542)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -219,8 +219,8 @@
// Proof Size summary in bytes:
// Measured: `182`
// Estimated: `6094`
- // Minimum execution time: 13_640_000 picoseconds.
- Weight::from_parts(13_935_000, 6094)
+ // Minimum execution time: 9_553_000 picoseconds.
+ Weight::from_parts(9_852_000, 6094)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -232,8 +232,8 @@
// Proof Size summary in bytes:
// Measured: `182`
// Estimated: `3542`
- // Minimum execution time: 11_769_000 picoseconds.
- Weight::from_parts(12_072_000, 3542)
+ // Minimum execution time: 8_435_000 picoseconds.
+ Weight::from_parts(8_714_000, 3542)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -245,8 +245,8 @@
// Proof Size summary in bytes:
// Measured: `170`
// Estimated: `3542`
- // Minimum execution time: 11_603_000 picoseconds.
- Weight::from_parts(12_003_000, 3542)
+ // Minimum execution time: 8_475_000 picoseconds.
+ Weight::from_parts(8_735_000, 3542)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -256,8 +256,8 @@
// Proof Size summary in bytes:
// Measured: `210`
// Estimated: `3558`
- // Minimum execution time: 5_682_000 picoseconds.
- Weight::from_parts(5_892_000, 3558)
+ // Minimum execution time: 4_426_000 picoseconds.
+ Weight::from_parts(4_604_000, 3558)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: Fungible Allowance (r:0 w:1)
@@ -266,8 +266,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 6_415_000 picoseconds.
- Weight::from_parts(6_599_000, 0)
+ // Minimum execution time: 4_130_000 picoseconds.
+ Weight::from_parts(4_275_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Fungible Allowance (r:1 w:1)
@@ -279,9 +279,9 @@
fn burn_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `315`
- // Estimated: `10593`
- // Minimum execution time: 20_257_000 picoseconds.
- Weight::from_parts(20_625_000, 10593)
+ // Estimated: `3558`
+ // Minimum execution time: 14_878_000 picoseconds.
+ Weight::from_parts(15_263_000, 3558)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
pallets/identity/src/weights.rsdiffbeforeafterboth--- a/pallets/identity/src/weights.rs
+++ b/pallets/identity/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_identity
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-27, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/identity/src/weights.rs
@@ -64,10 +64,10 @@
// Proof Size summary in bytes:
// Measured: `31 + r * (57 ±0)`
// Estimated: `2626`
- // Minimum execution time: 9_094_000 picoseconds.
- Weight::from_parts(10_431_627, 2626)
- // Standard Error: 1_046
- .saturating_add(Weight::from_parts(99_468, 0).saturating_mul(r.into()))
+ // Minimum execution time: 6_759_000 picoseconds.
+ Weight::from_parts(7_254_560, 2626)
+ // Standard Error: 231
+ .saturating_add(Weight::from_parts(64_513, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -79,12 +79,12 @@
// Proof Size summary in bytes:
// Measured: `441 + r * (5 ±0)`
// Estimated: `11003`
- // Minimum execution time: 18_662_000 picoseconds.
- Weight::from_parts(17_939_760, 11003)
- // Standard Error: 2_371
- .saturating_add(Weight::from_parts(22_184, 0).saturating_mul(r.into()))
- // Standard Error: 462
- .saturating_add(Weight::from_parts(151_368, 0).saturating_mul(x.into()))
+ // Minimum execution time: 14_134_000 picoseconds.
+ Weight::from_parts(12_591_985, 11003)
+ // Standard Error: 562
+ .saturating_add(Weight::from_parts(77_682, 0).saturating_mul(r.into()))
+ // Standard Error: 109
+ .saturating_add(Weight::from_parts(96_303, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -98,11 +98,11 @@
fn set_subs_new(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `100`
- // Estimated: `18716 + s * (2589 ±0)`
- // Minimum execution time: 6_921_000 picoseconds.
- Weight::from_parts(16_118_195, 18716)
- // Standard Error: 1_786
- .saturating_add(Weight::from_parts(1_350_155, 0).saturating_mul(s.into()))
+ // Estimated: `11003 + s * (2589 ±0)`
+ // Minimum execution time: 4_763_000 picoseconds.
+ Weight::from_parts(11_344_974, 11003)
+ // Standard Error: 401
+ .saturating_add(Weight::from_parts(1_141_028, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
@@ -119,11 +119,11 @@
fn set_subs_old(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + p * (32 ±0)`
- // Estimated: `17726`
- // Minimum execution time: 6_858_000 picoseconds.
- Weight::from_parts(16_222_054, 17726)
- // Standard Error: 1_409
- .saturating_add(Weight::from_parts(593_588, 0).saturating_mul(p.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 4_783_000 picoseconds.
+ Weight::from_parts(11_531_027, 11003)
+ // Standard Error: 369
+ .saturating_add(Weight::from_parts(542_102, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into())))
@@ -140,15 +140,15 @@
fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `468 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)`
- // Estimated: `17726`
- // Minimum execution time: 27_212_000 picoseconds.
- Weight::from_parts(19_030_840, 17726)
- // Standard Error: 3_118
- .saturating_add(Weight::from_parts(29_836, 0).saturating_mul(r.into()))
- // Standard Error: 608
- .saturating_add(Weight::from_parts(590_661, 0).saturating_mul(s.into()))
- // Standard Error: 608
- .saturating_add(Weight::from_parts(110_108, 0).saturating_mul(x.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 23_175_000 picoseconds.
+ Weight::from_parts(16_503_215, 11003)
+ // Standard Error: 625
+ .saturating_add(Weight::from_parts(1_175, 0).saturating_mul(r.into()))
+ // Standard Error: 122
+ .saturating_add(Weight::from_parts(533_184, 0).saturating_mul(s.into()))
+ // Standard Error: 122
+ .saturating_add(Weight::from_parts(94_600, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -162,13 +162,13 @@
fn request_judgement(r: u32, x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `366 + r * (57 ±0) + x * (66 ±0)`
- // Estimated: `13629`
- // Minimum execution time: 19_771_000 picoseconds.
- Weight::from_parts(18_917_892, 13629)
- // Standard Error: 1_957
- .saturating_add(Weight::from_parts(57_465, 0).saturating_mul(r.into()))
- // Standard Error: 381
- .saturating_add(Weight::from_parts(168_586, 0).saturating_mul(x.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 15_322_000 picoseconds.
+ Weight::from_parts(13_671_670, 11003)
+ // Standard Error: 722
+ .saturating_add(Weight::from_parts(73_665, 0).saturating_mul(r.into()))
+ // Standard Error: 140
+ .saturating_add(Weight::from_parts(124_598, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -180,12 +180,12 @@
// Proof Size summary in bytes:
// Measured: `397 + x * (66 ±0)`
// Estimated: `11003`
- // Minimum execution time: 17_411_000 picoseconds.
- Weight::from_parts(16_856_331, 11003)
- // Standard Error: 7_002
- .saturating_add(Weight::from_parts(34_389, 0).saturating_mul(r.into()))
- // Standard Error: 1_366
- .saturating_add(Weight::from_parts(165_686, 0).saturating_mul(x.into()))
+ // Minimum execution time: 13_268_000 picoseconds.
+ Weight::from_parts(12_489_352, 11003)
+ // Standard Error: 544
+ .saturating_add(Weight::from_parts(35_424, 0).saturating_mul(r.into()))
+ // Standard Error: 106
+ .saturating_add(Weight::from_parts(123_149, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -196,10 +196,10 @@
// Proof Size summary in bytes:
// Measured: `88 + r * (57 ±0)`
// Estimated: `2626`
- // Minimum execution time: 7_089_000 picoseconds.
- Weight::from_parts(7_750_487, 2626)
- // Standard Error: 1_625
- .saturating_add(Weight::from_parts(101_135, 0).saturating_mul(r.into()))
+ // Minimum execution time: 4_845_000 picoseconds.
+ Weight::from_parts(5_147_478, 2626)
+ // Standard Error: 169
+ .saturating_add(Weight::from_parts(55_561, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -210,10 +210,10 @@
// Proof Size summary in bytes:
// Measured: `88 + r * (57 ±0)`
// Estimated: `2626`
- // Minimum execution time: 6_300_000 picoseconds.
- Weight::from_parts(6_836_140, 2626)
- // Standard Error: 655
- .saturating_add(Weight::from_parts(102_284, 0).saturating_mul(r.into()))
+ // Minimum execution time: 4_191_000 picoseconds.
+ Weight::from_parts(4_478_351, 2626)
+ // Standard Error: 138
+ .saturating_add(Weight::from_parts(53_627, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -224,10 +224,10 @@
// Proof Size summary in bytes:
// Measured: `88 + r * (57 ±0)`
// Estimated: `2626`
- // Minimum execution time: 6_257_000 picoseconds.
- Weight::from_parts(6_917_052, 2626)
- // Standard Error: 2_628
- .saturating_add(Weight::from_parts(71_362, 0).saturating_mul(r.into()))
+ // Minimum execution time: 4_003_000 picoseconds.
+ Weight::from_parts(4_303_365, 2626)
+ // Standard Error: 147
+ .saturating_add(Weight::from_parts(52_472, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -240,13 +240,13 @@
fn provide_judgement(r: u32, x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `444 + r * (57 ±0) + x * (66 ±0)`
- // Estimated: `13629`
- // Minimum execution time: 16_021_000 picoseconds.
- Weight::from_parts(15_553_670, 13629)
- // Standard Error: 5_797
- .saturating_add(Weight::from_parts(42_423, 0).saturating_mul(r.into()))
- // Standard Error: 1_072
- .saturating_add(Weight::from_parts(252_721, 0).saturating_mul(x.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 11_465_000 picoseconds.
+ Weight::from_parts(10_326_049, 11003)
+ // Standard Error: 660
+ .saturating_add(Weight::from_parts(48_922, 0).saturating_mul(r.into()))
+ // Standard Error: 122
+ .saturating_add(Weight::from_parts(185_374, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -264,15 +264,15 @@
fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `665 + r * (12 ±0) + s * (32 ±0) + x * (66 ±0)`
- // Estimated: `23922`
- // Minimum execution time: 40_801_000 picoseconds.
- Weight::from_parts(34_079_397, 23922)
- // Standard Error: 3_750
- .saturating_add(Weight::from_parts(31_496, 0).saturating_mul(r.into()))
- // Standard Error: 732
- .saturating_add(Weight::from_parts(599_691, 0).saturating_mul(s.into()))
- // Standard Error: 732
- .saturating_add(Weight::from_parts(101_683, 0).saturating_mul(x.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 34_933_000 picoseconds.
+ Weight::from_parts(28_994_022, 11003)
+ // Standard Error: 668
+ .saturating_add(Weight::from_parts(21_722, 0).saturating_mul(r.into()))
+ // Standard Error: 130
+ .saturating_add(Weight::from_parts(540_580, 0).saturating_mul(s.into()))
+ // Standard Error: 130
+ .saturating_add(Weight::from_parts(89_348, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -285,12 +285,12 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_412_000 picoseconds.
- Weight::from_parts(4_592_000, 0)
- // Standard Error: 703_509
- .saturating_add(Weight::from_parts(43_647_925, 0).saturating_mul(x.into()))
- // Standard Error: 117_043
- .saturating_add(Weight::from_parts(9_312_431, 0).saturating_mul(n.into()))
+ // Minimum execution time: 2_770_000 picoseconds.
+ Weight::from_parts(2_875_000, 0)
+ // Standard Error: 281_295
+ .saturating_add(Weight::from_parts(37_513_186, 0).saturating_mul(x.into()))
+ // Standard Error: 46_799
+ .saturating_add(Weight::from_parts(7_949_936, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
}
/// Storage: Identity SubsOf (r:600 w:0)
@@ -303,12 +303,12 @@
// Proof Size summary in bytes:
// Measured: `41`
// Estimated: `990 + n * (5733 ±0)`
- // Minimum execution time: 3_824_000 picoseconds.
- Weight::from_parts(3_950_000, 990)
- // Standard Error: 2_864
- .saturating_add(Weight::from_parts(55_678, 0).saturating_mul(x.into()))
- // Standard Error: 476
- .saturating_add(Weight::from_parts(1_138_349, 0).saturating_mul(n.into()))
+ // Minimum execution time: 2_751_000 picoseconds.
+ Weight::from_parts(2_862_000, 990)
+ // Standard Error: 953
+ .saturating_add(Weight::from_parts(28_947, 0).saturating_mul(x.into()))
+ // Standard Error: 158
+ .saturating_add(Weight::from_parts(994_085, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 5733).saturating_mul(n.into()))
@@ -323,12 +323,12 @@
// Proof Size summary in bytes:
// Measured: `41`
// Estimated: `990 + n * (5733 ±0)`
- // Minimum execution time: 4_196_000 picoseconds.
- Weight::from_parts(4_340_000, 990)
- // Standard Error: 2_081_979
- .saturating_add(Weight::from_parts(130_653_903, 0).saturating_mul(s.into()))
- // Standard Error: 346_381
- .saturating_add(Weight::from_parts(23_046_001, 0).saturating_mul(n.into()))
+ // Minimum execution time: 2_671_000 picoseconds.
+ Weight::from_parts(2_814_000, 990)
+ // Standard Error: 785_159
+ .saturating_add(Weight::from_parts(109_659_566, 0).saturating_mul(s.into()))
+ // Standard Error: 130_628
+ .saturating_add(Weight::from_parts(19_169_269, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -344,11 +344,11 @@
fn add_sub(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `474 + s * (36 ±0)`
- // Estimated: `21305`
- // Minimum execution time: 15_289_000 picoseconds.
- Weight::from_parts(21_319_844, 21305)
- // Standard Error: 893
- .saturating_add(Weight::from_parts(53_159, 0).saturating_mul(s.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 12_571_000 picoseconds.
+ Weight::from_parts(16_366_301, 11003)
+ // Standard Error: 217
+ .saturating_add(Weight::from_parts(42_542, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -360,11 +360,11 @@
fn rename_sub(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `590 + s * (3 ±0)`
- // Estimated: `14582`
- // Minimum execution time: 9_867_000 picoseconds.
- Weight::from_parts(12_546_245, 14582)
- // Standard Error: 509
- .saturating_add(Weight::from_parts(10_078, 0).saturating_mul(s.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 7_278_000 picoseconds.
+ Weight::from_parts(9_227_799, 11003)
+ // Standard Error: 104
+ .saturating_add(Weight::from_parts(14_014, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -378,11 +378,11 @@
fn remove_sub(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `637 + s * (35 ±0)`
- // Estimated: `21305`
- // Minimum execution time: 19_299_000 picoseconds.
- Weight::from_parts(24_125_576, 21305)
- // Standard Error: 1_479
- .saturating_add(Weight::from_parts(22_611, 0).saturating_mul(s.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 15_771_000 picoseconds.
+ Weight::from_parts(18_105_475, 11003)
+ // Standard Error: 129
+ .saturating_add(Weight::from_parts(32_074, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -390,16 +390,18 @@
/// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen)
/// Storage: Identity SubsOf (r:1 w:1)
/// Proof: Identity SubsOf (max_values: None, max_size: Some(3258), added: 5733, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:0)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
/// The range of component `s` is `[0, 99]`.
fn quit_sub(s: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `563 + s * (37 ±0)`
- // Estimated: `10302`
- // Minimum execution time: 14_183_000 picoseconds.
- Weight::from_parts(17_343_547, 10302)
- // Standard Error: 454
- .saturating_add(Weight::from_parts(45_925, 0).saturating_mul(s.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
+ // Measured: `703 + s * (37 ±0)`
+ // Estimated: `6723`
+ // Minimum execution time: 14_093_000 picoseconds.
+ Weight::from_parts(16_125_177, 6723)
+ // Standard Error: 146
+ .saturating_add(Weight::from_parts(39_270, 0).saturating_mul(s.into()))
+ .saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
}
@@ -413,10 +415,10 @@
// Proof Size summary in bytes:
// Measured: `31 + r * (57 ±0)`
// Estimated: `2626`
- // Minimum execution time: 9_094_000 picoseconds.
- Weight::from_parts(10_431_627, 2626)
- // Standard Error: 1_046
- .saturating_add(Weight::from_parts(99_468, 0).saturating_mul(r.into()))
+ // Minimum execution time: 6_759_000 picoseconds.
+ Weight::from_parts(7_254_560, 2626)
+ // Standard Error: 231
+ .saturating_add(Weight::from_parts(64_513, 0).saturating_mul(r.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -428,12 +430,12 @@
// Proof Size summary in bytes:
// Measured: `441 + r * (5 ±0)`
// Estimated: `11003`
- // Minimum execution time: 18_662_000 picoseconds.
- Weight::from_parts(17_939_760, 11003)
- // Standard Error: 2_371
- .saturating_add(Weight::from_parts(22_184, 0).saturating_mul(r.into()))
- // Standard Error: 462
- .saturating_add(Weight::from_parts(151_368, 0).saturating_mul(x.into()))
+ // Minimum execution time: 14_134_000 picoseconds.
+ Weight::from_parts(12_591_985, 11003)
+ // Standard Error: 562
+ .saturating_add(Weight::from_parts(77_682, 0).saturating_mul(r.into()))
+ // Standard Error: 109
+ .saturating_add(Weight::from_parts(96_303, 0).saturating_mul(x.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -447,11 +449,11 @@
fn set_subs_new(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `100`
- // Estimated: `18716 + s * (2589 ±0)`
- // Minimum execution time: 6_921_000 picoseconds.
- Weight::from_parts(16_118_195, 18716)
- // Standard Error: 1_786
- .saturating_add(Weight::from_parts(1_350_155, 0).saturating_mul(s.into()))
+ // Estimated: `11003 + s * (2589 ±0)`
+ // Minimum execution time: 4_763_000 picoseconds.
+ Weight::from_parts(11_344_974, 11003)
+ // Standard Error: 401
+ .saturating_add(Weight::from_parts(1_141_028, 0).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(s.into())))
.saturating_add(RocksDbWeight::get().writes(1_u64))
@@ -468,11 +470,11 @@
fn set_subs_old(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + p * (32 ±0)`
- // Estimated: `17726`
- // Minimum execution time: 6_858_000 picoseconds.
- Weight::from_parts(16_222_054, 17726)
- // Standard Error: 1_409
- .saturating_add(Weight::from_parts(593_588, 0).saturating_mul(p.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 4_783_000 picoseconds.
+ Weight::from_parts(11_531_027, 11003)
+ // Standard Error: 369
+ .saturating_add(Weight::from_parts(542_102, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into())))
@@ -489,15 +491,15 @@
fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `468 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)`
- // Estimated: `17726`
- // Minimum execution time: 27_212_000 picoseconds.
- Weight::from_parts(19_030_840, 17726)
- // Standard Error: 3_118
- .saturating_add(Weight::from_parts(29_836, 0).saturating_mul(r.into()))
- // Standard Error: 608
- .saturating_add(Weight::from_parts(590_661, 0).saturating_mul(s.into()))
- // Standard Error: 608
- .saturating_add(Weight::from_parts(110_108, 0).saturating_mul(x.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 23_175_000 picoseconds.
+ Weight::from_parts(16_503_215, 11003)
+ // Standard Error: 625
+ .saturating_add(Weight::from_parts(1_175, 0).saturating_mul(r.into()))
+ // Standard Error: 122
+ .saturating_add(Weight::from_parts(533_184, 0).saturating_mul(s.into()))
+ // Standard Error: 122
+ .saturating_add(Weight::from_parts(94_600, 0).saturating_mul(x.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -511,13 +513,13 @@
fn request_judgement(r: u32, x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `366 + r * (57 ±0) + x * (66 ±0)`
- // Estimated: `13629`
- // Minimum execution time: 19_771_000 picoseconds.
- Weight::from_parts(18_917_892, 13629)
- // Standard Error: 1_957
- .saturating_add(Weight::from_parts(57_465, 0).saturating_mul(r.into()))
- // Standard Error: 381
- .saturating_add(Weight::from_parts(168_586, 0).saturating_mul(x.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 15_322_000 picoseconds.
+ Weight::from_parts(13_671_670, 11003)
+ // Standard Error: 722
+ .saturating_add(Weight::from_parts(73_665, 0).saturating_mul(r.into()))
+ // Standard Error: 140
+ .saturating_add(Weight::from_parts(124_598, 0).saturating_mul(x.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -529,12 +531,12 @@
// Proof Size summary in bytes:
// Measured: `397 + x * (66 ±0)`
// Estimated: `11003`
- // Minimum execution time: 17_411_000 picoseconds.
- Weight::from_parts(16_856_331, 11003)
- // Standard Error: 7_002
- .saturating_add(Weight::from_parts(34_389, 0).saturating_mul(r.into()))
- // Standard Error: 1_366
- .saturating_add(Weight::from_parts(165_686, 0).saturating_mul(x.into()))
+ // Minimum execution time: 13_268_000 picoseconds.
+ Weight::from_parts(12_489_352, 11003)
+ // Standard Error: 544
+ .saturating_add(Weight::from_parts(35_424, 0).saturating_mul(r.into()))
+ // Standard Error: 106
+ .saturating_add(Weight::from_parts(123_149, 0).saturating_mul(x.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -545,10 +547,10 @@
// Proof Size summary in bytes:
// Measured: `88 + r * (57 ±0)`
// Estimated: `2626`
- // Minimum execution time: 7_089_000 picoseconds.
- Weight::from_parts(7_750_487, 2626)
- // Standard Error: 1_625
- .saturating_add(Weight::from_parts(101_135, 0).saturating_mul(r.into()))
+ // Minimum execution time: 4_845_000 picoseconds.
+ Weight::from_parts(5_147_478, 2626)
+ // Standard Error: 169
+ .saturating_add(Weight::from_parts(55_561, 0).saturating_mul(r.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -559,10 +561,10 @@
// Proof Size summary in bytes:
// Measured: `88 + r * (57 ±0)`
// Estimated: `2626`
- // Minimum execution time: 6_300_000 picoseconds.
- Weight::from_parts(6_836_140, 2626)
- // Standard Error: 655
- .saturating_add(Weight::from_parts(102_284, 0).saturating_mul(r.into()))
+ // Minimum execution time: 4_191_000 picoseconds.
+ Weight::from_parts(4_478_351, 2626)
+ // Standard Error: 138
+ .saturating_add(Weight::from_parts(53_627, 0).saturating_mul(r.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -573,10 +575,10 @@
// Proof Size summary in bytes:
// Measured: `88 + r * (57 ±0)`
// Estimated: `2626`
- // Minimum execution time: 6_257_000 picoseconds.
- Weight::from_parts(6_917_052, 2626)
- // Standard Error: 2_628
- .saturating_add(Weight::from_parts(71_362, 0).saturating_mul(r.into()))
+ // Minimum execution time: 4_003_000 picoseconds.
+ Weight::from_parts(4_303_365, 2626)
+ // Standard Error: 147
+ .saturating_add(Weight::from_parts(52_472, 0).saturating_mul(r.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -589,13 +591,13 @@
fn provide_judgement(r: u32, x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `444 + r * (57 ±0) + x * (66 ±0)`
- // Estimated: `13629`
- // Minimum execution time: 16_021_000 picoseconds.
- Weight::from_parts(15_553_670, 13629)
- // Standard Error: 5_797
- .saturating_add(Weight::from_parts(42_423, 0).saturating_mul(r.into()))
- // Standard Error: 1_072
- .saturating_add(Weight::from_parts(252_721, 0).saturating_mul(x.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 11_465_000 picoseconds.
+ Weight::from_parts(10_326_049, 11003)
+ // Standard Error: 660
+ .saturating_add(Weight::from_parts(48_922, 0).saturating_mul(r.into()))
+ // Standard Error: 122
+ .saturating_add(Weight::from_parts(185_374, 0).saturating_mul(x.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -613,15 +615,15 @@
fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `665 + r * (12 ±0) + s * (32 ±0) + x * (66 ±0)`
- // Estimated: `23922`
- // Minimum execution time: 40_801_000 picoseconds.
- Weight::from_parts(34_079_397, 23922)
- // Standard Error: 3_750
- .saturating_add(Weight::from_parts(31_496, 0).saturating_mul(r.into()))
- // Standard Error: 732
- .saturating_add(Weight::from_parts(599_691, 0).saturating_mul(s.into()))
- // Standard Error: 732
- .saturating_add(Weight::from_parts(101_683, 0).saturating_mul(x.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 34_933_000 picoseconds.
+ Weight::from_parts(28_994_022, 11003)
+ // Standard Error: 668
+ .saturating_add(Weight::from_parts(21_722, 0).saturating_mul(r.into()))
+ // Standard Error: 130
+ .saturating_add(Weight::from_parts(540_580, 0).saturating_mul(s.into()))
+ // Standard Error: 130
+ .saturating_add(Weight::from_parts(89_348, 0).saturating_mul(x.into()))
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into())))
@@ -634,12 +636,12 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_412_000 picoseconds.
- Weight::from_parts(4_592_000, 0)
- // Standard Error: 703_509
- .saturating_add(Weight::from_parts(43_647_925, 0).saturating_mul(x.into()))
- // Standard Error: 117_043
- .saturating_add(Weight::from_parts(9_312_431, 0).saturating_mul(n.into()))
+ // Minimum execution time: 2_770_000 picoseconds.
+ Weight::from_parts(2_875_000, 0)
+ // Standard Error: 281_295
+ .saturating_add(Weight::from_parts(37_513_186, 0).saturating_mul(x.into()))
+ // Standard Error: 46_799
+ .saturating_add(Weight::from_parts(7_949_936, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
}
/// Storage: Identity SubsOf (r:600 w:0)
@@ -652,12 +654,12 @@
// Proof Size summary in bytes:
// Measured: `41`
// Estimated: `990 + n * (5733 ±0)`
- // Minimum execution time: 3_824_000 picoseconds.
- Weight::from_parts(3_950_000, 990)
- // Standard Error: 2_864
- .saturating_add(Weight::from_parts(55_678, 0).saturating_mul(x.into()))
- // Standard Error: 476
- .saturating_add(Weight::from_parts(1_138_349, 0).saturating_mul(n.into()))
+ // Minimum execution time: 2_751_000 picoseconds.
+ Weight::from_parts(2_862_000, 990)
+ // Standard Error: 953
+ .saturating_add(Weight::from_parts(28_947, 0).saturating_mul(x.into()))
+ // Standard Error: 158
+ .saturating_add(Weight::from_parts(994_085, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 5733).saturating_mul(n.into()))
@@ -672,12 +674,12 @@
// Proof Size summary in bytes:
// Measured: `41`
// Estimated: `990 + n * (5733 ±0)`
- // Minimum execution time: 4_196_000 picoseconds.
- Weight::from_parts(4_340_000, 990)
- // Standard Error: 2_081_979
- .saturating_add(Weight::from_parts(130_653_903, 0).saturating_mul(s.into()))
- // Standard Error: 346_381
- .saturating_add(Weight::from_parts(23_046_001, 0).saturating_mul(n.into()))
+ // Minimum execution time: 2_671_000 picoseconds.
+ Weight::from_parts(2_814_000, 990)
+ // Standard Error: 785_159
+ .saturating_add(Weight::from_parts(109_659_566, 0).saturating_mul(s.into()))
+ // Standard Error: 130_628
+ .saturating_add(Weight::from_parts(19_169_269, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -693,11 +695,11 @@
fn add_sub(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `474 + s * (36 ±0)`
- // Estimated: `21305`
- // Minimum execution time: 15_289_000 picoseconds.
- Weight::from_parts(21_319_844, 21305)
- // Standard Error: 893
- .saturating_add(Weight::from_parts(53_159, 0).saturating_mul(s.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 12_571_000 picoseconds.
+ Weight::from_parts(16_366_301, 11003)
+ // Standard Error: 217
+ .saturating_add(Weight::from_parts(42_542, 0).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -709,11 +711,11 @@
fn rename_sub(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `590 + s * (3 ±0)`
- // Estimated: `14582`
- // Minimum execution time: 9_867_000 picoseconds.
- Weight::from_parts(12_546_245, 14582)
- // Standard Error: 509
- .saturating_add(Weight::from_parts(10_078, 0).saturating_mul(s.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 7_278_000 picoseconds.
+ Weight::from_parts(9_227_799, 11003)
+ // Standard Error: 104
+ .saturating_add(Weight::from_parts(14_014, 0).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -727,11 +729,11 @@
fn remove_sub(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `637 + s * (35 ±0)`
- // Estimated: `21305`
- // Minimum execution time: 19_299_000 picoseconds.
- Weight::from_parts(24_125_576, 21305)
- // Standard Error: 1_479
- .saturating_add(Weight::from_parts(22_611, 0).saturating_mul(s.into()))
+ // Estimated: `11003`
+ // Minimum execution time: 15_771_000 picoseconds.
+ Weight::from_parts(18_105_475, 11003)
+ // Standard Error: 129
+ .saturating_add(Weight::from_parts(32_074, 0).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -739,16 +741,18 @@
/// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen)
/// Storage: Identity SubsOf (r:1 w:1)
/// Proof: Identity SubsOf (max_values: None, max_size: Some(3258), added: 5733, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:0)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
/// The range of component `s` is `[0, 99]`.
fn quit_sub(s: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `563 + s * (37 ±0)`
- // Estimated: `10302`
- // Minimum execution time: 14_183_000 picoseconds.
- Weight::from_parts(17_343_547, 10302)
- // Standard Error: 454
- .saturating_add(Weight::from_parts(45_925, 0).saturating_mul(s.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
+ // Measured: `703 + s * (37 ±0)`
+ // Estimated: `6723`
+ // Minimum execution time: 14_093_000 picoseconds.
+ Weight::from_parts(16_125_177, 6723)
+ // Standard Error: 146
+ .saturating_add(Weight::from_parts(39_270, 0).saturating_mul(s.into()))
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
}
pallets/maintenance/src/weights.rsdiffbeforeafterboth--- a/pallets/maintenance/src/weights.rs
+++ b/pallets/maintenance/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_maintenance
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/maintenance/src/weights.rs
@@ -47,8 +47,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_407_000 picoseconds.
- Weight::from_parts(4_556_000, 0)
+ // Minimum execution time: 3_015_000 picoseconds.
+ Weight::from_parts(3_184_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Maintenance Enabled (r:0 w:1)
@@ -57,8 +57,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 5_868_000 picoseconds.
- Weight::from_parts(6_100_000, 0)
+ // Minimum execution time: 2_976_000 picoseconds.
+ Weight::from_parts(3_111_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Preimage StatusFor (r:1 w:0)
@@ -68,9 +68,9 @@
fn execute_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `209`
- // Estimated: `7230`
- // Minimum execution time: 14_046_000 picoseconds.
- Weight::from_parts(14_419_000, 7230)
+ // Estimated: `3674`
+ // Minimum execution time: 7_359_000 picoseconds.
+ Weight::from_parts(7_613_000, 3674)
.saturating_add(T::DbWeight::get().reads(2_u64))
}
}
@@ -83,8 +83,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_407_000 picoseconds.
- Weight::from_parts(4_556_000, 0)
+ // Minimum execution time: 3_015_000 picoseconds.
+ Weight::from_parts(3_184_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Maintenance Enabled (r:0 w:1)
@@ -93,8 +93,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 5_868_000 picoseconds.
- Weight::from_parts(6_100_000, 0)
+ // Minimum execution time: 2_976_000 picoseconds.
+ Weight::from_parts(3_111_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Preimage StatusFor (r:1 w:0)
@@ -104,9 +104,9 @@
fn execute_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `209`
- // Estimated: `7230`
- // Minimum execution time: 14_046_000 picoseconds.
- Weight::from_parts(14_419_000, 7230)
+ // Estimated: `3674`
+ // Minimum execution time: 7_359_000 picoseconds.
+ Weight::from_parts(7_613_000, 3674)
.saturating_add(RocksDbWeight::get().reads(2_u64))
}
}
pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -20,7 +20,9 @@
use frame_benchmarking::{benchmarks, account};
use pallet_common::{
bench_init,
- benchmarking::{create_collection_raw, property_key, property_value},
+ benchmarking::{
+ create_collection_raw, property_key, property_value, load_is_admin_and_property_permissions,
+ },
CommonCollectionOperations,
};
use sp_std::prelude::*;
@@ -198,8 +200,49 @@
value: property_value(),
}).collect::<Vec<_>>();
let item = create_max_item(&collection, &owner, owner.clone())?;
- }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), SetPropertyMode::ExistingToken, &Unlimited)?}
+ }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), &Unlimited)?}
+
+ init_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_token_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())?;
+
+ let (is_collection_admin, property_permissions) = load_is_admin_and_property_permissions(&collection, &owner);
+ }: {
+ let mut property_writer = pallet_common::collection_info_loaded_property_writer(
+ &collection,
+ is_collection_admin,
+ property_permissions,
+ );
+
+ property_writer.write_token_properties(
+ true,
+ item,
+ props.into_iter(),
+ crate::erc::ERC721TokenEvent::TokenChanged {
+ token_id: item.into(),
+ }
+ .to_log(T::ContractAddress::get()),
+ )?
+ }
+
delete_token_properties {
let b in 0..MAX_PROPERTIES_PER_ITEM;
bench_init!{
@@ -220,7 +263,7 @@
value: property_value(),
}).collect::<Vec<_>>();
let item = create_max_item(&collection, &owner, owner.clone())?;
- <Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), SetPropertyMode::ExistingToken, &Unlimited)?;
+ <Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), &Unlimited)?;
let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
}: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -23,47 +23,40 @@
};
use pallet_common::{
CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
- weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf,
+ weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf, init_token_properties_delta,
};
+use pallet_structure::Pallet as PalletStructure;
use sp_runtime::DispatchError;
use sp_std::{vec::Vec, vec};
use crate::{
AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,
- SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted,
+ SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted, TokenProperties,
};
pub struct CommonWeights<T: Config>(PhantomData<T>);
impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {
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)
- + t.iter()
- .filter_map(|t| {
- if t.properties.len() > 0 {
- Some(Self::set_token_properties(t.properties.len() as u32))
- } else {
- None
- }
- })
- .fold(Weight::zero(), |a, b| a.saturating_add(b))
- }
+ CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32)
+ .saturating_add(init_token_properties_delta::<T, _>(
+ t.iter().map(|t| t.properties.len() as u32),
+ <SelfWeightOf<T>>::init_token_properties,
+ )),
_ => Weight::zero(),
}
}
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,
- })
- .fold(Weight::zero(), |a, b| a.saturating_add(b))
+ <SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(
+ init_token_properties_delta::<T, _>(
+ data.iter().map(|t| match t {
+ up_data_structs::CreateItemData::NFT(n) => n.properties.len() as u32,
+ _ => 0,
+ }),
+ <SelfWeightOf<T>>::init_token_properties,
+ ),
+ )
}
fn burn_item() -> Weight {
@@ -245,7 +238,6 @@
&sender,
token_id,
properties.into_iter(),
- pallet_common::SetPropertyMode::ExistingToken,
nesting_budget,
),
weight,
@@ -273,6 +265,17 @@
)
}
+ fn get_token_properties_raw(
+ &self,
+ token_id: TokenId,
+ ) -> Option<up_data_structs::TokenProperties> {
+ <TokenProperties<T>>::get((self.id, token_id))
+ }
+
+ fn set_token_properties_raw(&self, token_id: TokenId, map: up_data_structs::TokenProperties) {
+ <TokenProperties<T>>::insert((self.id, token_id), map)
+ }
+
fn set_token_property_permissions(
&self,
sender: &T::CrossAccountId,
@@ -457,19 +460,36 @@
.ok_or(TokenOwnerError::NotFound)
}
+ fn check_token_indirect_owner(
+ &self,
+ token: TokenId,
+ maybe_owner: &T::CrossAccountId,
+ nesting_budget: &dyn Budget,
+ ) -> Result<bool, DispatchError> {
+ <PalletStructure<T>>::check_indirectly_owned(
+ maybe_owner.clone(),
+ self.id,
+ token,
+ None,
+ nesting_budget,
+ )
+ }
+
/// Returns token owners.
fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {
self.token_owner(token).map_or_else(|_| vec![], |t| vec![t])
}
fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue> {
- <Pallet<T>>::token_properties((self.id, token_id))
+ <Pallet<T>>::token_properties((self.id, token_id))?
.get(key)
.cloned()
}
fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {
- let properties = <Pallet<T>>::token_properties((self.id, token_id));
+ let Some(properties) = <Pallet<T>>::token_properties((self.id, token_id)) else {
+ return vec![];
+ };
keys.map(|keys| {
keys.into_iter()
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -203,7 +203,6 @@
&caller,
TokenId(token_id),
properties.into_iter(),
- pallet_common::SetPropertyMode::ExistingToken,
&nesting_budget,
)
.map_err(dispatch_to_evm::<T>)
@@ -273,7 +272,8 @@
.try_into()
.map_err(|_| "key too long")?;
- let props = <TokenProperties<T>>::get((self.id, token_id));
+ let props =
+ <TokenProperties<T>>::get((self.id, token_id)).ok_or("token properties not found")?;
let prop = props.get(&key).ok_or("key not found")?;
Ok(prop.to_vec().into())
@@ -367,7 +367,7 @@
.transpose()
.map_err(|e| {
Error::Revert(alloc::format!(
- "Can not convert value \"baseURI\" to string with error \"{e}\""
+ "can not convert value \"baseURI\" to string with error \"{e}\""
))
})?;
@@ -658,7 +658,7 @@
let key = key::url();
let permission = get_token_permission::<T>(self.id, &key)?;
if !permission.collection_admin {
- return Err("Operation is not allowed".into());
+ return Err("operation is not allowed".into());
}
let caller = T::CrossAccountId::from_eth(caller);
@@ -685,7 +685,7 @@
.try_into()
.map_err(|_| "token uri is too long")?,
})
- .map_err(|e| Error::Revert(alloc::format!("Can't add property: {e:?}")))?;
+ .map_err(|e| Error::Revert(alloc::format!("can't add property: {e:?}")))?;
<Pallet<T>>::create_item(
self,
@@ -708,12 +708,12 @@
) -> Result<String> {
collection.consume_store_reads(1)?;
let properties = <TokenProperties<T>>::try_get((collection.id, token_id))
- .map_err(|_| Error::Revert("Token properties not found".into()))?;
+ .map_err(|_| Error::Revert("token properties not found".into()))?;
if let Some(property) = properties.get(key) {
return Ok(String::from_utf8_lossy(property).into());
}
- Err("Property tokenURI not found".into())
+ Err("property tokenURI not found".into())
}
fn get_token_permission<T: Config>(
@@ -721,13 +721,13 @@
key: &PropertyKey,
) -> Result<PropertyPermission> {
let token_property_permissions = CollectionPropertyPermissions::<T>::try_get(collection_id)
- .map_err(|_| Error::Revert("No permissions for collection".into()))?;
+ .map_err(|_| Error::Revert("no permissions for collection".into()))?;
let a = token_property_permissions
.get(key)
.map(Clone::clone)
.ok_or_else(|| {
let key = String::from_utf8(key.clone().into_inner()).unwrap_or_default();
- Error::Revert(alloc::format!("No permission for key {key}"))
+ Error::Revert(alloc::format!("no permission for key {key}"))
})?;
Ok(a)
}
@@ -1058,7 +1058,7 @@
.try_into()
.map_err(|_| "token uri is too long")?,
})
- .map_err(|e| Error::Revert(alloc::format!("Can't add property: {e:?}")))?;
+ .map_err(|e| Error::Revert(alloc::format!("can't add property: {e:?}")))?;
data.push(CreateItemData::<T> {
properties,
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -102,14 +102,14 @@
use up_data_structs::{
AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
mapping::TokenAddressMapping, budget::Budget, Property, PropertyKey, PropertyValue,
- PropertyKeyPermission, PropertyScope, TrySetProperty, TokenChild, AuxPropertyValue,
- PropertiesPermissionMap, TokenProperties as TokenPropertiesT,
+ PropertyKeyPermission, PropertyScope, TokenChild, AuxPropertyValue, PropertiesPermissionMap,
+ TokenProperties as TokenPropertiesT,
};
use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
use pallet_common::{
Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, CollectionHandle,
eth::collection_id_to_address, SelfWeightOf as PalletCommonWeightOf,
- weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info, SetPropertyMode,
+ weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info,
};
use pallet_structure::{Pallet as PalletStructure, Error as StructureError};
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
@@ -201,7 +201,7 @@
pub type TokenProperties<T: Config> = StorageNMap<
Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
Value = TokenPropertiesT,
- QueryKind = ValueQuery,
+ QueryKind = OptionQuery,
>;
/// Custom data of a token that is serialized to bytes,
@@ -340,38 +340,6 @@
/// - `token`: Token ID.
pub fn token_exists(collection: &NonfungibleHandle<T>, token: TokenId) -> bool {
<TokenData<T>>::contains_key((collection.id, token))
- }
-
- /// Set the token property with the scope.
- ///
- /// - `property`: Contains key-value pair.
- pub fn set_scoped_token_property(
- collection_id: CollectionId,
- token_id: TokenId,
- scope: PropertyScope,
- property: Property,
- ) -> DispatchResult {
- TokenProperties::<T>::try_mutate((collection_id, token_id), |properties| {
- properties.try_scoped_set(scope, property.key, property.value)
- })
- .map_err(<CommonError<T>>::from)?;
-
- Ok(())
- }
-
- /// Batch operation to set multiple properties with the same scope.
- pub fn set_scoped_token_properties(
- collection_id: CollectionId,
- token_id: TokenId,
- scope: PropertyScope,
- properties: impl Iterator<Item = Property>,
- ) -> DispatchResult {
- TokenProperties::<T>::try_mutate((collection_id, token_id), |stored_properties| {
- stored_properties.try_scoped_set_from_iter(scope, properties)
- })
- .map_err(<CommonError<T>>::from)?;
-
- Ok(())
}
/// Add or edit auxiliary data for the property.
@@ -598,42 +566,16 @@
sender: &T::CrossAccountId,
token_id: TokenId,
properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,
- mode: SetPropertyMode,
nesting_budget: &dyn Budget,
) -> DispatchResult {
- let mut is_token_owner = pallet_common::LazyValue::new(|| {
- if let SetPropertyMode::NewToken {
- mint_target_is_sender,
- } = mode
- {
- return Ok(mint_target_is_sender);
- }
-
- let is_owned = <PalletStructure<T>>::check_indirectly_owned(
- sender.clone(),
- collection.id,
- token_id,
- None,
- nesting_budget,
- )?;
-
- Ok(is_owned)
- });
+ let mut property_writer =
+ pallet_common::property_writer_for_existing_token(collection, sender);
- let mut is_token_exist =
- pallet_common::LazyValue::new(|| Self::token_exists(collection, token_id));
-
- let stored_properties = <TokenProperties<T>>::get((collection.id, token_id));
-
- <PalletCommon<T>>::modify_token_properties(
- collection,
+ property_writer.write_token_properties(
sender,
token_id,
- &mut is_token_exist,
properties_updates,
- stored_properties,
- &mut is_token_owner,
- |properties| <TokenProperties<T>>::set((collection.id, token_id), properties),
+ nesting_budget,
erc::ERC721TokenEvent::TokenChanged {
token_id: token_id.into(),
}
@@ -664,7 +606,6 @@
sender: &T::CrossAccountId,
token_id: TokenId,
properties: impl Iterator<Item = Property>,
- mode: SetPropertyMode,
nesting_budget: &dyn Budget,
) -> DispatchResult {
Self::modify_token_properties(
@@ -672,7 +613,6 @@
sender,
token_id,
properties.map(|p| (p.key, Some(p.value))),
- mode,
nesting_budget,
)
}
@@ -694,7 +634,6 @@
sender,
token_id,
[property].into_iter(),
- SetPropertyMode::ExistingToken,
nesting_budget,
)
}
@@ -716,7 +655,6 @@
sender,
token_id,
property_keys.into_iter().map(|key| (key, None)),
- SetPropertyMode::ExistingToken,
nesting_budget,
)
}
@@ -978,6 +916,8 @@
// =========
+ let mut property_writer = pallet_common::property_writer_for_new_token(collection, sender);
+
with_transaction(|| {
for (i, data) in data.iter().enumerate() {
let token = first_token + i as u32 + 1;
@@ -990,21 +930,22 @@
},
);
+ let token = TokenId(token);
+
<PalletStructure<T>>::nest_if_sent_to_token_unchecked(
&data.owner,
collection.id,
- TokenId(token),
+ token,
);
- if let Err(e) = Self::set_token_properties(
- collection,
- sender,
- TokenId(token),
+ if let Err(e) = property_writer.write_token_properties(
+ sender.conv_eq(&data.owner),
+ token,
data.properties.clone().into_iter(),
- SetPropertyMode::NewToken {
- mint_target_is_sender: sender.conv_eq(&data.owner),
- },
- nesting_budget,
+ erc::ERC721TokenEvent::TokenChanged {
+ token_id: token.into(),
+ }
+ .to_log(T::ContractAddress::get()),
) {
return TransactionOutcome::Rollback(Err(e));
}
@@ -1421,7 +1362,9 @@
pub fn repair_item(collection: &NonfungibleHandle<T>, token: TokenId) -> DispatchResult {
<TokenProperties<T>>::mutate((collection.id, token), |properties| {
- properties.recompute_consumed_space();
+ if let Some(properties) = properties {
+ properties.recompute_consumed_space();
+ }
});
Ok(())
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_nonfungible
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/nonfungible/src/weights.rs
@@ -46,6 +46,7 @@
fn burn_from() -> Weight;
fn set_token_property_permissions(b: u32, ) -> Weight;
fn set_token_properties(b: u32, ) -> Weight;
+ fn init_token_properties(b: u32, ) -> Weight;
fn delete_token_properties(b: u32, ) -> Weight;
fn token_owner() -> Weight;
fn set_allowance_for_all() -> Weight;
@@ -60,31 +61,23 @@
/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Nonfungible AccountBalance (r:1 w:1)
/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Nonfungible TokenData (r:0 w:1)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
/// Storage: Nonfungible Owned (r:0 w:1)
/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn create_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `390`
- // Estimated: `63471`
- // Minimum execution time: 25_892_000 picoseconds.
- Weight::from_parts(26_424_000, 63471)
- .saturating_add(T::DbWeight::get().reads(4_u64))
- .saturating_add(T::DbWeight::get().writes(5_u64))
+ // Measured: `142`
+ // Estimated: `3530`
+ // Minimum execution time: 9_726_000 picoseconds.
+ Weight::from_parts(10_059_000, 3530)
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ .saturating_add(T::DbWeight::get().writes(4_u64))
}
/// Storage: Nonfungible TokensMinted (r:1 w:1)
/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Nonfungible AccountBalance (r:1 w:1)
/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:200 w:200)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Nonfungible TokenData (r:0 w:200)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
/// Storage: Nonfungible Owned (r:0 w:200)
@@ -92,26 +85,20 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `390`
- // Estimated: `28192 + b * (35279 ±0)`
- // Minimum execution time: 4_612_000 picoseconds.
- Weight::from_parts(6_399_460, 28192)
- // Standard Error: 5_119
- .saturating_add(Weight::from_parts(7_230_389, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(3_u64))
- .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
+ // Measured: `142`
+ // Estimated: `3530`
+ // Minimum execution time: 3_270_000 picoseconds.
+ Weight::from_parts(3_693_659, 3530)
+ // Standard Error: 255
+ .saturating_add(Weight::from_parts(3_024_284, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
- .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 35279).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into())))
}
/// Storage: Nonfungible TokensMinted (r:1 w:1)
/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Nonfungible AccountBalance (r:200 w:200)
/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:200 w:200)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Nonfungible TokenData (r:0 w:200)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
/// Storage: Nonfungible Owned (r:0 w:200)
@@ -119,17 +106,17 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `390`
- // Estimated: `25652 + b * (37819 ±0)`
- // Minimum execution time: 4_538_000 picoseconds.
- Weight::from_parts(4_686_000, 25652)
- // Standard Error: 3_518
- .saturating_add(Weight::from_parts(8_905_771, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
- .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(b.into())))
+ // Measured: `142`
+ // Estimated: `3481 + b * (2540 ±0)`
+ // Minimum execution time: 3_188_000 picoseconds.
+ Weight::from_parts(3_307_000, 3481)
+ // Standard Error: 567
+ .saturating_add(Weight::from_parts(4_320_449, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
- .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 37819).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
+ .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
/// Storage: Nonfungible TokenData (r:1 w:1)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
@@ -148,9 +135,9 @@
fn burn_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
- // Estimated: `17561`
- // Minimum execution time: 24_230_000 picoseconds.
- Weight::from_parts(24_672_000, 17561)
+ // Estimated: `3530`
+ // Minimum execution time: 18_062_000 picoseconds.
+ Weight::from_parts(18_433_000, 3530)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -171,9 +158,9 @@
fn burn_recursively_self_raw() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
- // Estimated: `17561`
- // Minimum execution time: 30_521_000 picoseconds.
- Weight::from_parts(31_241_000, 17561)
+ // Estimated: `3530`
+ // Minimum execution time: 22_942_000 picoseconds.
+ Weight::from_parts(23_527_000, 3530)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -196,17 +183,17 @@
/// The range of component `b` is `[0, 200]`.
fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `1467 + b * (58 ±0)`
- // Estimated: `24230 + b * (10097 ±0)`
- // Minimum execution time: 31_734_000 picoseconds.
- Weight::from_parts(32_162_000, 24230)
- // Standard Error: 210_514
- .saturating_add(Weight::from_parts(71_382_804, 0).saturating_mul(b.into()))
+ // Measured: `1500 + b * (58 ±0)`
+ // Estimated: `5874 + b * (5032 ±0)`
+ // Minimum execution time: 22_709_000 picoseconds.
+ Weight::from_parts(23_287_000, 5874)
+ // Standard Error: 89_471
+ .saturating_add(Weight::from_parts(63_285_201, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(6_u64))
.saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 10097).saturating_mul(b.into()))
+ .saturating_add(Weight::from_parts(0, 5032).saturating_mul(b.into()))
}
/// Storage: Nonfungible TokenData (r:1 w:1)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
@@ -219,9 +206,9 @@
fn transfer_raw() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
- // Estimated: `13114`
- // Minimum execution time: 18_305_000 picoseconds.
- Weight::from_parts(18_859_000, 13114)
+ // Estimated: `6070`
+ // Minimum execution time: 13_652_000 picoseconds.
+ Weight::from_parts(13_981_000, 6070)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -232,9 +219,9 @@
fn approve() -> Weight {
// Proof Size summary in bytes:
// Measured: `326`
- // Estimated: `7044`
- // Minimum execution time: 10_977_000 picoseconds.
- Weight::from_parts(11_184_000, 7044)
+ // Estimated: `3522`
+ // Minimum execution time: 7_837_000 picoseconds.
+ Weight::from_parts(8_113_000, 3522)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -245,9 +232,9 @@
fn approve_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `313`
- // Estimated: `7044`
- // Minimum execution time: 11_456_000 picoseconds.
- Weight::from_parts(11_731_000, 7044)
+ // Estimated: `3522`
+ // Minimum execution time: 7_769_000 picoseconds.
+ Weight::from_parts(7_979_000, 3522)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -257,8 +244,8 @@
// Proof Size summary in bytes:
// Measured: `362`
// Estimated: `3522`
- // Minimum execution time: 5_771_000 picoseconds.
- Weight::from_parts(5_972_000, 3522)
+ // Minimum execution time: 4_194_000 picoseconds.
+ Weight::from_parts(4_353_000, 3522)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible Allowance (r:1 w:1)
@@ -278,9 +265,9 @@
fn burn_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `463`
- // Estimated: `17561`
- // Minimum execution time: 30_633_000 picoseconds.
- Weight::from_parts(31_136_000, 17561)
+ // Estimated: `3530`
+ // Minimum execution time: 21_978_000 picoseconds.
+ Weight::from_parts(22_519_000, 3530)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
@@ -289,45 +276,62 @@
/// The range of component `b` is `[0, 64]`.
fn set_token_property_permissions(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `281`
+ // Measured: `314`
// Estimated: `20191`
- // Minimum execution time: 2_300_000 picoseconds.
- Weight::from_parts(2_382_000, 20191)
- // Standard Error: 45_076
- .saturating_add(Weight::from_parts(12_000_777, 0).saturating_mul(b.into()))
+ // Minimum execution time: 1_457_000 picoseconds.
+ Weight::from_parts(1_563_000, 20191)
+ // Standard Error: 14_041
+ .saturating_add(Weight::from_parts(8_452_415, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
+ /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
+ /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Nonfungible TokenProperties (r:1 w:1)
/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ /// Storage: Nonfungible TokenData (r:1 w:0)
+ /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 64]`.
fn set_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `584 + b * (261 ±0)`
- // Estimated: `56460`
- // Minimum execution time: 12_422_000 picoseconds.
- Weight::from_parts(5_523_689, 56460)
- // Standard Error: 74_137
- .saturating_add(Weight::from_parts(6_320_501, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
+ // Measured: `640 + b * (261 ±0)`
+ // Estimated: `36269`
+ // Minimum execution time: 963_000 picoseconds.
+ Weight::from_parts(1_126_511, 36269)
+ // Standard Error: 9_175
+ .saturating_add(Weight::from_parts(5_096_011, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
+ /// Storage: Nonfungible TokenProperties (r:0 w:1)
/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// The range of component `b` is `[0, 64]`.
+ fn init_token_properties(b: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 194_000 picoseconds.
+ Weight::from_parts(222_000, 0)
+ // Standard Error: 7_295
+ .saturating_add(Weight::from_parts(4_499_463, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ /// Storage: Nonfungible TokenData (r:1 w:0)
+ /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+ /// Storage: Nonfungible TokenProperties (r:1 w:1)
+ /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 64]`.
fn delete_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `589 + b * (33291 ±0)`
- // Estimated: `56460`
- // Minimum execution time: 12_006_000 picoseconds.
- Weight::from_parts(12_216_000, 56460)
- // Standard Error: 83_431
- .saturating_add(Weight::from_parts(24_556_999, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
+ // Measured: `699 + b * (33291 ±0)`
+ // Estimated: `36269`
+ // Minimum execution time: 992_000 picoseconds.
+ Weight::from_parts(1_043_000, 36269)
+ // Standard Error: 37_370
+ .saturating_add(Weight::from_parts(23_672_870, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Nonfungible TokenData (r:1 w:0)
@@ -336,8 +340,8 @@
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `3522`
- // Minimum execution time: 4_827_000 picoseconds.
- Weight::from_parts(4_984_000, 3522)
+ // Minimum execution time: 3_743_000 picoseconds.
+ Weight::from_parts(3_908_000, 3522)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible CollectionAllowance (r:0 w:1)
@@ -346,28 +350,28 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 6_151_000 picoseconds.
- Weight::from_parts(6_394_000, 0)
+ // Minimum execution time: 4_106_000 picoseconds.
+ Weight::from_parts(4_293_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Nonfungible CollectionAllowance (r:1 w:0)
/// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
fn allowance_for_all() -> Weight {
// Proof Size summary in bytes:
- // Measured: `109`
+ // Measured: `142`
// Estimated: `3576`
- // Minimum execution time: 3_791_000 picoseconds.
- Weight::from_parts(3_950_000, 3576)
+ // Minimum execution time: 2_775_000 picoseconds.
+ Weight::from_parts(2_923_000, 3576)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible TokenProperties (r:1 w:1)
/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
fn repair_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `300`
+ // Measured: `279`
// Estimated: `36269`
- // Minimum execution time: 5_364_000 picoseconds.
- Weight::from_parts(5_539_000, 36269)
+ // Minimum execution time: 3_033_000 picoseconds.
+ Weight::from_parts(3_174_000, 36269)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -379,31 +383,23 @@
/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Nonfungible AccountBalance (r:1 w:1)
/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Nonfungible TokenData (r:0 w:1)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
/// Storage: Nonfungible Owned (r:0 w:1)
/// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn create_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `390`
- // Estimated: `63471`
- // Minimum execution time: 25_892_000 picoseconds.
- Weight::from_parts(26_424_000, 63471)
- .saturating_add(RocksDbWeight::get().reads(4_u64))
- .saturating_add(RocksDbWeight::get().writes(5_u64))
+ // Measured: `142`
+ // Estimated: `3530`
+ // Minimum execution time: 9_726_000 picoseconds.
+ Weight::from_parts(10_059_000, 3530)
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ .saturating_add(RocksDbWeight::get().writes(4_u64))
}
/// Storage: Nonfungible TokensMinted (r:1 w:1)
/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Nonfungible AccountBalance (r:1 w:1)
/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:200 w:200)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Nonfungible TokenData (r:0 w:200)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
/// Storage: Nonfungible Owned (r:0 w:200)
@@ -411,26 +407,20 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `390`
- // Estimated: `28192 + b * (35279 ±0)`
- // Minimum execution time: 4_612_000 picoseconds.
- Weight::from_parts(6_399_460, 28192)
- // Standard Error: 5_119
- .saturating_add(Weight::from_parts(7_230_389, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(3_u64))
- .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
+ // Measured: `142`
+ // Estimated: `3530`
+ // Minimum execution time: 3_270_000 picoseconds.
+ Weight::from_parts(3_693_659, 3530)
+ // Standard Error: 255
+ .saturating_add(Weight::from_parts(3_024_284, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
- .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 35279).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into())))
}
/// Storage: Nonfungible TokensMinted (r:1 w:1)
/// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Nonfungible AccountBalance (r:200 w:200)
/// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:200 w:200)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Nonfungible TokenData (r:0 w:200)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
/// Storage: Nonfungible Owned (r:0 w:200)
@@ -438,17 +428,17 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `390`
- // Estimated: `25652 + b * (37819 ±0)`
- // Minimum execution time: 4_538_000 picoseconds.
- Weight::from_parts(4_686_000, 25652)
- // Standard Error: 3_518
- .saturating_add(Weight::from_parts(8_905_771, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
- .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(b.into())))
+ // Measured: `142`
+ // Estimated: `3481 + b * (2540 ±0)`
+ // Minimum execution time: 3_188_000 picoseconds.
+ Weight::from_parts(3_307_000, 3481)
+ // Standard Error: 567
+ .saturating_add(Weight::from_parts(4_320_449, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
+ .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(1_u64))
- .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 37819).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
+ .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
/// Storage: Nonfungible TokenData (r:1 w:1)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
@@ -467,9 +457,9 @@
fn burn_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
- // Estimated: `17561`
- // Minimum execution time: 24_230_000 picoseconds.
- Weight::from_parts(24_672_000, 17561)
+ // Estimated: `3530`
+ // Minimum execution time: 18_062_000 picoseconds.
+ Weight::from_parts(18_433_000, 3530)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
@@ -490,9 +480,9 @@
fn burn_recursively_self_raw() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
- // Estimated: `17561`
- // Minimum execution time: 30_521_000 picoseconds.
- Weight::from_parts(31_241_000, 17561)
+ // Estimated: `3530`
+ // Minimum execution time: 22_942_000 picoseconds.
+ Weight::from_parts(23_527_000, 3530)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
@@ -515,17 +505,17 @@
/// The range of component `b` is `[0, 200]`.
fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `1467 + b * (58 ±0)`
- // Estimated: `24230 + b * (10097 ±0)`
- // Minimum execution time: 31_734_000 picoseconds.
- Weight::from_parts(32_162_000, 24230)
- // Standard Error: 210_514
- .saturating_add(Weight::from_parts(71_382_804, 0).saturating_mul(b.into()))
+ // Measured: `1500 + b * (58 ±0)`
+ // Estimated: `5874 + b * (5032 ±0)`
+ // Minimum execution time: 22_709_000 picoseconds.
+ Weight::from_parts(23_287_000, 5874)
+ // Standard Error: 89_471
+ .saturating_add(Weight::from_parts(63_285_201, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(6_u64))
.saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 10097).saturating_mul(b.into()))
+ .saturating_add(Weight::from_parts(0, 5032).saturating_mul(b.into()))
}
/// Storage: Nonfungible TokenData (r:1 w:1)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
@@ -538,9 +528,9 @@
fn transfer_raw() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
- // Estimated: `13114`
- // Minimum execution time: 18_305_000 picoseconds.
- Weight::from_parts(18_859_000, 13114)
+ // Estimated: `6070`
+ // Minimum execution time: 13_652_000 picoseconds.
+ Weight::from_parts(13_981_000, 6070)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
@@ -551,9 +541,9 @@
fn approve() -> Weight {
// Proof Size summary in bytes:
// Measured: `326`
- // Estimated: `7044`
- // Minimum execution time: 10_977_000 picoseconds.
- Weight::from_parts(11_184_000, 7044)
+ // Estimated: `3522`
+ // Minimum execution time: 7_837_000 picoseconds.
+ Weight::from_parts(8_113_000, 3522)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -564,9 +554,9 @@
fn approve_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `313`
- // Estimated: `7044`
- // Minimum execution time: 11_456_000 picoseconds.
- Weight::from_parts(11_731_000, 7044)
+ // Estimated: `3522`
+ // Minimum execution time: 7_769_000 picoseconds.
+ Weight::from_parts(7_979_000, 3522)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -576,8 +566,8 @@
// Proof Size summary in bytes:
// Measured: `362`
// Estimated: `3522`
- // Minimum execution time: 5_771_000 picoseconds.
- Weight::from_parts(5_972_000, 3522)
+ // Minimum execution time: 4_194_000 picoseconds.
+ Weight::from_parts(4_353_000, 3522)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible Allowance (r:1 w:1)
@@ -597,9 +587,9 @@
fn burn_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `463`
- // Estimated: `17561`
- // Minimum execution time: 30_633_000 picoseconds.
- Weight::from_parts(31_136_000, 17561)
+ // Estimated: `3530`
+ // Minimum execution time: 21_978_000 picoseconds.
+ Weight::from_parts(22_519_000, 3530)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
@@ -608,45 +598,62 @@
/// The range of component `b` is `[0, 64]`.
fn set_token_property_permissions(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `281`
+ // Measured: `314`
// Estimated: `20191`
- // Minimum execution time: 2_300_000 picoseconds.
- Weight::from_parts(2_382_000, 20191)
- // Standard Error: 45_076
- .saturating_add(Weight::from_parts(12_000_777, 0).saturating_mul(b.into()))
+ // Minimum execution time: 1_457_000 picoseconds.
+ Weight::from_parts(1_563_000, 20191)
+ // Standard Error: 14_041
+ .saturating_add(Weight::from_parts(8_452_415, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ /// Storage: Nonfungible TokenProperties (r:1 w:1)
+ /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: Nonfungible TokenData (r:1 w:0)
+ /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 64]`.
fn set_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `584 + b * (261 ±0)`
- // Estimated: `56460`
- // Minimum execution time: 12_422_000 picoseconds.
- Weight::from_parts(5_523_689, 56460)
- // Standard Error: 74_137
- .saturating_add(Weight::from_parts(6_320_501, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
+ // Measured: `640 + b * (261 ±0)`
+ // Estimated: `36269`
+ // Minimum execution time: 963_000 picoseconds.
+ Weight::from_parts(1_126_511, 36269)
+ // Standard Error: 9_175
+ .saturating_add(Weight::from_parts(5_096_011, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
+ /// Storage: Nonfungible TokenProperties (r:0 w:1)
/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// The range of component `b` is `[0, 64]`.
+ fn init_token_properties(b: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 194_000 picoseconds.
+ Weight::from_parts(222_000, 0)
+ // Standard Error: 7_295
+ .saturating_add(Weight::from_parts(4_499_463, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ /// Storage: Nonfungible TokenData (r:1 w:0)
+ /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+ /// Storage: Nonfungible TokenProperties (r:1 w:1)
+ /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 64]`.
fn delete_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `589 + b * (33291 ±0)`
- // Estimated: `56460`
- // Minimum execution time: 12_006_000 picoseconds.
- Weight::from_parts(12_216_000, 56460)
- // Standard Error: 83_431
- .saturating_add(Weight::from_parts(24_556_999, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
+ // Measured: `699 + b * (33291 ±0)`
+ // Estimated: `36269`
+ // Minimum execution time: 992_000 picoseconds.
+ Weight::from_parts(1_043_000, 36269)
+ // Standard Error: 37_370
+ .saturating_add(Weight::from_parts(23_672_870, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Nonfungible TokenData (r:1 w:0)
@@ -655,8 +662,8 @@
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `3522`
- // Minimum execution time: 4_827_000 picoseconds.
- Weight::from_parts(4_984_000, 3522)
+ // Minimum execution time: 3_743_000 picoseconds.
+ Weight::from_parts(3_908_000, 3522)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible CollectionAllowance (r:0 w:1)
@@ -665,28 +672,28 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 6_151_000 picoseconds.
- Weight::from_parts(6_394_000, 0)
+ // Minimum execution time: 4_106_000 picoseconds.
+ Weight::from_parts(4_293_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Nonfungible CollectionAllowance (r:1 w:0)
/// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
fn allowance_for_all() -> Weight {
// Proof Size summary in bytes:
- // Measured: `109`
+ // Measured: `142`
// Estimated: `3576`
- // Minimum execution time: 3_791_000 picoseconds.
- Weight::from_parts(3_950_000, 3576)
+ // Minimum execution time: 2_775_000 picoseconds.
+ Weight::from_parts(2_923_000, 3576)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible TokenProperties (r:1 w:1)
/// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
fn repair_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `300`
+ // Measured: `279`
// Estimated: `36269`
- // Minimum execution time: 5_364_000 picoseconds.
- Weight::from_parts(5_539_000, 36269)
+ // Minimum execution time: 3_033_000 picoseconds.
+ Weight::from_parts(3_174_000, 36269)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -22,7 +22,9 @@
use frame_benchmarking::{benchmarks, account};
use pallet_common::{
bench_init,
- benchmarking::{create_collection_raw, property_key, property_value},
+ benchmarking::{
+ create_collection_raw, property_key, property_value, load_is_admin_and_property_permissions,
+ },
};
use sp_std::prelude::*;
use up_data_structs::{
@@ -255,8 +257,49 @@
value: property_value(),
}).collect::<Vec<_>>();
let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
- }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), SetPropertyMode::ExistingToken, &Unlimited)?}
+ }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), &Unlimited)?}
+
+ init_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_token_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(), 200)])?;
+
+ let (is_collection_admin, property_permissions) = load_is_admin_and_property_permissions(&collection, &owner);
+ }: {
+ let mut property_writer = pallet_common::collection_info_loaded_property_writer(
+ &collection,
+ is_collection_admin,
+ property_permissions,
+ );
+
+ property_writer.write_token_properties(
+ true,
+ item,
+ props.into_iter(),
+ crate::erc::ERC721TokenEvent::TokenChanged {
+ token_id: item.into(),
+ }
+ .to_log(T::ContractAddress::get()),
+ )?
+ }
+
delete_token_properties {
let b in 0..MAX_PROPERTIES_PER_ITEM;
bench_init!{
@@ -277,7 +320,7 @@
value: property_value(),
}).collect::<Vec<_>>();
let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
- <Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), SetPropertyMode::ExistingToken, &Unlimited)?;
+ <Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), &Unlimited)?;
let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
}: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -20,20 +20,20 @@
use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};
use up_data_structs::{
CollectionId, TokenId, CreateItemExData, budget::Budget, Property, PropertyKey, PropertyValue,
- PropertyKeyPermission, CollectionPropertiesVec, CreateRefungibleExMultipleOwners,
- CreateRefungibleExSingleOwner, TokenOwnerError,
+ PropertyKeyPermission, CreateRefungibleExMultipleOwners, CreateRefungibleExSingleOwner,
+ TokenOwnerError,
};
use pallet_common::{
CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
- weights::WeightInfo as _,
+ weights::WeightInfo as _, init_token_properties_delta,
};
-use pallet_structure::Error as StructureError;
+use pallet_structure::{Pallet as PalletStructure, Error as StructureError};
use sp_runtime::{DispatchError};
use sp_std::{vec::Vec, vec};
use crate::{
AccountBalance, Allowance, Balance, Config, Error, Owned, Pallet, RefungibleHandle,
- SelfWeightOf, weights::WeightInfo, TokensMinted, TotalSupply, CreateItemData,
+ SelfWeightOf, weights::WeightInfo, TokensMinted, TotalSupply, CreateItemData, TokenProperties,
};
macro_rules! max_weight_of {
@@ -43,28 +43,21 @@
.max(<SelfWeightOf<T>>::$method($($args)*))
)*
};
-}
-
-fn properties_weight<T: Config>(properties: &CollectionPropertiesVec) -> Weight {
- if properties.len() > 0 {
- <CommonWeights<T>>::set_token_properties(properties.len() as u32)
- } else {
- Weight::zero()
- }
}
pub struct CommonWeights<T: Config>(PhantomData<T>);
impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {
fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {
<SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(
- data.iter()
- .map(|data| match data {
+ init_token_properties_delta::<T, _>(
+ data.iter().map(|data| match data {
up_data_structs::CreateItemData::ReFungible(rft_data) => {
- properties_weight::<T>(&rft_data.properties)
+ rft_data.properties.len() as u32
}
- _ => Weight::zero(),
- })
- .fold(Weight::zero(), |a, b| a.saturating_add(b)),
+ _ => 0,
+ }),
+ <SelfWeightOf<T>>::init_token_properties,
+ ),
)
}
@@ -72,15 +65,17 @@
match call {
CreateItemExData::RefungibleMultipleOwners(i) => {
<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32)
- .saturating_add(properties_weight::<T>(&i.properties))
+ .saturating_add(init_token_properties_delta::<T, _>(
+ [i.properties.len() as u32].into_iter(),
+ <SelfWeightOf<T>>::init_token_properties,
+ ))
}
CreateItemExData::RefungibleMultipleItems(i) => {
<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32)
- .saturating_add(
- i.iter()
- .map(|d| properties_weight::<T>(&d.properties))
- .fold(Weight::zero(), |a, b| a.saturating_add(b)),
- )
+ .saturating_add(init_token_properties_delta::<T, _>(
+ i.iter().map(|d| d.properties.len() as u32),
+ <SelfWeightOf<T>>::init_token_properties,
+ ))
}
_ => Weight::zero(),
}
@@ -399,7 +394,6 @@
&sender,
token_id,
properties.into_iter(),
- pallet_common::SetPropertyMode::ExistingToken,
nesting_budget,
),
weight,
@@ -441,6 +435,17 @@
)
}
+ fn get_token_properties_raw(
+ &self,
+ token_id: TokenId,
+ ) -> Option<up_data_structs::TokenProperties> {
+ <TokenProperties<T>>::get((self.id, token_id))
+ }
+
+ fn set_token_properties_raw(&self, token_id: TokenId, map: up_data_structs::TokenProperties) {
+ <TokenProperties<T>>::insert((self.id, token_id), map)
+ }
+
fn check_nesting(
&self,
_sender: <T>::CrossAccountId,
@@ -479,19 +484,44 @@
<Pallet<T>>::token_owner(self.id, token)
}
+ fn check_token_indirect_owner(
+ &self,
+ token: TokenId,
+ maybe_owner: &T::CrossAccountId,
+ nesting_budget: &dyn Budget,
+ ) -> Result<bool, DispatchError> {
+ let balance = self.balance(maybe_owner.clone(), token);
+ let total_pieces: u128 = <Pallet<T>>::total_pieces(self.id, token).unwrap_or(u128::MAX);
+ if balance != total_pieces {
+ return Ok(false);
+ }
+
+ let is_bundle_owner = <PalletStructure<T>>::check_indirectly_owned(
+ maybe_owner.clone(),
+ self.id,
+ token,
+ None,
+ nesting_budget,
+ )?;
+
+ Ok(is_bundle_owner)
+ }
+
/// Returns 10 token in no particular order.
fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {
<Pallet<T>>::token_owners(self.id, token).unwrap_or_default()
}
fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue> {
- <Pallet<T>>::token_properties((self.id, token_id))
+ <Pallet<T>>::token_properties((self.id, token_id))?
.get(key)
.cloned()
}
fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {
- let properties = <Pallet<T>>::token_properties((self.id, token_id));
+ let Some(properties) = <Pallet<T>>::token_properties((self.id, token_id)) else {
+ return vec![];
+ };
keys.map(|keys| {
keys.into_iter()
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -214,7 +214,6 @@
&caller,
TokenId(token_id),
properties.into_iter(),
- pallet_common::SetPropertyMode::ExistingToken,
&nesting_budget,
)
.map_err(dispatch_to_evm::<T>)
@@ -284,7 +283,8 @@
.try_into()
.map_err(|_| "key too long")?;
- let props = <TokenProperties<T>>::get((self.id, token_id));
+ let props =
+ <TokenProperties<T>>::get((self.id, token_id)).ok_or("token properties not found")?;
let prop = props.get(&key).ok_or("key not found")?;
Ok(prop.to_vec().into())
@@ -372,7 +372,7 @@
.transpose()
.map_err(|e| {
Error::Revert(alloc::format!(
- "Can not convert value \"baseURI\" to string with error \"{e}\""
+ "can not convert value \"baseURI\" to string with error \"{e}\""
))
})?;
@@ -697,7 +697,7 @@
let key = key::url();
let permission = get_token_permission::<T>(self.id, &key)?;
if !permission.collection_admin {
- return Err("Operation is not allowed".into());
+ return Err("operation is not allowed".into());
}
let caller = T::CrossAccountId::from_eth(caller);
@@ -724,7 +724,7 @@
.try_into()
.map_err(|_| "token uri is too long")?,
})
- .map_err(|e| Error::Revert(alloc::format!("Can't add property: {e:?}")))?;
+ .map_err(|e| Error::Revert(alloc::format!("can't add property: {e:?}")))?;
let users = [(to, 1)]
.into_iter()
@@ -749,12 +749,12 @@
) -> Result<String> {
collection.consume_store_reads(1)?;
let properties = <TokenProperties<T>>::try_get((collection.id, token_id))
- .map_err(|_| Error::Revert("Token properties not found".into()))?;
+ .map_err(|_| Error::Revert("token properties not found".into()))?;
if let Some(property) = properties.get(key) {
return Ok(String::from_utf8_lossy(property).into());
}
- Err("Property tokenURI not found".into())
+ Err("property tokenURI not found".into())
}
fn get_token_permission<T: Config>(
@@ -762,13 +762,13 @@
key: &PropertyKey,
) -> Result<PropertyPermission> {
let token_property_permissions = CollectionPropertyPermissions::<T>::try_get(collection_id)
- .map_err(|_| Error::Revert("No permissions for collection".into()))?;
+ .map_err(|_| Error::Revert("no permissions for collection".into()))?;
let a = token_property_permissions
.get(key)
.map(Clone::clone)
.ok_or_else(|| {
let key = String::from_utf8(key.clone().into_inner()).unwrap_or_default();
- Error::Revert(alloc::format!("No permission for key {key}"))
+ Error::Revert(alloc::format!("no permission for key {key}"))
})?;
Ok(a)
}
@@ -1133,7 +1133,7 @@
.try_into()
.map_err(|_| "token uri is too long")?,
})
- .map_err(|e| Error::Revert(alloc::format!("Can't add property: {e:?}")))?;
+ .map_err(|e| Error::Revert(alloc::format!("can't add property: {e:?}")))?;
let create_item_data = CreateItemData::<T> {
users: users.clone(),
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -96,8 +96,8 @@
use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
use pallet_evm_coder_substrate::WithRecorder;
use pallet_common::{
- CommonCollectionOperations, Error as CommonError, eth::collection_id_to_address,
- Event as CommonEvent, Pallet as PalletCommon, SetPropertyMode,
+ Error as CommonError, eth::collection_id_to_address, Event as CommonEvent,
+ Pallet as PalletCommon,
};
use pallet_structure::Pallet as PalletStructure;
use sp_core::{Get, H160};
@@ -106,8 +106,8 @@
use up_data_structs::{
AccessMode, budget::Budget, CollectionId, CreateCollectionData, mapping::TokenAddressMapping,
MAX_REFUNGIBLE_PIECES, Property, PropertyKey, PropertyKeyPermission, PropertyScope,
- PropertyValue, TokenId, TrySetProperty, PropertiesPermissionMap,
- CreateRefungibleExMultipleOwners, TokenOwnerError, TokenProperties as TokenPropertiesT,
+ PropertyValue, TokenId, PropertiesPermissionMap, CreateRefungibleExMultipleOwners,
+ TokenOwnerError, TokenProperties as TokenPropertiesT,
};
pub use pallet::*;
@@ -175,7 +175,7 @@
pub type TokenProperties<T: Config> = StorageNMap<
Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
Value = TokenPropertiesT,
- QueryKind = ValueQuery,
+ QueryKind = OptionQuery,
>;
/// Total amount of pieces for token
@@ -292,34 +292,6 @@
/// - `token`: Token ID.
pub fn token_exists(collection: &RefungibleHandle<T>, token: TokenId) -> bool {
<TotalSupply<T>>::contains_key((collection.id, token))
- }
-
- pub fn set_scoped_token_property(
- collection_id: CollectionId,
- token_id: TokenId,
- scope: PropertyScope,
- property: Property,
- ) -> DispatchResult {
- TokenProperties::<T>::try_mutate((collection_id, token_id), |properties| {
- properties.try_scoped_set(scope, property.key, property.value)
- })
- .map_err(<CommonError<T>>::from)?;
-
- Ok(())
- }
-
- pub fn set_scoped_token_properties(
- collection_id: CollectionId,
- token_id: TokenId,
- scope: PropertyScope,
- properties: impl Iterator<Item = Property>,
- ) -> DispatchResult {
- TokenProperties::<T>::try_mutate((collection_id, token_id), |stored_properties| {
- stored_properties.try_scoped_set_from_iter(scope, properties)
- })
- .map_err(<CommonError<T>>::from)?;
-
- Ok(())
}
}
@@ -533,50 +505,16 @@
sender: &T::CrossAccountId,
token_id: TokenId,
properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,
- mode: SetPropertyMode,
nesting_budget: &dyn Budget,
) -> DispatchResult {
- let mut is_token_owner =
- pallet_common::LazyValue::new(|| -> Result<bool, DispatchError> {
- if let SetPropertyMode::NewToken {
- mint_target_is_sender,
- } = mode
- {
- return Ok(mint_target_is_sender);
- }
-
- let balance = collection.balance(sender.clone(), token_id);
- let total_pieces: u128 =
- Self::total_pieces(collection.id, token_id).unwrap_or(u128::MAX);
- if balance != total_pieces {
- return Ok(false);
- }
-
- let is_bundle_owner = <PalletStructure<T>>::check_indirectly_owned(
- sender.clone(),
- collection.id,
- token_id,
- None,
- nesting_budget,
- )?;
-
- Ok(is_bundle_owner)
- });
+ let mut property_writer =
+ pallet_common::property_writer_for_existing_token(collection, sender);
- let mut is_token_exist =
- pallet_common::LazyValue::new(|| Self::token_exists(collection, token_id));
-
- let stored_properties = <TokenProperties<T>>::get((collection.id, token_id));
-
- <PalletCommon<T>>::modify_token_properties(
- collection,
+ property_writer.write_token_properties(
sender,
token_id,
- &mut is_token_exist,
properties_updates,
- stored_properties,
- &mut is_token_owner,
- |properties| <TokenProperties<T>>::set((collection.id, token_id), properties),
+ nesting_budget,
erc::ERC721TokenEvent::TokenChanged {
token_id: token_id.into(),
}
@@ -602,7 +540,6 @@
sender: &T::CrossAccountId,
token_id: TokenId,
properties: impl Iterator<Item = Property>,
- mode: SetPropertyMode,
nesting_budget: &dyn Budget,
) -> DispatchResult {
Self::modify_token_properties(
@@ -610,7 +547,6 @@
sender,
token_id,
properties.map(|p| (p.key, Some(p.value))),
- mode,
nesting_budget,
)
}
@@ -627,7 +563,6 @@
sender,
token_id,
[property].into_iter(),
- SetPropertyMode::ExistingToken,
nesting_budget,
)
}
@@ -644,7 +579,6 @@
sender,
token_id,
property_keys.into_iter().map(|key| (key, None)),
- SetPropertyMode::ExistingToken,
nesting_budget,
)
}
@@ -925,11 +859,15 @@
// =========
+ let mut property_writer = pallet_common::property_writer_for_new_token(collection, sender);
+
with_transaction(|| {
for (i, data) in data.iter().enumerate() {
let token_id = first_token_id + i as u32 + 1;
<TotalSupply<T>>::insert((collection.id, token_id), totals[i]);
+ let token = TokenId(token_id);
+
let mut mint_target_is_sender = true;
for (user, amount) in data.users.iter() {
if *amount == 0 {
@@ -939,23 +877,22 @@
mint_target_is_sender = mint_target_is_sender && sender.conv_eq(user);
<Balance<T>>::insert((collection.id, token_id, &user), amount);
- <Owned<T>>::insert((collection.id, &user, TokenId(token_id)), true);
+ <Owned<T>>::insert((collection.id, &user, token), true);
<PalletStructure<T>>::nest_if_sent_to_token_unchecked(
user,
collection.id,
- TokenId(token_id),
+ token,
);
}
- if let Err(e) = Self::set_token_properties(
- collection,
- sender,
- TokenId(token_id),
+ if let Err(e) = property_writer.write_token_properties(
+ mint_target_is_sender,
+ token,
data.properties.clone().into_iter(),
- SetPropertyMode::NewToken {
- mint_target_is_sender,
- },
- nesting_budget,
+ erc::ERC721TokenEvent::TokenChanged {
+ token_id: token.into(),
+ }
+ .to_log(T::ContractAddress::get()),
) {
return TransactionOutcome::Rollback(Err(e));
}
@@ -1461,7 +1398,9 @@
pub fn repair_item(collection: &RefungibleHandle<T>, token: TokenId) -> DispatchResult {
<TokenProperties<T>>::mutate((collection.id, token), |properties| {
- properties.recompute_consumed_space();
+ if let Some(properties) = properties {
+ properties.recompute_consumed_space();
+ }
});
Ok(())
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_refungible
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/refungible/src/weights.rs
@@ -52,6 +52,7 @@
fn burn_from() -> Weight;
fn set_token_property_permissions(b: u32, ) -> Weight;
fn set_token_properties(b: u32, ) -> Weight;
+ fn init_token_properties(b: u32, ) -> Weight;
fn delete_token_properties(b: u32, ) -> Weight;
fn repartition_item() -> Weight;
fn token_owner() -> Weight;
@@ -67,10 +68,6 @@
/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Refungible AccountBalance (r:1 w:1)
/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible Balance (r:0 w:1)
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
/// Storage: Refungible TotalSupply (r:0 w:1)
@@ -79,21 +76,17 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn create_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `285`
- // Estimated: `63471`
- // Minimum execution time: 30_759_000 picoseconds.
- Weight::from_parts(31_321_000, 63471)
- .saturating_add(T::DbWeight::get().reads(4_u64))
- .saturating_add(T::DbWeight::get().writes(6_u64))
+ // Measured: `4`
+ // Estimated: `3530`
+ // Minimum execution time: 11_341_000 picoseconds.
+ Weight::from_parts(11_741_000, 3530)
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ .saturating_add(T::DbWeight::get().writes(5_u64))
}
/// Storage: Refungible TokensMinted (r:1 w:1)
/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Refungible AccountBalance (r:1 w:1)
/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:200 w:200)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible Balance (r:0 w:200)
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
/// Storage: Refungible TotalSupply (r:0 w:200)
@@ -103,26 +96,20 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `285`
- // Estimated: `28192 + b * (35279 ±0)`
- // Minimum execution time: 4_024_000 picoseconds.
- Weight::from_parts(4_145_000, 28192)
- // Standard Error: 3_332
- .saturating_add(Weight::from_parts(8_967_757, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(3_u64))
- .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
+ // Measured: `4`
+ // Estimated: `3530`
+ // Minimum execution time: 2_665_000 picoseconds.
+ Weight::from_parts(2_791_000, 3530)
+ // Standard Error: 996
+ .saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
- .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 35279).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
}
/// Storage: Refungible TokensMinted (r:1 w:1)
/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Refungible AccountBalance (r:200 w:200)
/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:200 w:200)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible Balance (r:0 w:200)
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
/// Storage: Refungible TotalSupply (r:0 w:200)
@@ -132,26 +119,22 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `285`
- // Estimated: `25652 + b * (37819 ±0)`
- // Minimum execution time: 3_715_000 picoseconds.
- Weight::from_parts(3_881_000, 25652)
- // Standard Error: 3_275
- .saturating_add(Weight::from_parts(10_525_271, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
- .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(b.into())))
+ // Measured: `4`
+ // Estimated: `3481 + b * (2540 ±0)`
+ // Minimum execution time: 2_616_000 picoseconds.
+ Weight::from_parts(2_726_000, 3481)
+ // Standard Error: 665
+ .saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
- .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 37819).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
+ .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
/// Storage: Refungible TokensMinted (r:1 w:1)
/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Refungible AccountBalance (r:200 w:200)
/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible Balance (r:0 w:200)
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
/// Storage: Refungible TotalSupply (r:0 w:1)
@@ -161,15 +144,15 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `285`
- // Estimated: `60931 + b * (2540 ±0)`
- // Minimum execution time: 13_150_000 picoseconds.
- Weight::from_parts(15_655_930, 60931)
- // Standard Error: 4_170
- .saturating_add(Weight::from_parts(5_673_702, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(3_u64))
+ // Measured: `4`
+ // Estimated: `3481 + b * (2540 ±0)`
+ // Minimum execution time: 3_697_000 picoseconds.
+ Weight::from_parts(2_136_481, 3481)
+ // Standard Error: 567
+ .saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
- .saturating_add(T::DbWeight::get().writes(3_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
@@ -183,10 +166,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn burn_item_partial() -> Weight {
// Proof Size summary in bytes:
- // Measured: `490`
- // Estimated: `15717`
- // Minimum execution time: 28_992_000 picoseconds.
- Weight::from_parts(29_325_000, 15717)
+ // Measured: `456`
+ // Estimated: `8682`
+ // Minimum execution time: 22_859_000 picoseconds.
+ Weight::from_parts(23_295_000, 8682)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -204,10 +187,10 @@
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
fn burn_item_fully() -> Weight {
// Proof Size summary in bytes:
- // Measured: `375`
- // Estimated: `14070`
- // Minimum execution time: 27_980_000 picoseconds.
- Weight::from_parts(28_582_000, 14070)
+ // Measured: `341`
+ // Estimated: `3554`
+ // Minimum execution time: 21_477_000 picoseconds.
+ Weight::from_parts(22_037_000, 3554)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
@@ -217,10 +200,10 @@
/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
fn transfer_normal() -> Weight {
// Proof Size summary in bytes:
- // Measured: `398`
- // Estimated: `9623`
- // Minimum execution time: 18_746_000 picoseconds.
- Weight::from_parts(19_096_000, 9623)
+ // Measured: `365`
+ // Estimated: `6118`
+ // Minimum execution time: 13_714_000 picoseconds.
+ Weight::from_parts(14_050_000, 6118)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -234,10 +217,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_creating() -> Weight {
// Proof Size summary in bytes:
- // Measured: `375`
- // Estimated: `13153`
- // Minimum execution time: 21_719_000 picoseconds.
- Weight::from_parts(22_219_000, 13153)
+ // Measured: `341`
+ // Estimated: `6118`
+ // Minimum execution time: 15_879_000 picoseconds.
+ Weight::from_parts(16_266_000, 6118)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -251,10 +234,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_removing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `490`
- // Estimated: `13153`
- // Minimum execution time: 24_784_000 picoseconds.
- Weight::from_parts(25_231_000, 13153)
+ // Measured: `456`
+ // Estimated: `6118`
+ // Minimum execution time: 18_186_000 picoseconds.
+ Weight::from_parts(18_682_000, 6118)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -268,10 +251,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_creating_removing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `375`
- // Estimated: `15693`
- // Minimum execution time: 24_865_000 picoseconds.
- Weight::from_parts(25_253_000, 15693)
+ // Measured: `341`
+ // Estimated: `6118`
+ // Minimum execution time: 17_943_000 picoseconds.
+ Weight::from_parts(18_333_000, 6118)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
@@ -281,10 +264,10 @@
/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
fn approve() -> Weight {
// Proof Size summary in bytes:
- // Measured: `256`
+ // Measured: `223`
// Estimated: `3554`
- // Minimum execution time: 12_318_000 picoseconds.
- Weight::from_parts(12_597_000, 3554)
+ // Minimum execution time: 8_391_000 picoseconds.
+ Weight::from_parts(8_637_000, 3554)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -294,10 +277,10 @@
/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
fn approve_from() -> Weight {
// Proof Size summary in bytes:
- // Measured: `244`
+ // Measured: `211`
// Estimated: `3554`
- // Minimum execution time: 12_276_000 picoseconds.
- Weight::from_parts(12_557_000, 3554)
+ // Minimum execution time: 8_519_000 picoseconds.
+ Weight::from_parts(8_760_000, 3554)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -309,10 +292,10 @@
/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
fn transfer_from_normal() -> Weight {
// Proof Size summary in bytes:
- // Measured: `528`
- // Estimated: `13193`
- // Minimum execution time: 26_852_000 picoseconds.
- Weight::from_parts(27_427_000, 13193)
+ // Measured: `495`
+ // Estimated: `6118`
+ // Minimum execution time: 19_554_000 picoseconds.
+ Weight::from_parts(20_031_000, 6118)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -328,10 +311,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_from_creating() -> Weight {
// Proof Size summary in bytes:
- // Measured: `505`
- // Estimated: `16723`
- // Minimum execution time: 29_893_000 picoseconds.
- Weight::from_parts(30_345_000, 16723)
+ // Measured: `471`
+ // Estimated: `6118`
+ // Minimum execution time: 21_338_000 picoseconds.
+ Weight::from_parts(21_803_000, 6118)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -347,10 +330,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_from_removing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `620`
- // Estimated: `16723`
- // Minimum execution time: 32_784_000 picoseconds.
- Weight::from_parts(33_322_000, 16723)
+ // Measured: `586`
+ // Estimated: `6118`
+ // Minimum execution time: 24_179_000 picoseconds.
+ Weight::from_parts(24_647_000, 6118)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -366,10 +349,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_from_creating_removing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `505`
- // Estimated: `19263`
- // Minimum execution time: 32_987_000 picoseconds.
- Weight::from_parts(33_428_000, 19263)
+ // Measured: `471`
+ // Estimated: `6118`
+ // Minimum execution time: 24_008_000 picoseconds.
+ Weight::from_parts(24_545_000, 6118)
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(7_u64))
}
@@ -389,10 +372,10 @@
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
fn burn_from() -> Weight {
// Proof Size summary in bytes:
- // Measured: `505`
- // Estimated: `17640`
- // Minimum execution time: 38_277_000 picoseconds.
- Weight::from_parts(38_983_000, 17640)
+ // Measured: `471`
+ // Estimated: `3570`
+ // Minimum execution time: 27_907_000 picoseconds.
+ Weight::from_parts(28_489_000, 3570)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(7_u64))
}
@@ -401,45 +384,62 @@
/// The range of component `b` is `[0, 64]`.
fn set_token_property_permissions(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `281`
+ // Measured: `314`
// Estimated: `20191`
- // Minimum execution time: 2_254_000 picoseconds.
- Weight::from_parts(2_335_000, 20191)
- // Standard Error: 44_906
- .saturating_add(Weight::from_parts(12_118_499, 0).saturating_mul(b.into()))
+ // Minimum execution time: 1_460_000 picoseconds.
+ Weight::from_parts(1_564_000, 20191)
+ // Standard Error: 14_117
+ .saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
+ /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
+ /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible TokenProperties (r:1 w:1)
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ /// Storage: Refungible TotalSupply (r:1 w:0)
+ /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 64]`.
fn set_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `458 + b * (261 ±0)`
- // Estimated: `56460`
- // Minimum execution time: 11_249_000 picoseconds.
- Weight::from_parts(11_420_000, 56460)
- // Standard Error: 72_033
- .saturating_add(Weight::from_parts(7_008_012, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
+ // Measured: `502 + b * (261 ±0)`
+ // Estimated: `36269`
+ // Minimum execution time: 1_012_000 picoseconds.
+ Weight::from_parts(1_081_000, 36269)
+ // Standard Error: 6_838
+ .saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Refungible TokenProperties (r:1 w:1)
+ /// Storage: Refungible TokenProperties (r:0 w:1)
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// The range of component `b` is `[0, 64]`.
+ fn init_token_properties(b: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 229_000 picoseconds.
+ Weight::from_parts(253_000, 0)
+ // Standard Error: 100_218
+ .saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ /// Storage: Refungible TotalSupply (r:1 w:0)
+ /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+ /// Storage: Refungible TokenProperties (r:1 w:1)
+ /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 64]`.
fn delete_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `463 + b * (33291 ±0)`
- // Estimated: `56460`
- // Minimum execution time: 11_368_000 picoseconds.
- Weight::from_parts(11_546_000, 56460)
- // Standard Error: 85_444
- .saturating_add(Weight::from_parts(24_644_980, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(2_u64))
+ // Measured: `561 + b * (33291 ±0)`
+ // Estimated: `36269`
+ // Minimum execution time: 1_014_000 picoseconds.
+ Weight::from_parts(1_065_000, 36269)
+ // Standard Error: 39_536
+ .saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Refungible TotalSupply (r:1 w:1)
@@ -448,10 +448,10 @@
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
fn repartition_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `321`
- // Estimated: `7059`
- // Minimum execution time: 13_586_000 picoseconds.
- Weight::from_parts(14_489_000, 7059)
+ // Measured: `288`
+ // Estimated: `3554`
+ // Minimum execution time: 10_315_000 picoseconds.
+ Weight::from_parts(10_601_000, 3554)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -459,10 +459,10 @@
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
fn token_owner() -> Weight {
// Proof Size summary in bytes:
- // Measured: `321`
+ // Measured: `288`
// Estimated: `6118`
- // Minimum execution time: 7_049_000 picoseconds.
- Weight::from_parts(7_320_000, 6118)
+ // Minimum execution time: 4_898_000 picoseconds.
+ Weight::from_parts(5_136_000, 6118)
.saturating_add(T::DbWeight::get().reads(2_u64))
}
/// Storage: Refungible CollectionAllowance (r:0 w:1)
@@ -471,8 +471,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 6_432_000 picoseconds.
- Weight::from_parts(6_642_000, 0)
+ // Minimum execution time: 4_146_000 picoseconds.
+ Weight::from_parts(4_337_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Refungible CollectionAllowance (r:1 w:0)
@@ -481,18 +481,18 @@
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3576`
- // Minimum execution time: 3_030_000 picoseconds.
- Weight::from_parts(3_206_000, 3576)
+ // Minimum execution time: 2_170_000 picoseconds.
+ Weight::from_parts(2_301_000, 3576)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: Refungible TokenProperties (r:1 w:1)
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
fn repair_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `174`
+ // Measured: `120`
// Estimated: `36269`
- // Minimum execution time: 4_371_000 picoseconds.
- Weight::from_parts(4_555_000, 36269)
+ // Minimum execution time: 2_098_000 picoseconds.
+ Weight::from_parts(2_251_000, 36269)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -504,10 +504,6 @@
/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Refungible AccountBalance (r:1 w:1)
/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible Balance (r:0 w:1)
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
/// Storage: Refungible TotalSupply (r:0 w:1)
@@ -516,21 +512,17 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn create_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `285`
- // Estimated: `63471`
- // Minimum execution time: 30_759_000 picoseconds.
- Weight::from_parts(31_321_000, 63471)
- .saturating_add(RocksDbWeight::get().reads(4_u64))
- .saturating_add(RocksDbWeight::get().writes(6_u64))
+ // Measured: `4`
+ // Estimated: `3530`
+ // Minimum execution time: 11_341_000 picoseconds.
+ Weight::from_parts(11_741_000, 3530)
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ .saturating_add(RocksDbWeight::get().writes(5_u64))
}
/// Storage: Refungible TokensMinted (r:1 w:1)
/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Refungible AccountBalance (r:1 w:1)
/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:200 w:200)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible Balance (r:0 w:200)
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
/// Storage: Refungible TotalSupply (r:0 w:200)
@@ -540,26 +532,20 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `285`
- // Estimated: `28192 + b * (35279 ±0)`
- // Minimum execution time: 4_024_000 picoseconds.
- Weight::from_parts(4_145_000, 28192)
- // Standard Error: 3_332
- .saturating_add(Weight::from_parts(8_967_757, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(3_u64))
- .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
+ // Measured: `4`
+ // Estimated: `3530`
+ // Minimum execution time: 2_665_000 picoseconds.
+ Weight::from_parts(2_791_000, 3530)
+ // Standard Error: 996
+ .saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
- .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 35279).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
}
/// Storage: Refungible TokensMinted (r:1 w:1)
/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Refungible AccountBalance (r:200 w:200)
/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:200 w:200)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible Balance (r:0 w:200)
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
/// Storage: Refungible TotalSupply (r:0 w:200)
@@ -569,26 +555,22 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `285`
- // Estimated: `25652 + b * (37819 ±0)`
- // Minimum execution time: 3_715_000 picoseconds.
- Weight::from_parts(3_881_000, 25652)
- // Standard Error: 3_275
- .saturating_add(Weight::from_parts(10_525_271, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
- .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(b.into())))
+ // Measured: `4`
+ // Estimated: `3481 + b * (2540 ±0)`
+ // Minimum execution time: 2_616_000 picoseconds.
+ Weight::from_parts(2_726_000, 3481)
+ // Standard Error: 665
+ .saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
+ .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(1_u64))
- .saturating_add(RocksDbWeight::get().writes((5_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 37819).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
+ .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
/// Storage: Refungible TokensMinted (r:1 w:1)
/// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
/// Storage: Refungible AccountBalance (r:200 w:200)
/// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Refungible Balance (r:0 w:200)
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
/// Storage: Refungible TotalSupply (r:0 w:1)
@@ -598,15 +580,15 @@
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `285`
- // Estimated: `60931 + b * (2540 ±0)`
- // Minimum execution time: 13_150_000 picoseconds.
- Weight::from_parts(15_655_930, 60931)
- // Standard Error: 4_170
- .saturating_add(Weight::from_parts(5_673_702, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(3_u64))
+ // Measured: `4`
+ // Estimated: `3481 + b * (2540 ±0)`
+ // Minimum execution time: 3_697_000 picoseconds.
+ Weight::from_parts(2_136_481, 3481)
+ // Standard Error: 567
+ .saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
- .saturating_add(RocksDbWeight::get().writes(3_u64))
+ .saturating_add(RocksDbWeight::get().writes(2_u64))
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
@@ -620,10 +602,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn burn_item_partial() -> Weight {
// Proof Size summary in bytes:
- // Measured: `490`
- // Estimated: `15717`
- // Minimum execution time: 28_992_000 picoseconds.
- Weight::from_parts(29_325_000, 15717)
+ // Measured: `456`
+ // Estimated: `8682`
+ // Minimum execution time: 22_859_000 picoseconds.
+ Weight::from_parts(23_295_000, 8682)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -641,10 +623,10 @@
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
fn burn_item_fully() -> Weight {
// Proof Size summary in bytes:
- // Measured: `375`
- // Estimated: `14070`
- // Minimum execution time: 27_980_000 picoseconds.
- Weight::from_parts(28_582_000, 14070)
+ // Measured: `341`
+ // Estimated: `3554`
+ // Minimum execution time: 21_477_000 picoseconds.
+ Weight::from_parts(22_037_000, 3554)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
@@ -654,10 +636,10 @@
/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
fn transfer_normal() -> Weight {
// Proof Size summary in bytes:
- // Measured: `398`
- // Estimated: `9623`
- // Minimum execution time: 18_746_000 picoseconds.
- Weight::from_parts(19_096_000, 9623)
+ // Measured: `365`
+ // Estimated: `6118`
+ // Minimum execution time: 13_714_000 picoseconds.
+ Weight::from_parts(14_050_000, 6118)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -671,10 +653,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_creating() -> Weight {
// Proof Size summary in bytes:
- // Measured: `375`
- // Estimated: `13153`
- // Minimum execution time: 21_719_000 picoseconds.
- Weight::from_parts(22_219_000, 13153)
+ // Measured: `341`
+ // Estimated: `6118`
+ // Minimum execution time: 15_879_000 picoseconds.
+ Weight::from_parts(16_266_000, 6118)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -688,10 +670,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_removing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `490`
- // Estimated: `13153`
- // Minimum execution time: 24_784_000 picoseconds.
- Weight::from_parts(25_231_000, 13153)
+ // Measured: `456`
+ // Estimated: `6118`
+ // Minimum execution time: 18_186_000 picoseconds.
+ Weight::from_parts(18_682_000, 6118)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -705,10 +687,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_creating_removing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `375`
- // Estimated: `15693`
- // Minimum execution time: 24_865_000 picoseconds.
- Weight::from_parts(25_253_000, 15693)
+ // Measured: `341`
+ // Estimated: `6118`
+ // Minimum execution time: 17_943_000 picoseconds.
+ Weight::from_parts(18_333_000, 6118)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
@@ -718,10 +700,10 @@
/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
fn approve() -> Weight {
// Proof Size summary in bytes:
- // Measured: `256`
+ // Measured: `223`
// Estimated: `3554`
- // Minimum execution time: 12_318_000 picoseconds.
- Weight::from_parts(12_597_000, 3554)
+ // Minimum execution time: 8_391_000 picoseconds.
+ Weight::from_parts(8_637_000, 3554)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -731,10 +713,10 @@
/// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
fn approve_from() -> Weight {
// Proof Size summary in bytes:
- // Measured: `244`
+ // Measured: `211`
// Estimated: `3554`
- // Minimum execution time: 12_276_000 picoseconds.
- Weight::from_parts(12_557_000, 3554)
+ // Minimum execution time: 8_519_000 picoseconds.
+ Weight::from_parts(8_760_000, 3554)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -746,10 +728,10 @@
/// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
fn transfer_from_normal() -> Weight {
// Proof Size summary in bytes:
- // Measured: `528`
- // Estimated: `13193`
- // Minimum execution time: 26_852_000 picoseconds.
- Weight::from_parts(27_427_000, 13193)
+ // Measured: `495`
+ // Estimated: `6118`
+ // Minimum execution time: 19_554_000 picoseconds.
+ Weight::from_parts(20_031_000, 6118)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
@@ -765,10 +747,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_from_creating() -> Weight {
// Proof Size summary in bytes:
- // Measured: `505`
- // Estimated: `16723`
- // Minimum execution time: 29_893_000 picoseconds.
- Weight::from_parts(30_345_000, 16723)
+ // Measured: `471`
+ // Estimated: `6118`
+ // Minimum execution time: 21_338_000 picoseconds.
+ Weight::from_parts(21_803_000, 6118)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
@@ -784,10 +766,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_from_removing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `620`
- // Estimated: `16723`
- // Minimum execution time: 32_784_000 picoseconds.
- Weight::from_parts(33_322_000, 16723)
+ // Measured: `586`
+ // Estimated: `6118`
+ // Minimum execution time: 24_179_000 picoseconds.
+ Weight::from_parts(24_647_000, 6118)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
@@ -803,10 +785,10 @@
/// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
fn transfer_from_creating_removing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `505`
- // Estimated: `19263`
- // Minimum execution time: 32_987_000 picoseconds.
- Weight::from_parts(33_428_000, 19263)
+ // Measured: `471`
+ // Estimated: `6118`
+ // Minimum execution time: 24_008_000 picoseconds.
+ Weight::from_parts(24_545_000, 6118)
.saturating_add(RocksDbWeight::get().reads(6_u64))
.saturating_add(RocksDbWeight::get().writes(7_u64))
}
@@ -826,10 +808,10 @@
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
fn burn_from() -> Weight {
// Proof Size summary in bytes:
- // Measured: `505`
- // Estimated: `17640`
- // Minimum execution time: 38_277_000 picoseconds.
- Weight::from_parts(38_983_000, 17640)
+ // Measured: `471`
+ // Estimated: `3570`
+ // Minimum execution time: 27_907_000 picoseconds.
+ Weight::from_parts(28_489_000, 3570)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(7_u64))
}
@@ -838,45 +820,62 @@
/// The range of component `b` is `[0, 64]`.
fn set_token_property_permissions(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `281`
+ // Measured: `314`
// Estimated: `20191`
- // Minimum execution time: 2_254_000 picoseconds.
- Weight::from_parts(2_335_000, 20191)
- // Standard Error: 44_906
- .saturating_add(Weight::from_parts(12_118_499, 0).saturating_mul(b.into()))
+ // Minimum execution time: 1_460_000 picoseconds.
+ Weight::from_parts(1_564_000, 20191)
+ // Standard Error: 14_117
+ .saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ /// Storage: Refungible TokenProperties (r:1 w:1)
+ /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: Refungible TotalSupply (r:1 w:0)
+ /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 64]`.
fn set_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `458 + b * (261 ±0)`
- // Estimated: `56460`
- // Minimum execution time: 11_249_000 picoseconds.
- Weight::from_parts(11_420_000, 56460)
- // Standard Error: 72_033
- .saturating_add(Weight::from_parts(7_008_012, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
+ // Measured: `502 + b * (261 ±0)`
+ // Estimated: `36269`
+ // Minimum execution time: 1_012_000 picoseconds.
+ Weight::from_parts(1_081_000, 36269)
+ // Standard Error: 6_838
+ .saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Refungible TokenProperties (r:1 w:1)
+ /// Storage: Refungible TokenProperties (r:0 w:1)
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// The range of component `b` is `[0, 64]`.
+ fn init_token_properties(b: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 229_000 picoseconds.
+ Weight::from_parts(253_000, 0)
+ // Standard Error: 100_218
+ .saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
+ /// Storage: Refungible TotalSupply (r:1 w:0)
+ /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+ /// Storage: Refungible TokenProperties (r:1 w:1)
+ /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
/// The range of component `b` is `[0, 64]`.
fn delete_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `463 + b * (33291 ±0)`
- // Estimated: `56460`
- // Minimum execution time: 11_368_000 picoseconds.
- Weight::from_parts(11_546_000, 56460)
- // Standard Error: 85_444
- .saturating_add(Weight::from_parts(24_644_980, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(2_u64))
+ // Measured: `561 + b * (33291 ±0)`
+ // Estimated: `36269`
+ // Minimum execution time: 1_014_000 picoseconds.
+ Weight::from_parts(1_065_000, 36269)
+ // Standard Error: 39_536
+ .saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Refungible TotalSupply (r:1 w:1)
@@ -885,10 +884,10 @@
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
fn repartition_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `321`
- // Estimated: `7059`
- // Minimum execution time: 13_586_000 picoseconds.
- Weight::from_parts(14_489_000, 7059)
+ // Measured: `288`
+ // Estimated: `3554`
+ // Minimum execution time: 10_315_000 picoseconds.
+ Weight::from_parts(10_601_000, 3554)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -896,10 +895,10 @@
/// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
fn token_owner() -> Weight {
// Proof Size summary in bytes:
- // Measured: `321`
+ // Measured: `288`
// Estimated: `6118`
- // Minimum execution time: 7_049_000 picoseconds.
- Weight::from_parts(7_320_000, 6118)
+ // Minimum execution time: 4_898_000 picoseconds.
+ Weight::from_parts(5_136_000, 6118)
.saturating_add(RocksDbWeight::get().reads(2_u64))
}
/// Storage: Refungible CollectionAllowance (r:0 w:1)
@@ -908,8 +907,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 6_432_000 picoseconds.
- Weight::from_parts(6_642_000, 0)
+ // Minimum execution time: 4_146_000 picoseconds.
+ Weight::from_parts(4_337_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Refungible CollectionAllowance (r:1 w:0)
@@ -918,18 +917,18 @@
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3576`
- // Minimum execution time: 3_030_000 picoseconds.
- Weight::from_parts(3_206_000, 3576)
+ // Minimum execution time: 2_170_000 picoseconds.
+ Weight::from_parts(2_301_000, 3576)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: Refungible TokenProperties (r:1 w:1)
/// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
fn repair_item() -> Weight {
// Proof Size summary in bytes:
- // Measured: `174`
+ // Measured: `120`
// Estimated: `36269`
- // Minimum execution time: 4_371_000 picoseconds.
- Weight::from_parts(4_555_000, 36269)
+ // Minimum execution time: 2_098_000 picoseconds.
+ Weight::from_parts(2_251_000, 36269)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
pallets/structure/src/weights.rsdiffbeforeafterboth--- a/pallets/structure/src/weights.rs
+++ b/pallets/structure/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_structure
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/structure/src/weights.rs
@@ -45,10 +45,10 @@
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
fn find_parent() -> Weight {
// Proof Size summary in bytes:
- // Measured: `634`
- // Estimated: `7847`
- // Minimum execution time: 10_781_000 picoseconds.
- Weight::from_parts(11_675_000, 7847)
+ // Measured: `667`
+ // Estimated: `4325`
+ // Minimum execution time: 7_344_000 picoseconds.
+ Weight::from_parts(7_578_000, 4325)
.saturating_add(T::DbWeight::get().reads(2_u64))
}
}
@@ -61,10 +61,10 @@
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
fn find_parent() -> Weight {
// Proof Size summary in bytes:
- // Measured: `634`
- // Estimated: `7847`
- // Minimum execution time: 10_781_000 picoseconds.
- Weight::from_parts(11_675_000, 7847)
+ // Measured: `667`
+ // Estimated: `4325`
+ // Minimum execution time: 7_344_000 picoseconds.
+ Weight::from_parts(7_578_000, 4325)
.saturating_add(RocksDbWeight::get().reads(2_u64))
}
}
pallets/unique/src/weights.rsdiffbeforeafterboth--- a/pallets/unique/src/weights.rs
+++ b/pallets/unique/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_unique
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./pallets/unique/src/weights.rs
@@ -57,6 +57,8 @@
/// Proof: Common DestroyedCollectionCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: System Account (r:2 w:2)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ /// Storage: Common AdminAmount (r:0 w:1)
+ /// Proof: Common AdminAmount (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen)
/// Storage: Common CollectionPropertyPermissions (r:0 w:1)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Common CollectionProperties (r:0 w:1)
@@ -66,11 +68,11 @@
fn create_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `245`
- // Estimated: `9174`
- // Minimum execution time: 31_198_000 picoseconds.
- Weight::from_parts(32_046_000, 9174)
+ // Estimated: `6196`
+ // Minimum execution time: 26_618_000 picoseconds.
+ Weight::from_parts(27_287_000, 6196)
.saturating_add(T::DbWeight::get().reads(4_u64))
- .saturating_add(T::DbWeight::get().writes(6_u64))
+ .saturating_add(T::DbWeight::get().writes(7_u64))
}
/// Storage: Common CollectionById (r:1 w:1)
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
@@ -88,10 +90,10 @@
/// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
fn destroy_collection() -> Weight {
// Proof Size summary in bytes:
- // Measured: `1086`
- // Estimated: `9336`
- // Minimum execution time: 48_208_000 picoseconds.
- Weight::from_parts(49_031_000, 9336)
+ // Measured: `1200`
+ // Estimated: `4325`
+ // Minimum execution time: 37_428_000 picoseconds.
+ Weight::from_parts(38_258_000, 4325)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
@@ -101,10 +103,10 @@
/// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
fn add_to_allow_list() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 14_852_000 picoseconds.
- Weight::from_parts(15_268_000, 4325)
+ // Minimum execution time: 9_968_000 picoseconds.
+ Weight::from_parts(10_388_000, 4325)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -114,10 +116,10 @@
/// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
fn remove_from_allow_list() -> Weight {
// Proof Size summary in bytes:
- // Measured: `1000`
+ // Measured: `1033`
// Estimated: `4325`
- // Minimum execution time: 14_595_000 picoseconds.
- Weight::from_parts(14_933_000, 4325)
+ // Minimum execution time: 9_600_000 picoseconds.
+ Weight::from_parts(9_974_000, 4325)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -125,10 +127,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn change_collection_owner() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 14_132_000 picoseconds.
- Weight::from_parts(14_501_000, 4325)
+ // Minimum execution time: 9_185_000 picoseconds.
+ Weight::from_parts(9_525_000, 4325)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -140,10 +142,10 @@
/// Proof: Common AdminAmount (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen)
fn add_collection_admin() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
- // Estimated: `11349`
- // Minimum execution time: 17_229_000 picoseconds.
- Weight::from_parts(17_657_000, 11349)
+ // Measured: `1012`
+ // Estimated: `4325`
+ // Minimum execution time: 12_704_000 picoseconds.
+ Weight::from_parts(13_115_000, 4325)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -156,9 +158,9 @@
fn remove_collection_admin() -> Weight {
// Proof Size summary in bytes:
// Measured: `1107`
- // Estimated: `11349`
- // Minimum execution time: 19_827_000 picoseconds.
- Weight::from_parts(20_479_000, 11349)
+ // Estimated: `4325`
+ // Minimum execution time: 14_185_000 picoseconds.
+ Weight::from_parts(14_492_000, 4325)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -166,10 +168,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn set_collection_sponsor() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 14_049_000 picoseconds.
- Weight::from_parts(14_420_000, 4325)
+ // Minimum execution time: 9_217_000 picoseconds.
+ Weight::from_parts(9_499_000, 4325)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -177,10 +179,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn confirm_sponsorship() -> Weight {
// Proof Size summary in bytes:
- // Measured: `999`
+ // Measured: `1032`
// Estimated: `4325`
- // Minimum execution time: 13_689_000 picoseconds.
- Weight::from_parts(14_044_000, 4325)
+ // Minimum execution time: 8_993_000 picoseconds.
+ Weight::from_parts(9_264_000, 4325)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -188,10 +190,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn remove_collection_sponsor() -> Weight {
// Proof Size summary in bytes:
- // Measured: `999`
+ // Measured: `1032`
// Estimated: `4325`
- // Minimum execution time: 13_275_000 picoseconds.
- Weight::from_parts(13_598_000, 4325)
+ // Minimum execution time: 8_804_000 picoseconds.
+ Weight::from_parts(9_302_000, 4325)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -199,10 +201,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn set_transfers_enabled_flag() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 9_411_000 picoseconds.
- Weight::from_parts(9_706_000, 4325)
+ // Minimum execution time: 5_985_000 picoseconds.
+ Weight::from_parts(6_155_000, 4325)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -210,10 +212,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn set_collection_limits() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 13_864_000 picoseconds.
- Weight::from_parts(14_368_000, 4325)
+ // Minimum execution time: 9_288_000 picoseconds.
+ Weight::from_parts(9_608_000, 4325)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -221,10 +223,10 @@
/// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
fn force_repair_collection() -> Weight {
// Proof Size summary in bytes:
- // Measured: `265`
+ // Measured: `298`
// Estimated: `44457`
- // Minimum execution time: 7_104_000 picoseconds.
- Weight::from_parts(7_293_000, 44457)
+ // Minimum execution time: 4_904_000 picoseconds.
+ Weight::from_parts(5_142_000, 44457)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -238,6 +240,8 @@
/// Proof: Common DestroyedCollectionCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: System Account (r:2 w:2)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ /// Storage: Common AdminAmount (r:0 w:1)
+ /// Proof: Common AdminAmount (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen)
/// Storage: Common CollectionPropertyPermissions (r:0 w:1)
/// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
/// Storage: Common CollectionProperties (r:0 w:1)
@@ -247,11 +251,11 @@
fn create_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `245`
- // Estimated: `9174`
- // Minimum execution time: 31_198_000 picoseconds.
- Weight::from_parts(32_046_000, 9174)
+ // Estimated: `6196`
+ // Minimum execution time: 26_618_000 picoseconds.
+ Weight::from_parts(27_287_000, 6196)
.saturating_add(RocksDbWeight::get().reads(4_u64))
- .saturating_add(RocksDbWeight::get().writes(6_u64))
+ .saturating_add(RocksDbWeight::get().writes(7_u64))
}
/// Storage: Common CollectionById (r:1 w:1)
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
@@ -269,10 +273,10 @@
/// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
fn destroy_collection() -> Weight {
// Proof Size summary in bytes:
- // Measured: `1086`
- // Estimated: `9336`
- // Minimum execution time: 48_208_000 picoseconds.
- Weight::from_parts(49_031_000, 9336)
+ // Measured: `1200`
+ // Estimated: `4325`
+ // Minimum execution time: 37_428_000 picoseconds.
+ Weight::from_parts(38_258_000, 4325)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
@@ -282,10 +286,10 @@
/// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
fn add_to_allow_list() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 14_852_000 picoseconds.
- Weight::from_parts(15_268_000, 4325)
+ // Minimum execution time: 9_968_000 picoseconds.
+ Weight::from_parts(10_388_000, 4325)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -295,10 +299,10 @@
/// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
fn remove_from_allow_list() -> Weight {
// Proof Size summary in bytes:
- // Measured: `1000`
+ // Measured: `1033`
// Estimated: `4325`
- // Minimum execution time: 14_595_000 picoseconds.
- Weight::from_parts(14_933_000, 4325)
+ // Minimum execution time: 9_600_000 picoseconds.
+ Weight::from_parts(9_974_000, 4325)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -306,10 +310,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn change_collection_owner() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 14_132_000 picoseconds.
- Weight::from_parts(14_501_000, 4325)
+ // Minimum execution time: 9_185_000 picoseconds.
+ Weight::from_parts(9_525_000, 4325)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -321,10 +325,10 @@
/// Proof: Common AdminAmount (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen)
fn add_collection_admin() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
- // Estimated: `11349`
- // Minimum execution time: 17_229_000 picoseconds.
- Weight::from_parts(17_657_000, 11349)
+ // Measured: `1012`
+ // Estimated: `4325`
+ // Minimum execution time: 12_704_000 picoseconds.
+ Weight::from_parts(13_115_000, 4325)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -337,9 +341,9 @@
fn remove_collection_admin() -> Weight {
// Proof Size summary in bytes:
// Measured: `1107`
- // Estimated: `11349`
- // Minimum execution time: 19_827_000 picoseconds.
- Weight::from_parts(20_479_000, 11349)
+ // Estimated: `4325`
+ // Minimum execution time: 14_185_000 picoseconds.
+ Weight::from_parts(14_492_000, 4325)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -347,10 +351,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn set_collection_sponsor() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 14_049_000 picoseconds.
- Weight::from_parts(14_420_000, 4325)
+ // Minimum execution time: 9_217_000 picoseconds.
+ Weight::from_parts(9_499_000, 4325)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -358,10 +362,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn confirm_sponsorship() -> Weight {
// Proof Size summary in bytes:
- // Measured: `999`
+ // Measured: `1032`
// Estimated: `4325`
- // Minimum execution time: 13_689_000 picoseconds.
- Weight::from_parts(14_044_000, 4325)
+ // Minimum execution time: 8_993_000 picoseconds.
+ Weight::from_parts(9_264_000, 4325)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -369,10 +373,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn remove_collection_sponsor() -> Weight {
// Proof Size summary in bytes:
- // Measured: `999`
+ // Measured: `1032`
// Estimated: `4325`
- // Minimum execution time: 13_275_000 picoseconds.
- Weight::from_parts(13_598_000, 4325)
+ // Minimum execution time: 8_804_000 picoseconds.
+ Weight::from_parts(9_302_000, 4325)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -380,10 +384,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn set_transfers_enabled_flag() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 9_411_000 picoseconds.
- Weight::from_parts(9_706_000, 4325)
+ // Minimum execution time: 5_985_000 picoseconds.
+ Weight::from_parts(6_155_000, 4325)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -391,10 +395,10 @@
/// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
fn set_collection_limits() -> Weight {
// Proof Size summary in bytes:
- // Measured: `967`
+ // Measured: `1000`
// Estimated: `4325`
- // Minimum execution time: 13_864_000 picoseconds.
- Weight::from_parts(14_368_000, 4325)
+ // Minimum execution time: 9_288_000 picoseconds.
+ Weight::from_parts(9_608_000, 4325)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -402,10 +406,10 @@
/// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
fn force_repair_collection() -> Weight {
// Proof Size summary in bytes:
- // Measured: `265`
+ // Measured: `298`
// Estimated: `44457`
- // Minimum execution time: 7_104_000 picoseconds.
- Weight::from_parts(7_293_000, 44457)
+ // Minimum execution time: 4_904_000 picoseconds.
+ Weight::from_parts(5_142_000, 44457)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
primitives/common/src/constants.rsdiffbeforeafterboth--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -52,10 +52,10 @@
pub const SESSION_LENGTH: BlockNumber = HOURS;
// Targeting 0.1 UNQ per transfer
-pub const WEIGHT_TO_FEE_COEFF: u64 = /*<weight2fee>*/76_840_511_488_584_762/*</weight2fee>*/;
+pub const WEIGHT_TO_FEE_COEFF: u64 = /*<weight2fee>*/77_334_604_063_436_322/*</weight2fee>*/;
// Targeting 0.15 UNQ per transfer via ETH
-pub const MIN_GAS_PRICE: u64 = /*<mingasprice>*/1_906_626_161_453/*</mingasprice>*/;
+pub const MIN_GAS_PRICE: u64 = /*<mingasprice>*/1_920_639_188_722/*</mingasprice>*/;
/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.
/// This is used to limit the maximal weight of a single extrinsic.
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -692,7 +692,7 @@
{
use codec::Decode;
- let uxt_decode = <<Block as BlockT>::Extrinsic as Decode>::decode(&mut &uxt)
+ let uxt_decode = <<Block as BlockT>::Extrinsic as Decode>::decode(&mut &*uxt)
.map_err(|_| DispatchError::Other("failed to decode the extrinsic"));
let uxt = match uxt_decode {
runtime/common/weights/xcm.rsdiffbeforeafterboth--- a/runtime/common/weights/xcm.rs
+++ b/runtime/common/weights/xcm.rs
@@ -3,12 +3,12 @@
//! Autogenerated weights for pallet_xcm
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-20, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-26, STEPS: `50`, REPEAT: 400, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/release/unique-collator
+// target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -19,7 +19,7 @@
// *
// --template=.maintain/external-weight-template.hbs
// --steps=50
-// --repeat=80
+// --repeat=400
// --heap-pages=4096
// --output=./runtime/common/weights/xcm.rs
@@ -47,10 +47,10 @@
/// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
fn send() -> Weight {
// Proof Size summary in bytes:
- // Measured: `211`
- // Estimated: `10460`
- // Minimum execution time: 17_089_000 picoseconds.
- Weight::from_parts(17_615_000, 10460)
+ // Measured: `278`
+ // Estimated: `3743`
+ // Minimum execution time: 12_999_000 picoseconds.
+ Weight::from_parts(13_426_000, 3743)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -58,28 +58,28 @@
/// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
fn teleport_assets() -> Weight {
// Proof Size summary in bytes:
- // Measured: `136`
+ // Measured: `169`
// Estimated: `1489`
- // Minimum execution time: 14_443_000 picoseconds.
- Weight::from_parts(14_895_000, 1489)
+ // Minimum execution time: 10_299_000 picoseconds.
+ Weight::from_parts(10_647_000, 1489)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: ParachainInfo ParachainId (r:1 w:0)
/// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
fn reserve_transfer_assets() -> Weight {
// Proof Size summary in bytes:
- // Measured: `136`
+ // Measured: `169`
// Estimated: `1489`
- // Minimum execution time: 14_340_000 picoseconds.
- Weight::from_parts(14_748_000, 1489)
+ // Minimum execution time: 10_094_000 picoseconds.
+ Weight::from_parts(10_464_000, 1489)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
fn execute() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 5_266_000 picoseconds.
- Weight::from_parts(5_430_000, 0)
+ // Minimum execution time: 3_485_000 picoseconds.
+ Weight::from_parts(3_664_000, 0)
}
/// Storage: PolkadotXcm SupportedVersion (r:0 w:1)
/// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
@@ -87,8 +87,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 5_621_000 picoseconds.
- Weight::from_parts(5_888_000, 0)
+ // Minimum execution time: 3_717_000 picoseconds.
+ Weight::from_parts(3_866_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: PolkadotXcm SafeXcmVersion (r:0 w:1)
@@ -97,8 +97,8 @@
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 2_087_000 picoseconds.
- Weight::from_parts(2_218_000, 0)
+ // Minimum execution time: 1_328_000 picoseconds.
+ Weight::from_parts(1_400_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: PolkadotXcm VersionNotifiers (r:1 w:1)
@@ -119,10 +119,10 @@
/// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured)
fn force_subscribe_version_notify() -> Weight {
// Proof Size summary in bytes:
- // Measured: `211`
- // Estimated: `16043`
- // Minimum execution time: 21_067_000 picoseconds.
- Weight::from_parts(21_466_000, 16043)
+ // Measured: `278`
+ // Estimated: `3743`
+ // Minimum execution time: 16_057_000 picoseconds.
+ Weight::from_parts(16_483_000, 3743)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -142,21 +142,31 @@
/// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured)
fn force_unsubscribe_version_notify() -> Weight {
// Proof Size summary in bytes:
- // Measured: `394`
- // Estimated: `15628`
- // Minimum execution time: 23_986_000 picoseconds.
- Weight::from_parts(25_328_000, 15628)
+ // Measured: `461`
+ // Estimated: `3926`
+ // Minimum execution time: 18_009_000 picoseconds.
+ Weight::from_parts(18_565_000, 3926)
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
+ /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1)
+ /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured)
+ fn force_suspension() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 1_378_000 picoseconds.
+ Weight::from_parts(1_447_000, 0)
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
/// Storage: PolkadotXcm SupportedVersion (r:4 w:2)
/// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
fn migrate_supported_version() -> Weight {
// Proof Size summary in bytes:
- // Measured: `131`
- // Estimated: `11021`
- // Minimum execution time: 15_073_000 picoseconds.
- Weight::from_parts(15_451_000, 11021)
+ // Measured: `196`
+ // Estimated: `11086`
+ // Minimum execution time: 10_770_000 picoseconds.
+ Weight::from_parts(11_090_000, 11086)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -164,10 +174,10 @@
/// Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured)
fn migrate_version_notifiers() -> Weight {
// Proof Size summary in bytes:
- // Measured: `135`
- // Estimated: `11025`
- // Minimum execution time: 14_840_000 picoseconds.
- Weight::from_parts(15_347_000, 11025)
+ // Measured: `200`
+ // Estimated: `11090`
+ // Minimum execution time: 10_760_000 picoseconds.
+ Weight::from_parts(11_091_000, 11090)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -175,10 +185,10 @@
/// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured)
fn already_notified_target() -> Weight {
// Proof Size summary in bytes:
- // Measured: `142`
- // Estimated: `13507`
- // Minimum execution time: 16_215_000 picoseconds.
- Weight::from_parts(16_461_000, 13507)
+ // Measured: `207`
+ // Estimated: `13572`
+ // Minimum execution time: 12_026_000 picoseconds.
+ Weight::from_parts(12_321_000, 13572)
.saturating_add(T::DbWeight::get().reads(5_u64))
}
/// Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1)
@@ -195,10 +205,10 @@
/// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
fn notify_current_targets() -> Weight {
// Proof Size summary in bytes:
- // Measured: `278`
- // Estimated: `17013`
- // Minimum execution time: 21_705_000 picoseconds.
- Weight::from_parts(22_313_000, 17013)
+ // Measured: `345`
+ // Estimated: `6285`
+ // Minimum execution time: 15_508_000 picoseconds.
+ Weight::from_parts(15_885_000, 6285)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
@@ -206,20 +216,20 @@
/// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured)
fn notify_target_migration_fail() -> Weight {
// Proof Size summary in bytes:
- // Measured: `172`
- // Estimated: `8587`
- // Minimum execution time: 7_869_000 picoseconds.
- Weight::from_parts(8_052_000, 8587)
+ // Measured: `239`
+ // Estimated: `8654`
+ // Minimum execution time: 5_580_000 picoseconds.
+ Weight::from_parts(5_753_000, 8654)
.saturating_add(T::DbWeight::get().reads(3_u64))
}
/// Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2)
/// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured)
fn migrate_version_notify_targets() -> Weight {
// Proof Size summary in bytes:
- // Measured: `142`
- // Estimated: `11032`
- // Minimum execution time: 15_340_000 picoseconds.
- Weight::from_parts(15_738_000, 11032)
+ // Measured: `207`
+ // Estimated: `11097`
+ // Minimum execution time: 10_951_000 picoseconds.
+ Weight::from_parts(11_341_000, 11097)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -237,16 +247,12 @@
/// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
fn migrate_and_notify_old_targets() -> Weight {
// Proof Size summary in bytes:
- // Measured: `284`
- // Estimated: `21999`
- // Minimum execution time: 27_809_000 picoseconds.
- Weight::from_parts(28_290_000, 21999)
+ // Measured: `349`
+ // Estimated: `11239`
+ // Minimum execution time: 19_990_000 picoseconds.
+ Weight::from_parts(20_433_000, 11239)
.saturating_add(T::DbWeight::get().reads(9_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
- }
-
- fn force_suspension() -> Weight {
- Default::default()
}
}
runtime/tests/src/tests.rsdiffbeforeafterboth--- a/runtime/tests/src/tests.rs
+++ b/runtime/tests/src/tests.rs
@@ -168,6 +168,7 @@
fn get_token_properties(collection_id: CollectionId, token_id: TokenId) -> Vec<Property> {
<pallet_nonfungible::Pallet<Test>>::token_properties((collection_id, token_id))
+ .unwrap_or_default()
.into_iter()
.map(|(key, value)| Property { key, value })
.collect()
tests/package.jsondiffbeforeafterboth--- a/tests/package.json
+++ b/tests/package.json
@@ -48,6 +48,7 @@
"testEthFractionalizer": "yarn _test './**/eth/fractionalizer/**/*.*test.ts'",
"testEthMarketplace": "yarn _test './**/eth/marketplace/**/*.*test.ts'",
"testEthMarket": "yarn _test './**/eth/marketplace-v2/**/*.*test.ts'",
+ "testPerformance": "yarn _test ./**/performance.*test.ts",
"testSub": "yarn _test './**/sub/**/*.*test.ts'",
"testSubNesting": "yarn _test './**/sub/nesting/**/*.*test.ts'",
"testEvent": "yarn _test ./src/check-event/*.*test.ts",
tests/src/migrations/942057-appPromotion/lockedToFreeze.tsdiffbeforeafterboth--- a/tests/src/migrations/942057-appPromotion/lockedToFreeze.ts
+++ b/tests/src/migrations/942057-appPromotion/lockedToFreeze.ts
@@ -4,9 +4,10 @@
import path, {dirname} from 'path';
import {isInteger, parse} from 'lossless-json';
import {fileURLToPath} from 'url';
+import config from '../../config';
-const WS_ENDPOINT = 'ws://localhost:9944';
+const WS_ENDPOINT = config.substrateUrl;
const DONOR_SEED = '//Alice';
const UPDATE_IF_VERSION = 942057;
tests/src/migrations/correctStateAfterMaintenance.tsdiffbeforeafterboth--- a/tests/src/migrations/correctStateAfterMaintenance.ts
+++ b/tests/src/migrations/correctStateAfterMaintenance.ts
@@ -1,8 +1,9 @@
+import config from '../config';
import {usingPlaygrounds} from '../util';
-const WS_ENDPOINT = 'ws://localhost:9944';
+const WS_ENDPOINT = config.substrateUrl;
const DONOR_SEED = '//Alice';
export const main = async(options: { wsEndpoint: string; donorSeed: string } = {
@@ -66,4 +67,4 @@
const chunk = <T>(arr: T[], size: number) =>
Array.from({length: Math.ceil(arr.length / size)}, (_: any, i: number) =>
- arr.slice(i * size, i * size + size));
\ No newline at end of file
+ arr.slice(i * size, i * size + size));
tests/src/performance.seq.test.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/performance.seq.test.ts
@@ -0,0 +1,166 @@
+// Copyright 2019-2023 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {ApiPromise} from '@polkadot/api';
+import {IKeyringPair} from '@polkadot/types/types';
+import {expect, itSub, usingPlaygrounds} from './util';
+import {ICrossAccountId, IProperty} from './util/playgrounds/types';
+import {UniqueHelper} from './util/playgrounds/unique';
+
+describe('Performace tests', () => {
+ let alice: IKeyringPair;
+ const MAX_TOKENS_TO_MINT = 200;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({url: import.meta.url});
+ [alice] = await helper.arrange.createAccounts([100_000n], donor);
+ });
+ });
+
+ itSub('NFT tokens minting', async ({helper}) => {
+ const propertyKey = 'prop-a';
+ const collection = await helper.nft.mintCollection(alice, {
+ name: 'test properties',
+ description: 'test properties collection',
+ tokenPrefix: 'TPC',
+ tokenPropertyPermissions: [
+ {key: propertyKey, permission: {mutable: true, collectionAdmin: true, tokenOwner: true}},
+ ],
+ });
+
+
+ const results = [];
+ const step = 1_000;
+ const sizeOfKey = sizeOfEncodedStr(propertyKey);
+ let currentSize = step;
+ let startCount = 0;
+ let minterFunc = tryMintUnsafeRPC;
+ try {
+ startCount = await tryMintUnsafeRPC(helper, alice, MAX_TOKENS_TO_MINT, collection.collectionId, {Substrate: alice.address});
+ }
+ catch (e) {
+ startCount = await tryMintExplicit(helper, alice, MAX_TOKENS_TO_MINT, collection.collectionId, {Substrate: alice.address});
+ minterFunc = tryMintExplicit;
+ }
+ results.push({propertySize: 0, tokens: startCount});
+
+ while(currentSize <= 32_000) {
+ const property = {key: propertyKey, value: 'A'.repeat(currentSize - sizeOfKey - sizeOfInt(currentSize))};
+ const maxTokens = Math.ceil(results.map(x => x.tokens).reduce((a, b) => a + b) / results.length);
+ const tokens = await minterFunc(helper, alice, maxTokens, collection.collectionId, {Substrate: alice.address}, property);
+ results.push({propertySize: sizeOfProperty(property), tokens});
+ currentSize += step;
+ await helper.wait.newBlocks(2);
+ }
+
+ expect(results).to.be.deep.equal([
+ {propertySize: 0, tokens: 200},
+ {propertySize: 1000, tokens: 149},
+ {propertySize: 2000, tokens: 149},
+ {propertySize: 3000, tokens: 149},
+ {propertySize: 4000, tokens: 149},
+ {propertySize: 5000, tokens: 149},
+ {propertySize: 6000, tokens: 149},
+ {propertySize: 7000, tokens: 149},
+ {propertySize: 8000, tokens: 149},
+ {propertySize: 9000, tokens: 149},
+ {propertySize: 10000, tokens: 149},
+ {propertySize: 11000, tokens: 149},
+ {propertySize: 12000, tokens: 149},
+ {propertySize: 13000, tokens: 149},
+ {propertySize: 14000, tokens: 149},
+ {propertySize: 15000, tokens: 149},
+ {propertySize: 16000, tokens: 149},
+ {propertySize: 17000, tokens: 149},
+ {propertySize: 18000, tokens: 149},
+ {propertySize: 19000, tokens: 149},
+ {propertySize: 20000, tokens: 149},
+ {propertySize: 21000, tokens: 149},
+ {propertySize: 22000, tokens: 149},
+ {propertySize: 23000, tokens: 149},
+ {propertySize: 24000, tokens: 149},
+ {propertySize: 25000, tokens: 149},
+ {propertySize: 26000, tokens: 149},
+ {propertySize: 27000, tokens: 145},
+ {propertySize: 28000, tokens: 140},
+ {propertySize: 29000, tokens: 135},
+ {propertySize: 30000, tokens: 130},
+ {propertySize: 31000, tokens: 126},
+ {propertySize: 32000, tokens: 122},
+ ]);
+ });
+});
+
+
+const dryRun = async (api: ApiPromise, signer: IKeyringPair, tx: any) => {
+ const signed = await tx.signAsync(signer);
+ const dryRun = await api.rpc.system.dryRun(signed.toHex());
+ return dryRun.isOk && dryRun.asOk.isOk;
+};
+
+const getTokens = (tokensCount: number, owner: ICrossAccountId, property?: IProperty) => (new Array(tokensCount)).fill(0).map(() => {
+ const token = {owner} as {owner: ICrossAccountId, properties?: IProperty[]};
+ if(property) token.properties = [property];
+ return token;
+});
+
+const tryMintUnsafeRPC = async (helper: UniqueHelper, signer: IKeyringPair, tokensCount: number, collectionId: number, owner: ICrossAccountId, property?: IProperty): Promise<number> => {
+ if(tokensCount < 10) console.log('try mint', tokensCount, 'tokens');
+ const tokens = getTokens(tokensCount, owner, property);
+ const tx = helper.constructApiCall('api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}]);
+ if(!(await dryRun(helper.getApi(), signer, tx))) {
+ if(tokensCount < 2) return 0;
+ return await tryMintUnsafeRPC(helper, signer, tokensCount - 1, collectionId, owner, property);
+ }
+ await helper.executeExtrinsic(signer, 'api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}]);
+ return tokensCount;
+};
+
+const tryMintExplicit = async (helper: UniqueHelper, signer: IKeyringPair, tokensCount: number, collectionId: number, owner: ICrossAccountId, property?: IProperty): Promise<number> => {
+ const tokens = getTokens(tokensCount, owner, property);
+ try {
+ await helper.executeExtrinsic(signer, 'api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}]);
+ }
+ catch (e) {
+ if(tokensCount < 2) return 0;
+ return await tryMintExplicit(helper, signer, tokensCount - 1, collectionId, owner, property);
+ }
+ return tokensCount;
+};
+
+function sizeOfProperty(prop: IProperty) {
+ return sizeOfEncodedStr(prop.key) + sizeOfEncodedStr(prop.value!);
+}
+
+function sizeOfInt(i: number) {
+ if(i < 0 || i > 0xffffffff) throw new Error('out of range');
+ if(i < 0b11_1111) {
+ return 1;
+ } else if(i < 0b11_1111_1111_1111) {
+ return 2;
+ } else if(i < 0b11_1111_1111_1111_1111_1111_1111_1111) {
+ return 4;
+ } else {
+ return 5;
+ }
+}
+
+const UTF8_ENCODER = new TextEncoder();
+function sizeOfEncodedStr(v: string) {
+ const encoded = UTF8_ENCODER.encode(v);
+ return sizeOfInt(encoded.length) + encoded.length;
+}