diff --git a/Cargo.lock b/Cargo.lock index 75ec868171..54fb73664f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10679,7 +10679,7 @@ dependencies = [ [[package]] name = "polymesh" -version = "8.1.2" +version = "8.1.3" dependencies = [ "array-bytes 6.2.3", "clap", diff --git a/Cargo.toml b/Cargo.toml index 95e135d25f..4231dbac47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,7 +127,7 @@ members = [ exclude = ["contracts", "integration", "metadata-tools"] [workspace.package] -version = "8.1.2" +version = "8.1.3" authors = ["PolymeshAssociation"] license-file = "./LICENSE" edition = "2021" diff --git a/pallets/asset/src/lib.rs b/pallets/asset/src/lib.rs index f8829eb056..0d00d42f7d 100644 --- a/pallets/asset/src/lib.rs +++ b/pallets/asset/src/lib.rs @@ -3525,7 +3525,7 @@ impl Pallet { } /// Ensure asset metadata `value` is within the global limit. - fn ensure_asset_metadata_value_limited(value: &AssetMetadataValue) -> DispatchResult { + pub fn ensure_asset_metadata_value_limited(value: &AssetMetadataValue) -> DispatchResult { ensure!( value.len() <= T::AssetMetadataValueMaxLength::get() as usize, Error::::AssetMetadataValueMaxLengthExceeded diff --git a/pallets/compliance-manager/src/benchmarking.rs b/pallets/compliance-manager/src/benchmarking.rs index 6f3eed8738..7f44600fda 100644 --- a/pallets/compliance-manager/src/benchmarking.rs +++ b/pallets/compliance-manager/src/benchmarking.rs @@ -21,14 +21,12 @@ use pallet_identity::Config as IdentityConfig; use polymesh_primitives::agent::AgentGroup; use polymesh_primitives::traits::AssetFnTrait; use polymesh_primitives::{ - asset::AssetType, AssetHolderKind, AuthorizationData, ClaimType, CountryCode, Scope, - TargetIdentity, TrustedFor, TrustedIssuer, WeightMeter, + asset::AssetType, AssetHolderKind, AuthorizationData, ClaimType, CountryCode, + CustomClaimTypeId, Scope, TargetIdentity, TrustedFor, TrustedIssuer, WeightMeter, }; use crate::*; -const MAX_DEFAULT_TRUSTED_CLAIM_ISSUERS: u32 = 3; -const MAX_TRUSTED_ISSUER_PER_CONDITION: u32 = 3; const MAX_SENDER_CONDITIONS_PER_COMPLIANCE: u32 = 3; const MAX_RECEIVER_CONDITIONS_PER_COMPLIANCE: u32 = 3; const MAX_CONDITIONS_PER_COMPLIANCE: u32 = @@ -38,21 +36,26 @@ const MAX_COMPLIANCE_REQUIREMENTS: u32 = 2; const MAX_CONDITIONS: u32 = 10; const MAX_CONDITION_TYPE_CLAIMS: u32 = 10; const MAX_CONDITION_ISSUERS: u32 = 10; -const MAX_CONDITION_ISSUER_CLAIM_TYPES: u32 = 10; - -const CLAIM_TYPES: &[ClaimType] = &[ - ClaimType::Accredited, - ClaimType::Affiliate, - ClaimType::BuyLockup, - ClaimType::SellLockup, - ClaimType::CustomerDueDiligence, - ClaimType::KnowYourCustomer, - ClaimType::Jurisdiction, - ClaimType::Exempted, - ClaimType::Blocked, -]; - -/// Create a token issuer trusted for `Any`. +const MAX_CONDITION_ISSUER_CLAIM_TYPES: u32 = 16; + +/// Returns the maximum number of trusted issuers allowed by the runtime. +fn max_trusted_issuers() -> u32 { + T::MaximumNumberOfTrustedIssuers::get() +} + +/// Returns the maximum number of claim types a trusted issuer can be trusted for. +fn max_trusted_issuer_claim_types() -> usize { + T::MaxTrustedIssuerClaimTypes::get() as usize +} + +/// Returns the maximum number of trusted issuers each condition can have, such that +/// `total_conditions` conditions (with one claim each) stay within `MaxConditionComplexity`. +fn max_issuers_per_condition(total_conditions: u32) -> u32 { + let by_complexity = T::MaxConditionComplexity::get() / total_conditions.max(1); + max_trusted_issuers::().min(by_complexity).max(1) +} + +/// Create a token issuer trusted for `Any`, or for `claim_type_len` distinct custom claim types. pub fn make_issuer(id: u32, claim_type_len: Option) -> TrustedIssuer { let u = UserBuilder::::default() .generate_did() @@ -63,9 +66,9 @@ pub fn make_issuer(id: u32, claim_type_len: Option) -> trusted_for: match claim_type_len { None => TrustedFor::Any, Some(len) => TrustedFor::Specific( + // Custom claim types have the largest encoding and are distinct, so they are not removed by dedup. (0..len) - .into_iter() - .map(|idx| CLAIM_TYPES[idx % CLAIM_TYPES.len()]) + .map(|idx| ClaimType::Custom(CustomClaimTypeId(idx as u32 + 1))) .collect(), ), }, @@ -149,15 +152,18 @@ struct ComplianceRequirementInfo { } impl ComplianceRequirementInfo { + /// Adds `i` default trusted issuers, each trusted for the maximum number of claim types. pub fn add_default_trusted_claim_issuer(self: &Self, i: u32) { - make_issuers::(i, None).into_iter().for_each(|issuer| { - Pallet::::add_default_trusted_claim_issuer( - self.owner.origin.clone().into(), - self.asset_id, - issuer, - ) - .unwrap(); - }); + make_issuers::(i, Some(max_trusted_issuer_claim_types::())) + .into_iter() + .for_each(|issuer| { + Pallet::::add_default_trusted_claim_issuer( + self.owner.origin.clone().into(), + self.asset_id, + issuer, + ) + .unwrap(); + }); } } @@ -294,15 +300,9 @@ where }); if read_trusted_issuers_storage { - // Adds all trusted issuers as the default for the asset_id - trusted_issuers.into_iter().for_each(|trusted_issuer| { - Pallet::::base_add_default_trusted_claim_issuer( - sender.did(), - asset_id, - trusted_issuer, - ) - .unwrap(); - }); + // Adds all trusted issuers as the default for the asset_id. + // NB: Storage is written directly, since `n_issuers` can exceed `MaximumNumberOfTrustedIssuers`. + TrustedClaimIssuer::::insert(asset_id, trusted_issuers); let condition = Condition::new(ConditionType::IsNoneOf(claims), Vec::new()); return condition; } @@ -311,22 +311,38 @@ where } /// Adds `n` requirements for `asset_id` and pauses compliance if `pause_compliance` is true. +/// +/// The requirements are built for the worst case (each has complexity 1): +/// - The first `n - 1` requirements fail (no claims are issued, so `IsAnyOf` is false), +/// forcing all requirements to be evaluated. The last one uses `IsNoneOf`, so the asset is still compliant. +/// - Each requirement's claim scope is unique per asset, so no claim read is shared (cached) between assets. pub fn setup_asset_compliance( caller_did: IdentityId, asset_id: AssetId, n: u32, pause_compliance: bool, ) { + let claim_types: Vec = (1..T::MaxTrustedIssuerClaimTypes::get()) + .map(|i| ClaimType::Custom(CustomClaimTypeId(i))) + .chain(core::iter::once(ClaimType::Jurisdiction)) + .collect(); + (0..n).for_each(|i| { - let trusted_issuers = vec![TrustedIssuer::from(IdentityId::from(i as u128))]; - let claims = vec![Claim::Jurisdiction( - CountryCode::BR, - Scope::Custom(vec![i as u8]), - )]; - let sender_conditions = vec![Condition::new( - ConditionType::IsNoneOf(claims), - trusted_issuers, - )]; + let trusted_issuers = vec![TrustedIssuer { + issuer: IdentityId::from(i as u128), + trusted_for: TrustedFor::Specific(claim_types.clone()), + }]; + // The scope includes `asset_id` so that each asset reads unique `Identity::Claims` keys. + let mut scope = vec![0u8; 32]; + scope[..16].copy_from_slice(asset_id.as_ref()); + scope[16..20].copy_from_slice(&i.to_le_bytes()); + let claims = vec![Claim::Jurisdiction(CountryCode::BR, Scope::Custom(scope))]; + let condition_type = if i + 1 < n { + ConditionType::IsAnyOf(claims) + } else { + ConditionType::IsNoneOf(claims) + }; + let sender_conditions = vec![Condition::new(condition_type, trusted_issuers)]; Pallet::::base_add_compliance_requirement( caller_did, asset_id, @@ -357,7 +373,10 @@ benchmarks! { // INTERNAL: This benchmark only evaluate the adding operation. Its execution should be measured in another module. let c in 1..MAX_CONDITIONS_PER_COMPLIANCE; - let d = ComplianceRequirementBuilder::::new(MAX_TRUSTED_ISSUER_PER_CONDITION, c).build(); + let d = ComplianceRequirementBuilder::::new( + max_issuers_per_condition::(MAX_CONDITIONS_PER_COMPLIANCE), + c + ).build(); }: _(d.owner.origin, d.asset_id, d.sender_conditions.clone(), d.receiver_conditions.clone()) verify { @@ -369,7 +388,7 @@ benchmarks! { remove_compliance_requirement { // Add the compliance requirement. let d = ComplianceRequirementBuilder::::new( - MAX_TRUSTED_ISSUER_PER_CONDITION, + max_issuers_per_condition::(MAX_CONDITIONS_PER_COMPLIANCE), MAX_CONDITIONS_PER_COMPLIANCE) .add_compliance_requirement().build(); @@ -388,7 +407,7 @@ benchmarks! { pause_asset_compliance { let d = ComplianceRequirementBuilder::::new( - MAX_TRUSTED_ISSUER_PER_CONDITION, + max_issuers_per_condition::(MAX_CONDITIONS_PER_COMPLIANCE), MAX_CONDITIONS_PER_COMPLIANCE) .add_compliance_requirement().build(); }: _(d.owner.origin, d.asset_id) @@ -410,13 +429,15 @@ benchmarks! { add_default_trusted_claim_issuer { // Create and add the compliance requirement. - let d = ComplianceRequirementBuilder::::new(1, 1) + // The conditions have no issuers, so the complexity check depends on the default trusted issuers. + let d = ComplianceRequirementBuilder::::new(0, MAX_CONDITIONS_PER_COMPLIANCE) .add_compliance_requirement() .build(); - d.add_default_trusted_claim_issuer(MAX_DEFAULT_TRUSTED_CLAIM_ISSUERS -1); + let max_issuers = max_trusted_issuers::(); + d.add_default_trusted_claim_issuer(max_issuers - 1); // Add one more for benchmarking. - let new_issuer = make_issuer::(MAX_DEFAULT_TRUSTED_CLAIM_ISSUERS, None); + let new_issuer = make_issuer::(max_issuers, Some(max_trusted_issuer_claim_types::())); }: _(d.owner.origin, d.asset_id, new_issuer.clone()) verify { let trusted_issuers = TrustedClaimIssuer::::get(d.asset_id); @@ -430,8 +451,8 @@ benchmarks! { let d = ComplianceRequirementBuilder::::new(2, 1) .add_compliance_requirement().build(); - // Generate some trusted issuer. - d.add_default_trusted_claim_issuer(MAX_DEFAULT_TRUSTED_CLAIM_ISSUERS); + // Generate the maximum number of trusted issuers. + d.add_default_trusted_claim_issuer(max_trusted_issuers::()); // Delete the latest trusted issuer. let issuer = TrustedClaimIssuer::::get(d.asset_id).pop().unwrap(); @@ -449,7 +470,7 @@ benchmarks! { // Add maximum size compliance requirements. let d = ComplianceRequirementBuilder::::new( - MAX_TRUSTED_ISSUER_PER_CONDITION, + max_issuers_per_condition::(MAX_CONDITIONS_PER_COMPLIANCE), MAX_CONDITIONS_PER_COMPLIANCE) .add_compliance_requirement().build(); @@ -458,7 +479,10 @@ benchmarks! { // Build a new set of compliance requirements. let (sender_count, receiver_count) = split_conditions(c); - let issuers = make_issuers::(MAX_TRUSTED_ISSUER_PER_CONDITION, None); + let issuers = make_issuers::( + max_issuers_per_condition::(MAX_CONDITIONS_PER_COMPLIANCE), + None + ); let new_req = ComplianceRequirement { id, sender_conditions: make_conditions(sender_count, None, &issuers), @@ -478,13 +502,15 @@ benchmarks! { replace_asset_compliance { let c in 0..MAX_COMPLIANCE_REQUIREMENTS; + // The issuers are limited so that all requirements stay within `MaxConditionComplexity`. + let issuers_count = + max_issuers_per_condition::(MAX_COMPLIANCE_REQUIREMENTS * MAX_CONDITIONS_PER_COMPLIANCE); + // Always add at least one compliance requirement. - let d = ComplianceRequirementBuilder::::new( - MAX_TRUSTED_ISSUER_PER_CONDITION, - MAX_CONDITIONS_PER_COMPLIANCE) + let d = ComplianceRequirementBuilder::::new(issuers_count, MAX_CONDITIONS_PER_COMPLIANCE) .add_compliance_requirement().build(); - let issuers = make_issuers::(MAX_TRUSTED_ISSUER_PER_CONDITION, None); + let issuers = make_issuers::(issuers_count, None); let sender_conditions = make_conditions(MAX_SENDER_CONDITIONS_PER_COMPLIANCE, None, &issuers); let receiver_conditions = make_conditions(MAX_RECEIVER_CONDITIONS_PER_COMPLIANCE, None, &issuers); @@ -513,7 +539,7 @@ benchmarks! { reset_asset_compliance { // Add the compliance requirement. let d = ComplianceRequirementBuilder::::new( - MAX_TRUSTED_ISSUER_PER_CONDITION, + max_issuers_per_condition::(MAX_CONDITIONS_PER_COMPLIANCE), MAX_CONDITIONS_PER_COMPLIANCE) .add_compliance_requirement().build(); }: _(d.owner.origin, d.asset_id) diff --git a/pallets/compliance-manager/src/lib.rs b/pallets/compliance-manager/src/lib.rs index 63f821bf05..8d78587135 100644 --- a/pallets/compliance-manager/src/lib.rs +++ b/pallets/compliance-manager/src/lib.rs @@ -85,7 +85,6 @@ use frame_support::weights::Weight; use frame_system::pallet_prelude::OriginFor; use sp_std::{convert::From, prelude::*}; -use pallet_base::ensure_length_ok; use pallet_external_agents::{Config as EAConfig, GroupOfAgent}; use polymesh_primitives::asset::AssetId; use polymesh_primitives::compliance_manager::{ @@ -126,6 +125,15 @@ pub mod pallet { /// The maximum claim reads that are allowed to happen in worst case of a condition resolution #[pallet::constant] type MaxConditionComplexity: Get; + + /// The maximum number of trusted issuers allowed in the default trusted claim issuers of an asset + /// and in the `issuers` list of each condition. + #[pallet::constant] + type MaximumNumberOfTrustedIssuers: Get; + + /// The maximum number of claim types a trusted issuer can be trusted for (`TrustedFor::Specific`). + #[pallet::constant] + type MaxTrustedIssuerClaimTypes: Get; } #[pallet::event] @@ -260,6 +268,10 @@ pub mod pallet { ComplianceRequirementTooComplex, /// The maximum weight limit for executing the function was exceeded. WeightLimitExceeded, + /// The number of trusted issuers exceeds `MaximumNumberOfTrustedIssuers`. + TooManyTrustedIssuers, + /// The number of claim types of a trusted issuer exceeds `MaxTrustedIssuerClaimTypes`. + TooManyTrustedIssuerClaimTypes, } #[pallet::pallet] @@ -591,7 +603,7 @@ impl Pallet { TrustedClaimIssuer::::try_mutate(asset_id, |issuers| { // Ensure we don't have too many issuers now in total. let new_count = issuers.len().saturating_add(1); - ensure_length_ok::(new_count)?; + Self::ensure_trusted_issuers_count_limited(new_count)?; // Ensure the new issuer is new. ensure!( @@ -815,17 +827,31 @@ impl Pallet { fn ensure_issuers_in_req_limited(req: &ComplianceRequirement) -> DispatchResult { req.conditions().try_for_each(|cond| { - ensure_length_ok::(cond.issuers.len())?; + Self::ensure_trusted_issuers_count_limited(cond.issuers.len())?; cond.issuers .iter() .try_for_each(Self::ensure_issuer_limited) }) } + fn ensure_trusted_issuers_count_limited(count: usize) -> DispatchResult { + ensure!( + count <= T::MaximumNumberOfTrustedIssuers::get() as usize, + Error::::TooManyTrustedIssuers + ); + Ok(()) + } + fn ensure_issuer_limited(issuer: &TrustedIssuer) -> DispatchResult { match &issuer.trusted_for { TrustedFor::Any => Ok(()), - TrustedFor::Specific(cts) => ensure_length_ok::(cts.len()), + TrustedFor::Specific(cts) => { + ensure!( + cts.len() <= T::MaxTrustedIssuerClaimTypes::get() as usize, + Error::::TooManyTrustedIssuerClaimTypes + ); + Ok(()) + } } } diff --git a/pallets/nft/src/benchmarking.rs b/pallets/nft/src/benchmarking.rs index b15a8d8913..484d2c90d8 100644 --- a/pallets/nft/src/benchmarking.rs +++ b/pallets/nft/src/benchmarking.rs @@ -68,10 +68,11 @@ fn create_collection_issue_nfts( ) -> AssetId { let (asset_id, _) = create_collection::(collection_owner, n_keys); + let max_value_len = ::AssetMetadataValueMaxLength::get(); let metadata_attributes: Vec = (1..n_keys + 1) .map(|key| NFTMetadataAttribute { key: AssetMetadataKey::Global(AssetMetadataGlobalKey(key.into())), - value: AssetMetadataValue(b"value".to_vec()), + value: AssetMetadataValue(vec![b'v'; max_value_len as usize]), }) .collect(); for _ in 0..n_nfts { @@ -162,11 +163,12 @@ benchmarks! { let user = user::("target", 0); let (asset_id, collection_id) = create_collection::(&user, n); + let max_value_len = ::AssetMetadataValueMaxLength::get(); let metadata_attributes: Vec = (1..n + 1) .map(|key| { NFTMetadataAttribute{ key: AssetMetadataKey::Global(AssetMetadataGlobalKey(key.into())), - value: AssetMetadataValue(b"value".to_vec()), + value: AssetMetadataValue(vec![b'v'; max_value_len as usize]), } }) .collect(); @@ -365,4 +367,46 @@ benchmarks! { } } + nft_transfer_report_best_case { + let alice = UserBuilder::::default().generate_did().build("Alice"); + let bob = UserBuilder::::default().generate_did().build("Bob"); + let mut weight_meter = WeightMeter::max_limit_no_minimum(); + + // 50 compliance requirements are set but paused, so none are evaluated (AssetCompliances is still read) + let (asset_id, sender, receiver, _) = + setup_nft_transfer::(&alice, &bob, 1, None, None, true, 0, false); + }: { + assert!( + Pallet::::nft_transfer_report( + &sender, + &receiver, + &NFTs::new_unverified(asset_id, vec![NFTId(1)]), + false, + &mut weight_meter + ) + .is_empty() + ); + } + + nft_transfer_report_worst_case { + let alice = UserBuilder::::default().generate_did().build("Alice"); + let bob = UserBuilder::::default().generate_did().build("Bob"); + let mut weight_meter = WeightMeter::max_limit_no_minimum(); + + // 50 active compliance requirements are set; statistics are not read by nft_transfer_report + let (asset_id, sender, receiver, _) = + setup_nft_transfer::(&alice, &bob, 1, None, None, false, 0, false); + }: { + assert!( + Pallet::::nft_transfer_report( + &sender, + &receiver, + &NFTs::new_unverified(asset_id, vec![NFTId(1)]), + false, + &mut weight_meter + ) + .is_empty() + ); + } + } diff --git a/pallets/nft/src/lib.rs b/pallets/nft/src/lib.rs index 1738451a1d..b669e12aa9 100644 --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -47,6 +47,8 @@ pub trait WeightInfo { fn approve() -> Weight; fn set_approval_for_all() -> Weight; fn spend_nft_approval(n: u32) -> Weight; + fn nft_transfer_report_best_case() -> Weight; + fn nft_transfer_report_worst_case() -> Weight; } pub use pallet::*; @@ -301,6 +303,7 @@ pub mod pallet { /// - `CollectionNotFound` - if the collection associated to the given asset_id has not been created. /// - `InvalidMetadataAttribute` - if the number of attributes is not equal to the number set in the collection or attempting to set a value for a key not definied in the collection. /// - `DuplicateMetadataKey` - if a duplicate metadata keys has been passed as input. + /// - `AssetMetadataValueMaxLengthExceeded` - if any metadata value exceeds `AssetMetadataValueMaxLength`. /// /// /// # Permissions @@ -679,11 +682,12 @@ impl Pallet { Error::::DuplicateMetadataKey ); - for metadata_key in nft_attributes.keys() { + for (metadata_key, metadata_value) in nft_attributes.iter() { ensure!( mandatory_keys.contains(metadata_key), Error::::InvalidMetadataAttribute ); + AssetPallet::::ensure_asset_metadata_value_limited(metadata_value)?; } // Mints the NFT and adds it to the caller's portfolio diff --git a/pallets/precompiles/src/common.rs b/pallets/precompiles/src/common.rs index e74205ad4d..fb37467d24 100644 --- a/pallets/precompiles/src/common.rs +++ b/pallets/precompiles/src/common.rs @@ -47,6 +47,7 @@ pub const ERR_BALANCE_CONVERSION_FAILED: &str = "Balance conversion failed"; pub const ERR_EXTRINSIC_ERROR: &str = "Extrinsic returned an error: "; pub const ERR_INVALID_ACCOUNT_ID: &str = "Invalid account id"; pub const ERR_ASSET_NOT_FOUND: &str = "Asset not found"; +pub const ERR_WEIGHT_LIMIT_EXCEEDED: &str = "Benchmarked weight limit exceeded"; pub const ERR_INST_NOT_EXECUTED: &str = "Instruction was not executed; Most likely the instruction is missing an affirmation from the receiver/mediator"; const ERR_ASSET_NOT_FUNGIBLE: &str = "Asset is not fungible"; const ERR_ASSET_NOT_NON_FUNGIBLE: &str = "Asset is not non-fungible"; diff --git a/pallets/precompiles/src/interface/fungible_asset/erc7943.rs b/pallets/precompiles/src/interface/fungible_asset/erc7943.rs index b2d10c8920..ec00df79e9 100644 --- a/pallets/precompiles/src/interface/fungible_asset/erc7943.rs +++ b/pallets/precompiles/src/interface/fungible_asset/erc7943.rs @@ -23,8 +23,9 @@ use pallet_asset::WeightInfo; use polymesh_precompiles::{IFungibleAsset, IFungibleAssetEvents}; use polymesh_primitives::asset::AssetId; use polymesh_primitives::WeightMeter; +use sp_runtime::Weight; -use crate::common::Common; +use crate::common::{revert, Common, ERR_WEIGHT_LIMIT_EXCEEDED}; use crate::interface::FungibleAssetInterface; use crate::Config; @@ -35,33 +36,37 @@ impl FungibleAssetInterface { call: &IFungibleAsset::canTransferCall, env: &mut impl Ext, ) -> Result, Error> { - let transfer_report_worst_case_weight = + let best_case_weight = + ::WeightInfo::asset_transfer_report_best_case(); + let worst_case_weight = ::WeightInfo::asset_transfer_report_worst_case(); - let charged = env.charge(transfer_report_worst_case_weight)?; + let charged = env.charge(worst_case_weight)?; let from = Common::::asset_holder(env, call.from)?; let to = Common::::asset_holder(env, call.to)?; + let value = Common::::to_balance(call.value)?; - let mut weight_meter = WeightMeter::max_limit_no_minimum(); + // The best case covers the fixed work, the meter only gets the variable rest + let mut weight_meter = WeightMeter::from_limit_unchecked( + Weight::zero(), + worst_case_weight.saturating_sub(best_case_weight), + ); let errors = pallet_asset::Pallet::::asset_transfer_report( &from, &to, &asset_id, - Common::::to_balance(call.value)?, + value, false, &mut weight_meter, ); - let transfer_report_weight = - ::WeightInfo::asset_transfer_report_best_case(); - let compliance_and_statistics_weight = weight_meter.consumed(); - let real_consumed_weight = - transfer_report_weight.saturating_add(compliance_and_statistics_weight); - - if real_consumed_weight.ref_time() < transfer_report_worst_case_weight.ref_time() { - env.adjust_gas(charged, real_consumed_weight); + if weight_meter.limit_exceeded() { + return Err(revert(ERR_WEIGHT_LIMIT_EXCEEDED)); } + let real_consumed_weight = best_case_weight.saturating_add(weight_meter.consumed()); + env.adjust_gas(charged, real_consumed_weight.min(worst_case_weight)); + Ok(IFungibleAsset::canTransferCall::abi_encode_returns( &errors.is_empty(), )) @@ -164,13 +169,19 @@ impl FungibleAssetInterface { call: &IFungibleAsset::canSendCall, env: &mut impl Ext, ) -> Result, Error> { - let transfer_is_allowed_for_holder_worst_case_weight = + let best_case_weight = + ::WeightInfo::transfer_is_allowed_for_holder_best_case(); + let worst_case_weight = ::WeightInfo::transfer_is_allowed_for_holder_worst_case(); - let charged = env.charge(transfer_is_allowed_for_holder_worst_case_weight)?; + let charged = env.charge(worst_case_weight)?; let sender = Common::::asset_holder(env, call.account)?; - let mut weight_meter = WeightMeter::max_limit_no_minimum(); + // The best case covers the fixed work, the meter only gets the variable rest + let mut weight_meter = WeightMeter::from_limit_unchecked( + Weight::zero(), + worst_case_weight.saturating_sub(best_case_weight), + ); let allowed = pallet_asset::Pallet::::transfer_is_allowed_for_holder( &sender, &asset_id, @@ -178,17 +189,13 @@ impl FungibleAssetInterface { &mut weight_meter, ); - let transfer_is_allowed_weight = - ::WeightInfo::transfer_is_allowed_for_holder_best_case(); - let compliance_weight = weight_meter.consumed(); - let real_consumed_weight = transfer_is_allowed_weight.saturating_add(compliance_weight); - - if real_consumed_weight.ref_time() - < transfer_is_allowed_for_holder_worst_case_weight.ref_time() - { - env.adjust_gas(charged, real_consumed_weight); + if weight_meter.limit_exceeded() { + return Err(revert(ERR_WEIGHT_LIMIT_EXCEEDED)); } + let real_consumed_weight = best_case_weight.saturating_add(weight_meter.consumed()); + env.adjust_gas(charged, real_consumed_weight.min(worst_case_weight)); + Ok(IFungibleAsset::canSendCall::abi_encode_returns(&allowed)) } @@ -198,13 +205,19 @@ impl FungibleAssetInterface { call: &IFungibleAsset::canReceiveCall, env: &mut impl Ext, ) -> Result, Error> { - let transfer_is_allowed_for_holder_worst_case_weight = + let best_case_weight = + ::WeightInfo::transfer_is_allowed_for_holder_best_case(); + let worst_case_weight = ::WeightInfo::transfer_is_allowed_for_holder_worst_case(); - let charged = env.charge(transfer_is_allowed_for_holder_worst_case_weight)?; + let charged = env.charge(worst_case_weight)?; let receiver = Common::::asset_holder(env, call.account)?; - let mut weight_meter = WeightMeter::max_limit_no_minimum(); + // The best case covers the fixed work, the meter only gets the variable rest + let mut weight_meter = WeightMeter::from_limit_unchecked( + Weight::zero(), + worst_case_weight.saturating_sub(best_case_weight), + ); let allowed = pallet_asset::Pallet::::transfer_is_allowed_for_holder( &receiver, &asset_id, @@ -212,17 +225,13 @@ impl FungibleAssetInterface { &mut weight_meter, ); - let transfer_is_allowed_weight = - ::WeightInfo::transfer_is_allowed_for_holder_best_case(); - let compliance_weight = weight_meter.consumed(); - let real_consumed_weight = transfer_is_allowed_weight.saturating_add(compliance_weight); - - if real_consumed_weight.ref_time() - < transfer_is_allowed_for_holder_worst_case_weight.ref_time() - { - env.adjust_gas(charged, real_consumed_weight); + if weight_meter.limit_exceeded() { + return Err(revert(ERR_WEIGHT_LIMIT_EXCEEDED)); } + let real_consumed_weight = best_case_weight.saturating_add(weight_meter.consumed()); + env.adjust_gas(charged, real_consumed_weight.min(worst_case_weight)); + Ok(IFungibleAsset::canReceiveCall::abi_encode_returns(&allowed)) } } diff --git a/pallets/precompiles/src/interface/nft/erc7943.rs b/pallets/precompiles/src/interface/nft/erc7943.rs index 4afc579cfc..99890a664e 100644 --- a/pallets/precompiles/src/interface/nft/erc7943.rs +++ b/pallets/precompiles/src/interface/nft/erc7943.rs @@ -27,8 +27,9 @@ use polymesh_precompiles::{INonFungibleAsset, INonFungibleAssetEvents}; use polymesh_primitives::asset::AssetId; use polymesh_primitives::nft::NFTs; use polymesh_primitives::WeightMeter; +use sp_runtime::Weight; -use crate::common::Common; +use crate::common::{revert, Common, ERR_WEIGHT_LIMIT_EXCEEDED}; use crate::interface::nft::NonFungibleAssetInterface; use crate::Config; @@ -39,8 +40,10 @@ impl NonFungibleAssetInterface { call: &INonFungibleAsset::canTransferCall, env: &mut impl Ext, ) -> Result, Error> { - // `nft_transfer_report` performs the same checks as a single-NFT transfer. - let worst_case_weight = ::WeightInfo::base_nft_transfer(1); + let best_case_weight = + ::WeightInfo::nft_transfer_report_best_case(); + let worst_case_weight = + ::WeightInfo::nft_transfer_report_worst_case(); let charged = env.charge(worst_case_weight)?; let nft_id = Self::nft_id(call.tokenId)?; @@ -48,7 +51,11 @@ impl NonFungibleAssetInterface { let to = Common::::asset_holder(env, call.to)?; let nfts = NFTs::new_unverified(asset_id, vec![nft_id]); - let mut weight_meter = WeightMeter::max_limit_no_minimum(); + // The best case covers the fixed work, the meter only gets the variable rest + let mut weight_meter = WeightMeter::from_limit_unchecked( + Weight::zero(), + worst_case_weight.saturating_sub(best_case_weight), + ); let errors = pallet_nft::Pallet::::nft_transfer_report( &from, &to, @@ -57,11 +64,13 @@ impl NonFungibleAssetInterface { &mut weight_meter, ); - let consumed = weight_meter.consumed(); - if consumed.ref_time() < worst_case_weight.ref_time() { - env.adjust_gas(charged, consumed); + if weight_meter.limit_exceeded() { + return Err(revert(ERR_WEIGHT_LIMIT_EXCEEDED)); } + let real_consumed_weight = best_case_weight.saturating_add(weight_meter.consumed()); + env.adjust_gas(charged, real_consumed_weight.min(worst_case_weight)); + Ok(INonFungibleAsset::canTransferCall::abi_encode_returns( &errors.is_empty(), )) @@ -122,13 +131,19 @@ impl NonFungibleAssetInterface { call: &INonFungibleAsset::canSendCall, env: &mut impl Ext, ) -> Result, Error> { + let best_case_weight = + ::WeightInfo::transfer_is_allowed_for_holder_best_case(); let worst_case_weight = ::WeightInfo::transfer_is_allowed_for_holder_worst_case(); let charged = env.charge(worst_case_weight)?; let sender = Common::::asset_holder(env, call.account)?; - let mut weight_meter = WeightMeter::max_limit_no_minimum(); + // The best case covers the fixed work, the meter only gets the variable rest + let mut weight_meter = WeightMeter::from_limit_unchecked( + Weight::zero(), + worst_case_weight.saturating_sub(best_case_weight), + ); let allowed = pallet_asset::Pallet::::transfer_is_allowed_for_holder( &sender, &asset_id, @@ -136,14 +151,13 @@ impl NonFungibleAssetInterface { &mut weight_meter, ); - let best_case_weight = - ::WeightInfo::transfer_is_allowed_for_holder_best_case(); - let real_consumed_weight = best_case_weight.saturating_add(weight_meter.consumed()); - - if real_consumed_weight.ref_time() < worst_case_weight.ref_time() { - env.adjust_gas(charged, real_consumed_weight); + if weight_meter.limit_exceeded() { + return Err(revert(ERR_WEIGHT_LIMIT_EXCEEDED)); } + let real_consumed_weight = best_case_weight.saturating_add(weight_meter.consumed()); + env.adjust_gas(charged, real_consumed_weight.min(worst_case_weight)); + Ok(INonFungibleAsset::canSendCall::abi_encode_returns(&allowed)) } @@ -153,13 +167,19 @@ impl NonFungibleAssetInterface { call: &INonFungibleAsset::canReceiveCall, env: &mut impl Ext, ) -> Result, Error> { + let best_case_weight = + ::WeightInfo::transfer_is_allowed_for_holder_best_case(); let worst_case_weight = ::WeightInfo::transfer_is_allowed_for_holder_worst_case(); let charged = env.charge(worst_case_weight)?; let receiver = Common::::asset_holder(env, call.account)?; - let mut weight_meter = WeightMeter::max_limit_no_minimum(); + // The best case covers the fixed work, the meter only gets the variable rest + let mut weight_meter = WeightMeter::from_limit_unchecked( + Weight::zero(), + worst_case_weight.saturating_sub(best_case_weight), + ); let allowed = pallet_asset::Pallet::::transfer_is_allowed_for_holder( &receiver, &asset_id, @@ -167,14 +187,13 @@ impl NonFungibleAssetInterface { &mut weight_meter, ); - let best_case_weight = - ::WeightInfo::transfer_is_allowed_for_holder_best_case(); - let real_consumed_weight = best_case_weight.saturating_add(weight_meter.consumed()); - - if real_consumed_weight.ref_time() < worst_case_weight.ref_time() { - env.adjust_gas(charged, real_consumed_weight); + if weight_meter.limit_exceeded() { + return Err(revert(ERR_WEIGHT_LIMIT_EXCEEDED)); } + let real_consumed_weight = best_case_weight.saturating_add(weight_meter.consumed()); + env.adjust_gas(charged, real_consumed_weight.min(worst_case_weight)); + Ok(INonFungibleAsset::canReceiveCall::abi_encode_returns( &allowed, )) diff --git a/pallets/runtime/common/src/runtime.rs b/pallets/runtime/common/src/runtime.rs index 8e43089e4c..c1f5a7aeb6 100644 --- a/pallets/runtime/common/src/runtime.rs +++ b/pallets/runtime/common/src/runtime.rs @@ -518,6 +518,8 @@ macro_rules! misc_pallet_impls { impl pallet_compliance_manager::Config for Runtime { type WeightInfo = polymesh_weights::pallet_compliance_manager::SubstrateWeight; type MaxConditionComplexity = MaxConditionComplexity; + type MaximumNumberOfTrustedIssuers = MaximumNumberOfTrustedIssuers; + type MaxTrustedIssuerClaimTypes = MaxTrustedIssuerClaimTypes; } impl pallet_capital_distribution::Config for Runtime { diff --git a/pallets/runtime/develop/src/runtime.rs b/pallets/runtime/develop/src/runtime.rs index 4f320cee73..0815a2b148 100644 --- a/pallets/runtime/develop/src/runtime.rs +++ b/pallets/runtime/develop/src/runtime.rs @@ -58,7 +58,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 8_001_020, + spec_version: 8_001_030, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 8, @@ -131,6 +131,8 @@ parameter_types! { // Compliance manager: pub const MaxConditionComplexity: u32 = 50; + pub const MaximumNumberOfTrustedIssuers: u32 = 8; + pub const MaxTrustedIssuerClaimTypes: u32 = 16; // Corporate Actions: pub const MaxTargetIds: u32 = 1000; diff --git a/pallets/runtime/mainnet/src/runtime.rs b/pallets/runtime/mainnet/src/runtime.rs index edbf6943f5..306479e6dc 100644 --- a/pallets/runtime/mainnet/src/runtime.rs +++ b/pallets/runtime/mainnet/src/runtime.rs @@ -57,7 +57,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 8_001_020, + spec_version: 8_001_030, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 8, @@ -127,6 +127,8 @@ parameter_types! { // Compliance manager: pub const MaxConditionComplexity: u32 = 50; + pub const MaximumNumberOfTrustedIssuers: u32 = 8; + pub const MaxTrustedIssuerClaimTypes: u32 = 16; // Corporate Actions: pub const MaxTargetIds: u32 = 1000; diff --git a/pallets/runtime/testnet/src/runtime.rs b/pallets/runtime/testnet/src/runtime.rs index bb899f3148..8e477a97b0 100644 --- a/pallets/runtime/testnet/src/runtime.rs +++ b/pallets/runtime/testnet/src/runtime.rs @@ -59,7 +59,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 8_001_020, + spec_version: 8_001_030, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 8, @@ -137,6 +137,8 @@ parameter_types! { // Compliance manager: pub const MaxConditionComplexity: u32 = 50; + pub const MaximumNumberOfTrustedIssuers: u32 = 8; + pub const MaxTrustedIssuerClaimTypes: u32 = 16; // Corporate Actions: pub const MaxTargetIds: u32 = 1000; diff --git a/pallets/runtime/tests/src/compliance_manager_test.rs b/pallets/runtime/tests/src/compliance_manager_test.rs index f7d66ca4db..0117dd52fa 100644 --- a/pallets/runtime/tests/src/compliance_manager_test.rs +++ b/pallets/runtime/tests/src/compliance_manager_test.rs @@ -9,8 +9,8 @@ use polymesh_primitives::asset::AssetId; use polymesh_primitives::compliance_manager::{ComplianceReport, ComplianceRequirement}; use polymesh_primitives::{ traits::ComplianceFnConfig, AuthorizationData, Claim, ClaimType, Condition, ConditionType, - CountryCode, IdentityId, PortfolioId, Scope, Signatory, TargetIdentity, TrustedFor, - WeightMeter, + CountryCode, CustomClaimTypeId, IdentityId, PortfolioId, Scope, Signatory, TargetIdentity, + TrustedFor, TrustedIssuer, WeightMeter, }; use sp_keyring::Sr25519Keyring; @@ -1512,3 +1512,174 @@ fn check_new_return_type_of_rpc() { assert_valid_transfer!(asset_id, owner.did, receiver.did, 100); }); } + +#[test] +fn should_limit_number_of_trusted_issuers() { + ExtBuilder::default() + .build() + .execute_with(should_limit_number_of_trusted_issuers_we); +} + +fn should_limit_number_of_trusted_issuers_we() { + let max_issuers = + ::MaximumNumberOfTrustedIssuers::get(); + let owner = User::new(Sr25519Keyring::Alice); + let asset_id = create_and_issue_sample_asset(&owner); + + // Condition level issuers. + let ty = ConditionType::IsPresent(Claim::KnowYourCustomer(Scope::Asset(asset_id))); + let issuers = (0..=max_issuers as u128) + .map(IdentityId::from) + .collect::>(); + let max_condition = Condition::from_dids(ty.clone(), &issuers[..max_issuers as usize]); + let over_condition = Condition::from_dids(ty, &issuers); + + assert_noop!( + ComplianceManager::add_compliance_requirement( + owner.origin(), + asset_id, + vec![over_condition.clone()], + vec![], + ), + CMError::::TooManyTrustedIssuers + ); + assert_ok!(ComplianceManager::add_compliance_requirement( + owner.origin(), + asset_id, + vec![max_condition.clone()], + vec![], + )); + let id = AssetCompliances::::get(asset_id).requirements[0].id; + let over_req = ComplianceRequirement { + sender_conditions: vec![], + receiver_conditions: vec![over_condition], + id, + }; + assert_noop!( + ComplianceManager::change_compliance_requirement( + owner.origin(), + asset_id, + over_req.clone() + ), + CMError::::TooManyTrustedIssuers + ); + assert_noop!( + ComplianceManager::replace_asset_compliance(owner.origin(), asset_id, vec![over_req]), + CMError::::TooManyTrustedIssuers + ); + assert_ok!(ComplianceManager::reset_asset_compliance( + owner.origin(), + asset_id + )); + + // Default trusted issuers. + let rings = [ + Sr25519Keyring::Alice, + Sr25519Keyring::Bob, + Sr25519Keyring::Charlie, + Sr25519Keyring::Dave, + Sr25519Keyring::Eve, + Sr25519Keyring::Ferdie, + Sr25519Keyring::One, + Sr25519Keyring::Two, + ]; + assert_eq!(rings.len(), max_issuers as usize); + let users = rings + .iter() + .map(|ring| match *ring { + Sr25519Keyring::Alice => owner, + ring => User::new(ring), + }) + .collect::>(); + for user in &users { + assert_ok!(ComplianceManager::add_default_trusted_claim_issuer( + owner.origin(), + asset_id, + user.issuer(), + )); + } + assert_noop!( + ComplianceManager::add_default_trusted_claim_issuer( + owner.origin(), + asset_id, + owner.trusted_issuer_for(TrustedFor::Specific(vec![ClaimType::Accredited])), + ), + CMError::::TooManyTrustedIssuers + ); + assert_eq!( + TrustedClaimIssuer::::get(asset_id).len(), + max_issuers as usize + ); +} + +#[test] +fn should_limit_number_of_trusted_issuer_claim_types() { + ExtBuilder::default() + .build() + .execute_with(should_limit_number_of_trusted_issuer_claim_types_we); +} + +fn should_limit_number_of_trusted_issuer_claim_types_we() { + let max_claim_types = + ::MaxTrustedIssuerClaimTypes::get(); + let owner = User::new(Sr25519Keyring::Alice); + let asset_id = create_and_issue_sample_asset(&owner); + + let claim_types = |len: u32| { + TrustedFor::Specific( + (1..=len) + .map(|i| ClaimType::Custom(CustomClaimTypeId(i))) + .collect(), + ) + }; + let max_issuer = owner.trusted_issuer_for(claim_types(max_claim_types)); + let over_issuer = owner.trusted_issuer_for(claim_types(max_claim_types + 1)); + + // Condition level issuers. + let ty = ConditionType::IsPresent(Claim::KnowYourCustomer(Scope::Asset(asset_id))); + let condition = |issuer: &TrustedIssuer| Condition::new(ty.clone(), vec![issuer.clone()]); + assert_noop!( + ComplianceManager::add_compliance_requirement( + owner.origin(), + asset_id, + vec![condition(&over_issuer)], + vec![], + ), + CMError::::TooManyTrustedIssuerClaimTypes + ); + assert_ok!(ComplianceManager::add_compliance_requirement( + owner.origin(), + asset_id, + vec![condition(&max_issuer)], + vec![], + )); + let id = AssetCompliances::::get(asset_id).requirements[0].id; + let over_req = ComplianceRequirement { + sender_conditions: vec![condition(&over_issuer)], + receiver_conditions: vec![], + id, + }; + assert_noop!( + ComplianceManager::change_compliance_requirement( + owner.origin(), + asset_id, + over_req.clone() + ), + CMError::::TooManyTrustedIssuerClaimTypes + ); + assert_noop!( + ComplianceManager::replace_asset_compliance(owner.origin(), asset_id, vec![over_req]), + CMError::::TooManyTrustedIssuerClaimTypes + ); + + // Default trusted issuers. + assert_noop!( + ComplianceManager::add_default_trusted_claim_issuer(owner.origin(), asset_id, over_issuer), + CMError::::TooManyTrustedIssuerClaimTypes + ); + assert_ok!(ComplianceManager::add_default_trusted_claim_issuer( + owner.origin(), + asset_id, + max_issuer + )); +} diff --git a/pallets/runtime/tests/src/nft.rs b/pallets/runtime/tests/src/nft.rs index d3929d479e..d82b1b7e22 100644 --- a/pallets/runtime/tests/src/nft.rs +++ b/pallets/runtime/tests/src/nft.rs @@ -28,6 +28,7 @@ use crate::ext_builder::ExtBuilder; use crate::storage::{default_asset_holder_set, TestStorage, User}; type Asset = pallet_asset::Pallet; +type AssetError = pallet_asset::Error; type ComplianceManager = pallet_compliance_manager::Pallet; type EAError = pallet_external_agents::Error; type Identity = pallet_identity::Pallet; @@ -358,6 +359,47 @@ fn mint_nft_wrong_key() { }); } +/// An NFT can only be minted if all metadata values are within `AssetMetadataValueMaxLength`. +#[test] +fn mint_nft_metadata_value_too_long() { + ExtBuilder::default().build().execute_with(|| { + set_timestamp(Utc::now().timestamp() as _); + + let alice: User = User::new(Sr25519Keyring::Alice); + + let collection_keys: NFTCollectionKeys = + vec![AssetMetadataKey::Local(AssetMetadataLocalKey(1))].into(); + let asset_id = create_nft_collection( + alice.clone(), + AssetType::NonFungible(NonFungibleType::Derivative), + collection_keys, + ); + let max_len = + ::AssetMetadataValueMaxLength::get() as usize; + assert_noop!( + NFT::issue_nft( + alice.origin(), + asset_id, + vec![NFTMetadataAttribute { + key: AssetMetadataKey::Local(AssetMetadataLocalKey(1)), + value: AssetMetadataValue(vec![b'v'; max_len + 1]) + }], + AssetHolderKind::DefaultPortfolio + ), + AssetError::AssetMetadataValueMaxLengthExceeded + ); + assert_ok!(NFT::issue_nft( + alice.origin(), + asset_id, + vec![NFTMetadataAttribute { + key: AssetMetadataKey::Local(AssetMetadataLocalKey(1)), + value: AssetMetadataValue(vec![b'v'; max_len]) + }], + AssetHolderKind::DefaultPortfolio + )); + }); +} + /// An NFT can only be minted if the given portfolio exists. #[test] fn mint_nft_portfolio_not_found() { diff --git a/pallets/runtime/tests/src/storage.rs b/pallets/runtime/tests/src/storage.rs index eca6fffef6..412e3a49c1 100644 --- a/pallets/runtime/tests/src/storage.rs +++ b/pallets/runtime/tests/src/storage.rs @@ -573,11 +573,8 @@ parameter_types! { pub const MaxTransferConditionsPerAsset: u32 = 4 + BENCHMARK_MAX_INCREASE; pub const MaxConditionComplexity: u32 = 50; - pub const MaxDefaultTrustedClaimIssuers: usize = 10; - pub const MaxTrustedIssuerPerCondition: usize = 10; - pub const MaxSenderConditionsPerCompliance: usize = 30; - pub const MaxReceiverConditionsPerCompliance: usize = 30; - pub const MaxCompliancePerRequirement: usize = 10; + pub const MaximumNumberOfTrustedIssuers: u32 = 8; + pub const MaxTrustedIssuerClaimTypes: u32 = 16; pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; diff --git a/pallets/weights/src/pallet_asset.rs b/pallets/weights/src/pallet_asset.rs index b65f5ab801..f9cfb9ddc8 100644 --- a/pallets/weights/src/pallet_asset.rs +++ b/pallets/weights/src/pallet_asset.rs @@ -4,7 +4,7 @@ //! Autogenerated weights for pallet_asset //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 54.0.0 -//! DATE: 2026-09-15, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-10-04, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 //! HOSTNAME: `ubuntu-8gb-hel1-bench`, CPU: `AMD EPYC-Milan Processor` @@ -16,7 +16,7 @@ // 100 // -r // 5 -// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_portfolio +// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_sto,pallet_portfolio // -e=* // --heap-pages // 4096 @@ -58,8 +58,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::TickersOwnedByUser` (r:0 w:1) // Proof: `Asset::TickersOwnedByUser` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) fn register_unique_ticker() -> Weight { - // Minimum execution time: 49_590 nanoseconds. - Weight::from_parts(54_640_000, 0) + // Minimum execution time: 47_570 nanoseconds. + Weight::from_parts(51_570_000, 0) .saturating_add(DbWeight::get().reads(8)) .saturating_add(DbWeight::get().writes(2)) } @@ -80,8 +80,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::TickersOwnedByUser` (r:0 w:2) // Proof: `Asset::TickersOwnedByUser` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`) fn accept_ticker_transfer() -> Weight { - // Minimum execution time: 57_560 nanoseconds. - Weight::from_parts(62_090_000, 0) + // Minimum execution time: 55_100 nanoseconds. + Weight::from_parts(58_990_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(6)) } @@ -116,8 +116,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `ExternalAgents::AgentOf` (r:0 w:2) // Proof: `ExternalAgents::AgentOf` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) fn accept_asset_ownership_transfer() -> Weight { - // Minimum execution time: 109_020 nanoseconds. - Weight::from_parts(115_440_000, 0) + // Minimum execution time: 105_200 nanoseconds. + Weight::from_parts(111_070_000, 0) .saturating_add(DbWeight::get().reads(12)) .saturating_add(DbWeight::get().writes(14)) } @@ -153,12 +153,12 @@ impl pallet_asset::WeightInfo for SubstrateWeight { /// The range of component `i` is `[1, 512]`. /// The range of component `f` is `[1, 128]`. fn create_asset(n: u32, i: u32, f: u32) -> Weight { - // Minimum execution time: 76_530 nanoseconds. - Weight::from_parts(83_697_121, 0) + // Minimum execution time: 74_450 nanoseconds. + Weight::from_parts(82_919_011, 0) // Standard Error: 2_794 .saturating_add(Weight::from_parts(675, 0).saturating_mul(n.into())) - // Standard Error: 697 - .saturating_add(Weight::from_parts(62_939, 0).saturating_mul(i.into())) + // Standard Error: 591 + .saturating_add(Weight::from_parts(57_040, 0).saturating_mul(i.into())) // Standard Error: 2_794 .saturating_add(Weight::from_parts(5_528, 0).saturating_mul(f.into())) .saturating_add(DbWeight::get().reads(9)) @@ -177,8 +177,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::Frozen` (r:1 w:1) // Proof: `Asset::Frozen` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) fn freeze() -> Weight { - // Minimum execution time: 37_250 nanoseconds. - Weight::from_parts(41_000_000, 0) + // Minimum execution time: 36_080 nanoseconds. + Weight::from_parts(38_790_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(1)) } @@ -195,8 +195,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::Frozen` (r:1 w:1) // Proof: `Asset::Frozen` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) fn unfreeze() -> Weight { - // Minimum execution time: 38_239 nanoseconds. - Weight::from_parts(41_880_000, 0) + // Minimum execution time: 36_360 nanoseconds. + Weight::from_parts(39_320_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(1)) } @@ -214,10 +214,10 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Asset::AssetNames` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `n` is `[1, 128]`. fn rename_asset(n: u32) -> Weight { - // Minimum execution time: 35_310 nanoseconds. - Weight::from_parts(39_002_467, 0) - // Standard Error: 578 - .saturating_add(Weight::from_parts(4_329, 0).saturating_mul(n.into())) + // Minimum execution time: 33_920 nanoseconds. + Weight::from_parts(37_016_734, 0) + // Standard Error: 532 + .saturating_add(Weight::from_parts(5_912, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(1)) } @@ -260,8 +260,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::IssuedInFundingRound` (r:1 w:1) // Proof: `Asset::IssuedInFundingRound` (`max_values`: None, `max_size`: None, mode: `Measured`) fn issue() -> Weight { - // Minimum execution time: 551_679 nanoseconds. - Weight::from_parts(585_289_000, 0) + // Minimum execution time: 526_730 nanoseconds. + Weight::from_parts(549_669_000, 0) .saturating_add(DbWeight::get().reads(137)) .saturating_add(DbWeight::get().writes(65)) } @@ -296,8 +296,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Statistics::ActiveAssetStats` (r:1 w:0) // Proof: `Statistics::ActiveAssetStats` (`max_values`: None, `max_size`: Some(2373), added: 4848, mode: `MaxEncodedLen`) fn redeem() -> Weight { - // Minimum execution time: 105_140 nanoseconds. - Weight::from_parts(110_210_000, 0) + // Minimum execution time: 99_240 nanoseconds. + Weight::from_parts(104_060_000, 0) .saturating_add(DbWeight::get().reads(15)) .saturating_add(DbWeight::get().writes(3)) } @@ -312,8 +312,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::Assets` (r:1 w:1) // Proof: `Asset::Assets` (`max_values`: None, `max_size`: None, mode: `Measured`) fn make_divisible() -> Weight { - // Minimum execution time: 33_470 nanoseconds. - Weight::from_parts(36_960_000, 0) + // Minimum execution time: 32_110 nanoseconds. + Weight::from_parts(34_900_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(1)) } @@ -335,10 +335,10 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Asset::AssetDocuments` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `d` is `[1, 64]`. fn add_documents(d: u32) -> Weight { - // Minimum execution time: 47_550 nanoseconds. - Weight::from_parts(46_176_715, 0) - // Standard Error: 10_999 - .saturating_add(Weight::from_parts(8_822_890, 0).saturating_mul(d.into())) + // Minimum execution time: 46_350 nanoseconds. + Weight::from_parts(47_702_916, 0) + // Standard Error: 7_586 + .saturating_add(Weight::from_parts(8_812_920, 0).saturating_mul(d.into())) .saturating_add(DbWeight::get().reads(7)) .saturating_add(DbWeight::get().writes(1)) .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(d.into()))) @@ -355,10 +355,10 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Asset::AssetDocuments` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `d` is `[1, 64]`. fn remove_documents(d: u32) -> Weight { - // Minimum execution time: 21_720 nanoseconds. - Weight::from_parts(22_269_876, 0) - // Standard Error: 3_584 - .saturating_add(Weight::from_parts(4_420_948, 0).saturating_mul(d.into())) + // Minimum execution time: 20_970 nanoseconds. + Weight::from_parts(20_263_846, 0) + // Standard Error: 3_507 + .saturating_add(Weight::from_parts(4_450_792, 0).saturating_mul(d.into())) .saturating_add(DbWeight::get().reads(4)) .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(d.into()))) } @@ -374,10 +374,10 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Asset::FundingRound` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `f` is `[1, 128]`. fn set_funding_round(f: u32) -> Weight { - // Minimum execution time: 27_930 nanoseconds. - Weight::from_parts(31_319_324, 0) - // Standard Error: 552 - .saturating_add(Weight::from_parts(2_482, 0).saturating_mul(f.into())) + // Minimum execution time: 26_960 nanoseconds. + Weight::from_parts(29_814_822, 0) + // Standard Error: 442 + .saturating_add(Weight::from_parts(2_699, 0).saturating_mul(f.into())) .saturating_add(DbWeight::get().reads(4)) .saturating_add(DbWeight::get().writes(1)) } @@ -393,10 +393,10 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Asset::AssetIdentifiers` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[1, 512]`. fn update_identifiers(i: u32) -> Weight { - // Minimum execution time: 28_540 nanoseconds. - Weight::from_parts(31_691_957, 0) - // Standard Error: 239 - .saturating_add(Weight::from_parts(48_175, 0).saturating_mul(i.into())) + // Minimum execution time: 27_480 nanoseconds. + Weight::from_parts(30_010_161, 0) + // Standard Error: 220 + .saturating_add(Weight::from_parts(48_216, 0).saturating_mul(i.into())) .saturating_add(DbWeight::get().reads(4)) .saturating_add(DbWeight::get().writes(1)) } @@ -431,8 +431,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Statistics::ActiveAssetStats` (r:1 w:0) // Proof: `Statistics::ActiveAssetStats` (`max_values`: None, `max_size`: Some(2373), added: 4848, mode: `MaxEncodedLen`) fn controller_transfer() -> Weight { - // Minimum execution time: 119_800 nanoseconds. - Weight::from_parts(126_030_000, 0) + // Minimum execution time: 113_339 nanoseconds. + Weight::from_parts(118_820_000, 0) .saturating_add(DbWeight::get().reads(16)) .saturating_add(DbWeight::get().writes(5)) } @@ -473,8 +473,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Statistics::ActiveAssetStats` (r:1 w:0) // Proof: `Statistics::ActiveAssetStats` (`max_values`: None, `max_size`: Some(2373), added: 4848, mode: `MaxEncodedLen`) fn controller_transfer_to() -> Weight { - // Minimum execution time: 134_350 nanoseconds. - Weight::from_parts(140_380_000, 0) + // Minimum execution time: 128_570 nanoseconds. + Weight::from_parts(134_430_000, 0) .saturating_add(DbWeight::get().reads(20)) .saturating_add(DbWeight::get().writes(5)) } @@ -488,10 +488,10 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Asset::CustomTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `n` is `[1, 2048]`. fn register_custom_asset_type(n: u32) -> Weight { - // Minimum execution time: 26_960 nanoseconds. - Weight::from_parts(30_428_947, 0) - // Standard Error: 31 - .saturating_add(Weight::from_parts(5_621, 0).saturating_mul(n.into())) + // Minimum execution time: 25_800 nanoseconds. + Weight::from_parts(28_499_485, 0) + // Standard Error: 28 + .saturating_add(Weight::from_parts(5_773, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(3)) .saturating_add(DbWeight::get().writes(3)) } @@ -510,8 +510,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetMetadataValues` (r:0 w:1) // Proof: `Asset::AssetMetadataValues` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_asset_metadata() -> Weight { - // Minimum execution time: 51_250 nanoseconds. - Weight::from_parts(55_460_000, 0) + // Minimum execution time: 49_570 nanoseconds. + Weight::from_parts(52_880_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(2)) } @@ -530,8 +530,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Timestamp::Now` (r:1 w:0) // Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) fn set_asset_metadata_details() -> Weight { - // Minimum execution time: 47_270 nanoseconds. - Weight::from_parts(51_400_000, 0) + // Minimum execution time: 45_170 nanoseconds. + Weight::from_parts(48_530_000, 0) .saturating_add(DbWeight::get().reads(7)) .saturating_add(DbWeight::get().writes(1)) } @@ -556,8 +556,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetMetadataLocalSpecs` (r:0 w:1) // Proof: `Asset::AssetMetadataLocalSpecs` (`max_values`: None, `max_size`: None, mode: `Measured`) fn register_and_set_local_asset_metadata() -> Weight { - // Minimum execution time: 75_480 nanoseconds. - Weight::from_parts(80_789_000, 0) + // Minimum execution time: 73_980 nanoseconds. + Weight::from_parts(78_180_000, 0) .saturating_add(DbWeight::get().reads(7)) .saturating_add(DbWeight::get().writes(6)) } @@ -578,8 +578,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetMetadataLocalSpecs` (r:0 w:1) // Proof: `Asset::AssetMetadataLocalSpecs` (`max_values`: None, `max_size`: None, mode: `Measured`) fn register_asset_metadata_local_type() -> Weight { - // Minimum execution time: 53_410 nanoseconds. - Weight::from_parts(57_900_000, 0) + // Minimum execution time: 52_480 nanoseconds. + Weight::from_parts(55_890_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(4)) } @@ -592,8 +592,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetMetadataGlobalSpecs` (r:0 w:1) // Proof: `Asset::AssetMetadataGlobalSpecs` (`max_values`: None, `max_size`: None, mode: `Measured`) fn register_asset_metadata_global_type() -> Weight { - // Minimum execution time: 30_360 nanoseconds. - Weight::from_parts(35_380_000, 0) + // Minimum execution time: 29_359 nanoseconds. + Weight::from_parts(33_370_000, 0) .saturating_add(DbWeight::get().reads(2)) .saturating_add(DbWeight::get().writes(4)) } @@ -608,8 +608,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Permissions::CurrentDispatchableName` (r:1 w:0) // Proof: `Permissions::CurrentDispatchableName` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn update_asset_type() -> Weight { - // Minimum execution time: 35_760 nanoseconds. - Weight::from_parts(39_660_000, 0) + // Minimum execution time: 34_440 nanoseconds. + Weight::from_parts(37_320_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(1)) } @@ -636,8 +636,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetMetadataLocalSpecs` (r:0 w:1) // Proof: `Asset::AssetMetadataLocalSpecs` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_local_metadata_key() -> Weight { - // Minimum execution time: 64_290 nanoseconds. - Weight::from_parts(69_369_000, 0) + // Minimum execution time: 61_880 nanoseconds. + Weight::from_parts(65_400_000, 0) .saturating_add(DbWeight::get().reads(8)) .saturating_add(DbWeight::get().writes(5)) } @@ -656,8 +656,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetMetadataValues` (r:0 w:1) // Proof: `Asset::AssetMetadataValues` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_metadata_value() -> Weight { - // Minimum execution time: 43_030 nanoseconds. - Weight::from_parts(48_210_000, 0) + // Minimum execution time: 41_200 nanoseconds. + Weight::from_parts(44_100_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(2)) } @@ -692,30 +692,30 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Statistics::ActiveAssetStats` (r:1 w:0) // Proof: `Statistics::ActiveAssetStats` (`max_values`: None, `max_size`: Some(2373), added: 4848, mode: `MaxEncodedLen`) fn base_transfer() -> Weight { - // Minimum execution time: 159_730 nanoseconds. - Weight::from_parts(165_830_000, 0) + // Minimum execution time: 161_720 nanoseconds. + Weight::from_parts(167_579_000, 0) .saturating_add(DbWeight::get().reads(17)) .saturating_add(DbWeight::get().writes(5)) } // Storage: `Asset::AssetsExemptFromAffirmation` (r:0 w:1) // Proof: `Asset::AssetsExemptFromAffirmation` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) fn exempt_asset_affirmation() -> Weight { - // Minimum execution time: 8_650 nanoseconds. - Weight::from_parts(10_380_000, 0).saturating_add(DbWeight::get().writes(1)) + // Minimum execution time: 8_410 nanoseconds. + Weight::from_parts(9_710_000, 0).saturating_add(DbWeight::get().writes(1)) } // Storage: `Asset::AssetsExemptFromAffirmation` (r:0 w:1) // Proof: `Asset::AssetsExemptFromAffirmation` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) fn remove_asset_affirmation_exemption() -> Weight { - // Minimum execution time: 8_370 nanoseconds. - Weight::from_parts(10_180_000, 0).saturating_add(DbWeight::get().writes(1)) + // Minimum execution time: 8_200 nanoseconds. + Weight::from_parts(9_520_000, 0).saturating_add(DbWeight::get().writes(1)) } // Storage: `Identity::KeyRecords` (r:1 w:0) // Proof: `Identity::KeyRecords` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) // Storage: `Asset::PreApprovedAsset` (r:0 w:1) // Proof: `Asset::PreApprovedAsset` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) fn pre_approve_asset() -> Weight { - // Minimum execution time: 17_750 nanoseconds. - Weight::from_parts(20_290_000, 0) + // Minimum execution time: 16_940 nanoseconds. + Weight::from_parts(18_970_000, 0) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().writes(1)) } @@ -724,8 +724,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::PreApprovedAsset` (r:0 w:1) // Proof: `Asset::PreApprovedAsset` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) fn remove_asset_pre_approval() -> Weight { - // Minimum execution time: 17_450 nanoseconds. - Weight::from_parts(19_770_000, 0) + // Minimum execution time: 16_759 nanoseconds. + Weight::from_parts(18_490_000, 0) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().writes(1)) } @@ -741,10 +741,10 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Asset::MandatoryMediators` (`max_values`: None, `max_size`: Some(161), added: 2636, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 4]`. fn add_mandatory_mediators(n: u32) -> Weight { - // Minimum execution time: 33_430 nanoseconds. - Weight::from_parts(36_795_375, 0) - // Standard Error: 15_087 - .saturating_add(Weight::from_parts(267_018, 0).saturating_mul(n.into())) + // Minimum execution time: 32_310 nanoseconds. + Weight::from_parts(35_141_994, 0) + // Standard Error: 14_025 + .saturating_add(Weight::from_parts(244_564, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(1)) } @@ -760,10 +760,10 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Asset::MandatoryMediators` (`max_values`: None, `max_size`: Some(161), added: 2636, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 4]`. fn remove_mandatory_mediators(n: u32) -> Weight { - // Minimum execution time: 34_930 nanoseconds. - Weight::from_parts(38_344_758, 0) - // Standard Error: 15_704 - .saturating_add(Weight::from_parts(219_662, 0).saturating_mul(n.into())) + // Minimum execution time: 33_540 nanoseconds. + Weight::from_parts(36_169_296, 0) + // Standard Error: 12_665 + .saturating_add(Weight::from_parts(265_988, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(1)) } @@ -784,8 +784,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetIdTicker` (r:1 w:1) // Proof: `Asset::AssetIdTicker` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn link_ticker_to_asset_id() -> Weight { - // Minimum execution time: 49_870 nanoseconds. - Weight::from_parts(54_060_000, 0) + // Minimum execution time: 47_910 nanoseconds. + Weight::from_parts(51_340_000, 0) .saturating_add(DbWeight::get().reads(8)) .saturating_add(DbWeight::get().writes(3)) } @@ -806,8 +806,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetIdTicker` (r:0 w:1) // Proof: `Asset::AssetIdTicker` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) fn unlink_ticker_from_asset_id() -> Weight { - // Minimum execution time: 48_430 nanoseconds. - Weight::from_parts(52_530_000, 0) + // Minimum execution time: 46_580 nanoseconds. + Weight::from_parts(49_870_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(4)) } @@ -816,32 +816,32 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::AssetMetadataGlobalSpecs` (r:1 w:1) // Proof: `Asset::AssetMetadataGlobalSpecs` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_global_metadata_spec() -> Weight { - // Minimum execution time: 37_960 nanoseconds. - Weight::from_parts(41_100_000, 0) + // Minimum execution time: 37_460 nanoseconds. + Weight::from_parts(41_090_000, 0) .saturating_add(DbWeight::get().reads(2)) .saturating_add(DbWeight::get().writes(1)) } // Storage: `Identity::KeyRecords` (r:1 w:0) // Proof: `Identity::KeyRecords` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) fn receiver_affirm_asset_transfer_base_weight() -> Weight { - // Minimum execution time: 12_030 nanoseconds. - Weight::from_parts(13_070_000, 0).saturating_add(DbWeight::get().reads(1)) + // Minimum execution time: 11_430 nanoseconds. + Weight::from_parts(12_420_000, 0).saturating_add(DbWeight::get().reads(1)) } // Storage: `Identity::KeyRecords` (r:1 w:0) // Proof: `Identity::KeyRecords` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) // Storage: `Asset::Allowances` (r:0 w:1) // Proof: `Asset::Allowances` (`max_values`: None, `max_size`: Some(144), added: 2619, mode: `MaxEncodedLen`) fn approve() -> Weight { - // Minimum execution time: 21_700 nanoseconds. - Weight::from_parts(24_330_000, 0) + // Minimum execution time: 21_090 nanoseconds. + Weight::from_parts(23_150_000, 0) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().writes(1)) } // Storage: `Asset::Allowances` (r:1 w:1) // Proof: `Asset::Allowances` (`max_values`: None, `max_size`: Some(144), added: 2619, mode: `MaxEncodedLen`) fn spend_allowance() -> Weight { - // Minimum execution time: 21_180 nanoseconds. - Weight::from_parts(23_020_000, 0) + // Minimum execution time: 19_950 nanoseconds. + Weight::from_parts(21_350_000, 0) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().writes(1)) } @@ -878,8 +878,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Asset::IssuedInFundingRound` (r:1 w:1) // Proof: `Asset::IssuedInFundingRound` (`max_values`: None, `max_size`: None, mode: `Measured`) fn issue_without_statistics() -> Weight { - // Minimum execution time: 86_170 nanoseconds. - Weight::from_parts(92_339_000, 0) + // Minimum execution time: 81_730 nanoseconds. + Weight::from_parts(86_659_000, 0) .saturating_add(DbWeight::get().reads(16)) .saturating_add(DbWeight::get().writes(5)) } @@ -906,8 +906,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `ComplianceManager::AssetCompliances` (r:1 w:0) // Proof: `ComplianceManager::AssetCompliances` (`max_values`: None, `max_size`: None, mode: `Measured`) fn asset_transfer_report_best_case() -> Weight { - // Minimum execution time: 118_570 nanoseconds. - Weight::from_parts(123_260_000, 0).saturating_add(DbWeight::get().reads(13)) + // Minimum execution time: 123_949 nanoseconds. + Weight::from_parts(128_320_000, 0).saturating_add(DbWeight::get().reads(13)) } // Storage: `Asset::Assets` (r:1 w:0) // Proof: `Asset::Assets` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -931,15 +931,15 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `Statistics::AssetTransferCompliances` (`max_values`: None, `max_size`: Some(2896), added: 5371, mode: `MaxEncodedLen`) // Storage: `Timestamp::Now` (r:1 w:0) // Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - // Storage: `Identity::Claims` (r:9 w:0) + // Storage: `Identity::Claims` (r:58 w:0) // Proof: `Identity::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Statistics::AssetStats` (r:4 w:0) // Proof: `Statistics::AssetStats` (`max_values`: None, `max_size`: Some(107), added: 2582, mode: `MaxEncodedLen`) // Storage: `ComplianceManager::AssetCompliances` (r:1 w:0) // Proof: `ComplianceManager::AssetCompliances` (`max_values`: None, `max_size`: None, mode: `Measured`) fn asset_transfer_report_worst_case() -> Weight { - // Minimum execution time: 180_830 nanoseconds. - Weight::from_parts(186_830_000, 0).saturating_add(DbWeight::get().reads(27)) + // Minimum execution time: 356_379 nanoseconds. + Weight::from_parts(375_730_000, 0).saturating_add(DbWeight::get().reads(76)) } // Storage: `Identity::KeyRecords` (r:1 w:0) // Proof: `Identity::KeyRecords` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) @@ -956,16 +956,16 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PortfolioFrozenAssets` (r:0 w:1) // Proof: `Portfolio::PortfolioFrozenAssets` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) fn set_frozen_tokens() -> Weight { - // Minimum execution time: 42_910 nanoseconds. - Weight::from_parts(47_170_000, 0) + // Minimum execution time: 41_260 nanoseconds. + Weight::from_parts(44_260_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(1)) } // Storage: `Asset::FrozenBalance` (r:1 w:0) // Proof: `Asset::FrozenBalance` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`) fn get_holders_frozen_balance() -> Weight { - // Minimum execution time: 9_820 nanoseconds. - Weight::from_parts(10_760_000, 0).saturating_add(DbWeight::get().reads(1)) + // Minimum execution time: 9_340 nanoseconds. + Weight::from_parts(10_260_000, 0).saturating_add(DbWeight::get().reads(1)) } // Storage: `Asset::Assets` (r:1 w:0) // Proof: `Asset::Assets` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -978,8 +978,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `ComplianceManager::AssetCompliances` (r:1 w:0) // Proof: `ComplianceManager::AssetCompliances` (`max_values`: None, `max_size`: None, mode: `Measured`) fn transfer_is_allowed_for_holder_best_case() -> Weight { - // Minimum execution time: 74_090 nanoseconds. - Weight::from_parts(76_920_000, 0).saturating_add(DbWeight::get().reads(5)) + // Minimum execution time: 82_000 nanoseconds. + Weight::from_parts(84_700_000, 0).saturating_add(DbWeight::get().reads(5)) } // Storage: `Asset::Assets` (r:1 w:0) // Proof: `Asset::Assets` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -993,11 +993,11 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Proof: `ComplianceManager::AssetCompliances` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Timestamp::Now` (r:1 w:0) // Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - // Storage: `Identity::Claims` (r:1 w:0) + // Storage: `Identity::Claims` (r:50 w:0) // Proof: `Identity::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) fn transfer_is_allowed_for_holder_worst_case() -> Weight { - // Minimum execution time: 83_770 nanoseconds. - Weight::from_parts(86_789_000, 0).saturating_add(DbWeight::get().reads(7)) + // Minimum execution time: 266_059 nanoseconds. + Weight::from_parts(282_360_000, 0).saturating_add(DbWeight::get().reads(56)) } // Storage: `Identity::KeyRecords` (r:1 w:0) // Proof: `Identity::KeyRecords` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) @@ -1012,8 +1012,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Portfolio::FrozenPortfolios` (r:0 w:1) // Proof: `Portfolio::FrozenPortfolios` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) fn set_holder_frozen() -> Weight { - // Minimum execution time: 34_900 nanoseconds. - Weight::from_parts(38_580_000, 0) + // Minimum execution time: 33_530 nanoseconds. + Weight::from_parts(36_420_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(1)) } @@ -1034,8 +1034,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PortfolioAssetBalances` (r:1 w:0) // Proof: `Portfolio::PortfolioAssetBalances` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) fn freeze_partial_tokens() -> Weight { - // Minimum execution time: 51_140 nanoseconds. - Weight::from_parts(55_870_000, 0) + // Minimum execution time: 49_030 nanoseconds. + Weight::from_parts(52_490_000, 0) .saturating_add(DbWeight::get().reads(8)) .saturating_add(DbWeight::get().writes(1)) } @@ -1054,8 +1054,8 @@ impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PortfolioFrozenAssets` (r:1 w:1) // Proof: `Portfolio::PortfolioFrozenAssets` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) fn unfreeze_partial_tokens() -> Weight { - // Minimum execution time: 48_580 nanoseconds. - Weight::from_parts(52_890_000, 0) + // Minimum execution time: 46_360 nanoseconds. + Weight::from_parts(49_790_000, 0) .saturating_add(DbWeight::get().reads(7)) .saturating_add(DbWeight::get().writes(1)) } diff --git a/pallets/weights/src/pallet_nft.rs b/pallets/weights/src/pallet_nft.rs index 15b3c47291..a3898384ad 100644 --- a/pallets/weights/src/pallet_nft.rs +++ b/pallets/weights/src/pallet_nft.rs @@ -4,7 +4,7 @@ //! Autogenerated weights for pallet_nft //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 54.0.0 -//! DATE: 2026-09-15, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-10-04, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 //! HOSTNAME: `ubuntu-8gb-hel1-bench`, CPU: `AMD EPYC-Milan Processor` @@ -16,7 +16,7 @@ // 100 // -r // 5 -// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_portfolio +// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_sto,pallet_portfolio // -e=* // --heap-pages // 4096 @@ -77,10 +77,10 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Proof: `Nft::CollectionKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `n` is `[1, 255]`. fn create_nft_collection(n: u32) -> Weight { - // Minimum execution time: 106_580 nanoseconds. - Weight::from_parts(111_844_998, 0) - // Standard Error: 2_987 - .saturating_add(Weight::from_parts(3_080_985, 0).saturating_mul(n.into())) + // Minimum execution time: 101_620 nanoseconds. + Weight::from_parts(107_601_170, 0) + // Standard Error: 2_947 + .saturating_add(Weight::from_parts(2_910_092, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(11)) .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(12)) @@ -113,10 +113,10 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Proof: `Nft::Owner` (`max_values`: None, `max_size`: Some(98), added: 2573, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 255]`. fn issue_nft(n: u32) -> Weight { - // Minimum execution time: 76_890 nanoseconds. - Weight::from_parts(79_204_504, 0) - // Standard Error: 3_474 - .saturating_add(Weight::from_parts(3_256_377, 0).saturating_mul(n.into())) + // Minimum execution time: 78_109 nanoseconds. + Weight::from_parts(83_644_098, 0) + // Standard Error: 18_039 + .saturating_add(Weight::from_parts(7_078_221, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(11)) .saturating_add(DbWeight::get().writes(6)) .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -151,10 +151,10 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Proof: `Nft::Owner` (`max_values`: None, `max_size`: Some(98), added: 2573, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 255]`. fn redeem_nft(n: u32) -> Weight { - // Minimum execution time: 122_260 nanoseconds. - Weight::from_parts(119_267_183, 0) - // Standard Error: 7_591 - .saturating_add(Weight::from_parts(1_730_028, 0).saturating_mul(n.into())) + // Minimum execution time: 94_390 nanoseconds. + Weight::from_parts(98_787_544, 0) + // Standard Error: 4_003 + .saturating_add(Weight::from_parts(1_423_867, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(12)) .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(5)) @@ -182,10 +182,10 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Proof: `Nft::Owner` (`max_values`: None, `max_size`: Some(98), added: 2573, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 10]`. fn base_nft_transfer(n: u32) -> Weight { - // Minimum execution time: 152_870 nanoseconds. - Weight::from_parts(116_439_951, 0) - // Standard Error: 80_738 - .saturating_add(Weight::from_parts(45_120_093, 0).saturating_mul(n.into())) + // Minimum execution time: 157_180 nanoseconds. + Weight::from_parts(121_716_478, 0) + // Standard Error: 81_056 + .saturating_add(Weight::from_parts(41_772_794, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(9)) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(4)) @@ -217,10 +217,10 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Proof: `Nft::Owner` (`max_values`: None, `max_size`: Some(98), added: 2573, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 10]`. fn controller_transfer(n: u32) -> Weight { - // Minimum execution time: 115_589 nanoseconds. - Weight::from_parts(79_271_541, 0) - // Standard Error: 66_340 - .saturating_add(Weight::from_parts(44_199_943, 0).saturating_mul(n.into())) + // Minimum execution time: 109_610 nanoseconds. + Weight::from_parts(73_589_148, 0) + // Standard Error: 79_859 + .saturating_add(Weight::from_parts(41_225_975, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(11)) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(4)) @@ -258,10 +258,10 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Proof: `Nft::Owner` (`max_values`: None, `max_size`: Some(98), added: 2573, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 10]`. fn controller_transfer_to(n: u32) -> Weight { - // Minimum execution time: 130_560 nanoseconds. - Weight::from_parts(96_276_615, 0) - // Standard Error: 47_250 - .saturating_add(Weight::from_parts(44_293_145, 0).saturating_mul(n.into())) + // Minimum execution time: 123_990 nanoseconds. + Weight::from_parts(88_993_075, 0) + // Standard Error: 46_776 + .saturating_add(Weight::from_parts(41_330_221, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(14)) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(4)) @@ -274,8 +274,8 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Storage: `Nft::TokenApproval` (r:0 w:1) // Proof: `Nft::TokenApproval` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`) fn approve() -> Weight { - // Minimum execution time: 29_260 nanoseconds. - Weight::from_parts(32_100_000, 0) + // Minimum execution time: 27_980 nanoseconds. + Weight::from_parts(30_360_000, 0) .saturating_add(DbWeight::get().reads(2)) .saturating_add(DbWeight::get().writes(1)) } @@ -284,8 +284,8 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Storage: `Nft::OperatorApproval` (r:0 w:1) // Proof: `Nft::OperatorApproval` (`max_values`: None, `max_size`: Some(129), added: 2604, mode: `MaxEncodedLen`) fn set_approval_for_all() -> Weight { - // Minimum execution time: 21_640 nanoseconds. - Weight::from_parts(24_080_000, 0) + // Minimum execution time: 20_800 nanoseconds. + Weight::from_parts(22_960_000, 0) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().writes(1)) } @@ -295,12 +295,56 @@ impl pallet_nft::WeightInfo for SubstrateWeight { // Proof: `Nft::TokenApproval` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 10]`. fn spend_nft_approval(n: u32) -> Weight { - // Minimum execution time: 20_750 nanoseconds. - Weight::from_parts(14_728_054, 0) - // Standard Error: 5_498 - .saturating_add(Weight::from_parts(8_894_396, 0).saturating_mul(n.into())) + // Minimum execution time: 19_540 nanoseconds. + Weight::from_parts(13_507_302, 0) + // Standard Error: 4_245 + .saturating_add(Weight::from_parts(8_429_502, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(n.into()))) } + // Storage: `Nft::CollectionAsset` (r:1 w:0) + // Proof: `Nft::CollectionAsset` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + // Storage: `Asset::Frozen` (r:1 w:0) + // Proof: `Asset::Frozen` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) + // Storage: `Nft::NumberOfNFTs` (r:2 w:0) + // Proof: `Nft::NumberOfNFTs` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + // Storage: `Portfolio::FrozenPortfolios` (r:1 w:0) + // Proof: `Portfolio::FrozenPortfolios` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + // Storage: `Portfolio::PortfolioNFT` (r:1 w:0) + // Proof: `Portfolio::PortfolioNFT` (`max_values`: None, `max_size`: Some(106), added: 2581, mode: `MaxEncodedLen`) + // Storage: `Portfolio::PortfolioLockedNFT` (r:1 w:0) + // Proof: `Portfolio::PortfolioLockedNFT` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`) + // Storage: `Identity::DidRecords` (r:1 w:0) + // Proof: `Identity::DidRecords` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) + // Storage: `ComplianceManager::AssetCompliances` (r:1 w:0) + // Proof: `ComplianceManager::AssetCompliances` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn nft_transfer_report_best_case() -> Weight { + // Minimum execution time: 104_180 nanoseconds. + Weight::from_parts(107_960_000, 0).saturating_add(DbWeight::get().reads(9)) + } + // Storage: `Nft::CollectionAsset` (r:1 w:0) + // Proof: `Nft::CollectionAsset` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + // Storage: `Asset::Frozen` (r:1 w:0) + // Proof: `Asset::Frozen` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) + // Storage: `Nft::NumberOfNFTs` (r:2 w:0) + // Proof: `Nft::NumberOfNFTs` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + // Storage: `Portfolio::FrozenPortfolios` (r:1 w:0) + // Proof: `Portfolio::FrozenPortfolios` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + // Storage: `Portfolio::PortfolioNFT` (r:1 w:0) + // Proof: `Portfolio::PortfolioNFT` (`max_values`: None, `max_size`: Some(106), added: 2581, mode: `MaxEncodedLen`) + // Storage: `Portfolio::PortfolioLockedNFT` (r:1 w:0) + // Proof: `Portfolio::PortfolioLockedNFT` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`) + // Storage: `Identity::DidRecords` (r:1 w:0) + // Proof: `Identity::DidRecords` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) + // Storage: `ComplianceManager::AssetCompliances` (r:1 w:0) + // Proof: `ComplianceManager::AssetCompliances` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `Timestamp::Now` (r:1 w:0) + // Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + // Storage: `Identity::Claims` (r:50 w:0) + // Proof: `Identity::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn nft_transfer_report_worst_case() -> Weight { + // Minimum execution time: 285_700 nanoseconds. + Weight::from_parts(294_620_000, 0).saturating_add(DbWeight::get().reads(60)) + } } diff --git a/pallets/weights/src/pallet_portfolio.rs b/pallets/weights/src/pallet_portfolio.rs index 3dd28d0d40..d372c37bd6 100644 --- a/pallets/weights/src/pallet_portfolio.rs +++ b/pallets/weights/src/pallet_portfolio.rs @@ -4,7 +4,7 @@ //! Autogenerated weights for pallet_portfolio //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 54.0.0 -//! DATE: 2026-09-15, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-10-04, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 //! HOSTNAME: `ubuntu-8gb-hel1-bench`, CPU: `AMD EPYC-Milan Processor` @@ -16,7 +16,7 @@ // 100 // -r // 5 -// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_portfolio +// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_sto,pallet_portfolio // -e=* // --heap-pages // 4096 @@ -49,10 +49,10 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Proof: `Portfolio::Portfolios` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `l` is `[1, 500]`. fn create_portfolio(l: u32) -> Weight { - // Minimum execution time: 25_130 nanoseconds. - Weight::from_parts(28_263_159, 0) - // Standard Error: 120 - .saturating_add(Weight::from_parts(8_052, 0).saturating_mul(l.into())) + // Minimum execution time: 24_160 nanoseconds. + Weight::from_parts(26_679_191, 0) + // Standard Error: 100 + .saturating_add(Weight::from_parts(7_701, 0).saturating_mul(l.into())) .saturating_add(DbWeight::get().reads(3)) .saturating_add(DbWeight::get().writes(3)) } @@ -71,8 +71,8 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: `Portfolio::NameToNumber` (r:0 w:1) // Proof: `Portfolio::NameToNumber` (`max_values`: None, `max_size`: None, mode: `Measured`) fn delete_portfolio() -> Weight { - // Minimum execution time: 49_210 nanoseconds. - Weight::from_parts(53_960_000, 0) + // Minimum execution time: 46_820 nanoseconds. + Weight::from_parts(50_470_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(5)) } @@ -84,10 +84,10 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Proof: `Portfolio::NameToNumber` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[1, 500]`. fn rename_portfolio(i: u32) -> Weight { - // Minimum execution time: 31_320 nanoseconds. - Weight::from_parts(34_502_317, 0) - // Standard Error: 119 - .saturating_add(Weight::from_parts(15_327, 0).saturating_mul(i.into())) + // Minimum execution time: 29_860 nanoseconds. + Weight::from_parts(32_181_728, 0) + // Standard Error: 94 + .saturating_add(Weight::from_parts(16_501, 0).saturating_mul(i.into())) .saturating_add(DbWeight::get().reads(3)) .saturating_add(DbWeight::get().writes(3)) } @@ -98,8 +98,8 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PortfoliosInCustody` (r:0 w:1) // Proof: `Portfolio::PortfoliosInCustody` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) fn quit_portfolio_custody() -> Weight { - // Minimum execution time: 25_750 nanoseconds. - Weight::from_parts(28_590_000, 0) + // Minimum execution time: 24_590 nanoseconds. + Weight::from_parts(26_700_000, 0) .saturating_add(DbWeight::get().reads(2)) .saturating_add(DbWeight::get().writes(2)) } @@ -118,8 +118,8 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: `Identity::AuthorizationsGiven` (r:0 w:1) // Proof: `Identity::AuthorizationsGiven` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) fn accept_portfolio_custody() -> Weight { - // Minimum execution time: 46_170 nanoseconds. - Weight::from_parts(50_540_000, 0) + // Minimum execution time: 44_260 nanoseconds. + Weight::from_parts(47_530_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(6)) } @@ -154,12 +154,12 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { /// The range of component `f` is `[1, 10]`. /// The range of component `n` is `[1, 100]`. fn move_portfolio_funds(f: u32, n: u32) -> Weight { - // Minimum execution time: 501_330 nanoseconds. - Weight::from_parts(52_375_573, 0) - // Standard Error: 681_129 - .saturating_add(Weight::from_parts(42_772_418, 0).saturating_mul(f.into())) - // Standard Error: 64_004 - .saturating_add(Weight::from_parts(41_765_025, 0).saturating_mul(n.into())) + // Minimum execution time: 478_239 nanoseconds. + Weight::from_parts(483_309_000, 0) + // Standard Error: 633_700 + .saturating_add(Weight::from_parts(11_258_839, 0).saturating_mul(f.into())) + // Standard Error: 65_671 + .saturating_add(Weight::from_parts(36_055_332, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(8)) .saturating_add(DbWeight::get().reads((7_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(n.into()))) @@ -176,8 +176,8 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PreApprovedPortfolios` (r:0 w:1) // Proof: `Portfolio::PreApprovedPortfolios` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) fn pre_approve_portfolio() -> Weight { - // Minimum execution time: 23_970 nanoseconds. - Weight::from_parts(26_580_000, 0) + // Minimum execution time: 22_750 nanoseconds. + Weight::from_parts(24_900_000, 0) .saturating_add(DbWeight::get().reads(3)) .saturating_add(DbWeight::get().writes(1)) } @@ -190,8 +190,8 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PreApprovedPortfolios` (r:0 w:1) // Proof: `Portfolio::PreApprovedPortfolios` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) fn remove_portfolio_pre_approval() -> Weight { - // Minimum execution time: 24_070 nanoseconds. - Weight::from_parts(26_750_000, 0) + // Minimum execution time: 22_890 nanoseconds. + Weight::from_parts(25_010_000, 0) .saturating_add(DbWeight::get().reads(3)) .saturating_add(DbWeight::get().writes(1)) } @@ -200,8 +200,8 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: `Portfolio::AllowedCustodians` (r:0 w:1) // Proof: `Portfolio::AllowedCustodians` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) fn allow_identity_to_create_portfolios() -> Weight { - // Minimum execution time: 16_560 nanoseconds. - Weight::from_parts(19_040_000, 0) + // Minimum execution time: 15_980 nanoseconds. + Weight::from_parts(17_840_000, 0) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().writes(1)) } @@ -210,8 +210,8 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: `Portfolio::AllowedCustodians` (r:0 w:1) // Proof: `Portfolio::AllowedCustodians` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) fn revoke_create_portfolios_permission() -> Weight { - // Minimum execution time: 16_440 nanoseconds. - Weight::from_parts(18_860_000, 0) + // Minimum execution time: 15_620 nanoseconds. + Weight::from_parts(17_760_000, 0) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().writes(1)) } @@ -230,8 +230,8 @@ impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: `Portfolio::Portfolios` (r:0 w:1) // Proof: `Portfolio::Portfolios` (`max_values`: None, `max_size`: None, mode: `Measured`) fn create_custody_portfolio() -> Weight { - // Minimum execution time: 38_410 nanoseconds. - Weight::from_parts(42_190_000, 0) + // Minimum execution time: 36_739 nanoseconds. + Weight::from_parts(39_440_000, 0) .saturating_add(DbWeight::get().reads(4)) .saturating_add(DbWeight::get().writes(5)) } diff --git a/pallets/weights/src/pallet_settlement.rs b/pallets/weights/src/pallet_settlement.rs index 87ca79ebde..363a63863c 100644 --- a/pallets/weights/src/pallet_settlement.rs +++ b/pallets/weights/src/pallet_settlement.rs @@ -4,7 +4,7 @@ //! Autogenerated weights for pallet_settlement //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 54.0.0 -//! DATE: 2026-09-15, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-10-04, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 //! HOSTNAME: `ubuntu-8gb-hel1-bench`, CPU: `AMD EPYC-Milan Processor` @@ -16,7 +16,7 @@ // 100 // -r // 5 -// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_portfolio +// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_sto,pallet_portfolio // -e=* // --heap-pages // 4096 @@ -56,12 +56,12 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `d` is `[1, 2048]`. /// The range of component `s` is `[0, 50]`. fn create_venue(d: u32, s: u32) -> Weight { - // Minimum execution time: 30_530 nanoseconds. - Weight::from_parts(35_769_673, 0) - // Standard Error: 348 - .saturating_add(Weight::from_parts(1_577, 0).saturating_mul(d.into())) - // Standard Error: 14_703 - .saturating_add(Weight::from_parts(2_408_710, 0).saturating_mul(s.into())) + // Minimum execution time: 29_970 nanoseconds. + Weight::from_parts(34_354_141, 0) + // Standard Error: 310 + .saturating_add(Weight::from_parts(1_394, 0).saturating_mul(d.into())) + // Standard Error: 13_087 + .saturating_add(Weight::from_parts(2_363_906, 0).saturating_mul(s.into())) .saturating_add(DbWeight::get().reads(2)) .saturating_add(DbWeight::get().writes(5)) .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(s.into()))) @@ -74,10 +74,10 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Settlement::Details` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `d` is `[1, 2048]`. fn update_venue_details(d: u32) -> Weight { - // Minimum execution time: 24_230 nanoseconds. - Weight::from_parts(27_224_113, 0) - // Standard Error: 26 - .saturating_add(Weight::from_parts(1_198, 0).saturating_mul(d.into())) + // Minimum execution time: 23_300 nanoseconds. + Weight::from_parts(26_243_027, 0) + // Standard Error: 24 + .saturating_add(Weight::from_parts(930, 0).saturating_mul(d.into())) .saturating_add(DbWeight::get().reads(2)) .saturating_add(DbWeight::get().writes(1)) } @@ -86,8 +86,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Settlement::VenueInfo` (r:1 w:1) // Proof: `Settlement::VenueInfo` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) fn update_venue_type() -> Weight { - // Minimum execution time: 23_010 nanoseconds. - Weight::from_parts(25_820_000, 0) + // Minimum execution time: 22_360 nanoseconds. + Weight::from_parts(24_760_000, 0) .saturating_add(DbWeight::get().reads(2)) .saturating_add(DbWeight::get().writes(1)) } @@ -101,10 +101,10 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Settlement::VenueSigners` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) /// The range of component `s` is `[0, 50]`. fn update_venue_signers(s: u32) -> Weight { - // Minimum execution time: 25_980 nanoseconds. - Weight::from_parts(34_897_104, 0) - // Standard Error: 9_793 - .saturating_add(Weight::from_parts(5_040_925, 0).saturating_mul(s.into())) + // Minimum execution time: 24_990 nanoseconds. + Weight::from_parts(32_953_301, 0) + // Standard Error: 7_977 + .saturating_add(Weight::from_parts(4_999_213, 0).saturating_mul(s.into())) .saturating_add(DbWeight::get().reads(3)) .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(s.into()))) .saturating_add(DbWeight::get().writes(1)) @@ -122,7 +122,7 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Settlement::VenueFiltering` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) fn set_venue_filtering() -> Weight { // Minimum execution time: 27_220 nanoseconds. - Weight::from_parts(30_190_000, 0) + Weight::from_parts(29_670_000, 0) .saturating_add(DbWeight::get().reads(4)) .saturating_add(DbWeight::get().writes(1)) } @@ -140,10 +140,10 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Settlement::VenueAllowList` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) /// The range of component `v` is `[0, 100]`. fn allow_venues(v: u32) -> Weight { - // Minimum execution time: 32_130 nanoseconds. - Weight::from_parts(33_527_905, 0) - // Standard Error: 2_287 - .saturating_add(Weight::from_parts(2_414_834, 0).saturating_mul(v.into())) + // Minimum execution time: 31_170 nanoseconds. + Weight::from_parts(31_484_036, 0) + // Standard Error: 1_958 + .saturating_add(Weight::from_parts(2_449_800, 0).saturating_mul(v.into())) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(v.into()))) } @@ -161,10 +161,10 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Settlement::VenueAllowList` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) /// The range of component `v` is `[0, 100]`. fn disallow_venues(v: u32) -> Weight { - // Minimum execution time: 31_930 nanoseconds. - Weight::from_parts(33_647_940, 0) - // Standard Error: 1_807 - .saturating_add(Weight::from_parts(2_289_703, 0).saturating_mul(v.into())) + // Minimum execution time: 31_370 nanoseconds. + Weight::from_parts(32_137_814, 0) + // Standard Error: 1_621 + .saturating_add(Weight::from_parts(2_326_059, 0).saturating_mul(v.into())) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(v.into()))) } @@ -214,14 +214,14 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn affirm_with_receipts(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 1_238_679 nanoseconds. - Weight::from_parts(28_928_562, 0) - // Standard Error: 592_265 - .saturating_add(Weight::from_parts(46_574_243, 0).saturating_mul(f.into())) - // Standard Error: 54_786 - .saturating_add(Weight::from_parts(40_151_560, 0).saturating_mul(n.into())) - // Standard Error: 536_501 - .saturating_add(Weight::from_parts(78_406_066, 0).saturating_mul(o.into())) + // Minimum execution time: 1_242_878 nanoseconds. + Weight::from_parts(30_424_373, 0) + // Standard Error: 535_385 + .saturating_add(Weight::from_parts(47_686_809, 0).saturating_mul(f.into())) + // Standard Error: 49_524 + .saturating_add(Weight::from_parts(38_198_180, 0).saturating_mul(n.into())) + // Standard Error: 484_976 + .saturating_add(Weight::from_parts(78_434_584, 0).saturating_mul(o.into())) .saturating_add(DbWeight::get().reads(7)) .saturating_add(DbWeight::get().reads((8_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(n.into()))) @@ -281,7 +281,7 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Identity::DidRecords` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) // Storage: `Statistics::AssetTransferCompliances` (r:10 w:0) // Proof: `Statistics::AssetTransferCompliances` (`max_values`: None, `max_size`: Some(2896), added: 5371, mode: `MaxEncodedLen`) - // Storage: `Identity::Claims` (r:201 w:0) + // Storage: `Identity::Claims` (r:5700 w:0) // Proof: `Identity::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Statistics::AssetStats` (r:140 w:100) // Proof: `Statistics::AssetStats` (`max_values`: None, `max_size`: Some(107), added: 2582, mode: `MaxEncodedLen`) @@ -317,15 +317,15 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn execute_manual_instruction(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 4_456_184 nanoseconds. - Weight::from_parts(4_458_345_000, 0) - // Standard Error: 4_887_711 - .saturating_add(Weight::from_parts(257_773_974, 0).saturating_mul(f.into())) - // Standard Error: 490_720 - .saturating_add(Weight::from_parts(211_621_624, 0).saturating_mul(n.into())) - .saturating_add(DbWeight::get().reads(15)) - .saturating_add(DbWeight::get().reads((61_u64).saturating_mul(f.into()))) - .saturating_add(DbWeight::get().reads((22_u64).saturating_mul(n.into()))) + // Minimum execution time: 6_248_173 nanoseconds. + Weight::from_parts(6_250_543_000, 0) + // Standard Error: 7_262_425 + .saturating_add(Weight::from_parts(369_162_262, 0).saturating_mul(f.into())) + // Standard Error: 729_139 + .saturating_add(Weight::from_parts(410_392_191, 0).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(14)) + .saturating_add(DbWeight::get().reads((111_u64).saturating_mul(f.into()))) + .saturating_add(DbWeight::get().reads((72_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(o.into()))) .saturating_add(DbWeight::get().writes(11)) .saturating_add(DbWeight::get().writes((26_u64).saturating_mul(f.into()))) @@ -386,14 +386,14 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn add_instruction(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 687_689 nanoseconds. - Weight::from_parts(89_073_864, 0) - // Standard Error: 904_949 - .saturating_add(Weight::from_parts(57_249_377, 0).saturating_mul(f.into())) - // Standard Error: 83_710 - .saturating_add(Weight::from_parts(56_244_261, 0).saturating_mul(n.into())) - // Standard Error: 819_744 - .saturating_add(Weight::from_parts(4_717_299, 0).saturating_mul(o.into())) + // Minimum execution time: 672_040 nanoseconds. + Weight::from_parts(188_032_294, 0) + // Standard Error: 734_788 + .saturating_add(Weight::from_parts(47_503_257, 0).saturating_mul(f.into())) + // Standard Error: 67_969 + .saturating_add(Weight::from_parts(54_783_698, 0).saturating_mul(n.into())) + // Standard Error: 665_604 + .saturating_add(Weight::from_parts(3_328_867, 0).saturating_mul(o.into())) .saturating_add(DbWeight::get().reads(9)) .saturating_add(DbWeight::get().reads((9_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((9_u64).saturating_mul(n.into()))) @@ -472,14 +472,14 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn add_and_affirm_instruction(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 1_168_969 nanoseconds. - Weight::from_parts(1_041_593, 0) - // Standard Error: 1_073_641 - .saturating_add(Weight::from_parts(102_478_344, 0).saturating_mul(f.into())) - // Standard Error: 99_314 - .saturating_add(Weight::from_parts(92_319_998, 0).saturating_mul(n.into())) - // Standard Error: 972_553 - .saturating_add(Weight::from_parts(16_163_745, 0).saturating_mul(o.into())) + // Minimum execution time: 1_123_609 nanoseconds. + Weight::from_parts(82_249_526, 0) + // Standard Error: 895_045 + .saturating_add(Weight::from_parts(96_020_666, 0).saturating_mul(f.into())) + // Standard Error: 82_794 + .saturating_add(Weight::from_parts(88_876_304, 0).saturating_mul(n.into())) + // Standard Error: 810_772 + .saturating_add(Weight::from_parts(8_906_139, 0).saturating_mul(o.into())) .saturating_add(DbWeight::get().reads(10)) .saturating_add(DbWeight::get().reads((15_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((14_u64).saturating_mul(n.into()))) @@ -524,12 +524,12 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `f` is `[1, 10]`. /// The range of component `n` is `[1, 100]`. fn affirm_instruction(f: u32, n: u32) -> Weight { - // Minimum execution time: 608_530 nanoseconds. - Weight::from_parts(90_623_223, 0) - // Standard Error: 650_640 - .saturating_add(Weight::from_parts(51_630_667, 0).saturating_mul(f.into())) - // Standard Error: 61_139 - .saturating_add(Weight::from_parts(40_049_213, 0).saturating_mul(n.into())) + // Minimum execution time: 619_349 nanoseconds. + Weight::from_parts(124_190_954, 0) + // Standard Error: 690_260 + .saturating_add(Weight::from_parts(47_790_966, 0).saturating_mul(f.into())) + // Standard Error: 64_862 + .saturating_add(Weight::from_parts(38_606_631, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(15)) .saturating_add(DbWeight::get().reads((8_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(n.into()))) @@ -615,12 +615,12 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn execute_instruction_paused(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 2_553_089 nanoseconds. - Weight::from_parts(2_553_760_000, 0) - // Standard Error: 3_017_203 - .saturating_add(Weight::from_parts(115_262_208, 0).saturating_mul(f.into())) - // Standard Error: 291_331 - .saturating_add(Weight::from_parts(212_946_583, 0).saturating_mul(n.into())) + // Minimum execution time: 2_593_896 nanoseconds. + Weight::from_parts(2_623_127_000, 0) + // Standard Error: 4_441_760 + .saturating_add(Weight::from_parts(116_696_528, 0).saturating_mul(f.into())) + // Standard Error: 428_882 + .saturating_add(Weight::from_parts(219_009_206, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(12)) .saturating_add(DbWeight::get().reads((27_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((22_u64).saturating_mul(n.into()))) @@ -676,7 +676,7 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Identity::DidRecords` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) // Storage: `Statistics::AssetTransferCompliances` (r:10 w:0) // Proof: `Statistics::AssetTransferCompliances` (`max_values`: None, `max_size`: Some(2896), added: 5371, mode: `MaxEncodedLen`) - // Storage: `Identity::Claims` (r:201 w:0) + // Storage: `Identity::Claims` (r:5700 w:0) // Proof: `Identity::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Statistics::AssetStats` (r:140 w:100) // Proof: `Statistics::AssetStats` (`max_values`: None, `max_size`: Some(107), added: 2582, mode: `MaxEncodedLen`) @@ -712,15 +712,15 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn execute_scheduled_instruction(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 4_459_718 nanoseconds. - Weight::from_parts(4_485_678_000, 0) - // Standard Error: 4_998_051 - .saturating_add(Weight::from_parts(235_039_282, 0).saturating_mul(f.into())) - // Standard Error: 482_596 - .saturating_add(Weight::from_parts(209_695_385, 0).saturating_mul(n.into())) - .saturating_add(DbWeight::get().reads(13)) - .saturating_add(DbWeight::get().reads((61_u64).saturating_mul(f.into()))) - .saturating_add(DbWeight::get().reads((22_u64).saturating_mul(n.into()))) + // Minimum execution time: 6_362_873 nanoseconds. + Weight::from_parts(6_411_993_000, 0) + // Standard Error: 7_320_943 + .saturating_add(Weight::from_parts(308_159_589, 0).saturating_mul(f.into())) + // Standard Error: 706_887 + .saturating_add(Weight::from_parts(410_550_055, 0).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(12)) + .saturating_add(DbWeight::get().reads((111_u64).saturating_mul(f.into()))) + .saturating_add(DbWeight::get().reads((72_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(o.into()))) .saturating_add(DbWeight::get().writes(11)) .saturating_add(DbWeight::get().writes((26_u64).saturating_mul(f.into()))) @@ -728,8 +728,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(o.into()))) } fn ensure_root_origin() -> Weight { - // Minimum execution time: 450 nanoseconds. - Weight::from_parts(580_000, 0) + // Minimum execution time: 440 nanoseconds. + Weight::from_parts(560_000, 0) } // Storage: `Identity::KeyRecords` (r:1 w:0) // Proof: `Identity::KeyRecords` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) @@ -763,14 +763,14 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn affirm_with_receipts_rcv(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 1_001_498 nanoseconds. - Weight::from_parts(79_908_316, 0) - // Standard Error: 353_364 - .saturating_add(Weight::from_parts(21_330_187, 0).saturating_mul(f.into())) - // Standard Error: 32_687 - .saturating_add(Weight::from_parts(20_760_331, 0).saturating_mul(n.into())) - // Standard Error: 320_093 - .saturating_add(Weight::from_parts(71_846_236, 0).saturating_mul(o.into())) + // Minimum execution time: 1_009_779 nanoseconds. + Weight::from_parts(88_370_689, 0) + // Standard Error: 355_310 + .saturating_add(Weight::from_parts(18_563_194, 0).saturating_mul(f.into())) + // Standard Error: 32_867 + .saturating_add(Weight::from_parts(19_770_304, 0).saturating_mul(n.into())) + // Standard Error: 321_856 + .saturating_add(Weight::from_parts(74_735_674, 0).saturating_mul(o.into())) .saturating_add(DbWeight::get().reads(7)) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(n.into()))) @@ -799,12 +799,12 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `f` is `[1, 10]`. /// The range of component `n` is `[1, 100]`. fn affirm_instruction_rcv(f: u32, n: u32) -> Weight { - // Minimum execution time: 349_629 nanoseconds. - Weight::from_parts(146_057_074, 0) - // Standard Error: 284_608 - .saturating_add(Weight::from_parts(18_939_853, 0).saturating_mul(f.into())) - // Standard Error: 26_743 - .saturating_add(Weight::from_parts(20_317_831, 0).saturating_mul(n.into())) + // Minimum execution time: 324_330 nanoseconds. + Weight::from_parts(152_371_434, 0) + // Standard Error: 287_537 + .saturating_add(Weight::from_parts(18_264_392, 0).saturating_mul(f.into())) + // Standard Error: 27_019 + .saturating_add(Weight::from_parts(19_279_110, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(15)) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(n.into()))) @@ -823,8 +823,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Settlement::AffirmsReceived` (r:0 w:1) // Proof: `Settlement::AffirmsReceived` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) fn unsafe_affirm_instruction_receiver_portfolio() -> Weight { - // Minimum execution time: 39_840 nanoseconds. - Weight::from_parts(43_150_000, 0) + // Minimum execution time: 37_730 nanoseconds. + Weight::from_parts(40_370_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(3)) } @@ -839,16 +839,16 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Settlement::AffirmsReceived` (r:0 w:1) // Proof: `Settlement::AffirmsReceived` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) fn unsafe_affirm_instruction_receiver_account() -> Weight { - // Minimum execution time: 41_450 nanoseconds. - Weight::from_parts(44_440_000, 0) + // Minimum execution time: 38_820 nanoseconds. + Weight::from_parts(41_750_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(3)) } // Storage: `Settlement::InstructionMemos` (r:0 w:1) // Proof: `Settlement::InstructionMemos` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) fn set_instruction_memo() -> Weight { - // Minimum execution time: 1_830 nanoseconds. - Weight::from_parts(2_270_000, 0).saturating_add(DbWeight::get().writes(1)) + // Minimum execution time: 1_760 nanoseconds. + Weight::from_parts(2_150_000, 0).saturating_add(DbWeight::get().writes(1)) } // Storage: `Identity::KeyRecords` (r:1 w:0) // Proof: `Identity::KeyRecords` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) @@ -905,14 +905,16 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `o` is `[0, 10]`. /// The range of component `m` is `[0, 4]`. fn add_instruction_with_mediators(f: u32, n: u32, o: u32, m: u32) -> Weight { - // Minimum execution time: 683_299 nanoseconds. - Weight::from_parts(170_994_644, 0) - // Standard Error: 644_810 - .saturating_add(Weight::from_parts(52_960_163, 0).saturating_mul(f.into())) - // Standard Error: 59_502 - .saturating_add(Weight::from_parts(55_542_258, 0).saturating_mul(n.into())) - // Standard Error: 584_288 - .saturating_add(Weight::from_parts(4_111_122, 0).saturating_mul(o.into())) + // Minimum execution time: 675_400 nanoseconds. + Weight::from_parts(136_906_637, 0) + // Standard Error: 654_426 + .saturating_add(Weight::from_parts(50_907_295, 0).saturating_mul(f.into())) + // Standard Error: 60_390 + .saturating_add(Weight::from_parts(53_416_327, 0).saturating_mul(n.into())) + // Standard Error: 593_002 + .saturating_add(Weight::from_parts(3_799_861, 0).saturating_mul(o.into())) + // Standard Error: 1_373_173 + .saturating_add(Weight::from_parts(2_667_109, 0).saturating_mul(m.into())) .saturating_add(DbWeight::get().reads(9)) .saturating_add(DbWeight::get().reads((9_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((9_u64).saturating_mul(n.into()))) @@ -993,16 +995,14 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `o` is `[0, 10]`. /// The range of component `m` is `[0, 4]`. fn add_and_affirm_with_mediators(f: u32, n: u32, o: u32, m: u32) -> Weight { - // Minimum execution time: 1_156_378 nanoseconds. - Weight::from_parts(80_805_156, 0) - // Standard Error: 1_165_598 - .saturating_add(Weight::from_parts(100_036_842, 0).saturating_mul(f.into())) - // Standard Error: 107_560 - .saturating_add(Weight::from_parts(91_104_237, 0).saturating_mul(n.into())) - // Standard Error: 1_056_196 - .saturating_add(Weight::from_parts(5_578_613, 0).saturating_mul(o.into())) - // Standard Error: 2_445_756 - .saturating_add(Weight::from_parts(15_854_274, 0).saturating_mul(m.into())) + // Minimum execution time: 1_134_939 nanoseconds. + Weight::from_parts(52_754_445, 0) + // Standard Error: 931_837 + .saturating_add(Weight::from_parts(97_422_609, 0).saturating_mul(f.into())) + // Standard Error: 85_989 + .saturating_add(Weight::from_parts(86_921_381, 0).saturating_mul(n.into())) + // Standard Error: 844_375 + .saturating_add(Weight::from_parts(10_435_923, 0).saturating_mul(o.into())) .saturating_add(DbWeight::get().reads(10)) .saturating_add(DbWeight::get().reads((15_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((14_u64).saturating_mul(n.into()))) @@ -1024,8 +1024,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Settlement::InstructionAffirmsPending` (r:1 w:1) // Proof: `Settlement::InstructionAffirmsPending` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) fn affirm_instruction_as_mediator() -> Weight { - // Minimum execution time: 77_240 nanoseconds. - Weight::from_parts(80_259_000, 0) + // Minimum execution time: 73_260 nanoseconds. + Weight::from_parts(76_560_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(2)) } @@ -1069,14 +1069,14 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn base_reject_instruction(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 570_569 nanoseconds. - Weight::from_parts(111_819_283, 0) - // Standard Error: 426_686 - .saturating_add(Weight::from_parts(34_765_727, 0).saturating_mul(f.into())) - // Standard Error: 43_576 - .saturating_add(Weight::from_parts(33_441_420, 0).saturating_mul(n.into())) - // Standard Error: 426_686 - .saturating_add(Weight::from_parts(12_711_129, 0).saturating_mul(o.into())) + // Minimum execution time: 535_009 nanoseconds. + Weight::from_parts(122_842_893, 0) + // Standard Error: 384_088 + .saturating_add(Weight::from_parts(33_273_122, 0).saturating_mul(f.into())) + // Standard Error: 39_226 + .saturating_add(Weight::from_parts(32_307_000, 0).saturating_mul(n.into())) + // Standard Error: 384_088 + .saturating_add(Weight::from_parts(10_001_795, 0).saturating_mul(o.into())) .saturating_add(DbWeight::get().reads(10)) .saturating_add(DbWeight::get().reads((7_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((7_u64).saturating_mul(n.into()))) @@ -1160,14 +1160,12 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn lock_instruction_extrinsic(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 2_248_805 nanoseconds. - Weight::from_parts(76_850_488, 0) - // Standard Error: 2_547_137 - .saturating_add(Weight::from_parts(207_224_824, 0).saturating_mul(f.into())) - // Standard Error: 260_133 - .saturating_add(Weight::from_parts(196_569_690, 0).saturating_mul(n.into())) - // Standard Error: 2_547_137 - .saturating_add(Weight::from_parts(3_284_995, 0).saturating_mul(o.into())) + // Minimum execution time: 2_251_757 nanoseconds. + Weight::from_parts(149_167_170, 0) + // Standard Error: 2_151_705 + .saturating_add(Weight::from_parts(207_959_193, 0).saturating_mul(f.into())) + // Standard Error: 219_748 + .saturating_add(Weight::from_parts(201_512_302, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(14)) .saturating_add(DbWeight::get().reads((27_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((22_u64).saturating_mul(n.into()))) @@ -1248,12 +1246,12 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn execute_locked_instruction(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 3_250_440 nanoseconds. - Weight::from_parts(3_261_190_000, 0) - // Standard Error: 3_239_202 - .saturating_add(Weight::from_parts(188_044_776, 0).saturating_mul(f.into())) - // Standard Error: 325_212 - .saturating_add(Weight::from_parts(97_767_160, 0).saturating_mul(n.into())) + // Minimum execution time: 3_251_048 nanoseconds. + Weight::from_parts(3_256_748_000, 0) + // Standard Error: 3_274_743 + .saturating_add(Weight::from_parts(182_420_823, 0).saturating_mul(f.into())) + // Standard Error: 328_780 + .saturating_add(Weight::from_parts(96_017_404, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(11)) .saturating_add(DbWeight::get().reads((54_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((15_u64).saturating_mul(n.into()))) @@ -1345,12 +1343,12 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. /// The range of component `o` is `[0, 10]`. fn execute_manual_instruction_paused(f: u32, n: u32, o: u32) -> Weight { - // Minimum execution time: 2_620_600 nanoseconds. - Weight::from_parts(2_649_999_000, 0) - // Standard Error: 2_990_365 - .saturating_add(Weight::from_parts(125_068_669, 0).saturating_mul(f.into())) - // Standard Error: 300_229 - .saturating_add(Weight::from_parts(216_866_424, 0).saturating_mul(n.into())) + // Minimum execution time: 2_920_188 nanoseconds. + Weight::from_parts(769_905_508, 0) + // Standard Error: 7_119_553 + .saturating_add(Weight::from_parts(218_248_095, 0).saturating_mul(f.into())) + // Standard Error: 727_104 + .saturating_add(Weight::from_parts(258_042_823, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(14)) .saturating_add(DbWeight::get().reads((27_u64).saturating_mul(f.into()))) .saturating_add(DbWeight::get().reads((22_u64).saturating_mul(n.into()))) @@ -1365,8 +1363,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Settlement::MandatoryReceiverAffirmation` (r:0 w:1) // Proof: `Settlement::MandatoryReceiverAffirmation` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) fn set_mandatory_receiver_affirmation() -> Weight { - // Minimum execution time: 15_870 nanoseconds. - Weight::from_parts(18_530_000, 0) + // Minimum execution time: 15_849 nanoseconds. + Weight::from_parts(18_030_000, 0) .saturating_add(DbWeight::get().reads(1)) .saturating_add(DbWeight::get().writes(1)) } @@ -1389,8 +1387,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PortfolioAssetCount` (r:1 w:1) // Proof: `Portfolio::PortfolioAssetCount` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) fn transfer_funds_portfolio_same_did() -> Weight { - // Minimum execution time: 79_640 nanoseconds. - Weight::from_parts(83_720_000, 0) + // Minimum execution time: 76_450 nanoseconds. + Weight::from_parts(80_430_000, 0) .saturating_add(DbWeight::get().reads(10)) .saturating_add(DbWeight::get().writes(3)) } @@ -1443,8 +1441,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Settlement::InstructionLegStatus` (r:0 w:1) // Proof: `Settlement::InstructionLegStatus` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) fn transfer_funds_portfolio_diff_did() -> Weight { - // Minimum execution time: 156_340 nanoseconds. - Weight::from_parts(164_080_000, 0) + // Minimum execution time: 148_350 nanoseconds. + Weight::from_parts(156_940_000, 0) .saturating_add(DbWeight::get().reads(22)) .saturating_add(DbWeight::get().writes(10)) } @@ -1467,8 +1465,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PortfolioAssetCount` (r:1 w:1) // Proof: `Portfolio::PortfolioAssetCount` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) fn transfer_funds_account_same_did() -> Weight { - // Minimum execution time: 74_600 nanoseconds. - Weight::from_parts(78_680_000, 0) + // Minimum execution time: 72_490 nanoseconds. + Weight::from_parts(76_240_000, 0) .saturating_add(DbWeight::get().reads(9)) .saturating_add(DbWeight::get().writes(3)) } @@ -1515,8 +1513,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Settlement::InstructionLegStatus` (r:0 w:1) // Proof: `Settlement::InstructionLegStatus` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) fn transfer_funds_account_diff_did() -> Weight { - // Minimum execution time: 151_870 nanoseconds. - Weight::from_parts(162_140_000, 0) + // Minimum execution time: 146_220 nanoseconds. + Weight::from_parts(153_580_000, 0) .saturating_add(DbWeight::get().reads(18)) .saturating_add(DbWeight::get().writes(10)) } @@ -1538,10 +1536,10 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Nft::Owner` (`max_values`: None, `max_size`: Some(98), added: 2573, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 10]`. fn transfer_funds_nft_portfolio_same_did(n: u32) -> Weight { - // Minimum execution time: 89_730 nanoseconds. - Weight::from_parts(49_849_632, 0) - // Standard Error: 76_266 - .saturating_add(Weight::from_parts(45_085_637, 0).saturating_mul(n.into())) + // Minimum execution time: 86_130 nanoseconds. + Weight::from_parts(49_620_990, 0) + // Standard Error: 70_952 + .saturating_add(Weight::from_parts(42_020_638, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(2)) @@ -1595,10 +1593,10 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Settlement::InstructionLegStatus` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 10]`. fn transfer_funds_nft_portfolio_diff_did(n: u32) -> Weight { - // Minimum execution time: 153_509 nanoseconds. - Weight::from_parts(152_801_463, 0) - // Standard Error: 84_023 - .saturating_add(Weight::from_parts(14_499_775, 0).saturating_mul(n.into())) + // Minimum execution time: 145_780 nanoseconds. + Weight::from_parts(144_039_121, 0) + // Standard Error: 82_393 + .saturating_add(Weight::from_parts(13_673_492, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(19)) .saturating_add(DbWeight::get().reads((2_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(9)) @@ -1626,10 +1624,10 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Nft::Owner` (`max_values`: None, `max_size`: Some(98), added: 2573, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 10]`. fn transfer_funds_nft_account_same_did(n: u32) -> Weight { - // Minimum execution time: 102_510 nanoseconds. - Weight::from_parts(55_779_899, 0) - // Standard Error: 81_748 - .saturating_add(Weight::from_parts(51_576_497, 0).saturating_mul(n.into())) + // Minimum execution time: 98_720 nanoseconds. + Weight::from_parts(53_095_194, 0) + // Standard Error: 75_154 + .saturating_add(Weight::from_parts(48_912_605, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().reads((2_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(3)) @@ -1675,10 +1673,10 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Proof: `Settlement::InstructionLegStatus` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 10]`. fn transfer_funds_nft_account_diff_did(n: u32) -> Weight { - // Minimum execution time: 152_910 nanoseconds. - Weight::from_parts(142_256_152, 0) - // Standard Error: 82_438 - .saturating_add(Weight::from_parts(20_334_325, 0).saturating_mul(n.into())) + // Minimum execution time: 145_350 nanoseconds. + Weight::from_parts(135_691_764, 0) + // Standard Error: 79_425 + .saturating_add(Weight::from_parts(19_015_716, 0).saturating_mul(n.into())) .saturating_add(DbWeight::get().reads(15)) .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(DbWeight::get().writes(9)) @@ -1697,8 +1695,8 @@ impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: `Settlement::LockedTimestamp` (r:0 w:1) // Proof: `Settlement::LockedTimestamp` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) fn unlock_instruction() -> Weight { - // Minimum execution time: 44_820 nanoseconds. - Weight::from_parts(47_010_000, 0) + // Minimum execution time: 43_320 nanoseconds. + Weight::from_parts(46_200_000, 0) .saturating_add(DbWeight::get().reads(4)) .saturating_add(DbWeight::get().writes(3)) } diff --git a/pallets/weights/src/pallet_sto.rs b/pallets/weights/src/pallet_sto.rs index ba8d8ea7a8..23d472d4ef 100644 --- a/pallets/weights/src/pallet_sto.rs +++ b/pallets/weights/src/pallet_sto.rs @@ -4,28 +4,32 @@ //! Autogenerated weights for pallet_sto //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 54.0.0 -//! DATE: 2026-05-11, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-10-04, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 //! HOSTNAME: `ubuntu-8gb-hel1-bench`, CPU: `AMD EPYC-Milan Processor` // Executed Command: -// ./target/release/polymesh +// ./polymesh // benchmark // pallet // -s // 100 // -r // 5 -// -p=pallet_sto +// -p=pallet_asset,pallet_nft,pallet_settlement,pallet_sto,pallet_portfolio // -e=* // --heap-pages // 4096 // --db-cache // 512 +// --execution +// wasm +// --wasm-execution +// compiled // --output -// ./pallets/weights/src/ +// . // --template -// ./.maintain/frame-weight-template.hbs +// Polymesh/.maintain/frame-weight-template.hbs #![allow(unused_parens)] #![allow(unused_imports)] @@ -53,21 +57,25 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Proof: `Sto::FundraiserCount` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) // Storage: `Asset::Assets` (r:1 w:0) // Proof: `Asset::Assets` (`max_values`: None, `max_size`: None, mode: `Measured`) + // Storage: `Portfolio::FrozenPortfolios` (r:1 w:0) + // Proof: `Portfolio::FrozenPortfolios` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) // Storage: `Portfolio::PortfolioAssetBalances` (r:1 w:0) // Proof: `Portfolio::PortfolioAssetBalances` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) // Storage: `Portfolio::PortfolioLockedAssets` (r:1 w:1) // Proof: `Portfolio::PortfolioLockedAssets` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) + // Storage: `Portfolio::PortfolioFrozenAssets` (r:1 w:0) + // Proof: `Portfolio::PortfolioFrozenAssets` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) // Storage: `Sto::FundraiserNames` (r:0 w:1) // Proof: `Sto::FundraiserNames` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Sto::Fundraisers` (r:0 w:1) // Proof: `Sto::Fundraisers` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[1, 10]`. fn create_fundraiser(i: u32) -> Weight { - // Minimum execution time: 86_930 nanoseconds. - Weight::from_parts(91_027_889, 0) - // Standard Error: 27_200 - .saturating_add(Weight::from_parts(125_263, 0).saturating_mul(i.into())) - .saturating_add(DbWeight::get().reads(12)) + // Minimum execution time: 90_930 nanoseconds. + Weight::from_parts(95_883_990, 0) + // Standard Error: 42_360 + .saturating_add(Weight::from_parts(179_957, 0).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(14)) .saturating_add(DbWeight::get().writes(4)) } // Storage: `Identity::KeyRecords` (r:1 w:0) @@ -106,6 +114,10 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Proof: `Settlement::InstructionLegs` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Portfolio::PortfolioAssetBalances` (r:4 w:4) // Proof: `Portfolio::PortfolioAssetBalances` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) + // Storage: `Portfolio::FrozenPortfolios` (r:2 w:0) + // Proof: `Portfolio::FrozenPortfolios` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + // Storage: `Portfolio::PortfolioFrozenAssets` (r:2 w:0) + // Proof: `Portfolio::PortfolioFrozenAssets` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) // Storage: `Settlement::InstructionMediatorsAffirmations` (r:1 w:0) // Proof: `Settlement::InstructionMediatorsAffirmations` (`max_values`: None, `max_size`: Some(58), added: 2533, mode: `MaxEncodedLen`) // Storage: `Settlement::InstructionMemos` (r:1 w:0) @@ -115,8 +127,8 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Asset::Frozen` (r:2 w:0) // Proof: `Asset::Frozen` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) // Storage: `Statistics::AssetTransferCompliances` (r:2 w:0) - // Proof: `Statistics::AssetTransferCompliances` (`max_values`: None, `max_size`: Some(53247), added: 55722, mode: `MaxEncodedLen`) - // Storage: `Identity::Claims` (r:42 w:0) + // Proof: `Statistics::AssetTransferCompliances` (`max_values`: None, `max_size`: Some(2896), added: 5371, mode: `MaxEncodedLen`) + // Storage: `Identity::Claims` (r:140 w:0) // Proof: `Identity::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Statistics::AssetStats` (r:28 w:20) // Proof: `Statistics::AssetStats` (`max_values`: None, `max_size`: Some(107), added: 2582, mode: `MaxEncodedLen`) @@ -129,7 +141,7 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PortfolioAssetCount` (r:2 w:2) // Proof: `Portfolio::PortfolioAssetCount` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) // Storage: `Statistics::ActiveAssetStats` (r:2 w:0) - // Proof: `Statistics::ActiveAssetStats` (`max_values`: None, `max_size`: Some(39424), added: 41899, mode: `MaxEncodedLen`) + // Proof: `Statistics::ActiveAssetStats` (`max_values`: None, `max_size`: Some(2373), added: 4848, mode: `MaxEncodedLen`) // Storage: `Settlement::UnlockedTimestamp` (r:0 w:1) // Proof: `Settlement::UnlockedTimestamp` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) // Storage: `Settlement::UserAffirmations` (r:0 w:4) @@ -151,9 +163,9 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Settlement::InstructionLegStatus` (r:0 w:2) // Proof: `Settlement::InstructionLegStatus` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) fn invest_onchain() -> Weight { - // Minimum execution time: 1_059_329 nanoseconds. - Weight::from_parts(1_087_269_000, 0) - .saturating_add(DbWeight::get().reads(128)) + // Minimum execution time: 1_483_238 nanoseconds. + Weight::from_parts(1_524_948_000, 0) + .saturating_add(DbWeight::get().reads(230)) .saturating_add(DbWeight::get().writes(53)) } // Storage: `Identity::KeyRecords` (r:1 w:0) @@ -200,6 +212,10 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Proof: `Settlement::InstructionLegs` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Portfolio::PortfolioAssetBalances` (r:2 w:2) // Proof: `Portfolio::PortfolioAssetBalances` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) + // Storage: `Portfolio::FrozenPortfolios` (r:1 w:0) + // Proof: `Portfolio::FrozenPortfolios` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + // Storage: `Portfolio::PortfolioFrozenAssets` (r:1 w:0) + // Proof: `Portfolio::PortfolioFrozenAssets` (`max_values`: None, `max_size`: Some(97), added: 2572, mode: `MaxEncodedLen`) // Storage: `Settlement::InstructionMediatorsAffirmations` (r:1 w:0) // Proof: `Settlement::InstructionMediatorsAffirmations` (`max_values`: None, `max_size`: Some(58), added: 2533, mode: `MaxEncodedLen`) // Storage: `Settlement::InstructionMemos` (r:1 w:0) @@ -209,8 +225,8 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Asset::Frozen` (r:1 w:0) // Proof: `Asset::Frozen` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`) // Storage: `Statistics::AssetTransferCompliances` (r:1 w:0) - // Proof: `Statistics::AssetTransferCompliances` (`max_values`: None, `max_size`: Some(53247), added: 55722, mode: `MaxEncodedLen`) - // Storage: `Identity::Claims` (r:21 w:0) + // Proof: `Statistics::AssetTransferCompliances` (`max_values`: None, `max_size`: Some(2896), added: 5371, mode: `MaxEncodedLen`) + // Storage: `Identity::Claims` (r:70 w:0) // Proof: `Identity::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) // Storage: `Statistics::AssetStats` (r:14 w:10) // Proof: `Statistics::AssetStats` (`max_values`: None, `max_size`: Some(107), added: 2582, mode: `MaxEncodedLen`) @@ -223,7 +239,7 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Portfolio::PortfolioAssetCount` (r:1 w:1) // Proof: `Portfolio::PortfolioAssetCount` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) // Storage: `Statistics::ActiveAssetStats` (r:1 w:0) - // Proof: `Statistics::ActiveAssetStats` (`max_values`: None, `max_size`: Some(39424), added: 41899, mode: `MaxEncodedLen`) + // Proof: `Statistics::ActiveAssetStats` (`max_values`: None, `max_size`: Some(2373), added: 4848, mode: `MaxEncodedLen`) // Storage: `Settlement::UnlockedTimestamp` (r:0 w:1) // Proof: `Settlement::UnlockedTimestamp` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) // Storage: `Settlement::UserAffirmations` (r:0 w:2) @@ -245,9 +261,9 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Settlement::InstructionLegStatus` (r:0 w:1) // Proof: `Settlement::InstructionLegStatus` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) fn invest_offchain() -> Weight { - // Minimum execution time: 699_970 nanoseconds. - Weight::from_parts(725_519_000, 0) - .saturating_add(DbWeight::get().reads(73)) + // Minimum execution time: 909_609 nanoseconds. + Weight::from_parts(945_909_000, 0) + .saturating_add(DbWeight::get().reads(124)) .saturating_add(DbWeight::get().writes(32)) } // Storage: `Identity::KeyRecords` (r:1 w:0) @@ -261,8 +277,8 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Sto::Fundraisers` (r:1 w:1) // Proof: `Sto::Fundraisers` (`max_values`: None, `max_size`: None, mode: `Measured`) fn freeze_fundraiser() -> Weight { - // Minimum execution time: 44_370 nanoseconds. - Weight::from_parts(46_420_000, 0) + // Minimum execution time: 41_940 nanoseconds. + Weight::from_parts(45_020_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(1)) } @@ -277,8 +293,8 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Sto::Fundraisers` (r:1 w:1) // Proof: `Sto::Fundraisers` (`max_values`: None, `max_size`: None, mode: `Measured`) fn unfreeze_fundraiser() -> Weight { - // Minimum execution time: 43_450 nanoseconds. - Weight::from_parts(45_760_000, 0) + // Minimum execution time: 40_839 nanoseconds. + Weight::from_parts(44_190_000, 0) .saturating_add(DbWeight::get().reads(5)) .saturating_add(DbWeight::get().writes(1)) } @@ -295,8 +311,8 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Timestamp::Now` (r:1 w:0) // Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) fn modify_fundraiser_window() -> Weight { - // Minimum execution time: 47_180 nanoseconds. - Weight::from_parts(49_401_000, 0) + // Minimum execution time: 44_950 nanoseconds. + Weight::from_parts(48_500_000, 0) .saturating_add(DbWeight::get().reads(6)) .saturating_add(DbWeight::get().writes(1)) } @@ -309,8 +325,8 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Timestamp::Now` (r:1 w:0) // Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) fn stop() -> Weight { - // Minimum execution time: 44_420 nanoseconds. - Weight::from_parts(46_610_000, 0) + // Minimum execution time: 42_210 nanoseconds. + Weight::from_parts(45_020_000, 0) .saturating_add(DbWeight::get().reads(4)) .saturating_add(DbWeight::get().writes(2)) } @@ -321,8 +337,8 @@ impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: `Sto::FundraiserOffchainAsset` (r:0 w:1) // Proof: `Sto::FundraiserOffchainAsset` (`max_values`: None, `max_size`: Some(60), added: 2535, mode: `MaxEncodedLen`) fn enable_offchain_funding() -> Weight { - // Minimum execution time: 31_449 nanoseconds. - Weight::from_parts(33_270_000, 0) + // Minimum execution time: 29_350 nanoseconds. + Weight::from_parts(32_259_000, 0) .saturating_add(DbWeight::get().reads(2)) .saturating_add(DbWeight::get().writes(1)) } diff --git a/primitives/src/weight_meter.rs b/primitives/src/weight_meter.rs index 00fff096b9..25a91718c4 100644 --- a/primitives/src/weight_meter.rs +++ b/primitives/src/weight_meter.rs @@ -21,6 +21,7 @@ use scale_info::prelude::string::String; pub struct WeightMeter { minimum_charge: Weight, meter: FrameWeightMeter, + limit_exceeded: bool, } impl WeightMeter { @@ -39,6 +40,7 @@ impl WeightMeter { Self { minimum_charge, meter: FrameWeightMeter::with_limit(limit), + limit_exceeded: false, } } @@ -51,6 +53,7 @@ impl WeightMeter { Some(Self { minimum_charge, meter: FrameWeightMeter::with_limit(limit), + limit_exceeded: false, }) } @@ -59,6 +62,7 @@ impl WeightMeter { Self { minimum_charge, meter: FrameWeightMeter::new(), + limit_exceeded: false, } } @@ -67,6 +71,7 @@ impl WeightMeter { Self { minimum_charge: Weight::zero(), meter: FrameWeightMeter::new(), + limit_exceeded: false, } } @@ -83,11 +88,17 @@ impl WeightMeter { self.meter.limit() } + /// Returns `true` if any attempt to consume weight went over the limit. + pub fn limit_exceeded(&self) -> bool { + self.limit_exceeded + } + /// Consumes the given weight after checking that it can be consumed. Returns an error otherwise. pub fn check_accrue(&mut self, weight: Weight) -> Result<(), String> { - self.meter - .try_consume(weight) - .map_err(|_| "Maximum weight limit exceeded")?; + if self.meter.try_consume(weight).is_err() { + self.limit_exceeded = true; + return Err(String::from("Maximum weight limit exceeded")); + } Ok(()) }