From 1782372ffec6601a490d66af21386d3298b2dac3 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 15 May 2025 11:36:20 +0200 Subject: [PATCH 01/63] wip --- Cargo.lock | 1 + substrate/bin/node/runtime/src/lib.rs | 7 +- substrate/frame/assets/Cargo.toml | 4 + substrate/frame/assets/src/lib.rs | 1 + substrate/frame/assets/src/precompiles.rs | 147 ++++++++++++++++++ .../frame/assets/src/precompiles/IERC20.sol | 79 ++++++++++ substrate/frame/revive/src/exec.rs | 18 +-- substrate/frame/revive/src/precompiles.rs | 2 +- 8 files changed, 248 insertions(+), 11 deletions(-) create mode 100644 substrate/frame/assets/src/precompiles.rs create mode 100644 substrate/frame/assets/src/precompiles/IERC20.sol diff --git a/Cargo.lock b/Cargo.lock index fa27c09f1c12b..1e61a0bf4aca8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11120,6 +11120,7 @@ dependencies = [ "impl-trait-for-tuples", "log", "pallet-balances", + "pallet-revive", "parity-scale-codec", "scale-info", "sp-core 28.0.0", diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 9d696030136e6..3d6f4ce330c10 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1465,6 +1465,10 @@ impl pallet_contracts::Config for Runtime { type Xcm = (); } +use pallet_assets::{make_precompile_assets_config, precompiles::ERC20}; +make_precompile_assets_config!(Instance1Assets, 0x1); +make_precompile_assets_config!(Instance2Assets, 0x2); + impl pallet_revive::Config for Runtime { type Time = Timestamp; type Currency = Balances; @@ -1475,7 +1479,8 @@ impl pallet_revive::Config for Runtime { type DepositPerByte = DepositPerByte; type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_revive::weights::SubstrateWeight; - type Precompiles = (); + type Precompiles = + (ERC20, ERC20); type AddressMapper = pallet_revive::AccountId32Mapper; type RuntimeMemory = ConstU32<{ 128 * 1024 * 1024 }>; type PVFMemory = ConstU32<{ 512 * 1024 * 1024 }>; diff --git a/substrate/frame/assets/Cargo.toml b/substrate/frame/assets/Cargo.toml index 8d4b8c6a93545..6437101dd41aa 100644 --- a/substrate/frame/assets/Cargo.toml +++ b/substrate/frame/assets/Cargo.toml @@ -28,6 +28,7 @@ frame-support = { workspace = true } frame-benchmarking = { optional = true, workspace = true } frame-system = { workspace = true } sp-core = { workspace = true } +pallet-revive = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -42,6 +43,7 @@ std = [ "frame-system/std", "log/std", "pallet-balances/std", + "pallet-revive/std", "scale-info/std", "sp-core/std", "sp-io/std", @@ -53,10 +55,12 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "pallet-revive/runtime-benchmarks" ] try-runtime = [ "frame-support/try-runtime", "frame-system/try-runtime", "pallet-balances/try-runtime", "sp-runtime/try-runtime", + "pallet-revive/try-runtime" ] diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 79434f924b1e7..40275f0916759 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -155,6 +155,7 @@ pub mod benchmarking; pub mod migration; #[cfg(test)] pub mod mock; +pub mod precompiles; #[cfg(test)] mod tests; pub mod weights; diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs new file mode 100644 index 0000000000000..4c13c6e3e24f7 --- /dev/null +++ b/substrate/frame/assets/src/precompiles.rs @@ -0,0 +1,147 @@ +#![allow(unused_imports)] + +use crate::{Call, Config, PhantomData}; +use alloc::vec::Vec; +use alloy::sol_types::{Revert, SolValue}; +use core::num::NonZero; +pub use pallet_revive::{precompiles::*, AddressMapper}; +use sp_runtime::traits::{Get, StaticLookup}; +alloy::sol!("src/precompiles/IERC20.sol"); + +/// Mean of extracting the asset id from the precompile address. +pub trait AssetIdExtractor { + type AssetId; + /// Extracts the asset id from the address. + fn asset_id_from_address(address: &[u8; 20]) -> Result; +} + +/// The configuration of a pallet-assets precompile. +pub trait AssetPrecompileConfig { + /// The Address matcher used by the precompile. + const MATCHER: AddressMatcher; + + /// The [`AssetIdExtractor`] used by the precompile. + type AssetIdExtractor: AssetIdExtractor; +} + +/// An `AssetIdExtractor` that decode the asset id from the address. +pub struct AddressAssetIdExtractor; + +impl AssetIdExtractor for AddressAssetIdExtractor { + type AssetId = u32; + fn asset_id_from_address(addr: &[u8; 20]) -> Result { + let bytes: [u8; 4] = addr[0..4].try_into().expect("slice is 4 bytes; qed"); + let index = u32::from_be_bytes(bytes); + return Ok(index.into()); + } +} + +#[test] +fn asset_id_extractor_works() { + use crate::{make_precompile_assets_config, precompiles::alloy::hex}; + make_precompile_assets_config!(TestConfig, 0x0120); + + let address: [u8; 20] = + hex::const_decode_to_array(b"0000053900000000000000000000000001200000").unwrap(); + assert!(TestConfig::MATCHER.matches(&address)); + assert_eq!( + ::AssetIdExtractor::asset_id_from_address(&address) + .unwrap(), + 1337u32 + ); +} + +/// A macro to generate an `AssetPrecompileConfig` implementation for a given name prefix. +#[macro_export] +macro_rules! make_precompile_assets_config { + ($name:ident, $prefix:literal) => { + pub struct $name; + impl $crate::precompiles::AssetPrecompileConfig for $name { + const MATCHER: $crate::precompiles::AddressMatcher = + $crate::precompiles::AddressMatcher::Prefix( + core::num::NonZero::new($prefix).unwrap(), + ); + type AssetIdExtractor = $crate::precompiles::AddressAssetIdExtractor; + } + }; +} + +/// An ERC20 precompile. +pub struct ERC20 { + _phantom: PhantomData<(Runtime, PrecompileConfig, Instance)>, +} + +const BALANCE_CONVERSION_FAILED: &str = "Balance conversion failed"; + +impl Precompile + for ERC20 +where + PrecompileConfig: AssetPrecompileConfig, + Runtime: crate::Config + pallet_revive::Config, + <::AssetIdExtractor as AssetIdExtractor>::AssetId: + Into<>::AssetId>, + Call: Into<::RuntimeCall>, + alloy::primitives::U256: TryInto<>::Balance>, +{ + type T = Runtime; + type Interface = IERC20::IERC20Calls; + const MATCHER: AddressMatcher = PrecompileConfig::MATCHER; + + fn call_with_info( + address: &[u8; 20], + input: &Self::Interface, + env: &mut impl ExtWithInfo, + ) -> Result, Error> { + use IERC20::*; + + let asset_id = PrecompileConfig::AssetIdExtractor::asset_id_from_address(address)?.into(); + + match input { + IERC20Calls::transfer(transferCall { to, value }) => { + // Are we ok using te 0 address for root call? + let from = env + .caller() + .account_id() + .map(::AddressMapper::to_address) + .unwrap_or_default(); + + let dest = to.into_array().into(); + let dest = ::AddressMapper::to_account_id(&dest); + let amount: >::Balance = + value.clone().try_into().map_err(|_| { + Error::Revert(Revert { reason: BALANCE_CONVERSION_FAILED.into() }) + })?; + + let call: ::RuntimeCall = + Call::::transfer { + id: asset_id.into(), + target: ::Lookup::unlookup(dest), + amount, + } + .into(); + + env.call_runtime(call).map_err(|err| Error::Error(err.error.into()))?; + let ret: (bool,) = transferFromReturn { _0: true }.into(); + + // dispatch event + let _ev = IERC20::IERC20Events::Transfer(IERC20::Transfer { + from: from.0.into(), + to: *to, + value: *value, + }); + + // fn deposit_event(&mut self, topics: Vec, data: Vec); + // env.deposit_event(ev); + + return Ok(ret.abi_encode()); + }, + IERC20Calls::totalSupply(totalSupplyCall { .. }) => {}, + IERC20Calls::balanceOf(balanceOfCall { .. }) => {}, + IERC20Calls::allowance(allowanceCall { .. }) => {}, + IERC20Calls::approve(approveCall { .. }) => {}, + IERC20Calls::transferFrom(transferFromCall { .. }) => {}, + } + + Ok(Default::default()) + } +} diff --git a/substrate/frame/assets/src/precompiles/IERC20.sol b/substrate/frame/assets/src/precompiles/IERC20.sol new file mode 100644 index 0000000000000..5f7bb7806e68c --- /dev/null +++ b/substrate/frame/assets/src/precompiles/IERC20.sol @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) +// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol +pragma solidity ^0.8.20; + +/** + * @dev Interface of the ERC-20 standard as defined in the ERC. + */ +interface IERC20 { + /** + * @dev Emitted when `value` tokens are moved from one account (`from`) to + * another (`to`). + * + * Note that `value` may be zero. + */ + event Transfer(address indexed from, address indexed to, uint256 value); + + /** + * @dev Emitted when the allowance of a `spender` for an `owner` is set by + * a call to {approve}. `value` is the new allowance. + */ + event Approval(address indexed owner, address indexed spender, uint256 value); + + /** + * @dev Returns the value of tokens in existence. + */ + function totalSupply() external view returns (uint256); + + /** + * @dev Returns the value of tokens owned by `account`. + */ + function balanceOf(address account) external view returns (uint256); + + /** + * @dev Moves a `value` amount of tokens from the caller's account to `to`. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transfer(address to, uint256 value) external returns (bool); + + /** + * @dev Returns the remaining number of tokens that `spender` will be + * allowed to spend on behalf of `owner` through {transferFrom}. This is + * zero by default. + * + * This value changes when {approve} or {transferFrom} are called. + */ + function allowance(address owner, address spender) external view returns (uint256); + + /** + * @dev Sets a `value` amount of tokens as the allowance of `spender` over the + * caller's tokens. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * IMPORTANT: Beware that changing an allowance with this method brings the risk + * that someone may use both the old and the new allowance by unfortunate + * transaction ordering. One possible solution to mitigate this race + * condition is to first reduce the spender's allowance to 0 and set the + * desired value afterwards: + * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + * + * Emits an {Approval} event. + */ + function approve(address spender, uint256 value) external returns (bool); + + /** + * @dev Moves a `value` amount of tokens from `from` to `to` using the + * allowance mechanism. `value` is then deducted from the caller's + * allowance. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transferFrom(address from, address to, uint256 value) external returns (bool); +} diff --git a/substrate/frame/revive/src/exec.rs b/substrate/frame/revive/src/exec.rs index 25a1d1ebc2146..a089b5ebe668d 100644 --- a/substrate/frame/revive/src/exec.rs +++ b/substrate/frame/revive/src/exec.rs @@ -229,9 +229,6 @@ pub trait Ext: PrecompileWithInfoExt { /// /// Note: Requires &mut self to access the contract info. fn set_immutable_data(&mut self, data: ImmutableData) -> Result<(), DispatchError>; - - /// Call some dispatchable and return the result. - fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo; } /// Environment functions which are available to pre-compiles with `HAS_CONTRACT_INFO = true`. @@ -424,6 +421,9 @@ pub trait PrecompileExt: sealing::Sealed { /// Returns a mutable reference to the output of the last executed call frame. fn last_frame_output_mut(&mut self) -> &mut ExecReturnValue; + + /// Call some dispatchable and return the result. + fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo; } /// Describes the different functions that can be exported by an [`Executable`]. @@ -1573,12 +1573,6 @@ where Ok(()) } - fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo { - let mut origin: T::RuntimeOrigin = RawOrigin::Signed(self.account_id().clone()).into(); - origin.add_filter(T::CallFilter::contains); - call.dispatch(origin) - } - fn immutable_data_len(&mut self) -> u32 { self.top_frame_mut().contract_info().immutable_data_len() } @@ -1954,6 +1948,12 @@ where fn last_frame_output_mut(&mut self) -> &mut ExecReturnValue { &mut self.top_frame_mut().last_frame_output } + + fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo { + let mut origin: T::RuntimeOrigin = RawOrigin::Signed(self.account_id().clone()).into(); + origin.add_filter(T::CallFilter::contains); + call.dispatch(origin) + } } mod sealing { diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index c12527cee6646..77bb2cbd6dc92 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -192,7 +192,7 @@ pub trait Precompile { /// /// Have a look at [`ExtWithInfo`] to learn about the additional APIs that a contract info /// unlocks. - const HAS_CONTRACT_INFO: bool; + const HAS_CONTRACT_INFO: bool = false; /// Entry point for your pre-compile when `HAS_CONTRACT_INFO = false`. #[allow(unused_variables)] From 7734e4edc011909149263001905ba21274c9b259 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 15 May 2025 15:16:10 +0200 Subject: [PATCH 02/63] fix --- Cargo.lock | 144 ++++++++++----- Cargo.toml | 2 +- substrate/frame/assets/src/precompiles.rs | 214 +++++++++++++++++----- substrate/frame/revive/src/precompiles.rs | 4 +- 4 files changed, 268 insertions(+), 96 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e61a0bf4aca8..35c21b2aebe00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,9 +127,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "alloy-core" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618bd382f0bc2ac26a7e4bfae01c9b015ca8f21b37ca40059ae35a7e62b3dc6" +checksum = "24b2817489e4391d8c0bdf043c842164855e3d697de7a8e9edf24aa30b153ac5" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -140,9 +140,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41056bde53ae10ffbbf11618efbe1e0290859e5eab0fe9ef82ebdb62f12a866f" +checksum = "4f90b63261b7744642f6075ed17db6de118eecbe9516ea6c6ffd444b80180b75" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -152,14 +152,14 @@ dependencies = [ "itoa", "serde", "serde_json", - "winnow 0.6.18", + "winnow 0.7.10", ] [[package]] name = "alloy-json-abi" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c357da577dfb56998d01f574d81ad7a1958d248740a7981b205d69d65a7da404" +checksum = "0068ae277f5ee3153a95eaea8ff10e188ed8ccde9b7f9926305415a2c0ab2442" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -169,27 +169,26 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6259a506ab13e1d658796c31e6e39d2e2ee89243bcc505ddc613b35732e0a430" +checksum = "6a12fe11d0b8118e551c29e1a67ccb6d01cc07ef08086df30f07487146de6fa1" dependencies = [ "alloy-rlp", "bytes", "cfg-if", "const-hex", - "derive_more 1.0.0", + "derive_more 2.0.1", "foldhash", "hashbrown 0.15.2", - "hex-literal", "indexmap 2.9.0", "itoa", "k256", "keccak-asm", "paste", "proptest", - "rand 0.8.5", + "rand 0.9.0", "ruint", - "rustc-hash 2.0.0", + "rustc-hash 2.1.1", "serde", "sha3 0.10.8", "tiny-keccak", @@ -208,9 +207,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9d64f851d95619233f74b310f12bcf16e0cbc27ee3762b6115c14a84809280a" +checksum = "5d3ef8e0d622453d969ba3cded54cf6800efdc85cb929fe22c5bdf8335666757" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -222,9 +221,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf7ed1574b699f48bf17caab4e6e54c6d12bc3c006ab33d58b1e227c1c3559f" +checksum = "f0e84bd0693c69a8fbe3ec0008465e029c6293494df7cb07580bf4a33eff52e1" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -240,13 +239,14 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c02997ccef5f34f9c099277d4145f183b422938ed5322dc57a089fe9b9ad9ee" +checksum = "f3de663412dadf9b64f4f92f507f78deebcc92339d12cf15f88ded65d41c7935" dependencies = [ "const-hex", "dunce", "heck 0.5.0", + "macro-string", "proc-macro2 1.0.93", "quote 1.0.38", "syn 2.0.98", @@ -255,19 +255,19 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce13ff37285b0870d0a0746992a4ae48efaf34b766ae4c2640fa15e5305f8e73" +checksum = "251273c5aa1abb590852f795c938730fa641832fc8fa77b5478ed1bf11b6097e" dependencies = [ "serde", - "winnow 0.6.18", + "winnow 0.7.10", ] [[package]] name = "alloy-sol-types" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1174cafd6c6d810711b4e00383037bdb458efc4fe3dbafafa16567e0320c54d8" +checksum = "5460a975434ae594fe2b91586253c1beb404353b78f0a55bf124abcd79557b15" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -1846,18 +1846,18 @@ dependencies = [ [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitcoin-internals" @@ -5409,7 +5409,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ - "derive_more-impl", + "derive_more-impl 1.0.0", +] + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl 2.0.1", ] [[package]] @@ -5424,6 +5433,18 @@ dependencies = [ "unicode-xid 0.2.4", ] +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "proc-macro2 1.0.93", + "quote 1.0.38", + "syn 2.0.98", + "unicode-xid 0.2.4", +] + [[package]] name = "diff" version = "0.1.13" @@ -6147,6 +6168,17 @@ dependencies = [ "bytes", ] +[[package]] +name = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec 0.7.4", + "auto_impl", + "bytes", +] + [[package]] name = "fatality" version = "0.1.1" @@ -6352,9 +6384,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "foreign-types" @@ -8581,7 +8613,7 @@ dependencies = [ "parking_lot 0.12.3", "pin-project", "rand 0.8.5", - "rustc-hash 2.0.0", + "rustc-hash 2.1.1", "serde", "serde_json", "thiserror 1.0.65", @@ -9768,6 +9800,17 @@ dependencies = [ "libc", ] +[[package]] +name = "macro-string" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" +dependencies = [ + "proc-macro2 1.0.93", + "quote 1.0.38", + "syn 2.0.98", +] + [[package]] name = "macro_magic" version = "0.5.1" @@ -17321,9 +17364,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", "bit-vec", @@ -17563,7 +17606,7 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.0.0", + "rustc-hash 2.1.1", "rustls 0.23.18", "socket2 0.5.9", "thiserror 1.0.65", @@ -17580,7 +17623,7 @@ dependencies = [ "bytes", "rand 0.8.5", "ring 0.17.8", - "rustc-hash 2.0.0", + "rustc-hash 2.1.1", "rustls 0.23.18", "slab", "thiserror 1.0.65", @@ -17634,7 +17677,6 @@ dependencies = [ "libc", "rand_chacha 0.3.1", "rand_core 0.6.4", - "serde", ] [[package]] @@ -17645,6 +17687,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.1", + "serde", "zerocopy 0.8.20", ] @@ -17690,6 +17733,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a88e0da7a2c97baa202165137c158d0a2e824ac465d13d81046727b34cb247d3" dependencies = [ "getrandom 0.3.1", + "serde", "zerocopy 0.8.20", ] @@ -18465,21 +18509,24 @@ dependencies = [ [[package]] name = "ruint" -version = "1.12.3" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +checksum = "78a46eb779843b2c4f21fac5773e25d6d5b7c8f0922876c91541790d2ca27eef" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", "ark-ff 0.4.2", "bytes", - "fastrlp", + "fastrlp 0.3.1", + "fastrlp 0.4.0", "num-bigint", + "num-integer", "num-traits", "parity-scale-codec", "primitive-types 0.12.2", "proptest", "rand 0.8.5", + "rand 0.9.0", "rlp 0.5.2", "ruint-macro", "serde", @@ -18507,9 +18554,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc-hex" @@ -25228,9 +25275,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.15" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219389c1ebe89f8333df8bdfb871f6631c552ff399c23cac02480b6088aad8f0" +checksum = "3d0f0d4760f4c2a0823063b2c70e97aa2ad185f57be195172ccc0e23c4b787c4" dependencies = [ "paste", "proc-macro2 1.0.93", @@ -27750,6 +27797,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" diff --git a/Cargo.toml b/Cargo.toml index 4f0e13418f3d2..bf0f21f32a34b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -618,7 +618,7 @@ zero-prefixed-literal = { level = "allow", priority = 2 } # 00_1000_0 Inflector = { version = "0.11.4" } aes-gcm = { version = "0.10" } ahash = { version = "0.8.2" } -alloy-core = { version = "0.8.15", default-features = false } +alloy-core = { version = "1.1.0", default-features = false } always-assert = { version = "0.1" } anyhow = { version = "1.0.81", default-features = false } approx = { version = "0.5.1" } diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 4c13c6e3e24f7..027272e9e449a 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -1,12 +1,17 @@ -#![allow(unused_imports)] +#![allow(unused_variables)] use crate::{Call, Config, PhantomData}; use alloc::vec::Vec; -use alloy::sol_types::{Revert, SolValue}; -use core::num::NonZero; +use alloy::{ + primitives::IntoLogData, + sol_types::{Revert, SolCall}, +}; pub use pallet_revive::{precompiles::*, AddressMapper}; -use sp_runtime::traits::{Get, StaticLookup}; +use sp_core::H256; +use sp_runtime::traits::StaticLookup; + alloy::sol!("src/precompiles/IERC20.sol"); +use IERC20::*; /// Mean of extracting the asset id from the precompile address. pub trait AssetIdExtractor { @@ -81,7 +86,8 @@ where <::AssetIdExtractor as AssetIdExtractor>::AssetId: Into<>::AssetId>, Call: Into<::RuntimeCall>, - alloy::primitives::U256: TryInto<>::Balance>, + alloy::primitives::U256: From<>::Balance> + + TryInto<>::Balance>, { type T = Runtime; type Interface = IERC20::IERC20Calls; @@ -97,51 +103,161 @@ where let asset_id = PrecompileConfig::AssetIdExtractor::asset_id_from_address(address)?.into(); match input { - IERC20Calls::transfer(transferCall { to, value }) => { - // Are we ok using te 0 address for root call? - let from = env - .caller() - .account_id() - .map(::AddressMapper::to_address) - .unwrap_or_default(); - - let dest = to.into_array().into(); - let dest = ::AddressMapper::to_account_id(&dest); - let amount: >::Balance = - value.clone().try_into().map_err(|_| { - Error::Revert(Revert { reason: BALANCE_CONVERSION_FAILED.into() }) - })?; - - let call: ::RuntimeCall = - Call::::transfer { - id: asset_id.into(), - target: ::Lookup::unlookup(dest), - amount, - } - .into(); - - env.call_runtime(call).map_err(|err| Error::Error(err.error.into()))?; - let ret: (bool,) = transferFromReturn { _0: true }.into(); - - // dispatch event - let _ev = IERC20::IERC20Events::Transfer(IERC20::Transfer { - from: from.0.into(), - to: *to, - value: *value, - }); - - // fn deposit_event(&mut self, topics: Vec, data: Vec); - // env.deposit_event(ev); - - return Ok(ret.abi_encode()); - }, - IERC20Calls::totalSupply(totalSupplyCall { .. }) => {}, - IERC20Calls::balanceOf(balanceOfCall { .. }) => {}, - IERC20Calls::allowance(allowanceCall { .. }) => {}, - IERC20Calls::approve(approveCall { .. }) => {}, - IERC20Calls::transferFrom(transferFromCall { .. }) => {}, + IERC20Calls::transfer(call) => Self::transfer(asset_id, call, env), + IERC20Calls::totalSupply(call) => Self::total_supply(asset_id, call, env), + IERC20Calls::balanceOf(call) => Self::balance_of(asset_id, call, env), + IERC20Calls::allowance(call) => Self::allowance(asset_id, call, env), + IERC20Calls::approve(call) => Self::approve(asset_id, call, env), + IERC20Calls::transferFrom(call) => Self::transfer_from(asset_id, call, env), } + } +} + +impl ERC20 +where + PrecompileConfig: AssetPrecompileConfig, + Runtime: crate::Config + pallet_revive::Config, + <::AssetIdExtractor as AssetIdExtractor>::AssetId: + Into<>::AssetId>, + Call: Into<::RuntimeCall>, + alloy::primitives::U256: From<>::Balance> + + TryInto<>::Balance>, +{ + fn transfer( + asset_id: >::AssetId, + call: &transferCall, + env: &mut impl ExtWithInfo, + ) -> Result, Error> { + let transferCall { to, value } = call; + + // TODO: Are we ok using the 0 address for root call? + let from = env + .caller() + .account_id() + .map(::AddressMapper::to_address) + .unwrap_or_default(); + + let dest = to.into_array().into(); + let dest = ::AddressMapper::to_account_id(&dest); + let amount: >::Balance = value + .clone() + .try_into() + .map_err(|_| Error::Revert(Revert { reason: BALANCE_CONVERSION_FAILED.into() }))?; + + let call: ::RuntimeCall = + Call::::transfer { + id: asset_id.into(), + target: ::Lookup::unlookup(dest), + amount, + } + .into(); + + env.call_runtime(call).map_err(|err| Error::Error(err.error.into()))?; + + let (topics, data) = IERC20::IERC20Events::Transfer(IERC20::Transfer { + from: from.0.into(), + to: *to, + value: *value, + }) + .into_log_data() + .split(); + let topics = topics.into_iter().map(|v| H256(v.0)).collect::>(); + let data: Vec = data.to_vec(); + env.deposit_event(topics, data); + return Ok(transferCall::abi_encode_returns(&true)); + } + + fn total_supply( + asset_id: >::AssetId, + call: &totalSupplyCall, + env: &mut impl ExtWithInfo, + ) -> Result, Error> { + // TODO add benchmark + use frame_support::traits::fungibles::Inspect; + let value = crate::Pallet::::total_issuance(asset_id); + return Ok(totalSupplyCall::abi_encode_returns(&value.into())); + } + + fn balance_of( + asset_id: >::AssetId, + call: &balanceOfCall, + env: &mut impl ExtWithInfo, + ) -> Result, Error> { + // TODO add benchmark + let account = call.account.into_array().into(); + let account = ::AddressMapper::to_account_id(&account); + let value = crate::Pallet::::balance(asset_id, account); + return Ok(balanceOfCall::abi_encode_returns(&value.into())); + } + + fn allowance( + asset_id: >::AssetId, + call: &allowanceCall, + env: &mut impl ExtWithInfo, + ) -> Result, Error> { + // TODO add benchmark + use frame_support::traits::fungibles::approvals::Inspect; + let owner = call.owner.into_array().into(); + let owner = ::AddressMapper::to_account_id(&owner); + + let spender = call.spender.into_array().into(); + let spender = ::AddressMapper::to_account_id(&spender); + + let value = crate::Pallet::::allowance(asset_id, &owner, &spender); + return Ok(balanceOfCall::abi_encode_returns(&value.into())); + } + + fn approve( + asset_id: >::AssetId, + call: &approveCall, + env: &mut impl ExtWithInfo, + ) -> Result, Error> { + let spender = call.spender.into_array().into(); + let spender = ::AddressMapper::to_account_id(&spender); + + let amount: >::Balance = call + .value + .try_into() + .map_err(|_| Error::Revert(Revert { reason: BALANCE_CONVERSION_FAILED.into() }))?; + + let call: ::RuntimeCall = + Call::::approve_transfer { + id: asset_id.into(), + delegate: ::Lookup::unlookup(spender), + amount, + } + .into(); + + env.call_runtime(call).map_err(|err| Error::Error(err.error.into()))?; + return Ok(approveCall::abi_encode_returns(&true)); + } + + fn transfer_from( + asset_id: >::AssetId, + call: &transferFromCall, + env: &mut impl ExtWithInfo, + ) -> Result, Error> { + let from = call.from.into_array().into(); + let from = ::AddressMapper::to_account_id(&from); + + let to = call.to.into_array().into(); + let to = ::AddressMapper::to_account_id(&to); + + let amount: >::Balance = call + .value + .try_into() + .map_err(|_| Error::Revert(Revert { reason: BALANCE_CONVERSION_FAILED.into() }))?; + + let call: ::RuntimeCall = + Call::::transfer_approved { + id: asset_id.into(), + owner: ::Lookup::unlookup(from), + destination: ::Lookup::unlookup(to), + amount, + } + .into(); - Ok(Default::default()) + env.call_runtime(call).map_err(|err| Error::Error(err.error.into()))?; + return Ok(transferFromCall::abi_encode_returns(&true)); } } diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index 77bb2cbd6dc92..3ea70f5a3198b 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -353,7 +353,7 @@ impl PrimitivePrecompile for P { input: Vec, env: &mut impl Ext, ) -> Result, Error> { - let call = ::Interface::abi_decode(&input, true) + let call = ::Interface::abi_decode(&input) .map_err(|_| Error::Panic(PanicKind::ResourceError))?; ::call(address, &call, env) } @@ -363,7 +363,7 @@ impl PrimitivePrecompile for P { input: Vec, env: &mut impl ExtWithInfo, ) -> Result, Error> { - let call = ::Interface::abi_decode(&input, true) + let call = ::Interface::abi_decode(&input) .map_err(|_| Error::Panic(PanicKind::ResourceError))?; ::call_with_info(address, &call, env) } From dbe1ba3fb0e68ca64bfc7468257adddd7eb2e813 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 16 May 2025 13:08:38 +0200 Subject: [PATCH 03/63] add utility functions --- substrate/frame/assets/src/precompiles.rs | 140 +++++++++++++--------- 1 file changed, 84 insertions(+), 56 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 027272e9e449a..f1891ee61f3c7 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -7,11 +7,11 @@ use alloy::{ sol_types::{Revert, SolCall}, }; pub use pallet_revive::{precompiles::*, AddressMapper}; -use sp_core::H256; +use sp_core::{H160, H256}; use sp_runtime::traits::StaticLookup; alloy::sol!("src/precompiles/IERC20.sol"); -use IERC20::*; +use IERC20::{IERC20Events, *}; /// Mean of extracting the asset id from the precompile address. pub trait AssetIdExtractor { @@ -76,8 +76,6 @@ pub struct ERC20 { _phantom: PhantomData<(Runtime, PrecompileConfig, Instance)>, } -const BALANCE_CONVERSION_FAILED: &str = "Balance conversion failed"; - impl Precompile for ERC20 where @@ -123,47 +121,66 @@ where alloy::primitives::U256: From<>::Balance> + TryInto<>::Balance>, { + /// Get the caller as an `H160` address. + fn caller(env: &mut impl ExtWithInfo) -> Result { + env.caller() + .account_id() + .map(::AddressMapper::to_address) + .map_err(|_| Error::Revert(Revert { reason: "Invalid caller".into() })) + } + + /// Convert a `U256` value to the balance type of the pallet. + fn balance( + value: alloy::primitives::U256, + ) -> Result<>::Balance, Error> { + value + .try_into() + .map_err(|_| Error::Revert(Revert { reason: "Balance conversion failed".into() })) + } + + fn call_runtime( + env: &mut impl ExtWithInfo, + call: Call, + ) -> Result<(), Error> { + env.call_runtime(call.into()).map_err(|err| Error::Error(err.error.into()))?; + Ok(()) + } + + /// Deposit an event to the runtime. + fn deposit_event(env: &mut impl ExtWithInfo, event: IERC20Events) { + let (topics, data) = event.into_log_data().split(); + let topics = topics.into_iter().map(|v| H256(v.0)).collect::>(); + env.deposit_event(topics, data.to_vec()); + } + fn transfer( asset_id: >::AssetId, call: &transferCall, env: &mut impl ExtWithInfo, ) -> Result, Error> { - let transferCall { to, value } = call; - - // TODO: Are we ok using the 0 address for root call? - let from = env - .caller() - .account_id() - .map(::AddressMapper::to_address) - .unwrap_or_default(); + let from = Self::caller(env)?; + let dest = ::AddressMapper::to_account_id( + &call.to.into_array().into(), + ); - let dest = to.into_array().into(); - let dest = ::AddressMapper::to_account_id(&dest); - let amount: >::Balance = value - .clone() - .try_into() - .map_err(|_| Error::Revert(Revert { reason: BALANCE_CONVERSION_FAILED.into() }))?; - - let call: ::RuntimeCall = + Self::call_runtime( + env, Call::::transfer { id: asset_id.into(), target: ::Lookup::unlookup(dest), - amount, - } - .into(); - - env.call_runtime(call).map_err(|err| Error::Error(err.error.into()))?; - - let (topics, data) = IERC20::IERC20Events::Transfer(IERC20::Transfer { - from: from.0.into(), - to: *to, - value: *value, - }) - .into_log_data() - .split(); - let topics = topics.into_iter().map(|v| H256(v.0)).collect::>(); - let data: Vec = data.to_vec(); - env.deposit_event(topics, data); + amount: Self::balance(call.value.clone())?, + }, + )?; + + Self::deposit_event( + env, + IERC20Events::Transfer(IERC20::Transfer { + from: from.0.into(), + to: call.to, + value: call.value, + }), + ); + return Ok(transferCall::abi_encode_returns(&true)); } @@ -212,23 +229,30 @@ where call: &approveCall, env: &mut impl ExtWithInfo, ) -> Result, Error> { + let owner = Self::caller(env)?; + let spender = call.spender.into_array().into(); let spender = ::AddressMapper::to_account_id(&spender); - let amount: >::Balance = call - .value - .try_into() - .map_err(|_| Error::Revert(Revert { reason: BALANCE_CONVERSION_FAILED.into() }))?; - - let call: ::RuntimeCall = + let value: >::Balance = Self::balance(call.value)?; + Self::call_runtime( + env, Call::::approve_transfer { id: asset_id.into(), delegate: ::Lookup::unlookup(spender), - amount, - } - .into(); + amount: value, + }, + )?; + + Self::deposit_event( + env, + IERC20Events::Approval(IERC20::Approval { + owner: owner.0.into(), + spender: call.spender, + value: call.value, + }), + ); - env.call_runtime(call).map_err(|err| Error::Error(err.error.into()))?; return Ok(approveCall::abi_encode_returns(&true)); } @@ -243,21 +267,25 @@ where let to = call.to.into_array().into(); let to = ::AddressMapper::to_account_id(&to); - let amount: >::Balance = call - .value - .try_into() - .map_err(|_| Error::Revert(Revert { reason: BALANCE_CONVERSION_FAILED.into() }))?; - - let call: ::RuntimeCall = + Self::call_runtime( + env, Call::::transfer_approved { id: asset_id.into(), owner: ::Lookup::unlookup(from), destination: ::Lookup::unlookup(to), - amount, - } - .into(); + amount: Self::balance(call.value)?, + }, + )?; + + Self::deposit_event( + env, + IERC20Events::Transfer(IERC20::Transfer { + from: call.from, + to: call.to, + value: call.value, + }), + ); - env.call_runtime(call).map_err(|err| Error::Error(err.error.into()))?; return Ok(transferFromCall::abi_encode_returns(&true)); } } From 232780037c7adde1c4007a4a11fead2281e433c5 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 16 May 2025 15:00:39 +0200 Subject: [PATCH 04/63] update --- substrate/frame/assets/src/benchmarking.rs | 31 ++++++ substrate/frame/assets/src/precompiles.rs | 16 ++- .../frame/assets/src/precompiles/IERC20.sol | 98 ++++++++----------- substrate/frame/assets/src/weights.rs | 3 + substrate/frame/revive/src/exec.rs | 5 + substrate/frame/revive/src/wasm/runtime.rs | 4 +- 6 files changed, 95 insertions(+), 62 deletions(-) diff --git a/substrate/frame/assets/src/benchmarking.rs b/substrate/frame/assets/src/benchmarking.rs index 8988323c19851..1e6a286bf4bfd 100644 --- a/substrate/frame/assets/src/benchmarking.rs +++ b/substrate/frame/assets/src/benchmarking.rs @@ -564,5 +564,36 @@ benchmarks_instance_pallet! { assert_last_event::(Event::Transferred { asset_id: asset_id.into(), from: caller, to: target, amount }.into()); } + total_issuance { + use frame_support::traits::fungibles::Inspect; + let (asset_id, _, _) = create_default_minted_asset::(true, 100u32.into()); + let amount; + }: { + amount = Pallet::::total_issuance(asset_id.into()); + } verify { + assert_eq!(amount, 100u32.into()); + } + + balance { + let (asset_id, caller, _) = create_default_minted_asset::(true, 100u32.into()); + let amount; + }: { + amount = Pallet::::balance(asset_id.into(), caller); + } verify { + assert_eq!(amount, 100u32.into()); + } + + allowance { + use frame_support::traits::fungibles::approvals::Inspect; + let (asset_id, caller, _) = create_default_minted_asset::(true, 100u32.into()); + add_approvals::(caller.clone(), 1); + let delegate: T::AccountId = account("approval", 0, SEED); + let amount; + }: { + amount = Pallet::::allowance(asset_id.into(), &caller, &delegate); + } verify { + assert_eq!(amount, 100u32.into()); + } + impl_benchmark_test_suite!(Assets, crate::mock::new_test_ext(), crate::mock::Test) } diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index f1891ee61f3c7..802959641e356 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -1,6 +1,6 @@ #![allow(unused_variables)] -use crate::{Call, Config, PhantomData}; +use crate::{weights::WeightInfo, Call, Config, PhantomData}; use alloc::vec::Vec; use alloy::{ primitives::IntoLogData, @@ -138,6 +138,7 @@ where .map_err(|_| Error::Revert(Revert { reason: "Balance conversion failed".into() })) } + /// Call the runtime with the given call. fn call_runtime( env: &mut impl ExtWithInfo, call: Call, @@ -153,6 +154,7 @@ where env.deposit_event(topics, data.to_vec()); } + /// Execute the transfer call. fn transfer( asset_id: >::AssetId, call: &transferCall, @@ -184,35 +186,39 @@ where return Ok(transferCall::abi_encode_returns(&true)); } + /// Execute the total supply call. fn total_supply( asset_id: >::AssetId, call: &totalSupplyCall, env: &mut impl ExtWithInfo, ) -> Result, Error> { - // TODO add benchmark use frame_support::traits::fungibles::Inspect; + env.charge(>::WeightInfo::total_issuance())?; + let value = crate::Pallet::::total_issuance(asset_id); return Ok(totalSupplyCall::abi_encode_returns(&value.into())); } + /// Execute the balance_of call. fn balance_of( asset_id: >::AssetId, call: &balanceOfCall, env: &mut impl ExtWithInfo, ) -> Result, Error> { - // TODO add benchmark + env.charge(>::WeightInfo::balance())?; let account = call.account.into_array().into(); let account = ::AddressMapper::to_account_id(&account); let value = crate::Pallet::::balance(asset_id, account); return Ok(balanceOfCall::abi_encode_returns(&value.into())); } + /// Execute the allowance call. fn allowance( asset_id: >::AssetId, call: &allowanceCall, env: &mut impl ExtWithInfo, ) -> Result, Error> { - // TODO add benchmark + env.charge(>::WeightInfo::allowance())?; use frame_support::traits::fungibles::approvals::Inspect; let owner = call.owner.into_array().into(); let owner = ::AddressMapper::to_account_id(&owner); @@ -224,6 +230,7 @@ where return Ok(balanceOfCall::abi_encode_returns(&value.into())); } + /// Execute the approve call. fn approve( asset_id: >::AssetId, call: &approveCall, @@ -256,6 +263,7 @@ where return Ok(approveCall::abi_encode_returns(&true)); } + /// Execute the transfer_from call. fn transfer_from( asset_id: >::AssetId, call: &transferFromCall, diff --git a/substrate/frame/assets/src/precompiles/IERC20.sol b/substrate/frame/assets/src/precompiles/IERC20.sol index 5f7bb7806e68c..6b33f25d44e53 100644 --- a/substrate/frame/assets/src/precompiles/IERC20.sol +++ b/substrate/frame/assets/src/precompiles/IERC20.sol @@ -3,77 +3,61 @@ // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol pragma solidity ^0.8.20; -/** - * @dev Interface of the ERC-20 standard as defined in the ERC. - */ +/// +/// @dev Interface of the ERC-20 standard as defined in the ERC. +/// interface IERC20 { - /** - * @dev Emitted when `value` tokens are moved from one account (`from`) to - * another (`to`). - * - * Note that `value` may be zero. - */ + /// @dev Emitted when `value` tokens are moved from one account (`from`) to + /// another (`to`). + /// + /// Note that `value` may be zero. event Transfer(address indexed from, address indexed to, uint256 value); - /** - * @dev Emitted when the allowance of a `spender` for an `owner` is set by - * a call to {approve}. `value` is the new allowance. - */ + /// @dev Emitted when the allowance of a `spender` for an `owner` is set by + /// a call to {approve}. `value` is the new allowance. event Approval(address indexed owner, address indexed spender, uint256 value); - /** - * @dev Returns the value of tokens in existence. - */ + /// @dev Returns the value of tokens in existence. function totalSupply() external view returns (uint256); - /** - * @dev Returns the value of tokens owned by `account`. - */ + /// @dev Returns the value of tokens owned by `account`. function balanceOf(address account) external view returns (uint256); - /** - * @dev Moves a `value` amount of tokens from the caller's account to `to`. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ + /// @dev Moves a `value` amount of tokens from the caller's account to `to`. + /// + /// Returns a boolean value indicating whether the operation succeeded. + /// + /// Emits a {Transfer} event. function transfer(address to, uint256 value) external returns (bool); - /** - * @dev Returns the remaining number of tokens that `spender` will be - * allowed to spend on behalf of `owner` through {transferFrom}. This is - * zero by default. - * - * This value changes when {approve} or {transferFrom} are called. - */ + /// @dev Returns the remaining number of tokens that `spender` will be + /// allowed to spend on behalf of `owner` through {transferFrom}. This is + /// zero by default. + /// + /// This value changes when {approve} or {transferFrom} are called. function allowance(address owner, address spender) external view returns (uint256); - /** - * @dev Sets a `value` amount of tokens as the allowance of `spender` over the - * caller's tokens. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * IMPORTANT: Beware that changing an allowance with this method brings the risk - * that someone may use both the old and the new allowance by unfortunate - * transaction ordering. One possible solution to mitigate this race - * condition is to first reduce the spender's allowance to 0 and set the - * desired value afterwards: - * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 - * - * Emits an {Approval} event. - */ + /// @dev Sets a `value` amount of tokens as the allowance of `spender` over the + /// caller's tokens. + /// + /// Returns a boolean value indicating whether the operation succeeded. + /// + /// IMPORTANT: Beware that changing an allowance with this method brings the risk + /// that someone may use both the old and the new allowance by unfortunate + /// transaction ordering. One possible solution to mitigate this race + /// condition is to first reduce the spender's allowance to 0 and set the + /// desired value afterwards: + /// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + /// + /// Emits an {Approval} event. function approve(address spender, uint256 value) external returns (bool); - /** - * @dev Moves a `value` amount of tokens from `from` to `to` using the - * allowance mechanism. `value` is then deducted from the caller's - * allowance. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ + /// @dev Moves a `value` amount of tokens from `from` to `to` using the + /// allowance mechanism. `value` is then deducted from the caller's + /// allowance. + /// + /// Returns a boolean value indicating whether the operation succeeded. + /// + /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 value) external returns (bool); } diff --git a/substrate/frame/assets/src/weights.rs b/substrate/frame/assets/src/weights.rs index 3b77821f7dadb..1cb6689828a9a 100644 --- a/substrate/frame/assets/src/weights.rs +++ b/substrate/frame/assets/src/weights.rs @@ -72,6 +72,9 @@ use core::marker::PhantomData; /// Weight functions needed for `pallet_assets`. pub trait WeightInfo { + fn total_issuance() -> Weight { Weight::zero() } + fn balance() -> Weight { Weight::zero() } + fn allowance() -> Weight { Weight::zero() } fn create() -> Weight; fn force_create() -> Weight; fn start_destroy() -> Weight; diff --git a/substrate/frame/revive/src/exec.rs b/substrate/frame/revive/src/exec.rs index a089b5ebe668d..e700a9e84cb27 100644 --- a/substrate/frame/revive/src/exec.rs +++ b/substrate/frame/revive/src/exec.rs @@ -277,6 +277,11 @@ pub trait PrecompileWithInfoExt: PrecompileExt { pub trait PrecompileExt: sealing::Sealed { type T: Config; + /// Charges the gas meter with the given weight. + fn charge(&mut self, weight: Weight) -> Result { + self.gas_meter_mut().charge(crate::RuntimeCosts::Precompile(weight)) + } + /// Call (possibly transferring some amount of funds) into the specified account. /// /// Returns the code size of the called contract. diff --git a/substrate/frame/revive/src/wasm/runtime.rs b/substrate/frame/revive/src/wasm/runtime.rs index 1586a0e9c1b2f..9b858acd52549 100644 --- a/substrate/frame/revive/src/wasm/runtime.rs +++ b/substrate/frame/revive/src/wasm/runtime.rs @@ -396,6 +396,8 @@ pub enum RuntimeCosts { Sr25519Verify(u32), /// Weight charged for calling into the runtime. CallRuntime(Weight), + /// Weight charged by a precompile. + Precompile(Weight), /// Weight charged for calling xcm_execute. CallXcmExecute(Weight), /// Weight of calling `seal_set_code_hash` @@ -545,7 +547,7 @@ impl Token for RuntimeCosts { HashBlake128(len) => T::WeightInfo::seal_hash_blake2_128(len), EcdsaRecovery => T::WeightInfo::ecdsa_recover(), Sr25519Verify(len) => T::WeightInfo::seal_sr25519_verify(len), - CallRuntime(weight) | CallXcmExecute(weight) => weight, + Precompile(weight) | CallRuntime(weight) | CallXcmExecute(weight) => weight, SetCodeHash => T::WeightInfo::seal_set_code_hash(), EcdsaToEthAddress => T::WeightInfo::seal_ecdsa_to_eth_address(), GetImmutableData(len) => T::WeightInfo::seal_get_immutable_data(len), From 4db498477fb2c92231567828630368fb5e5de758 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 16 May 2025 22:06:10 +0200 Subject: [PATCH 05/63] wip --- substrate/frame/assets/src/mock.rs | 11 ++ substrate/frame/assets/src/precompiles.rs | 185 +++++++++++++++------- substrate/frame/revive/src/address.rs | 39 ++++- substrate/frame/revive/src/lib.rs | 16 +- 4 files changed, 181 insertions(+), 70 deletions(-) diff --git a/substrate/frame/assets/src/mock.rs b/substrate/frame/assets/src/mock.rs index 9803f929a566f..7de5745f8e661 100644 --- a/substrate/frame/assets/src/mock.rs +++ b/substrate/frame/assets/src/mock.rs @@ -36,6 +36,7 @@ construct_runtime!( System: frame_system, Balances: pallet_balances, Assets: pallet_assets, + Revive: pallet_revive, } ); @@ -54,6 +55,16 @@ impl pallet_balances::Config for Test { type AccountStore = System; } +use crate::precompiles::ERC20; +make_precompile_assets_config!(ERC20Config, 0x0120); + +#[derive_impl(pallet_revive::config_preludes::TestDefaultConfig)] +impl pallet_revive::Config for Test { + type AddressMapper = pallet_revive::TestAccountMapper; + type Currency = Balances; + type Precompiles = (ERC20,); +} + pub struct AssetsCallbackHandle; impl AssetsCallback for AssetsCallbackHandle { fn created(_id: &AssetId, _owner: &AccountId) -> Result<(), ()> { diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 802959641e356..e72ddedca57b9 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -1,6 +1,6 @@ #![allow(unused_variables)] -use crate::{weights::WeightInfo, Call, Config, PhantomData}; +use crate::{weights::WeightInfo, Call, Config, PhantomData, TransferFlags}; use alloc::vec::Vec; use alloy::{ primitives::IntoLogData, @@ -41,21 +41,6 @@ impl AssetIdExtractor for AddressAssetIdExtractor { } } -#[test] -fn asset_id_extractor_works() { - use crate::{make_precompile_assets_config, precompiles::alloy::hex}; - make_precompile_assets_config!(TestConfig, 0x0120); - - let address: [u8; 20] = - hex::const_decode_to_array(b"0000053900000000000000000000000001200000").unwrap(); - assert!(TestConfig::MATCHER.matches(&address)); - assert_eq!( - ::AssetIdExtractor::asset_id_from_address(&address) - .unwrap(), - 1337u32 - ); -} - /// A macro to generate an `AssetPrecompileConfig` implementation for a given name prefix. #[macro_export] macro_rules! make_precompile_assets_config { @@ -72,7 +57,7 @@ macro_rules! make_precompile_assets_config { } /// An ERC20 precompile. -pub struct ERC20 { +pub struct ERC20 { _phantom: PhantomData<(Runtime, PrecompileConfig, Instance)>, } @@ -84,17 +69,19 @@ where <::AssetIdExtractor as AssetIdExtractor>::AssetId: Into<>::AssetId>, Call: Into<::RuntimeCall>, - alloy::primitives::U256: From<>::Balance> - + TryInto<>::Balance>, + alloy::primitives::U256: TryInto<>::Balance>, + + // Note can't use From as it's not implemented for alloy::primitives::U256 for unsigned types + alloy::primitives::U256: TryFrom<>::Balance>, { type T = Runtime; type Interface = IERC20::IERC20Calls; const MATCHER: AddressMatcher = PrecompileConfig::MATCHER; - fn call_with_info( + fn call( address: &[u8; 20], input: &Self::Interface, - env: &mut impl ExtWithInfo, + env: &mut impl Ext, ) -> Result, Error> { use IERC20::*; @@ -118,11 +105,13 @@ where <::AssetIdExtractor as AssetIdExtractor>::AssetId: Into<>::AssetId>, Call: Into<::RuntimeCall>, - alloy::primitives::U256: From<>::Balance> - + TryInto<>::Balance>, + alloy::primitives::U256: TryInto<>::Balance>, + + // Note can't use From as it's not implemented for alloy::primitives::U256 for unsigned types + alloy::primitives::U256: TryFrom<>::Balance>, { /// Get the caller as an `H160` address. - fn caller(env: &mut impl ExtWithInfo) -> Result { + fn caller(env: &mut impl Ext) -> Result { env.caller() .account_id() .map(::AddressMapper::to_address) @@ -130,7 +119,7 @@ where } /// Convert a `U256` value to the balance type of the pallet. - fn balance( + fn to_balance( value: alloy::primitives::U256, ) -> Result<>::Balance, Error> { value @@ -138,17 +127,17 @@ where .map_err(|_| Error::Revert(Revert { reason: "Balance conversion failed".into() })) } - /// Call the runtime with the given call. - fn call_runtime( - env: &mut impl ExtWithInfo, - call: Call, - ) -> Result<(), Error> { - env.call_runtime(call.into()).map_err(|err| Error::Error(err.error.into()))?; - Ok(()) + /// Convert a balance to a `U256` value. + /// Note this is needed cause From is not implemented for unsigned integer types + fn to_u256( + value: >::Balance, + ) -> Result { + Ok(alloy::primitives::U256::try_from(value) + .map_err(|_| Error::Revert(Revert { reason: "Balance conversion failed".into() }))?) } /// Deposit an event to the runtime. - fn deposit_event(env: &mut impl ExtWithInfo, event: IERC20Events) { + fn deposit_event(env: &mut impl Ext, event: IERC20Events) { let (topics, data) = event.into_log_data().split(); let topics = topics.into_iter().map(|v| H256(v.0)).collect::>(); env.deposit_event(topics, data.to_vec()); @@ -158,20 +147,23 @@ where fn transfer( asset_id: >::AssetId, call: &transferCall, - env: &mut impl ExtWithInfo, + env: &mut impl Ext, ) -> Result, Error> { + env.charge(>::WeightInfo::transfer())?; + let from = Self::caller(env)?; let dest = ::AddressMapper::to_account_id( &call.to.into_array().into(), ); - Self::call_runtime( - env, - Call::::transfer { - id: asset_id.into(), - target: ::Lookup::unlookup(dest), - amount: Self::balance(call.value.clone())?, - }, + let f = TransferFlags { keep_alive: false, best_effort: false, burn_dust: false }; + crate::Pallet::::do_transfer( + asset_id, + &::AddressMapper::to_account_id(&from), + &dest, + Self::to_balance(call.value.clone())?, + None, + f, )?; Self::deposit_event( @@ -190,33 +182,33 @@ where fn total_supply( asset_id: >::AssetId, call: &totalSupplyCall, - env: &mut impl ExtWithInfo, + env: &mut impl Ext, ) -> Result, Error> { use frame_support::traits::fungibles::Inspect; env.charge(>::WeightInfo::total_issuance())?; - let value = crate::Pallet::::total_issuance(asset_id); - return Ok(totalSupplyCall::abi_encode_returns(&value.into())); + let value = Self::to_u256(crate::Pallet::::total_issuance(asset_id))?; + return Ok(totalSupplyCall::abi_encode_returns(&value)); } /// Execute the balance_of call. fn balance_of( asset_id: >::AssetId, call: &balanceOfCall, - env: &mut impl ExtWithInfo, + env: &mut impl Ext, ) -> Result, Error> { env.charge(>::WeightInfo::balance())?; let account = call.account.into_array().into(); let account = ::AddressMapper::to_account_id(&account); - let value = crate::Pallet::::balance(asset_id, account); - return Ok(balanceOfCall::abi_encode_returns(&value.into())); + let value = Self::to_u256(crate::Pallet::::balance(asset_id, account))?; + return Ok(balanceOfCall::abi_encode_returns(&value)); } /// Execute the allowance call. fn allowance( asset_id: >::AssetId, call: &allowanceCall, - env: &mut impl ExtWithInfo, + env: &mut impl Ext, ) -> Result, Error> { env.charge(>::WeightInfo::allowance())?; use frame_support::traits::fungibles::approvals::Inspect; @@ -225,30 +217,31 @@ where let spender = call.spender.into_array().into(); let spender = ::AddressMapper::to_account_id(&spender); + let value = Self::to_u256(crate::Pallet::::allowance( + asset_id, &owner, &spender, + ))?; - let value = crate::Pallet::::allowance(asset_id, &owner, &spender); - return Ok(balanceOfCall::abi_encode_returns(&value.into())); + return Ok(balanceOfCall::abi_encode_returns(&value)); } /// Execute the approve call. fn approve( asset_id: >::AssetId, call: &approveCall, - env: &mut impl ExtWithInfo, + env: &mut impl Ext, ) -> Result, Error> { let owner = Self::caller(env)?; let spender = call.spender.into_array().into(); let spender = ::AddressMapper::to_account_id(&spender); - let value: >::Balance = Self::balance(call.value)?; - Self::call_runtime( - env, - Call::::approve_transfer { - id: asset_id.into(), - delegate: ::Lookup::unlookup(spender), - amount: value, - }, + let value: >::Balance = Self::to_balance(call.value)?; + + crate::Pallet::::do_approve_transfer( + asset_id, + &::AddressMapper::to_account_id(&owner), + &spender, + Self::to_balance(call.value.clone())?, )?; Self::deposit_event( @@ -267,7 +260,7 @@ where fn transfer_from( asset_id: >::AssetId, call: &transferFromCall, - env: &mut impl ExtWithInfo, + env: &mut impl Ext, ) -> Result, Error> { let from = call.from.into_array().into(); let from = ::AddressMapper::to_account_id(&from); @@ -275,13 +268,20 @@ where let to = call.to.into_array().into(); let to = ::AddressMapper::to_account_id(&to); + crate::Pallet::::do_transfer_approved( + asset_id, + &from, + &to, + Self::to_balance(call.value.clone())?, + )?; + Self::call_runtime( env, Call::::transfer_approved { id: asset_id.into(), owner: ::Lookup::unlookup(from), destination: ::Lookup::unlookup(to), - amount: Self::balance(call.value)?, + amount: Self::to_balance(call.value)?, }, )?; @@ -297,3 +297,66 @@ where return Ok(transferFromCall::abi_encode_returns(&true)); } } + +#[cfg(test)] +mod test { + use super::*; + use crate::{ + mock::{new_test_ext, Assets, Balances, ERC20Config, RuntimeOrigin, System, Test}, + precompiles::alloy::hex, + }; + use alloy::primitives::U256; + use frame_support::{assert_ok, traits::Currency}; + use pallet_revive::DepositLimit; + use sp_core::H160; + use sp_runtime::Weight; + + #[test] + fn asset_id_extractor_works() { + let address: [u8; 20] = + hex::const_decode_to_array(b"0000053900000000000000000000000001200000").unwrap(); + assert!(ERC20Config::MATCHER.matches(&address)); + assert_eq!( + ::AssetIdExtractor::asset_id_from_address( + &address + ) + .unwrap(), + 1337u32 + ); + } + + #[test] + fn precompile_transfer_works() { + new_test_ext().execute_with(|| { + let asset_id = 0u32; + let asset_addr = + hex::const_decode_to_array(b"0000000000000000000000000000000001200000").unwrap(); + + let owner = 1; + let to = 2; + + Balances::make_free_balance_be(&owner, 100); + Balances::make_free_balance_be(&to, 100); + + let to_addr = ::AddressMapper::to_address(&to); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, owner, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(owner), asset_id, owner, 100)); + + System::reset_events(); + + let data = + IERC20::transferCall { to: to_addr.0.into(), value: U256::from(10) }.abi_encode(); + + pallet_revive::Pallet::::bare_call( + RuntimeOrigin::signed(1), + H160::from(asset_addr), + 0u64, + Weight::MAX, + DepositLimit::Unchecked, + data, + ); + + dbg!(System::events()); + }); + } +} diff --git a/substrate/frame/revive/src/address.rs b/substrate/frame/revive/src/address.rs index 3765fc1c7c512..101ac75c3e806 100644 --- a/substrate/frame/revive/src/address.rs +++ b/substrate/frame/revive/src/address.rs @@ -42,7 +42,7 @@ use sp_runtime::{AccountId32, DispatchResult, Saturating}; /// different sizes one direction of the mapping is necessarily lossy. This requires the mapping to /// make use of the [`OriginalAccount`] storage item to reverse the mapping. pub trait AddressMapper: private::Sealed { - /// Convert an account id to an ethereum adress. + /// Convert an account id to an ethereum address. fn to_address(account_id: &T::AccountId) -> H160; /// Convert an ethereum address to a native account id. @@ -68,7 +68,7 @@ pub trait AddressMapper: private::Sealed { /// for reclaiming the deposit. fn unmap(account_id: &T::AccountId) -> DispatchResult; - /// Returns true if the `account_id` is useable as an origin. + /// Returns true if the `account_id` is usable as an origin. /// /// This means either the `account_id` doesn't require a stateful mapping /// or a stateful mapping exists. @@ -79,6 +79,7 @@ mod private { pub trait Sealed {} impl Sealed for super::AccountId32Mapper {} impl Sealed for super::H160Mapper {} + impl Sealed for super::TestAccountMapper {} } /// The mapper to be used if the account id is `AccountId32`. @@ -153,6 +154,40 @@ where } } +pub struct TestAccountMapper(PhantomData); + +impl AddressMapper for TestAccountMapper +where + T: Config, + crate::AccountIdOf: crate::IsType, +{ + fn to_address(account_id: &T::AccountId) -> H160 { + let mut bytes = [0u8; 20]; + bytes[12..].copy_from_slice(&account_id.clone().into().to_be_bytes()); + H160::from(bytes) + } + + fn to_account_id(address: &H160) -> T::AccountId { + Self::to_fallback_account_id(address) + } + + fn to_fallback_account_id(address: &H160) -> T::AccountId { + u64::from_be_bytes(address.as_ref()[12..].try_into().unwrap()).into() + } + + fn map(_account_id: &T::AccountId) -> DispatchResult { + Ok(()) + } + + fn unmap(_account_id: &T::AccountId) -> DispatchResult { + Ok(()) + } + + fn is_mapped(_account_id: &T::AccountId) -> bool { + true + } +} + /// Returns true if the passed account id is controlled by an eth key. /// /// This is a stateless check that just compares the last 12 bytes. Please note that it is diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index 3ffb88c6b8a87..9a9e89b1f911f 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -64,7 +64,7 @@ use frame_support::{ traits::{ fungible::{Inspect, Mutate, MutateHold}, tokens::{Fortitude::Polite, Preservation::Preserve}, - ConstU32, ConstU64, Contains, EnsureOrigin, Get, IsType, OriginTrait, Time, + ConstU32, ConstU64, Contains, EnsureOrigin, Everything, Get, IsType, OriginTrait, Time, }, weights::{Weight, WeightMeter}, BoundedVec, RuntimeDebugNoBound, @@ -82,7 +82,9 @@ use sp_runtime::{ }; pub use crate::{ - address::{create1, create2, is_eth_derived, AccountId32Mapper, AddressMapper}, + address::{ + create1, create2, is_eth_derived, AccountId32Mapper, AddressMapper, TestAccountMapper, + }, exec::{MomentOf, Origin}, pallet::*, }; @@ -309,7 +311,6 @@ pub mod pallet { use frame_system::EnsureSigned; use sp_core::parameter_types; - type AccountId = sp_runtime::AccountId32; type Balance = u64; const UNITS: Balance = 10_000_000_000; const CENTS: Balance = UNITS / 100; @@ -330,7 +331,7 @@ pub mod pallet { impl Time for TestDefaultConfig { type Moment = u64; fn now() -> Self::Moment { - unimplemented!("No default `now` implementation in `TestDefaultConfig` provide a custom `T::Time` type.") + 0u64 } } @@ -353,15 +354,16 @@ pub mod pallet { #[inject_runtime_type] type RuntimeCall = (); - type CallFilter = (); + + type CallFilter = Everything; type Precompiles = (); type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type DepositPerByte = DepositPerByte; type DepositPerItem = DepositPerItem; type Time = Self; type UnsafeUnstableInterface = ConstBool; - type UploadOrigin = EnsureSigned; - type InstantiateOrigin = EnsureSigned; + type UploadOrigin = EnsureSigned; + type InstantiateOrigin = EnsureSigned; type WeightInfo = (); type WeightPrice = Self; type Xcm = (); From 0374ba553d14cdff0cf9e01b49f618a3bebc0eb6 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 16 May 2025 23:19:57 +0200 Subject: [PATCH 06/63] add tests --- substrate/frame/assets/src/precompiles.rs | 219 +++++++++++++++++++--- 1 file changed, 197 insertions(+), 22 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index e72ddedca57b9..a15ab41579945 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -8,7 +8,6 @@ use alloy::{ }; pub use pallet_revive::{precompiles::*, AddressMapper}; use sp_core::{H160, H256}; -use sp_runtime::traits::StaticLookup; alloy::sol!("src/precompiles/IERC20.sol"); use IERC20::{IERC20Events, *}; @@ -89,7 +88,7 @@ where match input { IERC20Calls::transfer(call) => Self::transfer(asset_id, call, env), - IERC20Calls::totalSupply(call) => Self::total_supply(asset_id, call, env), + IERC20Calls::totalSupply(call) => Self::total_supply(asset_id, env), IERC20Calls::balanceOf(call) => Self::balance_of(asset_id, call, env), IERC20Calls::allowance(call) => Self::allowance(asset_id, call, env), IERC20Calls::approve(call) => Self::approve(asset_id, call, env), @@ -181,7 +180,6 @@ where /// Execute the total supply call. fn total_supply( asset_id: >::AssetId, - call: &totalSupplyCall, env: &mut impl Ext, ) -> Result, Error> { use frame_support::traits::fungibles::Inspect; @@ -230,6 +228,7 @@ where call: &approveCall, env: &mut impl Ext, ) -> Result, Error> { + env.charge(>::WeightInfo::approve_transfer())?; let owner = Self::caller(env)?; let spender = call.spender.into_array().into(); @@ -262,6 +261,10 @@ where call: &transferFromCall, env: &mut impl Ext, ) -> Result, Error> { + env.charge(>::WeightInfo::transfer_approved())?; + let spender = Self::caller(env)?; + let spender = ::AddressMapper::to_account_id(&spender); + let from = call.from.into_array().into(); let from = ::AddressMapper::to_account_id(&from); @@ -271,20 +274,11 @@ where crate::Pallet::::do_transfer_approved( asset_id, &from, + &spender, &to, Self::to_balance(call.value.clone())?, )?; - Self::call_runtime( - env, - Call::::transfer_approved { - id: asset_id.into(), - owner: ::Lookup::unlookup(from), - destination: ::Lookup::unlookup(to), - amount: Self::to_balance(call.value)?, - }, - )?; - Self::deposit_event( env, IERC20Events::Transfer(IERC20::Transfer { @@ -302,7 +296,9 @@ where mod test { use super::*; use crate::{ - mock::{new_test_ext, Assets, Balances, ERC20Config, RuntimeOrigin, System, Test}, + mock::{ + new_test_ext, Assets, Balances, ERC20Config, RuntimeEvent, RuntimeOrigin, System, Test, + }, precompiles::alloy::hex, }; use alloy::primitives::U256; @@ -311,6 +307,16 @@ mod test { use sp_core::H160; use sp_runtime::Weight; + fn assert_contract_event(contract: H160, event: IERC20Events) { + let (topics, data) = event.into_log_data().split(); + let topics = topics.into_iter().map(|v| H256(v.0)).collect::>(); + System::assert_has_event(RuntimeEvent::Revive(pallet_revive::Event::ContractEmitted { + contract, + data: data.to_vec(), + topics, + })); + } + #[test] fn asset_id_extractor_works() { let address: [u8; 20] = @@ -327,28 +333,141 @@ mod test { #[test] fn precompile_transfer_works() { + new_test_ext().execute_with(|| { + let asset_id = 0u32; + let asset_addr = H160::from( + hex::const_decode_to_array(b"0000000000000000000000000000000001200000").unwrap(), + ); + + let from = 1; + let to = 2; + + Balances::make_free_balance_be(&from, 100); + Balances::make_free_balance_be(&to, 100); + + let from_addr = ::AddressMapper::to_address(&from); + let to_addr = ::AddressMapper::to_address(&to); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, from, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(from), asset_id, from, 100)); + + let data = + IERC20::transferCall { to: to_addr.0.into(), value: U256::from(10) }.abi_encode(); + + pallet_revive::Pallet::::bare_call( + RuntimeOrigin::signed(1), + H160::from(asset_addr), + 0u64, + Weight::MAX, + DepositLimit::Unchecked, + data, + ); + + assert_contract_event( + asset_addr, + IERC20Events::Transfer(IERC20::Transfer { + from: from_addr.0.into(), + to: to_addr.0.into(), + value: U256::from(10), + }), + ); + + assert_eq!(Assets::balance(asset_id, from), 90); + assert_eq!(Assets::balance(asset_id, to), 10); + }); + } + + #[test] + fn total_supply_works() { + new_test_ext().execute_with(|| { + let asset_id = 0u32; + let asset_addr = + hex::const_decode_to_array(b"0000000000000000000000000000000001200000").unwrap(); + + Balances::make_free_balance_be(&1, 100); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, 1, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), asset_id, 1, 1000)); + + let data = IERC20::totalSupplyCall {}.abi_encode(); + + let data = pallet_revive::Pallet::::bare_call( + RuntimeOrigin::signed(1), + H160::from(asset_addr), + 0u64, + Weight::MAX, + DepositLimit::Unchecked, + data, + ) + .result + .unwrap() + .data; + + let ret = IERC20::totalSupplyCall::abi_decode_returns(&data).unwrap(); + assert_eq!(ret, U256::from(1000)); + }); + } + + #[test] + fn balance_of_works() { new_test_ext().execute_with(|| { let asset_id = 0u32; let asset_addr = hex::const_decode_to_array(b"0000000000000000000000000000000001200000").unwrap(); + Balances::make_free_balance_be(&1, 100); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, 1, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), asset_id, 1, 1000)); + + let account = ::AddressMapper::to_address(&1).0.into(); + let data = IERC20::balanceOfCall { account }.abi_encode(); + + let data = pallet_revive::Pallet::::bare_call( + RuntimeOrigin::signed(1), + H160::from(asset_addr), + 0u64, + Weight::MAX, + DepositLimit::Unchecked, + data, + ) + .result + .unwrap() + .data; + + let ret = IERC20::balanceOfCall::abi_decode_returns(&data).unwrap(); + assert_eq!(ret, U256::from(1000)); + }); + } + + #[test] + fn approval_works() { + use frame_support::traits::fungibles::approvals::Inspect; + + new_test_ext().execute_with(|| { + let asset_id = 0u32; + let asset_addr = H160::from( + hex::const_decode_to_array(b"0000000000000000000000000000000001200000").unwrap(), + ); + let owner = 1; - let to = 2; + let spender = 2; + let other = 3; Balances::make_free_balance_be(&owner, 100); - Balances::make_free_balance_be(&to, 100); + Balances::make_free_balance_be(&spender, 100); + Balances::make_free_balance_be(&other, 100); + + let owner_addr = ::AddressMapper::to_address(&owner); + let spender_addr = ::AddressMapper::to_address(&spender); + let other_addr = ::AddressMapper::to_address(&other); - let to_addr = ::AddressMapper::to_address(&to); assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, owner, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(owner), asset_id, owner, 100)); - System::reset_events(); - let data = - IERC20::transferCall { to: to_addr.0.into(), value: U256::from(10) }.abi_encode(); + IERC20::approveCall { spender: spender_addr.0.into(), value: U256::from(25) } + .abi_encode(); pallet_revive::Pallet::::bare_call( - RuntimeOrigin::signed(1), + RuntimeOrigin::signed(owner), H160::from(asset_addr), 0u64, Weight::MAX, @@ -356,7 +475,63 @@ mod test { data, ); - dbg!(System::events()); + assert_contract_event( + asset_addr, + IERC20Events::Approval(IERC20::Approval { + owner: owner_addr.0.into(), + spender: spender_addr.0.into(), + value: U256::from(25), + }), + ); + + let data = IERC20::allowanceCall { + owner: owner_addr.0.into(), + spender: spender_addr.0.into(), + } + .abi_encode(); + + let data = pallet_revive::Pallet::::bare_call( + RuntimeOrigin::signed(owner), + H160::from(asset_addr), + 0u64, + Weight::MAX, + DepositLimit::Unchecked, + data, + ) + .result + .unwrap() + .data; + + let ret = IERC20::allowanceCall::abi_decode_returns(&data).unwrap(); + assert_eq!(ret, U256::from(25)); + + let data = IERC20::transferFromCall { + from: owner_addr.0.into(), + to: other_addr.0.into(), + value: U256::from(10), + } + .abi_encode(); + + pallet_revive::Pallet::::bare_call( + RuntimeOrigin::signed(spender), + H160::from(asset_addr), + 0u64, + Weight::MAX, + DepositLimit::Unchecked, + data, + ); + assert_eq!(Assets::balance(asset_id, owner), 90); + assert_eq!(Assets::allowance(asset_id, &owner, &spender), 15); + assert_eq!(Assets::balance(asset_id, other), 10); + + assert_contract_event( + asset_addr, + IERC20Events::Transfer(IERC20::Transfer { + from: owner_addr.0.into(), + to: other_addr.0.into(), + value: U256::from(10), + }), + ); }); } } From 8dc6a8e0ab74d6b1923a7b85ee2adcd82cc68962 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 16 May 2025 23:24:51 +0200 Subject: [PATCH 07/63] nit --- substrate/frame/assets/src/mock.rs | 2 +- substrate/frame/revive/src/address.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/substrate/frame/assets/src/mock.rs b/substrate/frame/assets/src/mock.rs index 7de5745f8e661..c6e903370b79b 100644 --- a/substrate/frame/assets/src/mock.rs +++ b/substrate/frame/assets/src/mock.rs @@ -20,6 +20,7 @@ use super::*; use crate as pallet_assets; +use crate::precompiles::ERC20; use codec::Encode; use frame_support::{ assert_ok, construct_runtime, derive_impl, parameter_types, @@ -55,7 +56,6 @@ impl pallet_balances::Config for Test { type AccountStore = System; } -use crate::precompiles::ERC20; make_precompile_assets_config!(ERC20Config, 0x0120); #[derive_impl(pallet_revive::config_preludes::TestDefaultConfig)] diff --git a/substrate/frame/revive/src/address.rs b/substrate/frame/revive/src/address.rs index 101ac75c3e806..ebb45961ebe58 100644 --- a/substrate/frame/revive/src/address.rs +++ b/substrate/frame/revive/src/address.rs @@ -154,6 +154,7 @@ where } } +/// An account mapper that can be used for testing u64 account ids. pub struct TestAccountMapper(PhantomData); impl AddressMapper for TestAccountMapper From 2065dcbf7063c03c337a6a84232580b109759422 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 17 May 2025 09:45:27 +0200 Subject: [PATCH 08/63] fix alloy --- bridges/snowbridge/pallets/inbound-queue/src/envelope.rs | 2 +- bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs | 2 +- .../primitives/outbound-queue/src/v2/delivery_receipt.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs b/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs index 888ffe86092d7..5fec8a7c36fa0 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs @@ -36,7 +36,7 @@ impl TryFrom<&Log> for Envelope { fn try_from(log: &Log) -> Result { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); - let event = OutboundMessageAccepted::decode_raw_log(topics, &log.data, true) + let event = OutboundMessageAccepted::decode_raw_log(topics, &log.data) .map_err(|_| EnvelopeDecodeError)?; Ok(Self { diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs index 06efeba8546aa..cf1325f4e6b1f 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs @@ -149,7 +149,7 @@ impl TryFrom<&Log> for Message { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); // Decode the Solidity event from raw logs - let event = IGatewayV2::OutboundMessageAccepted::decode_raw_log(topics, &log.data, true) + let event = IGatewayV2::OutboundMessageAccepted::decode_raw_log(topics, &log.data) .map_err(|_| MessageDecodeError)?; let payload = event.payload; diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs index 852de849177b1..7288f63b7b81a 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs @@ -38,7 +38,7 @@ impl TryFrom<&Log> for DeliveryReceipt { fn try_from(log: &Log) -> Result { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); - let event = InboundMessageDispatched::decode_raw_log(topics, &log.data, true) + let event = InboundMessageDispatched::decode_raw_log(topics, &log.data) .map_err(|_| DeliveryReceiptDecodeError::DecodeLogFailed)?; Ok(Self { From ef08472b66aa3658d9db033725c7a2457a68bcb5 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 17 May 2025 07:49:45 +0000 Subject: [PATCH 09/63] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump patch' --- prdoc/pr_8554.prdoc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 prdoc/pr_8554.prdoc diff --git a/prdoc/pr_8554.prdoc b/prdoc/pr_8554.prdoc new file mode 100644 index 0000000000000..c4f46ff4b927f --- /dev/null +++ b/prdoc/pr_8554.prdoc @@ -0,0 +1,23 @@ +title: pallet-assets ERC20 precompile +doc: +- audience: Runtime Dev + description: |- + Add ERC20 precompile for pallet-asset. + + Since there can be multiple instance of pallet-assets the Precompile is implemented for an `AssetPrecompileConfig` that defines the address range to match and how to extract the asset_id from the address. + + For now I have only created one `AssetIdExtractor` that pull u32 asset id encoded on the address. + Follow up PR will define another stateful extractor to extract it from storage for foreign assets. + + Other solidity traits will follow up as well in follow up PRs +crates: +- name: pallet-assets + bump: patch +- name: pallet-revive + bump: patch +- name: snowbridge-pallet-inbound-queue + bump: patch +- name: snowbridge-inbound-queue-primitives + bump: patch +- name: snowbridge-outbound-queue-primitives + bump: patch From 79bd9aba41bd67beb5c9c6f50a27703bc7a5775a Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 17 May 2025 11:42:25 +0200 Subject: [PATCH 10/63] fix alloy --- .../snowbridge/primitives/inbound-queue/src/v2/message.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs index cf1325f4e6b1f..104bea7381345 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs @@ -198,7 +198,7 @@ impl TryFrom<&IGatewayV2::Payload> for XcmPayload { let xcm = match payload.xcm.kind { 0 => XcmPayload::Raw(payload.xcm.data.to_vec()), 1 => { - let create_asset = IGatewayV2::XcmCreateAsset::abi_decode(&payload.xcm.data, true) + let create_asset = IGatewayV2::XcmCreateAsset::abi_decode(&payload.xcm.data) .map_err(|_| MessageDecodeError)?; // Convert u8 network to Network enum let network = match create_asset.network { @@ -219,7 +219,7 @@ impl TryFrom<&IGatewayV2::EthereumAsset> for EthereumAsset { fn try_from(asset: &IGatewayV2::EthereumAsset) -> Result { let asset = match asset.kind { 0 => { - let native_data = IGatewayV2::AsNativeTokenERC20::abi_decode(&asset.data, true) + let native_data = IGatewayV2::AsNativeTokenERC20::abi_decode(&asset.data) .map_err(|_| MessageDecodeError)?; EthereumAsset::NativeTokenERC20 { token_id: H160::from(native_data.token_id.as_ref()), @@ -227,7 +227,7 @@ impl TryFrom<&IGatewayV2::EthereumAsset> for EthereumAsset { } }, 1 => { - let foreign_data = IGatewayV2::AsForeignTokenERC20::abi_decode(&asset.data, true) + let foreign_data = IGatewayV2::AsForeignTokenERC20::abi_decode(&asset.data) .map_err(|_| MessageDecodeError)?; EthereumAsset::ForeignTokenERC20 { token_id: H256::from(foreign_data.token_id.as_ref()), From 231387c312d6fea8facc3ffa3501239166820c5c Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 17 May 2025 11:50:59 +0200 Subject: [PATCH 11/63] add constants --- substrate/frame/assets/src/precompiles.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index a15ab41579945..424f6d502516f 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -97,6 +97,9 @@ where } } +const ERR_INVALID_CALLER: &str = "Invalid caller"; +const ERR_BALANCE_CONVERSION_FAILED: &str = "Balance conversion failed"; + impl ERC20 where PrecompileConfig: AssetPrecompileConfig, @@ -114,7 +117,7 @@ where env.caller() .account_id() .map(::AddressMapper::to_address) - .map_err(|_| Error::Revert(Revert { reason: "Invalid caller".into() })) + .map_err(|_| Error::Revert(Revert { reason: ERR_INVALID_CALLER.into() })) } /// Convert a `U256` value to the balance type of the pallet. @@ -123,7 +126,7 @@ where ) -> Result<>::Balance, Error> { value .try_into() - .map_err(|_| Error::Revert(Revert { reason: "Balance conversion failed".into() })) + .map_err(|_| Error::Revert(Revert { reason: ERR_BALANCE_CONVERSION_FAILED.into() })) } /// Convert a balance to a `U256` value. @@ -132,7 +135,7 @@ where value: >::Balance, ) -> Result { Ok(alloy::primitives::U256::try_from(value) - .map_err(|_| Error::Revert(Revert { reason: "Balance conversion failed".into() }))?) + .map_err(|_| Error::Revert(Revert { reason: ERR_BALANCE_CONVERSION_FAILED.into() }))?) } /// Deposit an event to the runtime. From 6aff60de24d93deafee0a1c47498bfaccadae1cb Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 17 May 2025 16:36:52 +0200 Subject: [PATCH 12/63] fix --- .../revive/mock-network/src/parachain/contracts_config.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/substrate/frame/revive/mock-network/src/parachain/contracts_config.rs b/substrate/frame/revive/mock-network/src/parachain/contracts_config.rs index c2ddb8fb750fe..49567a6d87a7d 100644 --- a/substrate/frame/revive/mock-network/src/parachain/contracts_config.rs +++ b/substrate/frame/revive/mock-network/src/parachain/contracts_config.rs @@ -14,14 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use super::{Balances, Runtime, RuntimeCall, RuntimeEvent}; +use super::{AccountId, Balances, Runtime, RuntimeCall, RuntimeEvent}; use crate::parachain::RuntimeHoldReason; use frame_support::derive_impl; +use frame_system::EnsureSigned; #[derive_impl(pallet_revive::config_preludes::TestDefaultConfig)] impl pallet_revive::Config for Runtime { type AddressMapper = pallet_revive::AccountId32Mapper; type Currency = Balances; + type UploadOrigin = EnsureSigned; + type InstantiateOrigin = EnsureSigned; type Time = super::Timestamp; type Xcm = pallet_xcm::Pallet; } From 5b580b0b29bef045e9b80b8336a92da8969617cf Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 17 May 2025 16:41:20 +0200 Subject: [PATCH 13/63] undo changes --- substrate/frame/revive/src/exec.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/substrate/frame/revive/src/exec.rs b/substrate/frame/revive/src/exec.rs index e700a9e84cb27..7c98b9aeadbaf 100644 --- a/substrate/frame/revive/src/exec.rs +++ b/substrate/frame/revive/src/exec.rs @@ -229,6 +229,9 @@ pub trait Ext: PrecompileWithInfoExt { /// /// Note: Requires &mut self to access the contract info. fn set_immutable_data(&mut self, data: ImmutableData) -> Result<(), DispatchError>; + + /// Call some dispatchable and return the result. + fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo; } /// Environment functions which are available to pre-compiles with `HAS_CONTRACT_INFO = true`. @@ -426,9 +429,6 @@ pub trait PrecompileExt: sealing::Sealed { /// Returns a mutable reference to the output of the last executed call frame. fn last_frame_output_mut(&mut self) -> &mut ExecReturnValue; - - /// Call some dispatchable and return the result. - fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo; } /// Describes the different functions that can be exported by an [`Executable`]. @@ -1578,6 +1578,12 @@ where Ok(()) } + fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo { + let mut origin: T::RuntimeOrigin = RawOrigin::Signed(self.account_id().clone()).into(); + origin.add_filter(T::CallFilter::contains); + call.dispatch(origin) + } + fn immutable_data_len(&mut self) -> u32 { self.top_frame_mut().contract_info().immutable_data_len() } @@ -1953,12 +1959,6 @@ where fn last_frame_output_mut(&mut self) -> &mut ExecReturnValue { &mut self.top_frame_mut().last_frame_output } - - fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo { - let mut origin: T::RuntimeOrigin = RawOrigin::Signed(self.account_id().clone()).into(); - origin.add_filter(T::CallFilter::contains); - call.dispatch(origin) - } } mod sealing { From bf654ec66e5538efeb1b23752ca4caa8eb04bc5e Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 17 May 2025 17:43:21 +0200 Subject: [PATCH 14/63] clippy --- substrate/frame/assets/src/precompiles.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 424f6d502516f..d38d8d37cb6d2 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -134,8 +134,8 @@ where fn to_u256( value: >::Balance, ) -> Result { - Ok(alloy::primitives::U256::try_from(value) - .map_err(|_| Error::Revert(Revert { reason: ERR_BALANCE_CONVERSION_FAILED.into() }))?) + alloy::primitives::U256::try_from(value) + .map_err(|_| Error::Revert(Revert { reason: ERR_BALANCE_CONVERSION_FAILED.into() })) } /// Deposit an event to the runtime. @@ -163,7 +163,7 @@ where asset_id, &::AddressMapper::to_account_id(&from), &dest, - Self::to_balance(call.value.clone())?, + Self::to_balance(call.value)?, None, f, )?; @@ -243,7 +243,7 @@ where asset_id, &::AddressMapper::to_account_id(&owner), &spender, - Self::to_balance(call.value.clone())?, + Self::to_balance(call.value)?, )?; Self::deposit_event( @@ -279,7 +279,7 @@ where &from, &spender, &to, - Self::to_balance(call.value.clone())?, + Self::to_balance(call.value)?, )?; Self::deposit_event( From b9d3add0ef15fb696f0c70b508b3fe7ef25a9825 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 17 May 2025 22:12:23 +0200 Subject: [PATCH 15/63] clippy --- substrate/frame/assets/src/precompiles.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index d38d8d37cb6d2..347a732a4a510 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -1,4 +1,19 @@ -#![allow(unused_variables)] +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. use crate::{weights::WeightInfo, Call, Config, PhantomData, TransferFlags}; use alloc::vec::Vec; @@ -88,7 +103,7 @@ where match input { IERC20Calls::transfer(call) => Self::transfer(asset_id, call, env), - IERC20Calls::totalSupply(call) => Self::total_supply(asset_id, env), + IERC20Calls::totalSupply(_) => Self::total_supply(asset_id, env), IERC20Calls::balanceOf(call) => Self::balance_of(asset_id, call, env), IERC20Calls::allowance(call) => Self::allowance(asset_id, call, env), IERC20Calls::approve(call) => Self::approve(asset_id, call, env), @@ -233,12 +248,9 @@ where ) -> Result, Error> { env.charge(>::WeightInfo::approve_transfer())?; let owner = Self::caller(env)?; - let spender = call.spender.into_array().into(); let spender = ::AddressMapper::to_account_id(&spender); - let value: >::Balance = Self::to_balance(call.value)?; - crate::Pallet::::do_approve_transfer( asset_id, &::AddressMapper::to_account_id(&owner), From 86e590a70f638c578388044be98f3f1a689ba728 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 17 May 2025 22:13:16 +0200 Subject: [PATCH 16/63] taplo --- substrate/frame/assets/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/substrate/frame/assets/Cargo.toml b/substrate/frame/assets/Cargo.toml index 6437101dd41aa..c643ae751a1fc 100644 --- a/substrate/frame/assets/Cargo.toml +++ b/substrate/frame/assets/Cargo.toml @@ -27,8 +27,8 @@ frame-support = { workspace = true } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. frame-benchmarking = { optional = true, workspace = true } frame-system = { workspace = true } -sp-core = { workspace = true } pallet-revive = { workspace = true } +sp-core = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -54,13 +54,13 @@ runtime-benchmarks = [ "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-revive/runtime-benchmarks", "sp-runtime/runtime-benchmarks", - "pallet-revive/runtime-benchmarks" ] try-runtime = [ "frame-support/try-runtime", "frame-system/try-runtime", "pallet-balances/try-runtime", + "pallet-revive/try-runtime", "sp-runtime/try-runtime", - "pallet-revive/try-runtime" ] From bbe4285df1979db0444a542686f54d8b4df95e9d Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 17 May 2025 20:47:52 +0000 Subject: [PATCH 17/63] Update from github-actions[bot] running command 'bench --runtime dev --pallet pallet_assets' --- substrate/frame/assets/src/weights.rs | 517 ++++++++++++++------------ 1 file changed, 288 insertions(+), 229 deletions(-) diff --git a/substrate/frame/assets/src/weights.rs b/substrate/frame/assets/src/weights.rs index 1cb6689828a9a..32de86c2317ec 100644 --- a/substrate/frame/assets/src/weights.rs +++ b/substrate/frame/assets/src/weights.rs @@ -35,9 +35,9 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `4563561839a5`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `e148eff7bcc7`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: @@ -58,8 +58,7 @@ // --no-storage-info // --no-min-squares // --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage,pallet_election_provider_multi_block,pallet_election_provider_multi_block::signed,pallet_election_provider_multi_block::unsigned,pallet_election_provider_multi_block::verifier +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -72,9 +71,6 @@ use core::marker::PhantomData; /// Weight functions needed for `pallet_assets`. pub trait WeightInfo { - fn total_issuance() -> Weight { Weight::zero() } - fn balance() -> Weight { Weight::zero() } - fn allowance() -> Weight { Weight::zero() } fn create() -> Weight; fn force_create() -> Weight; fn start_destroy() -> Weight; @@ -108,6 +104,9 @@ pub trait WeightInfo { fn refund_other() -> Weight; fn block() -> Weight; fn transfer_all() -> Weight; + fn total_issuance() -> Weight; + fn balance() -> Weight; + fn allowance() -> Weight; } /// Weights for `pallet_assets` using the Substrate node and recommended hardware. @@ -121,10 +120,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn create() -> Weight { // Proof Size summary in bytes: - // Measured: `52` + // Measured: `326` // Estimated: `3675` - // Minimum execution time: 22_322_000 picoseconds. - Weight::from_parts(22_636_000, 3675) + // Minimum execution time: 30_405_000 picoseconds. + Weight::from_parts(31_723_000, 3675) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -134,10 +133,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn force_create() -> Weight { // Proof Size summary in bytes: - // Measured: `0` + // Measured: `186` // Estimated: `3675` - // Minimum execution time: 7_493_000 picoseconds. - Weight::from_parts(7_920_000, 3675) + // Minimum execution time: 12_751_000 picoseconds. + Weight::from_parts(13_355_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -145,10 +144,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn start_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `255` + // Measured: `418` // Estimated: `3675` - // Minimum execution time: 9_650_000 picoseconds. - Weight::from_parts(10_108_000, 3675) + // Minimum execution time: 14_582_000 picoseconds. + Weight::from_parts(15_406_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -161,12 +160,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + c * (208 ±0)` + // Measured: `104 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 11_811_000 picoseconds. - Weight::from_parts(12_285_000, 3675) - // Standard Error: 8_837 - .saturating_add(Weight::from_parts(14_469_922, 0).saturating_mul(c.into())) + // Minimum execution time: 18_704_000 picoseconds. + Weight::from_parts(19_061_000, 3675) + // Standard Error: 12_155 + .saturating_add(Weight::from_parts(14_363_983, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -180,12 +179,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `a` is `[0, 1000]`. fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `469 + a * (86 ±0)` + // Measured: `555 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 14_861_000 picoseconds. - Weight::from_parts(15_009_000, 3675) - // Standard Error: 4_545 - .saturating_add(Weight::from_parts(15_566_242, 0).saturating_mul(a.into())) + // Minimum execution time: 19_375_000 picoseconds. + Weight::from_parts(19_900_000, 3675) + // Standard Error: 6_093 + .saturating_add(Weight::from_parts(15_502_206, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -198,10 +197,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn finish_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 10_306_000 picoseconds. - Weight::from_parts(10_763_000, 3675) + // Minimum execution time: 15_657_000 picoseconds. + Weight::from_parts(16_283_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -211,10 +210,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 19_364_000 picoseconds. - Weight::from_parts(19_954_000, 3675) + // Minimum execution time: 25_547_000 picoseconds. + Weight::from_parts(26_465_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -224,10 +223,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `492` // Estimated: `3675` - // Minimum execution time: 29_138_000 picoseconds. - Weight::from_parts(29_702_000, 3675) + // Minimum execution time: 33_549_000 picoseconds. + Weight::from_parts(35_274_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -239,10 +238,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `531` // Estimated: `6208` - // Minimum execution time: 40_145_000 picoseconds. - Weight::from_parts(40_920_000, 6208) + // Minimum execution time: 47_470_000 picoseconds. + Weight::from_parts(48_792_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -254,10 +253,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `531` // Estimated: `6208` - // Minimum execution time: 36_083_000 picoseconds. - Weight::from_parts(36_804_000, 6208) + // Minimum execution time: 42_132_000 picoseconds. + Weight::from_parts(43_155_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -269,10 +268,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `531` // Estimated: `6208` - // Minimum execution time: 39_945_000 picoseconds. - Weight::from_parts(40_933_000, 6208) + // Minimum execution time: 46_320_000 picoseconds. + Weight::from_parts(48_163_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -282,10 +281,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn freeze() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `492` // Estimated: `3675` - // Minimum execution time: 14_764_000 picoseconds. - Weight::from_parts(15_135_000, 3675) + // Minimum execution time: 19_030_000 picoseconds. + Weight::from_parts(20_042_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -295,10 +294,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn thaw() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `492` // Estimated: `3675` - // Minimum execution time: 14_563_000 picoseconds. - Weight::from_parts(15_262_000, 3675) + // Minimum execution time: 19_166_000 picoseconds. + Weight::from_parts(19_969_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -306,10 +305,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn freeze_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `255` + // Measured: `418` // Estimated: `3675` - // Minimum execution time: 9_511_000 picoseconds. - Weight::from_parts(9_822_000, 3675) + // Minimum execution time: 14_521_000 picoseconds. + Weight::from_parts(15_429_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -317,10 +316,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn thaw_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `255` + // Measured: `418` // Estimated: `3675` - // Minimum execution time: 9_601_000 picoseconds. - Weight::from_parts(9_823_000, 3675) + // Minimum execution time: 14_593_000 picoseconds. + Weight::from_parts(15_350_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -330,10 +329,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn transfer_ownership() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 10_822_000 picoseconds. - Weight::from_parts(11_355_000, 3675) + // Minimum execution time: 15_970_000 picoseconds. + Weight::from_parts(16_777_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -341,10 +340,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn set_team() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 8_918_000 picoseconds. - Weight::from_parts(9_276_000, 3675) + // Minimum execution time: 14_235_000 picoseconds. + Weight::from_parts(14_668_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -356,14 +355,14 @@ impl WeightInfo for SubstrateWeight { /// The range of component `s` is `[0, 50]`. fn set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 23_560_000 picoseconds. - Weight::from_parts(24_344_158, 3675) - // Standard Error: 532 - .saturating_add(Weight::from_parts(6_585, 0).saturating_mul(n.into())) - // Standard Error: 532 - .saturating_add(Weight::from_parts(4_755, 0).saturating_mul(s.into())) + // Minimum execution time: 29_909_000 picoseconds. + Weight::from_parts(31_576_538, 3675) + // Standard Error: 1_361 + .saturating_add(Weight::from_parts(5_096, 0).saturating_mul(n.into())) + // Standard Error: 1_361 + .saturating_add(Weight::from_parts(1_553, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -373,10 +372,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `386` + // Measured: `548` // Estimated: `3675` - // Minimum execution time: 25_139_000 picoseconds. - Weight::from_parts(25_763_000, 3675) + // Minimum execution time: 29_975_000 picoseconds. + Weight::from_parts(31_243_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -388,14 +387,14 @@ impl WeightInfo for SubstrateWeight { /// The range of component `s` is `[0, 50]`. fn force_set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `56` + // Measured: `223` // Estimated: `3675` - // Minimum execution time: 9_212_000 picoseconds. - Weight::from_parts(9_752_745, 3675) - // Standard Error: 308 - .saturating_add(Weight::from_parts(665, 0).saturating_mul(n.into())) - // Standard Error: 308 - .saturating_add(Weight::from_parts(1_680, 0).saturating_mul(s.into())) + // Minimum execution time: 12_623_000 picoseconds. + Weight::from_parts(13_744_890, 3675) + // Standard Error: 601 + .saturating_add(Weight::from_parts(1_284, 0).saturating_mul(n.into())) + // Standard Error: 601 + .saturating_add(Weight::from_parts(1_056, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -405,10 +404,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `386` + // Measured: `548` // Estimated: `3675` - // Minimum execution time: 25_100_000 picoseconds. - Weight::from_parts(25_471_000, 3675) + // Minimum execution time: 29_614_000 picoseconds. + Weight::from_parts(30_708_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -416,10 +415,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn force_asset_status() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 8_834_000 picoseconds. - Weight::from_parts(9_282_000, 3675) + // Minimum execution time: 13_760_000 picoseconds. + Weight::from_parts(14_420_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -429,10 +428,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn approve_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `255` + // Measured: `418` // Estimated: `3675` - // Minimum execution time: 29_392_000 picoseconds. - Weight::from_parts(30_210_000, 3675) + // Minimum execution time: 34_039_000 picoseconds. + Weight::from_parts(35_267_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -446,10 +445,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `500` + // Measured: `701` // Estimated: `6208` - // Minimum execution time: 59_493_000 picoseconds. - Weight::from_parts(60_467_000, 6208) + // Minimum execution time: 67_152_000 picoseconds. + Weight::from_parts(68_752_000, 6208) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -459,10 +458,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `425` + // Measured: `588` // Estimated: `3675` - // Minimum execution time: 30_429_000 picoseconds. - Weight::from_parts(31_332_000, 3675) + // Minimum execution time: 35_452_000 picoseconds. + Weight::from_parts(36_609_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -472,10 +471,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `425` + // Measured: `588` // Estimated: `3675` - // Minimum execution time: 30_628_000 picoseconds. - Weight::from_parts(31_361_000, 3675) + // Minimum execution time: 35_608_000 picoseconds. + Weight::from_parts(36_487_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -483,10 +482,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn set_min_balance() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 9_657_000 picoseconds. - Weight::from_parts(9_994_000, 3675) + // Minimum execution time: 15_133_000 picoseconds. + Weight::from_parts(15_629_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -498,10 +497,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn touch() -> Weight { // Proof Size summary in bytes: - // Measured: `269` + // Measured: `486` // Estimated: `3675` - // Minimum execution time: 27_740_000 picoseconds. - Weight::from_parts(28_250_000, 3675) + // Minimum execution time: 35_385_000 picoseconds. + Weight::from_parts(36_282_000, 3675) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -511,10 +510,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn touch_other() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 26_874_000 picoseconds. - Weight::from_parts(27_348_000, 3675) + // Minimum execution time: 33_501_000 picoseconds. + Weight::from_parts(34_398_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -526,10 +525,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn refund() -> Weight { // Proof Size summary in bytes: - // Measured: `400` + // Measured: `612` // Estimated: `3675` - // Minimum execution time: 28_474_000 picoseconds. - Weight::from_parts(29_396_000, 3675) + // Minimum execution time: 33_799_000 picoseconds. + Weight::from_parts(34_728_000, 3675) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -539,10 +538,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn refund_other() -> Weight { // Proof Size summary in bytes: - // Measured: `381` + // Measured: `543` // Estimated: `3675` - // Minimum execution time: 27_646_000 picoseconds. - Weight::from_parts(28_249_000, 3675) + // Minimum execution time: 31_956_000 picoseconds. + Weight::from_parts(33_067_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -552,10 +551,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn block() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `492` // Estimated: `3675` - // Minimum execution time: 14_437_000 picoseconds. - Weight::from_parts(15_127_000, 3675) + // Minimum execution time: 19_191_000 picoseconds. + Weight::from_parts(19_966_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -567,13 +566,43 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `531` // Estimated: `6208` - // Minimum execution time: 49_370_000 picoseconds. - Weight::from_parts(50_734_000, 6208) + // Minimum execution time: 54_969_000 picoseconds. + Weight::from_parts(57_370_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } + /// Storage: `Assets::Asset` (r:1 w:0) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `418` + // Estimated: `3675` + // Minimum execution time: 8_594_000 picoseconds. + Weight::from_parts(8_977_000, 3675) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + /// Storage: `Assets::Account` (r:1 w:0) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `255` + // Estimated: `3599` + // Minimum execution time: 8_469_000 picoseconds. + Weight::from_parts(8_867_000, 3599) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + /// Storage: `Assets::Approvals` (r:1 w:0) + /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `350` + // Estimated: `3613` + // Minimum execution time: 11_269_000 picoseconds. + Weight::from_parts(11_630_000, 3613) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } } // For backwards compatibility and tests. @@ -586,10 +615,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn create() -> Weight { // Proof Size summary in bytes: - // Measured: `52` + // Measured: `326` // Estimated: `3675` - // Minimum execution time: 22_322_000 picoseconds. - Weight::from_parts(22_636_000, 3675) + // Minimum execution time: 30_405_000 picoseconds. + Weight::from_parts(31_723_000, 3675) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -599,10 +628,10 @@ impl WeightInfo for () { /// Proof: `Assets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn force_create() -> Weight { // Proof Size summary in bytes: - // Measured: `0` + // Measured: `186` // Estimated: `3675` - // Minimum execution time: 7_493_000 picoseconds. - Weight::from_parts(7_920_000, 3675) + // Minimum execution time: 12_751_000 picoseconds. + Weight::from_parts(13_355_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -610,10 +639,10 @@ impl WeightInfo for () { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn start_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `255` + // Measured: `418` // Estimated: `3675` - // Minimum execution time: 9_650_000 picoseconds. - Weight::from_parts(10_108_000, 3675) + // Minimum execution time: 14_582_000 picoseconds. + Weight::from_parts(15_406_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -626,12 +655,12 @@ impl WeightInfo for () { /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + c * (208 ±0)` + // Measured: `104 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 11_811_000 picoseconds. - Weight::from_parts(12_285_000, 3675) - // Standard Error: 8_837 - .saturating_add(Weight::from_parts(14_469_922, 0).saturating_mul(c.into())) + // Minimum execution time: 18_704_000 picoseconds. + Weight::from_parts(19_061_000, 3675) + // Standard Error: 12_155 + .saturating_add(Weight::from_parts(14_363_983, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -645,12 +674,12 @@ impl WeightInfo for () { /// The range of component `a` is `[0, 1000]`. fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `469 + a * (86 ±0)` + // Measured: `555 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 14_861_000 picoseconds. - Weight::from_parts(15_009_000, 3675) - // Standard Error: 4_545 - .saturating_add(Weight::from_parts(15_566_242, 0).saturating_mul(a.into())) + // Minimum execution time: 19_375_000 picoseconds. + Weight::from_parts(19_900_000, 3675) + // Standard Error: 6_093 + .saturating_add(Weight::from_parts(15_502_206, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -663,10 +692,10 @@ impl WeightInfo for () { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn finish_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 10_306_000 picoseconds. - Weight::from_parts(10_763_000, 3675) + // Minimum execution time: 15_657_000 picoseconds. + Weight::from_parts(16_283_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -676,10 +705,10 @@ impl WeightInfo for () { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 19_364_000 picoseconds. - Weight::from_parts(19_954_000, 3675) + // Minimum execution time: 25_547_000 picoseconds. + Weight::from_parts(26_465_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -689,10 +718,10 @@ impl WeightInfo for () { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `492` // Estimated: `3675` - // Minimum execution time: 29_138_000 picoseconds. - Weight::from_parts(29_702_000, 3675) + // Minimum execution time: 33_549_000 picoseconds. + Weight::from_parts(35_274_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -704,10 +733,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `531` // Estimated: `6208` - // Minimum execution time: 40_145_000 picoseconds. - Weight::from_parts(40_920_000, 6208) + // Minimum execution time: 47_470_000 picoseconds. + Weight::from_parts(48_792_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -719,10 +748,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `531` // Estimated: `6208` - // Minimum execution time: 36_083_000 picoseconds. - Weight::from_parts(36_804_000, 6208) + // Minimum execution time: 42_132_000 picoseconds. + Weight::from_parts(43_155_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -734,10 +763,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `531` // Estimated: `6208` - // Minimum execution time: 39_945_000 picoseconds. - Weight::from_parts(40_933_000, 6208) + // Minimum execution time: 46_320_000 picoseconds. + Weight::from_parts(48_163_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -747,10 +776,10 @@ impl WeightInfo for () { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn freeze() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `492` // Estimated: `3675` - // Minimum execution time: 14_764_000 picoseconds. - Weight::from_parts(15_135_000, 3675) + // Minimum execution time: 19_030_000 picoseconds. + Weight::from_parts(20_042_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -760,10 +789,10 @@ impl WeightInfo for () { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn thaw() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `492` // Estimated: `3675` - // Minimum execution time: 14_563_000 picoseconds. - Weight::from_parts(15_262_000, 3675) + // Minimum execution time: 19_166_000 picoseconds. + Weight::from_parts(19_969_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -771,10 +800,10 @@ impl WeightInfo for () { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn freeze_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `255` + // Measured: `418` // Estimated: `3675` - // Minimum execution time: 9_511_000 picoseconds. - Weight::from_parts(9_822_000, 3675) + // Minimum execution time: 14_521_000 picoseconds. + Weight::from_parts(15_429_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -782,10 +811,10 @@ impl WeightInfo for () { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn thaw_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `255` + // Measured: `418` // Estimated: `3675` - // Minimum execution time: 9_601_000 picoseconds. - Weight::from_parts(9_823_000, 3675) + // Minimum execution time: 14_593_000 picoseconds. + Weight::from_parts(15_350_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -795,10 +824,10 @@ impl WeightInfo for () { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn transfer_ownership() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 10_822_000 picoseconds. - Weight::from_parts(11_355_000, 3675) + // Minimum execution time: 15_970_000 picoseconds. + Weight::from_parts(16_777_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -806,10 +835,10 @@ impl WeightInfo for () { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn set_team() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 8_918_000 picoseconds. - Weight::from_parts(9_276_000, 3675) + // Minimum execution time: 14_235_000 picoseconds. + Weight::from_parts(14_668_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -821,14 +850,14 @@ impl WeightInfo for () { /// The range of component `s` is `[0, 50]`. fn set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 23_560_000 picoseconds. - Weight::from_parts(24_344_158, 3675) - // Standard Error: 532 - .saturating_add(Weight::from_parts(6_585, 0).saturating_mul(n.into())) - // Standard Error: 532 - .saturating_add(Weight::from_parts(4_755, 0).saturating_mul(s.into())) + // Minimum execution time: 29_909_000 picoseconds. + Weight::from_parts(31_576_538, 3675) + // Standard Error: 1_361 + .saturating_add(Weight::from_parts(5_096, 0).saturating_mul(n.into())) + // Standard Error: 1_361 + .saturating_add(Weight::from_parts(1_553, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -838,10 +867,10 @@ impl WeightInfo for () { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `386` + // Measured: `548` // Estimated: `3675` - // Minimum execution time: 25_139_000 picoseconds. - Weight::from_parts(25_763_000, 3675) + // Minimum execution time: 29_975_000 picoseconds. + Weight::from_parts(31_243_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -853,14 +882,14 @@ impl WeightInfo for () { /// The range of component `s` is `[0, 50]`. fn force_set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `56` + // Measured: `223` // Estimated: `3675` - // Minimum execution time: 9_212_000 picoseconds. - Weight::from_parts(9_752_745, 3675) - // Standard Error: 308 - .saturating_add(Weight::from_parts(665, 0).saturating_mul(n.into())) - // Standard Error: 308 - .saturating_add(Weight::from_parts(1_680, 0).saturating_mul(s.into())) + // Minimum execution time: 12_623_000 picoseconds. + Weight::from_parts(13_744_890, 3675) + // Standard Error: 601 + .saturating_add(Weight::from_parts(1_284, 0).saturating_mul(n.into())) + // Standard Error: 601 + .saturating_add(Weight::from_parts(1_056, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -870,10 +899,10 @@ impl WeightInfo for () { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `386` + // Measured: `548` // Estimated: `3675` - // Minimum execution time: 25_100_000 picoseconds. - Weight::from_parts(25_471_000, 3675) + // Minimum execution time: 29_614_000 picoseconds. + Weight::from_parts(30_708_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -881,10 +910,10 @@ impl WeightInfo for () { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn force_asset_status() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 8_834_000 picoseconds. - Weight::from_parts(9_282_000, 3675) + // Minimum execution time: 13_760_000 picoseconds. + Weight::from_parts(14_420_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -894,10 +923,10 @@ impl WeightInfo for () { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn approve_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `255` + // Measured: `418` // Estimated: `3675` - // Minimum execution time: 29_392_000 picoseconds. - Weight::from_parts(30_210_000, 3675) + // Minimum execution time: 34_039_000 picoseconds. + Weight::from_parts(35_267_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -911,10 +940,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `500` + // Measured: `701` // Estimated: `6208` - // Minimum execution time: 59_493_000 picoseconds. - Weight::from_parts(60_467_000, 6208) + // Minimum execution time: 67_152_000 picoseconds. + Weight::from_parts(68_752_000, 6208) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -924,10 +953,10 @@ impl WeightInfo for () { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `425` + // Measured: `588` // Estimated: `3675` - // Minimum execution time: 30_429_000 picoseconds. - Weight::from_parts(31_332_000, 3675) + // Minimum execution time: 35_452_000 picoseconds. + Weight::from_parts(36_609_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -937,10 +966,10 @@ impl WeightInfo for () { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `425` + // Measured: `588` // Estimated: `3675` - // Minimum execution time: 30_628_000 picoseconds. - Weight::from_parts(31_361_000, 3675) + // Minimum execution time: 35_608_000 picoseconds. + Weight::from_parts(36_487_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -948,10 +977,10 @@ impl WeightInfo for () { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn set_min_balance() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 9_657_000 picoseconds. - Weight::from_parts(9_994_000, 3675) + // Minimum execution time: 15_133_000 picoseconds. + Weight::from_parts(15_629_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -963,10 +992,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn touch() -> Weight { // Proof Size summary in bytes: - // Measured: `269` + // Measured: `486` // Estimated: `3675` - // Minimum execution time: 27_740_000 picoseconds. - Weight::from_parts(28_250_000, 3675) + // Minimum execution time: 35_385_000 picoseconds. + Weight::from_parts(36_282_000, 3675) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -976,10 +1005,10 @@ impl WeightInfo for () { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn touch_other() -> Weight { // Proof Size summary in bytes: - // Measured: `217` + // Measured: `384` // Estimated: `3675` - // Minimum execution time: 26_874_000 picoseconds. - Weight::from_parts(27_348_000, 3675) + // Minimum execution time: 33_501_000 picoseconds. + Weight::from_parts(34_398_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -991,10 +1020,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn refund() -> Weight { // Proof Size summary in bytes: - // Measured: `400` + // Measured: `612` // Estimated: `3675` - // Minimum execution time: 28_474_000 picoseconds. - Weight::from_parts(29_396_000, 3675) + // Minimum execution time: 33_799_000 picoseconds. + Weight::from_parts(34_728_000, 3675) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1004,10 +1033,10 @@ impl WeightInfo for () { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn refund_other() -> Weight { // Proof Size summary in bytes: - // Measured: `381` + // Measured: `543` // Estimated: `3675` - // Minimum execution time: 27_646_000 picoseconds. - Weight::from_parts(28_249_000, 3675) + // Minimum execution time: 31_956_000 picoseconds. + Weight::from_parts(33_067_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1017,10 +1046,10 @@ impl WeightInfo for () { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn block() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `492` // Estimated: `3675` - // Minimum execution time: 14_437_000 picoseconds. - Weight::from_parts(15_127_000, 3675) + // Minimum execution time: 19_191_000 picoseconds. + Weight::from_parts(19_966_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1032,11 +1061,41 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `330` + // Measured: `531` // Estimated: `6208` - // Minimum execution time: 49_370_000 picoseconds. - Weight::from_parts(50_734_000, 6208) + // Minimum execution time: 54_969_000 picoseconds. + Weight::from_parts(57_370_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } + /// Storage: `Assets::Asset` (r:1 w:0) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `418` + // Estimated: `3675` + // Minimum execution time: 8_594_000 picoseconds. + Weight::from_parts(8_977_000, 3675) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + } + /// Storage: `Assets::Account` (r:1 w:0) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `255` + // Estimated: `3599` + // Minimum execution time: 8_469_000 picoseconds. + Weight::from_parts(8_867_000, 3599) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + } + /// Storage: `Assets::Approvals` (r:1 w:0) + /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `350` + // Estimated: `3613` + // Minimum execution time: 11_269_000 picoseconds. + Weight::from_parts(11_630_000, 3613) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + } } From 0a099caa8c8cc2657803ee4c744f5a70b6b6551b Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sun, 18 May 2025 07:50:21 +0200 Subject: [PATCH 18/63] fix try-runtime pallet-assets now depends on pallet-revive that needs try-runtime for it's UncheckedExtrinsics wrapper, thus the feature needs to be propagated now --- cumulus/parachains/common/Cargo.toml | 14 ++++++++++++++ .../runtimes/assets/asset-hub-rococo/Cargo.toml | 1 + .../runtimes/assets/asset-hub-westend/Cargo.toml | 1 + .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 1 + .../bridge-hubs/bridge-hub-westend/Cargo.toml | 1 + .../collectives/collectives-westend/Cargo.toml | 1 + .../runtimes/coretime/coretime-rococo/Cargo.toml | 1 + .../runtimes/coretime/coretime-westend/Cargo.toml | 1 + .../runtimes/glutton/glutton-westend/Cargo.toml | 1 + .../runtimes/people/people-rococo/Cargo.toml | 1 + .../runtimes/people/people-westend/Cargo.toml | 1 + .../parachains/runtimes/testing/penpal/Cargo.toml | 1 + cumulus/polkadot-omni-node/lib/Cargo.toml | 1 + cumulus/polkadot-parachain/Cargo.toml | 1 + .../staking-async/runtimes/parachain/Cargo.toml | 1 + umbrella/Cargo.toml | 1 + 16 files changed, 29 insertions(+) diff --git a/cumulus/parachains/common/Cargo.toml b/cumulus/parachains/common/Cargo.toml index 1ee39bd7a2535..2ce717614970c 100644 --- a/cumulus/parachains/common/Cargo.toml +++ b/cumulus/parachains/common/Cargo.toml @@ -86,3 +86,17 @@ runtime-benchmarks = [ "xcm-executor/runtime-benchmarks", "xcm/runtime-benchmarks", ] + +try-runtime = [ + "pallet-collator-selection/try-runtime", + "parachain-info/try-runtime", + "pallet-xcm/try-runtime", + "pallet-assets/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-message-queue/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-asset-tx-payment/try-runtime", + "sp-runtime/try-runtime" +] diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml index 79afbb00b4615..99bc1d8b3ab60 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml @@ -184,6 +184,7 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] std = [ "assets-common/std", diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml index c3a0683b9d4df..2a1403e982ffc 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml @@ -202,6 +202,7 @@ try-runtime = [ "snowbridge-pallet-system-frontend/try-runtime", "snowbridge-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] std = [ "assets-common/std", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 209f39910e128..c1dc76666d5cd 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -304,6 +304,7 @@ try-runtime = [ "snowbridge-pallet-system/try-runtime", "snowbridge-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] fast-runtime = [] diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml index e513def3164c4..9e245587d6771 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml @@ -320,6 +320,7 @@ try-runtime = [ "snowbridge-pallet-system/try-runtime", "snowbridge-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml index 0b03a8b16a774..4ee5aea22def6 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml @@ -180,6 +180,7 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] std = [ "codec/std", diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml index f6aa5cfb57ead..d2410544e689c 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml @@ -212,6 +212,7 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] fast-runtime = [ "rococo-runtime-constants/fast-runtime", diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml index 1a5a9d67f9e61..aa6e3763a8e93 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml @@ -212,6 +212,7 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] fast-runtime = [ "westend-runtime-constants/fast-runtime", diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml index f39f45f635cdf..097ca1a5ad65e 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml @@ -136,6 +136,7 @@ try-runtime = [ "pallet-timestamp/try-runtime", "parachain-info/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml index fd707e20b32d9..566c8315d48ef 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml @@ -211,6 +211,7 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml index 26fdf7816b2f4..7d8b06765df06 100644 --- a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml @@ -211,6 +211,7 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/testing/penpal/Cargo.toml b/cumulus/parachains/runtimes/testing/penpal/Cargo.toml index 16838b9ed126a..a1b3c7ab2dae3 100644 --- a/cumulus/parachains/runtimes/testing/penpal/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/penpal/Cargo.toml @@ -210,4 +210,5 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] diff --git a/cumulus/polkadot-omni-node/lib/Cargo.toml b/cumulus/polkadot-omni-node/lib/Cargo.toml index fb5d006f0d187..aa28cbf0bebef 100644 --- a/cumulus/polkadot-omni-node/lib/Cargo.toml +++ b/cumulus/polkadot-omni-node/lib/Cargo.toml @@ -130,4 +130,5 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "polkadot-cli/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] diff --git a/cumulus/polkadot-parachain/Cargo.toml b/cumulus/polkadot-parachain/Cargo.toml index ee218b1fa72d6..5ec7b47e261b3 100644 --- a/cumulus/polkadot-parachain/Cargo.toml +++ b/cumulus/polkadot-parachain/Cargo.toml @@ -101,6 +101,7 @@ try-runtime = [ "penpal-runtime/try-runtime", "people-rococo-runtime/try-runtime", "people-westend-runtime/try-runtime", + "parachains-common/try-runtime" ] fast-runtime = [ "bridge-hub-rococo-runtime/fast-runtime", diff --git a/substrate/frame/staking-async/runtimes/parachain/Cargo.toml b/substrate/frame/staking-async/runtimes/parachain/Cargo.toml index 202a1f31a2b44..2bc11131a0ac1 100644 --- a/substrate/frame/staking-async/runtimes/parachain/Cargo.toml +++ b/substrate/frame/staking-async/runtimes/parachain/Cargo.toml @@ -251,6 +251,7 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] std = [ "assets-common/std", diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 3967d80a363f2..6b50e10356007 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -478,6 +478,7 @@ try-runtime = [ "polkadot-service?/try-runtime", "sp-runtime?/try-runtime", "staging-parachain-info?/try-runtime", + "parachains-common?/try-runtime" ] serde = [ "bp-polkadot-core?/serde", From 0fedfc69e5d99311ac7da0219c04947985019b2c Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sun, 18 May 2025 07:52:07 +0200 Subject: [PATCH 19/63] taplo --- cumulus/parachains/common/Cargo.toml | 14 +++++++------- .../runtimes/assets/asset-hub-rococo/Cargo.toml | 2 +- .../runtimes/assets/asset-hub-westend/Cargo.toml | 2 +- .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 2 +- .../bridge-hubs/bridge-hub-westend/Cargo.toml | 2 +- .../collectives/collectives-westend/Cargo.toml | 2 +- .../runtimes/coretime/coretime-rococo/Cargo.toml | 2 +- .../runtimes/coretime/coretime-westend/Cargo.toml | 2 +- .../runtimes/glutton/glutton-westend/Cargo.toml | 2 +- .../runtimes/people/people-rococo/Cargo.toml | 2 +- .../runtimes/people/people-westend/Cargo.toml | 2 +- .../parachains/runtimes/testing/penpal/Cargo.toml | 2 +- .../testing/yet-another-parachain/Cargo.toml | 2 +- cumulus/polkadot-omni-node/lib/Cargo.toml | 2 +- cumulus/polkadot-parachain/Cargo.toml | 2 +- .../staking-async/runtimes/parachain/Cargo.toml | 2 +- umbrella/Cargo.toml | 2 +- 17 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cumulus/parachains/common/Cargo.toml b/cumulus/parachains/common/Cargo.toml index 2ce717614970c..8f75c0de91f35 100644 --- a/cumulus/parachains/common/Cargo.toml +++ b/cumulus/parachains/common/Cargo.toml @@ -88,15 +88,15 @@ runtime-benchmarks = [ ] try-runtime = [ - "pallet-collator-selection/try-runtime", - "parachain-info/try-runtime", - "pallet-xcm/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-asset-tx-payment/try-runtime", "pallet-assets/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", + "pallet-collator-selection/try-runtime", "pallet-message-queue/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "pallet-asset-tx-payment/try-runtime", - "sp-runtime/try-runtime" + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "sp-runtime/try-runtime", ] diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml index 99bc1d8b3ab60..97c4e14ea3184 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml @@ -182,9 +182,9 @@ try-runtime = [ "pallet-xcm-bridge-hub-router/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] std = [ "assets-common/std", diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml index 2a1403e982ffc..482436d2c9cfa 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml @@ -198,11 +198,11 @@ try-runtime = [ "pallet-xcm-bridge-hub-router/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "snowbridge-pallet-system-frontend/try-runtime", "snowbridge-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] std = [ "assets-common/std", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index c1dc76666d5cd..339506642b595 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -297,6 +297,7 @@ try-runtime = [ "pallet-xcm-bridge-hub/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "snowbridge-pallet-ethereum-client/try-runtime", "snowbridge-pallet-inbound-queue/try-runtime", @@ -304,7 +305,6 @@ try-runtime = [ "snowbridge-pallet-system/try-runtime", "snowbridge-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] fast-runtime = [] diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml index 9e245587d6771..be4788005f136 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml @@ -310,6 +310,7 @@ try-runtime = [ "pallet-xcm-bridge-hub/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "snowbridge-pallet-ethereum-client/try-runtime", "snowbridge-pallet-inbound-queue-v2/try-runtime", @@ -320,7 +321,6 @@ try-runtime = [ "snowbridge-pallet-system/try-runtime", "snowbridge-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml index 4ee5aea22def6..23a79deb598c2 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml @@ -178,9 +178,9 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] std = [ "codec/std", diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml index d2410544e689c..796e4cee03284 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml @@ -210,9 +210,9 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] fast-runtime = [ "rococo-runtime-constants/fast-runtime", diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml index aa6e3763a8e93..a2f178b043495 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml @@ -210,9 +210,9 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] fast-runtime = [ "westend-runtime-constants/fast-runtime", diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml index 097ca1a5ad65e..5fa923c889260 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml @@ -135,8 +135,8 @@ try-runtime = [ "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml index 566c8315d48ef..fe97d06f10303 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml @@ -209,9 +209,9 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml index 7d8b06765df06..5a7604b5297c1 100644 --- a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml @@ -209,9 +209,9 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/testing/penpal/Cargo.toml b/cumulus/parachains/runtimes/testing/penpal/Cargo.toml index a1b3c7ab2dae3..0d9014165e80e 100644 --- a/cumulus/parachains/runtimes/testing/penpal/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/penpal/Cargo.toml @@ -208,7 +208,7 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] diff --git a/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml b/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml index d7a6e540fac10..e082c6ca60a59 100644 --- a/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml @@ -47,9 +47,9 @@ sp-runtime = { workspace = true } sp-session = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } +xcm.workspace = true xcm-builder.workspace = true xcm-executor.workspace = true -xcm.workspace = true # Polkadot polkadot-parachain-primitives = { workspace = true } diff --git a/cumulus/polkadot-omni-node/lib/Cargo.toml b/cumulus/polkadot-omni-node/lib/Cargo.toml index aa28cbf0bebef..d0e421318ae5b 100644 --- a/cumulus/polkadot-omni-node/lib/Cargo.toml +++ b/cumulus/polkadot-omni-node/lib/Cargo.toml @@ -128,7 +128,7 @@ try-runtime = [ "frame-support/try-runtime", "frame-try-runtime/try-runtime", "pallet-transaction-payment/try-runtime", + "parachains-common/try-runtime", "polkadot-cli/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] diff --git a/cumulus/polkadot-parachain/Cargo.toml b/cumulus/polkadot-parachain/Cargo.toml index 5ec7b47e261b3..62e6c21b6d343 100644 --- a/cumulus/polkadot-parachain/Cargo.toml +++ b/cumulus/polkadot-parachain/Cargo.toml @@ -98,10 +98,10 @@ try-runtime = [ "coretime-rococo-runtime/try-runtime", "coretime-westend-runtime/try-runtime", "glutton-westend-runtime/try-runtime", + "parachains-common/try-runtime", "penpal-runtime/try-runtime", "people-rococo-runtime/try-runtime", "people-westend-runtime/try-runtime", - "parachains-common/try-runtime" ] fast-runtime = [ "bridge-hub-rococo-runtime/fast-runtime", diff --git a/substrate/frame/staking-async/runtimes/parachain/Cargo.toml b/substrate/frame/staking-async/runtimes/parachain/Cargo.toml index 2bc11131a0ac1..0a15706104789 100644 --- a/substrate/frame/staking-async/runtimes/parachain/Cargo.toml +++ b/substrate/frame/staking-async/runtimes/parachain/Cargo.toml @@ -249,9 +249,9 @@ try-runtime = [ "pallet-xcm-bridge-hub-router/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] std = [ "assets-common/std", diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 6b50e10356007..8898e60c0544b 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -470,6 +470,7 @@ try-runtime = [ "pallet-xcm-bridge-hub-router?/try-runtime", "pallet-xcm-bridge-hub?/try-runtime", "pallet-xcm?/try-runtime", + "parachains-common?/try-runtime", "polkadot-cli?/try-runtime", "polkadot-omni-node-lib?/try-runtime", "polkadot-runtime-common?/try-runtime", @@ -478,7 +479,6 @@ try-runtime = [ "polkadot-service?/try-runtime", "sp-runtime?/try-runtime", "staging-parachain-info?/try-runtime", - "parachains-common?/try-runtime" ] serde = [ "bp-polkadot-core?/serde", From 99ccb3ace28f013f45232243317a9cdb65885a8f Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sun, 18 May 2025 08:41:52 +0200 Subject: [PATCH 20/63] restart bench --- substrate/frame/assets/src/weights.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/substrate/frame/assets/src/weights.rs b/substrate/frame/assets/src/weights.rs index 32de86c2317ec..0d4e6740d962b 100644 --- a/substrate/frame/assets/src/weights.rs +++ b/substrate/frame/assets/src/weights.rs @@ -71,6 +71,9 @@ use core::marker::PhantomData; /// Weight functions needed for `pallet_assets`. pub trait WeightInfo { + fn total_issuance() -> Weight { Weight::zero() } + fn balance() -> Weight { Weight::zero() } + fn allowance() -> Weight { Weight::zero() } fn create() -> Weight; fn force_create() -> Weight; fn start_destroy() -> Weight; @@ -104,9 +107,6 @@ pub trait WeightInfo { fn refund_other() -> Weight; fn block() -> Weight; fn transfer_all() -> Weight; - fn total_issuance() -> Weight; - fn balance() -> Weight; - fn allowance() -> Weight; } /// Weights for `pallet_assets` using the Substrate node and recommended hardware. From ea4e2ffad1a2c8e6aba794343d46ea0ac683dbdb Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 18 May 2025 08:54:38 +0000 Subject: [PATCH 21/63] Update from github-actions[bot] running command 'bench --pallet pallet_assets' --- .../src/weights/pallet_assets_foreign.rs | 189 ++++++---- .../src/weights/pallet_assets_local.rs | 191 +++++----- .../src/weights/pallet_assets_pool.rs | 193 +++++----- .../src/weights/pallet_assets_foreign.rs | 191 ++++++---- .../src/weights/pallet_assets_local.rs | 191 +++++----- .../src/weights/pallet_assets_pool.rs | 193 ++++++---- substrate/frame/assets/src/weights.rs | 342 +++++++++--------- 7 files changed, 841 insertions(+), 649 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_foreign.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_foreign.rs index eaa831b810b8c..8475c3ac34da8 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_foreign.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_foreign.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `ef4134d66388`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -62,8 +62,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `139` // Estimated: `4273` - // Minimum execution time: 30_246_000 picoseconds. - Weight::from_parts(31_156_000, 0) + // Minimum execution time: 29_713_000 picoseconds. + Weight::from_parts(30_405_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -76,8 +76,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `4` // Estimated: `4273` - // Minimum execution time: 11_637_000 picoseconds. - Weight::from_parts(12_068_000, 0) + // Minimum execution time: 11_430_000 picoseconds. + Weight::from_parts(11_825_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -90,8 +90,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `324` // Estimated: `4273` - // Minimum execution time: 17_070_000 picoseconds. - Weight::from_parts(18_146_000, 0) + // Minimum execution time: 16_882_000 picoseconds. + Weight::from_parts(17_360_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -113,11 +113,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `4273 + c * (3207 ±0)` - // Minimum execution time: 16_224_000 picoseconds. - Weight::from_parts(16_754_000, 0) + // Minimum execution time: 15_990_000 picoseconds. + Weight::from_parts(16_161_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 23_871 - .saturating_add(Weight::from_parts(26_177_483, 0).saturating_mul(c.into())) + // Standard Error: 16_995 + .saturating_add(Weight::from_parts(25_624_471, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -135,11 +135,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `413 + a * (86 ±0)` // Estimated: `4273 + a * (3221 ±0)` - // Minimum execution time: 17_258_000 picoseconds. - Weight::from_parts(17_625_000, 0) + // Minimum execution time: 16_532_000 picoseconds. + Weight::from_parts(16_865_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 14_612 - .saturating_add(Weight::from_parts(16_083_771, 0).saturating_mul(a.into())) + // Standard Error: 4_823 + .saturating_add(Weight::from_parts(15_353_976, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -154,8 +154,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 13_734_000 picoseconds. - Weight::from_parts(14_417_000, 0) + // Minimum execution time: 13_451_000 picoseconds. + Weight::from_parts(14_019_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -168,8 +168,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 23_611_000 picoseconds. - Weight::from_parts(24_501_000, 0) + // Minimum execution time: 22_965_000 picoseconds. + Weight::from_parts(23_855_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -186,8 +186,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `4273` - // Minimum execution time: 49_376_000 picoseconds. - Weight::from_parts(50_141_000, 0) + // Minimum execution time: 47_536_000 picoseconds. + Weight::from_parts(49_071_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -206,8 +206,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `7404` - // Minimum execution time: 60_761_000 picoseconds. - Weight::from_parts(62_200_000, 0) + // Minimum execution time: 59_854_000 picoseconds. + Weight::from_parts(61_262_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -224,8 +224,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `7404` - // Minimum execution time: 46_370_000 picoseconds. - Weight::from_parts(47_956_000, 0) + // Minimum execution time: 45_638_000 picoseconds. + Weight::from_parts(46_477_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -244,8 +244,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `7404` - // Minimum execution time: 60_815_000 picoseconds. - Weight::from_parts(62_582_000, 0) + // Minimum execution time: 59_607_000 picoseconds. + Weight::from_parts(61_405_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -258,8 +258,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 16_880_000 picoseconds. - Weight::from_parts(17_827_000, 0) + // Minimum execution time: 16_524_000 picoseconds. + Weight::from_parts(17_268_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -272,8 +272,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 17_171_000 picoseconds. - Weight::from_parts(17_756_000, 0) + // Minimum execution time: 16_618_000 picoseconds. + Weight::from_parts(17_201_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -284,8 +284,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 11_878_000 picoseconds. - Weight::from_parts(12_566_000, 0) + // Minimum execution time: 11_755_000 picoseconds. + Weight::from_parts(12_366_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -296,8 +296,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 12_164_000 picoseconds. - Weight::from_parts(12_518_000, 0) + // Minimum execution time: 11_872_000 picoseconds. + Weight::from_parts(12_490_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -310,8 +310,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 14_110_000 picoseconds. - Weight::from_parts(14_657_000, 0) + // Minimum execution time: 13_752_000 picoseconds. + Weight::from_parts(14_440_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -322,8 +322,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 12_027_000 picoseconds. - Weight::from_parts(12_614_000, 0) + // Minimum execution time: 11_860_000 picoseconds. + Weight::from_parts(12_186_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -338,13 +338,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(_n: u32, _s: u32, ) -> Weight { + fn set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 27_342_000 picoseconds. - Weight::from_parts(29_133_541, 0) + // Minimum execution time: 27_274_000 picoseconds. + Weight::from_parts(28_578_070, 0) .saturating_add(Weight::from_parts(0, 4273)) + // Standard Error: 776 + .saturating_add(Weight::from_parts(1_087, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -356,8 +358,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `406` // Estimated: `4273` - // Minimum execution time: 28_284_000 picoseconds. - Weight::from_parts(29_024_000, 0) + // Minimum execution time: 27_414_000 picoseconds. + Weight::from_parts(28_274_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -376,13 +378,13 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `81` // Estimated: `4273` - // Minimum execution time: 12_413_000 picoseconds. - Weight::from_parts(12_976_191, 0) + // Minimum execution time: 12_087_000 picoseconds. + Weight::from_parts(12_745_826, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 364 - .saturating_add(Weight::from_parts(2_252, 0).saturating_mul(n.into())) - // Standard Error: 364 - .saturating_add(Weight::from_parts(1_100, 0).saturating_mul(s.into())) + // Standard Error: 440 + .saturating_add(Weight::from_parts(1_010, 0).saturating_mul(n.into())) + // Standard Error: 440 + .saturating_add(Weight::from_parts(1_303, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -394,8 +396,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `406` // Estimated: `4273` - // Minimum execution time: 27_314_000 picoseconds. - Weight::from_parts(28_197_000, 0) + // Minimum execution time: 26_528_000 picoseconds. + Weight::from_parts(27_478_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -406,8 +408,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 11_156_000 picoseconds. - Weight::from_parts(11_810_000, 0) + // Minimum execution time: 10_881_000 picoseconds. + Weight::from_parts(11_268_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -420,8 +422,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 31_643_000 picoseconds. - Weight::from_parts(32_896_000, 0) + // Minimum execution time: 31_216_000 picoseconds. + Weight::from_parts(32_411_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -442,8 +444,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `526` // Estimated: `7404` - // Minimum execution time: 82_050_000 picoseconds. - Weight::from_parts(83_534_000, 0) + // Minimum execution time: 79_133_000 picoseconds. + Weight::from_parts(81_252_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -456,8 +458,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `446` // Estimated: `4273` - // Minimum execution time: 34_026_000 picoseconds. - Weight::from_parts(35_141_000, 0) + // Minimum execution time: 33_529_000 picoseconds. + Weight::from_parts(34_768_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -470,8 +472,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `446` // Estimated: `4273` - // Minimum execution time: 34_552_000 picoseconds. - Weight::from_parts(35_270_000, 0) + // Minimum execution time: 33_558_000 picoseconds. + Weight::from_parts(34_197_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -482,8 +484,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 12_814_000 picoseconds. - Weight::from_parts(13_387_000, 0) + // Minimum execution time: 12_533_000 picoseconds. + Weight::from_parts(12_956_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -498,8 +500,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `345` // Estimated: `4273` - // Minimum execution time: 33_402_000 picoseconds. - Weight::from_parts(34_342_000, 0) + // Minimum execution time: 32_643_000 picoseconds. + Weight::from_parts(33_899_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -512,8 +514,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 31_253_000 picoseconds. - Weight::from_parts(32_341_000, 0) + // Minimum execution time: 31_276_000 picoseconds. + Weight::from_parts(32_155_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -532,8 +534,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `477` // Estimated: `4273` - // Minimum execution time: 44_555_000 picoseconds. - Weight::from_parts(45_738_000, 0) + // Minimum execution time: 43_426_000 picoseconds. + Weight::from_parts(45_064_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -550,8 +552,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `407` // Estimated: `4273` - // Minimum execution time: 42_140_000 picoseconds. - Weight::from_parts(43_882_000, 0) + // Minimum execution time: 41_885_000 picoseconds. + Weight::from_parts(43_300_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -564,8 +566,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 16_905_000 picoseconds. - Weight::from_parts(17_780_000, 0) + // Minimum execution time: 16_833_000 picoseconds. + Weight::from_parts(17_265_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -584,10 +586,43 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `7404` - // Minimum execution time: 76_194_000 picoseconds. - Weight::from_parts(77_219_000, 0) + // Minimum execution time: 72_880_000 picoseconds. + Weight::from_parts(74_426_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `ForeignAssets::Asset` (r:1 w:0) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `276` + // Estimated: `4273` + // Minimum execution time: 5_454_000 picoseconds. + Weight::from_parts(5_742_000, 0) + .saturating_add(Weight::from_parts(0, 4273)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `ForeignAssets::Account` (r:1 w:0) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `150` + // Estimated: `4197` + // Minimum execution time: 6_480_000 picoseconds. + Weight::from_parts(6_813_000, 0) + .saturating_add(Weight::from_parts(0, 4197)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `ForeignAssets::Approvals` (r:1 w:0) + /// Proof: `ForeignAssets::Approvals` (`max_values`: None, `max_size`: Some(746), added: 3221, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `245` + // Estimated: `4211` + // Minimum execution time: 8_685_000 picoseconds. + Weight::from_parts(9_177_000, 0) + .saturating_add(Weight::from_parts(0, 4211)) + .saturating_add(T::DbWeight::get().reads(1)) + } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_local.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_local.rs index c720cd55abdf1..802f246c26357 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_local.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_local.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `ef4134d66388`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -60,8 +60,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `145` // Estimated: `3675` - // Minimum execution time: 27_053_000 picoseconds. - Weight::from_parts(28_062_000, 0) + // Minimum execution time: 26_482_000 picoseconds. + Weight::from_parts(27_179_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -74,8 +74,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3675` - // Minimum execution time: 11_612_000 picoseconds. - Weight::from_parts(12_184_000, 0) + // Minimum execution time: 11_224_000 picoseconds. + Weight::from_parts(11_615_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -88,8 +88,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `324` // Estimated: `3675` - // Minimum execution time: 17_158_000 picoseconds. - Weight::from_parts(17_958_000, 0) + // Minimum execution time: 16_018_000 picoseconds. + Weight::from_parts(16_859_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -111,11 +111,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 15_728_000 picoseconds. - Weight::from_parts(16_165_000, 0) + // Minimum execution time: 15_347_000 picoseconds. + Weight::from_parts(15_681_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 13_616 - .saturating_add(Weight::from_parts(25_043_308, 0).saturating_mul(c.into())) + // Standard Error: 26_239 + .saturating_add(Weight::from_parts(25_531_130, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -133,11 +133,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `451 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 16_873_000 picoseconds. - Weight::from_parts(17_432_000, 0) + // Minimum execution time: 16_411_000 picoseconds. + Weight::from_parts(16_761_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 5_507 - .saturating_add(Weight::from_parts(15_610_110, 0).saturating_mul(a.into())) + // Standard Error: 12_049 + .saturating_add(Weight::from_parts(15_632_794, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -152,8 +152,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_205_000 picoseconds. - Weight::from_parts(14_082_000, 0) + // Minimum execution time: 12_979_000 picoseconds. + Weight::from_parts(13_512_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -166,8 +166,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 22_893_000 picoseconds. - Weight::from_parts(23_480_000, 0) + // Minimum execution time: 22_629_000 picoseconds. + Weight::from_parts(23_429_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -184,8 +184,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `392` // Estimated: `3675` - // Minimum execution time: 46_351_000 picoseconds. - Weight::from_parts(47_418_000, 0) + // Minimum execution time: 45_871_000 picoseconds. + Weight::from_parts(46_802_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -204,8 +204,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `392` // Estimated: `6208` - // Minimum execution time: 57_281_000 picoseconds. - Weight::from_parts(59_830_000, 0) + // Minimum execution time: 56_609_000 picoseconds. + Weight::from_parts(58_229_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -222,8 +222,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `392` // Estimated: `6208` - // Minimum execution time: 43_893_000 picoseconds. - Weight::from_parts(45_219_000, 0) + // Minimum execution time: 42_947_000 picoseconds. + Weight::from_parts(43_748_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -242,8 +242,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `392` // Estimated: `6208` - // Minimum execution time: 57_213_000 picoseconds. - Weight::from_parts(59_097_000, 0) + // Minimum execution time: 56_609_000 picoseconds. + Weight::from_parts(58_589_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -256,8 +256,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_760_000 picoseconds. - Weight::from_parts(17_477_000, 0) + // Minimum execution time: 16_199_000 picoseconds. + Weight::from_parts(16_994_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -270,8 +270,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_632_000 picoseconds. - Weight::from_parts(17_241_000, 0) + // Minimum execution time: 16_107_000 picoseconds. + Weight::from_parts(17_102_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -282,8 +282,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_003_000 picoseconds. - Weight::from_parts(12_787_000, 0) + // Minimum execution time: 11_414_000 picoseconds. + Weight::from_parts(12_053_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -294,8 +294,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_226_000 picoseconds. - Weight::from_parts(12_689_000, 0) + // Minimum execution time: 11_710_000 picoseconds. + Weight::from_parts(12_122_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -308,8 +308,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_923_000 picoseconds. - Weight::from_parts(14_426_000, 0) + // Minimum execution time: 13_447_000 picoseconds. + Weight::from_parts(13_861_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -320,8 +320,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 11_938_000 picoseconds. - Weight::from_parts(12_519_000, 0) + // Minimum execution time: 11_569_000 picoseconds. + Weight::from_parts(12_049_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -336,17 +336,13 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(_n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 27_465_000 picoseconds. - Weight::from_parts(28_954_819, 0) + // Minimum execution time: 26_983_000 picoseconds. + Weight::from_parts(28_703_529, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 805 - .saturating_add(Weight::from_parts(317, 0).saturating_mul(n.into())) - // Standard Error: 805 - .saturating_add(Weight::from_parts(13, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -358,8 +354,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `444` // Estimated: `3675` - // Minimum execution time: 28_215_000 picoseconds. - Weight::from_parts(28_930_000, 0) + // Minimum execution time: 27_171_000 picoseconds. + Weight::from_parts(28_200_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -378,13 +374,13 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `119` // Estimated: `3675` - // Minimum execution time: 12_542_000 picoseconds. - Weight::from_parts(13_088_363, 0) + // Minimum execution time: 12_271_000 picoseconds. + Weight::from_parts(12_658_518, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 523 - .saturating_add(Weight::from_parts(3_687, 0).saturating_mul(n.into())) - // Standard Error: 523 - .saturating_add(Weight::from_parts(3_344, 0).saturating_mul(s.into())) + // Standard Error: 438 + .saturating_add(Weight::from_parts(3_068, 0).saturating_mul(n.into())) + // Standard Error: 438 + .saturating_add(Weight::from_parts(4_338, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -396,8 +392,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `444` // Estimated: `3675` - // Minimum execution time: 27_879_000 picoseconds. - Weight::from_parts(28_681_000, 0) + // Minimum execution time: 26_574_000 picoseconds. + Weight::from_parts(27_538_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -408,8 +404,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 11_563_000 picoseconds. - Weight::from_parts(12_057_000, 0) + // Minimum execution time: 11_164_000 picoseconds. + Weight::from_parts(11_592_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -422,8 +418,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 31_809_000 picoseconds. - Weight::from_parts(32_724_000, 0) + // Minimum execution time: 30_723_000 picoseconds. + Weight::from_parts(32_100_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -444,8 +440,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `562` // Estimated: `6208` - // Minimum execution time: 81_974_000 picoseconds. - Weight::from_parts(83_937_000, 0) + // Minimum execution time: 79_016_000 picoseconds. + Weight::from_parts(80_828_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -458,8 +454,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `484` // Estimated: `3675` - // Minimum execution time: 33_484_000 picoseconds. - Weight::from_parts(34_485_000, 0) + // Minimum execution time: 33_078_000 picoseconds. + Weight::from_parts(34_121_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -472,8 +468,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `484` // Estimated: `3675` - // Minimum execution time: 34_093_000 picoseconds. - Weight::from_parts(34_486_000, 0) + // Minimum execution time: 32_674_000 picoseconds. + Weight::from_parts(33_256_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -484,8 +480,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_637_000 picoseconds. - Weight::from_parts(13_075_000, 0) + // Minimum execution time: 12_075_000 picoseconds. + Weight::from_parts(12_615_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -500,8 +496,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `383` // Estimated: `3675` - // Minimum execution time: 32_983_000 picoseconds. - Weight::from_parts(33_735_000, 0) + // Minimum execution time: 31_734_000 picoseconds. + Weight::from_parts(32_991_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -514,8 +510,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 30_946_000 picoseconds. - Weight::from_parts(32_157_000, 0) + // Minimum execution time: 30_207_000 picoseconds. + Weight::from_parts(31_152_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -534,8 +530,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `513` // Estimated: `3675` - // Minimum execution time: 46_816_000 picoseconds. - Weight::from_parts(47_776_000, 0) + // Minimum execution time: 43_677_000 picoseconds. + Weight::from_parts(45_244_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -552,8 +548,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `3675` - // Minimum execution time: 44_723_000 picoseconds. - Weight::from_parts(46_367_000, 0) + // Minimum execution time: 41_707_000 picoseconds. + Weight::from_parts(43_356_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -566,8 +562,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_930_000 picoseconds. - Weight::from_parts(17_769_000, 0) + // Minimum execution time: 16_127_000 picoseconds. + Weight::from_parts(16_872_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -586,10 +582,43 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `392` // Estimated: `6208` - // Minimum execution time: 70_437_000 picoseconds. - Weight::from_parts(72_895_000, 0) + // Minimum execution time: 69_690_000 picoseconds. + Weight::from_parts(72_135_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `Assets::Asset` (r:1 w:0) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `314` + // Estimated: `3675` + // Minimum execution time: 5_735_000 picoseconds. + Weight::from_parts(5_937_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `Assets::Account` (r:1 w:0) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `188` + // Estimated: `3599` + // Minimum execution time: 6_622_000 picoseconds. + Weight::from_parts(6_995_000, 0) + .saturating_add(Weight::from_parts(0, 3599)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `Assets::Approvals` (r:1 w:0) + /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `283` + // Estimated: `3613` + // Minimum execution time: 9_066_000 picoseconds. + Weight::from_parts(9_393_000, 0) + .saturating_add(Weight::from_parts(0, 3613)) + .saturating_add(T::DbWeight::get().reads(1)) + } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_pool.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_pool.rs index e93fc5ecfa62b..f315798a40f2e 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_pool.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_assets_pool.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `ef4134d66388`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -58,8 +58,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3675` - // Minimum execution time: 11_547_000 picoseconds. - Weight::from_parts(12_096_000, 0) + // Minimum execution time: 11_176_000 picoseconds. + Weight::from_parts(11_708_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -72,8 +72,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3675` - // Minimum execution time: 11_194_000 picoseconds. - Weight::from_parts(11_656_000, 0) + // Minimum execution time: 11_139_000 picoseconds. + Weight::from_parts(11_425_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -86,8 +86,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `465` // Estimated: `3675` - // Minimum execution time: 17_914_000 picoseconds. - Weight::from_parts(18_501_000, 0) + // Minimum execution time: 16_818_000 picoseconds. + Weight::from_parts(17_574_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -109,11 +109,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 15_789_000 picoseconds. - Weight::from_parts(16_084_000, 0) + // Minimum execution time: 15_399_000 picoseconds. + Weight::from_parts(15_922_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 22_937 - .saturating_add(Weight::from_parts(26_582_378, 0).saturating_mul(c.into())) + // Standard Error: 20_120 + .saturating_add(Weight::from_parts(24_799_452, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -131,11 +131,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `451 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 16_668_000 picoseconds. - Weight::from_parts(16_927_000, 0) + // Minimum execution time: 16_199_000 picoseconds. + Weight::from_parts(16_470_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 8_819 - .saturating_add(Weight::from_parts(15_849_663, 0).saturating_mul(a.into())) + // Standard Error: 4_361 + .saturating_add(Weight::from_parts(15_336_713, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -150,8 +150,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_553_000 picoseconds. - Weight::from_parts(13_986_000, 0) + // Minimum execution time: 12_959_000 picoseconds. + Weight::from_parts(13_382_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -164,8 +164,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 22_877_000 picoseconds. - Weight::from_parts(23_846_000, 0) + // Minimum execution time: 22_225_000 picoseconds. + Weight::from_parts(23_117_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -182,8 +182,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3675` - // Minimum execution time: 50_770_000 picoseconds. - Weight::from_parts(52_504_000, 0) + // Minimum execution time: 47_719_000 picoseconds. + Weight::from_parts(49_655_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -202,8 +202,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `430` // Estimated: `6208` - // Minimum execution time: 62_125_000 picoseconds. - Weight::from_parts(63_860_000, 0) + // Minimum execution time: 59_349_000 picoseconds. + Weight::from_parts(60_869_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -220,8 +220,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `430` // Estimated: `6208` - // Minimum execution time: 49_077_000 picoseconds. - Weight::from_parts(52_343_000, 0) + // Minimum execution time: 45_905_000 picoseconds. + Weight::from_parts(47_017_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -240,8 +240,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `430` // Estimated: `6208` - // Minimum execution time: 62_560_000 picoseconds. - Weight::from_parts(64_211_000, 0) + // Minimum execution time: 59_187_000 picoseconds. + Weight::from_parts(60_814_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -254,8 +254,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_692_000 picoseconds. - Weight::from_parts(17_363_000, 0) + // Minimum execution time: 16_306_000 picoseconds. + Weight::from_parts(16_893_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -268,8 +268,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_750_000 picoseconds. - Weight::from_parts(17_518_000, 0) + // Minimum execution time: 16_090_000 picoseconds. + Weight::from_parts(16_832_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -280,8 +280,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_021_000 picoseconds. - Weight::from_parts(12_644_000, 0) + // Minimum execution time: 11_493_000 picoseconds. + Weight::from_parts(12_065_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -292,8 +292,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_154_000 picoseconds. - Weight::from_parts(12_681_000, 0) + // Minimum execution time: 11_673_000 picoseconds. + Weight::from_parts(12_059_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -306,8 +306,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_667_000 picoseconds. - Weight::from_parts(14_265_000, 0) + // Minimum execution time: 13_512_000 picoseconds. + Weight::from_parts(13_977_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -318,8 +318,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 11_923_000 picoseconds. - Weight::from_parts(12_566_000, 0) + // Minimum execution time: 11_669_000 picoseconds. + Weight::from_parts(11_898_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -334,17 +334,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 14_401_000 picoseconds. - Weight::from_parts(15_355_048, 0) + // Minimum execution time: 13_910_000 picoseconds. + Weight::from_parts(14_908_493, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 887 - .saturating_add(Weight::from_parts(2_676, 0).saturating_mul(n.into())) - // Standard Error: 887 - .saturating_add(Weight::from_parts(660, 0).saturating_mul(s.into())) + // Standard Error: 931 + .saturating_add(Weight::from_parts(409, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -356,8 +354,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `444` // Estimated: `3675` - // Minimum execution time: 15_459_000 picoseconds. - Weight::from_parts(16_182_000, 0) + // Minimum execution time: 15_016_000 picoseconds. + Weight::from_parts(15_808_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -372,17 +370,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(n: u32, s: u32, ) -> Weight { + fn force_set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `119` // Estimated: `3675` - // Minimum execution time: 12_615_000 picoseconds. - Weight::from_parts(13_114_212, 0) + // Minimum execution time: 12_162_000 picoseconds. + Weight::from_parts(12_966_962, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 783 - .saturating_add(Weight::from_parts(2_984, 0).saturating_mul(n.into())) - // Standard Error: 783 - .saturating_add(Weight::from_parts(4_072, 0).saturating_mul(s.into())) + // Standard Error: 397 + .saturating_add(Weight::from_parts(289, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -394,8 +390,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `444` // Estimated: `3675` - // Minimum execution time: 15_606_000 picoseconds. - Weight::from_parts(16_153_000, 0) + // Minimum execution time: 14_885_000 picoseconds. + Weight::from_parts(15_220_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -406,8 +402,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 11_720_000 picoseconds. - Weight::from_parts(12_055_000, 0) + // Minimum execution time: 11_115_000 picoseconds. + Weight::from_parts(11_652_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -420,8 +416,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 31_960_000 picoseconds. - Weight::from_parts(32_873_000, 0) + // Minimum execution time: 30_537_000 picoseconds. + Weight::from_parts(31_792_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -442,8 +438,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `600` // Estimated: `6208` - // Minimum execution time: 81_618_000 picoseconds. - Weight::from_parts(84_984_000, 0) + // Minimum execution time: 79_178_000 picoseconds. + Weight::from_parts(83_473_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -456,8 +452,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `484` // Estimated: `3675` - // Minimum execution time: 33_414_000 picoseconds. - Weight::from_parts(34_574_000, 0) + // Minimum execution time: 33_185_000 picoseconds. + Weight::from_parts(33_940_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -470,8 +466,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `484` // Estimated: `3675` - // Minimum execution time: 33_877_000 picoseconds. - Weight::from_parts(35_058_000, 0) + // Minimum execution time: 32_692_000 picoseconds. + Weight::from_parts(33_486_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -482,8 +478,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_567_000 picoseconds. - Weight::from_parts(13_155_000, 0) + // Minimum execution time: 12_301_000 picoseconds. + Weight::from_parts(12_727_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -496,8 +492,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 17_467_000 picoseconds. - Weight::from_parts(18_559_000, 0) + // Minimum execution time: 17_321_000 picoseconds. + Weight::from_parts(17_943_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -510,8 +506,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 17_675_000 picoseconds. - Weight::from_parts(18_543_000, 0) + // Minimum execution time: 17_306_000 picoseconds. + Weight::from_parts(17_911_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -528,8 +524,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `448` // Estimated: `3675` - // Minimum execution time: 28_339_000 picoseconds. - Weight::from_parts(29_166_000, 0) + // Minimum execution time: 27_522_000 picoseconds. + Weight::from_parts(28_593_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -546,8 +542,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `481` // Estimated: `3675` - // Minimum execution time: 31_422_000 picoseconds. - Weight::from_parts(32_992_000, 0) + // Minimum execution time: 29_602_000 picoseconds. + Weight::from_parts(30_397_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -560,8 +556,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_518_000 picoseconds. - Weight::from_parts(17_489_000, 0) + // Minimum execution time: 16_076_000 picoseconds. + Weight::from_parts(16_614_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -580,10 +576,43 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `430` // Estimated: `6208` - // Minimum execution time: 75_603_000 picoseconds. - Weight::from_parts(77_765_000, 0) + // Minimum execution time: 71_751_000 picoseconds. + Weight::from_parts(74_070_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `PoolAssets::Asset` (r:1 w:0) + /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `314` + // Estimated: `3675` + // Minimum execution time: 5_676_000 picoseconds. + Weight::from_parts(5_922_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `PoolAssets::Account` (r:1 w:0) + /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `188` + // Estimated: `3599` + // Minimum execution time: 6_525_000 picoseconds. + Weight::from_parts(6_982_000, 0) + .saturating_add(Weight::from_parts(0, 3599)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `PoolAssets::Approvals` (r:1 w:0) + /// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `283` + // Estimated: `3613` + // Minimum execution time: 9_208_000 picoseconds. + Weight::from_parts(9_558_000, 0) + .saturating_add(Weight::from_parts(0, 3613)) + .saturating_add(T::DbWeight::get().reads(1)) + } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_foreign.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_foreign.rs index 0e92a7679b1aa..a507422977260 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_foreign.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_foreign.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `73b9817d6032`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -62,8 +62,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `4273` - // Minimum execution time: 31_134_000 picoseconds. - Weight::from_parts(31_972_000, 0) + // Minimum execution time: 30_845_000 picoseconds. + Weight::from_parts(31_476_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -76,8 +76,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `4` // Estimated: `4273` - // Minimum execution time: 11_555_000 picoseconds. - Weight::from_parts(11_941_000, 0) + // Minimum execution time: 11_187_000 picoseconds. + Weight::from_parts(11_701_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -90,8 +90,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `324` // Estimated: `4273` - // Minimum execution time: 17_275_000 picoseconds. - Weight::from_parts(17_940_000, 0) + // Minimum execution time: 17_073_000 picoseconds. + Weight::from_parts(17_558_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -113,11 +113,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `4273 + c * (3207 ±0)` - // Minimum execution time: 16_257_000 picoseconds. - Weight::from_parts(16_544_000, 0) + // Minimum execution time: 15_958_000 picoseconds. + Weight::from_parts(16_230_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 44_223 - .saturating_add(Weight::from_parts(28_326_460, 0).saturating_mul(c.into())) + // Standard Error: 41_431 + .saturating_add(Weight::from_parts(28_378_939, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -135,11 +135,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `413 + a * (86 ±0)` // Estimated: `4273 + a * (3221 ±0)` - // Minimum execution time: 17_118_000 picoseconds. - Weight::from_parts(17_373_000, 0) + // Minimum execution time: 16_607_000 picoseconds. + Weight::from_parts(16_830_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 7_697 - .saturating_add(Weight::from_parts(16_674_246, 0).saturating_mul(a.into())) + // Standard Error: 8_249 + .saturating_add(Weight::from_parts(16_576_446, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -154,8 +154,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 13_784_000 picoseconds. - Weight::from_parts(14_363_000, 0) + // Minimum execution time: 13_239_000 picoseconds. + Weight::from_parts(13_810_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -168,8 +168,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 23_549_000 picoseconds. - Weight::from_parts(24_293_000, 0) + // Minimum execution time: 23_376_000 picoseconds. + Weight::from_parts(24_247_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -186,8 +186,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `4273` - // Minimum execution time: 48_465_000 picoseconds. - Weight::from_parts(49_862_000, 0) + // Minimum execution time: 48_245_000 picoseconds. + Weight::from_parts(49_442_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -206,8 +206,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `7404` - // Minimum execution time: 59_905_000 picoseconds. - Weight::from_parts(61_874_000, 0) + // Minimum execution time: 60_321_000 picoseconds. + Weight::from_parts(61_984_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -224,8 +224,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `7404` - // Minimum execution time: 45_868_000 picoseconds. - Weight::from_parts(47_239_000, 0) + // Minimum execution time: 45_691_000 picoseconds. + Weight::from_parts(46_756_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -244,8 +244,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `7404` - // Minimum execution time: 60_020_000 picoseconds. - Weight::from_parts(62_424_000, 0) + // Minimum execution time: 61_133_000 picoseconds. + Weight::from_parts(62_538_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -258,8 +258,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 17_255_000 picoseconds. - Weight::from_parts(18_437_000, 0) + // Minimum execution time: 16_683_000 picoseconds. + Weight::from_parts(17_324_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -272,8 +272,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 17_301_000 picoseconds. - Weight::from_parts(18_140_000, 0) + // Minimum execution time: 16_213_000 picoseconds. + Weight::from_parts(17_375_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -284,8 +284,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 12_175_000 picoseconds. - Weight::from_parts(13_035_000, 0) + // Minimum execution time: 11_888_000 picoseconds. + Weight::from_parts(12_347_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -296,8 +296,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 12_004_000 picoseconds. - Weight::from_parts(12_769_000, 0) + // Minimum execution time: 11_827_000 picoseconds. + Weight::from_parts(12_358_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -310,8 +310,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 14_008_000 picoseconds. - Weight::from_parts(14_531_000, 0) + // Minimum execution time: 13_607_000 picoseconds. + Weight::from_parts(14_130_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -322,8 +322,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 12_017_000 picoseconds. - Weight::from_parts(12_627_000, 0) + // Minimum execution time: 11_744_000 picoseconds. + Weight::from_parts(12_012_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -338,13 +338,17 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(_n: u32, _s: u32, ) -> Weight { + fn set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 27_801_000 picoseconds. - Weight::from_parts(29_861_465, 0) + // Minimum execution time: 27_696_000 picoseconds. + Weight::from_parts(28_935_866, 0) .saturating_add(Weight::from_parts(0, 4273)) + // Standard Error: 1_512 + .saturating_add(Weight::from_parts(1_552, 0).saturating_mul(n.into())) + // Standard Error: 1_512 + .saturating_add(Weight::from_parts(5_379, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -356,8 +360,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `406` // Estimated: `4273` - // Minimum execution time: 28_106_000 picoseconds. - Weight::from_parts(28_835_000, 0) + // Minimum execution time: 27_908_000 picoseconds. + Weight::from_parts(28_871_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -372,15 +376,17 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(n: u32, _s: u32, ) -> Weight { + fn force_set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `81` // Estimated: `4273` - // Minimum execution time: 12_233_000 picoseconds. - Weight::from_parts(13_163_730, 0) + // Minimum execution time: 12_021_000 picoseconds. + Weight::from_parts(12_717_451, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 469 - .saturating_add(Weight::from_parts(444, 0).saturating_mul(n.into())) + // Standard Error: 357 + .saturating_add(Weight::from_parts(1_478, 0).saturating_mul(n.into())) + // Standard Error: 357 + .saturating_add(Weight::from_parts(1_237, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -392,8 +398,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `406` // Estimated: `4273` - // Minimum execution time: 27_247_000 picoseconds. - Weight::from_parts(28_219_000, 0) + // Minimum execution time: 27_025_000 picoseconds. + Weight::from_parts(28_182_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -404,8 +410,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 11_057_000 picoseconds. - Weight::from_parts(11_811_000, 0) + // Minimum execution time: 10_973_000 picoseconds. + Weight::from_parts(11_522_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -418,8 +424,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 31_763_000 picoseconds. - Weight::from_parts(33_283_000, 0) + // Minimum execution time: 31_873_000 picoseconds. + Weight::from_parts(32_908_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -440,8 +446,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `526` // Estimated: `7404` - // Minimum execution time: 80_737_000 picoseconds. - Weight::from_parts(82_408_000, 0) + // Minimum execution time: 83_300_000 picoseconds. + Weight::from_parts(85_969_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -454,8 +460,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `446` // Estimated: `4273` - // Minimum execution time: 34_241_000 picoseconds. - Weight::from_parts(34_846_000, 0) + // Minimum execution time: 33_826_000 picoseconds. + Weight::from_parts(34_740_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -468,8 +474,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `446` // Estimated: `4273` - // Minimum execution time: 33_719_000 picoseconds. - Weight::from_parts(34_770_000, 0) + // Minimum execution time: 33_361_000 picoseconds. + Weight::from_parts(34_518_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -480,8 +486,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 12_500_000 picoseconds. - Weight::from_parts(13_175_000, 0) + // Minimum execution time: 12_297_000 picoseconds. + Weight::from_parts(12_693_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -496,8 +502,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `345` // Estimated: `4273` - // Minimum execution time: 33_356_000 picoseconds. - Weight::from_parts(34_214_000, 0) + // Minimum execution time: 33_281_000 picoseconds. + Weight::from_parts(34_312_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -510,8 +516,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 31_594_000 picoseconds. - Weight::from_parts(32_665_000, 0) + // Minimum execution time: 31_275_000 picoseconds. + Weight::from_parts(32_435_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -530,8 +536,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `477` // Estimated: `4273` - // Minimum execution time: 44_372_000 picoseconds. - Weight::from_parts(45_810_000, 0) + // Minimum execution time: 43_974_000 picoseconds. + Weight::from_parts(44_843_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -548,8 +554,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `407` // Estimated: `4273` - // Minimum execution time: 42_378_000 picoseconds. - Weight::from_parts(43_628_000, 0) + // Minimum execution time: 42_604_000 picoseconds. + Weight::from_parts(43_385_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -562,8 +568,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 16_831_000 picoseconds. - Weight::from_parts(17_455_000, 0) + // Minimum execution time: 16_456_000 picoseconds. + Weight::from_parts(17_099_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -582,10 +588,43 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `356` // Estimated: `7404` - // Minimum execution time: 74_949_000 picoseconds. - Weight::from_parts(75_726_000, 0) + // Minimum execution time: 74_954_000 picoseconds. + Weight::from_parts(76_564_000, 0) .saturating_add(Weight::from_parts(0, 7404)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `ForeignAssets::Asset` (r:1 w:0) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `276` + // Estimated: `4273` + // Minimum execution time: 5_493_000 picoseconds. + Weight::from_parts(5_775_000, 0) + .saturating_add(Weight::from_parts(0, 4273)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `ForeignAssets::Account` (r:1 w:0) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `150` + // Estimated: `4197` + // Minimum execution time: 6_455_000 picoseconds. + Weight::from_parts(6_750_000, 0) + .saturating_add(Weight::from_parts(0, 4197)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `ForeignAssets::Approvals` (r:1 w:0) + /// Proof: `ForeignAssets::Approvals` (`max_values`: None, `max_size`: Some(746), added: 3221, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `245` + // Estimated: `4211` + // Minimum execution time: 8_796_000 picoseconds. + Weight::from_parts(9_236_000, 0) + .saturating_add(Weight::from_parts(0, 4211)) + .saturating_add(T::DbWeight::get().reads(1)) + } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_local.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_local.rs index 9d696a41e9f69..c5c81a051c9cb 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_local.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_local.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `73b9817d6032`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -60,8 +60,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `179` // Estimated: `3675` - // Minimum execution time: 27_182_000 picoseconds. - Weight::from_parts(27_926_000, 0) + // Minimum execution time: 27_345_000 picoseconds. + Weight::from_parts(28_052_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -74,8 +74,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `76` // Estimated: `3675` - // Minimum execution time: 11_684_000 picoseconds. - Weight::from_parts(12_206_000, 0) + // Minimum execution time: 11_316_000 picoseconds. + Weight::from_parts(11_738_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -88,8 +88,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `358` // Estimated: `3675` - // Minimum execution time: 17_345_000 picoseconds. - Weight::from_parts(17_902_000, 0) + // Minimum execution time: 16_120_000 picoseconds. + Weight::from_parts(16_917_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -111,11 +111,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 16_027_000 picoseconds. - Weight::from_parts(16_400_000, 0) + // Minimum execution time: 15_510_000 picoseconds. + Weight::from_parts(16_008_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 64_931 - .saturating_add(Weight::from_parts(28_334_934, 0).saturating_mul(c.into())) + // Standard Error: 44_611 + .saturating_add(Weight::from_parts(27_430_638, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -133,11 +133,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `485 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 16_903_000 picoseconds. - Weight::from_parts(17_488_000, 0) + // Minimum execution time: 16_281_000 picoseconds. + Weight::from_parts(16_941_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 9_291 - .saturating_add(Weight::from_parts(16_474_115, 0).saturating_mul(a.into())) + // Standard Error: 12_278 + .saturating_add(Weight::from_parts(16_641_458, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -152,8 +152,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 13_563_000 picoseconds. - Weight::from_parts(14_003_000, 0) + // Minimum execution time: 13_250_000 picoseconds. + Weight::from_parts(13_714_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -166,8 +166,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 23_249_000 picoseconds. - Weight::from_parts(23_947_000, 0) + // Minimum execution time: 23_015_000 picoseconds. + Weight::from_parts(23_984_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -184,8 +184,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `3675` - // Minimum execution time: 46_572_000 picoseconds. - Weight::from_parts(47_817_000, 0) + // Minimum execution time: 46_060_000 picoseconds. + Weight::from_parts(47_290_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -204,8 +204,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `6208` - // Minimum execution time: 57_647_000 picoseconds. - Weight::from_parts(58_786_000, 0) + // Minimum execution time: 58_298_000 picoseconds. + Weight::from_parts(59_602_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -222,8 +222,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `6208` - // Minimum execution time: 43_959_000 picoseconds. - Weight::from_parts(45_092_000, 0) + // Minimum execution time: 44_043_000 picoseconds. + Weight::from_parts(45_167_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -242,8 +242,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `6208` - // Minimum execution time: 58_167_000 picoseconds. - Weight::from_parts(60_723_000, 0) + // Minimum execution time: 58_292_000 picoseconds. + Weight::from_parts(59_096_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -256,8 +256,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `422` // Estimated: `3675` - // Minimum execution time: 16_885_000 picoseconds. - Weight::from_parts(17_421_000, 0) + // Minimum execution time: 16_308_000 picoseconds. + Weight::from_parts(16_850_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -270,8 +270,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `422` // Estimated: `3675` - // Minimum execution time: 16_730_000 picoseconds. - Weight::from_parts(17_283_000, 0) + // Minimum execution time: 16_168_000 picoseconds. + Weight::from_parts(17_087_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -282,8 +282,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `348` // Estimated: `3675` - // Minimum execution time: 12_077_000 picoseconds. - Weight::from_parts(12_863_000, 0) + // Minimum execution time: 11_649_000 picoseconds. + Weight::from_parts(12_205_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -294,8 +294,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `348` // Estimated: `3675` - // Minimum execution time: 11_861_000 picoseconds. - Weight::from_parts(12_458_000, 0) + // Minimum execution time: 11_581_000 picoseconds. + Weight::from_parts(12_144_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -308,8 +308,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 13_964_000 picoseconds. - Weight::from_parts(14_476_000, 0) + // Minimum execution time: 13_659_000 picoseconds. + Weight::from_parts(14_063_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -320,8 +320,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_067_000 picoseconds. - Weight::from_parts(12_518_000, 0) + // Minimum execution time: 11_773_000 picoseconds. + Weight::from_parts(12_318_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -336,17 +336,13 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(_n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 27_534_000 picoseconds. - Weight::from_parts(28_553_946, 0) + // Minimum execution time: 27_666_000 picoseconds. + Weight::from_parts(29_418_576, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 1_422 - .saturating_add(Weight::from_parts(6_980, 0).saturating_mul(n.into())) - // Standard Error: 1_422 - .saturating_add(Weight::from_parts(9_116, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -358,8 +354,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3675` - // Minimum execution time: 28_363_000 picoseconds. - Weight::from_parts(28_871_000, 0) + // Minimum execution time: 27_696_000 picoseconds. + Weight::from_parts(28_581_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -378,13 +374,13 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `153` // Estimated: `3675` - // Minimum execution time: 12_567_000 picoseconds. - Weight::from_parts(13_159_122, 0) + // Minimum execution time: 12_322_000 picoseconds. + Weight::from_parts(12_988_255, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 547 - .saturating_add(Weight::from_parts(1_543, 0).saturating_mul(n.into())) - // Standard Error: 547 - .saturating_add(Weight::from_parts(4_320, 0).saturating_mul(s.into())) + // Standard Error: 1_012 + .saturating_add(Weight::from_parts(1_936, 0).saturating_mul(n.into())) + // Standard Error: 1_012 + .saturating_add(Weight::from_parts(2_627, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -396,8 +392,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3675` - // Minimum execution time: 27_693_000 picoseconds. - Weight::from_parts(28_430_000, 0) + // Minimum execution time: 27_303_000 picoseconds. + Weight::from_parts(28_116_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -408,8 +404,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 11_613_000 picoseconds. - Weight::from_parts(11_887_000, 0) + // Minimum execution time: 11_193_000 picoseconds. + Weight::from_parts(11_800_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -422,8 +418,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `348` // Estimated: `3675` - // Minimum execution time: 32_033_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 31_558_000 picoseconds. + Weight::from_parts(32_461_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -444,8 +440,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `596` // Estimated: `6208` - // Minimum execution time: 78_369_000 picoseconds. - Weight::from_parts(80_805_000, 0) + // Minimum execution time: 78_672_000 picoseconds. + Weight::from_parts(80_184_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -458,8 +454,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3675` - // Minimum execution time: 33_623_000 picoseconds. - Weight::from_parts(34_584_000, 0) + // Minimum execution time: 33_378_000 picoseconds. + Weight::from_parts(34_054_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -472,8 +468,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3675` - // Minimum execution time: 33_417_000 picoseconds. - Weight::from_parts(34_959_000, 0) + // Minimum execution time: 32_932_000 picoseconds. + Weight::from_parts(33_994_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -484,8 +480,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_404_000 picoseconds. - Weight::from_parts(13_145_000, 0) + // Minimum execution time: 12_319_000 picoseconds. + Weight::from_parts(12_843_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -500,8 +496,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `417` // Estimated: `3675` - // Minimum execution time: 32_707_000 picoseconds. - Weight::from_parts(33_774_000, 0) + // Minimum execution time: 33_017_000 picoseconds. + Weight::from_parts(33_654_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -514,8 +510,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 31_407_000 picoseconds. - Weight::from_parts(31_998_000, 0) + // Minimum execution time: 31_352_000 picoseconds. + Weight::from_parts(32_145_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -534,8 +530,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `547` // Estimated: `3675` - // Minimum execution time: 43_501_000 picoseconds. - Weight::from_parts(44_981_000, 0) + // Minimum execution time: 42_926_000 picoseconds. + Weight::from_parts(44_322_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -552,8 +548,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `477` // Estimated: `3675` - // Minimum execution time: 41_981_000 picoseconds. - Weight::from_parts(45_208_000, 0) + // Minimum execution time: 41_094_000 picoseconds. + Weight::from_parts(41_955_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -566,8 +562,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `422` // Estimated: `3675` - // Minimum execution time: 17_149_000 picoseconds. - Weight::from_parts(17_863_000, 0) + // Minimum execution time: 16_295_000 picoseconds. + Weight::from_parts(16_900_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -586,10 +582,43 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `6208` - // Minimum execution time: 71_146_000 picoseconds. - Weight::from_parts(72_446_000, 0) + // Minimum execution time: 71_441_000 picoseconds. + Weight::from_parts(72_377_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `Assets::Asset` (r:1 w:0) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `348` + // Estimated: `3675` + // Minimum execution time: 5_821_000 picoseconds. + Weight::from_parts(6_163_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `Assets::Account` (r:1 w:0) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `222` + // Estimated: `3599` + // Minimum execution time: 6_840_000 picoseconds. + Weight::from_parts(7_154_000, 0) + .saturating_add(Weight::from_parts(0, 3599)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `Assets::Approvals` (r:1 w:0) + /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `317` + // Estimated: `3613` + // Minimum execution time: 9_336_000 picoseconds. + Weight::from_parts(9_839_000, 0) + .saturating_add(Weight::from_parts(0, 3613)) + .saturating_add(T::DbWeight::get().reads(1)) + } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_pool.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_pool.rs index 83b4486eb49d1..7c0d113417191 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_pool.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_assets_pool.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `73b9817d6032`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -58,8 +58,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3675` - // Minimum execution time: 11_449_000 picoseconds. - Weight::from_parts(12_119_000, 0) + // Minimum execution time: 11_569_000 picoseconds. + Weight::from_parts(11_889_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -72,8 +72,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3675` - // Minimum execution time: 11_268_000 picoseconds. - Weight::from_parts(11_798_000, 0) + // Minimum execution time: 11_004_000 picoseconds. + Weight::from_parts(11_358_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -86,8 +86,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3675` - // Minimum execution time: 18_002_000 picoseconds. - Weight::from_parts(18_512_000, 0) + // Minimum execution time: 16_849_000 picoseconds. + Weight::from_parts(17_412_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -109,11 +109,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 16_317_000 picoseconds. - Weight::from_parts(16_638_000, 0) + // Minimum execution time: 15_443_000 picoseconds. + Weight::from_parts(15_900_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 23_047 - .saturating_add(Weight::from_parts(25_902_940, 0).saturating_mul(c.into())) + // Standard Error: 42_899 + .saturating_add(Weight::from_parts(26_918_528, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -131,11 +131,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `451 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 17_037_000 picoseconds. - Weight::from_parts(17_184_000, 0) + // Minimum execution time: 15_852_000 picoseconds. + Weight::from_parts(16_324_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 4_968 - .saturating_add(Weight::from_parts(6_168_952, 0).saturating_mul(a.into())) + // Standard Error: 7_240 + .saturating_add(Weight::from_parts(6_025_177, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -150,8 +150,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_547_000 picoseconds. - Weight::from_parts(13_889_000, 0) + // Minimum execution time: 13_087_000 picoseconds. + Weight::from_parts(13_717_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -164,8 +164,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 22_935_000 picoseconds. - Weight::from_parts(23_509_000, 0) + // Minimum execution time: 22_607_000 picoseconds. + Weight::from_parts(23_394_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -182,8 +182,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `464` // Estimated: `3675` - // Minimum execution time: 47_315_000 picoseconds. - Weight::from_parts(48_784_000, 0) + // Minimum execution time: 47_055_000 picoseconds. + Weight::from_parts(48_623_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -202,8 +202,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `464` // Estimated: `6208` - // Minimum execution time: 58_538_000 picoseconds. - Weight::from_parts(60_004_000, 0) + // Minimum execution time: 59_079_000 picoseconds. + Weight::from_parts(61_112_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -220,8 +220,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `464` // Estimated: `6208` - // Minimum execution time: 45_058_000 picoseconds. - Weight::from_parts(46_367_000, 0) + // Minimum execution time: 45_022_000 picoseconds. + Weight::from_parts(45_867_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -240,8 +240,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `464` // Estimated: `6208` - // Minimum execution time: 59_358_000 picoseconds. - Weight::from_parts(60_726_000, 0) + // Minimum execution time: 58_841_000 picoseconds. + Weight::from_parts(60_287_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) @@ -254,8 +254,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_840_000 picoseconds. - Weight::from_parts(17_552_000, 0) + // Minimum execution time: 16_231_000 picoseconds. + Weight::from_parts(16_669_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -268,8 +268,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_495_000 picoseconds. - Weight::from_parts(17_055_000, 0) + // Minimum execution time: 16_306_000 picoseconds. + Weight::from_parts(16_822_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -280,8 +280,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_024_000 picoseconds. - Weight::from_parts(12_473_000, 0) + // Minimum execution time: 11_570_000 picoseconds. + Weight::from_parts(12_166_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -292,8 +292,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 11_771_000 picoseconds. - Weight::from_parts(12_583_000, 0) + // Minimum execution time: 11_566_000 picoseconds. + Weight::from_parts(11_968_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -306,8 +306,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_850_000 picoseconds. - Weight::from_parts(14_227_000, 0) + // Minimum execution time: 13_350_000 picoseconds. + Weight::from_parts(13_761_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -318,8 +318,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_098_000 picoseconds. - Weight::from_parts(12_490_000, 0) + // Minimum execution time: 11_563_000 picoseconds. + Weight::from_parts(12_002_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -334,15 +334,17 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, _s: u32, ) -> Weight { + fn set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 14_376_000 picoseconds. - Weight::from_parts(15_338_765, 0) + // Minimum execution time: 13_982_000 picoseconds. + Weight::from_parts(14_938_292, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 664 - .saturating_add(Weight::from_parts(1_523, 0).saturating_mul(n.into())) + // Standard Error: 793 + .saturating_add(Weight::from_parts(347, 0).saturating_mul(n.into())) + // Standard Error: 793 + .saturating_add(Weight::from_parts(303, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -354,8 +356,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `444` // Estimated: `3675` - // Minimum execution time: 15_875_000 picoseconds. - Weight::from_parts(16_435_000, 0) + // Minimum execution time: 15_150_000 picoseconds. + Weight::from_parts(15_734_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -374,13 +376,13 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `119` // Estimated: `3675` - // Minimum execution time: 12_590_000 picoseconds. - Weight::from_parts(13_306_615, 0) + // Minimum execution time: 12_294_000 picoseconds. + Weight::from_parts(12_892_214, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 462 - .saturating_add(Weight::from_parts(320, 0).saturating_mul(n.into())) - // Standard Error: 462 - .saturating_add(Weight::from_parts(161, 0).saturating_mul(s.into())) + // Standard Error: 363 + .saturating_add(Weight::from_parts(1_449, 0).saturating_mul(n.into())) + // Standard Error: 363 + .saturating_add(Weight::from_parts(949, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -392,8 +394,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `444` // Estimated: `3675` - // Minimum execution time: 15_355_000 picoseconds. - Weight::from_parts(16_118_000, 0) + // Minimum execution time: 14_637_000 picoseconds. + Weight::from_parts(15_381_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -404,8 +406,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 11_617_000 picoseconds. - Weight::from_parts(12_076_000, 0) + // Minimum execution time: 11_326_000 picoseconds. + Weight::from_parts(11_597_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -418,8 +420,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 18_711_000 picoseconds. - Weight::from_parts(19_255_000, 0) + // Minimum execution time: 17_983_000 picoseconds. + Weight::from_parts(18_855_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -440,8 +442,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `634` // Estimated: `6208` - // Minimum execution time: 71_616_000 picoseconds. - Weight::from_parts(73_811_000, 0) + // Minimum execution time: 69_752_000 picoseconds. + Weight::from_parts(71_877_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -454,8 +456,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `484` // Estimated: `3675` - // Minimum execution time: 21_285_000 picoseconds. - Weight::from_parts(22_104_000, 0) + // Minimum execution time: 20_653_000 picoseconds. + Weight::from_parts(21_557_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -468,8 +470,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `484` // Estimated: `3675` - // Minimum execution time: 21_495_000 picoseconds. - Weight::from_parts(22_126_000, 0) + // Minimum execution time: 20_561_000 picoseconds. + Weight::from_parts(21_348_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -480,8 +482,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_559_000 picoseconds. - Weight::from_parts(13_047_000, 0) + // Minimum execution time: 12_113_000 picoseconds. + Weight::from_parts(12_644_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -494,8 +496,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 17_455_000 picoseconds. - Weight::from_parts(18_164_000, 0) + // Minimum execution time: 17_074_000 picoseconds. + Weight::from_parts(17_729_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -508,8 +510,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 18_076_000 picoseconds. - Weight::from_parts(18_738_000, 0) + // Minimum execution time: 17_410_000 picoseconds. + Weight::from_parts(17_968_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -526,8 +528,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `482` // Estimated: `3675` - // Minimum execution time: 28_319_000 picoseconds. - Weight::from_parts(29_121_000, 0) + // Minimum execution time: 28_130_000 picoseconds. + Weight::from_parts(28_908_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -544,8 +546,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `515` // Estimated: `3675` - // Minimum execution time: 31_937_000 picoseconds. - Weight::from_parts(32_906_000, 0) + // Minimum execution time: 29_928_000 picoseconds. + Weight::from_parts(30_744_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -558,8 +560,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_575_000 picoseconds. - Weight::from_parts(17_361_000, 0) + // Minimum execution time: 15_931_000 picoseconds. + Weight::from_parts(16_907_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -578,10 +580,43 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `464` // Estimated: `6208` - // Minimum execution time: 72_414_000 picoseconds. - Weight::from_parts(74_124_000, 0) + // Minimum execution time: 71_790_000 picoseconds. + Weight::from_parts(73_457_000, 0) .saturating_add(Weight::from_parts(0, 6208)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) } + /// Storage: `PoolAssets::Asset` (r:1 w:0) + /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `314` + // Estimated: `3675` + // Minimum execution time: 5_673_000 picoseconds. + Weight::from_parts(6_032_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `PoolAssets::Account` (r:1 w:0) + /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `188` + // Estimated: `3599` + // Minimum execution time: 6_746_000 picoseconds. + Weight::from_parts(7_190_000, 0) + .saturating_add(Weight::from_parts(0, 3599)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `PoolAssets::Approvals` (r:1 w:0) + /// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `283` + // Estimated: `3613` + // Minimum execution time: 9_311_000 picoseconds. + Weight::from_parts(9_602_000, 0) + .saturating_add(Weight::from_parts(0, 3613)) + .saturating_add(T::DbWeight::get().reads(1)) + } } diff --git a/substrate/frame/assets/src/weights.rs b/substrate/frame/assets/src/weights.rs index 0d4e6740d962b..5ceab268e127f 100644 --- a/substrate/frame/assets/src/weights.rs +++ b/substrate/frame/assets/src/weights.rs @@ -35,9 +35,9 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-05-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `e148eff7bcc7`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: @@ -71,9 +71,6 @@ use core::marker::PhantomData; /// Weight functions needed for `pallet_assets`. pub trait WeightInfo { - fn total_issuance() -> Weight { Weight::zero() } - fn balance() -> Weight { Weight::zero() } - fn allowance() -> Weight { Weight::zero() } fn create() -> Weight; fn force_create() -> Weight; fn start_destroy() -> Weight; @@ -107,6 +104,9 @@ pub trait WeightInfo { fn refund_other() -> Weight; fn block() -> Weight; fn transfer_all() -> Weight; + fn total_issuance() -> Weight; + fn balance() -> Weight; + fn allowance() -> Weight; } /// Weights for `pallet_assets` using the Substrate node and recommended hardware. @@ -122,8 +122,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3675` - // Minimum execution time: 30_405_000 picoseconds. - Weight::from_parts(31_723_000, 3675) + // Minimum execution time: 30_517_000 picoseconds. + Weight::from_parts(31_518_000, 3675) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -135,8 +135,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `186` // Estimated: `3675` - // Minimum execution time: 12_751_000 picoseconds. - Weight::from_parts(13_355_000, 3675) + // Minimum execution time: 12_469_000 picoseconds. + Weight::from_parts(13_002_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -146,8 +146,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 14_582_000 picoseconds. - Weight::from_parts(15_406_000, 3675) + // Minimum execution time: 14_767_000 picoseconds. + Weight::from_parts(15_425_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -162,10 +162,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `104 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 18_704_000 picoseconds. - Weight::from_parts(19_061_000, 3675) - // Standard Error: 12_155 - .saturating_add(Weight::from_parts(14_363_983, 0).saturating_mul(c.into())) + // Minimum execution time: 18_900_000 picoseconds. + Weight::from_parts(19_222_000, 3675) + // Standard Error: 25_984 + .saturating_add(Weight::from_parts(15_436_025, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -181,10 +181,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `555 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 19_375_000 picoseconds. - Weight::from_parts(19_900_000, 3675) - // Standard Error: 6_093 - .saturating_add(Weight::from_parts(15_502_206, 0).saturating_mul(a.into())) + // Minimum execution time: 19_685_000 picoseconds. + Weight::from_parts(20_138_000, 3675) + // Standard Error: 10_401 + .saturating_add(Weight::from_parts(15_779_729, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -199,8 +199,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 15_657_000 picoseconds. - Weight::from_parts(16_283_000, 3675) + // Minimum execution time: 15_652_000 picoseconds. + Weight::from_parts(16_159_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -212,8 +212,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 25_547_000 picoseconds. - Weight::from_parts(26_465_000, 3675) + // Minimum execution time: 25_446_000 picoseconds. + Weight::from_parts(26_623_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -225,8 +225,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `492` // Estimated: `3675` - // Minimum execution time: 33_549_000 picoseconds. - Weight::from_parts(35_274_000, 3675) + // Minimum execution time: 33_608_000 picoseconds. + Weight::from_parts(34_662_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -240,8 +240,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `531` // Estimated: `6208` - // Minimum execution time: 47_470_000 picoseconds. - Weight::from_parts(48_792_000, 6208) + // Minimum execution time: 46_426_000 picoseconds. + Weight::from_parts(47_772_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -255,8 +255,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `531` // Estimated: `6208` - // Minimum execution time: 42_132_000 picoseconds. - Weight::from_parts(43_155_000, 6208) + // Minimum execution time: 42_162_000 picoseconds. + Weight::from_parts(42_964_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -270,8 +270,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `531` // Estimated: `6208` - // Minimum execution time: 46_320_000 picoseconds. - Weight::from_parts(48_163_000, 6208) + // Minimum execution time: 46_399_000 picoseconds. + Weight::from_parts(47_580_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -283,8 +283,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `492` // Estimated: `3675` - // Minimum execution time: 19_030_000 picoseconds. - Weight::from_parts(20_042_000, 3675) + // Minimum execution time: 19_369_000 picoseconds. + Weight::from_parts(19_799_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -296,8 +296,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `492` // Estimated: `3675` - // Minimum execution time: 19_166_000 picoseconds. - Weight::from_parts(19_969_000, 3675) + // Minimum execution time: 19_145_000 picoseconds. + Weight::from_parts(19_873_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -307,8 +307,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 14_521_000 picoseconds. - Weight::from_parts(15_429_000, 3675) + // Minimum execution time: 14_728_000 picoseconds. + Weight::from_parts(15_405_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -318,8 +318,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 14_593_000 picoseconds. - Weight::from_parts(15_350_000, 3675) + // Minimum execution time: 14_730_000 picoseconds. + Weight::from_parts(15_284_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -331,8 +331,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 15_970_000 picoseconds. - Weight::from_parts(16_777_000, 3675) + // Minimum execution time: 16_247_000 picoseconds. + Weight::from_parts(16_890_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -342,8 +342,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 14_235_000 picoseconds. - Weight::from_parts(14_668_000, 3675) + // Minimum execution time: 14_206_000 picoseconds. + Weight::from_parts(14_856_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -353,16 +353,14 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 29_909_000 picoseconds. - Weight::from_parts(31_576_538, 3675) - // Standard Error: 1_361 - .saturating_add(Weight::from_parts(5_096, 0).saturating_mul(n.into())) - // Standard Error: 1_361 - .saturating_add(Weight::from_parts(1_553, 0).saturating_mul(s.into())) + // Minimum execution time: 30_217_000 picoseconds. + Weight::from_parts(31_869_256, 3675) + // Standard Error: 1_165 + .saturating_add(Weight::from_parts(826, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -374,8 +372,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `548` // Estimated: `3675` - // Minimum execution time: 29_975_000 picoseconds. - Weight::from_parts(31_243_000, 3675) + // Minimum execution time: 29_914_000 picoseconds. + Weight::from_parts(30_680_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -389,12 +387,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `223` // Estimated: `3675` - // Minimum execution time: 12_623_000 picoseconds. - Weight::from_parts(13_744_890, 3675) - // Standard Error: 601 - .saturating_add(Weight::from_parts(1_284, 0).saturating_mul(n.into())) - // Standard Error: 601 - .saturating_add(Weight::from_parts(1_056, 0).saturating_mul(s.into())) + // Minimum execution time: 13_045_000 picoseconds. + Weight::from_parts(13_680_991, 3675) + // Standard Error: 528 + .saturating_add(Weight::from_parts(3_162, 0).saturating_mul(n.into())) + // Standard Error: 528 + .saturating_add(Weight::from_parts(2_931, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -406,8 +404,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `548` // Estimated: `3675` - // Minimum execution time: 29_614_000 picoseconds. - Weight::from_parts(30_708_000, 3675) + // Minimum execution time: 29_440_000 picoseconds. + Weight::from_parts(30_302_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -417,8 +415,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 13_760_000 picoseconds. - Weight::from_parts(14_420_000, 3675) + // Minimum execution time: 14_175_000 picoseconds. + Weight::from_parts(14_802_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -430,8 +428,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 34_039_000 picoseconds. - Weight::from_parts(35_267_000, 3675) + // Minimum execution time: 34_027_000 picoseconds. + Weight::from_parts(34_976_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -447,8 +445,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `701` // Estimated: `6208` - // Minimum execution time: 67_152_000 picoseconds. - Weight::from_parts(68_752_000, 6208) + // Minimum execution time: 66_073_000 picoseconds. + Weight::from_parts(69_478_000, 6208) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -461,7 +459,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `588` // Estimated: `3675` // Minimum execution time: 35_452_000 picoseconds. - Weight::from_parts(36_609_000, 3675) + Weight::from_parts(36_883_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -473,8 +471,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `588` // Estimated: `3675` - // Minimum execution time: 35_608_000 picoseconds. - Weight::from_parts(36_487_000, 3675) + // Minimum execution time: 35_154_000 picoseconds. + Weight::from_parts(36_578_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -484,8 +482,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 15_133_000 picoseconds. - Weight::from_parts(15_629_000, 3675) + // Minimum execution time: 14_904_000 picoseconds. + Weight::from_parts(15_505_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -499,8 +497,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `486` // Estimated: `3675` - // Minimum execution time: 35_385_000 picoseconds. - Weight::from_parts(36_282_000, 3675) + // Minimum execution time: 35_434_000 picoseconds. + Weight::from_parts(36_636_000, 3675) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -512,8 +510,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 33_501_000 picoseconds. - Weight::from_parts(34_398_000, 3675) + // Minimum execution time: 33_361_000 picoseconds. + Weight::from_parts(34_522_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -527,8 +525,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `612` // Estimated: `3675` - // Minimum execution time: 33_799_000 picoseconds. - Weight::from_parts(34_728_000, 3675) + // Minimum execution time: 33_977_000 picoseconds. + Weight::from_parts(34_979_000, 3675) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -540,8 +538,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `543` // Estimated: `3675` - // Minimum execution time: 31_956_000 picoseconds. - Weight::from_parts(33_067_000, 3675) + // Minimum execution time: 31_928_000 picoseconds. + Weight::from_parts(33_214_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -553,8 +551,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `492` // Estimated: `3675` - // Minimum execution time: 19_191_000 picoseconds. - Weight::from_parts(19_966_000, 3675) + // Minimum execution time: 19_186_000 picoseconds. + Weight::from_parts(20_104_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -568,8 +566,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `531` // Estimated: `6208` - // Minimum execution time: 54_969_000 picoseconds. - Weight::from_parts(57_370_000, 6208) + // Minimum execution time: 55_413_000 picoseconds. + Weight::from_parts(56_798_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -579,8 +577,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 8_594_000 picoseconds. - Weight::from_parts(8_977_000, 3675) + // Minimum execution time: 8_792_000 picoseconds. + Weight::from_parts(9_095_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Assets::Account` (r:1 w:0) @@ -589,8 +587,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `255` // Estimated: `3599` - // Minimum execution time: 8_469_000 picoseconds. - Weight::from_parts(8_867_000, 3599) + // Minimum execution time: 8_924_000 picoseconds. + Weight::from_parts(9_407_000, 3599) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Assets::Approvals` (r:1 w:0) @@ -599,8 +597,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3613` - // Minimum execution time: 11_269_000 picoseconds. - Weight::from_parts(11_630_000, 3613) + // Minimum execution time: 11_348_000 picoseconds. + Weight::from_parts(11_882_000, 3613) .saturating_add(T::DbWeight::get().reads(1_u64)) } } @@ -617,8 +615,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3675` - // Minimum execution time: 30_405_000 picoseconds. - Weight::from_parts(31_723_000, 3675) + // Minimum execution time: 30_517_000 picoseconds. + Weight::from_parts(31_518_000, 3675) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -630,8 +628,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `186` // Estimated: `3675` - // Minimum execution time: 12_751_000 picoseconds. - Weight::from_parts(13_355_000, 3675) + // Minimum execution time: 12_469_000 picoseconds. + Weight::from_parts(13_002_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -641,8 +639,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 14_582_000 picoseconds. - Weight::from_parts(15_406_000, 3675) + // Minimum execution time: 14_767_000 picoseconds. + Weight::from_parts(15_425_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -657,10 +655,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `104 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 18_704_000 picoseconds. - Weight::from_parts(19_061_000, 3675) - // Standard Error: 12_155 - .saturating_add(Weight::from_parts(14_363_983, 0).saturating_mul(c.into())) + // Minimum execution time: 18_900_000 picoseconds. + Weight::from_parts(19_222_000, 3675) + // Standard Error: 25_984 + .saturating_add(Weight::from_parts(15_436_025, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -676,10 +674,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `555 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 19_375_000 picoseconds. - Weight::from_parts(19_900_000, 3675) - // Standard Error: 6_093 - .saturating_add(Weight::from_parts(15_502_206, 0).saturating_mul(a.into())) + // Minimum execution time: 19_685_000 picoseconds. + Weight::from_parts(20_138_000, 3675) + // Standard Error: 10_401 + .saturating_add(Weight::from_parts(15_779_729, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -694,8 +692,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 15_657_000 picoseconds. - Weight::from_parts(16_283_000, 3675) + // Minimum execution time: 15_652_000 picoseconds. + Weight::from_parts(16_159_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -707,8 +705,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 25_547_000 picoseconds. - Weight::from_parts(26_465_000, 3675) + // Minimum execution time: 25_446_000 picoseconds. + Weight::from_parts(26_623_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -720,8 +718,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `492` // Estimated: `3675` - // Minimum execution time: 33_549_000 picoseconds. - Weight::from_parts(35_274_000, 3675) + // Minimum execution time: 33_608_000 picoseconds. + Weight::from_parts(34_662_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -735,8 +733,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `531` // Estimated: `6208` - // Minimum execution time: 47_470_000 picoseconds. - Weight::from_parts(48_792_000, 6208) + // Minimum execution time: 46_426_000 picoseconds. + Weight::from_parts(47_772_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -750,8 +748,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `531` // Estimated: `6208` - // Minimum execution time: 42_132_000 picoseconds. - Weight::from_parts(43_155_000, 6208) + // Minimum execution time: 42_162_000 picoseconds. + Weight::from_parts(42_964_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -765,8 +763,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `531` // Estimated: `6208` - // Minimum execution time: 46_320_000 picoseconds. - Weight::from_parts(48_163_000, 6208) + // Minimum execution time: 46_399_000 picoseconds. + Weight::from_parts(47_580_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -778,8 +776,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `492` // Estimated: `3675` - // Minimum execution time: 19_030_000 picoseconds. - Weight::from_parts(20_042_000, 3675) + // Minimum execution time: 19_369_000 picoseconds. + Weight::from_parts(19_799_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -791,8 +789,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `492` // Estimated: `3675` - // Minimum execution time: 19_166_000 picoseconds. - Weight::from_parts(19_969_000, 3675) + // Minimum execution time: 19_145_000 picoseconds. + Weight::from_parts(19_873_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -802,8 +800,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 14_521_000 picoseconds. - Weight::from_parts(15_429_000, 3675) + // Minimum execution time: 14_728_000 picoseconds. + Weight::from_parts(15_405_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -813,8 +811,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 14_593_000 picoseconds. - Weight::from_parts(15_350_000, 3675) + // Minimum execution time: 14_730_000 picoseconds. + Weight::from_parts(15_284_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -826,8 +824,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 15_970_000 picoseconds. - Weight::from_parts(16_777_000, 3675) + // Minimum execution time: 16_247_000 picoseconds. + Weight::from_parts(16_890_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -837,8 +835,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 14_235_000 picoseconds. - Weight::from_parts(14_668_000, 3675) + // Minimum execution time: 14_206_000 picoseconds. + Weight::from_parts(14_856_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -848,16 +846,14 @@ impl WeightInfo for () { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 29_909_000 picoseconds. - Weight::from_parts(31_576_538, 3675) - // Standard Error: 1_361 - .saturating_add(Weight::from_parts(5_096, 0).saturating_mul(n.into())) - // Standard Error: 1_361 - .saturating_add(Weight::from_parts(1_553, 0).saturating_mul(s.into())) + // Minimum execution time: 30_217_000 picoseconds. + Weight::from_parts(31_869_256, 3675) + // Standard Error: 1_165 + .saturating_add(Weight::from_parts(826, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -869,8 +865,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `548` // Estimated: `3675` - // Minimum execution time: 29_975_000 picoseconds. - Weight::from_parts(31_243_000, 3675) + // Minimum execution time: 29_914_000 picoseconds. + Weight::from_parts(30_680_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -884,12 +880,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `223` // Estimated: `3675` - // Minimum execution time: 12_623_000 picoseconds. - Weight::from_parts(13_744_890, 3675) - // Standard Error: 601 - .saturating_add(Weight::from_parts(1_284, 0).saturating_mul(n.into())) - // Standard Error: 601 - .saturating_add(Weight::from_parts(1_056, 0).saturating_mul(s.into())) + // Minimum execution time: 13_045_000 picoseconds. + Weight::from_parts(13_680_991, 3675) + // Standard Error: 528 + .saturating_add(Weight::from_parts(3_162, 0).saturating_mul(n.into())) + // Standard Error: 528 + .saturating_add(Weight::from_parts(2_931, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -901,8 +897,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `548` // Estimated: `3675` - // Minimum execution time: 29_614_000 picoseconds. - Weight::from_parts(30_708_000, 3675) + // Minimum execution time: 29_440_000 picoseconds. + Weight::from_parts(30_302_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -912,8 +908,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 13_760_000 picoseconds. - Weight::from_parts(14_420_000, 3675) + // Minimum execution time: 14_175_000 picoseconds. + Weight::from_parts(14_802_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -925,8 +921,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 34_039_000 picoseconds. - Weight::from_parts(35_267_000, 3675) + // Minimum execution time: 34_027_000 picoseconds. + Weight::from_parts(34_976_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -942,8 +938,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `701` // Estimated: `6208` - // Minimum execution time: 67_152_000 picoseconds. - Weight::from_parts(68_752_000, 6208) + // Minimum execution time: 66_073_000 picoseconds. + Weight::from_parts(69_478_000, 6208) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -956,7 +952,7 @@ impl WeightInfo for () { // Measured: `588` // Estimated: `3675` // Minimum execution time: 35_452_000 picoseconds. - Weight::from_parts(36_609_000, 3675) + Weight::from_parts(36_883_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -968,8 +964,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `588` // Estimated: `3675` - // Minimum execution time: 35_608_000 picoseconds. - Weight::from_parts(36_487_000, 3675) + // Minimum execution time: 35_154_000 picoseconds. + Weight::from_parts(36_578_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -979,8 +975,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 15_133_000 picoseconds. - Weight::from_parts(15_629_000, 3675) + // Minimum execution time: 14_904_000 picoseconds. + Weight::from_parts(15_505_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -994,8 +990,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `486` // Estimated: `3675` - // Minimum execution time: 35_385_000 picoseconds. - Weight::from_parts(36_282_000, 3675) + // Minimum execution time: 35_434_000 picoseconds. + Weight::from_parts(36_636_000, 3675) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1007,8 +1003,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3675` - // Minimum execution time: 33_501_000 picoseconds. - Weight::from_parts(34_398_000, 3675) + // Minimum execution time: 33_361_000 picoseconds. + Weight::from_parts(34_522_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1022,8 +1018,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `612` // Estimated: `3675` - // Minimum execution time: 33_799_000 picoseconds. - Weight::from_parts(34_728_000, 3675) + // Minimum execution time: 33_977_000 picoseconds. + Weight::from_parts(34_979_000, 3675) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1035,8 +1031,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `543` // Estimated: `3675` - // Minimum execution time: 31_956_000 picoseconds. - Weight::from_parts(33_067_000, 3675) + // Minimum execution time: 31_928_000 picoseconds. + Weight::from_parts(33_214_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1048,8 +1044,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `492` // Estimated: `3675` - // Minimum execution time: 19_191_000 picoseconds. - Weight::from_parts(19_966_000, 3675) + // Minimum execution time: 19_186_000 picoseconds. + Weight::from_parts(20_104_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1063,8 +1059,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `531` // Estimated: `6208` - // Minimum execution time: 54_969_000 picoseconds. - Weight::from_parts(57_370_000, 6208) + // Minimum execution time: 55_413_000 picoseconds. + Weight::from_parts(56_798_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1074,8 +1070,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `418` // Estimated: `3675` - // Minimum execution time: 8_594_000 picoseconds. - Weight::from_parts(8_977_000, 3675) + // Minimum execution time: 8_792_000 picoseconds. + Weight::from_parts(9_095_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Assets::Account` (r:1 w:0) @@ -1084,8 +1080,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `255` // Estimated: `3599` - // Minimum execution time: 8_469_000 picoseconds. - Weight::from_parts(8_867_000, 3599) + // Minimum execution time: 8_924_000 picoseconds. + Weight::from_parts(9_407_000, 3599) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Assets::Approvals` (r:1 w:0) @@ -1094,8 +1090,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3613` - // Minimum execution time: 11_269_000 picoseconds. - Weight::from_parts(11_630_000, 3613) + // Minimum execution time: 11_348_000 picoseconds. + Weight::from_parts(11_882_000, 3613) .saturating_add(RocksDbWeight::get().reads(1_u64)) } } From 904020a1085e063281d022f060851a2c20ff05f5 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 18 May 2025 09:05:31 +0000 Subject: [PATCH 22/63] Update from github-actions[bot] running command 'fmt' --- .../runtimes/testing/yet-another-parachain/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml b/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml index e082c6ca60a59..d7a6e540fac10 100644 --- a/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml @@ -47,9 +47,9 @@ sp-runtime = { workspace = true } sp-session = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } -xcm.workspace = true xcm-builder.workspace = true xcm-executor.workspace = true +xcm.workspace = true # Polkadot polkadot-parachain-primitives = { workspace = true } From ad0905d41958d2ab61a8017488b96d50b4117a30 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sun, 18 May 2025 11:48:11 +0200 Subject: [PATCH 23/63] copy missing benchmarks /cmd bench does not do the weights from stacking-async so copying over the one from asset-hub-rococo --- .../src/weights/pallet_assets_foreign.rs | 330 ++++++++++------ .../src/weights/pallet_assets_local.rs | 372 +++++++++++------- .../src/weights/pallet_assets_pool.rs | 328 +++++++++------ 3 files changed, 627 insertions(+), 403 deletions(-) diff --git a/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_foreign.rs b/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_foreign.rs index 483794c8cc6ea..8475c3ac34da8 100644 --- a/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_foreign.rs +++ b/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_foreign.rs @@ -1,5 +1,3 @@ -// This file is part of Substrate. - // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 @@ -17,28 +15,29 @@ //! Autogenerated weights for `pallet_assets` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-next-westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=asset-hub-next-westend-dev -// --wasm-execution=compiled -// --pallet=pallet_assets -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-rococo-runtime/asset_hub_rococo_runtime.wasm +// --pallet=pallet_assets +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./parachains/runtimes/assets/asset-hub-next-westend/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,48 +54,58 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::NextAssetId` (r:1 w:0) + /// Proof: `ForeignAssets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(602), added: 1097, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn create() -> Weight { // Proof Size summary in bytes: - // Measured: `107` + // Measured: `139` // Estimated: `4273` - // Minimum execution time: 29_123_000 picoseconds. - Weight::from_parts(30_025_000, 0) + // Minimum execution time: 29_713_000 picoseconds. + Weight::from_parts(30_405_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::NextAssetId` (r:1 w:0) + /// Proof: `ForeignAssets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(602), added: 1097, mode: `MaxEncodedLen`) fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `4` // Estimated: `4273` - // Minimum execution time: 11_857_000 picoseconds. - Weight::from_parts(12_256_000, 0) + // Minimum execution time: 11_430_000 picoseconds. + Weight::from_parts(11_825_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1 w:0) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) fn start_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `276` + // Measured: `324` // Estimated: `4273` - // Minimum execution time: 14_513_000 picoseconds. - Weight::from_parts(15_110_000, 0) + // Minimum execution time: 16_882_000 picoseconds. + Weight::from_parts(17_360_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Account` (r:1001 w:1000) /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1000 w:1000) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1000 w:1000) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1000 w:1000) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) /// The range of component `c` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. @@ -104,15 +113,15 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `4273 + c * (3207 ±0)` - // Minimum execution time: 17_168_000 picoseconds. - Weight::from_parts(17_732_000, 0) + // Minimum execution time: 15_990_000 picoseconds. + Weight::from_parts(16_161_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 8_406 - .saturating_add(Weight::from_parts(15_274_700, 0).saturating_mul(c.into())) + // Standard Error: 16_995 + .saturating_add(Weight::from_parts(25_624_471, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(c.into()))) .saturating_add(Weight::from_parts(0, 3207).saturating_mul(c.into())) } /// Storage: `ForeignAssets::Asset` (r:1 w:1) @@ -126,11 +135,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `413 + a * (86 ±0)` // Estimated: `4273 + a * (3221 ±0)` - // Minimum execution time: 18_111_000 picoseconds. - Weight::from_parts(18_573_000, 0) + // Minimum execution time: 16_532_000 picoseconds. + Weight::from_parts(16_865_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 3_988 - .saturating_add(Weight::from_parts(15_270_030, 0).saturating_mul(a.into())) + // Standard Error: 4_823 + .saturating_add(Weight::from_parts(15_353_976, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -145,8 +154,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 14_768_000 picoseconds. - Weight::from_parts(15_323_000, 0) + // Minimum execution time: 13_451_000 picoseconds. + Weight::from_parts(14_019_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -159,8 +168,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 25_855_000 picoseconds. - Weight::from_parts(26_592_000, 0) + // Minimum execution time: 22_965_000 picoseconds. + Weight::from_parts(23_855_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -169,63 +178,77 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Account` (r:1 w:1) /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `350` + // Measured: `356` // Estimated: `4273` - // Minimum execution time: 33_065_000 picoseconds. - Weight::from_parts(34_113_000, 0) + // Minimum execution time: 47_536_000 picoseconds. + Weight::from_parts(49_071_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Account` (r:2 w:2) /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `350` + // Measured: `356` // Estimated: `7404` - // Minimum execution time: 45_409_000 picoseconds. - Weight::from_parts(46_176_000, 0) + // Minimum execution time: 59_854_000 picoseconds. + Weight::from_parts(61_262_000, 0) .saturating_add(Weight::from_parts(0, 7404)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) } /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Account` (r:2 w:2) /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:0) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `350` + // Measured: `356` // Estimated: `7404` - // Minimum execution time: 40_017_000 picoseconds. - Weight::from_parts(41_081_000, 0) + // Minimum execution time: 45_638_000 picoseconds. + Weight::from_parts(46_477_000, 0) .saturating_add(Weight::from_parts(0, 7404)) - .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Account` (r:2 w:2) /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `350` + // Measured: `356` // Estimated: `7404` - // Minimum execution time: 45_189_000 picoseconds. - Weight::from_parts(46_133_000, 0) + // Minimum execution time: 59_607_000 picoseconds. + Weight::from_parts(61_405_000, 0) .saturating_add(Weight::from_parts(0, 7404)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) } /// Storage: `ForeignAssets::Asset` (r:1 w:0) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) @@ -235,8 +258,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 18_147_000 picoseconds. - Weight::from_parts(18_923_000, 0) + // Minimum execution time: 16_524_000 picoseconds. + Weight::from_parts(17_268_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -249,8 +272,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 17_801_000 picoseconds. - Weight::from_parts(18_472_000, 0) + // Minimum execution time: 16_618_000 picoseconds. + Weight::from_parts(17_201_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -261,8 +284,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 14_204_000 picoseconds. - Weight::from_parts(14_671_000, 0) + // Minimum execution time: 11_755_000 picoseconds. + Weight::from_parts(12_366_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -273,8 +296,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 13_752_000 picoseconds. - Weight::from_parts(14_380_000, 0) + // Minimum execution time: 11_872_000 picoseconds. + Weight::from_parts(12_490_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -287,8 +310,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 15_310_000 picoseconds. - Weight::from_parts(15_761_000, 0) + // Minimum execution time: 13_752_000 picoseconds. + Weight::from_parts(14_440_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -299,8 +322,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 13_656_000 picoseconds. - Weight::from_parts(14_121_000, 0) + // Minimum execution time: 11_860_000 picoseconds. + Weight::from_parts(12_186_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -315,17 +338,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 28_413_000 picoseconds. - Weight::from_parts(29_399_881, 0) + // Minimum execution time: 27_274_000 picoseconds. + Weight::from_parts(28_578_070, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 369 - .saturating_add(Weight::from_parts(5_400, 0).saturating_mul(n.into())) - // Standard Error: 369 - .saturating_add(Weight::from_parts(3_525, 0).saturating_mul(s.into())) + // Standard Error: 776 + .saturating_add(Weight::from_parts(1_087, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -337,8 +358,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `406` // Estimated: `4273` - // Minimum execution time: 29_660_000 picoseconds. - Weight::from_parts(30_281_000, 0) + // Minimum execution time: 27_414_000 picoseconds. + Weight::from_parts(28_274_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -357,13 +378,13 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `81` // Estimated: `4273` - // Minimum execution time: 12_949_000 picoseconds. - Weight::from_parts(13_813_061, 0) + // Minimum execution time: 12_087_000 picoseconds. + Weight::from_parts(12_745_826, 0) .saturating_add(Weight::from_parts(0, 4273)) - // Standard Error: 229 - .saturating_add(Weight::from_parts(480, 0).saturating_mul(n.into())) - // Standard Error: 229 - .saturating_add(Weight::from_parts(94, 0).saturating_mul(s.into())) + // Standard Error: 440 + .saturating_add(Weight::from_parts(1_010, 0).saturating_mul(n.into())) + // Standard Error: 440 + .saturating_add(Weight::from_parts(1_303, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -375,8 +396,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `406` // Estimated: `4273` - // Minimum execution time: 29_002_000 picoseconds. - Weight::from_parts(29_772_000, 0) + // Minimum execution time: 26_528_000 picoseconds. + Weight::from_parts(27_478_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -387,8 +408,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 13_023_000 picoseconds. - Weight::from_parts(13_528_000, 0) + // Minimum execution time: 10_881_000 picoseconds. + Weight::from_parts(11_268_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -401,8 +422,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `276` // Estimated: `4273` - // Minimum execution time: 32_393_000 picoseconds. - Weight::from_parts(33_164_000, 0) + // Minimum execution time: 31_216_000 picoseconds. + Weight::from_parts(32_411_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -413,17 +434,21 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `ForeignAssets::Approvals` (`max_values`: None, `max_size`: Some(746), added: 3221, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Account` (r:2 w:2) /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `520` + // Measured: `526` // Estimated: `7404` - // Minimum execution time: 64_647_000 picoseconds. - Weight::from_parts(65_669_000, 0) + // Minimum execution time: 79_133_000 picoseconds. + Weight::from_parts(81_252_000, 0) .saturating_add(Weight::from_parts(0, 7404)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(7)) } /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) @@ -433,8 +458,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `446` // Estimated: `4273` - // Minimum execution time: 34_292_000 picoseconds. - Weight::from_parts(35_505_000, 0) + // Minimum execution time: 33_529_000 picoseconds. + Weight::from_parts(34_768_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -447,8 +472,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `446` // Estimated: `4273` - // Minimum execution time: 35_358_000 picoseconds. - Weight::from_parts(36_553_000, 0) + // Minimum execution time: 33_558_000 picoseconds. + Weight::from_parts(34_197_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -459,8 +484,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 14_656_000 picoseconds. - Weight::from_parts(15_097_000, 0) + // Minimum execution time: 12_533_000 picoseconds. + Weight::from_parts(12_956_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -475,8 +500,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `345` // Estimated: `4273` - // Minimum execution time: 33_758_000 picoseconds. - Weight::from_parts(34_618_000, 0) + // Minimum execution time: 32_643_000 picoseconds. + Weight::from_parts(33_899_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -489,8 +514,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `4273` - // Minimum execution time: 32_205_000 picoseconds. - Weight::from_parts(33_208_000, 0) + // Minimum execution time: 31_276_000 picoseconds. + Weight::from_parts(32_155_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -499,31 +524,39 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) fn refund() -> Weight { // Proof Size summary in bytes: - // Measured: `471` + // Measured: `477` // Estimated: `4273` - // Minimum execution time: 30_848_000 picoseconds. - Weight::from_parts(31_592_000, 0) + // Minimum execution time: 43_426_000 picoseconds. + Weight::from_parts(45_064_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) } /// Storage: `ForeignAssets::Account` (r:1 w:1) /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) /// Storage: `ForeignAssets::Asset` (r:1 w:1) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) fn refund_other() -> Weight { // Proof Size summary in bytes: - // Measured: `401` + // Measured: `407` // Estimated: `4273` - // Minimum execution time: 28_920_000 picoseconds. - Weight::from_parts(29_519_000, 0) + // Minimum execution time: 41_885_000 picoseconds. + Weight::from_parts(43_300_000, 0) .saturating_add(Weight::from_parts(0, 4273)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `ForeignAssets::Asset` (r:1 w:0) /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) @@ -533,20 +566,63 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `4273` - // Minimum execution time: 17_938_000 picoseconds. - Weight::from_parts(18_525_000, 0) + // Minimum execution time: 16_833_000 picoseconds. + Weight::from_parts(17_265_000, 0) .saturating_add(Weight::from_parts(0, 4273)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } - + /// Storage: `ForeignAssets::Asset` (r:1 w:1) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssets::Account` (r:2 w:2) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) + /// Storage: `ForeignAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `ForeignAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(685), added: 3160, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3593` - // Minimum execution time: 46_573_000 picoseconds. - Weight::from_parts(47_385_000, 3593) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `356` + // Estimated: `7404` + // Minimum execution time: 72_880_000 picoseconds. + Weight::from_parts(74_426_000, 0) + .saturating_add(Weight::from_parts(0, 7404)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `ForeignAssets::Asset` (r:1 w:0) + /// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `276` + // Estimated: `4273` + // Minimum execution time: 5_454_000 picoseconds. + Weight::from_parts(5_742_000, 0) + .saturating_add(Weight::from_parts(0, 4273)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `ForeignAssets::Account` (r:1 w:0) + /// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `150` + // Estimated: `4197` + // Minimum execution time: 6_480_000 picoseconds. + Weight::from_parts(6_813_000, 0) + .saturating_add(Weight::from_parts(0, 4197)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `ForeignAssets::Approvals` (r:1 w:0) + /// Proof: `ForeignAssets::Approvals` (`max_values`: None, `max_size`: Some(746), added: 3221, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `245` + // Estimated: `4211` + // Minimum execution time: 8_685_000 picoseconds. + Weight::from_parts(9_177_000, 0) + .saturating_add(Weight::from_parts(0, 4211)) + .saturating_add(T::DbWeight::get().reads(1)) } } diff --git a/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_local.rs b/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_local.rs index 026c7fb5668ea..802f246c26357 100644 --- a/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_local.rs +++ b/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_local.rs @@ -1,5 +1,3 @@ -// This file is part of Substrate. - // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 @@ -17,28 +15,29 @@ //! Autogenerated weights for `pallet_assets` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-next-westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=asset-hub-next-westend-dev -// --wasm-execution=compiled -// --pallet=pallet_assets -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-rococo-runtime/asset_hub_rococo_runtime.wasm +// --pallet=pallet_assets +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./parachains/runtimes/assets/asset-hub-next-westend/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,48 +52,58 @@ pub struct WeightInfo(PhantomData); impl pallet_assets::WeightInfo for WeightInfo { /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::NextAssetId` (r:1 w:0) + /// Proof: `Assets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn create() -> Weight { // Proof Size summary in bytes: - // Measured: `109` + // Measured: `145` // Estimated: `3675` - // Minimum execution time: 25_894_000 picoseconds. - Weight::from_parts(26_675_000, 0) + // Minimum execution time: 26_482_000 picoseconds. + Weight::from_parts(27_179_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::NextAssetId` (r:1 w:0) + /// Proof: `Assets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn force_create() -> Weight { // Proof Size summary in bytes: - // Measured: `6` + // Measured: `42` // Estimated: `3675` - // Minimum execution time: 10_155_000 picoseconds. - Weight::from_parts(10_864_000, 0) + // Minimum execution time: 11_224_000 picoseconds. + Weight::from_parts(11_615_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1 w:0) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn start_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `277` + // Measured: `324` // Estimated: `3675` - // Minimum execution time: 12_904_000 picoseconds. - Weight::from_parts(13_723_000, 0) + // Minimum execution time: 16_018_000 picoseconds. + Weight::from_parts(16_859_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:1001 w:1000) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1000 w:1000) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1000 w:1000) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1000 w:1000) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) /// The range of component `c` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. @@ -102,15 +111,15 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 15_522_000 picoseconds. - Weight::from_parts(16_015_000, 0) + // Minimum execution time: 15_347_000 picoseconds. + Weight::from_parts(15_681_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 7_984 - .saturating_add(Weight::from_parts(15_024_602, 0).saturating_mul(c.into())) + // Standard Error: 26_239 + .saturating_add(Weight::from_parts(25_531_130, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(c.into()))) .saturating_add(Weight::from_parts(0, 2609).saturating_mul(c.into())) } /// Storage: `Assets::Asset` (r:1 w:1) @@ -122,13 +131,13 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `a` is `[0, 1000]`. fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `414 + a * (86 ±0)` + // Measured: `451 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 16_570_000 picoseconds. - Weight::from_parts(16_940_000, 0) + // Minimum execution time: 16_411_000 picoseconds. + Weight::from_parts(16_761_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 4_030 - .saturating_add(Weight::from_parts(15_317_878, 0).saturating_mul(a.into())) + // Standard Error: 12_049 + .saturating_add(Weight::from_parts(15_632_794, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -141,10 +150,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn finish_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `243` + // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_327_000 picoseconds. - Weight::from_parts(13_909_000, 0) + // Minimum execution time: 12_979_000 picoseconds. + Weight::from_parts(13_512_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -155,10 +164,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `243` + // Measured: `280` // Estimated: `3675` - // Minimum execution time: 23_662_000 picoseconds. - Weight::from_parts(24_510_000, 0) + // Minimum execution time: 22_629_000 picoseconds. + Weight::from_parts(23_429_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -167,63 +176,77 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:1 w:1) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `351` + // Measured: `392` // Estimated: `3675` - // Minimum execution time: 30_903_000 picoseconds. - Weight::from_parts(31_725_000, 0) + // Minimum execution time: 45_871_000 picoseconds. + Weight::from_parts(46_802_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:2 w:2) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `351` + // Measured: `392` // Estimated: `6208` - // Minimum execution time: 42_163_000 picoseconds. - Weight::from_parts(43_176_000, 0) + // Minimum execution time: 56_609_000 picoseconds. + Weight::from_parts(58_229_000, 0) .saturating_add(Weight::from_parts(0, 6208)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) } /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:2 w:2) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1 w:0) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `351` + // Measured: `392` // Estimated: `6208` - // Minimum execution time: 36_812_000 picoseconds. - Weight::from_parts(37_836_000, 0) + // Minimum execution time: 42_947_000 picoseconds. + Weight::from_parts(43_748_000, 0) .saturating_add(Weight::from_parts(0, 6208)) - .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:2 w:2) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `351` + // Measured: `392` // Estimated: `6208` - // Minimum execution time: 41_923_000 picoseconds. - Weight::from_parts(43_200_000, 0) + // Minimum execution time: 56_609_000 picoseconds. + Weight::from_parts(58_589_000, 0) .saturating_add(Weight::from_parts(0, 6208)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) } /// Storage: `Assets::Asset` (r:1 w:0) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) @@ -231,10 +254,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn freeze() -> Weight { // Proof Size summary in bytes: - // Measured: `351` + // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_567_000 picoseconds. - Weight::from_parts(17_125_000, 0) + // Minimum execution time: 16_199_000 picoseconds. + Weight::from_parts(16_994_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -245,10 +268,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn thaw() -> Weight { // Proof Size summary in bytes: - // Measured: `351` + // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_271_000 picoseconds. - Weight::from_parts(17_116_000, 0) + // Minimum execution time: 16_107_000 picoseconds. + Weight::from_parts(17_102_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -257,10 +280,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn freeze_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `277` + // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_772_000 picoseconds. - Weight::from_parts(13_267_000, 0) + // Minimum execution time: 11_414_000 picoseconds. + Weight::from_parts(12_053_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -269,10 +292,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn thaw_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `277` + // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_477_000 picoseconds. - Weight::from_parts(13_110_000, 0) + // Minimum execution time: 11_710_000 picoseconds. + Weight::from_parts(12_122_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -283,10 +306,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn transfer_ownership() -> Weight { // Proof Size summary in bytes: - // Measured: `243` + // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_857_000 picoseconds. - Weight::from_parts(14_270_000, 0) + // Minimum execution time: 13_447_000 picoseconds. + Weight::from_parts(13_861_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -295,10 +318,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn set_team() -> Weight { // Proof Size summary in bytes: - // Measured: `243` + // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_844_000 picoseconds. - Weight::from_parts(13_215_000, 0) + // Minimum execution time: 11_569_000 picoseconds. + Weight::from_parts(12_049_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -313,17 +336,13 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(_n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `243` + // Measured: `280` // Estimated: `3675` - // Minimum execution time: 27_149_000 picoseconds. - Weight::from_parts(28_147_817, 0) + // Minimum execution time: 26_983_000 picoseconds. + Weight::from_parts(28_703_529, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 410 - .saturating_add(Weight::from_parts(3_935, 0).saturating_mul(n.into())) - // Standard Error: 410 - .saturating_add(Weight::from_parts(2_686, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -333,10 +352,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `407` + // Measured: `444` // Estimated: `3675` - // Minimum execution time: 27_866_000 picoseconds. - Weight::from_parts(28_735_000, 0) + // Minimum execution time: 27_171_000 picoseconds. + Weight::from_parts(28_200_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -353,15 +372,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. fn force_set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `82` + // Measured: `119` // Estimated: `3675` - // Minimum execution time: 11_877_000 picoseconds. - Weight::from_parts(12_700_940, 0) + // Minimum execution time: 12_271_000 picoseconds. + Weight::from_parts(12_658_518, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 219 - .saturating_add(Weight::from_parts(253, 0).saturating_mul(n.into())) - // Standard Error: 219 - .saturating_add(Weight::from_parts(1_004, 0).saturating_mul(s.into())) + // Standard Error: 438 + .saturating_add(Weight::from_parts(3_068, 0).saturating_mul(n.into())) + // Standard Error: 438 + .saturating_add(Weight::from_parts(4_338, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -371,10 +390,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `407` + // Measured: `444` // Estimated: `3675` - // Minimum execution time: 27_536_000 picoseconds. - Weight::from_parts(28_635_000, 0) + // Minimum execution time: 26_574_000 picoseconds. + Weight::from_parts(27_538_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -383,10 +402,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn force_asset_status() -> Weight { // Proof Size summary in bytes: - // Measured: `243` + // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_010_000 picoseconds. - Weight::from_parts(12_526_000, 0) + // Minimum execution time: 11_164_000 picoseconds. + Weight::from_parts(11_592_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -397,10 +416,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn approve_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `277` + // Measured: `314` // Estimated: `3675` - // Minimum execution time: 30_436_000 picoseconds. - Weight::from_parts(31_420_000, 0) + // Minimum execution time: 30_723_000 picoseconds. + Weight::from_parts(32_100_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -411,17 +430,21 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:2 w:2) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `521` + // Measured: `562` // Estimated: `6208` - // Minimum execution time: 60_189_000 picoseconds. - Weight::from_parts(61_948_000, 0) + // Minimum execution time: 79_016_000 picoseconds. + Weight::from_parts(80_828_000, 0) .saturating_add(Weight::from_parts(0, 6208)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(7)) } /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) @@ -429,10 +452,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `447` + // Measured: `484` // Estimated: `3675` - // Minimum execution time: 33_033_000 picoseconds. - Weight::from_parts(33_710_000, 0) + // Minimum execution time: 33_078_000 picoseconds. + Weight::from_parts(34_121_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -443,10 +466,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `447` + // Measured: `484` // Estimated: `3675` - // Minimum execution time: 33_121_000 picoseconds. - Weight::from_parts(34_112_000, 0) + // Minimum execution time: 32_674_000 picoseconds. + Weight::from_parts(33_256_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -455,10 +478,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn set_min_balance() -> Weight { // Proof Size summary in bytes: - // Measured: `243` + // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_994_000 picoseconds. - Weight::from_parts(13_442_000, 0) + // Minimum execution time: 12_075_000 picoseconds. + Weight::from_parts(12_615_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -471,10 +494,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn touch() -> Weight { // Proof Size summary in bytes: - // Measured: `346` + // Measured: `383` // Estimated: `3675` - // Minimum execution time: 31_950_000 picoseconds. - Weight::from_parts(32_750_000, 0) + // Minimum execution time: 31_734_000 picoseconds. + Weight::from_parts(32_991_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -485,10 +508,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn touch_other() -> Weight { // Proof Size summary in bytes: - // Measured: `243` + // Measured: `280` // Estimated: `3675` - // Minimum execution time: 29_976_000 picoseconds. - Weight::from_parts(31_186_000, 0) + // Minimum execution time: 30_207_000 picoseconds. + Weight::from_parts(31_152_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -497,31 +520,39 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn refund() -> Weight { // Proof Size summary in bytes: - // Measured: `472` + // Measured: `513` // Estimated: `3675` - // Minimum execution time: 29_549_000 picoseconds. - Weight::from_parts(30_533_000, 0) + // Minimum execution time: 43_677_000 picoseconds. + Weight::from_parts(45_244_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) } /// Storage: `Assets::Account` (r:1 w:1) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn refund_other() -> Weight { // Proof Size summary in bytes: - // Measured: `402` + // Measured: `443` // Estimated: `3675` - // Minimum execution time: 27_746_000 picoseconds. - Weight::from_parts(28_561_000, 0) + // Minimum execution time: 41_707_000 picoseconds. + Weight::from_parts(43_356_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Assets::Asset` (r:1 w:0) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) @@ -529,22 +560,65 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn block() -> Weight { // Proof Size summary in bytes: - // Measured: `351` + // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_408_000 picoseconds. - Weight::from_parts(17_038_000, 0) + // Minimum execution time: 16_127_000 picoseconds. + Weight::from_parts(16_872_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } - + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `AssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + /// Storage: `AssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `AssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3593` - // Minimum execution time: 46_573_000 picoseconds. - Weight::from_parts(47_385_000, 3593) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `392` + // Estimated: `6208` + // Minimum execution time: 69_690_000 picoseconds. + Weight::from_parts(72_135_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Assets::Asset` (r:1 w:0) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `314` + // Estimated: `3675` + // Minimum execution time: 5_735_000 picoseconds. + Weight::from_parts(5_937_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `Assets::Account` (r:1 w:0) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `188` + // Estimated: `3599` + // Minimum execution time: 6_622_000 picoseconds. + Weight::from_parts(6_995_000, 0) + .saturating_add(Weight::from_parts(0, 3599)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `Assets::Approvals` (r:1 w:0) + /// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `283` + // Estimated: `3613` + // Minimum execution time: 9_066_000 picoseconds. + Weight::from_parts(9_393_000, 0) + .saturating_add(Weight::from_parts(0, 3613)) + .saturating_add(T::DbWeight::get().reads(1)) } } diff --git a/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_pool.rs b/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_pool.rs index a09ece1b184f7..f315798a40f2e 100644 --- a/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_pool.rs +++ b/substrate/frame/staking-async/runtimes/parachain/src/weights/pallet_assets_pool.rs @@ -1,5 +1,3 @@ -// This file is part of Substrate. - // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 @@ -17,28 +15,29 @@ //! Autogenerated weights for `pallet_assets` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-05-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-next-westend-dev")`, DB CACHE: 1024 +//! HOSTNAME: `c47a012f15ca`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=asset-hub-next-westend-dev -// --wasm-execution=compiled -// --pallet=pallet_assets -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-rococo-runtime/asset_hub_rococo_runtime.wasm +// --pallet=pallet_assets +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --json -// --header=./file_header.txt -// --output=./parachains/runtimes/assets/asset-hub-next-westend/src/weights/ +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,46 +52,56 @@ pub struct WeightInfo(PhantomData); impl pallet_assets::WeightInfo for WeightInfo { /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `PoolAssets::NextAssetId` (r:1 w:0) + /// Proof: `PoolAssets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn create() -> Weight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3675` - // Minimum execution time: 11_148_000 picoseconds. - Weight::from_parts(11_683_000, 0) + // Minimum execution time: 11_176_000 picoseconds. + Weight::from_parts(11_708_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `PoolAssets::NextAssetId` (r:1 w:0) + /// Proof: `PoolAssets::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3675` - // Minimum execution time: 10_811_000 picoseconds. - Weight::from_parts(11_324_000, 0) + // Minimum execution time: 11_139_000 picoseconds. + Weight::from_parts(11_425_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1 w:0) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn start_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `314` + // Measured: `465` // Estimated: `3675` - // Minimum execution time: 13_360_000 picoseconds. - Weight::from_parts(13_961_000, 0) + // Minimum execution time: 16_818_000 picoseconds. + Weight::from_parts(17_574_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `PoolAssets::Account` (r:1001 w:1000) /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1000 w:1000) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1000 w:1000) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1000 w:1000) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) /// The range of component `c` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. @@ -100,15 +109,15 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` // Estimated: `3675 + c * (2609 ±0)` - // Minimum execution time: 16_162_000 picoseconds. - Weight::from_parts(16_588_000, 0) + // Minimum execution time: 15_399_000 picoseconds. + Weight::from_parts(15_922_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 8_120 - .saturating_add(Weight::from_parts(14_997_923, 0).saturating_mul(c.into())) + // Standard Error: 20_120 + .saturating_add(Weight::from_parts(24_799_452, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(c.into()))) .saturating_add(Weight::from_parts(0, 2609).saturating_mul(c.into())) } /// Storage: `PoolAssets::Asset` (r:1 w:1) @@ -122,11 +131,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `451 + a * (86 ±0)` // Estimated: `3675 + a * (2623 ±0)` - // Minimum execution time: 17_013_000 picoseconds. - Weight::from_parts(17_433_000, 0) + // Minimum execution time: 16_199_000 picoseconds. + Weight::from_parts(16_470_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 3_595 - .saturating_add(Weight::from_parts(5_514_723, 0).saturating_mul(a.into())) + // Standard Error: 4_361 + .saturating_add(Weight::from_parts(15_336_713, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -141,8 +150,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_565_000 picoseconds. - Weight::from_parts(14_080_000, 0) + // Minimum execution time: 12_959_000 picoseconds. + Weight::from_parts(13_382_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -155,8 +164,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 24_156_000 picoseconds. - Weight::from_parts(24_879_000, 0) + // Minimum execution time: 22_225_000 picoseconds. + Weight::from_parts(23_117_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -165,63 +174,77 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `PoolAssets::Account` (r:1 w:1) /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `388` + // Measured: `430` // Estimated: `3675` - // Minimum execution time: 31_099_000 picoseconds. - Weight::from_parts(31_804_000, 0) + // Minimum execution time: 47_719_000 picoseconds. + Weight::from_parts(49_655_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `PoolAssets::Account` (r:2 w:2) /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `388` + // Measured: `430` // Estimated: `6208` - // Minimum execution time: 42_337_000 picoseconds. - Weight::from_parts(43_359_000, 0) + // Minimum execution time: 59_349_000 picoseconds. + Weight::from_parts(60_869_000, 0) .saturating_add(Weight::from_parts(0, 6208)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) } /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `PoolAssets::Account` (r:2 w:2) /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1 w:0) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `388` + // Measured: `430` // Estimated: `6208` - // Minimum execution time: 37_216_000 picoseconds. - Weight::from_parts(37_927_000, 0) + // Minimum execution time: 45_905_000 picoseconds. + Weight::from_parts(47_017_000, 0) .saturating_add(Weight::from_parts(0, 6208)) - .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `PoolAssets::Account` (r:2 w:2) /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `388` + // Measured: `430` // Estimated: `6208` - // Minimum execution time: 42_250_000 picoseconds. - Weight::from_parts(43_145_000, 0) + // Minimum execution time: 59_187_000 picoseconds. + Weight::from_parts(60_814_000, 0) .saturating_add(Weight::from_parts(0, 6208)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) } /// Storage: `PoolAssets::Asset` (r:1 w:0) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) @@ -231,8 +254,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_897_000 picoseconds. - Weight::from_parts(17_424_000, 0) + // Minimum execution time: 16_306_000 picoseconds. + Weight::from_parts(16_893_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -245,8 +268,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_804_000 picoseconds. - Weight::from_parts(17_335_000, 0) + // Minimum execution time: 16_090_000 picoseconds. + Weight::from_parts(16_832_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -257,8 +280,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 13_195_000 picoseconds. - Weight::from_parts(13_531_000, 0) + // Minimum execution time: 11_493_000 picoseconds. + Weight::from_parts(12_065_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -269,8 +292,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 12_982_000 picoseconds. - Weight::from_parts(13_469_000, 0) + // Minimum execution time: 11_673_000 picoseconds. + Weight::from_parts(12_059_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -283,8 +306,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 14_275_000 picoseconds. - Weight::from_parts(14_696_000, 0) + // Minimum execution time: 13_512_000 picoseconds. + Weight::from_parts(13_977_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -295,8 +318,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_972_000 picoseconds. - Weight::from_parts(13_459_000, 0) + // Minimum execution time: 11_669_000 picoseconds. + Weight::from_parts(11_898_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -311,17 +334,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 15_092_000 picoseconds. - Weight::from_parts(15_929_556, 0) + // Minimum execution time: 13_910_000 picoseconds. + Weight::from_parts(14_908_493, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 289 - .saturating_add(Weight::from_parts(3_185, 0).saturating_mul(n.into())) - // Standard Error: 289 - .saturating_add(Weight::from_parts(1_709, 0).saturating_mul(s.into())) + // Standard Error: 931 + .saturating_add(Weight::from_parts(409, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -333,8 +354,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `444` // Estimated: `3675` - // Minimum execution time: 15_711_000 picoseconds. - Weight::from_parts(16_183_000, 0) + // Minimum execution time: 15_016_000 picoseconds. + Weight::from_parts(15_808_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -349,17 +370,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 50]`. /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(n: u32, s: u32, ) -> Weight { + fn force_set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `119` // Estimated: `3675` - // Minimum execution time: 13_288_000 picoseconds. - Weight::from_parts(14_061_633, 0) + // Minimum execution time: 12_162_000 picoseconds. + Weight::from_parts(12_966_962, 0) .saturating_add(Weight::from_parts(0, 3675)) - // Standard Error: 215 - .saturating_add(Weight::from_parts(1_169, 0).saturating_mul(n.into())) - // Standard Error: 215 - .saturating_add(Weight::from_parts(900, 0).saturating_mul(s.into())) + // Standard Error: 397 + .saturating_add(Weight::from_parts(289, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -371,8 +390,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `444` // Estimated: `3675` - // Minimum execution time: 15_235_000 picoseconds. - Weight::from_parts(15_998_000, 0) + // Minimum execution time: 14_885_000 picoseconds. + Weight::from_parts(15_220_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -383,8 +402,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 12_556_000 picoseconds. - Weight::from_parts(13_054_000, 0) + // Minimum execution time: 11_115_000 picoseconds. + Weight::from_parts(11_652_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -397,8 +416,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `314` // Estimated: `3675` - // Minimum execution time: 18_635_000 picoseconds. - Weight::from_parts(19_431_000, 0) + // Minimum execution time: 30_537_000 picoseconds. + Weight::from_parts(31_792_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -409,17 +428,21 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) /// Storage: `PoolAssets::Account` (r:2 w:2) /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `558` + // Measured: `600` // Estimated: `6208` - // Minimum execution time: 49_082_000 picoseconds. - Weight::from_parts(50_414_000, 0) + // Minimum execution time: 79_178_000 picoseconds. + Weight::from_parts(83_473_000, 0) .saturating_add(Weight::from_parts(0, 6208)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(7)) } /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) @@ -429,8 +452,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `484` // Estimated: `3675` - // Minimum execution time: 20_978_000 picoseconds. - Weight::from_parts(21_628_000, 0) + // Minimum execution time: 33_185_000 picoseconds. + Weight::from_parts(33_940_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -443,8 +466,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `484` // Estimated: `3675` - // Minimum execution time: 21_453_000 picoseconds. - Weight::from_parts(22_134_000, 0) + // Minimum execution time: 32_692_000 picoseconds. + Weight::from_parts(33_486_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -455,8 +478,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 13_390_000 picoseconds. - Weight::from_parts(13_920_000, 0) + // Minimum execution time: 12_301_000 picoseconds. + Weight::from_parts(12_727_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -469,8 +492,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 18_063_000 picoseconds. - Weight::from_parts(18_669_000, 0) + // Minimum execution time: 17_321_000 picoseconds. + Weight::from_parts(17_943_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -483,8 +506,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `280` // Estimated: `3675` - // Minimum execution time: 17_949_000 picoseconds. - Weight::from_parts(18_891_000, 0) + // Minimum execution time: 17_306_000 picoseconds. + Weight::from_parts(17_911_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -493,29 +516,37 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn refund() -> Weight { // Proof Size summary in bytes: - // Measured: `406` + // Measured: `448` // Estimated: `3675` - // Minimum execution time: 14_696_000 picoseconds. - Weight::from_parts(15_295_000, 0) + // Minimum execution time: 27_522_000 picoseconds. + Weight::from_parts(28_593_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `PoolAssets::Account` (r:1 w:1) /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) /// Storage: `PoolAssets::Asset` (r:1 w:1) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn refund_other() -> Weight { // Proof Size summary in bytes: - // Measured: `439` + // Measured: `481` // Estimated: `3675` - // Minimum execution time: 14_643_000 picoseconds. - Weight::from_parts(15_289_000, 0) + // Minimum execution time: 29_602_000 picoseconds. + Weight::from_parts(30_397_000, 0) .saturating_add(Weight::from_parts(0, 3675)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `PoolAssets::Asset` (r:1 w:0) /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) @@ -525,20 +556,63 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3675` - // Minimum execution time: 16_619_000 picoseconds. - Weight::from_parts(17_279_000, 0) + // Minimum execution time: 16_076_000 picoseconds. + Weight::from_parts(16_614_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } - + /// Storage: `PoolAssets::Asset` (r:1 w:1) + /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `PoolAssets::Account` (r:2 w:2) + /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::FrozenBalances` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) + /// Storage: `PoolAssetsFreezer::Freezes` (r:1 w:1) + /// Proof: `PoolAssetsFreezer::Freezes` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3593` - // Minimum execution time: 46_573_000 picoseconds. - Weight::from_parts(47_385_000, 3593) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `430` + // Estimated: `6208` + // Minimum execution time: 71_751_000 picoseconds. + Weight::from_parts(74_070_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `PoolAssets::Asset` (r:1 w:0) + /// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + fn total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `314` + // Estimated: `3675` + // Minimum execution time: 5_676_000 picoseconds. + Weight::from_parts(5_922_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `PoolAssets::Account` (r:1 w:0) + /// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + fn balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `188` + // Estimated: `3599` + // Minimum execution time: 6_525_000 picoseconds. + Weight::from_parts(6_982_000, 0) + .saturating_add(Weight::from_parts(0, 3599)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `PoolAssets::Approvals` (r:1 w:0) + /// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`) + fn allowance() -> Weight { + // Proof Size summary in bytes: + // Measured: `283` + // Estimated: `3613` + // Minimum execution time: 9_208_000 picoseconds. + Weight::from_parts(9_558_000, 0) + .saturating_add(Weight::from_parts(0, 3613)) + .saturating_add(T::DbWeight::get().reads(1)) } } From 4fd493c303f45cd854291e37d2cbae092d759550 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 07:31:19 +0000 Subject: [PATCH 24/63] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump minor --force' --- prdoc/pr_8554.prdoc | 55 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/prdoc/pr_8554.prdoc b/prdoc/pr_8554.prdoc index c4f46ff4b927f..f85441f14356f 100644 --- a/prdoc/pr_8554.prdoc +++ b/prdoc/pr_8554.prdoc @@ -4,20 +4,57 @@ doc: description: |- Add ERC20 precompile for pallet-asset. - Since there can be multiple instance of pallet-assets the Precompile is implemented for an `AssetPrecompileConfig` that defines the address range to match and how to extract the asset_id from the address. + Since there can be multiple instances of `pallet-assets`, the Precompile is implemented for an `AssetPrecompileConfig` that defines both the address range to match and how to extract the asset_id from the address. - For now I have only created one `AssetIdExtractor` that pull u32 asset id encoded on the address. - Follow up PR will define another stateful extractor to extract it from storage for foreign assets. + For now I have only created one `AssetIdExtractor` that pulls an u32 asset id encoded in the address. - Other solidity traits will follow up as well in follow up PRs + Follow up PR will define stateful extractor to extract the id from storage for foreign assets. + + Other solidity traits will be added in follow up PRs crates: - name: pallet-assets - bump: patch + bump: minor - name: pallet-revive - bump: patch + bump: minor - name: snowbridge-pallet-inbound-queue - bump: patch + bump: minor - name: snowbridge-inbound-queue-primitives - bump: patch + bump: minor - name: snowbridge-outbound-queue-primitives - bump: patch + bump: minor +- name: pallet-revive-mock-network + bump: minor +- name: parachains-common + bump: minor +- name: asset-hub-rococo-runtime + bump: minor +- name: asset-hub-westend-runtime + bump: minor +- name: bridge-hub-rococo-runtime + bump: minor +- name: bridge-hub-westend-runtime + bump: minor +- name: collectives-westend-runtime + bump: minor +- name: coretime-rococo-runtime + bump: minor +- name: coretime-westend-runtime + bump: minor +- name: glutton-westend-runtime + bump: minor +- name: people-rococo-runtime + bump: minor +- name: people-westend-runtime + bump: minor +- name: penpal-runtime + bump: minor +- name: polkadot-omni-node-lib + bump: minor +- name: polkadot-parachain-bin + bump: minor +- name: pallet-staking-async-parachain-runtime + bump: minor +- name: polkadot-sdk + bump: minor +- name: yet-another-parachain-runtime + bump: minor From 907e03fd20d243ed64bf239db653118c984dea65 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 22 May 2025 17:45:09 +0200 Subject: [PATCH 25/63] use abi_decode_validate --- .../primitives/inbound-queue/src/v2/message.rs | 12 +++++++----- substrate/frame/revive/src/precompiles.rs | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs index 104bea7381345..18db169a96ff3 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs @@ -198,8 +198,9 @@ impl TryFrom<&IGatewayV2::Payload> for XcmPayload { let xcm = match payload.xcm.kind { 0 => XcmPayload::Raw(payload.xcm.data.to_vec()), 1 => { - let create_asset = IGatewayV2::XcmCreateAsset::abi_decode(&payload.xcm.data) - .map_err(|_| MessageDecodeError)?; + let create_asset = + IGatewayV2::XcmCreateAsset::abi_decode_validate(&payload.xcm.data) + .map_err(|_| MessageDecodeError)?; // Convert u8 network to Network enum let network = match create_asset.network { 0 => Network::Polkadot, @@ -219,7 +220,7 @@ impl TryFrom<&IGatewayV2::EthereumAsset> for EthereumAsset { fn try_from(asset: &IGatewayV2::EthereumAsset) -> Result { let asset = match asset.kind { 0 => { - let native_data = IGatewayV2::AsNativeTokenERC20::abi_decode(&asset.data) + let native_data = IGatewayV2::AsNativeTokenERC20::abi_decode_validate(&asset.data) .map_err(|_| MessageDecodeError)?; EthereumAsset::NativeTokenERC20 { token_id: H160::from(native_data.token_id.as_ref()), @@ -227,8 +228,9 @@ impl TryFrom<&IGatewayV2::EthereumAsset> for EthereumAsset { } }, 1 => { - let foreign_data = IGatewayV2::AsForeignTokenERC20::abi_decode(&asset.data) - .map_err(|_| MessageDecodeError)?; + let foreign_data = + IGatewayV2::AsForeignTokenERC20::abi_decode_validate(&asset.data) + .map_err(|_| MessageDecodeError)?; EthereumAsset::ForeignTokenERC20 { token_id: H256::from(foreign_data.token_id.as_ref()), value: foreign_data.value, diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index 3ea70f5a3198b..429aea38e1d67 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -353,7 +353,7 @@ impl PrimitivePrecompile for P { input: Vec, env: &mut impl Ext, ) -> Result, Error> { - let call = ::Interface::abi_decode(&input) + let call = ::Interface::abi_decode_validate(&input) .map_err(|_| Error::Panic(PanicKind::ResourceError))?; ::call(address, &call, env) } @@ -363,7 +363,7 @@ impl PrimitivePrecompile for P { input: Vec, env: &mut impl ExtWithInfo, ) -> Result, Error> { - let call = ::Interface::abi_decode(&input) + let call = ::Interface::abi_decode_validate(&input) .map_err(|_| Error::Panic(PanicKind::ResourceError))?; ::call_with_info(address, &call, env) } From b48fcd141f99e9e4696f3df0bfbed298e53873bc Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 11:07:49 +0200 Subject: [PATCH 26/63] PR review remove default HAS_CONTRACT_INFO --- substrate/frame/assets/src/precompiles.rs | 1 + substrate/frame/revive/src/precompiles.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 347a732a4a510..0d18f71bd5a77 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -91,6 +91,7 @@ where type T = Runtime; type Interface = IERC20::IERC20Calls; const MATCHER: AddressMatcher = PrecompileConfig::MATCHER; + const HAS_CONTRACT_INFO: bool = false; fn call( address: &[u8; 20], diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index 429aea38e1d67..60bbd04c76e7b 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -192,7 +192,7 @@ pub trait Precompile { /// /// Have a look at [`ExtWithInfo`] to learn about the additional APIs that a contract info /// unlocks. - const HAS_CONTRACT_INFO: bool = false; + const HAS_CONTRACT_INFO; /// Entry point for your pre-compile when `HAS_CONTRACT_INFO = false`. #[allow(unused_variables)] From 6712c18e7826df2cfa74eae5ed131f4dc1db9473 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 11:09:16 +0200 Subject: [PATCH 27/63] Update precompiles doc --- substrate/frame/revive/src/precompiles.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index 60bbd04c76e7b..55da6c7fcab93 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -137,9 +137,7 @@ impl From> for Error { /// # Warning /// /// Pre-compiles are unmetered code. Hence they have to charge an appropriate amount of weight -/// themselves. Generally, their first line of code should be a call to -/// `env.gas_meter_mut().charge()`. For that you need to implement [`Token`] on a type of your -/// choosing. +/// themselves. Generally, their first line of code should be a call to `env.charge(weight)`. pub trait Precompile { /// Your runtime. type T: Config; From 51be4f85cc19cd8ace96d2ddf709c2049ebc29bd Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 11:10:34 +0200 Subject: [PATCH 28/63] Move struct towards the begining of the file --- substrate/frame/revive/src/address.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/substrate/frame/revive/src/address.rs b/substrate/frame/revive/src/address.rs index ebb45961ebe58..5ff201bae5cec 100644 --- a/substrate/frame/revive/src/address.rs +++ b/substrate/frame/revive/src/address.rs @@ -95,6 +95,9 @@ pub struct AccountId32Mapper(PhantomData); /// It just trivially returns its inputs and doesn't make use of any state. pub struct H160Mapper(PhantomData); +/// An account mapper that can be used for testing u64 account ids. +pub struct TestAccountMapper(PhantomData); + impl AddressMapper for AccountId32Mapper where T: Config, @@ -154,9 +157,6 @@ where } } -/// An account mapper that can be used for testing u64 account ids. -pub struct TestAccountMapper(PhantomData); - impl AddressMapper for TestAccountMapper where T: Config, From 02d9a78ae85fa4d007f2cf9dd5a3696698d9d41d Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 11:18:36 +0200 Subject: [PATCH 29/63] PR suggestion fixes --- substrate/frame/revive/src/address.rs | 7 +++---- substrate/frame/revive/src/precompiles.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/substrate/frame/revive/src/address.rs b/substrate/frame/revive/src/address.rs index 5ff201bae5cec..928397ec63635 100644 --- a/substrate/frame/revive/src/address.rs +++ b/substrate/frame/revive/src/address.rs @@ -159,12 +159,11 @@ where impl AddressMapper for TestAccountMapper where - T: Config, - crate::AccountIdOf: crate::IsType, + T: Config, { fn to_address(account_id: &T::AccountId) -> H160 { let mut bytes = [0u8; 20]; - bytes[12..].copy_from_slice(&account_id.clone().into().to_be_bytes()); + bytes[12..].copy_from_slice(&account_id.to_be_bytes()); H160::from(bytes) } @@ -173,7 +172,7 @@ where } fn to_fallback_account_id(address: &H160) -> T::AccountId { - u64::from_be_bytes(address.as_ref()[12..].try_into().unwrap()).into() + u64::from_be_bytes(address.as_ref()[12..].try_into().unwrap()) } fn map(_account_id: &T::AccountId) -> DispatchResult { diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index 55da6c7fcab93..2da95f965875c 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -190,7 +190,7 @@ pub trait Precompile { /// /// Have a look at [`ExtWithInfo`] to learn about the additional APIs that a contract info /// unlocks. - const HAS_CONTRACT_INFO; + const HAS_CONTRACT_INFO: bool; /// Entry point for your pre-compile when `HAS_CONTRACT_INFO = false`. #[allow(unused_variables)] From 79f3679611cf6a1c205bb8e8a881d05b1179e2a7 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 11:34:16 +0200 Subject: [PATCH 30/63] Charge for events --- substrate/frame/assets/src/precompiles.rs | 13 +++++++++---- substrate/frame/revive/src/lib.rs | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 0d18f71bd5a77..d5a409f00b36c 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -155,10 +155,15 @@ where } /// Deposit an event to the runtime. - fn deposit_event(env: &mut impl Ext, event: IERC20Events) { + fn deposit_event(env: &mut impl Ext, event: IERC20Events) -> Result<(), Error> { let (topics, data) = event.into_log_data().split(); let topics = topics.into_iter().map(|v| H256(v.0)).collect::>(); + env.gas_meter_mut().charge(pallet_revive::RuntimeCosts::DepositEvent { + num_topic: topics.len() as u32, + len: topics.len() as u32, + })?; env.deposit_event(topics, data.to_vec()); + Ok(()) } /// Execute the transfer call. @@ -191,7 +196,7 @@ where to: call.to, value: call.value, }), - ); + )?; return Ok(transferCall::abi_encode_returns(&true)); } @@ -266,7 +271,7 @@ where spender: call.spender, value: call.value, }), - ); + )?; return Ok(approveCall::abi_encode_returns(&true)); } @@ -302,7 +307,7 @@ where to: call.to, value: call.value, }), - ); + )?; return Ok(transferFromCall::abi_encode_returns(&true)); } diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index 9a9e89b1f911f..bc13d44ee6cec 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -49,7 +49,7 @@ use crate::{ exec::{AccountIdOf, ExecError, Executable, Key, Stack as ExecStack}, gas::GasMeter, storage::{meter::Meter as StorageMeter, ContractInfo, DeletionQueueManager}, - wasm::{CodeInfo, RuntimeCosts, WasmBlob}, + wasm::{CodeInfo, WasmBlob}, }; use alloc::{boxed::Box, format, vec}; use codec::{Codec, Decode, Encode}; @@ -87,6 +87,7 @@ pub use crate::{ }, exec::{MomentOf, Origin}, pallet::*, + wasm::RuntimeCosts, }; pub use primitives::*; pub use weights::WeightInfo; From 7ef8907535a4e39e15cb5ea2b5a64380716ddaa1 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 11:37:29 +0200 Subject: [PATCH 31/63] use decode_raw_log_validate --- bridges/snowbridge/pallets/inbound-queue/src/envelope.rs | 2 +- bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs | 2 +- .../primitives/outbound-queue/src/v2/delivery_receipt.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs b/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs index 5fec8a7c36fa0..2ba779b410709 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs @@ -36,7 +36,7 @@ impl TryFrom<&Log> for Envelope { fn try_from(log: &Log) -> Result { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); - let event = OutboundMessageAccepted::decode_raw_log(topics, &log.data) + let event = OutboundMessageAccepted::decode_raw_log_validate(topics, &log.data) .map_err(|_| EnvelopeDecodeError)?; Ok(Self { diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs index 18db169a96ff3..177f62ab0ef58 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs @@ -149,7 +149,7 @@ impl TryFrom<&Log> for Message { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); // Decode the Solidity event from raw logs - let event = IGatewayV2::OutboundMessageAccepted::decode_raw_log(topics, &log.data) + let event = IGatewayV2::OutboundMessageAccepted::decode_raw_log_validate(topics, &log.data) .map_err(|_| MessageDecodeError)?; let payload = event.payload; diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs index 7288f63b7b81a..ca4758334cad6 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs @@ -38,7 +38,7 @@ impl TryFrom<&Log> for DeliveryReceipt { fn try_from(log: &Log) -> Result { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); - let event = InboundMessageDispatched::decode_raw_log(topics, &log.data) + let event = InboundMessageDispatched::decode_raw_log_validate(topics, &log.data) .map_err(|_| DeliveryReceiptDecodeError::DecodeLogFailed)?; Ok(Self { From 7a43f5f2569e524e8919acf5ca51c5c3c6803f53 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 14:43:53 +0200 Subject: [PATCH 32/63] re-organize import exports --- substrate/frame/assets/src/precompiles.rs | 7 +++++-- substrate/frame/revive/src/lib.rs | 3 +-- substrate/frame/revive/src/precompiles.rs | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index d5a409f00b36c..e4da0ae349fc8 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -21,7 +21,10 @@ use alloy::{ primitives::IntoLogData, sol_types::{Revert, SolCall}, }; -pub use pallet_revive::{precompiles::*, AddressMapper}; +pub use pallet_revive::{ + precompiles::{alloy, AddressMatcher, Error, Ext, Precompile, RuntimeCosts}, + AddressMapper, +}; use sp_core::{H160, H256}; alloy::sol!("src/precompiles/IERC20.sol"); @@ -158,7 +161,7 @@ where fn deposit_event(env: &mut impl Ext, event: IERC20Events) -> Result<(), Error> { let (topics, data) = event.into_log_data().split(); let topics = topics.into_iter().map(|v| H256(v.0)).collect::>(); - env.gas_meter_mut().charge(pallet_revive::RuntimeCosts::DepositEvent { + env.gas_meter_mut().charge(RuntimeCosts::DepositEvent { num_topic: topics.len() as u32, len: topics.len() as u32, })?; diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index bc13d44ee6cec..9a9e89b1f911f 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -49,7 +49,7 @@ use crate::{ exec::{AccountIdOf, ExecError, Executable, Key, Stack as ExecStack}, gas::GasMeter, storage::{meter::Meter as StorageMeter, ContractInfo, DeletionQueueManager}, - wasm::{CodeInfo, WasmBlob}, + wasm::{CodeInfo, RuntimeCosts, WasmBlob}, }; use alloc::{boxed::Box, format, vec}; use codec::{Codec, Decode, Encode}; @@ -87,7 +87,6 @@ pub use crate::{ }, exec::{MomentOf, Origin}, pallet::*, - wasm::RuntimeCosts, }; pub use primitives::*; pub use weights::WeightInfo; diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index 2da95f965875c..2fc2943963127 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -33,6 +33,7 @@ pub use crate::{ exec::{ExecError, PrecompileExt as Ext, PrecompileWithInfoExt as ExtWithInfo}, gas::{GasMeter, Token}, storage::meter::Diff, + wasm::RuntimeCosts, }; pub use alloy_core as alloy; From 10d3d0e80fa4cbb77a8705610e72129aeea16489 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 14:45:42 +0200 Subject: [PATCH 33/63] Add addressmapper --- substrate/frame/assets/src/precompiles.rs | 5 ++--- substrate/frame/revive/src/precompiles.rs | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index e4da0ae349fc8..eac580501b53c 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -21,9 +21,8 @@ use alloy::{ primitives::IntoLogData, sol_types::{Revert, SolCall}, }; -pub use pallet_revive::{ - precompiles::{alloy, AddressMatcher, Error, Ext, Precompile, RuntimeCosts}, - AddressMapper, +pub use pallet_revive::precompiles::{ + alloy, AddressMapper, AddressMatcher, Error, Ext, Precompile, RuntimeCosts, }; use sp_core::{H160, H256}; diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index 2fc2943963127..d9d7a1ce4db7d 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -34,6 +34,7 @@ pub use crate::{ gas::{GasMeter, Token}, storage::meter::Diff, wasm::RuntimeCosts, + AddressMapper, }; pub use alloy_core as alloy; From 09dcf743bfb8c41b64e8dd5e255d93932bee828e Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 14:51:06 +0200 Subject: [PATCH 34/63] update imports --- substrate/frame/assets/src/precompiles.rs | 12 ++++++------ substrate/frame/revive/src/precompiles.rs | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index eac580501b53c..f7487260bb080 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -17,14 +17,14 @@ use crate::{weights::WeightInfo, Call, Config, PhantomData, TransferFlags}; use alloc::vec::Vec; -use alloy::{ - primitives::IntoLogData, - sol_types::{Revert, SolCall}, -}; pub use pallet_revive::precompiles::{ - alloy, AddressMapper, AddressMatcher, Error, Ext, Precompile, RuntimeCosts, + alloy::{ + self, + primitives::IntoLogData, + sol_types::{Revert, SolCall}, + }, + AddressMapper, AddressMatcher, Error, Ext, Precompile, RuntimeCosts, H160, H256, }; -use sp_core::{H160, H256}; alloy::sol!("src/precompiles/IERC20.sol"); use IERC20::{IERC20Events, *}; diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index d9d7a1ce4db7d..c51e60cf23adc 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -37,6 +37,7 @@ pub use crate::{ AddressMapper, }; pub use alloy_core as alloy; +pub use sp_core::{H160, H256, U256}; use crate::{ exec::ExecResult, precompiles::builtin::Builtin, primitives::ExecReturnValue, Config, From 15b329f2637aaaa8112f191e5a3b6f77087a0df2 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 16:12:23 +0200 Subject: [PATCH 35/63] remove glob --- substrate/frame/assets/src/precompiles.rs | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index f7487260bb080..cc82ef3c8f464 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -27,7 +27,7 @@ pub use pallet_revive::precompiles::{ }; alloy::sol!("src/precompiles/IERC20.sol"); -use IERC20::{IERC20Events, *}; +use IERC20::IERC20Events; /// Mean of extracting the asset id from the precompile address. pub trait AssetIdExtractor { @@ -171,7 +171,7 @@ where /// Execute the transfer call. fn transfer( asset_id: >::AssetId, - call: &transferCall, + call: &IERC20::transferCall, env: &mut impl Ext, ) -> Result, Error> { env.charge(>::WeightInfo::transfer())?; @@ -200,7 +200,7 @@ where }), )?; - return Ok(transferCall::abi_encode_returns(&true)); + return Ok(IERC20::transferCall::abi_encode_returns(&true)); } /// Execute the total supply call. @@ -212,26 +212,26 @@ where env.charge(>::WeightInfo::total_issuance())?; let value = Self::to_u256(crate::Pallet::::total_issuance(asset_id))?; - return Ok(totalSupplyCall::abi_encode_returns(&value)); + return Ok(IERC20::totalSupplyCall::abi_encode_returns(&value)); } /// Execute the balance_of call. fn balance_of( asset_id: >::AssetId, - call: &balanceOfCall, + call: &IERC20::balanceOfCall, env: &mut impl Ext, ) -> Result, Error> { env.charge(>::WeightInfo::balance())?; let account = call.account.into_array().into(); let account = ::AddressMapper::to_account_id(&account); let value = Self::to_u256(crate::Pallet::::balance(asset_id, account))?; - return Ok(balanceOfCall::abi_encode_returns(&value)); + return Ok(IERC20::balanceOfCall::abi_encode_returns(&value)); } /// Execute the allowance call. fn allowance( asset_id: >::AssetId, - call: &allowanceCall, + call: &IERC20::allowanceCall, env: &mut impl Ext, ) -> Result, Error> { env.charge(>::WeightInfo::allowance())?; @@ -245,13 +245,13 @@ where asset_id, &owner, &spender, ))?; - return Ok(balanceOfCall::abi_encode_returns(&value)); + return Ok(IERC20::balanceOfCall::abi_encode_returns(&value)); } /// Execute the approve call. fn approve( asset_id: >::AssetId, - call: &approveCall, + call: &IERC20::approveCall, env: &mut impl Ext, ) -> Result, Error> { env.charge(>::WeightInfo::approve_transfer())?; @@ -275,13 +275,13 @@ where }), )?; - return Ok(approveCall::abi_encode_returns(&true)); + return Ok(IERC20::approveCall::abi_encode_returns(&true)); } /// Execute the transfer_from call. fn transfer_from( asset_id: >::AssetId, - call: &transferFromCall, + call: &IERC20::transferFromCall, env: &mut impl Ext, ) -> Result, Error> { env.charge(>::WeightInfo::transfer_approved())?; @@ -311,7 +311,7 @@ where }), )?; - return Ok(transferFromCall::abi_encode_returns(&true)); + return Ok(IERC20::transferFromCall::abi_encode_returns(&true)); } } From 4d57a0600d052fac6b41f9d940eb69069a1f6c51 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 16:27:19 +0200 Subject: [PATCH 36/63] Address remaining comments --- substrate/bin/node/runtime/src/lib.rs | 6 ++---- substrate/frame/assets/src/mock.rs | 4 +--- substrate/frame/assets/src/precompiles.rs | 25 ++++++++--------------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index ed259f288f35a..f916224487e2b 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1463,9 +1463,7 @@ impl pallet_contracts::Config for Runtime { type Xcm = (); } -use pallet_assets::{make_precompile_assets_config, precompiles::ERC20}; -make_precompile_assets_config!(Instance1Assets, 0x1); -make_precompile_assets_config!(Instance2Assets, 0x2); +use pallet_assets::{precompiles::ERC20, InlineIdConfig}; impl pallet_revive::Config for Runtime { type Time = Timestamp; @@ -1478,7 +1476,7 @@ impl pallet_revive::Config for Runtime { type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_revive::weights::SubstrateWeight; type Precompiles = - (ERC20, ERC20); + (ERC20, Instance1>, ERC20, Instance2>); type AddressMapper = pallet_revive::AccountId32Mapper; type RuntimeMemory = ConstU32<{ 128 * 1024 * 1024 }>; type PVFMemory = ConstU32<{ 512 * 1024 * 1024 }>; diff --git a/substrate/frame/assets/src/mock.rs b/substrate/frame/assets/src/mock.rs index c6e903370b79b..736718a580f46 100644 --- a/substrate/frame/assets/src/mock.rs +++ b/substrate/frame/assets/src/mock.rs @@ -56,13 +56,11 @@ impl pallet_balances::Config for Test { type AccountStore = System; } -make_precompile_assets_config!(ERC20Config, 0x0120); - #[derive_impl(pallet_revive::config_preludes::TestDefaultConfig)] impl pallet_revive::Config for Test { type AddressMapper = pallet_revive::TestAccountMapper; type Currency = Balances; - type Precompiles = (ERC20,); + type Precompiles = (ERC20,); } pub struct AssetsCallbackHandle; diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index cc82ef3c8f464..bd60b16c82e85 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -45,10 +45,10 @@ pub trait AssetPrecompileConfig { type AssetIdExtractor: AssetIdExtractor; } -/// An `AssetIdExtractor` that decode the asset id from the address. -pub struct AddressAssetIdExtractor; +/// An `AssetIdExtractor` that stores the asset id directly inside the address. +pub struct InlineAssetIdExtractor; -impl AssetIdExtractor for AddressAssetIdExtractor { +impl AssetIdExtractor for InlineAssetIdExtractor { type AssetId = u32; fn asset_id_from_address(addr: &[u8; 20]) -> Result { let bytes: [u8; 4] = addr[0..4].try_into().expect("slice is 4 bytes; qed"); @@ -57,19 +57,12 @@ impl AssetIdExtractor for AddressAssetIdExtractor { } } -/// A macro to generate an `AssetPrecompileConfig` implementation for a given name prefix. -#[macro_export] -macro_rules! make_precompile_assets_config { - ($name:ident, $prefix:literal) => { - pub struct $name; - impl $crate::precompiles::AssetPrecompileConfig for $name { - const MATCHER: $crate::precompiles::AddressMatcher = - $crate::precompiles::AddressMatcher::Prefix( - core::num::NonZero::new($prefix).unwrap(), - ); - type AssetIdExtractor = $crate::precompiles::AddressAssetIdExtractor; - } - }; +/// A precompile configuration that uses a prefix [`AddressMatcher`]. +pub struct InlineIDConfig; + +impl AssetPrecompileConfig for InlineIDConfig

{ + const MATCHER: AddressMatcher = AddressMatcher::Prefix(core::num::NonZero::new(P).unwrap()); + type AssetIdExtractor = InlineAssetIdExtractor; } /// An ERC20 precompile. From 3411ce5ef77ad2f0556d3eb380d5472adffe71a9 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 16:59:10 +0200 Subject: [PATCH 37/63] fix typo --- substrate/frame/assets/src/precompiles.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index bd60b16c82e85..55a00ec2a6bc2 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -58,9 +58,9 @@ impl AssetIdExtractor for InlineAssetIdExtractor { } /// A precompile configuration that uses a prefix [`AddressMatcher`]. -pub struct InlineIDConfig; +pub struct InlineIdConfig; -impl AssetPrecompileConfig for InlineIDConfig

{ +impl AssetPrecompileConfig for InlineIdConfig

{ const MATCHER: AddressMatcher = AddressMatcher::Prefix(core::num::NonZero::new(P).unwrap()); type AssetIdExtractor = InlineAssetIdExtractor; } From 820602e13dab3b7766af7e49030672784be91272 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 17:02:41 +0200 Subject: [PATCH 38/63] fix --- substrate/bin/node/runtime/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index f916224487e2b..600f28f71062d 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -78,6 +78,7 @@ pub use node_primitives::{AccountId, Signature}; use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Moment, Nonce}; use pallet_asset_conversion::{AccountIdConverter, Ascending, Chain, WithFirstAsset}; use pallet_asset_conversion_tx_payment::SwapAssetAdapter; +use pallet_assets::precompiles::{InlineIdConfig, ERC20}; use pallet_broker::{CoreAssignment, CoreIndex, CoretimeInterface, PartsOf57600}; use pallet_election_provider_multi_phase::{GeometricDepositBase, SolutionAccuracyOf}; use pallet_identity::legacy::IdentityInfo; @@ -1463,8 +1464,6 @@ impl pallet_contracts::Config for Runtime { type Xcm = (); } -use pallet_assets::{precompiles::ERC20, InlineIdConfig}; - impl pallet_revive::Config for Runtime { type Time = Timestamp; type Currency = Balances; From 9567d89090a0843b073676c23857d99ef204ae0c Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 17:08:56 +0200 Subject: [PATCH 39/63] Update westend --- .../parachains/runtimes/assets/asset-hub-westend/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 64d9a5a79737e..103da0d7fba5a 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -61,6 +61,7 @@ use frame_system::{ EnsureRoot, EnsureSigned, EnsureSignedBy, }; use pallet_asset_conversion_tx_payment::SwapAssetAdapter; +use pallet_assets::precompiles::{InlineIdConfig, ERC20}; use pallet_nfts::{DestroyWitness, PalletFeatures}; use pallet_revive::evm::runtime::EthExtra; use pallet_xcm::EnsureXcm; @@ -1076,7 +1077,10 @@ impl pallet_revive::Config for Runtime { type DepositPerByte = DepositPerByte; type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_revive::weights::SubstrateWeight; - type Precompiles = (); + type Precompiles = ( + ERC20, TrustBackedAssetsInstance>, + ERC20, PoolAssetsInstance>, + ); type AddressMapper = pallet_revive::AccountId32Mapper; type RuntimeMemory = ConstU32<{ 128 * 1024 * 1024 }>; type PVFMemory = ConstU32<{ 512 * 1024 * 1024 }>; From c118a240ed0f75db16dbfb31ca1a74784ca378a3 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 17:10:43 +0200 Subject: [PATCH 40/63] fix --- substrate/frame/assets/src/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/assets/src/mock.rs b/substrate/frame/assets/src/mock.rs index 736718a580f46..8930a9c71564f 100644 --- a/substrate/frame/assets/src/mock.rs +++ b/substrate/frame/assets/src/mock.rs @@ -60,7 +60,7 @@ impl pallet_balances::Config for Test { impl pallet_revive::Config for Test { type AddressMapper = pallet_revive::TestAccountMapper; type Currency = Balances; - type Precompiles = (ERC20,); + type Precompiles = (ERC20>,); } pub struct AssetsCallbackHandle; From 55b54a09e0a658c45122c70b414ab029e9843497 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 15:14:40 +0000 Subject: [PATCH 41/63] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump patch --force' --- prdoc/pr_8554.prdoc | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/prdoc/pr_8554.prdoc b/prdoc/pr_8554.prdoc index f85441f14356f..ff16aa34b79c9 100644 --- a/prdoc/pr_8554.prdoc +++ b/prdoc/pr_8554.prdoc @@ -13,48 +13,48 @@ doc: Other solidity traits will be added in follow up PRs crates: - name: pallet-assets - bump: minor + bump: patch - name: pallet-revive - bump: minor + bump: patch - name: snowbridge-pallet-inbound-queue - bump: minor + bump: patch - name: snowbridge-inbound-queue-primitives - bump: minor + bump: patch - name: snowbridge-outbound-queue-primitives - bump: minor + bump: patch - name: pallet-revive-mock-network - bump: minor + bump: patch - name: parachains-common - bump: minor + bump: patch - name: asset-hub-rococo-runtime - bump: minor + bump: patch - name: asset-hub-westend-runtime - bump: minor + bump: patch - name: bridge-hub-rococo-runtime - bump: minor + bump: patch - name: bridge-hub-westend-runtime - bump: minor + bump: patch - name: collectives-westend-runtime - bump: minor + bump: patch - name: coretime-rococo-runtime - bump: minor + bump: patch - name: coretime-westend-runtime - bump: minor + bump: patch - name: glutton-westend-runtime - bump: minor + bump: patch - name: people-rococo-runtime - bump: minor + bump: patch - name: people-westend-runtime - bump: minor + bump: patch - name: penpal-runtime - bump: minor + bump: patch - name: polkadot-omni-node-lib - bump: minor + bump: patch - name: polkadot-parachain-bin - bump: minor + bump: patch - name: pallet-staking-async-parachain-runtime - bump: minor + bump: patch - name: polkadot-sdk - bump: minor + bump: patch - name: yet-another-parachain-runtime - bump: minor + bump: patch From 7252da66482ca4eb7b2bee7be347dcc88bb95590 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 17:42:37 +0200 Subject: [PATCH 42/63] add ethereum-standards --- Cargo.toml | 4 +- .../primitives/ethereum-standards/Cargo.toml | 15 +++++ .../ethereum-standards/src/IERC20.sol | 63 +++++++++++++++++++ .../primitives/ethereum-standards/src/lib.rs | 20 ++++++ 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 substrate/primitives/ethereum-standards/Cargo.toml create mode 100644 substrate/primitives/ethereum-standards/src/IERC20.sol create mode 100644 substrate/primitives/ethereum-standards/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 27e732e845a3a..43738ef882d94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -498,6 +498,7 @@ members = [ "substrate/primitives/crypto/hashing/proc-macro", "substrate/primitives/database", "substrate/primitives/debug-derive", + "substrate/primitives/ethereum-standards", "substrate/primitives/externalities", "substrate/primitives/genesis-builder", "substrate/primitives/inherents", @@ -621,7 +622,7 @@ zero-prefixed-literal = { level = "allow", priority = 2 } # 00_1000_0 Inflector = { version = "0.11.4" } aes-gcm = { version = "0.10" } ahash = { version = "0.8.2" } -alloy-core = { version = "0.8.15", default-features = false } +alloy-core = { version = "1.1.0", default-features = false } always-assert = { version = "0.1" } anyhow = { version = "1.0.81", default-features = false } approx = { version = "0.5.1" } @@ -658,6 +659,7 @@ backoff = { version = "0.4" } backtrace = { version = "0.3.71" } binary-merkle-tree = { path = "substrate/utils/binary-merkle-tree", default-features = false } bincode = { version = "1.3.3" } +ethereum-standards = { path = "substrate/primitives/ethereum-standards" } # personal fork here as workaround for: https://github.com/rust-bitcoin/rust-bip39/pull/64 bip39 = { package = "parity-bip39", version = "2.0.1", default-features = false } bitflags = { version = "1.3.2" } diff --git a/substrate/primitives/ethereum-standards/Cargo.toml b/substrate/primitives/ethereum-standards/Cargo.toml new file mode 100644 index 0000000000000..e2e4bf4cdf96d --- /dev/null +++ b/substrate/primitives/ethereum-standards/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "ethereum-standards" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +description = "Interfaces for Ethereum standards" +license = "Apache-2.0" +homepage.workspace = true +repository.workspace = true + +[lints] +workspace = true + +[dependencies] +alloy-core = { workspace = true, features = ["sol-types"] } diff --git a/substrate/primitives/ethereum-standards/src/IERC20.sol b/substrate/primitives/ethereum-standards/src/IERC20.sol new file mode 100644 index 0000000000000..6b33f25d44e53 --- /dev/null +++ b/substrate/primitives/ethereum-standards/src/IERC20.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) +// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol +pragma solidity ^0.8.20; + +/// +/// @dev Interface of the ERC-20 standard as defined in the ERC. +/// +interface IERC20 { + /// @dev Emitted when `value` tokens are moved from one account (`from`) to + /// another (`to`). + /// + /// Note that `value` may be zero. + event Transfer(address indexed from, address indexed to, uint256 value); + + /// @dev Emitted when the allowance of a `spender` for an `owner` is set by + /// a call to {approve}. `value` is the new allowance. + event Approval(address indexed owner, address indexed spender, uint256 value); + + /// @dev Returns the value of tokens in existence. + function totalSupply() external view returns (uint256); + + /// @dev Returns the value of tokens owned by `account`. + function balanceOf(address account) external view returns (uint256); + + /// @dev Moves a `value` amount of tokens from the caller's account to `to`. + /// + /// Returns a boolean value indicating whether the operation succeeded. + /// + /// Emits a {Transfer} event. + function transfer(address to, uint256 value) external returns (bool); + + /// @dev Returns the remaining number of tokens that `spender` will be + /// allowed to spend on behalf of `owner` through {transferFrom}. This is + /// zero by default. + /// + /// This value changes when {approve} or {transferFrom} are called. + function allowance(address owner, address spender) external view returns (uint256); + + /// @dev Sets a `value` amount of tokens as the allowance of `spender` over the + /// caller's tokens. + /// + /// Returns a boolean value indicating whether the operation succeeded. + /// + /// IMPORTANT: Beware that changing an allowance with this method brings the risk + /// that someone may use both the old and the new allowance by unfortunate + /// transaction ordering. One possible solution to mitigate this race + /// condition is to first reduce the spender's allowance to 0 and set the + /// desired value afterwards: + /// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + /// + /// Emits an {Approval} event. + function approve(address spender, uint256 value) external returns (bool); + + /// @dev Moves a `value` amount of tokens from `from` to `to` using the + /// allowance mechanism. `value` is then deducted from the caller's + /// allowance. + /// + /// Returns a boolean value indicating whether the operation succeeded. + /// + /// Emits a {Transfer} event. + function transferFrom(address from, address to, uint256 value) external returns (bool); +} diff --git a/substrate/primitives/ethereum-standards/src/lib.rs b/substrate/primitives/ethereum-standards/src/lib.rs new file mode 100644 index 0000000000000..e18d0aa557077 --- /dev/null +++ b/substrate/primitives/ethereum-standards/src/lib.rs @@ -0,0 +1,20 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Ethereum standards. + +#![no_std] + +alloy_core::sol!("src/IERC20.sol"); From 4043100c86049d7bf70c2f422d467ad7195fb2e7 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 17:45:25 +0200 Subject: [PATCH 43/63] add precompiles export --- substrate/frame/revive/src/precompiles.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index c12527cee6646..85602fb2b7a7f 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -33,8 +33,11 @@ pub use crate::{ exec::{ExecError, PrecompileExt as Ext, PrecompileWithInfoExt as ExtWithInfo}, gas::{GasMeter, Token}, storage::meter::Diff, + wasm::RuntimeCosts, + AddressMapper, }; pub use alloy_core as alloy; +pub use sp_core::{H160, H256, U256}; use crate::{ exec::ExecResult, precompiles::builtin::Builtin, primitives::ExecReturnValue, Config, From 5ebdb8e461289e9ded9267d803cb675431790e9c Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 17:46:14 +0200 Subject: [PATCH 44/63] fix bridge alloy deps bump --- .../pallets/inbound-queue/src/envelope.rs | 2 +- .../primitives/inbound-queue/src/v2/message.rs | 14 ++++++++------ .../outbound-queue/src/v2/delivery_receipt.rs | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs b/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs index 888ffe86092d7..2ba779b410709 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/envelope.rs @@ -36,7 +36,7 @@ impl TryFrom<&Log> for Envelope { fn try_from(log: &Log) -> Result { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); - let event = OutboundMessageAccepted::decode_raw_log(topics, &log.data, true) + let event = OutboundMessageAccepted::decode_raw_log_validate(topics, &log.data) .map_err(|_| EnvelopeDecodeError)?; Ok(Self { diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs index 06efeba8546aa..177f62ab0ef58 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs @@ -149,7 +149,7 @@ impl TryFrom<&Log> for Message { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); // Decode the Solidity event from raw logs - let event = IGatewayV2::OutboundMessageAccepted::decode_raw_log(topics, &log.data, true) + let event = IGatewayV2::OutboundMessageAccepted::decode_raw_log_validate(topics, &log.data) .map_err(|_| MessageDecodeError)?; let payload = event.payload; @@ -198,8 +198,9 @@ impl TryFrom<&IGatewayV2::Payload> for XcmPayload { let xcm = match payload.xcm.kind { 0 => XcmPayload::Raw(payload.xcm.data.to_vec()), 1 => { - let create_asset = IGatewayV2::XcmCreateAsset::abi_decode(&payload.xcm.data, true) - .map_err(|_| MessageDecodeError)?; + let create_asset = + IGatewayV2::XcmCreateAsset::abi_decode_validate(&payload.xcm.data) + .map_err(|_| MessageDecodeError)?; // Convert u8 network to Network enum let network = match create_asset.network { 0 => Network::Polkadot, @@ -219,7 +220,7 @@ impl TryFrom<&IGatewayV2::EthereumAsset> for EthereumAsset { fn try_from(asset: &IGatewayV2::EthereumAsset) -> Result { let asset = match asset.kind { 0 => { - let native_data = IGatewayV2::AsNativeTokenERC20::abi_decode(&asset.data, true) + let native_data = IGatewayV2::AsNativeTokenERC20::abi_decode_validate(&asset.data) .map_err(|_| MessageDecodeError)?; EthereumAsset::NativeTokenERC20 { token_id: H160::from(native_data.token_id.as_ref()), @@ -227,8 +228,9 @@ impl TryFrom<&IGatewayV2::EthereumAsset> for EthereumAsset { } }, 1 => { - let foreign_data = IGatewayV2::AsForeignTokenERC20::abi_decode(&asset.data, true) - .map_err(|_| MessageDecodeError)?; + let foreign_data = + IGatewayV2::AsForeignTokenERC20::abi_decode_validate(&asset.data) + .map_err(|_| MessageDecodeError)?; EthereumAsset::ForeignTokenERC20 { token_id: H256::from(foreign_data.token_id.as_ref()), value: foreign_data.value, diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs index 852de849177b1..ca4758334cad6 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v2/delivery_receipt.rs @@ -38,7 +38,7 @@ impl TryFrom<&Log> for DeliveryReceipt { fn try_from(log: &Log) -> Result { let topics: Vec = log.topics.iter().map(|x| B256::from_slice(x.as_ref())).collect(); - let event = InboundMessageDispatched::decode_raw_log(topics, &log.data, true) + let event = InboundMessageDispatched::decode_raw_log_validate(topics, &log.data) .map_err(|_| DeliveryReceiptDecodeError::DecodeLogFailed)?; Ok(Self { From 3c01934df5758fc5ed59db708c1a38ed94af20a9 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 17:49:32 +0200 Subject: [PATCH 45/63] add umbrella --- umbrella/Cargo.toml | 6 ++++++ umbrella/src/lib.rs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 80a63a6888cc8..740048c980c1f 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -563,6 +563,7 @@ runtime-full = [ "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", + "ethereum-standards", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", @@ -1139,6 +1140,11 @@ default-features = false optional = true path = "../cumulus/primitives/utility" +[dependencies.ethereum-standards] +default-features = false +optional = true +path = "../substrate/primitives/ethereum-standards" + [dependencies.frame-benchmarking] default-features = false optional = true diff --git a/umbrella/src/lib.rs b/umbrella/src/lib.rs index 6c41154bf2723..fde520b937c00 100644 --- a/umbrella/src/lib.rs +++ b/umbrella/src/lib.rs @@ -214,6 +214,10 @@ pub use cumulus_test_relay_sproof_builder; #[cfg(feature = "emulated-integration-tests-common")] pub use emulated_integration_tests_common; +/// Interfaces for Ethereum standards. +#[cfg(feature = "ethereum-standards")] +pub use ethereum_standards; + /// Utility library for managing tree-like ordered data with logic for pruning the tree while /// finalizing nodes. #[cfg(feature = "fork-tree")] From 56ed38e0e3d70c1f00bee5bdc6eebf8799f5d48b Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 17:52:48 +0200 Subject: [PATCH 46/63] missing alloy_bump dep --- substrate/frame/revive/src/precompiles.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/substrate/frame/revive/src/precompiles.rs b/substrate/frame/revive/src/precompiles.rs index 85602fb2b7a7f..ddaa2710d78da 100644 --- a/substrate/frame/revive/src/precompiles.rs +++ b/substrate/frame/revive/src/precompiles.rs @@ -356,7 +356,7 @@ impl PrimitivePrecompile for P { input: Vec, env: &mut impl Ext, ) -> Result, Error> { - let call = ::Interface::abi_decode(&input, true) + let call = ::Interface::abi_decode_validate(&input) .map_err(|_| Error::Panic(PanicKind::ResourceError))?; ::call(address, &call, env) } @@ -366,7 +366,7 @@ impl PrimitivePrecompile for P { input: Vec, env: &mut impl ExtWithInfo, ) -> Result, Error> { - let call = ::Interface::abi_decode(&input, true) + let call = ::Interface::abi_decode_validate(&input) .map_err(|_| Error::Panic(PanicKind::ResourceError))?; ::call_with_info(address, &call, env) } From d0c3467bb9a53b08ecb242a781cf0c7374a5446b Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 15:54:30 +0000 Subject: [PATCH 47/63] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump patch' --- prdoc/pr_8679.prdoc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 prdoc/pr_8679.prdoc diff --git a/prdoc/pr_8679.prdoc b/prdoc/pr_8679.prdoc new file mode 100644 index 0000000000000..75a62da0852dc --- /dev/null +++ b/prdoc/pr_8679.prdoc @@ -0,0 +1,18 @@ +title: Shared Add ethereum-standards crate +doc: +- audience: Runtime Dev + description: 'Shared PR that adds ethereum-standards crate used by upcoming #7762 and + #8365 ' +crates: +- name: ethereum-standards + bump: patch +- name: pallet-revive + bump: patch +- name: snowbridge-pallet-inbound-queue + bump: patch +- name: snowbridge-inbound-queue-primitives + bump: patch +- name: snowbridge-outbound-queue-primitives + bump: patch +- name: polkadot-sdk + bump: patch From 2b858f1c9e1e027c95c2c13e7099e866d020b87a Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 18:02:09 +0200 Subject: [PATCH 48/63] fixes --- Cargo.lock | 154 ++++++++++++------ .../primitives/ethereum-standards/Cargo.toml | 2 +- .../primitives/ethereum-standards/src/lib.rs | 4 +- 3 files changed, 112 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02ccf11661443..99f02f0b0823e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,9 +127,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "alloy-core" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618bd382f0bc2ac26a7e4bfae01c9b015ca8f21b37ca40059ae35a7e62b3dc6" +checksum = "a3c5a28f166629752f2e7246b813cdea3243cca59aab2d4264b1fd68392c10eb" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -140,26 +140,25 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41056bde53ae10ffbbf11618efbe1e0290859e5eab0fe9ef82ebdb62f12a866f" +checksum = "18cc14d832bc3331ca22a1c7819de1ede99f58f61a7d123952af7dde8de124a6" dependencies = [ "alloy-json-abi", "alloy-primitives", "alloy-sol-type-parser", "alloy-sol-types", - "const-hex", "itoa", "serde", "serde_json", - "winnow 0.6.18", + "winnow 0.7.10", ] [[package]] name = "alloy-json-abi" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c357da577dfb56998d01f574d81ad7a1958d248740a7981b205d69d65a7da404" +checksum = "3ccaa79753d7bf15f06399ea76922afbfaf8d18bebed9e8fc452984b4a90dcc9" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -169,27 +168,26 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6259a506ab13e1d658796c31e6e39d2e2ee89243bcc505ddc613b35732e0a430" +checksum = "18c35fc4b03ace65001676358ffbbaefe2a2b27ee50fe777c345082c7c888be8" dependencies = [ "alloy-rlp", "bytes", "cfg-if", "const-hex", - "derive_more 1.0.0", + "derive_more 2.0.1", "foldhash", "hashbrown 0.15.3", - "hex-literal", "indexmap 2.9.0", "itoa", "k256", "keccak-asm", "paste", "proptest", - "rand 0.8.5", + "rand 0.9.0", "ruint", - "rustc-hash 2.0.0", + "rustc-hash 2.1.1", "serde", "sha3 0.10.8", "tiny-keccak", @@ -208,9 +206,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9d64f851d95619233f74b310f12bcf16e0cbc27ee3762b6115c14a84809280a" +checksum = "8612e0658964d616344f199ab251a49d48113992d81b92dab93ed855faa66383" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -222,9 +220,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf7ed1574b699f48bf17caab4e6e54c6d12bc3c006ab33d58b1e227c1c3559f" +checksum = "7a384edac7283bc4c010a355fb648082860c04b826bb7a814c45263c8f304c74" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -240,13 +238,14 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c02997ccef5f34f9c099277d4145f183b422938ed5322dc57a089fe9b9ad9ee" +checksum = "0dd588c2d516da7deb421b8c166dc60b7ae31bca5beea29ab6621fcfa53d6ca5" dependencies = [ "const-hex", "dunce", "heck 0.5.0", + "macro-string", "proc-macro2 1.0.95", "quote 1.0.40", "syn 2.0.98", @@ -255,24 +254,23 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce13ff37285b0870d0a0746992a4ae48efaf34b766ae4c2640fa15e5305f8e73" +checksum = "e86ddeb70792c7ceaad23e57d52250107ebbb86733e52f4a25d8dc1abc931837" dependencies = [ "serde", - "winnow 0.6.18", + "winnow 0.7.10", ] [[package]] name = "alloy-sol-types" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1174cafd6c6d810711b4e00383037bdb458efc4fe3dbafafa16567e0320c54d8" +checksum = "584cb97bfc5746cb9dcc4def77da11694b5d6d7339be91b7480a6a68dc129387" dependencies = [ "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", - "const-hex", "serde", ] @@ -1846,18 +1844,18 @@ dependencies = [ [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitcoin-internals" @@ -5427,7 +5425,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ - "derive_more-impl", + "derive_more-impl 1.0.0", +] + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl 2.0.1", ] [[package]] @@ -5442,6 +5449,18 @@ dependencies = [ "unicode-xid 0.2.4", ] +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "proc-macro2 1.0.95", + "quote 1.0.40", + "syn 2.0.98", + "unicode-xid 0.2.4", +] + [[package]] name = "diff" version = "0.1.13" @@ -6040,6 +6059,13 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "ethereum-standards" +version = "0.1.0" +dependencies = [ + "pallet-revive", +] + [[package]] name = "ethereum-types" version = "0.15.1" @@ -6166,6 +6192,17 @@ dependencies = [ "bytes", ] +[[package]] +name = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec 0.7.4", + "auto_impl", + "bytes", +] + [[package]] name = "fatality" version = "0.1.1" @@ -6371,9 +6408,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "foreign-types" @@ -8617,7 +8654,7 @@ dependencies = [ "parking_lot 0.12.3", "pin-project", "rand 0.8.5", - "rustc-hash 2.0.0", + "rustc-hash 2.1.1", "serde", "serde_json", "thiserror 1.0.65", @@ -9804,6 +9841,17 @@ dependencies = [ "libc", ] +[[package]] +name = "macro-string" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" +dependencies = [ + "proc-macro2 1.0.95", + "quote 1.0.40", + "syn 2.0.98", +] + [[package]] name = "macro_magic" version = "0.5.1" @@ -15863,6 +15911,7 @@ dependencies = [ "cumulus-relay-chain-streams", "cumulus-test-relay-sproof-builder", "emulated-integration-tests-common", + "ethereum-standards", "fork-tree", "frame-benchmarking", "frame-benchmarking-cli", @@ -17364,9 +17413,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", "bit-vec", @@ -17606,7 +17655,7 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.0.0", + "rustc-hash 2.1.1", "rustls 0.23.18", "socket2 0.5.9", "thiserror 1.0.65", @@ -17623,7 +17672,7 @@ dependencies = [ "bytes", "rand 0.8.5", "ring 0.17.8", - "rustc-hash 2.0.0", + "rustc-hash 2.1.1", "rustls 0.23.18", "slab", "thiserror 1.0.65", @@ -17677,7 +17726,6 @@ dependencies = [ "libc", "rand_chacha 0.3.1", "rand_core 0.6.4", - "serde", ] [[package]] @@ -17688,6 +17736,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.1", + "serde", "zerocopy 0.8.20", ] @@ -17733,6 +17782,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a88e0da7a2c97baa202165137c158d0a2e824ac465d13d81046727b34cb247d3" dependencies = [ "getrandom 0.3.1", + "serde", "zerocopy 0.8.20", ] @@ -18508,21 +18558,24 @@ dependencies = [ [[package]] name = "ruint" -version = "1.12.3" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +checksum = "11256b5fe8c68f56ac6f39ef0720e592f33d2367a4782740d9c9142e889c7fb4" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", "ark-ff 0.4.2", "bytes", - "fastrlp", + "fastrlp 0.3.1", + "fastrlp 0.4.0", "num-bigint", + "num-integer", "num-traits", "parity-scale-codec", "primitive-types 0.12.2", "proptest", "rand 0.8.5", + "rand 0.9.0", "rlp 0.5.2", "ruint-macro", "serde", @@ -18550,9 +18603,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc-hex" @@ -25281,9 +25334,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.15" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219389c1ebe89f8333df8bdfb871f6631c552ff399c23cac02480b6088aad8f0" +checksum = "1b5d879005cc1b5ba4e18665be9e9501d9da3a9b95f625497c4cb7ee082b532e" dependencies = [ "paste", "proc-macro2 1.0.95", @@ -27803,6 +27856,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" diff --git a/substrate/primitives/ethereum-standards/Cargo.toml b/substrate/primitives/ethereum-standards/Cargo.toml index e2e4bf4cdf96d..13c8443703b0a 100644 --- a/substrate/primitives/ethereum-standards/Cargo.toml +++ b/substrate/primitives/ethereum-standards/Cargo.toml @@ -12,4 +12,4 @@ repository.workspace = true workspace = true [dependencies] -alloy-core = { workspace = true, features = ["sol-types"] } +pallet-revive = { workspace = true } diff --git a/substrate/primitives/ethereum-standards/src/lib.rs b/substrate/primitives/ethereum-standards/src/lib.rs index e18d0aa557077..9485a6943b1a1 100644 --- a/substrate/primitives/ethereum-standards/src/lib.rs +++ b/substrate/primitives/ethereum-standards/src/lib.rs @@ -17,4 +17,6 @@ #![no_std] -alloy_core::sol!("src/IERC20.sol"); +pub use pallet_revive::precompiles::alloy; + +alloy::sol!("src/IERC20.sol"); From be32e8c5588270e4e79464743b63134c36dd8f63 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Tue, 27 May 2025 18:09:23 +0200 Subject: [PATCH 49/63] Apply suggestions from code review --- substrate/primitives/ethereum-standards/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/primitives/ethereum-standards/src/lib.rs b/substrate/primitives/ethereum-standards/src/lib.rs index 9485a6943b1a1..ae95db103d912 100644 --- a/substrate/primitives/ethereum-standards/src/lib.rs +++ b/substrate/primitives/ethereum-standards/src/lib.rs @@ -17,6 +17,6 @@ #![no_std] -pub use pallet_revive::precompiles::alloy; +use pallet_revive::precompiles::alloy; alloy::sol!("src/IERC20.sol"); From fefc9232f8f79cf520621ce44fbc9a67dbd28b19 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 18:17:37 +0200 Subject: [PATCH 50/63] do not depend on pallet-revive --- substrate/primitives/ethereum-standards/Cargo.toml | 2 +- substrate/primitives/ethereum-standards/src/lib.rs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/substrate/primitives/ethereum-standards/Cargo.toml b/substrate/primitives/ethereum-standards/Cargo.toml index 13c8443703b0a..e2e4bf4cdf96d 100644 --- a/substrate/primitives/ethereum-standards/Cargo.toml +++ b/substrate/primitives/ethereum-standards/Cargo.toml @@ -12,4 +12,4 @@ repository.workspace = true workspace = true [dependencies] -pallet-revive = { workspace = true } +alloy-core = { workspace = true, features = ["sol-types"] } diff --git a/substrate/primitives/ethereum-standards/src/lib.rs b/substrate/primitives/ethereum-standards/src/lib.rs index 9485a6943b1a1..e18d0aa557077 100644 --- a/substrate/primitives/ethereum-standards/src/lib.rs +++ b/substrate/primitives/ethereum-standards/src/lib.rs @@ -17,6 +17,4 @@ #![no_std] -pub use pallet_revive::precompiles::alloy; - -alloy::sol!("src/IERC20.sol"); +alloy_core::sol!("src/IERC20.sol"); From 2fe6187b38476575a3a8dc3afb88fed5dfbf4d67 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 18:20:11 +0200 Subject: [PATCH 51/63] fix --- substrate/frame/assets/src/precompiles.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 55a00ec2a6bc2..8c03b7a162dae 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -17,7 +17,7 @@ use crate::{weights::WeightInfo, Call, Config, PhantomData, TransferFlags}; use alloc::vec::Vec; -pub use pallet_revive::precompiles::{ +use pallet_revive::precompiles::{ alloy::{ self, primitives::IntoLogData, @@ -27,7 +27,7 @@ pub use pallet_revive::precompiles::{ }; alloy::sol!("src/precompiles/IERC20.sol"); -use IERC20::IERC20Events; +use IERC20::{IERC20Calls, IERC20Events}; /// Mean of extracting the asset id from the precompile address. pub trait AssetIdExtractor { @@ -93,8 +93,6 @@ where input: &Self::Interface, env: &mut impl Ext, ) -> Result, Error> { - use IERC20::*; - let asset_id = PrecompileConfig::AssetIdExtractor::asset_id_from_address(address)?.into(); match input { From 8c0f6566289e14cec212d4943f3f715ff14052b7 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 18:22:21 +0200 Subject: [PATCH 52/63] Use ethereum-standards --- Cargo.lock | 3 +- substrate/frame/assets/Cargo.toml | 1 + substrate/frame/assets/src/precompiles.rs | 7 ++- .../frame/assets/src/precompiles/IERC20.sol | 63 ------------------- 4 files changed, 7 insertions(+), 67 deletions(-) delete mode 100644 substrate/frame/assets/src/precompiles/IERC20.sol diff --git a/Cargo.lock b/Cargo.lock index 3992cc24c62d7..9278541bae1f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6063,7 +6063,7 @@ dependencies = [ name = "ethereum-standards" version = "0.1.0" dependencies = [ - "pallet-revive", + "alloy-core", ] [[package]] @@ -11198,6 +11198,7 @@ dependencies = [ name = "pallet-assets" version = "29.1.0" dependencies = [ + "ethereum-standards", "frame-benchmarking", "frame-support", "frame-system", diff --git a/substrate/frame/assets/Cargo.toml b/substrate/frame/assets/Cargo.toml index c643ae751a1fc..d893e7ad11fa1 100644 --- a/substrate/frame/assets/Cargo.toml +++ b/substrate/frame/assets/Cargo.toml @@ -17,6 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { workspace = true } +ethereum-standards = { workspace = true } impl-trait-for-tuples = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 8c03b7a162dae..3d8f3d12f0f95 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -17,6 +17,10 @@ use crate::{weights::WeightInfo, Call, Config, PhantomData, TransferFlags}; use alloc::vec::Vec; +use ethereum_standards::{ + IERC20, + IERC20::{IERC20Calls, IERC20Events}, +}; use pallet_revive::precompiles::{ alloy::{ self, @@ -26,9 +30,6 @@ use pallet_revive::precompiles::{ AddressMapper, AddressMatcher, Error, Ext, Precompile, RuntimeCosts, H160, H256, }; -alloy::sol!("src/precompiles/IERC20.sol"); -use IERC20::{IERC20Calls, IERC20Events}; - /// Mean of extracting the asset id from the precompile address. pub trait AssetIdExtractor { type AssetId; diff --git a/substrate/frame/assets/src/precompiles/IERC20.sol b/substrate/frame/assets/src/precompiles/IERC20.sol deleted file mode 100644 index 6b33f25d44e53..0000000000000 --- a/substrate/frame/assets/src/precompiles/IERC20.sol +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) -// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol -pragma solidity ^0.8.20; - -/// -/// @dev Interface of the ERC-20 standard as defined in the ERC. -/// -interface IERC20 { - /// @dev Emitted when `value` tokens are moved from one account (`from`) to - /// another (`to`). - /// - /// Note that `value` may be zero. - event Transfer(address indexed from, address indexed to, uint256 value); - - /// @dev Emitted when the allowance of a `spender` for an `owner` is set by - /// a call to {approve}. `value` is the new allowance. - event Approval(address indexed owner, address indexed spender, uint256 value); - - /// @dev Returns the value of tokens in existence. - function totalSupply() external view returns (uint256); - - /// @dev Returns the value of tokens owned by `account`. - function balanceOf(address account) external view returns (uint256); - - /// @dev Moves a `value` amount of tokens from the caller's account to `to`. - /// - /// Returns a boolean value indicating whether the operation succeeded. - /// - /// Emits a {Transfer} event. - function transfer(address to, uint256 value) external returns (bool); - - /// @dev Returns the remaining number of tokens that `spender` will be - /// allowed to spend on behalf of `owner` through {transferFrom}. This is - /// zero by default. - /// - /// This value changes when {approve} or {transferFrom} are called. - function allowance(address owner, address spender) external view returns (uint256); - - /// @dev Sets a `value` amount of tokens as the allowance of `spender` over the - /// caller's tokens. - /// - /// Returns a boolean value indicating whether the operation succeeded. - /// - /// IMPORTANT: Beware that changing an allowance with this method brings the risk - /// that someone may use both the old and the new allowance by unfortunate - /// transaction ordering. One possible solution to mitigate this race - /// condition is to first reduce the spender's allowance to 0 and set the - /// desired value afterwards: - /// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 - /// - /// Emits an {Approval} event. - function approve(address spender, uint256 value) external returns (bool); - - /// @dev Moves a `value` amount of tokens from `from` to `to` using the - /// allowance mechanism. `value` is then deducted from the caller's - /// allowance. - /// - /// Returns a boolean value indicating whether the operation succeeded. - /// - /// Emits a {Transfer} event. - function transferFrom(address from, address to, uint256 value) external returns (bool); -} From ac10de8b3e85527f9c98bf735fb08358e4891dec Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 18:17:37 +0200 Subject: [PATCH 53/63] do not depend on pallet-revive --- substrate/primitives/ethereum-standards/Cargo.toml | 2 +- substrate/primitives/ethereum-standards/src/lib.rs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/substrate/primitives/ethereum-standards/Cargo.toml b/substrate/primitives/ethereum-standards/Cargo.toml index 13c8443703b0a..e2e4bf4cdf96d 100644 --- a/substrate/primitives/ethereum-standards/Cargo.toml +++ b/substrate/primitives/ethereum-standards/Cargo.toml @@ -12,4 +12,4 @@ repository.workspace = true workspace = true [dependencies] -pallet-revive = { workspace = true } +alloy-core = { workspace = true, features = ["sol-types"] } diff --git a/substrate/primitives/ethereum-standards/src/lib.rs b/substrate/primitives/ethereum-standards/src/lib.rs index ae95db103d912..e18d0aa557077 100644 --- a/substrate/primitives/ethereum-standards/src/lib.rs +++ b/substrate/primitives/ethereum-standards/src/lib.rs @@ -17,6 +17,4 @@ #![no_std] -use pallet_revive::precompiles::alloy; - -alloy::sol!("src/IERC20.sol"); +alloy_core::sol!("src/IERC20.sol"); From ce31275c2cdf9e785ffb5f24a07c5535c15dbfd1 Mon Sep 17 00:00:00 2001 From: Francisco Aguirre Date: Tue, 27 May 2025 15:14:26 -0300 Subject: [PATCH 54/63] fix: taplo, license, lockfile --- Cargo.lock | 2 +- .../runtimes/testing/yet-another-parachain/Cargo.toml | 2 +- substrate/primitives/ethereum-standards/src/lib.rs | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99f02f0b0823e..ff0d0a6cef4fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6063,7 +6063,7 @@ dependencies = [ name = "ethereum-standards" version = "0.1.0" dependencies = [ - "pallet-revive", + "alloy-core", ] [[package]] diff --git a/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml b/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml index d7a6e540fac10..e082c6ca60a59 100644 --- a/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml @@ -47,9 +47,9 @@ sp-runtime = { workspace = true } sp-session = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } +xcm.workspace = true xcm-builder.workspace = true xcm-executor.workspace = true -xcm.workspace = true # Polkadot polkadot-parachain-primitives = { workspace = true } diff --git a/substrate/primitives/ethereum-standards/src/lib.rs b/substrate/primitives/ethereum-standards/src/lib.rs index e18d0aa557077..85b5fd7adb9c9 100644 --- a/substrate/primitives/ethereum-standards/src/lib.rs +++ b/substrate/primitives/ethereum-standards/src/lib.rs @@ -1,3 +1,5 @@ +// This file is part of Substrate. + // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 From 4329bec87734bf3d36cd24386a7bda87c196e508 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 20:16:52 +0000 Subject: [PATCH 55/63] Update from github-actions[bot] running command 'fmt' --- .../runtimes/testing/yet-another-parachain/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml b/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml index e082c6ca60a59..d7a6e540fac10 100644 --- a/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/yet-another-parachain/Cargo.toml @@ -47,9 +47,9 @@ sp-runtime = { workspace = true } sp-session = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } -xcm.workspace = true xcm-builder.workspace = true xcm-executor.workspace = true +xcm.workspace = true # Polkadot polkadot-parachain-primitives = { workspace = true } From 6a15a7931911988a7a083d786c68ec5110a7f69e Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 22:20:23 +0200 Subject: [PATCH 56/63] fix UnsafeOnlyForDryRun --- substrate/frame/assets/src/precompiles.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 3d8f3d12f0f95..58e8d919970ce 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -373,7 +373,7 @@ mod test { H160::from(asset_addr), 0u64, Weight::MAX, - DepositLimit::Unchecked, + DepositLimit::UnsafeOnlyForDryRun, data, ); @@ -409,7 +409,7 @@ mod test { H160::from(asset_addr), 0u64, Weight::MAX, - DepositLimit::Unchecked, + DepositLimit::UnsafeOnlyForDryRun, data, ) .result @@ -440,7 +440,7 @@ mod test { H160::from(asset_addr), 0u64, Weight::MAX, - DepositLimit::Unchecked, + DepositLimit::UnsafeOnlyForDryRun, data, ) .result @@ -486,7 +486,7 @@ mod test { H160::from(asset_addr), 0u64, Weight::MAX, - DepositLimit::Unchecked, + DepositLimit::UnsafeOnlyForDryRun, data, ); @@ -510,7 +510,7 @@ mod test { H160::from(asset_addr), 0u64, Weight::MAX, - DepositLimit::Unchecked, + DepositLimit::UnsafeOnlyForDryRun, data, ) .result @@ -532,7 +532,7 @@ mod test { H160::from(asset_addr), 0u64, Weight::MAX, - DepositLimit::Unchecked, + DepositLimit::UnsafeOnlyForDryRun, data, ); assert_eq!(Assets::balance(asset_id, owner), 90); From cec38d88abccfbae315a83fa03bd6bab41784c56 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 27 May 2025 22:32:23 +0200 Subject: [PATCH 57/63] fix updates --- substrate/frame/assets/src/mock.rs | 2 +- substrate/frame/assets/src/precompiles.rs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/substrate/frame/assets/src/mock.rs b/substrate/frame/assets/src/mock.rs index 8930a9c71564f..78fb2b78e4f47 100644 --- a/substrate/frame/assets/src/mock.rs +++ b/substrate/frame/assets/src/mock.rs @@ -20,7 +20,7 @@ use super::*; use crate as pallet_assets; -use crate::precompiles::ERC20; +use crate::precompiles::{InlineIdConfig, ERC20}; use codec::Encode; use frame_support::{ assert_ok, construct_runtime, derive_impl, parameter_types, diff --git a/substrate/frame/assets/src/precompiles.rs b/substrate/frame/assets/src/precompiles.rs index 58e8d919970ce..6d0c08ba3eecb 100644 --- a/substrate/frame/assets/src/precompiles.rs +++ b/substrate/frame/assets/src/precompiles.rs @@ -311,9 +311,7 @@ where mod test { use super::*; use crate::{ - mock::{ - new_test_ext, Assets, Balances, ERC20Config, RuntimeEvent, RuntimeOrigin, System, Test, - }, + mock::{new_test_ext, Assets, Balances, RuntimeEvent, RuntimeOrigin, System, Test}, precompiles::alloy::hex, }; use alloy::primitives::U256; @@ -336,9 +334,9 @@ mod test { fn asset_id_extractor_works() { let address: [u8; 20] = hex::const_decode_to_array(b"0000053900000000000000000000000001200000").unwrap(); - assert!(ERC20Config::MATCHER.matches(&address)); + assert!(InlineIdConfig::<0x0120>::MATCHER.matches(&address)); assert_eq!( - ::AssetIdExtractor::asset_id_from_address( + as AssetPrecompileConfig>::AssetIdExtractor::asset_id_from_address( &address ) .unwrap(), From c30941e4ca2e9a3fbcca6393a43f1c6d8afe9de5 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Wed, 28 May 2025 22:01:43 +0200 Subject: [PATCH 58/63] Update prdoc/pr_8679.prdoc --- prdoc/pr_8679.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_8679.prdoc b/prdoc/pr_8679.prdoc index d6bfe993ff317..43ee18de00258 100644 --- a/prdoc/pr_8679.prdoc +++ b/prdoc/pr_8679.prdoc @@ -17,4 +17,4 @@ crates: - name: polkadot-sdk bump: minor - name: yet-another-parachain-runtime - bump: minor \ No newline at end of file + bump: minor From 29673a0710f79da56268d6755f35603c9e3eb38c Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 07:20:52 +0000 Subject: [PATCH 59/63] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --bump minor --force' --- prdoc/pr_8554.prdoc | 48 +++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/prdoc/pr_8554.prdoc b/prdoc/pr_8554.prdoc index ff16aa34b79c9..693c22db8d24f 100644 --- a/prdoc/pr_8554.prdoc +++ b/prdoc/pr_8554.prdoc @@ -13,48 +13,50 @@ doc: Other solidity traits will be added in follow up PRs crates: - name: pallet-assets - bump: patch + bump: minor - name: pallet-revive - bump: patch + bump: minor - name: snowbridge-pallet-inbound-queue - bump: patch + bump: minor - name: snowbridge-inbound-queue-primitives - bump: patch + bump: minor - name: snowbridge-outbound-queue-primitives - bump: patch + bump: minor - name: pallet-revive-mock-network - bump: patch + bump: minor - name: parachains-common - bump: patch + bump: minor - name: asset-hub-rococo-runtime - bump: patch + bump: minor - name: asset-hub-westend-runtime - bump: patch + bump: minor - name: bridge-hub-rococo-runtime - bump: patch + bump: minor - name: bridge-hub-westend-runtime - bump: patch + bump: minor - name: collectives-westend-runtime - bump: patch + bump: minor - name: coretime-rococo-runtime - bump: patch + bump: minor - name: coretime-westend-runtime - bump: patch + bump: minor - name: glutton-westend-runtime - bump: patch + bump: minor - name: people-rococo-runtime - bump: patch + bump: minor - name: people-westend-runtime - bump: patch + bump: minor - name: penpal-runtime - bump: patch + bump: minor - name: polkadot-omni-node-lib - bump: patch + bump: minor - name: polkadot-parachain-bin - bump: patch + bump: minor - name: pallet-staking-async-parachain-runtime - bump: patch + bump: minor - name: polkadot-sdk - bump: patch + bump: minor - name: yet-another-parachain-runtime - bump: patch + bump: minor +- name: ethereum-standards + bump: minor From 35ce7006cb46e56d7b8a8258b1bdc517995571f3 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 30 May 2025 10:20:57 +0200 Subject: [PATCH 60/63] fix --- cumulus/parachains/runtimes/assets/common/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/cumulus/parachains/runtimes/assets/common/Cargo.toml b/cumulus/parachains/runtimes/assets/common/Cargo.toml index c64a9c1875b7f..6365831d9f8d2 100644 --- a/cumulus/parachains/runtimes/assets/common/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/common/Cargo.toml @@ -82,4 +82,5 @@ try-runtime = [ "pallet-revive/try-runtime", "pallet-xcm/try-runtime", "sp-runtime/try-runtime", + "parachains-common/try-runtime" ] From 79e5fbbde48fe107964fa9f8e8c03e935bfdf6cc Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 08:55:38 +0000 Subject: [PATCH 61/63] Update from github-actions[bot] running command 'fmt' --- cumulus/parachains/runtimes/assets/common/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/assets/common/Cargo.toml b/cumulus/parachains/runtimes/assets/common/Cargo.toml index 6365831d9f8d2..69ccfca9da961 100644 --- a/cumulus/parachains/runtimes/assets/common/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/common/Cargo.toml @@ -81,6 +81,6 @@ try-runtime = [ "pallet-assets/try-runtime", "pallet-revive/try-runtime", "pallet-xcm/try-runtime", + "parachains-common/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] From 8c91c30dbad3d1216f65941cf4d1a7db4e1f3620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 30 May 2025 15:38:33 +0200 Subject: [PATCH 62/63] Update substrate/frame/revive/src/lib.rs --- substrate/frame/revive/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index cb13aea84070b..99eb97438a4eb 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -360,8 +360,7 @@ pub mod pallet { #[inject_runtime_type] type RuntimeCall = (); - - type CallFilter = Everything; + type CallFilter = (); type Precompiles = (); type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type DepositPerByte = DepositPerByte; From 49799cda9b00ebd1daf7d9da7a404273c6f47791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 30 May 2025 15:38:39 +0200 Subject: [PATCH 63/63] Update substrate/frame/revive/src/lib.rs --- substrate/frame/revive/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index 99eb97438a4eb..c3a3b1ad81741 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -65,7 +65,7 @@ use frame_support::{ traits::{ fungible::{Inspect, Mutate, MutateHold}, tokens::{Fortitude::Polite, Preservation::Preserve}, - ConstU32, ConstU64, Contains, EnsureOrigin, Everything, Get, IsType, OriginTrait, Time, + ConstU32, ConstU64, Contains, EnsureOrigin, Get, IsType, OriginTrait, Time, }, weights::WeightMeter, BoundedVec, RuntimeDebugNoBound,