diff --git a/.github/workflows/release-10_branchoff-stable.yml b/.github/workflows/release-10_branchoff-stable.yml index ced08da5a0a0c6806bcc42536bc851431835f611..2fad2dbcf1e73d2d0340734e3cb4ded6cd1008f3 100644 --- a/.github/workflows/release-10_branchoff-stable.yml +++ b/.github/workflows/release-10_branchoff-stable.yml @@ -50,7 +50,7 @@ jobs: - name: Install pgpkkms run: | # Install pgpkms that is used to sign commits - pip install git+https://github.com/paritytech-release/pgpkms.git@5a8f82fbb607ea102d8c178e761659de54c7af69 + pip install git+https://github.com/paritytech-release/pgpkms.git@e7f806f99e9be5c52f0b4a536b7d4ef9c3e695ed - name: Generate content write token for the release automation id: generate_write_token diff --git a/.github/workflows/release-11_rc-automation.yml b/.github/workflows/release-11_rc-automation.yml index 0be671185c70c49209517f19490b4d22b2b2d1b4..ffd780d5f1dddb2dd6c162bc698475c0d53fcd45 100644 --- a/.github/workflows/release-11_rc-automation.yml +++ b/.github/workflows/release-11_rc-automation.yml @@ -34,7 +34,7 @@ jobs: - name: Install pgpkkms run: | # Install pgpkms that is used to sign commits - pip install git+https://github.com/paritytech-release/pgpkms.git@5a8f82fbb607ea102d8c178e761659de54c7af69 + pip install git+https://github.com/paritytech-release/pgpkms.git@e7f806f99e9be5c52f0b4a536b7d4ef9c3e695ed - name: Generate content write token for the release automation id: generate_write_token diff --git a/.github/workflows/release-40_publish-deb-package.yml b/.github/workflows/release-40_publish-deb-package.yml index 3c5411ab16f0281d638ca3c1981606b422fdc8ae..60ab1c7b729731b8ce3371e658441e2745f5d2fe 100644 --- a/.github/workflows/release-40_publish-deb-package.yml +++ b/.github/workflows/release-40_publish-deb-package.yml @@ -82,7 +82,7 @@ jobs: - name: Install pgpkkms run: | # Install pgpkms that is used to sign built artifacts - python3 -m pip install "pgpkms @ git+https://github.com/paritytech-release/pgpkms.git@1f8555426662ac93a3849480a35449f683b1c89f" + python3 -m pip install "pgpkms @ git+https://github.com/paritytech-release/pgpkms.git@e7f806f99e9be5c52f0b4a536b7d4ef9c3e695ed" echo "PGPKMS_REPREPRO_PATH=$(which pgpkms-reprepro)" >> $GITHUB_ENV - name: Install awscli diff --git a/.github/workflows/release-reusable-rc-buid.yml b/.github/workflows/release-reusable-rc-buid.yml index aea9cedba54fdf3b13742d779970ca534669ea43..a615826addce91be3e43dcdca7f2a78a0320de76 100644 --- a/.github/workflows/release-reusable-rc-buid.yml +++ b/.github/workflows/release-reusable-rc-buid.yml @@ -82,7 +82,7 @@ jobs: - name: Install pgpkkms run: | # Install pgpkms that is used to sign built artifacts - python3 -m pip install "pgpkms @ git+https://github.com/paritytech-release/pgpkms.git@5a8f82fbb607ea102d8c178e761659de54c7af69" + python3 -m pip install "pgpkms @ git+https://github.com/paritytech-release/pgpkms.git@e7f806f99e9be5c52f0b4a536b7d4ef9c3e695ed" which pgpkms - name: Checkout sources @@ -204,7 +204,7 @@ jobs: - name: Install pgpkkms run: | # Install pgpkms that is used to sign built artifacts - python3 -m pip install "pgpkms @ git+https://github.com/paritytech-release/pgpkms.git@5a8f82fbb607ea102d8c178e761659de54c7af69" --break-system-packages + python3 -m pip install "pgpkms @ git+https://github.com/paritytech-release/pgpkms.git@e7f806f99e9be5c52f0b4a536b7d4ef9c3e695ed" - name: Import gpg keys shell: bash diff --git a/Cargo.lock b/Cargo.lock index a110a6d0f4d718d45f27f47ea4ae0585416b10d6..817004c537e46de746212ef091710fc785e0f5cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12740,7 +12740,6 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hex", "hex-literal", "impl-trait-for-tuples", "log", diff --git a/bridges/bin/runtime-common/src/extensions.rs b/bridges/bin/runtime-common/src/extensions.rs index a8ae17d23128e63d49502561d25d7b830fe89fcf..9e27e01efa1e8677537cbdf25e302ac23e45906c 100644 --- a/bridges/bin/runtime-common/src/extensions.rs +++ b/bridges/bin/runtime-common/src/extensions.rs @@ -271,7 +271,7 @@ where #[macro_export] macro_rules! generate_bridge_reject_obsolete_headers_and_messages { ($call:ty, $account_id:ty, $($filter_call:ty),*) => { - #[derive(Clone, codec::Decode, Default, codec::Encode, Eq, PartialEq, sp_runtime::RuntimeDebug, scale_info::TypeInfo)] + #[derive(Clone, codec::Decode, codec::DecodeWithMemTracking, Default, codec::Encode, Eq, PartialEq, sp_runtime::RuntimeDebug, scale_info::TypeInfo)] pub struct BridgeRejectObsoleteHeadersAndMessages; impl sp_runtime::traits::TransactionExtension<$call> for BridgeRejectObsoleteHeadersAndMessages { const IDENTIFIER: &'static str = "BridgeRejectObsoleteHeadersAndMessages"; diff --git a/bridges/chains/chain-polkadot-bulletin/src/lib.rs b/bridges/chains/chain-polkadot-bulletin/src/lib.rs index 070bc7b0ba3d3804a3982d81296b7d7d72b06a62..e2067fa573227829b795d01148eab2ae5f21a592 100644 --- a/bridges/chains/chain-polkadot-bulletin/src/lib.rs +++ b/bridges/chains/chain-polkadot-bulletin/src/lib.rs @@ -29,7 +29,7 @@ use bp_runtime::{ }, Chain, ChainId, TransactionEra, }; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ dispatch::DispatchClass, parameter_types, @@ -91,7 +91,7 @@ pub type TransactionExtensionSchema = GenericTransactionExtension<( )>; /// Transaction extension, used by Polkadot Bulletin. -#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Debug, PartialEq, Eq, Clone, TypeInfo)] pub struct TransactionExtension(TransactionExtensionSchema); impl<C> sp_runtime::traits::TransactionExtension<C> for TransactionExtension diff --git a/bridges/modules/messages/src/tests/mock.rs b/bridges/modules/messages/src/tests/mock.rs index 8eebdf3a50817dd11936f2f3958272e4d0781c90..d824c2d765f51c043e9edb6a96261dd5c1baf77f 100644 --- a/bridges/modules/messages/src/tests/mock.rs +++ b/bridges/modules/messages/src/tests/mock.rs @@ -42,7 +42,7 @@ use bp_messages::{ use bp_runtime::{ messages::MessageDispatchResult, Chain, ChainId, Size, UnverifiedStorageProofParams, }; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ derive_impl, weights::{constants::RocksDbWeight, Weight}, @@ -58,7 +58,7 @@ use std::{collections::VecDeque, ops::RangeInclusive}; pub type AccountId = u64; pub type Balance = u64; -#[derive(Decode, Encode, Clone, Debug, PartialEq, Eq, TypeInfo)] +#[derive(Decode, DecodeWithMemTracking, Encode, Clone, Debug, PartialEq, Eq, TypeInfo)] pub struct TestPayload { /// Field that may be used to identify messages. pub id: u64, diff --git a/bridges/modules/relayers/src/extension/mod.rs b/bridges/modules/relayers/src/extension/mod.rs index 0f74b501495544984e05333c1910405aa9c13137..8d03a0db2e509a804404213445ca5f65b52dffe0 100644 --- a/bridges/modules/relayers/src/extension/mod.rs +++ b/bridges/modules/relayers/src/extension/mod.rs @@ -30,7 +30,7 @@ use bp_relayers::{ RewardsAccountOwner, RewardsAccountParams, }; use bp_runtime::{Chain, RangeInclusiveExt, StaticStrProvider}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::{fmt::Debug, marker::PhantomData}; use frame_support::{ dispatch::{DispatchInfo, PostDispatchInfo}, @@ -117,6 +117,7 @@ pub enum RelayerAccountAction<AccountId, RewardBalance, LaneId> { DefaultNoBound, CloneNoBound, Decode, + DecodeWithMemTracking, Encode, EqNoBound, PartialEqNoBound, diff --git a/bridges/primitives/runtime/src/extensions.rs b/bridges/primitives/runtime/src/extensions.rs index 25553f9c7b2e884511409b3804ea26b3a968cce0..4fe881ee4c339a9e475e4231a0e2770d430c2126 100644 --- a/bridges/primitives/runtime/src/extensions.rs +++ b/bridges/primitives/runtime/src/extensions.rs @@ -16,7 +16,7 @@ //! Primitives that may be used for creating signed extensions for indirect runtimes. -use codec::{Compact, Decode, Encode}; +use codec::{Compact, Decode, DecodeWithMemTracking, Encode}; use impl_trait_for_tuples::impl_for_tuples; use scale_info::{StaticTypeInfo, TypeInfo}; use sp_runtime::{ @@ -29,7 +29,7 @@ use sp_std::{fmt::Debug, marker::PhantomData}; /// Trait that describes some properties of a `TransactionExtension` that are needed in order to /// send a transaction to the chain. pub trait TransactionExtensionSchema: - Encode + Decode + Debug + Eq + Clone + StaticTypeInfo + Encode + Decode + DecodeWithMemTracking + Debug + Eq + Clone + StaticTypeInfo { /// A type of the data encoded as part of the transaction. type Payload: Encode + Decode + Debug + Eq + Clone + StaticTypeInfo; @@ -44,7 +44,7 @@ impl TransactionExtensionSchema for () { } /// An implementation of `TransactionExtensionSchema` using generic params. -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Debug, PartialEq, Eq, TypeInfo)] pub struct GenericTransactionExtensionSchema<P, S>(PhantomData<(P, S)>); impl<P, S> TransactionExtensionSchema for GenericTransactionExtensionSchema<P, S> @@ -104,7 +104,7 @@ impl TransactionExtensionSchema for Tuple { /// A simplified version of signed extensions meant for producing signed transactions /// and signed payloads in the client code. -#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Debug, PartialEq, Eq, Clone, TypeInfo)] pub struct GenericTransactionExtension<S: TransactionExtensionSchema> { /// A payload that is included in the transaction. pub payload: S::Payload, @@ -127,7 +127,7 @@ impl<S, C> TransactionExtension<C> for GenericTransactionExtension<S> where C: Dispatchable, S: TransactionExtensionSchema, - S::Payload: Send + Sync, + S::Payload: DecodeWithMemTracking + Send + Sync, S::Implicit: Send + Sync, { const IDENTIFIER: &'static str = "Not needed."; diff --git a/cumulus/client/consensus/aura/src/collators/lookahead.rs b/cumulus/client/consensus/aura/src/collators/lookahead.rs index 8427a40419986ebe4012b86001838718855ea460..17c4059b114662434bdcd770952c80b48a2a3c98 100644 --- a/cumulus/client/consensus/aura/src/collators/lookahead.rs +++ b/cumulus/client/consensus/aura/src/collators/lookahead.rs @@ -40,14 +40,14 @@ use cumulus_primitives_aura::AuraUnincludedSegmentApi; use cumulus_primitives_core::{ClaimQueueOffset, CollectCollationInfo, PersistedValidationData}; use cumulus_relay_chain_interface::RelayChainInterface; -use polkadot_node_primitives::{PoV, SubmitCollationParams}; +use polkadot_node_primitives::SubmitCollationParams; use polkadot_node_subsystem::messages::CollationGenerationMessage; use polkadot_overseer::Handle as OverseerHandle; use polkadot_primitives::{ - vstaging::DEFAULT_CLAIM_QUEUE_OFFSET, BlockNumber as RBlockNumber, CollatorPair, Hash as RHash, - HeadData, Id as ParaId, OccupiedCoreAssumption, + vstaging::DEFAULT_CLAIM_QUEUE_OFFSET, CollatorPair, Id as ParaId, OccupiedCoreAssumption, }; +use crate::{collator as collator_util, export_pov_to_path}; use futures::prelude::*; use sc_client_api::{backend::AuxStore, BlockBackend, BlockOf}; use sc_consensus::BlockImport; @@ -58,49 +58,8 @@ use sp_consensus_aura::{AuraApi, Slot}; use sp_core::crypto::Pair; use sp_inherents::CreateInherentDataProviders; use sp_keystore::KeystorePtr; -use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member, NumberFor}; -use std::{ - fs::{self, File}, - path::PathBuf, - sync::Arc, - time::Duration, -}; - -use crate::{collator as collator_util, LOG_TARGET}; - -/// Export the given `pov` to the file system at `path`. -/// -/// The file will be named `block_hash_block_number.pov`. -/// -/// The `parent_header`, `relay_parent_storage_root` and `relay_parent_number` will also be -/// stored in the file alongside the `pov`. This enables stateless validation of the `pov`. -fn export_pov_to_path<Block: BlockT>( - path: PathBuf, - pov: PoV, - block_hash: Block::Hash, - block_number: NumberFor<Block>, - parent_header: Block::Header, - relay_parent_storage_root: RHash, - relay_parent_number: RBlockNumber, -) { - if let Err(error) = fs::create_dir_all(&path) { - tracing::error!(target: LOG_TARGET, %error, path = %path.display(), "Failed to create PoV export directory"); - return - } - - let mut file = match File::create(path.join(format!("{block_hash:?}_{block_number}.pov"))) { - Ok(f) => f, - Err(error) => { - tracing::error!(target: LOG_TARGET, %error, "Failed to export PoV."); - return - }, - }; - - pov.encode_to(&mut file); - HeadData(parent_header.encode()).encode_to(&mut file); - relay_parent_storage_root.encode_to(&mut file); - relay_parent_number.encode_to(&mut file); -} +use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member}; +use std::{path::PathBuf, sync::Arc, time::Duration}; /// Parameters for [`run`]. pub struct Params<BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS> { diff --git a/cumulus/client/consensus/aura/src/collators/slot_based/collation_task.rs b/cumulus/client/consensus/aura/src/collators/slot_based/collation_task.rs index eb48494cf6dcda718061e8467b64b448da0fad3a..d92cfb044b836c6ba35dc92915b72cdeb622149a 100644 --- a/cumulus/client/consensus/aura/src/collators/slot_based/collation_task.rs +++ b/cumulus/client/consensus/aura/src/collators/slot_based/collation_task.rs @@ -16,6 +16,7 @@ // along with Cumulus. If not, see <https://www.gnu.org/licenses/>. use codec::Encode; +use std::path::PathBuf; use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface; use cumulus_relay_chain_interface::RelayChainInterface; @@ -25,8 +26,10 @@ use polkadot_node_subsystem::messages::CollationGenerationMessage; use polkadot_overseer::Handle as OverseerHandle; use polkadot_primitives::{CollatorPair, Id as ParaId}; +use cumulus_primitives_core::relay_chain::BlockId; use futures::prelude::*; +use crate::export_pov_to_path; use sc_utils::mpsc::TracingUnboundedReceiver; use sp_runtime::traits::{Block as BlockT, Header}; @@ -50,6 +53,8 @@ pub struct Params<Block: BlockT, RClient, CS> { pub collator_receiver: TracingUnboundedReceiver<CollatorMessage<Block>>, /// The handle from the special slot based block import. pub block_import_handle: super::SlotBasedBlockImportHandle<Block>, + /// When set, the collator will export every produced `POV` to this folder. + pub export_pov: Option<PathBuf>, } /// Asynchronously executes the collation task for a parachain. @@ -67,6 +72,7 @@ pub async fn run_collation_task<Block, RClient, CS>( collator_service, mut collator_receiver, mut block_import_handle, + export_pov, }: Params<Block, RClient, CS>, ) where Block: BlockT, @@ -93,7 +99,7 @@ pub async fn run_collation_task<Block, RClient, CS>( return; }; - handle_collation_message(message, &collator_service, &mut overseer_handle).await; + handle_collation_message(message, &collator_service, &mut overseer_handle,relay_client.clone(),export_pov.clone()).await; }, block_import_msg = block_import_handle.next().fuse() => { // TODO: Implement me. @@ -107,10 +113,12 @@ pub async fn run_collation_task<Block, RClient, CS>( /// Handle an incoming collation message from the block builder task. /// This builds the collation from the [`CollatorMessage`] and submits it to /// the collation-generation subsystem of the relay chain. -async fn handle_collation_message<Block: BlockT>( +async fn handle_collation_message<Block: BlockT, RClient: RelayChainInterface + Clone + 'static>( message: CollatorMessage<Block>, collator_service: &impl CollatorServiceInterface<Block>, overseer_handle: &mut OverseerHandle, + relay_client: RClient, + export_pov: Option<PathBuf>, ) { let CollatorMessage { parent_header, @@ -140,6 +148,24 @@ async fn handle_collation_message<Block: BlockT>( ); if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity { + if let Some(pov_path) = export_pov { + if let Ok(Some(relay_parent_header)) = + relay_client.header(BlockId::Hash(relay_parent)).await + { + export_pov_to_path::<Block>( + pov_path.clone(), + pov.clone(), + block_data.header().hash(), + *block_data.header().number(), + parent_header.clone(), + relay_parent_header.state_root, + relay_parent_header.number, + ); + } else { + tracing::error!(target: LOG_TARGET, "Failed to get relay parent header from hash: {relay_parent:?}"); + } + } + tracing::info!( target: LOG_TARGET, "Compressed PoV size: {}kb", diff --git a/cumulus/client/consensus/aura/src/collators/slot_based/mod.rs b/cumulus/client/consensus/aura/src/collators/slot_based/mod.rs index f72960fe4c2e1ba83638547b85f8873f482b81bd..6839b3882b2cba5e966dbd282e7f2ed8dbfedf44 100644 --- a/cumulus/client/consensus/aura/src/collators/slot_based/mod.rs +++ b/cumulus/client/consensus/aura/src/collators/slot_based/mod.rs @@ -54,7 +54,7 @@ use sp_core::{crypto::Pair, traits::SpawnNamed, U256}; use sp_inherents::CreateInherentDataProviders; use sp_keystore::KeystorePtr; use sp_runtime::traits::{Block as BlockT, Member, NumberFor, One}; -use std::{sync::Arc, time::Duration}; +use std::{path::PathBuf, sync::Arc, time::Duration}; pub use block_import::{SlotBasedBlockImport, SlotBasedBlockImportHandle}; @@ -100,28 +100,13 @@ pub struct Params<Block, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, pub block_import_handle: SlotBasedBlockImportHandle<Block>, /// Spawner for spawning futures. pub spawner: Spawner, + /// When set, the collator will export every produced `POV` to this folder. + pub export_pov: Option<PathBuf>, } /// Run aura-based block building and collation task. pub fn run<Block, P, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spawner>( - Params { - create_inherent_data_providers, - block_import, - para_client, - para_backend, - relay_client, - code_hash_provider, - keystore, - collator_key, - para_id, - proposer, - collator_service, - authoring_duration, - reinitialize, - slot_drift, - block_import_handle, - spawner, - }: Params<Block, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spawner>, + params: Params<Block, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spawner>, ) where Block: BlockT, Client: ProvideRuntimeApi<Block> @@ -148,6 +133,26 @@ pub fn run<Block, P, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spaw P::Signature: TryFrom<Vec<u8>> + Member + Codec, Spawner: SpawnNamed, { + let Params { + create_inherent_data_providers, + block_import, + para_client, + para_backend, + relay_client, + code_hash_provider, + keystore, + collator_key, + para_id, + proposer, + collator_service, + authoring_duration, + reinitialize, + slot_drift, + block_import_handle, + spawner, + export_pov, + } = params; + let (tx, rx) = tracing_unbounded("mpsc_builder_to_collator", 100); let collator_task_params = collation_task::Params { relay_client: relay_client.clone(), @@ -157,6 +162,7 @@ pub fn run<Block, P, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spaw collator_service: collator_service.clone(), collator_receiver: rx, block_import_handle, + export_pov, }; let collation_task_fut = run_collation_task::<Block, _, _>(collator_task_params); diff --git a/cumulus/client/consensus/aura/src/lib.rs b/cumulus/client/consensus/aura/src/lib.rs index 0e404541ab9a6099e8f69fdd38fd5743fa9b3c52..2e9b4b702344bea3434627493c69ef4c5e6440ac 100644 --- a/cumulus/client/consensus/aura/src/lib.rs +++ b/cumulus/client/consensus/aura/src/lib.rs @@ -23,13 +23,15 @@ //! //! For more information about AuRa, the Substrate crate should be checked. -use codec::Codec; +use codec::{Codec, Encode}; use cumulus_client_consensus_common::{ ParachainBlockImportMarker, ParachainCandidate, ParachainConsensus, }; use cumulus_primitives_core::{relay_chain::Hash as PHash, PersistedValidationData}; +use cumulus_primitives_core::relay_chain::HeadData; use futures::lock::Mutex; +use polkadot_primitives::{BlockNumber as RBlockNumber, Hash as RHash}; use sc_client_api::{backend::AuxStore, BlockOf}; use sc_consensus::BlockImport; use sc_consensus_slots::{BackoffAuthoringBlocksStrategy, SimpleSlotWorker, SlotInfo}; @@ -45,7 +47,10 @@ use sp_keystore::KeystorePtr; use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member, NumberFor}; use std::{ convert::TryFrom, + fs, + fs::File, marker::PhantomData, + path::PathBuf, sync::{ atomic::{AtomicU64, Ordering}, Arc, @@ -55,6 +60,7 @@ use std::{ mod import_queue; pub use import_queue::{build_verifier, import_queue, BuildVerifierParams, ImportQueueParams}; +use polkadot_node_primitives::PoV; pub use sc_consensus_aura::{ slot_duration, standalone::slot_duration_at, AuraVerifier, BuildAuraWorkerParams, SlotProportion, @@ -252,3 +258,37 @@ where Some(ParachainCandidate { block: res.block, proof: res.storage_proof }) } } + +/// Export the given `pov` to the file system at `path`. +/// +/// The file will be named `block_hash_block_number.pov`. +/// +/// The `parent_header`, `relay_parent_storage_root` and `relay_parent_number` will also be +/// stored in the file alongside the `pov`. This enables stateless validation of the `pov`. +pub(crate) fn export_pov_to_path<Block: BlockT>( + path: PathBuf, + pov: PoV, + block_hash: Block::Hash, + block_number: NumberFor<Block>, + parent_header: Block::Header, + relay_parent_storage_root: RHash, + relay_parent_number: RBlockNumber, +) { + if let Err(error) = fs::create_dir_all(&path) { + tracing::error!(target: LOG_TARGET, %error, path = %path.display(), "Failed to create PoV export directory"); + return + } + + let mut file = match File::create(path.join(format!("{block_hash:?}_{block_number}.pov"))) { + Ok(f) => f, + Err(error) => { + tracing::error!(target: LOG_TARGET, %error, "Failed to export PoV."); + return + }, + }; + + pov.encode_to(&mut file); + HeadData(parent_header.encode()).encode_to(&mut file); + relay_parent_storage_root.encode_to(&mut file); + relay_parent_number.encode_to(&mut file); +} diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs index 8e593816637d8a1cfc108087c2896e0632a87bcf..5252544f50505f22ef5cec18e5915c01f1213d07 100644 --- a/cumulus/pallets/weight-reclaim/src/lib.rs +++ b/cumulus/pallets/weight-reclaim/src/lib.rs @@ -27,7 +27,7 @@ extern crate alloc; #[cfg(not(feature = "std"))] use alloc::vec::Vec; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use cumulus_primitives_storage_weight_reclaim::get_proof_size; use derive_where::derive_where; use frame_support::{ @@ -83,7 +83,7 @@ pub mod pallet { /// calculates the unused weight using the post information and reclaim the unused weight. /// So this extension can be used as a drop-in replacement for `WeightReclaim` extension for /// parachains. -#[derive(Encode, Decode, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, TypeInfo)] #[derive_where(Clone, Eq, PartialEq, Default; S)] #[scale_info(skip_type_params(T))] pub struct StorageWeightReclaim<T, S>(pub S, core::marker::PhantomData<T>); diff --git a/cumulus/pallets/weight-reclaim/src/tests.rs b/cumulus/pallets/weight-reclaim/src/tests.rs index 711faa7eb5081b1aba12bb02698cc21e5fad4006..765ba868b40d3a745b0f2fc7a537b8169e3b4c81 100644 --- a/cumulus/pallets/weight-reclaim/src/tests.rs +++ b/cumulus/pallets/weight-reclaim/src/tests.rs @@ -36,7 +36,9 @@ thread_local! { } /// An extension which has some proof_size weight and some proof_size refund. -#[derive(Encode, Decode, Debug, Clone, PartialEq, Eq, scale_info::TypeInfo)] +#[derive( + Encode, Decode, DecodeWithMemTracking, Debug, Clone, PartialEq, Eq, scale_info::TypeInfo, +)] pub struct MockExtensionWithRefund; impl TransactionExtension<RuntimeCall> for MockExtensionWithRefund { diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_multisig.rs index 84308608601c710ecb3624d797fda1ae12d8592a..7b1bb6218c2fa9ec3f18a36d9b0e7ab59f01d52a 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `ef4134d66388`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_330_000 picoseconds. - Weight::from_parts(16_333_078, 0) + // Minimum execution time: 16_387_000 picoseconds. + Weight::from_parts(21_205_790, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(449, 0).saturating_mul(z.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(122, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `295 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 47_342_000 picoseconds. - Weight::from_parts(33_910_391, 0) + // Minimum execution time: 45_977_000 picoseconds. + Weight::from_parts(31_074_975, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_132 - .saturating_add(Weight::from_parts(151_947, 0).saturating_mul(s.into())) - // Standard Error: 11 - .saturating_add(Weight::from_parts(1_971, 0).saturating_mul(z.into())) + // Standard Error: 1_279 + .saturating_add(Weight::from_parts(167_034, 0).saturating_mul(s.into())) + // Standard Error: 12 + .saturating_add(Weight::from_parts(2_016, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `315` // Estimated: `6811` - // Minimum execution time: 31_233_000 picoseconds. - Weight::from_parts(19_737_939, 0) + // Minimum execution time: 30_756_000 picoseconds. + Weight::from_parts(19_173_288, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_153 - .saturating_add(Weight::from_parts(128_447, 0).saturating_mul(s.into())) - // Standard Error: 11 - .saturating_add(Weight::from_parts(1_961, 0).saturating_mul(z.into())) + // Standard Error: 2_175 + .saturating_add(Weight::from_parts(133_101, 0).saturating_mul(s.into())) + // Standard Error: 21 + .saturating_add(Weight::from_parts(1_981, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `418 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 53_727_000 picoseconds. - Weight::from_parts(38_115_851, 0) + // Minimum execution time: 52_118_000 picoseconds. + Weight::from_parts(33_785_281, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_528 - .saturating_add(Weight::from_parts(175_734, 0).saturating_mul(s.into())) - // Standard Error: 14 - .saturating_add(Weight::from_parts(1_955, 0).saturating_mul(z.into())) + // Standard Error: 2_722 + .saturating_add(Weight::from_parts(210_321, 0).saturating_mul(s.into())) + // Standard Error: 26 + .saturating_add(Weight::from_parts(2_186, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `296 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 30_194_000 picoseconds. - Weight::from_parts(33_135_268, 0) + // Minimum execution time: 29_905_000 picoseconds. + Weight::from_parts(32_174_112, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_801 - .saturating_add(Weight::from_parts(148_875, 0).saturating_mul(s.into())) + // Standard Error: 1_811 + .saturating_add(Weight::from_parts(157_665, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `315` // Estimated: `6811` - // Minimum execution time: 16_621_000 picoseconds. - Weight::from_parts(17_902_643, 0) + // Minimum execution time: 16_959_000 picoseconds. + Weight::from_parts(18_404_166, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 695 - .saturating_add(Weight::from_parts(138_028, 0).saturating_mul(s.into())) + // Standard Error: 1_122 + .saturating_add(Weight::from_parts(125_139, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `487 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 30_790_000 picoseconds. - Weight::from_parts(33_415_669, 0) + // Minimum execution time: 30_189_000 picoseconds. + Weight::from_parts(32_326_735, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_302 - .saturating_add(Weight::from_parts(150_462, 0).saturating_mul(s.into())) + // Standard Error: 1_644 + .saturating_add(Weight::from_parts(158_333, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `487 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 29_451_000 picoseconds. + Weight::from_parts(31_338_818, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_549 + .saturating_add(Weight::from_parts(147_032, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_multisig.rs index 1034b5713010c80cdf3657ea3a528a580f36631b..307b028844154b98af5f2cd3cb5592ac055b56b4 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `73b9817d6032`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_575_000 picoseconds. - Weight::from_parts(16_410_749, 0) + // Minimum execution time: 15_819_000 picoseconds. + Weight::from_parts(16_264_115, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 5 - .saturating_add(Weight::from_parts(453, 0).saturating_mul(z.into())) + // Standard Error: 23 + .saturating_add(Weight::from_parts(801, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `295 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 46_931_000 picoseconds. - Weight::from_parts(34_711_049, 0) + // Minimum execution time: 47_212_000 picoseconds. + Weight::from_parts(32_568_978, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_399 - .saturating_add(Weight::from_parts(141_679, 0).saturating_mul(s.into())) - // Standard Error: 13 - .saturating_add(Weight::from_parts(1_860, 0).saturating_mul(z.into())) + // Standard Error: 3_178 + .saturating_add(Weight::from_parts(154_052, 0).saturating_mul(s.into())) + // Standard Error: 31 + .saturating_add(Weight::from_parts(2_348, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `315` // Estimated: `6811` - // Minimum execution time: 30_369_000 picoseconds. - Weight::from_parts(19_149_593, 0) + // Minimum execution time: 32_417_000 picoseconds. + Weight::from_parts(17_400_688, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 869 - .saturating_add(Weight::from_parts(129_297, 0).saturating_mul(s.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_925, 0).saturating_mul(z.into())) + // Standard Error: 3_165 + .saturating_add(Weight::from_parts(149_105, 0).saturating_mul(s.into())) + // Standard Error: 30 + .saturating_add(Weight::from_parts(2_325, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `418 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 52_534_000 picoseconds. - Weight::from_parts(37_508_720, 0) + // Minimum execution time: 53_462_000 picoseconds. + Weight::from_parts(39_946_704, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_011 - .saturating_add(Weight::from_parts(173_577, 0).saturating_mul(s.into())) - // Standard Error: 19 - .saturating_add(Weight::from_parts(1_921, 0).saturating_mul(z.into())) + // Standard Error: 6_271 + .saturating_add(Weight::from_parts(180_027, 0).saturating_mul(s.into())) + // Standard Error: 61 + .saturating_add(Weight::from_parts(2_190, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `296 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 29_980_000 picoseconds. - Weight::from_parts(32_426_710, 0) + // Minimum execution time: 29_523_000 picoseconds. + Weight::from_parts(31_632_836, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_040 - .saturating_add(Weight::from_parts(146_066, 0).saturating_mul(s.into())) + // Standard Error: 2_330 + .saturating_add(Weight::from_parts(170_695, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `315` // Estimated: `6811` - // Minimum execution time: 16_810_000 picoseconds. - Weight::from_parts(17_531_771, 0) + // Minimum execution time: 17_471_000 picoseconds. + Weight::from_parts(18_501_369, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 632 - .saturating_add(Weight::from_parts(133_128, 0).saturating_mul(s.into())) + // Standard Error: 1_310 + .saturating_add(Weight::from_parts(132_081, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `487 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 30_372_000 picoseconds. - Weight::from_parts(32_450_346, 0) + // Minimum execution time: 30_715_000 picoseconds. + Weight::from_parts(32_330_651, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_115 - .saturating_add(Weight::from_parts(158_829, 0).saturating_mul(s.into())) + // Standard Error: 1_147 + .saturating_add(Weight::from_parts(152_071, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `487 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 29_011_000 picoseconds. + Weight::from_parts(30_639_580, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_876 + .saturating_add(Weight::from_parts(164_361, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_multisig.rs index 29b6c5d3520d51b8b51daee0882eb3b4a7304937..fd5a91243e4ff2885d169781a188f41c79f42cbf 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `814af52b0d43`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 16_259_000 picoseconds. - Weight::from_parts(16_833_085, 0) + // Minimum execution time: 16_528_000 picoseconds. + Weight::from_parts(17_737_513, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(428, 0).saturating_mul(z.into())) + // Standard Error: 10 + .saturating_add(Weight::from_parts(343, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `191 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 46_300_000 picoseconds. - Weight::from_parts(33_189_290, 0) + // Minimum execution time: 46_334_000 picoseconds. + Weight::from_parts(32_518_569, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_200 - .saturating_add(Weight::from_parts(145_862, 0).saturating_mul(s.into())) - // Standard Error: 11 - .saturating_add(Weight::from_parts(1_975, 0).saturating_mul(z.into())) + // Standard Error: 2_036 + .saturating_add(Weight::from_parts(159_802, 0).saturating_mul(s.into())) + // Standard Error: 19 + .saturating_add(Weight::from_parts(1_974, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `210` // Estimated: `6811` - // Minimum execution time: 31_157_000 picoseconds. - Weight::from_parts(18_729_817, 0) + // Minimum execution time: 30_787_000 picoseconds. + Weight::from_parts(20_678_818, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 900 - .saturating_add(Weight::from_parts(133_920, 0).saturating_mul(s.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_908, 0).saturating_mul(z.into())) + // Standard Error: 3_051 + .saturating_add(Weight::from_parts(126_496, 0).saturating_mul(s.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(1_831, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `316 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 56_207_000 picoseconds. - Weight::from_parts(40_455_538, 0) + // Minimum execution time: 56_718_000 picoseconds. + Weight::from_parts(31_282_377, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_336 - .saturating_add(Weight::from_parts(188_440, 0).saturating_mul(s.into())) - // Standard Error: 13 - .saturating_add(Weight::from_parts(1_952, 0).saturating_mul(z.into())) + // Standard Error: 4_467 + .saturating_add(Weight::from_parts(277_430, 0).saturating_mul(s.into())) + // Standard Error: 43 + .saturating_add(Weight::from_parts(2_675, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `191 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 30_711_000 picoseconds. - Weight::from_parts(31_958_424, 0) + // Minimum execution time: 30_946_000 picoseconds. + Weight::from_parts(35_834_019, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 967 - .saturating_add(Weight::from_parts(150_377, 0).saturating_mul(s.into())) + // Standard Error: 5_715 + .saturating_add(Weight::from_parts(195_084, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `210` // Estimated: `6811` - // Minimum execution time: 16_649_000 picoseconds. - Weight::from_parts(17_457_299, 0) + // Minimum execution time: 17_064_000 picoseconds. + Weight::from_parts(20_584_833, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 648 - .saturating_add(Weight::from_parts(134_465, 0).saturating_mul(s.into())) + // Standard Error: 3_539 + .saturating_add(Weight::from_parts(126_800, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `382 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 34_764_000 picoseconds. - Weight::from_parts(36_867_069, 0) + // Minimum execution time: 33_785_000 picoseconds. + Weight::from_parts(35_236_692, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_222 - .saturating_add(Weight::from_parts(148_156, 0).saturating_mul(s.into())) + // Standard Error: 1_223 + .saturating_add(Weight::from_parts(162_823, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `382 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 33_210_000 picoseconds. + Weight::from_parts(33_269_677, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_886 + .saturating_add(Weight::from_parts(183_458, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_multisig.rs index 713f2df84073a6919870f8e07ae39c53daa40127..bc9d5f5b9cb3badefe967aa6585748f6c681ad73 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `d3b41be4aae8`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 16_223_000 picoseconds. - Weight::from_parts(17_418_945, 0) + // Minimum execution time: 16_093_000 picoseconds. + Weight::from_parts(17_921_144, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 5 - .saturating_add(Weight::from_parts(460, 0).saturating_mul(z.into())) + // Standard Error: 13 + .saturating_add(Weight::from_parts(351, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `296 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 46_458_000 picoseconds. - Weight::from_parts(34_575_077, 0) + // Minimum execution time: 47_085_000 picoseconds. + Weight::from_parts(34_986_291, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_449 - .saturating_add(Weight::from_parts(149_463, 0).saturating_mul(s.into())) - // Standard Error: 14 - .saturating_add(Weight::from_parts(1_972, 0).saturating_mul(z.into())) + // Standard Error: 1_770 + .saturating_add(Weight::from_parts(152_332, 0).saturating_mul(s.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_863, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `315` // Estimated: `6811` - // Minimum execution time: 31_913_000 picoseconds. - Weight::from_parts(20_347_783, 0) + // Minimum execution time: 32_003_000 picoseconds. + Weight::from_parts(20_190_464, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_172 - .saturating_add(Weight::from_parts(129_870, 0).saturating_mul(s.into())) - // Standard Error: 11 - .saturating_add(Weight::from_parts(1_997, 0).saturating_mul(z.into())) + // Standard Error: 1_882 + .saturating_add(Weight::from_parts(135_952, 0).saturating_mul(s.into())) + // Standard Error: 18 + .saturating_add(Weight::from_parts(1_938, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `421 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 55_999_000 picoseconds. - Weight::from_parts(34_398_419, 0) + // Minimum execution time: 55_297_000 picoseconds. + Weight::from_parts(38_187_046, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_464 - .saturating_add(Weight::from_parts(280_544, 0).saturating_mul(s.into())) - // Standard Error: 24 - .saturating_add(Weight::from_parts(2_345, 0).saturating_mul(z.into())) + // Standard Error: 2_679 + .saturating_add(Weight::from_parts(239_841, 0).saturating_mul(s.into())) + // Standard Error: 26 + .saturating_add(Weight::from_parts(2_089, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `296 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 31_488_000 picoseconds. - Weight::from_parts(33_266_767, 0) + // Minimum execution time: 31_531_000 picoseconds. + Weight::from_parts(33_472_349, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_177 - .saturating_add(Weight::from_parts(157_330, 0).saturating_mul(s.into())) + // Standard Error: 1_885 + .saturating_add(Weight::from_parts(149_888, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `315` // Estimated: `6811` - // Minimum execution time: 17_787_000 picoseconds. - Weight::from_parts(18_877_731, 0) + // Minimum execution time: 17_099_000 picoseconds. + Weight::from_parts(17_601_456, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 988 - .saturating_add(Weight::from_parts(132_780, 0).saturating_mul(s.into())) + // Standard Error: 1_042 + .saturating_add(Weight::from_parts(146_267, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `487 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 32_081_000 picoseconds. - Weight::from_parts(34_416_316, 0) + // Minimum execution time: 31_776_000 picoseconds. + Weight::from_parts(33_572_763, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_380 - .saturating_add(Weight::from_parts(203_695, 0).saturating_mul(s.into())) + // Standard Error: 2_457 + .saturating_add(Weight::from_parts(202_712, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `487 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 30_123_000 picoseconds. + Weight::from_parts(32_415_361, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 2_652 + .saturating_add(Weight::from_parts(190_453, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_multisig.rs index b96aa715c197b8716f676e90ed2443235163f642..37b3f04eb0caaa2b901b25e5918f963f9931a01a 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `e0f303704c84`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_409_000 picoseconds. - Weight::from_parts(16_449_519, 0) + // Minimum execution time: 15_445_000 picoseconds. + Weight::from_parts(16_746_680, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 5 - .saturating_add(Weight::from_parts(421, 0).saturating_mul(z.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(438, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `328 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 46_429_000 picoseconds. - Weight::from_parts(34_234_681, 0) + // Minimum execution time: 48_846_000 picoseconds. + Weight::from_parts(34_395_780, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 963 - .saturating_add(Weight::from_parts(146_785, 0).saturating_mul(s.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(1_972, 0).saturating_mul(z.into())) + // Standard Error: 4_494 + .saturating_add(Weight::from_parts(222_389, 0).saturating_mul(s.into())) + // Standard Error: 44 + .saturating_add(Weight::from_parts(1_895, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `348` // Estimated: `6811` - // Minimum execution time: 30_926_000 picoseconds. - Weight::from_parts(19_639_350, 0) + // Minimum execution time: 30_576_000 picoseconds. + Weight::from_parts(18_763_978, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 897 - .saturating_add(Weight::from_parts(128_785, 0).saturating_mul(s.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_928, 0).saturating_mul(z.into())) + // Standard Error: 1_097 + .saturating_add(Weight::from_parts(140_137, 0).saturating_mul(s.into())) + // Standard Error: 10 + .saturating_add(Weight::from_parts(1_915, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `451 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 53_028_000 picoseconds. - Weight::from_parts(36_956_560, 0) + // Minimum execution time: 53_269_000 picoseconds. + Weight::from_parts(36_529_777, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_783 - .saturating_add(Weight::from_parts(181_010, 0).saturating_mul(s.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(2_046, 0).saturating_mul(z.into())) + // Standard Error: 2_752 + .saturating_add(Weight::from_parts(190_931, 0).saturating_mul(s.into())) + // Standard Error: 26 + .saturating_add(Weight::from_parts(2_136, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `329 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 30_323_000 picoseconds. - Weight::from_parts(32_859_436, 0) + // Minimum execution time: 30_485_000 picoseconds. + Weight::from_parts(32_275_917, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_250 - .saturating_add(Weight::from_parts(155_164, 0).saturating_mul(s.into())) + // Standard Error: 1_395 + .saturating_add(Weight::from_parts(163_554, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `348` // Estimated: `6811` - // Minimum execution time: 17_246_000 picoseconds. - Weight::from_parts(18_201_312, 0) + // Minimum execution time: 17_030_000 picoseconds. + Weight::from_parts(18_316_018, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 738 - .saturating_add(Weight::from_parts(126_646, 0).saturating_mul(s.into())) + // Standard Error: 1_407 + .saturating_add(Weight::from_parts(138_516, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `520 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 31_722_000 picoseconds. - Weight::from_parts(33_685_429, 0) + // Minimum execution time: 31_503_000 picoseconds. + Weight::from_parts(33_555_853, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_535 + .saturating_add(Weight::from_parts(143_177, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `520 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 29_729_000 picoseconds. + Weight::from_parts(31_737_165, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_141 - .saturating_add(Weight::from_parts(143_831, 0).saturating_mul(s.into())) + // Standard Error: 1_058 + .saturating_add(Weight::from_parts(140_714, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_parachain_system.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_parachain_system.rs deleted file mode 100644 index d1860f08bd464072153b95a6c5571454312d4feb..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_parachain_system.rs +++ /dev/null @@ -1,79 +0,0 @@ -// 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. - -//! Autogenerated weights for `cumulus_pallet_parachain_system` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=cumulus_pallet_parachain_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `cumulus_pallet_parachain_system`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> cumulus_pallet_parachain_system::WeightInfo for WeightInfo<T> { - /// Storage: `ParachainSystem::LastDmqMqcHead` (r:1 w:1) - /// Proof: `ParachainSystem::LastDmqMqcHead` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) - /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ProcessedDownwardMessages` (r:0 w:1) - /// Proof: `ParachainSystem::ProcessedDownwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `MessageQueue::Pages` (r:0 w:1000) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(105521), added: 107996, mode: `MaxEncodedLen`) - /// The range of component `n` is `[0, 1000]`. - fn enqueue_inbound_downward_messages(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3517` - // Minimum execution time: 1_041_000 picoseconds. - Weight::from_parts(1_085_000, 0) - .saturating_add(Weight::from_parts(0, 3517)) - // Standard Error: 51_499 - .saturating_add(Weight::from_parts(351_831_616, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs deleted file mode 100644 index 8a60d3901bfeab9295abc466ff3b98bb9dba50cf..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/cumulus_pallet_weight_reclaim.rs +++ /dev/null @@ -1,63 +0,0 @@ -// 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. - -//! Autogenerated weights for `cumulus_pallet_weight_reclaim` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=cumulus_pallet_weight_reclaim -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `cumulus_pallet_weight_reclaim`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> cumulus_pallet_weight_reclaim::WeightInfo for WeightInfo<T> { - fn storage_weight_reclaim() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_407_000 picoseconds. - Weight::from_parts(3_508_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs deleted file mode 100644 index fed65d0063ae33abe53dc15c47a53b703789cfbb..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system.rs +++ /dev/null @@ -1,189 +0,0 @@ -// 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. - -//! Autogenerated weights for `frame_system` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=frame_system -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `frame_system`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> { - /// The range of component `b` is `[0, 3932160]`. - fn remark(b: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_587_000 picoseconds. - Weight::from_parts(1_663_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 158 - .saturating_add(Weight::from_parts(13_997, 0).saturating_mul(b.into())) - } - /// The range of component `b` is `[0, 3932160]`. - fn remark_with_event(b: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_768_000 picoseconds. - Weight::from_parts(4_833_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 158 - .saturating_add(Weight::from_parts(15_301, 0).saturating_mul(b.into())) - } - /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) - /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) - fn set_heap_pages() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_602_000 picoseconds. - Weight::from_parts(2_806_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn set_code() -> Weight { - // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `1591` - // Minimum execution time: 183_909_339_000 picoseconds. - Weight::from_parts(186_712_921_000, 0) - .saturating_add(Weight::from_parts(0, 1591)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `i` is `[0, 1000]`. - fn set_storage(i: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_620_000 picoseconds. - Weight::from_parts(1_651_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_491 - .saturating_add(Weight::from_parts(719_102, 0).saturating_mul(i.into())) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `i` is `[0, 1000]`. - fn kill_storage(i: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_579_000 picoseconds. - Weight::from_parts(1_624_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_039 - .saturating_add(Weight::from_parts(564_698, 0).saturating_mul(i.into())) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `p` is `[0, 1000]`. - fn kill_prefix(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `4 + p * (69 ±0)` - // Estimated: `0 + p * (69 ±0)` - // Minimum execution time: 2_843_000 picoseconds. - Weight::from_parts(2_977_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_314 - .saturating_add(Weight::from_parts(1_316_608, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 69).saturating_mul(p.into())) - } - /// Storage: `System::AuthorizedUpgrade` (r:0 w:1) - /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - fn authorize_upgrade() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 8_803_000 picoseconds. - Weight::from_parts(9_155_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) - /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) - /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) - /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) - /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) - /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) - /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) - /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn apply_authorized_upgrade() -> Weight { - // Proof Size summary in bytes: - // Measured: `127` - // Estimated: `1612` - // Minimum execution time: 186_274_577_000 picoseconds. - Weight::from_parts(188_440_013_000, 0) - .saturating_add(Weight::from_parts(0, 1612)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs deleted file mode 100644 index 3973e2c3d179a21b1490f75bacd9adaff0cc961f..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/frame_system_extensions.rs +++ /dev/null @@ -1,131 +0,0 @@ -// 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. - -//! Autogenerated weights for `frame_system_extensions` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=frame_system_extensions -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `frame_system_extensions`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> frame_system::ExtensionsWeightInfo for WeightInfo<T> { - fn check_genesis() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_639_000 picoseconds. - Weight::from_parts(1_697_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn check_mortality_mortal_transaction() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_707_000 picoseconds. - Weight::from_parts(3_824_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn check_mortality_immortal_transaction() -> Weight { - // Proof Size summary in bytes: - // Measured: `14` - // Estimated: `0` - // Minimum execution time: 4_631_000 picoseconds. - Weight::from_parts(4_829_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn check_non_zero_sender() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 456_000 picoseconds. - Weight::from_parts(526_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn check_nonce() -> Weight { - // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `3593` - // Minimum execution time: 4_873_000 picoseconds. - Weight::from_parts(5_102_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn check_spec_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 385_000 picoseconds. - Weight::from_parts(399_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn check_tx_version() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 346_000 picoseconds. - Weight::from_parts(394_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn check_weight() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_298_000 picoseconds. - Weight::from_parts(3_438_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn weight_reclaim() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_935_000 picoseconds. - Weight::from_parts(2_010_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_balances.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_balances.rs deleted file mode 100644 index 07a5acde40bb2aae63c85a1f6bbb68224cf14f9b..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_balances.rs +++ /dev/null @@ -1,179 +0,0 @@ -// 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. - -//! Autogenerated weights for `pallet_balances` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=pallet_balances -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_balances`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> { - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn transfer_allow_death() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3593` - // Minimum execution time: 47_587_000 picoseconds. - Weight::from_parts(48_280_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// 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: `0` - // Estimated: `3593` - // Minimum execution time: 38_136_000 picoseconds. - Weight::from_parts(38_927_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn force_set_balance_creating() -> Weight { - // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `3593` - // Minimum execution time: 12_239_000 picoseconds. - Weight::from_parts(12_604_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn force_set_balance_killing() -> Weight { - // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `3593` - // Minimum execution time: 19_247_000 picoseconds. - Weight::from_parts(19_660_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn force_transfer() -> Weight { - // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `6196` - // Minimum execution time: 48_715_000 picoseconds. - Weight::from_parts(49_784_000, 0) - .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// 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: 47_448_000 picoseconds. - Weight::from_parts(48_363_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn force_unreserve() -> Weight { - // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `3593` - // Minimum execution time: 15_386_000 picoseconds. - Weight::from_parts(15_778_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `System::Account` (r:999 w:999) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `u` is `[1, 1000]`. - fn upgrade_accounts(u: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0 + u * (136 ±0)` - // Estimated: `990 + u * (2603 ±0)` - // Minimum execution time: 14_618_000 picoseconds. - Weight::from_parts(14_816_000, 0) - .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 11_806 - .saturating_add(Weight::from_parts(14_658_653, 0).saturating_mul(u.into())) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) - .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) - } - fn force_adjust_total_issuance() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 5_098_000 picoseconds. - Weight::from_parts(5_381_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn burn_allow_death() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 29_435_000 picoseconds. - Weight::from_parts(29_987_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn burn_keep_alive() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 20_093_000 picoseconds. - Weight::from_parts(20_623_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_collator_selection.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_collator_selection.rs deleted file mode 100644 index e290e2fe1e53803d6307ec120ef10b4c5edf0980..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_collator_selection.rs +++ /dev/null @@ -1,282 +0,0 @@ -// 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. - -//! Autogenerated weights for `pallet_collator_selection` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=pallet_collator_selection -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_collator_selection`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> { - /// Storage: `Session::NextKeys` (r:20 w:0) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `CollatorSelection::Invulnerables` (r:0 w:1) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) - /// The range of component `b` is `[1, 20]`. - fn set_invulnerables(b: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `41 + b * (79 ±0)` - // Estimated: `1030 + b * (2554 ±0)` - // Minimum execution time: 9_970_000 picoseconds. - Weight::from_parts(6_811_549, 0) - .saturating_add(Weight::from_parts(0, 1030)) - // Standard Error: 9_340 - .saturating_add(Weight::from_parts(4_092_958, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) - } - /// Storage: `Session::NextKeys` (r:1 w:0) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) - /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `b` is `[1, 19]`. - /// The range of component `c` is `[1, 99]`. - fn add_invulnerable(b: u32, c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `623 + b * (32 ±0) + c * (53 ±0)` - // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` - // Minimum execution time: 44_284_000 picoseconds. - Weight::from_parts(44_913_672, 0) - .saturating_add(Weight::from_parts(0, 6287)) - // Standard Error: 10_427 - .saturating_add(Weight::from_parts(133_492, 0).saturating_mul(b.into())) - // Standard Error: 1_976 - .saturating_add(Weight::from_parts(144_419, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) - } - /// Storage: `CollatorSelection::CandidateList` (r:1 w:0) - /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) - /// The range of component `b` is `[2, 20]`. - fn remove_invulnerable(b: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `8 + b * (32 ±0)` - // Estimated: `6287` - // Minimum execution time: 10_016_000 picoseconds. - Weight::from_parts(10_124_278, 0) - .saturating_add(Weight::from_parts(0, 6287)) - // Standard Error: 1_457 - .saturating_add(Weight::from_parts(150_553, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1) - /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - fn set_desired_candidates() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_133_000 picoseconds. - Weight::from_parts(4_354_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:1) - /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) - /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:100 w:100) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:100) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - /// The range of component `c` is `[0, 100]`. - /// The range of component `k` is `[0, 100]`. - fn set_candidacy_bond(c: u32, k: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0 + c * (180 ±0) + k * (112 ±0)` - // Estimated: `6287 + c * (901 ±29) + k * (901 ±29)` - // Minimum execution time: 8_827_000 picoseconds. - Weight::from_parts(9_194_000, 0) - .saturating_add(Weight::from_parts(0, 6287)) - // Standard Error: 176_244 - .saturating_add(Weight::from_parts(5_973_083, 0).saturating_mul(c.into())) - // Standard Error: 176_244 - .saturating_add(Weight::from_parts(5_604_851, 0).saturating_mul(k.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) - .saturating_add(Weight::from_parts(0, 901).saturating_mul(c.into())) - .saturating_add(Weight::from_parts(0, 901).saturating_mul(k.into())) - } - /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) - /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) - /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) - /// The range of component `c` is `[2, 100]`. - fn update_bond(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `221 + c * (49 ±0)` - // Estimated: `6287` - // Minimum execution time: 26_598_000 picoseconds. - Weight::from_parts(29_925_480, 0) - .saturating_add(Weight::from_parts(0, 6287)) - // Standard Error: 2_047 - .saturating_add(Weight::from_parts(143_639, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) - /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) - /// Storage: `Session::NextKeys` (r:1 w:0) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) - /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - /// The range of component `c` is `[1, 99]`. - fn register_as_candidate(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `528 + c * (52 ±0)` - // Estimated: `6287 + c * (54 ±0)` - // Minimum execution time: 33_828_000 picoseconds. - Weight::from_parts(39_373_178, 0) - .saturating_add(Weight::from_parts(0, 6287)) - // Standard Error: 2_744 - .saturating_add(Weight::from_parts(172_026, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into())) - } - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) - /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `Session::NextKeys` (r:1 w:0) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) - /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:2) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - /// The range of component `c` is `[2, 100]`. - fn take_candidate_slot(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `657 + c * (53 ±0)` - // Estimated: `6287 + c * (55 ±0)` - // Minimum execution time: 50_767_000 picoseconds. - Weight::from_parts(56_932_944, 0) - .saturating_add(Weight::from_parts(0, 6287)) - // Standard Error: 3_561 - .saturating_add(Weight::from_parts(188_764, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(Weight::from_parts(0, 55).saturating_mul(c.into())) - } - /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) - /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - /// The range of component `c` is `[2, 100]`. - fn leave_intent(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `202 + c * (48 ±0)` - // Estimated: `6287` - // Minimum execution time: 28_366_000 picoseconds. - Weight::from_parts(32_664_626, 0) - .saturating_add(Weight::from_parts(0, 6287)) - // Standard Error: 2_706 - .saturating_add(Weight::from_parts(157_539, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - fn note_author() -> Weight { - // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `6196` - // Minimum execution time: 40_636_000 picoseconds. - Weight::from_parts(41_340_000, 0) - .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `CollatorSelection::CandidateList` (r:1 w:0) - /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:100 w:0) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0) - /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:97 w:97) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 100]`. - /// The range of component `c` is `[1, 100]`. - fn new_session(r: u32, c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `2045 + c * (97 ±0) + r * (112 ±0)` - // Estimated: `6287 + c * (2519 ±0) + r * (2603 ±0)` - // Minimum execution time: 15_976_000 picoseconds. - Weight::from_parts(16_203_000, 0) - .saturating_add(Weight::from_parts(0, 6287)) - // Standard Error: 311_393 - .saturating_add(Weight::from_parts(14_019_707, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) - .saturating_add(Weight::from_parts(0, 2603).saturating_mul(r.into())) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_contracts.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_contracts.rs deleted file mode 100644 index d34c36fa98e9bd5974f5c35161b4c37847c774f8..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_contracts.rs +++ /dev/null @@ -1,1122 +0,0 @@ -// 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. - -//! Autogenerated weights for `pallet_contracts` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=pallet_contracts -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_contracts`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> pallet_contracts::WeightInfo for WeightInfo<T> { - /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:0) - /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - fn on_process_deletion_queue_batch() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1485` - // Minimum execution time: 677_000 picoseconds. - Weight::from_parts(708_000, 0) - .saturating_add(Weight::from_parts(0, 1485)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `k` is `[0, 1024]`. - fn on_initialize_per_trie_key(k: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `224 + k * (69 ±0)` - // Estimated: `216 + k * (70 ±0)` - // Minimum execution time: 11_923_000 picoseconds. - Weight::from_parts(12_178_000, 0) - .saturating_add(Weight::from_parts(0, 216)) - // Standard Error: 2_247 - .saturating_add(Weight::from_parts(1_316_320, 0).saturating_mul(k.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) - .saturating_add(Weight::from_parts(0, 70).saturating_mul(k.into())) - } - /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553022fca90611ba8b7942f8bdb3b97f6580` (r:2 w:1) - /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553022fca90611ba8b7942f8bdb3b97f6580` (r:2 w:1) - /// The range of component `c` is `[0, 125952]`. - fn v9_migration_step(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `49 + c * (1 ±0)` - // Estimated: `5987 + c * (1 ±0)` - // Minimum execution time: 5_746_000 picoseconds. - Weight::from_parts(5_920_000, 0) - .saturating_add(Weight::from_parts(0, 5987)) - // Standard Error: 6 - .saturating_add(Weight::from_parts(1_987, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) - } - /// Storage: `Contracts::ContractInfoOf` (r:2 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:0) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - fn v10_migration_step() -> Weight { - // Proof Size summary in bytes: - // Measured: `374` - // Estimated: `6314` - // Minimum execution time: 16_573_000 picoseconds. - Weight::from_parts(17_052_000, 0) - .saturating_add(Weight::from_parts(0, 6314)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Contracts::DeletionQueue` (r:1 w:1025) - /// Proof: `Contracts::DeletionQueue` (`max_values`: None, `max_size`: Some(142), added: 2617, mode: `Measured`) - /// Storage: `Contracts::DeletionQueueCounter` (r:0 w:1) - /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// The range of component `k` is `[0, 1024]`. - fn v11_migration_step(k: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `9 + k * (1 ±0)` - // Estimated: `3473 + k * (1 ±0)` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_397_000, 0) - .saturating_add(Weight::from_parts(0, 3473)) - // Standard Error: 992 - .saturating_add(Weight::from_parts(1_081_705, 0).saturating_mul(k.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(k.into())) - } - /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553053f13fd319a03c211337c76e0fe776df` (r:2 w:0) - /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553053f13fd319a03c211337c76e0fe776df` (r:2 w:0) - /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553022fca90611ba8b7942f8bdb3b97f6580` (r:1 w:1) - /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553022fca90611ba8b7942f8bdb3b97f6580` (r:1 w:1) - /// Storage: `System::Account` (r:1 w:0) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:0 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// The range of component `c` is `[0, 125952]`. - fn v12_migration_step(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `188 + c * (1 ±0)` - // Estimated: `6126 + c * (1 ±0)` - // Minimum execution time: 14_874_000 picoseconds. - Weight::from_parts(2_186_796, 0) - .saturating_add(Weight::from_parts(0, 6126)) - // Standard Error: 9 - .saturating_add(Weight::from_parts(1_013, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) - } - /// Storage: `Contracts::ContractInfoOf` (r:2 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - fn v13_migration_step() -> Weight { - // Proof Size summary in bytes: - // Measured: `303` - // Estimated: `6243` - // Minimum execution time: 12_203_000 picoseconds. - Weight::from_parts(12_758_000, 0) - .saturating_add(Weight::from_parts(0, 6243)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Contracts::CodeInfoOf` (r:2 w:0) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - /// Storage: `Balances::Holds` (r:1 w:0) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) - fn v14_migration_step() -> Weight { - // Proof Size summary in bytes: - // Measured: `139` - // Estimated: `6079` - // Minimum execution time: 41_809_000 picoseconds. - Weight::from_parts(42_696_000, 0) - .saturating_add(Weight::from_parts(0, 6079)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Contracts::ContractInfoOf` (r:2 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `System::Account` (r:2 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - fn v15_migration_step() -> Weight { - // Proof Size summary in bytes: - // Measured: `407` - // Estimated: `6347` - // Minimum execution time: 40_894_000 picoseconds. - Weight::from_parts(42_048_000, 0) - .saturating_add(Weight::from_parts(0, 6347)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Contracts::ContractInfoOf` (r:2 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - fn v16_migration_step() -> Weight { - // Proof Size summary in bytes: - // Measured: `272` - // Estimated: `6212` - // Minimum execution time: 11_467_000 picoseconds. - Weight::from_parts(12_092_000, 0) - .saturating_add(Weight::from_parts(0, 6212)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:1) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - fn migration_noop() -> Weight { - // Proof Size summary in bytes: - // Measured: `6` - // Estimated: `1491` - // Minimum execution time: 1_848_000 picoseconds. - Weight::from_parts(1_949_000, 0) - .saturating_add(Weight::from_parts(0, 1491)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:1) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:1) - /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:1) - fn migrate() -> Weight { - // Proof Size summary in bytes: - // Measured: `29` - // Estimated: `3494` - // Minimum execution time: 9_507_000 picoseconds. - Weight::from_parts(9_983_000, 0) - .saturating_add(Weight::from_parts(0, 3494)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) - /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) - fn on_runtime_upgrade_noop() -> Weight { - // Proof Size summary in bytes: - // Measured: `6` - // Estimated: `3471` - // Minimum execution time: 3_186_000 picoseconds. - Weight::from_parts(3_304_000, 0) - .saturating_add(Weight::from_parts(0, 3471)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) - /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - fn on_runtime_upgrade_in_progress() -> Weight { - // Proof Size summary in bytes: - // Measured: `30` - // Estimated: `3495` - // Minimum execution time: 4_844_000 picoseconds. - Weight::from_parts(5_047_000, 0) - .saturating_add(Weight::from_parts(0, 3495)) - .saturating_add(T::DbWeight::get().reads(2)) - } - /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) - /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) - /// Storage: `Contracts::MigrationInProgress` (r:1 w:1) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - fn on_runtime_upgrade() -> Weight { - // Proof Size summary in bytes: - // Measured: `6` - // Estimated: `3471` - // Minimum execution time: 4_412_000 picoseconds. - Weight::from_parts(4_652_000, 0) - .saturating_add(Weight::from_parts(0, 3471)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:1 w:0) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - /// The range of component `c` is `[0, 125952]`. - fn call_with_code_per_byte(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `460 + c * (1 ±0)` - // Estimated: `3930 + c * (1 ±0)` - // Minimum execution time: 333_060_000 picoseconds. - Weight::from_parts(330_280_046, 0) - .saturating_add(Weight::from_parts(0, 3930)) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_327, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Balances::Holds` (r:2 w:2) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) - /// Storage: `Contracts::Nonce` (r:1 w:1) - /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:0 w:1) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - /// The range of component `c` is `[0, 125952]`. - /// The range of component `i` is `[0, 1048576]`. - /// The range of component `s` is `[0, 1048576]`. - fn instantiate_with_code(c: u32, i: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `5940` - // Minimum execution time: 13_954_246_000 picoseconds. - Weight::from_parts(136_160_290, 0) - .saturating_add(Weight::from_parts(0, 5940)) - // Standard Error: 355 - .saturating_add(Weight::from_parts(44_045, 0).saturating_mul(c.into())) - // Standard Error: 42 - .saturating_add(Weight::from_parts(7_158, 0).saturating_mul(i.into())) - // Standard Error: 42 - .saturating_add(Weight::from_parts(7_260, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(7)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:1 w:0) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - /// Storage: `Contracts::Nonce` (r:1 w:1) - /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) - /// The range of component `i` is `[0, 1048576]`. - /// The range of component `s` is `[0, 1048576]`. - fn instantiate(i: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `205` - // Estimated: `3670` - // Minimum execution time: 7_143_134_000 picoseconds. - Weight::from_parts(7_149_888_000, 0) - .saturating_add(Weight::from_parts(0, 3670)) - // Standard Error: 85 - .saturating_add(Weight::from_parts(1_825, 0).saturating_mul(i.into())) - // Standard Error: 85 - .saturating_add(Weight::from_parts(2_089, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(5)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:1 w:0) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - fn call() -> Weight { - // Proof Size summary in bytes: - // Measured: `524` - // Estimated: `3989` - // Minimum execution time: 178_855_000 picoseconds. - Weight::from_parts(181_879_000, 0) - .saturating_add(Weight::from_parts(0, 3989)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:0 w:1) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - /// The range of component `c` is `[0, 125952]`. - fn upload_code_determinism_enforced(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3465` - // Minimum execution time: 311_535_000 picoseconds. - Weight::from_parts(319_240_645, 0) - .saturating_add(Weight::from_parts(0, 3465)) - // Standard Error: 48 - .saturating_add(Weight::from_parts(50_589, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:0 w:1) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - /// The range of component `c` is `[0, 125952]`. - fn upload_code_determinism_relaxed(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3465` - // Minimum execution time: 322_133_000 picoseconds. - Weight::from_parts(337_225_781, 0) - .saturating_add(Weight::from_parts(0, 3465)) - // Standard Error: 46 - .saturating_add(Weight::from_parts(50_419, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:0 w:1) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - fn remove_code() -> Weight { - // Proof Size summary in bytes: - // Measured: `175` - // Estimated: `3640` - // Minimum execution time: 40_976_000 picoseconds. - Weight::from_parts(41_828_000, 0) - .saturating_add(Weight::from_parts(0, 3640)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) - /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) - /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:2 w:2) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - fn set_code() -> Weight { - // Proof Size summary in bytes: - // Measured: `415` - // Estimated: `6355` - // Minimum execution time: 26_973_000 picoseconds. - Weight::from_parts(27_707_000, 0) - .saturating_add(Weight::from_parts(0, 6355)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// The range of component `r` is `[0, 1600]`. - fn noop_host_fn(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 9_379_000 picoseconds. - Weight::from_parts(9_989_943, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 162 - .saturating_add(Weight::from_parts(53_008, 0).saturating_mul(r.into())) - } - fn seal_caller() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 712_000 picoseconds. - Weight::from_parts(752_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - fn seal_is_contract() -> Weight { - // Proof Size summary in bytes: - // Measured: `217` - // Estimated: `3682` - // Minimum execution time: 8_059_000 picoseconds. - Weight::from_parts(8_298_000, 0) - .saturating_add(Weight::from_parts(0, 3682)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - fn seal_code_hash() -> Weight { - // Proof Size summary in bytes: - // Measured: `310` - // Estimated: `3775` - // Minimum execution time: 9_127_000 picoseconds. - Weight::from_parts(9_646_000, 0) - .saturating_add(Weight::from_parts(0, 3775)) - .saturating_add(T::DbWeight::get().reads(1)) - } - fn seal_own_code_hash() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 880_000 picoseconds. - Weight::from_parts(970_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_caller_is_origin() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 405_000 picoseconds. - Weight::from_parts(467_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_caller_is_root() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 363_000 picoseconds. - Weight::from_parts(402_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_address() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 704_000 picoseconds. - Weight::from_parts(763_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_gas_left() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 725_000 picoseconds. - Weight::from_parts(794_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_balance() -> Weight { - // Proof Size summary in bytes: - // Measured: `101` - // Estimated: `0` - // Minimum execution time: 4_701_000 picoseconds. - Weight::from_parts(4_816_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_value_transferred() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 654_000 picoseconds. - Weight::from_parts(730_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_minimum_balance() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 712_000 picoseconds. - Weight::from_parts(744_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_block_number() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 692_000 picoseconds. - Weight::from_parts(733_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_now() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 687_000 picoseconds. - Weight::from_parts(742_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_weight_to_fee() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_839_000 picoseconds. - Weight::from_parts(1_965_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// The range of component `n` is `[0, 1048572]`. - fn seal_input(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 560_000 picoseconds. - Weight::from_parts(474_353, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(149, 0).saturating_mul(n.into())) - } - /// The range of component `n` is `[0, 1048572]`. - fn seal_return(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 373_000 picoseconds. - Weight::from_parts(120_996, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(298, 0).saturating_mul(n.into())) - } - /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) - /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:33 w:33) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Contracts::DeletionQueue` (r:0 w:1) - /// Proof: `Contracts::DeletionQueue` (`max_values`: None, `max_size`: Some(142), added: 2617, mode: `Measured`) - /// The range of component `n` is `[0, 32]`. - fn seal_terminate(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `182 + n * (78 ±0)` - // Estimated: `3647 + n * (2553 ±0)` - // Minimum execution time: 15_218_000 picoseconds. - Weight::from_parts(15_465_565, 0) - .saturating_add(Weight::from_parts(0, 3647)) - // Standard Error: 9_791 - .saturating_add(Weight::from_parts(4_517_806, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2553).saturating_mul(n.into())) - } - /// Storage: `RandomnessCollectiveFlip::RandomMaterial` (r:1 w:0) - /// Proof: `RandomnessCollectiveFlip::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `Measured`) - fn seal_random() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1485` - // Minimum execution time: 2_366_000 picoseconds. - Weight::from_parts(2_486_000, 0) - .saturating_add(Weight::from_parts(0, 1485)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `System::EventTopics` (r:4 w:4) - /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `t` is `[0, 4]`. - /// The range of component `n` is `[0, 16384]`. - fn seal_deposit_event(t: u32, n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_833_000 picoseconds. - Weight::from_parts(4_131_920, 0) - .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 5_589 - .saturating_add(Weight::from_parts(2_206_348, 0).saturating_mul(t.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(18, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) - .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) - } - /// The range of component `i` is `[0, 1048576]`. - fn seal_debug_message(i: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 490_000 picoseconds. - Weight::from_parts(758_018, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(809, 0).saturating_mul(i.into())) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn get_storage_empty() -> Weight { - // Proof Size summary in bytes: - // Measured: `16522` - // Estimated: `16522` - // Minimum execution time: 13_108_000 picoseconds. - Weight::from_parts(13_393_000, 0) - .saturating_add(Weight::from_parts(0, 16522)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn get_storage_full() -> Weight { - // Proof Size summary in bytes: - // Measured: `26532` - // Estimated: `26532` - // Minimum execution time: 53_184_000 picoseconds. - Weight::from_parts(54_178_000, 0) - .saturating_add(Weight::from_parts(0, 26532)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_storage_empty() -> Weight { - // Proof Size summary in bytes: - // Measured: `16522` - // Estimated: `16522` - // Minimum execution time: 15_092_000 picoseconds. - Weight::from_parts(15_359_000, 0) - .saturating_add(Weight::from_parts(0, 16522)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_storage_full() -> Weight { - // Proof Size summary in bytes: - // Measured: `26532` - // Estimated: `26532` - // Minimum execution time: 56_785_000 picoseconds. - Weight::from_parts(58_278_000, 0) - .saturating_add(Weight::from_parts(0, 26532)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 16384]`. - /// The range of component `o` is `[0, 16384]`. - fn seal_set_storage(n: u32, o: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `154 + o * (1 ±0)` - // Estimated: `153 + o * (1 ±0)` - // Minimum execution time: 9_423_000 picoseconds. - Weight::from_parts(8_255_134, 0) - .saturating_add(Weight::from_parts(0, 153)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(351, 0).saturating_mul(n.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(107, 0).saturating_mul(o.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 16384]`. - fn seal_clear_storage(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `152 + n * (1 ±0)` - // Estimated: `152 + n * (1 ±0)` - // Minimum execution time: 6_118_000 picoseconds. - Weight::from_parts(7_673_108, 0) - .saturating_add(Weight::from_parts(0, 152)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(126, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 16384]`. - fn seal_get_storage(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `152 + n * (1 ±0)` - // Estimated: `152 + n * (1 ±0)` - // Minimum execution time: 5_831_000 picoseconds. - Weight::from_parts(7_639_088, 0) - .saturating_add(Weight::from_parts(0, 152)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(604, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 16384]`. - fn seal_contains_storage(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `152 + n * (1 ±0)` - // Estimated: `152 + n * (1 ±0)` - // Minimum execution time: 5_355_000 picoseconds. - Weight::from_parts(6_745_997, 0) - .saturating_add(Weight::from_parts(0, 152)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(117, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) - } - /// Storage: `Skipped::Metadata` (r:0 w:0) - /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 16384]`. - fn seal_take_storage(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `152 + n * (1 ±0)` - // Estimated: `152 + n * (1 ±0)` - // Minimum execution time: 6_695_000 picoseconds. - Weight::from_parts(8_400_138, 0) - .saturating_add(Weight::from_parts(0, 152)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(612, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) - } - fn set_transient_storage_empty() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_493_000 picoseconds. - Weight::from_parts(1_585_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn set_transient_storage_full() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_704_000 picoseconds. - Weight::from_parts(2_809_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn get_transient_storage_empty() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_783_000 picoseconds. - Weight::from_parts(3_872_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn get_transient_storage_full() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_705_000 picoseconds. - Weight::from_parts(4_888_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn rollback_transient_storage() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_630_000 picoseconds. - Weight::from_parts(1_777_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// The range of component `n` is `[0, 16384]`. - /// The range of component `o` is `[0, 16384]`. - fn seal_set_transient_storage(n: u32, o: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_169_000 picoseconds. - Weight::from_parts(2_765_808, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(291, 0).saturating_mul(n.into())) - // Standard Error: 2 - .saturating_add(Weight::from_parts(300, 0).saturating_mul(o.into())) - } - /// The range of component `n` is `[0, 16384]`. - fn seal_clear_transient_storage(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_097_000 picoseconds. - Weight::from_parts(2_448_732, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(302, 0).saturating_mul(n.into())) - } - /// The range of component `n` is `[0, 16384]`. - fn seal_get_transient_storage(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_969_000 picoseconds. - Weight::from_parts(2_177_213, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(304, 0).saturating_mul(n.into())) - } - /// The range of component `n` is `[0, 16384]`. - fn seal_contains_transient_storage(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_792_000 picoseconds. - Weight::from_parts(2_006_292, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(151, 0).saturating_mul(n.into())) - } - /// The range of component `n` is `[0, 16384]`. - fn seal_take_transient_storage(_n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 9_818_000 picoseconds. - Weight::from_parts(10_025_671, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_transfer() -> Weight { - // Proof Size summary in bytes: - // Measured: `101` - // Estimated: `0` - // Minimum execution time: 9_129_000 picoseconds. - Weight::from_parts(9_348_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:1 w:0) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - /// The range of component `t` is `[0, 1]`. - /// The range of component `i` is `[0, 1048576]`. - fn seal_call(t: u32, i: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `459 + t * (242 ±0)` - // Estimated: `3924 + t * (2083 ±0)` - // Minimum execution time: 138_023_000 picoseconds. - Weight::from_parts(133_480_685, 0) - .saturating_add(Weight::from_parts(0, 3924)) - // Standard Error: 301_706 - .saturating_add(Weight::from_parts(45_437_576, 0).saturating_mul(t.into())) - // Standard Error: 0 - .saturating_add(Weight::from_parts(7, 0).saturating_mul(i.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) - .saturating_add(Weight::from_parts(0, 2083).saturating_mul(t.into())) - } - /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:1 w:0) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - fn seal_delegate_call() -> Weight { - // Proof Size summary in bytes: - // Measured: `269` - // Estimated: `3734` - // Minimum execution time: 123_648_000 picoseconds. - Weight::from_parts(127_328_000, 0) - .saturating_add(Weight::from_parts(0, 3734)) - .saturating_add(T::DbWeight::get().reads(2)) - } - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:1 w:0) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - /// Storage: `Contracts::Nonce` (r:1 w:0) - /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) - /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) - /// The range of component `i` is `[0, 983040]`. - /// The range of component `s` is `[0, 983040]`. - fn seal_instantiate(i: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `463` - // Estimated: `3937` - // Minimum execution time: 2_056_967_000 picoseconds. - Weight::from_parts(180_437_986, 0) - .saturating_add(Weight::from_parts(0, 3937)) - // Standard Error: 14 - .saturating_add(Weight::from_parts(1_833, 0).saturating_mul(i.into())) - // Standard Error: 14 - .saturating_add(Weight::from_parts(2_125, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// The range of component `n` is `[0, 1048576]`. - fn seal_hash_sha2_256(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 899_000 picoseconds. - Weight::from_parts(8_228_062, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_421, 0).saturating_mul(n.into())) - } - /// The range of component `n` is `[0, 1048576]`. - fn seal_hash_keccak_256(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_294_000 picoseconds. - Weight::from_parts(11_920_315, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(3_617, 0).saturating_mul(n.into())) - } - /// The range of component `n` is `[0, 1048576]`. - fn seal_hash_blake2_256(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 821_000 picoseconds. - Weight::from_parts(8_739_815, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_546, 0).saturating_mul(n.into())) - } - /// The range of component `n` is `[0, 1048576]`. - fn seal_hash_blake2_128(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 779_000 picoseconds. - Weight::from_parts(3_065_877, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_569, 0).saturating_mul(n.into())) - } - /// The range of component `n` is `[0, 125697]`. - fn seal_sr25519_verify(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 43_020_000 picoseconds. - Weight::from_parts(40_956_487, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 8 - .saturating_add(Weight::from_parts(5_059, 0).saturating_mul(n.into())) - } - fn seal_ecdsa_recover() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 48_050_000 picoseconds. - Weight::from_parts(48_836_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_ecdsa_to_eth_address() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 12_716_000 picoseconds. - Weight::from_parts(12_963_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - /// Storage: `Contracts::PristineCode` (r:1 w:0) - /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) - fn seal_set_code_hash() -> Weight { - // Proof Size summary in bytes: - // Measured: `269` - // Estimated: `3734` - // Minimum execution time: 19_810_000 picoseconds. - Weight::from_parts(20_223_000, 0) - .saturating_add(Weight::from_parts(0, 3734)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) - fn lock_delegate_dependency() -> Weight { - // Proof Size summary in bytes: - // Measured: `218` - // Estimated: `3683` - // Minimum execution time: 10_650_000 picoseconds. - Weight::from_parts(11_091_000, 0) - .saturating_add(Weight::from_parts(0, 3683)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) - /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`) - fn unlock_delegate_dependency() -> Weight { - // Proof Size summary in bytes: - // Measured: `218` - // Estimated: `3558` - // Minimum execution time: 9_519_000 picoseconds. - Weight::from_parts(9_830_000, 0) - .saturating_add(Weight::from_parts(0, 3558)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn seal_reentrance_count() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 359_000 picoseconds. - Weight::from_parts(391_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn seal_account_reentrance_count() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 367_000 picoseconds. - Weight::from_parts(449_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// Storage: `Contracts::Nonce` (r:1 w:0) - /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - fn seal_instantiation_nonce() -> Weight { - // Proof Size summary in bytes: - // Measured: `82` - // Estimated: `1567` - // Minimum execution time: 2_918_000 picoseconds. - Weight::from_parts(3_068_000, 0) - .saturating_add(Weight::from_parts(0, 1567)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// The range of component `r` is `[0, 5000]`. - fn instr_i64_load_store(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 817_000 picoseconds. - Weight::from_parts(906_008, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 12 - .saturating_add(Weight::from_parts(7_731, 0).saturating_mul(r.into())) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_multisig.rs deleted file mode 100644 index 3a3e153eab684734c0021070872b84b2a1ef27ef..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_multisig.rs +++ /dev/null @@ -1,167 +0,0 @@ -// 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. - -//! Autogenerated weights for `pallet_multisig` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=pallet_multisig -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_multisig`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { - /// The range of component `z` is `[0, 10000]`. - fn as_multi_threshold_1(z: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 15_402_000 picoseconds. - Weight::from_parts(16_121_123, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(448, 0).saturating_mul(z.into())) - } - /// Storage: `Multisig::Multisigs` (r:1 w:1) - /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create(s: u32, z: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `186 + s * (2 ±0)` - // Estimated: `6811` - // Minimum execution time: 43_046_000 picoseconds. - Weight::from_parts(29_330_828, 0) - .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_014 - .saturating_add(Weight::from_parts(153_954, 0).saturating_mul(s.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(1_955, 0).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Multisig::Multisigs` (r:1 w:1) - /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve(s: u32, z: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `185` - // Estimated: `6811` - // Minimum execution time: 27_474_000 picoseconds. - Weight::from_parts(14_888_154, 0) - .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 867 - .saturating_add(Weight::from_parts(138_299, 0).saturating_mul(s.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_978, 0).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Multisig::Multisigs` (r:1 w:1) - /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_complete(s: u32, z: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `288 + s * (33 ±0)` - // Estimated: `6811` - // Minimum execution time: 48_173_000 picoseconds. - Weight::from_parts(32_308_394, 0) - .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 975 - .saturating_add(Weight::from_parts(178_234, 0).saturating_mul(s.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_008, 0).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Multisig::Multisigs` (r:1 w:1) - /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_create(s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `187 + s * (2 ±0)` - // Estimated: `6811` - // Minimum execution time: 26_338_000 picoseconds. - Weight::from_parts(28_036_357, 0) - .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 910 - .saturating_add(Weight::from_parts(156_156, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Multisig::Multisigs` (r:1 w:1) - /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_approve(s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `185` - // Estimated: `6811` - // Minimum execution time: 13_363_000 picoseconds. - Weight::from_parts(13_544_871, 0) - .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 759 - .saturating_add(Weight::from_parts(145_581, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Multisig::Multisigs` (r:1 w:1) - /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) - /// The range of component `s` is `[2, 100]`. - fn cancel_as_multi(s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `357 + s * (1 ±0)` - // Estimated: `6811` - // Minimum execution time: 27_886_000 picoseconds. - Weight::from_parts(29_233_555, 0) - .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_135 - .saturating_add(Weight::from_parts(150_081, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_session.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_session.rs deleted file mode 100644 index 3c3f49241613b2870023c2bf6b5cbe3c10abb60b..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_session.rs +++ /dev/null @@ -1,83 +0,0 @@ -// 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. - -//! Autogenerated weights for `pallet_session` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=pallet_session -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_session`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> { - /// Storage: `Session::NextKeys` (r:1 w:1) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Session::KeyOwner` (r:1 w:1) - /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_keys() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `3465` - // Minimum execution time: 11_193_000 picoseconds. - Weight::from_parts(11_560_000, 0) - .saturating_add(Weight::from_parts(0, 3465)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Session::NextKeys` (r:1 w:1) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Session::KeyOwner` (r:0 w:1) - /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn purge_keys() -> Weight { - // Proof Size summary in bytes: - // Measured: `60` - // Estimated: `3525` - // Minimum execution time: 8_814_000 picoseconds. - Weight::from_parts(9_183_000, 0) - .saturating_add(Weight::from_parts(0, 3525)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_sudo.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_sudo.rs deleted file mode 100644 index 56181740928172d532e82909d0d1f5f895b215b8..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_sudo.rs +++ /dev/null @@ -1,112 +0,0 @@ -// 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. - -//! Autogenerated weights for `pallet_sudo` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=pallet_sudo -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_sudo`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> pallet_sudo::WeightInfo for WeightInfo<T> { - /// Storage: `Sudo::Key` (r:1 w:1) - /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) - fn set_key() -> Weight { - // Proof Size summary in bytes: - // Measured: `37` - // Estimated: `1517` - // Minimum execution time: 7_288_000 picoseconds. - Weight::from_parts(7_636_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Sudo::Key` (r:1 w:0) - /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) - fn sudo() -> Weight { - // Proof Size summary in bytes: - // Measured: `37` - // Estimated: `1517` - // Minimum execution time: 8_003_000 picoseconds. - Weight::from_parts(8_210_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `Sudo::Key` (r:1 w:0) - /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) - fn sudo_as() -> Weight { - // Proof Size summary in bytes: - // Measured: `37` - // Estimated: `1517` - // Minimum execution time: 8_032_000 picoseconds. - Weight::from_parts(8_377_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - } - /// Storage: `Sudo::Key` (r:1 w:1) - /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) - fn remove_key() -> Weight { - // Proof Size summary in bytes: - // Measured: `37` - // Estimated: `1517` - // Minimum execution time: 6_387_000 picoseconds. - Weight::from_parts(6_512_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Sudo::Key` (r:1 w:0) - /// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) - fn check_only_sudo_account() -> Weight { - // Proof Size summary in bytes: - // Measured: `37` - // Estimated: `1517` - // Minimum execution time: 2_103_000 picoseconds. - Weight::from_parts(2_222_000, 0) - .saturating_add(Weight::from_parts(0, 1517)) - .saturating_add(T::DbWeight::get().reads(1)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_timestamp.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_timestamp.rs deleted file mode 100644 index e50bc0359d66ef0175fe5264faae3f822b4226c2..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_timestamp.rs +++ /dev/null @@ -1,77 +0,0 @@ -// 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. - -//! Autogenerated weights for `pallet_timestamp` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=pallet_timestamp -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_timestamp`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> pallet_timestamp::WeightInfo for WeightInfo<T> { - /// Storage: `Timestamp::Now` (r:1 w:1) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Aura::CurrentSlot` (r:1 w:0) - /// Proof: `Aura::CurrentSlot` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - fn set() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `1493` - // Minimum execution time: 3_743_000 picoseconds. - Weight::from_parts(3_884_000, 0) - .saturating_add(Weight::from_parts(0, 1493)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn on_finalize() -> Weight { - // Proof Size summary in bytes: - // Measured: `36` - // Estimated: `0` - // Minimum execution time: 3_174_000 picoseconds. - Weight::from_parts(3_292_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } -} diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_utility.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_utility.rs deleted file mode 100644 index 5dade7bf1c03f8120d4d4b3700251766110ae111..0000000000000000000000000000000000000000 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/pallet_utility.rs +++ /dev/null @@ -1,120 +0,0 @@ -// 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. - -//! Autogenerated weights for `pallet_utility` -//! -//! 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: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `0108b0983295`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/contracts-rococo-runtime/contracts_rococo_runtime.wasm -// --pallet=pallet_utility -// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt -// --output=./cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 -// --no-storage-info -// --no-min-squares -// --no-median-slopes -// --genesis-builder-policy=none -// --exclude-pallets=pallet_xcm - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_utility`. -pub struct WeightInfo<T>(PhantomData<T>); -impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> { - /// The range of component `c` is `[0, 1000]`. - fn batch(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_182_000 picoseconds. - Weight::from_parts(4_295_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_857 - .saturating_add(Weight::from_parts(3_024_986, 0).saturating_mul(c.into())) - } - fn as_derivative() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_782_000 picoseconds. - Weight::from_parts(3_881_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// The range of component `c` is `[0, 1000]`. - fn batch_all(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_148_000 picoseconds. - Weight::from_parts(4_240_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 792 - .saturating_add(Weight::from_parts(3_255_356, 0).saturating_mul(c.into())) - } - fn dispatch_as() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 5_998_000 picoseconds. - Weight::from_parts(6_172_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// The range of component `c` is `[0, 1000]`. - fn force_batch(c: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_160_000 picoseconds. - Weight::from_parts(4_244_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_589 - .saturating_add(Weight::from_parts(3_010_782, 0).saturating_mul(c.into())) - } - fn dispatch_as_fallible() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 5_853_000 picoseconds. - Weight::from_parts(6_013_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - fn if_else() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_134_000 picoseconds. - Weight::from_parts(7_435_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } -} diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_multisig.rs index ed0eb42f117b4f5929ba966a45b4b0ee1fb0b69e..441b4e625dd8c4eeef5d2f06a84588f465d458f5 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `731f893ee36e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 16_135_000 picoseconds. - Weight::from_parts(17_839_067, 0) + // Minimum execution time: 15_641_000 picoseconds. + Weight::from_parts(16_253_264, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 13 - .saturating_add(Weight::from_parts(462, 0).saturating_mul(z.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(490, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `262 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 48_564_000 picoseconds. - Weight::from_parts(33_121_311, 0) + // Minimum execution time: 45_641_000 picoseconds. + Weight::from_parts(32_463_659, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_818 - .saturating_add(Weight::from_parts(185_382, 0).saturating_mul(s.into())) - // Standard Error: 27 - .saturating_add(Weight::from_parts(2_052, 0).saturating_mul(z.into())) + // Standard Error: 1_746 + .saturating_add(Weight::from_parts(154_624, 0).saturating_mul(s.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_972, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 31_466_000 picoseconds. - Weight::from_parts(18_489_464, 0) + // Minimum execution time: 30_242_000 picoseconds. + Weight::from_parts(18_657_028, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_997 - .saturating_add(Weight::from_parts(158_854, 0).saturating_mul(s.into())) - // Standard Error: 19 - .saturating_add(Weight::from_parts(1_978, 0).saturating_mul(z.into())) + // Standard Error: 1_726 + .saturating_add(Weight::from_parts(135_426, 0).saturating_mul(s.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(1_960, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `385 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 54_035_000 picoseconds. - Weight::from_parts(34_585_912, 0) + // Minimum execution time: 52_084_000 picoseconds. + Weight::from_parts(32_454_224, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 3_385 - .saturating_add(Weight::from_parts(264_857, 0).saturating_mul(s.into())) - // Standard Error: 33 - .saturating_add(Weight::from_parts(2_264, 0).saturating_mul(z.into())) + // Standard Error: 2_509 + .saturating_add(Weight::from_parts(214_513, 0).saturating_mul(s.into())) + // Standard Error: 24 + .saturating_add(Weight::from_parts(2_247, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 30_251_000 picoseconds. - Weight::from_parts(32_437_358, 0) + // Minimum execution time: 29_600_000 picoseconds. + Weight::from_parts(30_597_949, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_293 - .saturating_add(Weight::from_parts(173_951, 0).saturating_mul(s.into())) + // Standard Error: 2_117 + .saturating_add(Weight::from_parts(191_486, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 16_972_000 picoseconds. - Weight::from_parts(17_886_291, 0) + // Minimum execution time: 17_839_000 picoseconds. + Weight::from_parts(18_672_161, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_589 - .saturating_add(Weight::from_parts(146_847, 0).saturating_mul(s.into())) + // Standard Error: 2_491 + .saturating_add(Weight::from_parts(172_942, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 31_204_000 picoseconds. - Weight::from_parts(33_605_920, 0) + // Minimum execution time: 31_824_000 picoseconds. + Weight::from_parts(35_736_587, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 2_156 - .saturating_add(Weight::from_parts(165_315, 0).saturating_mul(s.into())) + // Standard Error: 3_833 + .saturating_add(Weight::from_parts(187_839, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `454 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 29_796_000 picoseconds. + Weight::from_parts(35_859_134, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 3_720 + .saturating_add(Weight::from_parts(82_222, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_multisig.rs index 5c520bdc85e9248e4bb0abb37aa6f861c61ff729..41011f99dca57949b67acc9d3eb9c171ec051ba8 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `050e4dc4313a`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_622_000 picoseconds. - Weight::from_parts(16_362_774, 0) + // Minimum execution time: 15_894_000 picoseconds. + Weight::from_parts(16_821_453, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(446, 0).saturating_mul(z.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(509, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `262 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 45_732_000 picoseconds. - Weight::from_parts(32_263_758, 0) + // Minimum execution time: 47_240_000 picoseconds. + Weight::from_parts(33_336_057, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_072 - .saturating_add(Weight::from_parts(151_949, 0).saturating_mul(s.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(2_001, 0).saturating_mul(z.into())) + // Standard Error: 2_661 + .saturating_add(Weight::from_parts(157_360, 0).saturating_mul(s.into())) + // Standard Error: 26 + .saturating_add(Weight::from_parts(2_077, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 29_775_000 picoseconds. - Weight::from_parts(18_891_923, 0) + // Minimum execution time: 31_060_000 picoseconds. + Weight::from_parts(18_645_543, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 703 - .saturating_add(Weight::from_parts(132_780, 0).saturating_mul(s.into())) - // Standard Error: 6 - .saturating_add(Weight::from_parts(1_927, 0).saturating_mul(z.into())) + // Standard Error: 911 + .saturating_add(Weight::from_parts(137_724, 0).saturating_mul(s.into())) + // Standard Error: 8 + .saturating_add(Weight::from_parts(1_982, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `385 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 51_773_000 picoseconds. - Weight::from_parts(34_260_743, 0) + // Minimum execution time: 52_517_000 picoseconds. + Weight::from_parts(36_395_191, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_848 - .saturating_add(Weight::from_parts(188_370, 0).saturating_mul(s.into())) - // Standard Error: 18 - .saturating_add(Weight::from_parts(2_194, 0).saturating_mul(z.into())) + // Standard Error: 2_629 + .saturating_add(Weight::from_parts(195_873, 0).saturating_mul(s.into())) + // Standard Error: 25 + .saturating_add(Weight::from_parts(2_051, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 29_854_000 picoseconds. - Weight::from_parts(31_648_003, 0) + // Minimum execution time: 31_134_000 picoseconds. + Weight::from_parts(32_407_018, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_077 - .saturating_add(Weight::from_parts(155_375, 0).saturating_mul(s.into())) + // Standard Error: 1_677 + .saturating_add(Weight::from_parts(157_494, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 16_742_000 picoseconds. - Weight::from_parts(17_612_400, 0) + // Minimum execution time: 16_473_000 picoseconds. + Weight::from_parts(17_703_446, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 671 - .saturating_add(Weight::from_parts(131_519, 0).saturating_mul(s.into())) + // Standard Error: 979 + .saturating_add(Weight::from_parts(134_876, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 30_707_000 picoseconds. - Weight::from_parts(32_967_409, 0) + // Minimum execution time: 30_096_000 picoseconds. + Weight::from_parts(32_339_395, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 880 - .saturating_add(Weight::from_parts(143_516, 0).saturating_mul(s.into())) + // Standard Error: 1_032 + .saturating_add(Weight::from_parts(154_970, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `454 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 28_808_000 picoseconds. + Weight::from_parts(31_104_411, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_313 + .saturating_add(Weight::from_parts(155_584, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_multisig.rs index b1a754bc8a89e3d6ad408182576d84089266abbc..c60c8a657bc553340e628e3743cfa7b772542fa3 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `afc679a858d4`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_609_000 picoseconds. - Weight::from_parts(16_198_883, 0) + // Minimum execution time: 15_740_000 picoseconds. + Weight::from_parts(16_129_400, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 4 - .saturating_add(Weight::from_parts(443, 0).saturating_mul(z.into())) + // Standard Error: 18 + .saturating_add(Weight::from_parts(949, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `262 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 46_213_000 picoseconds. - Weight::from_parts(33_717_215, 0) + // Minimum execution time: 47_726_000 picoseconds. + Weight::from_parts(42_770_458, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_176 - .saturating_add(Weight::from_parts(150_138, 0).saturating_mul(s.into())) - // Standard Error: 11 - .saturating_add(Weight::from_parts(1_840, 0).saturating_mul(z.into())) + // Standard Error: 5_216 + .saturating_add(Weight::from_parts(92_088, 0).saturating_mul(s.into())) + // Standard Error: 51 + .saturating_add(Weight::from_parts(1_836, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 31_060_000 picoseconds. - Weight::from_parts(19_039_059, 0) + // Minimum execution time: 30_839_000 picoseconds. + Weight::from_parts(17_024_830, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 643 - .saturating_add(Weight::from_parts(137_526, 0).saturating_mul(s.into())) - // Standard Error: 6 - .saturating_add(Weight::from_parts(1_875, 0).saturating_mul(z.into())) + // Standard Error: 1_897 + .saturating_add(Weight::from_parts(152_893, 0).saturating_mul(s.into())) + // Standard Error: 18 + .saturating_add(Weight::from_parts(2_077, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `385 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 52_418_000 picoseconds. - Weight::from_parts(36_319_835, 0) + // Minimum execution time: 51_336_000 picoseconds. + Weight::from_parts(33_150_111, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_195 - .saturating_add(Weight::from_parts(180_876, 0).saturating_mul(s.into())) - // Standard Error: 11 - .saturating_add(Weight::from_parts(1_966, 0).saturating_mul(z.into())) + // Standard Error: 2_792 + .saturating_add(Weight::from_parts(210_323, 0).saturating_mul(s.into())) + // Standard Error: 27 + .saturating_add(Weight::from_parts(2_275, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 29_703_000 picoseconds. - Weight::from_parts(31_823_629, 0) + // Minimum execution time: 29_377_000 picoseconds. + Weight::from_parts(31_278_890, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 953 - .saturating_add(Weight::from_parts(155_054, 0).saturating_mul(s.into())) + // Standard Error: 1_426 + .saturating_add(Weight::from_parts(167_735, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 16_639_000 picoseconds. - Weight::from_parts(17_839_105, 0) + // Minimum execution time: 16_734_000 picoseconds. + Weight::from_parts(18_265_217, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 725 - .saturating_add(Weight::from_parts(134_058, 0).saturating_mul(s.into())) + // Standard Error: 1_209 + .saturating_add(Weight::from_parts(133_740, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 31_172_000 picoseconds. - Weight::from_parts(32_933_689, 0) + // Minimum execution time: 30_167_000 picoseconds. + Weight::from_parts(32_070_456, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_003 - .saturating_add(Weight::from_parts(145_576, 0).saturating_mul(s.into())) + // Standard Error: 1_666 + .saturating_add(Weight::from_parts(163_065, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `454 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 29_156_000 picoseconds. + Weight::from_parts(30_828_857, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_194 + .saturating_add(Weight::from_parts(145_508, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_multisig.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_multisig.rs index 7c4d9933fe6e7212d4751a5c355353e12dba0c34..c87c6464bc8e80eac701f6346305a101fd1507e9 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_multisig.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_multisig.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `b9a9df1fcddf`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -55,11 +55,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_857_000 picoseconds. - Weight::from_parts(16_443_344, 0) + // Minimum execution time: 15_547_000 picoseconds. + Weight::from_parts(17_016_393, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 6 - .saturating_add(Weight::from_parts(465, 0).saturating_mul(z.into())) + // Standard Error: 11 + .saturating_add(Weight::from_parts(451, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -69,13 +69,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `262 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 47_650_000 picoseconds. - Weight::from_parts(34_338_175, 0) + // Minimum execution time: 46_205_000 picoseconds. + Weight::from_parts(32_709_232, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_316 - .saturating_add(Weight::from_parts(154_947, 0).saturating_mul(s.into())) - // Standard Error: 12 - .saturating_add(Weight::from_parts(1_947, 0).saturating_mul(z.into())) + // Standard Error: 1_436 + .saturating_add(Weight::from_parts(155_664, 0).saturating_mul(s.into())) + // Standard Error: 14 + .saturating_add(Weight::from_parts(1_961, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -87,13 +87,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 32_166_000 picoseconds. - Weight::from_parts(19_455_221, 0) + // Minimum execution time: 31_191_000 picoseconds. + Weight::from_parts(18_049_741, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 569 - .saturating_add(Weight::from_parts(137_763, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_948, 0).saturating_mul(z.into())) + // Standard Error: 3_281 + .saturating_add(Weight::from_parts(191_717, 0).saturating_mul(s.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(1_870, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -107,13 +107,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `385 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 52_855_000 picoseconds. - Weight::from_parts(35_028_223, 0) + // Minimum execution time: 51_144_000 picoseconds. + Weight::from_parts(39_814_896, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_938 - .saturating_add(Weight::from_parts(199_405, 0).saturating_mul(s.into())) - // Standard Error: 18 - .saturating_add(Weight::from_parts(2_164, 0).saturating_mul(z.into())) + // Standard Error: 5_503 + .saturating_add(Weight::from_parts(129_151, 0).saturating_mul(s.into())) + // Standard Error: 53 + .saturating_add(Weight::from_parts(2_606, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,11 +124,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 30_293_000 picoseconds. - Weight::from_parts(33_154_387, 0) + // Minimum execution time: 29_407_000 picoseconds. + Weight::from_parts(31_348_384, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_639 - .saturating_add(Weight::from_parts(155_138, 0).saturating_mul(s.into())) + // Standard Error: 1_745 + .saturating_add(Weight::from_parts(166_419, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 17_941_000 picoseconds. - Weight::from_parts(18_072_308, 0) + // Minimum execution time: 16_850_000 picoseconds. + Weight::from_parts(17_798_580, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 655 - .saturating_add(Weight::from_parts(143_823, 0).saturating_mul(s.into())) + // Standard Error: 997 + .saturating_add(Weight::from_parts(136_483, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -154,11 +154,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 31_203_000 picoseconds. - Weight::from_parts(33_614_159, 0) + // Minimum execution time: 30_358_000 picoseconds. + Weight::from_parts(32_907_172, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_240 - .saturating_add(Weight::from_parts(143_359, 0).saturating_mul(s.into())) + // Standard Error: 1_729 + .saturating_add(Weight::from_parts(142_934, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `454 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 28_252_000 picoseconds. + Weight::from_parts(30_269_886, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_802 + .saturating_add(Weight::from_parts(161_973, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs b/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs index 0d526b09834e9035ac02faa167cd4f0b6ffaecb1..60c75464ae3ec2bfadb19a6497523d0f78b10125 100644 --- a/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs +++ b/cumulus/polkadot-omni-node/lib/src/nodes/aura.rs @@ -250,7 +250,7 @@ where { #[docify::export_content] fn launch_slot_based_collator<CIDP, CHP, Proposer, CS, Spawner>( - params: SlotBasedParams< + params_with_export: SlotBasedParams< Block, ParachainBlockImport< Block, @@ -277,7 +277,9 @@ where CS: CollatorServiceInterface<Block> + Send + Sync + Clone + 'static, Spawner: SpawnNamed, { - slot_based::run::<Block, <AuraId as AppCrypto>::Pair, _, _, _, _, _, _, _, _, _>(params); + slot_based::run::<Block, <AuraId as AppCrypto>::Pair, _, _, _, _, _, _, _, _, _>( + params_with_export, + ); } } @@ -319,7 +321,7 @@ where _overseer_handle: OverseerHandle, announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>, backend: Arc<ParachainBackend<Block>>, - _node_extra_args: NodeExtraArgs, + node_extra_args: NodeExtraArgs, block_import_handle: SlotBasedBlockImportHandle<Block>, ) -> Result<(), Error> { let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( @@ -358,10 +360,12 @@ where slot_drift: Duration::from_secs(1), block_import_handle, spawner: task_manager.spawn_handle(), + export_pov: node_extra_args.export_pov, }; // We have a separate function only to be able to use `docify::export` on this piece of // code. + Self::launch_slot_based_collator(params); Ok(()) diff --git a/cumulus/polkadot-omni-node/lib/src/nodes/mod.rs b/cumulus/polkadot-omni-node/lib/src/nodes/mod.rs index de27ce3704fc3a9a8b7af2f015d12ee30b85e209..468f285b8fa3a35a72a57b50e5bacfad03d1dba3 100644 --- a/cumulus/polkadot-omni-node/lib/src/nodes/mod.rs +++ b/cumulus/polkadot-omni-node/lib/src/nodes/mod.rs @@ -25,7 +25,7 @@ use sc_service::{Configuration, TaskManager}; /// The current node version for cumulus official binaries, which takes the basic /// SemVer form `<major>.<minor>.<patch>`. It should correspond to the latest /// `polkadot` version of a stable release. -pub const NODE_VERSION: &'static str = "1.17.1"; +pub const NODE_VERSION: &'static str = "1.17.2"; /// Trait that extends the `DynNodeSpec` trait with manual seal related logic. /// diff --git a/cumulus/primitives/storage-weight-reclaim/src/lib.rs b/cumulus/primitives/storage-weight-reclaim/src/lib.rs index 62ff60811904525c1e6af944776bfaac77b926fa..0e4afc439de64ede63a913dc66a424ea2d83f8e4 100644 --- a/cumulus/primitives/storage-weight-reclaim/src/lib.rs +++ b/cumulus/primitives/storage-weight-reclaim/src/lib.rs @@ -17,7 +17,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::marker::PhantomData; use cumulus_primitives_core::Weight; use cumulus_primitives_proof_size_hostfunction::{ @@ -116,7 +116,7 @@ mod allow_deprecated { to itself and ignores the post dispatch logic for extensions subsequent to itself, it also doesn't provide weight information. \ Use `StorageWeightReclaim` in the `cumulus-pallet-weight-reclaim` crate")] - #[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] + #[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, Default, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct StorageWeightReclaim<T: Config + Send + Sync>(pub(super) PhantomData<T>); } diff --git a/cumulus/test/service/src/lib.rs b/cumulus/test/service/src/lib.rs index f3f04cbb63835fb2dc2926b1e3b50a320e39794d..075258fe25b98e33ce1833467d5744a9ca085f59 100644 --- a/cumulus/test/service/src/lib.rs +++ b/cumulus/test/service/src/lib.rs @@ -506,6 +506,7 @@ where slot_drift: Duration::from_secs(1), block_import_handle: slot_based_handle, spawner: task_manager.spawn_handle(), + export_pov: None, }; slot_based::run::<Block, AuthorityPair, _, _, _, _, _, _, _, _, _>(params); diff --git a/docs/sdk/src/reference_docs/transaction_extensions.rs b/docs/sdk/src/reference_docs/transaction_extensions.rs index fe213458b25c0400a8aef014398fa6d04b7a2f2b..4a69acae1ad618524d7ea0340ac47ee7f8b9dab7 100644 --- a/docs/sdk/src/reference_docs/transaction_extensions.rs +++ b/docs/sdk/src/reference_docs/transaction_extensions.rs @@ -62,7 +62,7 @@ #[docify::export] pub mod transaction_extensions_example { - use codec::{Decode, Encode}; + use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use sp_runtime::{ impl_tx_ext_default, @@ -72,7 +72,7 @@ pub mod transaction_extensions_example { // This doesn't actually check anything, but simply allows // some arbitrary `u32` to be added to the extrinsic payload - #[derive(Debug, Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] + #[derive(Debug, Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] pub struct AddToPayload(pub u32); impl<Call: Dispatchable> TransactionExtension<Call> for AddToPayload { @@ -87,7 +87,7 @@ pub mod transaction_extensions_example { // This is the opposite; nothing will be added to the extrinsic payload, // but the Implicit type (`1234u32`) will be added to the // payload to be signed. - #[derive(Debug, Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] + #[derive(Debug, Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] pub struct AddToSignaturePayload; impl<Call: Dispatchable> TransactionExtension<Call> for AddToSignaturePayload { diff --git a/polkadot/node/primitives/src/lib.rs b/polkadot/node/primitives/src/lib.rs index 845daa2679850cea080400dfe6abdec11146d8aa..26ec2d883783cf26f50adf9cc40f38610714897f 100644 --- a/polkadot/node/primitives/src/lib.rs +++ b/polkadot/node/primitives/src/lib.rs @@ -59,7 +59,7 @@ pub use disputes::{ /// relatively rare. /// /// The associated worker binaries should use the same version as the node that spawns them. -pub const NODE_VERSION: &'static str = "1.17.1"; +pub const NODE_VERSION: &'static str = "1.17.2"; // For a 16-ary Merkle Prefix Trie, we can expect at most 16 32-byte hashes per node // plus some overhead: diff --git a/polkadot/runtime/common/src/claims/mod.rs b/polkadot/runtime/common/src/claims/mod.rs index 1c557051add476a1ee7223ee29c542ac68ac3c3c..0104d9e7d726fd069e233bf857755d41671d1e87 100644 --- a/polkadot/runtime/common/src/claims/mod.rs +++ b/polkadot/runtime/common/src/claims/mod.rs @@ -619,7 +619,7 @@ impl<T: Config> Pallet<T> { /// Validate `attest` calls prior to execution. Needed to avoid a DoS attack since they are /// otherwise free to place on chain. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct PrevalidateAttests<T>(core::marker::PhantomData<fn(T)>); diff --git a/polkadot/runtime/rococo/src/weights/pallet_multisig.rs b/polkadot/runtime/rococo/src/weights/pallet_multisig.rs index cf41d0db26677875e377de7fbbaf80af1d3da3d1..3dffdbf06ce318ef169f53e17548629eb8ccc8d3 100644 --- a/polkadot/runtime/rococo/src/weights/pallet_multisig.rs +++ b/polkadot/runtime/rococo/src/weights/pallet_multisig.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `d3a9aad6f7a3`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,11 +56,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_540_000 picoseconds. - Weight::from_parts(16_404_944, 0) + // Minimum execution time: 16_031_000 picoseconds. + Weight::from_parts(16_334_237, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 8 - .saturating_add(Weight::from_parts(458, 0).saturating_mul(z.into())) + // Standard Error: 27 + .saturating_add(Weight::from_parts(655, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -70,13 +70,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `229 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 48_133_000 picoseconds. - Weight::from_parts(35_272_992, 0) + // Minimum execution time: 47_422_000 picoseconds. + Weight::from_parts(34_453_063, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_330 - .saturating_add(Weight::from_parts(140_880, 0).saturating_mul(s.into())) - // Standard Error: 13 - .saturating_add(Weight::from_parts(1_879, 0).saturating_mul(z.into())) + // Standard Error: 3_967 + .saturating_add(Weight::from_parts(149_468, 0).saturating_mul(s.into())) + // Standard Error: 38 + .saturating_add(Weight::from_parts(2_115, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -88,13 +88,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `248` // Estimated: `6811` - // Minimum execution time: 31_046_000 picoseconds. - Weight::from_parts(18_890_897, 0) + // Minimum execution time: 32_443_000 picoseconds. + Weight::from_parts(20_948_248, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_091 - .saturating_add(Weight::from_parts(132_904, 0).saturating_mul(s.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_985, 0).saturating_mul(z.into())) + // Standard Error: 2_516 + .saturating_add(Weight::from_parts(134_093, 0).saturating_mul(s.into())) + // Standard Error: 24 + .saturating_add(Weight::from_parts(1_905, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -108,13 +108,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `354 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 52_526_000 picoseconds. - Weight::from_parts(38_262_143, 0) + // Minimum execution time: 53_028_000 picoseconds. + Weight::from_parts(23_678_558, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_890 - .saturating_add(Weight::from_parts(178_121, 0).saturating_mul(s.into())) - // Standard Error: 18 - .saturating_add(Weight::from_parts(1_922, 0).saturating_mul(z.into())) + // Standard Error: 6_864 + .saturating_add(Weight::from_parts(300_804, 0).saturating_mul(s.into())) + // Standard Error: 67 + .saturating_add(Weight::from_parts(3_380, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -125,11 +125,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `229 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 31_752_000 picoseconds. - Weight::from_parts(33_375_748, 0) + // Minimum execution time: 31_551_000 picoseconds. + Weight::from_parts(33_991_440, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_137 - .saturating_add(Weight::from_parts(146_793, 0).saturating_mul(s.into())) + // Standard Error: 2_114 + .saturating_add(Weight::from_parts(123_260, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -140,11 +140,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `248` // Estimated: `6811` - // Minimum execution time: 17_100_000 picoseconds. - Weight::from_parts(18_339_117, 0) + // Minimum execution time: 17_063_000 picoseconds. + Weight::from_parts(17_667_306, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 791 - .saturating_add(Weight::from_parts(130_881, 0).saturating_mul(s.into())) + // Standard Error: 1_384 + .saturating_add(Weight::from_parts(146_228, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -155,11 +155,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `420 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 32_917_000 picoseconds. - Weight::from_parts(34_103_889, 0) + // Minimum execution time: 31_979_000 picoseconds. + Weight::from_parts(35_042_991, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_357 - .saturating_add(Weight::from_parts(146_547, 0).saturating_mul(s.into())) + // Standard Error: 3_858 + .saturating_add(Weight::from_parts(163_176, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `420 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 30_328_000 picoseconds. + Weight::from_parts(34_135_440, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 4_398 + .saturating_add(Weight::from_parts(161_074, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/polkadot/runtime/westend/src/weights/pallet_multisig.rs b/polkadot/runtime/westend/src/weights/pallet_multisig.rs index 1c27fb99f8ea31ca2a71d142a38c2dfd72474003..5eedacb9bed3637ecea7d143e7593014b75bc650 100644 --- a/polkadot/runtime/westend/src/weights/pallet_multisig.rs +++ b/polkadot/runtime/westend/src/weights/pallet_multisig.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `3a2e9ae8a8f5`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -56,11 +56,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_742_000 picoseconds. - Weight::from_parts(16_689_158, 0) + // Minimum execution time: 16_297_000 picoseconds. + Weight::from_parts(17_470_545, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 4 - .saturating_add(Weight::from_parts(425, 0).saturating_mul(z.into())) + // Standard Error: 23 + .saturating_add(Weight::from_parts(906, 0).saturating_mul(z.into())) } /// Storage: `Multisig::Multisigs` (r:1 w:1) /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) @@ -70,13 +70,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `267 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 51_695_000 picoseconds. - Weight::from_parts(39_502_473, 0) + // Minimum execution time: 53_876_000 picoseconds. + Weight::from_parts(51_061_263, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_991 - .saturating_add(Weight::from_parts(149_722, 0).saturating_mul(s.into())) - // Standard Error: 19 - .saturating_add(Weight::from_parts(1_920, 0).saturating_mul(z.into())) + // Standard Error: 6_290 + .saturating_add(Weight::from_parts(76_185, 0).saturating_mul(s.into())) + // Standard Error: 61 + .saturating_add(Weight::from_parts(1_799, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -88,13 +88,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `286` // Estimated: `6811` - // Minimum execution time: 36_027_000 picoseconds. - Weight::from_parts(23_708_974, 0) + // Minimum execution time: 37_211_000 picoseconds. + Weight::from_parts(22_933_454, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 886 - .saturating_add(Weight::from_parts(135_578, 0).saturating_mul(s.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_977, 0).saturating_mul(z.into())) + // Standard Error: 1_435 + .saturating_add(Weight::from_parts(163_808, 0).saturating_mul(s.into())) + // Standard Error: 14 + .saturating_add(Weight::from_parts(1_998, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -108,13 +108,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `392 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 57_964_000 picoseconds. - Weight::from_parts(41_322_769, 0) + // Minimum execution time: 59_254_000 picoseconds. + Weight::from_parts(44_463_212, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_938 - .saturating_add(Weight::from_parts(187_486, 0).saturating_mul(s.into())) - // Standard Error: 18 - .saturating_add(Weight::from_parts(2_132, 0).saturating_mul(z.into())) + // Standard Error: 5_523 + .saturating_add(Weight::from_parts(224_317, 0).saturating_mul(s.into())) + // Standard Error: 54 + .saturating_add(Weight::from_parts(1_895, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -125,11 +125,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `267 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 35_875_000 picoseconds. - Weight::from_parts(37_310_784, 0) + // Minimum execution time: 35_716_000 picoseconds. + Weight::from_parts(37_158_321, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_591 - .saturating_add(Weight::from_parts(162_975, 0).saturating_mul(s.into())) + // Standard Error: 1_359 + .saturating_add(Weight::from_parts(167_574, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -140,11 +140,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `286` // Estimated: `6811` - // Minimum execution time: 21_526_000 picoseconds. - Weight::from_parts(22_387_339, 0) + // Minimum execution time: 21_897_000 picoseconds. + Weight::from_parts(23_002_371, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 706 - .saturating_add(Weight::from_parts(146_192, 0).saturating_mul(s.into())) + // Standard Error: 2_438 + .saturating_add(Weight::from_parts(163_255, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -155,11 +155,26 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> { // Proof Size summary in bytes: // Measured: `458 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 36_493_000 picoseconds. - Weight::from_parts(38_162_969, 0) + // Minimum execution time: 36_287_000 picoseconds. + Weight::from_parts(38_396_611, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_164 - .saturating_add(Weight::from_parts(153_723, 0).saturating_mul(s.into())) + // Standard Error: 3_536 + .saturating_add(Weight::from_parts(178_827, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `458 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 34_917_000 picoseconds. + Weight::from_parts(36_141_350, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_247 + .saturating_add(Weight::from_parts(166_544, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/polkadot/xcm/xcm-builder/src/tests/mock.rs b/polkadot/xcm/xcm-builder/src/tests/mock.rs index 2df6bdfe15062324221e66dc8577f2daad61b1f2..cbb44b77e8541441fc32e6118fe0723d91d0dc3e 100644 --- a/polkadot/xcm/xcm-builder/src/tests/mock.rs +++ b/polkadot/xcm/xcm-builder/src/tests/mock.rs @@ -27,7 +27,7 @@ pub use crate::{ FixedRateOfFungible, FixedWeightBounds, TakeWeightCredit, }; pub use alloc::collections::{btree_map::BTreeMap, btree_set::BTreeSet}; -pub use codec::{Decode, Encode}; +pub use codec::{Decode, DecodeWithMemTracking, Encode}; pub use core::{ cell::{Cell, RefCell}, fmt::Debug, @@ -62,7 +62,9 @@ pub enum TestOrigin { /// /// Each item contains the amount of weight that it *wants* to consume as the first item, and the /// actual amount (if different from the former) in the second option. -#[derive(Debug, Encode, Decode, Eq, PartialEq, Clone, Copy, scale_info::TypeInfo)] +#[derive( + Debug, Encode, Decode, DecodeWithMemTracking, Eq, PartialEq, Clone, Copy, scale_info::TypeInfo, +)] pub enum TestCall { OnlyRoot(Weight, Option<Weight>), OnlyParachain(Weight, Option<Weight>, Option<u32>), diff --git a/polkadot/xcm/xcm-executor/src/tests/mock.rs b/polkadot/xcm/xcm-executor/src/tests/mock.rs index f94f289ff563c932260636920b38abc575b919be..11cdbf1128f84b69822fe6cf99f60b08e0fb9716 100644 --- a/polkadot/xcm/xcm-executor/src/tests/mock.rs +++ b/polkadot/xcm/xcm-executor/src/tests/mock.rs @@ -17,7 +17,7 @@ //! Mock types and XcmConfig for all executor unit tests. use alloc::collections::btree_map::BTreeMap; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::cell::RefCell; use frame_support::{ dispatch::{DispatchInfo, DispatchResultWithPostInfo, GetDispatchInfo, PostDispatchInfo}, @@ -64,7 +64,9 @@ pub struct TestOrigin; /// /// Doesn't dispatch anything, has an empty implementation of [`Dispatchable`] that /// just returns `Ok` with an empty [`PostDispatchInfo`]. -#[derive(Debug, Encode, Decode, Eq, PartialEq, Clone, Copy, scale_info::TypeInfo)] +#[derive( + Debug, Encode, Decode, DecodeWithMemTracking, Eq, PartialEq, Clone, Copy, scale_info::TypeInfo, +)] pub struct TestCall; impl Dispatchable for TestCall { type RuntimeOrigin = TestOrigin; diff --git a/polkadot/xcm/xcm-simulator/example/src/tests.rs b/polkadot/xcm/xcm-simulator/example/src/tests.rs index b39c63bd7dad4d93961edfca868fff314448fa7a..0808d209343f0adebfdeb21d756339f5e3549cdd 100644 --- a/polkadot/xcm/xcm-simulator/example/src/tests.rs +++ b/polkadot/xcm/xcm-simulator/example/src/tests.rs @@ -26,6 +26,21 @@ fn buy_execution<C>(fees: impl Into<Asset>) -> Instruction<C> { BuyExecution { fees: fees.into(), weight_limit: Unlimited } } +/// Helper macro to check if a system event exists in the event list. +/// +/// Example usage: +/// ```ignore +/// assert!(system_contains_event!(parachain, System(frame_system::Event::Remarked { .. }))); +/// assert!(system_contains_event!(relay_chain, XcmPallet(pallet_xcm::Event::Attempted { .. }))); +/// ``` +macro_rules! system_contains_event { + ($runtime:ident, $variant:ident($($pattern:tt)*)) => { + $runtime::System::events().iter().any(|e| { + matches!(e.event, $runtime::RuntimeEvent::$variant($($pattern)*)) + }) + }; +} + #[test] fn remote_account_ids_work() { child_account_account_id(1, ALICE); @@ -53,11 +68,7 @@ fn dmp() { }); ParaA::execute_with(|| { - use parachain::{RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { .. }) - ))); + assert!(system_contains_event!(parachain, System(frame_system::Event::Remarked { .. }))); }); } @@ -81,11 +92,7 @@ fn ump() { }); Relay::execute_with(|| { - use relay_chain::{RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { .. }) - ))); + assert!(system_contains_event!(relay_chain, System(frame_system::Event::Remarked { .. }))); }); } @@ -109,11 +116,7 @@ fn xcmp() { }); ParaB::execute_with(|| { - use parachain::{RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { .. }) - ))); + assert!(system_contains_event!(parachain, System(frame_system::Event::Remarked { .. }))); }); } @@ -137,18 +140,12 @@ fn reserve_transfer() { INITIAL_BALANCE + withdraw_amount ); // Ensure expected events were emitted - let events = relay_chain::System::events(); - let attempted_count = count_relay_chain_events(&events, |event| { - matches!( - event, - relay_chain::RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted { .. }) - ) - }); - let sent_count = count_relay_chain_events(&events, |event| { - matches!(event, relay_chain::RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. })) - }); - assert_eq!(attempted_count, 1, "Expected one XcmPallet::Attempted event"); - assert_eq!(sent_count, 1, "Expected one XcmPallet::Sent event"); + let attempted_emitted = + system_contains_event!(relay_chain, XcmPallet(pallet_xcm::Event::Attempted { .. })); + let sent_emitted = + system_contains_event!(relay_chain, XcmPallet(pallet_xcm::Event::Sent { .. })); + assert!(attempted_emitted, "Expected XcmPallet::Attempted event emitted"); + assert!(sent_emitted, "Expected XcmPallet::Sent event emitted"); }); ParaA::execute_with(|| { @@ -193,13 +190,8 @@ fn reserve_transfer_with_error() { assert!(log_capture.contains("XCM validate_send failed")); // Verify that XcmPallet::Attempted was NOT emitted (rollback happened) - let events = relay_chain::System::events(); - let xcm_attempted_emitted = events.iter().any(|e| { - matches!( - e.event, - relay_chain::RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted { .. }) - ) - }); + let xcm_attempted_emitted = + system_contains_event!(relay_chain, XcmPallet(pallet_xcm::Event::Attempted { .. })); assert!( !xcm_attempted_emitted, "Expected no XcmPallet::Attempted event due to rollback, but it was emitted" @@ -580,13 +572,3 @@ fn query_holding() { ); }); } - -fn count_relay_chain_events<F>( - events: &[frame_system::EventRecord<relay_chain::RuntimeEvent, sp_core::H256>], - predicate: F, -) -> usize -where - F: Fn(&relay_chain::RuntimeEvent) -> bool, -{ - events.iter().filter(|e| predicate(&e.event)).count() -} diff --git a/prdoc/pr_7585.prdoc b/prdoc/pr_7585.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..1d6b69e8df63bad46fc566d602acf60c7eca69c7 --- /dev/null +++ b/prdoc/pr_7585.prdoc @@ -0,0 +1,11 @@ +title: 'Add export PoV on slot base collator' +doc: +- audience: [Node Dev, Node Operator] + description: Add functionality to export the Proof of Validity (PoV) when the slot-based collator is used. +crates: +- name: cumulus-test-service + bump: major +- name: cumulus-client-consensus-aura + bump: major +- name: polkadot-omni-node-lib + bump: major \ No newline at end of file diff --git a/prdoc/pr_7634.prdoc b/prdoc/pr_7634.prdoc index f1bdd383b2fc7cc375d9b00e2133560cdc74c577..f2cdba09cb1bfd1fdcfc9e8d0f9b5347c670693a 100644 --- a/prdoc/pr_7634.prdoc +++ b/prdoc/pr_7634.prdoc @@ -13,4 +13,4 @@ crates: - name: frame-support-procedural bump: major - name: bridge-hub-westend-runtime - bump: none + bump: patch diff --git a/prdoc/pr_7655.prdoc b/prdoc/pr_7655.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..0f56a9eb6dc815dd345151f14b69fcea8e328328 --- /dev/null +++ b/prdoc/pr_7655.prdoc @@ -0,0 +1,73 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: derive `DecodeWithMemTracking` for `Block` + +doc: + - audience: Runtime Dev + description: | + This PR adds `DecodeWithMemTracking` as a trait bound for `Header`, `Block` and `TransactionExtension` and + derives it for all the types that implement these traits in `polkadot-sdk`. + All the external types that implement these traits will need to implement `DecodeWithMemTracking` as well. + +crates: + - name: sp-runtime + bump: major + - name: sp-staking + bump: minor + - name: bp-runtime + bump: major + - name: bridge-runtime-common + bump: patch + - name: frame-executive + bump: patch + - name: frame-support + bump: major + - name: frame-system + bump: minor + - name: pallet-balances + bump: minor + - name: pallet-verify-signature + bump: minor + - name: pallet-transaction-payment + bump: minor + - name: pallet-sudo + bump: minor + - name: polkadot-runtime-common + bump: minor + - name: cumulus-pallet-weight-reclaim + bump: minor + - name: cumulus-primitives-storage-weight-reclaim + bump: minor + - name: frame-benchmarking-cli + bump: patch + - name: frame-metadata-hash-extension + bump: minor + - name: pallet-assets + bump: minor + - name: pallet-assets-freezer + bump: minor + - name: pallet-asset-tx-payment + bump: minor + - name: pallet-bridge-relayers + bump: minor + - name: pallet-bridge-messages + bump: minor + - name: pallet-asset-conversion-tx-payment + bump: minor + - name: pallet-referenda + bump: minor + - name: pallet-revive + bump: minor + - name: pallet-skip-feeless-payment + bump: minor + - name: pallet-staking + bump: minor + - name: staging-xcm-builder + bump: patch + - name: staging-xcm-executor + bump: patch + - name: bp-polkadot-bulletin + bump: minor + - name: frame-system-benchmarking + bump: patch diff --git a/prdoc/pr_7662.prdoc b/prdoc/pr_7662.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..050ef3aa88e4df0a0a27f18c133cc8c123918389 --- /dev/null +++ b/prdoc/pr_7662.prdoc @@ -0,0 +1,26 @@ +title: 'pallet_revive: Change address derivation to use hashing' +doc: +- audience: Runtime Dev + description: |- + ## Motivation + + Internal auditors recommended to not truncate Polkadot Addresses when deriving Ethereum addresses from it. Reasoning is that they are raw public keys where truncating could lead to collisions when weaknesses in those curves are discovered in the future. Additionally, some pallets generate account addresses in a way where only the suffix we were truncating contains any entropy. The changes in this PR act as a safe guard against those two points. + + ## Changes made + + We change the `to_address` function to first hash the AccountId32 and then use trailing 20 bytes as `AccountId20`. If the `AccountId32` ends with 12x 0xEE we keep our current behaviour of just truncating those trailing bytes. + + ## Security Discussion + + This will allow us to still recover the original `AccountId20` because those are constructed by just adding those 12 bytes. Please note that generating an ed25519 key pair where the trailing 12 bytes are 0xEE is theoretically possible as 96bits is not a huge search space. However, this cannot be used as an attack vector. It will merely allow this address to interact with `pallet_revive` without registering as the fallback account is the same as the actual address. The ultimate vanity address. In practice, this is not relevant since the 0xEE addresses are not valid public keys for sr25519 which is used almost everywhere. + + tl:dr: We keep truncating in case of an Ethereum address derived account id. This is safe as those are already derived via keccak. In every other case where we have to assume that the account id might be a public key. Therefore we first hash and then take the trailing bytes. + + ## Do we need a Migration for Westend + + No. We changed the name of the mapping. This means the runtime will not try to read the old data. Ethereum keys are unaffected by this change. We just advise people to re-register their AccountId32 in case they need to use it as it is a very small circle of users (just 3 addresses registered). This will not cause disturbance on Westend. +crates: +- name: pallet-revive + bump: major +- name: pallet-revive-fixtures + bump: major diff --git a/prdoc/pr_7700.prdoc b/prdoc/pr_7700.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..2764058d3918bc429d3f989324c2bc46e09f96df --- /dev/null +++ b/prdoc/pr_7700.prdoc @@ -0,0 +1,29 @@ +title: '[AHM] Poke deposits: Multisig pallet' +doc: +- audience: Runtime Dev + description: This PR adds a new extrinsic `poke_deposit` to `pallet-multisig`. This extrinsic will be used to re-adjust the deposits made in the pallet to create a multisig operation. +crates: +- name: asset-hub-rococo-runtime + bump: major +- name: asset-hub-westend-runtime + bump: major +- name: bridge-hub-rococo-runtime + bump: major +- name: bridge-hub-westend-runtime + bump: major +- name: collectives-westend-runtime + bump: major +- name: coretime-rococo-runtime + bump: major +- name: coretime-westend-runtime + bump: major +- name: people-rococo-runtime + bump: major +- name: people-westend-runtime + bump: major +- name: rococo-runtime + bump: major +- name: westend-runtime + bump: major +- name: pallet-multisig + bump: major diff --git a/prdoc/pr_7724.prdoc b/prdoc/pr_7724.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..30c1da3fc1553f1ca438ce753b0996effd2817f9 --- /dev/null +++ b/prdoc/pr_7724.prdoc @@ -0,0 +1,13 @@ +title: Terminate libp2p the outbound notification substream on io errors + +doc: + - audience: [Node Dev, Node Operator] + description: | + This PR handles a case where we called the poll_next on an outbound substream notification to check if the stream is closed. + It is entirely possible that the poll_next would return an io::error, for example end of file. + This PR ensures that we make the distinction between unexpected incoming data, and error originated from poll_next. + While at it, the bulk of the PR change propagates the PeerID from the network behavior, through the notification handler, to the notification outbound stream for logging purposes. + +crates: + - name: sc-network + bump: patch diff --git a/prdoc/pr_7734.prdoc b/prdoc/pr_7734.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..60a4935956e7f4fd3ca1f258af0139800d32fa58 --- /dev/null +++ b/prdoc/pr_7734.prdoc @@ -0,0 +1,8 @@ +title: Simplify event assertion with predicate-based check +doc: +- audience: Runtime Dev + description: |- + Simplify event assertions by introducing `contains_event`, reducing duplicated code. +crates: +- name: xcm-simulator-example + bump: patch diff --git a/prdoc/pr_7243.prdoc b/prdoc/stable2412-2/pr_7243.prdoc similarity index 100% rename from prdoc/pr_7243.prdoc rename to prdoc/stable2412-2/pr_7243.prdoc diff --git a/prdoc/pr_7307.prdoc b/prdoc/stable2412-2/pr_7307.prdoc similarity index 100% rename from prdoc/pr_7307.prdoc rename to prdoc/stable2412-2/pr_7307.prdoc diff --git a/prdoc/pr_7365.prdoc b/prdoc/stable2412-2/pr_7365.prdoc similarity index 100% rename from prdoc/pr_7365.prdoc rename to prdoc/stable2412-2/pr_7365.prdoc diff --git a/prdoc/stable2412-2/pr_7367.prdoc b/prdoc/stable2412-2/pr_7367.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..cfbfb2a703cb69649112caa267e18665e853e0da --- /dev/null +++ b/prdoc/stable2412-2/pr_7367.prdoc @@ -0,0 +1,8 @@ +title: Align omni-node and polkadot-parachain versions +doc: +- audience: [ Runtime Dev, Node Dev, Node Operator ] + description: |- + Aligned polkadot-omni-node & polkadot-parachain versions. There is one NODE_VERSION constant, in polkadot-omni-node-lib, used by both binaries. +crates: +- name: polkadot-omni-node-lib + bump: patch diff --git a/prdoc/pr_7383.prdoc b/prdoc/stable2412-2/pr_7383.prdoc similarity index 100% rename from prdoc/pr_7383.prdoc rename to prdoc/stable2412-2/pr_7383.prdoc diff --git a/prdoc/pr_7451.prdoc b/prdoc/stable2412-2/pr_7451.prdoc similarity index 100% rename from prdoc/pr_7451.prdoc rename to prdoc/stable2412-2/pr_7451.prdoc diff --git a/prdoc/pr_7488.prdoc b/prdoc/stable2412-2/pr_7488.prdoc similarity index 100% rename from prdoc/pr_7488.prdoc rename to prdoc/stable2412-2/pr_7488.prdoc diff --git a/prdoc/pr_7504.prdoc b/prdoc/stable2412-2/pr_7504.prdoc similarity index 100% rename from prdoc/pr_7504.prdoc rename to prdoc/stable2412-2/pr_7504.prdoc diff --git a/prdoc/stable2412-2/pr_7605.prdoc b/prdoc/stable2412-2/pr_7605.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..30e22a7ccf8665db07dcb6cdd72062fec46da6d9 --- /dev/null +++ b/prdoc/stable2412-2/pr_7605.prdoc @@ -0,0 +1,17 @@ +title: Fix issue with InitiateTransfer and UnpaidExecution +doc: +- audience: Runtime Dev + description: + Fix issue where setting the `remote_fees` field of `InitiateTransfer` to `None` could lead to unintended bypassing of fees in certain conditions. + `UnpaidExecution` is now appended **after** origin alteration. + If planning to use `UnpaidExecution`, you need to set `preserve_origin = true`. + + The `AllowExplicitUnpaidExecutionFrom` barrier now allows instructions for receiving funds before origin altering instructions before + the actual `UnpaidExecution`. + It takes a new generic, `Aliasers`, needed for executing `AliasOrigin` to see if the effective origin is allowed to use `UnpaidExecution`. + This should be set to the same value as `Aliasers` in the XCM configuration. +crates: +- name: staging-xcm-builder + bump: patch +- name: staging-xcm-executor + bump: patch diff --git a/prdoc/pr_7640.prdoc b/prdoc/stable2412-2/pr_7640.prdoc similarity index 100% rename from prdoc/pr_7640.prdoc rename to prdoc/stable2412-2/pr_7640.prdoc diff --git a/scripts/generate-umbrella.py b/scripts/generate-umbrella.py index 388573707822fcd771da6dff779c2dad56d2eff2..13b39a6172a90f853af055f71e4f1b702cc5f756 100644 --- a/scripts/generate-umbrella.py +++ b/scripts/generate-umbrella.py @@ -77,7 +77,7 @@ def main(path, version): with open(lib_path, "r") as f: nostd_crate = False for line in f: - line = line.strip() + line = line.strip() if line == "#![no_std]" or line == '#![cfg_attr(not(feature = "std"), no_std)]': nostd_crate = True break @@ -179,16 +179,17 @@ def main(path, version): Delete the umbrella folder and remove the umbrella crate from the workspace. """ def delete_umbrella(path): - umbrella_dir = os.path.join(path, "umbrella") # remove the umbrella crate from the workspace manifest = os.path.join(path, "Cargo.toml") manifest = open(manifest, "r").read() manifest = re.sub(r'\s+"umbrella",\n', "", manifest) with open(os.path.join(path, "Cargo.toml"), "w") as f: f.write(manifest) + umbrella_dir = os.path.join(path, "umbrella") if os.path.exists(umbrella_dir): print(f"Deleting {umbrella_dir}") - shutil.rmtree(umbrella_dir) + os.remove(os.path.join(umbrella_dir, "Cargo.toml")) + shutil.rmtree(os.path.join(umbrella_dir, "src")) """ Create the umbrella crate and add it to the workspace. diff --git a/substrate/client/network/src/protocol/notifications/behaviour.rs b/substrate/client/network/src/protocol/notifications/behaviour.rs index 217ef304bd0fc6c96fffc33fdb08b8ae38a1c47d..f524d3f0d3d1d02b6618f5f974c06f1b8c44508c 100644 --- a/substrate/client/network/src/protocol/notifications/behaviour.rs +++ b/substrate/client/network/src/protocol/notifications/behaviour.rs @@ -703,7 +703,7 @@ impl Notifications { self.events.push_back(ToSwarm::NotifyHandler { peer_id, handler: NotifyHandler::One(*connec_id), - event: NotifsHandlerIn::Open { protocol_index: set_id.into() }, + event: NotifsHandlerIn::Open { protocol_index: set_id.into(), peer_id }, }); *connec_state = ConnectionState::Opening; *occ_entry.into_mut() = PeerState::Enabled { connections }; @@ -1062,7 +1062,10 @@ impl Notifications { self.events.push_back(ToSwarm::NotifyHandler { peer_id: incoming.peer_id, handler: NotifyHandler::One(*connec_id), - event: NotifsHandlerIn::Open { protocol_index: incoming.set_id.into() }, + event: NotifsHandlerIn::Open { + protocol_index: incoming.set_id.into(), + peer_id: incoming.peer_id, + }, }); *connec_state = ConnectionState::Opening; } @@ -1260,7 +1263,10 @@ impl NetworkBehaviour for Notifications { self.events.push_back(ToSwarm::NotifyHandler { peer_id, handler: NotifyHandler::One(connection_id), - event: NotifsHandlerIn::Open { protocol_index: set_id.into() }, + event: NotifsHandlerIn::Open { + protocol_index: set_id.into(), + peer_id, + }, }); let mut connections = SmallVec::new(); @@ -1762,7 +1768,10 @@ impl NetworkBehaviour for Notifications { self.events.push_back(ToSwarm::NotifyHandler { peer_id, handler: NotifyHandler::One(connection_id), - event: NotifsHandlerIn::Open { protocol_index: set_id.into() }, + event: NotifsHandlerIn::Open { + protocol_index: set_id.into(), + peer_id, + }, }); *connec_state = ConnectionState::Opening; } else { @@ -1849,7 +1858,10 @@ impl NetworkBehaviour for Notifications { self.events.push_back(ToSwarm::NotifyHandler { peer_id, handler: NotifyHandler::One(connection_id), - event: NotifsHandlerIn::Open { protocol_index: set_id.into() }, + event: NotifsHandlerIn::Open { + protocol_index: set_id.into(), + peer_id, + }, }); *connec_state = ConnectionState::Opening; @@ -2336,7 +2348,7 @@ impl NetworkBehaviour for Notifications { self.events.push_back(ToSwarm::NotifyHandler { peer_id, handler: NotifyHandler::One(*connec_id), - event: NotifsHandlerIn::Open { protocol_index: set_id.into() }, + event: NotifsHandlerIn::Open { protocol_index: set_id.into(), peer_id }, }); *connec_state = ConnectionState::Opening; *peer_state = PeerState::Enabled { connections: mem::take(connections) }; diff --git a/substrate/client/network/src/protocol/notifications/handler.rs b/substrate/client/network/src/protocol/notifications/handler.rs index 416a35ad88c9ac1cf24675c37904998bb8d943f3..c5f0de9991c7121fb4d69ac92864166aede29d0c 100644 --- a/substrate/client/network/src/protocol/notifications/handler.rs +++ b/substrate/client/network/src/protocol/notifications/handler.rs @@ -264,6 +264,9 @@ pub enum NotifsHandlerIn { Open { /// Index of the protocol in the list of protocols passed at initialization. protocol_index: usize, + + /// The peer id of the remote. + peer_id: PeerId, }, /// Instruct the handler to close the notification substreams, or reject any pending incoming @@ -632,7 +635,7 @@ impl ConnectionHandler for NotifsHandler { fn on_behaviour_event(&mut self, message: NotifsHandlerIn) { match message { - NotifsHandlerIn::Open { protocol_index } => { + NotifsHandlerIn::Open { protocol_index, peer_id } => { let protocol_info = &mut self.protocols[protocol_index]; match &mut protocol_info.state { State::Closed { pending_opening } => { @@ -642,6 +645,7 @@ impl ConnectionHandler for NotifsHandler { protocol_info.config.fallback_names.clone(), protocol_info.config.handshake.read().clone(), protocol_info.config.max_notification_size, + peer_id, ); self.events_queue.push_back( @@ -663,6 +667,7 @@ impl ConnectionHandler for NotifsHandler { protocol_info.config.fallback_names.clone(), handshake_message.clone(), protocol_info.config.max_notification_size, + peer_id, ); self.events_queue.push_back( @@ -1202,7 +1207,10 @@ pub mod tests { .await; // move the handler state to 'Opening' - handler.on_behaviour_event(NotifsHandlerIn::Open { protocol_index: 0 }); + handler.on_behaviour_event(NotifsHandlerIn::Open { + protocol_index: 0, + peer_id: PeerId::random(), + }); assert!(std::matches!( handler.protocols[0].state, State::Opening { in_substream: Some(_), .. } @@ -1273,7 +1281,10 @@ pub mod tests { .await; // move the handler state to 'Opening' - handler.on_behaviour_event(NotifsHandlerIn::Open { protocol_index: 0 }); + handler.on_behaviour_event(NotifsHandlerIn::Open { + protocol_index: 0, + peer_id: PeerId::random(), + }); assert!(std::matches!( handler.protocols[0].state, State::Opening { in_substream: Some(_), .. } @@ -1362,7 +1373,10 @@ pub mod tests { // first instruct the handler to open a connection and then close it right after // so the handler is in state `Closed { pending_opening: true }` - handler.on_behaviour_event(NotifsHandlerIn::Open { protocol_index: 0 }); + handler.on_behaviour_event(NotifsHandlerIn::Open { + protocol_index: 0, + peer_id: PeerId::random(), + }); assert!(std::matches!( handler.protocols[0].state, State::Opening { in_substream: Some(_), .. } @@ -1421,7 +1435,10 @@ pub mod tests { // first instruct the handler to open a connection and then close it right after // so the handler is in state `Closed { pending_opening: true }` - handler.on_behaviour_event(NotifsHandlerIn::Open { protocol_index: 0 }); + handler.on_behaviour_event(NotifsHandlerIn::Open { + protocol_index: 0, + peer_id: PeerId::random(), + }); assert!(std::matches!( handler.protocols[0].state, State::Opening { in_substream: Some(_), .. } @@ -1502,7 +1519,10 @@ pub mod tests { // first instruct the handler to open a connection and then close it right after // so the handler is in state `Closed { pending_opening: true }` - handler.on_behaviour_event(NotifsHandlerIn::Open { protocol_index: 0 }); + handler.on_behaviour_event(NotifsHandlerIn::Open { + protocol_index: 0, + peer_id: PeerId::random(), + }); assert!(std::matches!( handler.protocols[0].state, State::Opening { in_substream: Some(_), .. } @@ -1550,7 +1570,10 @@ pub mod tests { // first instruct the handler to open a connection and then close it right after // so the handler is in state `Closed { pending_opening: true }` - handler.on_behaviour_event(NotifsHandlerIn::Open { protocol_index: 0 }); + handler.on_behaviour_event(NotifsHandlerIn::Open { + protocol_index: 0, + peer_id: PeerId::random(), + }); assert!(std::matches!( handler.protocols[0].state, State::Opening { in_substream: Some(_), .. } diff --git a/substrate/client/network/src/protocol/notifications/tests/conformance.rs b/substrate/client/network/src/protocol/notifications/tests/conformance.rs new file mode 100644 index 0000000000000000000000000000000000000000..421177997f99840a1cbf6aa753b42fcd5f2278c7 --- /dev/null +++ b/substrate/client/network/src/protocol/notifications/tests/conformance.rs @@ -0,0 +1,1070 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <https://www.gnu.org/licenses/>. + +use crate::{ + peer_store::{PeerStore, PeerStoreHandle, PeerStoreProvider}, + protocol::notifications::{ + service::notification_service, Notifications, NotificationsOut, ProtocolConfig, + }, + protocol_controller::{ProtoSetConfig, ProtocolController, SetId}, + service::metrics::NotificationMetrics, + NotificationService, +}; + +use futures::prelude::*; +use libp2p::{ + core::upgrade, + identity, + swarm::{Swarm, SwarmEvent}, + PeerId, +}; +use sc_utils::mpsc::tracing_unbounded; +use std::{collections::HashSet, iter, num::NonZeroUsize, pin::Pin, sync::Arc, time::Duration}; + +use litep2p::{ + config::ConfigBuilder as Litep2pConfigBuilder, + protocol::notification::{ + Config as NotificationConfig, NotificationEvent as Litep2pNotificationEvent, + NotificationHandle, ValidationResult as Litep2pValidationResult, + }, + transport::tcp::config::Config as TcpConfig, + types::protocol::ProtocolName as Litep2pProtocolName, + Litep2p, Litep2pEvent, +}; + +fn setup_libp2p( + in_peers: u32, + out_peers: u32, +) -> (Swarm<Notifications>, PeerStoreHandle, Box<dyn NotificationService>) { + let local_key = identity::Keypair::generate_ed25519(); + let local_peer_id = PeerId::from(local_key.public()); + let peer_store = PeerStore::new(vec![], None); + + let (to_notifications, from_controller) = + tracing_unbounded("test_protocol_controller_to_notifications", 10_000); + + let (protocol_handle_pair, notif_service) = notification_service("/foo".into()); + + let (controller_handle, controller) = ProtocolController::new( + SetId::from(0usize), + ProtoSetConfig { + in_peers, + out_peers, + reserved_nodes: HashSet::new(), + reserved_only: false, + }, + to_notifications.clone(), + Arc::new(peer_store.handle()), + ); + let peer_store_handle = peer_store.handle(); + tokio::spawn(controller.run()); + tokio::spawn(peer_store.run()); + + let (notif_handle, command_stream) = protocol_handle_pair.split(); + + let behaviour = Notifications::new( + vec![controller_handle], + from_controller, + NotificationMetrics::new(None), + iter::once(( + ProtocolConfig { + name: "/foo".into(), + fallback_names: Vec::new(), + handshake: vec![1, 2, 3, 4], + max_notification_size: 1024 * 1024, + }, + notif_handle, + command_stream, + )), + ); + let transport = crate::transport::build_transport(local_key.clone().into(), false); + + let mut swarm = { + struct SpawnImpl {} + impl libp2p::swarm::Executor for SpawnImpl { + fn exec(&self, f: Pin<Box<dyn Future<Output = ()> + Send>>) { + tokio::spawn(f); + } + } + + let config = libp2p::swarm::Config::with_executor(SpawnImpl {}) + .with_substream_upgrade_protocol_override(upgrade::Version::V1) + .with_notify_handler_buffer_size(NonZeroUsize::new(32).expect("32 != 0; qed")) + // NOTE: 24 is somewhat arbitrary and should be tuned in the future if + // necessary. See <https://github.com/paritytech/substrate/pull/6080> + .with_per_connection_event_buffer_size(24) + .with_max_negotiating_inbound_streams(2048) + .with_idle_connection_timeout(Duration::from_secs(5)); + + Swarm::new(transport.0, behaviour, local_peer_id, config) + }; + + swarm.listen_on("/ip6/::1/tcp/0".parse().unwrap()).unwrap(); + + (swarm, peer_store_handle, notif_service) +} + +async fn setup_litep2p() -> (Litep2p, NotificationHandle) { + let (notif_config, handle) = NotificationConfig::new( + Litep2pProtocolName::from("/foo"), + 1024 * 1024, + vec![1, 2, 3, 4], + Vec::new(), + false, + 64, + 64, + true, + ); + + let config1 = Litep2pConfigBuilder::new() + .with_tcp(TcpConfig { + listen_addresses: vec!["/ip6/::1/tcp/0".parse().unwrap()], + ..Default::default() + }) + .with_notification_protocol(notif_config) + .build(); + let litep2p = Litep2p::new(config1).unwrap(); + + (litep2p, handle) +} + +/// Test ensures litep2p can dial and connect to libp2p. +#[tokio::test] +async fn test_libp2p_litep2p_connectivity() { + let (mut litep2p, _notif_handle) = setup_litep2p().await; + let (mut libp2p, _peerstore, _notification_service) = setup_libp2p(1, 1); + + let libp2p_address = loop { + let event = libp2p.select_next_some().await; + match event { + SwarmEvent::NewListenAddr { address, .. } => { + break address; + }, + _ => {}, + } + }; + let libp2p_address = libp2p_address.with_p2p(*libp2p.local_peer_id()).unwrap(); + let libp2p_address: sc_network_types::multiaddr::Multiaddr = libp2p_address.clone().into(); + litep2p.dial_address(libp2p_address.into()).await.unwrap(); + + let mut libp2p_connected = false; + let mut litep2p_connected = false; + + loop { + tokio::select! { + event = litep2p.next_event() => match event.unwrap() { + Litep2pEvent::ConnectionEstablished { .. } => { + litep2p_connected = true; + } + _ => {}, + }, + + event = libp2p.select_next_some() => match event { + SwarmEvent::ConnectionEstablished { .. } => { + libp2p_connected = true; + } + _ => {}, + }, + } + + if libp2p_connected && litep2p_connected { + break; + } + } +} + +/// A ping pong between libp2p and low level litep2p at notification level. +#[tokio::test] +async fn libp2p_to_litep2p_substream() { + let (mut litep2p, mut handle) = setup_litep2p().await; + let (mut libp2p, peerstore, _notification_service) = setup_libp2p(1, 1); + + let libp2p_peer = *libp2p.local_peer_id(); + let litep2p_peer = *litep2p.local_peer_id(); + + let litep2p_address = litep2p.listen_addresses().into_iter().next().unwrap().clone(); + let address: sc_network_types::multiaddr::Multiaddr = litep2p_address.clone().into(); + let address: libp2p::multiaddr::Multiaddr = address.into(); + libp2p.dial(address).unwrap(); + + let mut libp2p_ready = false; + let mut litep2p_ready = false; + let mut litep2p_3333_seen = false; + let mut litep2p_4444_seen = false; + let mut libp2p_1111_seen = false; + let mut libp2p_2222_seen = false; + + while !libp2p_ready || + !litep2p_ready || + !litep2p_3333_seen || + !litep2p_4444_seen || + !libp2p_1111_seen || + !libp2p_2222_seen + { + tokio::select! { + event = libp2p.select_next_some() => match event { + SwarmEvent::ConnectionEstablished { .. } => { + peerstore.add_known_peer(litep2p_peer.into()); + } + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolOpen { peer_id, set_id, negotiated_fallback, received_handshake, notifications_sink, .. }) => { + assert_eq!(peer_id.to_bytes(), litep2p_peer.to_bytes()); + assert_eq!(set_id, SetId::from(0usize)); + assert_eq!(received_handshake, vec![1, 2, 3, 4]); + assert!(negotiated_fallback.is_none()); + + notifications_sink.reserve_notification().await.unwrap().send(vec![3, 3, 3, 3]).unwrap(); + notifications_sink.send_sync_notification(vec![4, 4, 4, 4]); + + libp2p_ready = true; + } + SwarmEvent::Behaviour(NotificationsOut::Notification { peer_id, set_id, message }) => { + assert_eq!(peer_id.to_bytes(), litep2p_peer.to_bytes()); + assert_eq!(set_id, SetId::from(0usize)); + + if message == vec![1, 1, 1, 1] { + libp2p_1111_seen = true; + } else if message == vec![2, 2, 2, 2] { + libp2p_2222_seen = true; + } + } + _ => {}, + }, + + _event = litep2p.next_event() => {}, + + event = handle.next() => match event.unwrap() { + Litep2pNotificationEvent::ValidateSubstream { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle.send_validation_result(peer, Litep2pValidationResult::Accept); + litep2p_ready = true; + } + Litep2pNotificationEvent::NotificationStreamOpened { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle.send_sync_notification(peer, vec![1, 1, 1, 1]).unwrap(); + handle.send_async_notification(peer, vec![2, 2, 2, 2]).await.unwrap(); + } + Litep2pNotificationEvent::NotificationReceived { peer, notification } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + + if notification == vec![3, 3, 3, 3] { + litep2p_3333_seen = true; + } else if notification == vec![4, 4, 4, 4] { + litep2p_4444_seen = true; + } + } + _ => {}, + } + } + } +} + +/// Litep2p rejects the libp2p substream. The connection finishes due to the keep-alive mechanism +/// detecting the connection as idle. In this case, substrate does not force reopen the substreams. +#[tokio::test] +async fn litep2p_rejects_libp2p_substream() { + let (mut litep2p, mut handle) = setup_litep2p().await; + let (mut libp2p, peerstore, _notification_service) = setup_libp2p(1, 1); + + let libp2p_peer = *libp2p.local_peer_id(); + let litep2p_peer = *litep2p.local_peer_id(); + + let litep2p_address = litep2p.listen_addresses().into_iter().next().unwrap().clone(); + let address: sc_network_types::multiaddr::Multiaddr = litep2p_address.clone().into(); + let address: libp2p::multiaddr::Multiaddr = address.into(); + libp2p.dial(address).unwrap(); + + const RETRY_DURATION: Duration = Duration::from_secs(5); + // Check that libp2p does not eagerly retry opening the rejected substream by litep2p. + let mut first_notification = None; + + loop { + tokio::select! { + event = libp2p.select_next_some() => { + log::info!("[libp2p] event: {event:?}"); + + match event { + SwarmEvent::ConnectionEstablished { .. } => { + peerstore.add_known_peer(litep2p_peer.into()); + } + _ => {}, + } + }, + + event = litep2p.next_event() => { + log::info!("[litep2p] event: {event:?}"); + + match event { + Some(Litep2pEvent::ConnectionClosed { .. }) => break, + _ => {}, + } + }, + + event = handle.next() => match event.unwrap() { + Litep2pNotificationEvent::ValidateSubstream { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle.send_validation_result(peer, Litep2pValidationResult::Reject); + log::info!("reject substream"); + + match first_notification { + None => { + first_notification = Some(std::time::Instant::now()); + }, + Some(instant) => { + let elapsed = instant.elapsed(); + if elapsed < RETRY_DURATION { + log::error!("Expecting libp2p substream to retry after 5 seconds, elapsed: {elapsed:?}"); + panic!("Libp2p substream was not rejected and is expected to retry after 5 seconds"); + } else { + // Finish testing. + return; + } + }, + } + } + _ => {}, + }, + } + } +} + +/// Libp2p LHS disconnects from Libp2p RHS after receiving a notification. +/// The protocol controller reopens the substream and the connection is re-established. +#[tokio::test] +async fn libp2p_disconnects_libp2p_substream() { + let (mut libp2p_lhs, peerstore_lhs, _notification_service) = setup_libp2p(1, 1); + let (mut libp2p_rhs, peerstore_rhs, _notification_service) = setup_libp2p(1, 1); + + let libp2p_lhs_peer = *libp2p_lhs.local_peer_id(); + let libp2p_rhs_peer = *libp2p_rhs.local_peer_id(); + + let libp2p_lhs_address = loop { + let event = libp2p_lhs.select_next_some().await; + match event { + SwarmEvent::NewListenAddr { address, .. } => { + log::info!("libp2p lhs address: {address:?}"); + break address.clone(); + }, + _ => {}, + } + }; + + libp2p_rhs.dial(libp2p_lhs_address).unwrap(); + + // Disarm first timer interval that fires immediately. + let mut timer = tokio::time::interval(std::time::Duration::from_secs(5)); + timer.tick().await; + + let mut sink = None; + let mut notification_count = 0; + let mut open_times = 0; + let mut recv_1111 = 0; + let mut recv_2222 = 0; + let mut recv_3333 = 0; + let mut recv_4444 = 0; + let mut recv_5555 = 0; + let mut recv_6666 = 0; + + loop { + tokio::select! { + _ = timer.tick() => { + break; + } + + event = libp2p_lhs.select_next_some() => { + log::info!("[libp2p lhs] event: {event:?}"); + match event { + SwarmEvent::ConnectionEstablished { .. } => { + peerstore_lhs.add_known_peer(libp2p_rhs_peer.into()); + }, + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolOpen { set_id, negotiated_fallback, received_handshake, notifications_sink, .. }) => { + assert_eq!(set_id, SetId::from(0usize)); + assert_eq!(received_handshake, vec![1, 2, 3, 4]); + assert!(negotiated_fallback.is_none()); + + notifications_sink.reserve_notification().await.unwrap().send(vec![3, 3, 3, 3]).unwrap(); + notifications_sink.send_sync_notification(vec![4, 4, 4, 4]); + + open_times += 1; + }, + SwarmEvent::Behaviour(NotificationsOut::Notification { peer_id, set_id, message }) => { + if message == vec![1, 1, 1, 1] { + recv_1111 += 1; + } else if message == vec![2, 2, 2, 2] { + recv_2222 += 1; + } else if message == vec![3, 3, 3, 3] { + recv_3333+= 1; + } else if message == vec![4, 4, 4, 4] { + recv_4444 += 1; + } else if message == vec![5, 5, 5, 5] { + recv_5555 += 1; + } else if message == vec![6, 6, 6, 6] { + recv_6666 += 1; + } + + notification_count += 1; + if notification_count == 2 { + // Disconnect the peer. + log::info!("Disconnecting peer: {peer_id:?}"); + + libp2p_lhs.behaviour_mut().disconnect_peer(&peer_id, set_id); + } + }, + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolClosed { .. }) => { + // Use the rhs sink to send notifications to the lhs node. + // + // The rhs node is not aware that the lhs node has disconnected. + // This is because lhs disconnected the node on the second notification received above, + // and because of this it is guaranteed for the LHS swarm to promptly generate + // the `NotificationsOut::CustomProtocolClosed` event. At the same time, the rhs swarm + // is not polled. + // + // Because the lhs substream is closed, these notifications are lost. However, + // the rhs behaves as if the substream is still open. + let sink: crate::service::NotificationsSink = sink.take().unwrap(); + sink.reserve_notification().await.unwrap().send(vec![5, 5, 5, 5]).unwrap(); + sink.send_sync_notification(vec![6, 6, 6, 6]); + } + _ => {}, + } + } + + event = libp2p_rhs.select_next_some() => { + log::info!("[libp2p lhs] event: {event:?}"); + + match event { + SwarmEvent::ConnectionEstablished { .. } => { + peerstore_rhs.add_known_peer(libp2p_lhs_peer.into()); + }, + SwarmEvent::ConnectionClosed { .. } => { + panic!("Keep alive should not close the connection because the notification controller should reopen the substream"); + } + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolOpen { set_id, negotiated_fallback, received_handshake, notifications_sink, .. }) => { + assert_eq!(set_id, SetId::from(0usize)); + assert_eq!(received_handshake, vec![1, 2, 3, 4]); + assert!(negotiated_fallback.is_none()); + + notifications_sink.reserve_notification().await.unwrap().send(vec![1, 1, 1, 1]).unwrap(); + notifications_sink.send_sync_notification(vec![2, 2, 2, 2]); + sink = Some(notifications_sink); + }, + SwarmEvent::Behaviour(NotificationsOut::Notification {message, .. }) => { + if message == vec![1, 1, 1, 1] { + recv_1111 += 1; + } else if message == vec![2, 2, 2, 2] { + recv_2222 += 1; + } else if message == vec![3, 3, 3, 3] { + recv_3333+= 1; + } else if message == vec![4, 4, 4, 4] { + recv_4444 += 1; + } else if message == vec![5, 5, 5, 5] { + recv_5555 += 1; + } else if message == vec![6, 6, 6, 6] { + recv_6666 += 1; + } + } + _ => {}, + } + + }, + } + } + + assert_eq!(open_times, 2); + assert_eq!(notification_count, 4); + assert_eq!(recv_1111, 2); + assert_eq!(recv_2222, 2); + assert_eq!(recv_3333, 2); + assert_eq!(recv_4444, 2); + assert_eq!(recv_5555, 0); + assert_eq!(recv_6666, 0); +} + +/// Libp2p disconnects the litep2p substream. +/// Then, the libp2p protocol controller reopens the substream and the connection is +/// re-established. +/// +/// # Warning +/// +/// It is unclear at the moment if this behavior is intended, considering that libp2p disconnected +/// the peer. +#[tokio::test] +async fn libp2p_disconnects_litep2p_substream() { + let (mut litep2p, mut handle) = setup_litep2p().await; + let (mut libp2p, peerstore, _notification_service) = setup_libp2p(1, 1); + + let libp2p_peer = *libp2p.local_peer_id(); + let litep2p_peer = *litep2p.local_peer_id(); + + let litep2p_address = litep2p.listen_addresses().into_iter().next().unwrap().clone(); + let address: sc_network_types::multiaddr::Multiaddr = litep2p_address.clone().into(); + let address: libp2p::multiaddr::Multiaddr = address.into(); + libp2p.dial(address).unwrap(); + + // Disarm first timer interval. + let mut timer = tokio::time::interval(std::time::Duration::from_secs(5)); + timer.tick().await; + + let mut notification_count = 0; + let mut open_times = 0; + let mut recv_1111 = 0; + let mut recv_2222 = 0; + let mut recv_3333 = 0; + let mut recv_4444 = 0; + let mut recv_5555 = 0; + let mut recv_6666 = 0; + + loop { + tokio::select! { + _ = timer.tick() => { + break; + } + + event = libp2p.select_next_some() => { + log::info!("[libp2p lhs] event: {event:?}"); + match event { + SwarmEvent::ConnectionEstablished { .. } => { + peerstore.add_known_peer(litep2p_peer.into()); + }, + + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolOpen { set_id, negotiated_fallback, received_handshake, notifications_sink, .. }) => { + assert_eq!(set_id, SetId::from(0usize)); + assert_eq!(received_handshake, vec![1, 2, 3, 4]); + assert!(negotiated_fallback.is_none()); + + notifications_sink.reserve_notification().await.unwrap().send(vec![3, 3, 3, 3]).unwrap(); + notifications_sink.send_sync_notification(vec![4, 4, 4, 4]); + + open_times += 1; + }, + + SwarmEvent::Behaviour(NotificationsOut::Notification { peer_id, set_id, message }) => { + if message == vec![1, 1, 1, 1] { + recv_1111 += 1; + } else if message == vec![2, 2, 2, 2] { + recv_2222 += 1; + } else if message == vec![3, 3, 3, 3] { + recv_3333+= 1; + } else if message == vec![4, 4, 4, 4] { + recv_4444 += 1; + } else if message == vec![5, 5, 5, 5] { + recv_5555 += 1; + } else if message == vec![6, 6, 6, 6] { + recv_6666 += 1; + } + + notification_count += 1; + if notification_count == 2 { + // Disconnect the peer. + log::info!("Disconnecting peer: {peer_id:?}"); + + libp2p.behaviour_mut().disconnect_peer(&peer_id, set_id); + } + }, + + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolClosed { .. }) => { + // At this point libp2p is disconnected from litep2p. + // However, litep2p still thinks its connected to libp2p and this notification is entirely lost. + let libp2p_peer: sc_network_types::PeerId = libp2p_peer.into(); + handle.send_sync_notification(libp2p_peer.into(), vec![5, 5, 5, 5]).unwrap(); + handle.send_async_notification(libp2p_peer.into(), vec![6, 6, 6, 6]).await.unwrap(); + } + _ => {}, + } + } + + event = litep2p.next_event() => { + log::info!("[litep2p] event: {event:?}"); + + match event { + Some(Litep2pEvent::ConnectionClosed { .. }) => { + panic!("Litep2p connection should not be closed by libp2p"); + } + _ => {}, + } + }, + + event = handle.next() => { + log::info!("[litep2p handle] event: {event:?}"); + match event.unwrap() { + Litep2pNotificationEvent::ValidateSubstream { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle.send_validation_result(peer, Litep2pValidationResult::Accept); + }, + Litep2pNotificationEvent::NotificationStreamOpened { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle.send_sync_notification(peer, vec![1, 1, 1, 1]).unwrap(); + handle.send_async_notification(peer, vec![2, 2, 2, 2]).await.unwrap(); + } + Litep2pNotificationEvent::NotificationReceived { peer, notification: message } => { + if message == vec![1, 1, 1, 1] { + recv_1111 += 1; + } else if message == vec![2, 2, 2, 2] { + recv_2222 += 1; + } else if message == vec![3, 3, 3, 3] { + recv_3333+= 1; + } else if message == vec![4, 4, 4, 4] { + recv_4444 += 1; + } else if message == vec![5, 5, 5, 5] { + recv_5555 += 1; + } else if message == vec![6, 6, 6, 6] { + recv_6666 += 1; + } + + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + } + event => log::info!("unhandled notification event: {event:?}"), + } + }, + } + } + + assert_eq!(open_times, 2); + assert_eq!(notification_count, 4); + assert_eq!(recv_1111, 2); + assert_eq!(recv_2222, 2); + assert_eq!(recv_3333, 2); + assert_eq!(recv_4444, 2); + assert_eq!(recv_5555, 0); + assert_eq!(recv_6666, 0); +} + +/// Litep2p force-closes the substream with libp2p. The protocol controller of libp2p reopens the +/// substream. +/// +/// The keep-alive mechanism should not detect the connection as closed, as it has at least one open +/// substream. +#[tokio::test] +async fn litep2p_disconnects_libp2p_substream() { + let (mut litep2p, mut handle) = setup_litep2p().await; + let (mut libp2p, peerstore, _notification_service) = setup_libp2p(1, 1); + + let libp2p_peer = *libp2p.local_peer_id(); + let litep2p_peer = *litep2p.local_peer_id(); + + let litep2p_address = litep2p.listen_addresses().into_iter().next().unwrap().clone(); + let address: sc_network_types::multiaddr::Multiaddr = litep2p_address.clone().into(); + let address: libp2p::multiaddr::Multiaddr = address.into(); + libp2p.dial(address).unwrap(); + + let mut notification_count = 0; + let mut open_times = 0; + + // Disarm first timer interval. + let mut timer = tokio::time::interval(std::time::Duration::from_secs(u64::MAX)); + timer.tick().await; + + loop { + tokio::select! { + _ = timer.tick() => { + assert_eq!(notification_count, 4); + assert_eq!(open_times, 2); + return; + } + + event = libp2p.select_next_some() => { + log::info!("[libp2p] event: {event:?}"); + match event { + SwarmEvent::ConnectionEstablished { .. } => { + peerstore.add_known_peer(litep2p_peer.into()); + }, + + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolOpen { set_id, negotiated_fallback, received_handshake, .. }) => { + assert_eq!(set_id, SetId::from(0usize)); + assert_eq!(received_handshake, vec![1, 2, 3, 4]); + assert!(negotiated_fallback.is_none()); + + open_times += 1; + }, + + SwarmEvent::Behaviour(NotificationsOut::Notification { peer_id, .. }) => { + notification_count += 1; + + if notification_count == 2 { + // Disconnect the peer. + log::info!("Disconnecting peer: {peer_id:?}"); + + let libp2p_peer: sc_network_types::PeerId = libp2p_peer.into(); + handle.close_substream(libp2p_peer.into()).await; + + // After closing the substream set the timer to 6s to ensure the connection does + // not close due to the keep-alive mechanism of 5s. + timer = tokio::time::interval(std::time::Duration::from_secs(6)); + timer.tick().await; + } + }, + _ => {}, + } + } + + event = litep2p.next_event() => { + log::info!("[litep2p] event: {event:?}"); + }, + + event = handle.next() => { + log::info!("[litep2p handle] event: {event:?}"); + + match event.unwrap() { + Litep2pNotificationEvent::ValidateSubstream { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle.send_validation_result(peer, Litep2pValidationResult::Accept); + }, + Litep2pNotificationEvent::NotificationStreamOpened { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle.send_sync_notification(peer, vec![1, 1, 1, 1]).unwrap(); + handle.send_async_notification(peer, vec![2, 2, 2, 2]).await.unwrap(); + } + Litep2pNotificationEvent::NotificationReceived { peer, .. } => { + assert_eq!(peer.to_bytes(), libp2p_peer.to_bytes()); + + } + Litep2pNotificationEvent::NotificationStreamClosed { .. } => { + } + _ => {}, + } + }, + } + } +} + +/// Raw litep2p closes the substream with a raw litep2p. +/// In this case, there's no protocol controller from substrate that will reopen the substream. +/// Therefore, since the substream is closed, the connection will be closed by the keep-alive. +#[tokio::test] +async fn litep2p_disconnects_litep2p_substream() { + let (mut litep2p_lhs, mut handle_lhs) = setup_litep2p().await; + let (mut litep2p_rhs, mut handle_rhs) = setup_litep2p().await; + + let litep2p_lhs_peer = *litep2p_lhs.local_peer_id(); + let litep2p_rhs_peer = *litep2p_rhs.local_peer_id(); + + let litep2p_address = litep2p_lhs.listen_addresses().into_iter().next().unwrap().clone(); + litep2p_rhs.dial_address(litep2p_address).await.unwrap(); + + let mut num_closed = 0; + let mut lhs_opened = 0; + let mut lhs_closed = 0; + let mut rhs_opened = 0; + let mut rhs_closed = 0; + + loop { + tokio::select! { + event = litep2p_lhs.next_event() => { + log::info!("[litep2p_lhs] event: {event:?}"); + + match event.unwrap() { + Litep2pEvent::ConnectionEstablished { .. } => { + handle_rhs.open_substream(litep2p_lhs_peer).await.unwrap(); + } + Litep2pEvent::ConnectionClosed { .. } => { + num_closed += 1; + if num_closed == 2 { + break; + } + } + _ => {}, + } + }, + + event = litep2p_rhs.next_event() => { + log::info!("[litep2p_rhs] event: {event:?}"); + + match event.unwrap() { + Litep2pEvent::ConnectionEstablished { .. } => { + handle_lhs.open_substream(litep2p_rhs_peer).await.unwrap(); + } + Litep2pEvent::ConnectionClosed { .. } => { + num_closed += 1; + if num_closed == 2 { + break; + } + } + _ => {}, + } + }, + + event = handle_rhs.next() => { + log::info!("[handle_rhs] event: {event:?}"); + + match event.unwrap() { + Litep2pNotificationEvent::ValidateSubstream { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), litep2p_lhs_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle_rhs.send_validation_result(peer, Litep2pValidationResult::Accept); + } + Litep2pNotificationEvent::NotificationStreamOpened { peer, handshake, .. } => { + rhs_opened += 1; + assert_eq!(peer.to_bytes(), litep2p_lhs_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle_rhs.send_sync_notification(peer, vec![1, 1, 1, 1]).unwrap(); + handle_rhs.send_async_notification(peer, vec![2, 2, 2, 2]).await.unwrap(); + } + Litep2pNotificationEvent::NotificationReceived { peer, .. } => { + assert_eq!(peer.to_bytes(), litep2p_lhs_peer.to_bytes()); + + handle_lhs.close_substream(litep2p_rhs_peer).await; + } + Litep2pNotificationEvent::NotificationStreamClosed { peer, .. } => { + rhs_closed += 1; + assert_eq!(peer.to_bytes(), litep2p_lhs_peer.to_bytes()); + } + _ => {}, + } + } + + event = handle_lhs.next() => { + log::info!("[handle_lhs] event: {event:?}"); + + match event.unwrap() { + Litep2pNotificationEvent::ValidateSubstream { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), litep2p_rhs_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle_lhs.send_validation_result(peer, Litep2pValidationResult::Accept); + } + Litep2pNotificationEvent::NotificationStreamOpened { peer, handshake, .. } => { + lhs_opened += 1; + + assert_eq!(peer.to_bytes(), litep2p_rhs_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle_lhs.send_sync_notification(peer, vec![1, 1, 1, 1]).unwrap(); + handle_lhs.send_async_notification(peer, vec![2, 2, 2, 2]).await.unwrap(); + } + Litep2pNotificationEvent::NotificationReceived { peer, .. } => { + assert_eq!(peer.to_bytes(), litep2p_rhs_peer.to_bytes()); + } + Litep2pNotificationEvent::NotificationStreamClosed { peer, .. } => { + lhs_closed += 1; + assert_eq!(peer.to_bytes(), litep2p_rhs_peer.to_bytes()); + } + _ => {}, + } + } + } + } + + assert_eq!(lhs_opened, 1); + assert_eq!(lhs_closed, 1); + assert_eq!(rhs_opened, 1); + assert_eq!(rhs_closed, 1); +} + +/// Keep the substream idle for a long time and ensure the connection is not closed by the +/// keep-alive mechanism. +#[tokio::test] +async fn litep2p_idle_litep2p_substream() { + let (mut litep2p_lhs, mut handle_lhs) = setup_litep2p().await; + let (mut litep2p_rhs, mut handle_rhs) = setup_litep2p().await; + + let litep2p_lhs_peer = *litep2p_lhs.local_peer_id(); + let litep2p_rhs_peer = *litep2p_rhs.local_peer_id(); + + let litep2p_address = litep2p_lhs.listen_addresses().into_iter().next().unwrap().clone(); + litep2p_rhs.dial_address(litep2p_address).await.unwrap(); + + // Disarm first timer interval. + let mut timer = tokio::time::interval(std::time::Duration::from_secs(6)); + timer.tick().await; + + loop { + tokio::select! { + _ = timer.tick() => { + return; + } + + event = litep2p_lhs.next_event() => { + log::info!("[litep2p lhs] event: {event:?}"); + + match event.unwrap() { + Litep2pEvent::ConnectionEstablished { .. } => { + handle_rhs.open_substream(litep2p_lhs_peer).await.unwrap(); + } + _ => {}, + } + }, + + event = litep2p_rhs.next_event() => { + log::info!("[litep2p rhs] event: {event:?}"); + + match event.unwrap() { + Litep2pEvent::ConnectionEstablished { .. } => { + handle_lhs.open_substream(litep2p_lhs_peer).await.unwrap(); + } + _ => {}, + } + }, + + event = handle_rhs.next() => { + log::info!("[handle rhs] event: {event:?}"); + + match event.unwrap() { + Litep2pNotificationEvent::ValidateSubstream { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), litep2p_lhs_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle_rhs.send_validation_result(peer, Litep2pValidationResult::Accept); + } + Litep2pNotificationEvent::NotificationStreamOpened { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), litep2p_lhs_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle_rhs.send_sync_notification(peer, vec![1, 1, 1, 1]).unwrap(); + handle_rhs.send_async_notification(peer, vec![2, 2, 2, 2]).await.unwrap(); + } + Litep2pNotificationEvent::NotificationReceived { peer, .. } => { + assert_eq!(peer.to_bytes(), litep2p_lhs_peer.to_bytes()); + } + Litep2pNotificationEvent::NotificationStreamClosed { .. } => { + panic!("Substream should not be closed by the keep-alive mechanism"); + } + _ => {}, + } + } + + event = handle_lhs.next() => { + log::info!("[handle lhs] event: {event:?}"); + + match event.unwrap() { + Litep2pNotificationEvent::ValidateSubstream { peer, handshake, .. } => { + assert_eq!(peer.to_bytes(), litep2p_rhs_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle_lhs.send_validation_result(peer, Litep2pValidationResult::Accept); + } + Litep2pNotificationEvent::NotificationStreamOpened { peer, handshake, ..} => { + assert_eq!(peer.to_bytes(), litep2p_rhs_peer.to_bytes()); + assert_eq!(handshake, vec![1, 2, 3, 4]); + + handle_lhs.send_sync_notification(peer, vec![1, 1, 1, 1]).unwrap(); + handle_lhs.send_async_notification(peer, vec![2, 2, 2, 2]).await.unwrap(); + } + Litep2pNotificationEvent::NotificationReceived { peer, .. } => { + assert_eq!(peer.to_bytes(), litep2p_rhs_peer.to_bytes()); + } + Litep2pNotificationEvent::NotificationStreamClosed { .. } => { + panic!("Substream should not be closed by the keep-alive mechanism"); + } + _ => {}, + } + } + } + } +} + +/// Keep the substream idle for a long time and ensure the connection is not closed by the +/// keep-alive mechanism. +#[tokio::test] +async fn libp2p_idle_to_libp2p_substream() { + let (mut libp2p_lhs, peerstore_lhs, _notification_service) = setup_libp2p(1, 1); + let (mut libp2p_rhs, peerstore_rhs, _notification_service) = setup_libp2p(1, 1); + + let libp2p_lhs_peer = *libp2p_lhs.local_peer_id(); + let libp2p_rhs_peer = *libp2p_rhs.local_peer_id(); + + let libp2p_lhs_address = loop { + let event = libp2p_lhs.select_next_some().await; + match event { + SwarmEvent::NewListenAddr { address, .. } => { + log::info!("libp2p lhs listener: {address:?}"); + + break address.clone(); + }, + _ => {}, + } + }; + + libp2p_rhs.dial(libp2p_lhs_address).unwrap(); + + // Disarm first timer interval. + let mut timer = tokio::time::interval(std::time::Duration::from_secs(6)); + timer.tick().await; + + loop { + tokio::select! { + _ = timer.tick() => { + return; + } + + event = libp2p_lhs.select_next_some() => { + log::info!("[libp2p lhs] event: {event:?}"); + match event { + SwarmEvent::ConnectionEstablished { .. } => { + peerstore_lhs.add_known_peer(libp2p_rhs_peer.into()); + }, + SwarmEvent::ConnectionClosed { .. } => { + panic!("Connection should not be closed by the keep-alive mechanism"); + } + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolOpen { set_id, negotiated_fallback, received_handshake, notifications_sink, .. }) => { + assert_eq!(set_id, SetId::from(0usize)); + assert_eq!(received_handshake, vec![1, 2, 3, 4]); + assert!(negotiated_fallback.is_none()); + + notifications_sink.reserve_notification().await.unwrap().send(vec![3, 3, 3, 3]).unwrap(); + notifications_sink.send_sync_notification(vec![4, 4, 4, 4]); + }, + SwarmEvent::Behaviour(NotificationsOut::Notification { .. }) => { }, + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolClosed { .. }) => { + panic!("Libp2p substream should not be closed by the keep-alive mechanism"); + } + _ => {}, + } + } + + event = libp2p_rhs.select_next_some() => { + log::info!("[LIBP2P LHS] event: {event:?}"); + + match event { + SwarmEvent::ConnectionEstablished { .. } => { + peerstore_rhs.add_known_peer(libp2p_lhs_peer.into()); + }, + SwarmEvent::ConnectionClosed { .. } => { + panic!("Connection should not be closed by the keep-alive mechanism"); + } + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolOpen { set_id, negotiated_fallback, received_handshake, notifications_sink, .. }) => { + assert_eq!(set_id, SetId::from(0usize)); + assert_eq!(received_handshake, vec![1, 2, 3, 4]); + assert!(negotiated_fallback.is_none()); + + notifications_sink.reserve_notification().await.unwrap().send(vec![3, 3, 3, 3]).unwrap(); + notifications_sink.send_sync_notification(vec![4, 4, 4, 4]); + }, + SwarmEvent::Behaviour(NotificationsOut::CustomProtocolClosed { .. }) => { + panic!("Libp2p substream should not be closed by the keep-alive mechanism"); + } + _ => {}, + } + }, + } + } +} diff --git a/substrate/client/network/src/protocol/notifications/tests.rs b/substrate/client/network/src/protocol/notifications/tests/mod.rs similarity index 99% rename from substrate/client/network/src/protocol/notifications/tests.rs rename to substrate/client/network/src/protocol/notifications/tests/mod.rs index 50f03b5911b67cb526800b64f7395525a9b14436..80ed0aa9f189ba00c658835aba96ab845b7c61cd 100644 --- a/substrate/client/network/src/protocol/notifications/tests.rs +++ b/substrate/client/network/src/protocol/notifications/tests/mod.rs @@ -49,6 +49,9 @@ use std::{ time::Duration, }; +#[cfg(test)] +mod conformance; + /// Builds two nodes that have each other as bootstrap nodes. /// This is to be used only for testing, and a panic will happen if something goes wrong. fn build_nodes() -> (Swarm<CustomProtoWithAddr>, Swarm<CustomProtoWithAddr>) { diff --git a/substrate/client/network/src/protocol/notifications/upgrade/notifications.rs b/substrate/client/network/src/protocol/notifications/upgrade/notifications.rs index b4d0de171a183935d38c928dc5b935b95d42e2e6..dba6a7b598acf74c5803f959216c16bdc6174a84 100644 --- a/substrate/client/network/src/protocol/notifications/upgrade/notifications.rs +++ b/substrate/client/network/src/protocol/notifications/upgrade/notifications.rs @@ -39,8 +39,11 @@ use crate::types::ProtocolName; use asynchronous_codec::Framed; use bytes::BytesMut; use futures::prelude::*; -use libp2p::core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo}; -use log::{error, warn}; +use libp2p::{ + core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo}, + PeerId, +}; +use log::{debug, error, warn}; use unsigned_varint::codec::UviBytes; use std::{ @@ -78,6 +81,8 @@ pub struct NotificationsOut { initial_message: Vec<u8>, /// Maximum allowed size for a single notification. max_notification_size: u64, + /// The peerID of the remote. + peer_id: PeerId, } /// A substream for incoming notification messages. @@ -114,12 +119,15 @@ pub struct NotificationsOutSubstream<TSubstream> { /// Substream where to send messages. #[pin] socket: Framed<TSubstream, UviBytes<io::Cursor<Vec<u8>>>>, + + /// The remote peer. + peer_id: PeerId, } #[cfg(test)] impl<TSubstream> NotificationsOutSubstream<TSubstream> { pub fn new(socket: Framed<TSubstream, UviBytes<io::Cursor<Vec<u8>>>>) -> Self { - Self { socket } + Self { socket, peer_id: PeerId::random() } } } @@ -349,6 +357,7 @@ impl NotificationsOut { fallback_names: Vec<ProtocolName>, initial_message: impl Into<Vec<u8>>, max_notification_size: u64, + peer_id: PeerId, ) -> Self { let initial_message = initial_message.into(); if initial_message.len() > MAX_HANDSHAKE_SIZE { @@ -358,7 +367,7 @@ impl NotificationsOut { let mut protocol_names = fallback_names; protocol_names.insert(0, main_protocol_name.into()); - Self { protocol_names, initial_message, max_notification_size } + Self { protocol_names, initial_message, max_notification_size, peer_id } } } @@ -414,7 +423,10 @@ where } else { Some(negotiated_name) }, - substream: NotificationsOutSubstream { socket: Framed::new(socket, codec) }, + substream: NotificationsOutSubstream { + socket: Framed::new(socket, codec), + peer_id: self.peer_id, + }, }) }) } @@ -465,11 +477,25 @@ where // even if we don't write anything into it. match Stream::poll_next(this.socket.as_mut(), cx) { Poll::Pending => {}, - Poll::Ready(Some(_)) => { - error!( - target: LOG_TARGET, - "Unexpected incoming data in `NotificationsOutSubstream`", - ); + Poll::Ready(Some(result)) => match result { + Ok(_) => { + error!( + target: "sub-libp2p", + "Unexpected incoming data in `NotificationsOutSubstream` peer={:?}", + this.peer_id + ); + }, + Err(error) => { + debug!( + target: "sub-libp2p", + "Error while reading from `NotificationsOutSubstream` peer={:?} error={error:?}", + this.peer_id + ); + + // The expectation is that the remote has closed the substream. + // This is similar to the `Poll::Ready(None)` branch below. + return Poll::Ready(Err(NotificationsOutError::Terminated)); + }, }, Poll::Ready(None) => return Poll::Ready(Err(NotificationsOutError::Terminated)), } @@ -537,7 +563,10 @@ mod tests { NotificationsOutSubstream, }; use futures::{channel::oneshot, future, prelude::*, SinkExt, StreamExt}; - use libp2p::core::{upgrade, InboundUpgrade, OutboundUpgrade, UpgradeInfo}; + use libp2p::{ + core::{upgrade, InboundUpgrade, OutboundUpgrade, UpgradeInfo}, + PeerId, + }; use std::{pin::Pin, task::Poll}; use tokio::net::{TcpListener, TcpStream}; use tokio_util::compat::TokioAsyncReadCompatExt; @@ -557,7 +586,13 @@ mod tests { NotificationsHandshakeError, > { let socket = TcpStream::connect(addr).await.unwrap(); - let notifs_out = NotificationsOut::new("/test/proto/1", Vec::new(), handshake, 1024 * 1024); + let notifs_out = NotificationsOut::new( + "/test/proto/1", + Vec::new(), + handshake, + 1024 * 1024, + PeerId::random(), + ); let (_, substream) = multistream_select::dialer_select_proto( socket.compat(), notifs_out.protocol_info(), @@ -721,7 +756,13 @@ mod tests { let client = tokio::spawn(async move { let socket = TcpStream::connect(listener_addr_rx.await.unwrap()).await.unwrap(); let NotificationsOutOpen { handshake, .. } = OutboundUpgrade::upgrade_outbound( - NotificationsOut::new(PROTO_NAME, Vec::new(), &b"initial message"[..], 1024 * 1024), + NotificationsOut::new( + PROTO_NAME, + Vec::new(), + &b"initial message"[..], + 1024 * 1024, + PeerId::random(), + ), socket.compat(), ProtocolName::Static(PROTO_NAME), ) @@ -766,6 +807,7 @@ mod tests { Vec::new(), &b"initial message"[..], 1024 * 1024, + PeerId::random(), ), socket.compat(), ProtocolName::Static(PROTO_NAME), diff --git a/substrate/frame/assets-freezer/src/mock.rs b/substrate/frame/assets-freezer/src/mock.rs index c957692f2b48ec9554f3a9ed1cfcb470cb5cc575..16595d706bcf9bda89c2aa3865aae275febafd8c 100644 --- a/substrate/frame/assets-freezer/src/mock.rs +++ b/substrate/frame/assets-freezer/src/mock.rs @@ -113,7 +113,18 @@ impl pallet_assets::Config for Test { } #[derive( - Decode, Encode, MaxEncodedLen, PartialEq, Eq, Ord, PartialOrd, TypeInfo, Debug, Clone, Copy, + Decode, + DecodeWithMemTracking, + Encode, + MaxEncodedLen, + PartialEq, + Eq, + Ord, + PartialOrd, + TypeInfo, + Debug, + Clone, + Copy, )] pub enum DummyFreezeReason { Governance, diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 6e946d610e07365f9225f339c80fd9d7fa5d9ecf..1bdd11904d459ab834b3e17290487a502a22725e 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -248,6 +248,7 @@ where #[frame_support::pallet] pub mod pallet { use super::*; + use codec::HasCompact; use frame_support::{ pallet_prelude::*, traits::{AccountTouch, ContainsPair}, @@ -316,6 +317,7 @@ pub mod pallet { /// The units in which we record balances. type Balance: Member + Parameter + + HasCompact<Type: DecodeWithMemTracking> + AtLeast32BitUnsigned + Default + Copy diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index e994f05a77c51dc97043700061835f9f8b1e2ca7..22277e68a071bba9fa56244ab0bc5333fe9ecabf 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -203,6 +203,7 @@ type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup #[frame_support::pallet] pub mod pallet { use super::*; + use codec::HasCompact; use frame_support::{ pallet_prelude::*, traits::{fungible::Credit, tokens::Precision, VariantCount, VariantCountOf}, @@ -270,6 +271,7 @@ pub mod pallet { + Member + AtLeast32BitUnsigned + Codec + + HasCompact<Type: DecodeWithMemTracking> + Default + Copy + MaybeSerializeDeserialize diff --git a/substrate/frame/balances/src/tests/mod.rs b/substrate/frame/balances/src/tests/mod.rs index ceb8e8134f0a29cbaae72291c194f241246880aa..d27d997582cf545e5af019ccdbcdd3b4d49b1727 100644 --- a/substrate/frame/balances/src/tests/mod.rs +++ b/substrate/frame/balances/src/tests/mod.rs @@ -23,7 +23,7 @@ use crate::{ self as pallet_balances, AccountData, Config, CreditOf, Error, Pallet, TotalIssuance, DEFAULT_ADDRESS_URI, }; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use frame_support::{ assert_err, assert_noop, assert_ok, assert_storage_noop, derive_impl, dispatch::{DispatchInfo, GetDispatchInfo}, @@ -58,6 +58,7 @@ type Block = frame_system::mocking::MockBlock<Test>; #[derive( Encode, Decode, + DecodeWithMemTracking, Copy, Clone, Eq, diff --git a/substrate/frame/examples/authorization-tx-extension/src/extensions.rs b/substrate/frame/examples/authorization-tx-extension/src/extensions.rs index f4e4719bad7e3899e2f5af45ad7091405e436043..791b38742777541f2b36c1059ee3bcbd9acec357 100644 --- a/substrate/frame/examples/authorization-tx-extension/src/extensions.rs +++ b/substrate/frame/examples/authorization-tx-extension/src/extensions.rs @@ -23,7 +23,7 @@ use core::{fmt, marker::PhantomData}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{pallet_prelude::TransactionSource, traits::OriginTrait, Parameter}; use scale_info::TypeInfo; use sp_runtime::{ @@ -38,7 +38,7 @@ use sp_runtime::{ use crate::pallet_coownership::{Config, Origin}; /// Helper struct to organize the data needed for signature verification of both parties involved. -#[derive(Clone, Eq, PartialEq, Encode, Decode, TypeInfo)] +#[derive(Clone, Eq, PartialEq, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct AuthCredentials<Signer, Signature> { first: (Signer, Signature), second: (Signer, Signature), @@ -49,7 +49,7 @@ pub struct AuthCredentials<Signer, Signature> { /// data that follows this extension in the `TransactionExtension` pipeline, their implications and /// the call. Essentially re-sign the transaction from this point onwards in the pipeline by using /// the `inherited_implication`, as shown below. -#[derive(Clone, Eq, PartialEq, Encode, Decode, TypeInfo)] +#[derive(Clone, Eq, PartialEq, Encode, Decode, DecodeWithMemTracking, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct AuthorizeCoownership<T, Signer, Signature> { inner: Option<AuthCredentials<Signer, Signature>>, diff --git a/substrate/frame/examples/basic/src/lib.rs b/substrate/frame/examples/basic/src/lib.rs index 7d7f1d838c9f3fd2137e9037fee4d84d3cbdcb91..ff9b401be6f0af1be3dfcf773c1fafbd5289d232 100644 --- a/substrate/frame/examples/basic/src/lib.rs +++ b/substrate/frame/examples/basic/src/lib.rs @@ -63,7 +63,7 @@ extern crate alloc; use alloc::vec::Vec; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::marker::PhantomData; use frame_support::{ dispatch::{ClassifyDispatch, DispatchClass, DispatchResult, Pays, PaysFee, WeighData}, @@ -487,7 +487,7 @@ impl<T: Config> Pallet<T> { /// /// Additionally, it drops any transaction with an encoded length higher than 200 bytes. No /// particular reason why, just to demonstrate the power of transaction extensions. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct WatchDummy<T: Config + Send + Sync>(PhantomData<T>); diff --git a/substrate/frame/executive/src/tests.rs b/substrate/frame/executive/src/tests.rs index dd12a85a1114c162d1ce9d41bc11a65075776c3b..cd7f6c5ff42c140feb187b401db96d529dfdc6a5 100644 --- a/substrate/frame/executive/src/tests.rs +++ b/substrate/frame/executive/src/tests.rs @@ -357,7 +357,18 @@ impl frame_system::Config for Runtime { type ExtensionsWeightInfo = MockExtensionsWeights; } -#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, MaxEncodedLen, TypeInfo, RuntimeDebug)] +#[derive( + Encode, + Decode, + DecodeWithMemTracking, + Copy, + Clone, + Eq, + PartialEq, + MaxEncodedLen, + TypeInfo, + RuntimeDebug, +)] pub enum FreezeReasonId { Foo, } diff --git a/substrate/frame/metadata-hash-extension/src/lib.rs b/substrate/frame/metadata-hash-extension/src/lib.rs index 0b45f5a7e51524e63e10f5d8ae44650c0eacd168..b57d0319cc1a496a0d9b8e0fcd4907ad5ed76a95 100644 --- a/substrate/frame/metadata-hash-extension/src/lib.rs +++ b/substrate/frame/metadata-hash-extension/src/lib.rs @@ -38,7 +38,7 @@ extern crate alloc; /// For our tests extern crate self as frame_metadata_hash_extension; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{pallet_prelude::Weight, DebugNoBound}; use frame_system::Config; use scale_info::TypeInfo; @@ -52,7 +52,7 @@ use sp_runtime::{ mod tests; /// The mode of [`CheckMetadataHash`]. -#[derive(Decode, Encode, PartialEq, Debug, TypeInfo, Clone, Copy, Eq)] +#[derive(Decode, Encode, DecodeWithMemTracking, PartialEq, Debug, TypeInfo, Clone, Copy, Eq)] enum Mode { Disabled, Enabled, @@ -113,7 +113,7 @@ impl MetadataHash { /// environment variable is for example set by the `substrate-wasm-builder` when the feature for /// generating the metadata hash is enabled. If the environment variable is not set and `mode = 1` /// is passed, the transaction is rejected with [`UnknownTransaction::CannotLookup`]. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo, DebugNoBound)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo, DebugNoBound)] #[scale_info(skip_type_params(T))] pub struct CheckMetadataHash<T> { _phantom: core::marker::PhantomData<T>, diff --git a/substrate/frame/multisig/src/benchmarking.rs b/substrate/frame/multisig/src/benchmarking.rs index 3f75d92fe0ed378d2e76e87dbfba4c6a21048727..4fce2d4dad3822b17f4586a80007d13a41899138 100644 --- a/substrate/frame/multisig/src/benchmarking.rs +++ b/substrate/frame/multisig/src/benchmarking.rs @@ -296,5 +296,68 @@ mod benchmarks { Ok(()) } + /// `s`: Signatories, need at least 2 people + #[benchmark] + fn poke_deposit(s: Linear<2, { T::MaxSignatories::get() }>) -> Result<(), BenchmarkError> { + // The call is neither in storage or an argument, so just use any: + let call_len = 10_000; + let (mut signatories, call) = setup_multi::<T>(s, call_len)?; + let multi_account_id = Multisig::<T>::multi_account_id(&signatories, s.try_into().unwrap()); + let caller = signatories.pop().ok_or("signatories should have len 2 or more")?; + let call_hash = call.using_encoded(blake2_256); + // Create the multi + Multisig::<T>::as_multi( + RawOrigin::Signed(caller.clone()).into(), + s as u16, + signatories.clone(), + None, + call, + Weight::zero(), + )?; + + // Get the current multisig data + let multisig = Multisigs::<T>::get(multi_account_id.clone(), call_hash) + .ok_or("multisig not created")?; + // The original deposit + let old_deposit = multisig.deposit; + assert_eq!(T::Currency::reserved_balance(&caller), old_deposit); + + let additional_amount = 2u32.into(); + let new_deposit = old_deposit.saturating_add(additional_amount); + + // Reserve the additional amount from the caller's balance + T::Currency::reserve(&caller, additional_amount)?; + assert_eq!(T::Currency::reserved_balance(&caller), new_deposit); + // Update the storage with the new deposit + Multisigs::<T>::try_mutate( + &multi_account_id, + call_hash, + |maybe_multisig| -> DispatchResult { + let mut multisig = maybe_multisig.take().ok_or(Error::<T>::NotFound)?; + multisig.deposit = new_deposit; + *maybe_multisig = Some(multisig); + Ok(()) + }, + ) + .map_err(|_| BenchmarkError::Stop("Mutating storage to change deposits failed"))?; + // Check that the deposit was updated in storage + let multisig = Multisigs::<T>::get(multi_account_id.clone(), call_hash) + .ok_or("Multisig not created")?; + assert_eq!(multisig.deposit, new_deposit); + + // Whitelist caller account + let caller_key = frame_system::Account::<T>::hashed_key_for(&caller); + add_to_whitelist(caller_key.into()); + + #[extrinsic_call] + _(RawOrigin::Signed(caller.clone()), s as u16, signatories, call_hash); + + let multisig = Multisigs::<T>::get(multi_account_id.clone(), call_hash) + .ok_or("Multisig not created")?; + assert_eq!(multisig.deposit, old_deposit); + assert_eq!(T::Currency::reserved_balance(&caller), old_deposit); + Ok(()) + } + impl_benchmark_test_suite!(Multisig, crate::tests::new_test_ext(), crate::tests::Test); } diff --git a/substrate/frame/multisig/src/lib.rs b/substrate/frame/multisig/src/lib.rs index 6fdc52d6887d03895199fe1351066901e2d45e7e..83c893d08697e7cf59bd6bb0235e4c4a48e95d5d 100644 --- a/substrate/frame/multisig/src/lib.rs +++ b/substrate/frame/multisig/src/lib.rs @@ -226,9 +226,10 @@ pub mod pallet { SignatoriesOutOfOrder, /// The sender was contained in the other signatories; it shouldn't be. SenderInSignatories, - /// Multisig operation not found when attempting to cancel. + /// Multisig operation not found in storage. NotFound, - /// Only the account that originally created the multisig is able to cancel it. + /// Only the account that originally created the multisig is able to cancel it or update + /// its deposits. NotOwner, /// No timepoint was given, yet the multisig operation is already underway. NoTimepoint, @@ -269,6 +270,13 @@ pub mod pallet { multisig: T::AccountId, call_hash: CallHash, }, + /// The deposit for a multisig operation has been updated/poked. + DepositPoked { + who: T::AccountId, + call_hash: CallHash, + old_deposit: BalanceOf<T>, + new_deposit: BalanceOf<T>, + }, } #[pallet::hooks] @@ -517,6 +525,84 @@ pub mod pallet { }); Ok(()) } + + /// Poke the deposit reserved for an existing multisig operation. + /// + /// The dispatch origin for this call must be _Signed_ and must be the original depositor of + /// the multisig operation. + /// + /// The transaction fee is waived if the deposit amount has changed. + /// + /// - `threshold`: The total number of approvals needed for this multisig. + /// - `other_signatories`: The accounts (other than the sender) who are part of the + /// multisig. + /// - `call_hash`: The hash of the call this deposit is reserved for. + /// + /// Emits `DepositPoked` if successful. + #[pallet::call_index(4)] + #[pallet::weight(T::WeightInfo::poke_deposit(other_signatories.len() as u32))] + pub fn poke_deposit( + origin: OriginFor<T>, + threshold: u16, + other_signatories: Vec<T::AccountId>, + call_hash: [u8; 32], + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + ensure!(threshold >= 2, Error::<T>::MinimumThreshold); + let max_sigs = T::MaxSignatories::get() as usize; + ensure!(!other_signatories.is_empty(), Error::<T>::TooFewSignatories); + ensure!(other_signatories.len() < max_sigs, Error::<T>::TooManySignatories); + // Get the multisig account ID + let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?; + let id = Self::multi_account_id(&signatories, threshold); + + Multisigs::<T>::try_mutate( + &id, + call_hash, + |maybe_multisig| -> DispatchResultWithPostInfo { + let mut multisig = maybe_multisig.take().ok_or(Error::<T>::NotFound)?; + ensure!(multisig.depositor == who, Error::<T>::NotOwner); + + // Calculate the new deposit + let new_deposit = Self::deposit(threshold); + let old_deposit = multisig.deposit; + + if new_deposit == old_deposit { + *maybe_multisig = Some(multisig); + return Ok(Pays::Yes.into()); + } + + // Update the reserved amount + if new_deposit > old_deposit { + let extra = new_deposit.saturating_sub(old_deposit); + T::Currency::reserve(&who, extra)?; + } else { + let excess = old_deposit.saturating_sub(new_deposit); + let remaining_unreserved = T::Currency::unreserve(&who, excess); + if !remaining_unreserved.is_zero() { + defensive!( + "Failed to unreserve for full amount for multisig. (Call Hash, Requested, Actual): ", + (call_hash, excess, excess.saturating_sub(remaining_unreserved)) + ); + } + } + + // Update storage + multisig.deposit = new_deposit; + *maybe_multisig = Some(multisig); + + // Emit event + Self::deposit_event(Event::DepositPoked { + who: who.clone(), + call_hash, + old_deposit, + new_deposit, + }); + + Ok(Pays::No.into()) + }, + ) + } } } @@ -634,7 +720,7 @@ impl<T: Config> Pallet<T> { ensure!(maybe_timepoint.is_none(), Error::<T>::UnexpectedTimepoint); // Just start the operation by recording it in storage. - let deposit = T::DepositBase::get() + T::DepositFactor::get() * threshold.into(); + let deposit = Self::deposit(threshold); T::Currency::reserve(&who, deposit)?; @@ -689,6 +775,13 @@ impl<T: Config> Pallet<T> { signatories.insert(index, who); Ok(signatories) } + + /// Calculate the deposit for a multisig operation. + /// + /// The deposit is calculated as `DepositBase + DepositFactor * threshold`. + pub fn deposit(threshold: u16) -> BalanceOf<T> { + T::DepositBase::get() + T::DepositFactor::get() * threshold.into() + } } /// Return the weight of a dispatch call result as an `Option`. diff --git a/substrate/frame/multisig/src/tests.rs b/substrate/frame/multisig/src/tests.rs index 8a389314256bec1aca8c3cbe00fe6b005d19c554..a5206342c762e4b89f77a37a22b4d880f11fe084 100644 --- a/substrate/frame/multisig/src/tests.rs +++ b/substrate/frame/multisig/src/tests.rs @@ -58,23 +58,29 @@ impl Contains<RuntimeCall> for TestBaseCallFilter { } } } + +parameter_types! { + pub static MultisigDepositBase: u64 = 1; + pub static MultisigDepositFactor: u64 = 1; +} + impl Config for Test { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; type Currency = Balances; - type DepositBase = ConstU64<1>; - type DepositFactor = ConstU64<1>; + type DepositBase = MultisigDepositBase; + type DepositFactor = MultisigDepositFactor; type MaxSignatories = ConstU32<3>; type WeightInfo = (); type BlockNumberProvider = frame_system::Pallet<Test>; } -use pallet_balances::Call as BalancesCall; +use pallet_balances::{Call as BalancesCall, Error as BalancesError}; pub fn new_test_ext() -> TestState { let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap(); pallet_balances::GenesisConfig::<Test> { - balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 2)], + balances: vec![(1, 10), (2, 10), (3, 10), (4, 5), (5, 2)], ..Default::default() } .assimilate_storage(&mut t) @@ -688,3 +694,314 @@ fn multisig_handles_no_preimage_after_all_approve() { assert_eq!(Balances::free_balance(6), 15); }); } + +#[test] +fn poke_deposit_fails_for_threshold_less_than_two() { + new_test_ext().execute_with(|| { + let call = call_transfer(6, 15); + let hash = blake2_256(&call.encode()); + assert_noop!( + Multisig::poke_deposit(RuntimeOrigin::signed(1), 0, vec![2], hash), + Error::<Test>::MinimumThreshold, + ); + assert_noop!( + Multisig::poke_deposit(RuntimeOrigin::signed(1), 1, vec![2], hash), + Error::<Test>::MinimumThreshold, + ); + }); +} + +#[test] +fn poke_deposit_fails_for_too_incorrect_number_of_signatories() { + new_test_ext().execute_with(|| { + let call = call_transfer(6, 15); + let hash = blake2_256(&call.encode()); + assert_noop!( + Multisig::poke_deposit(RuntimeOrigin::signed(1), 2, vec![], hash), + Error::<Test>::TooFewSignatories, + ); + assert_noop!( + Multisig::poke_deposit(RuntimeOrigin::signed(1), 2, vec![2, 3, 4, 5], hash), + Error::<Test>::TooManySignatories, + ); + }); +} + +#[test] +fn poke_deposit_fails_for_signatories_out_of_order() { + new_test_ext().execute_with(|| { + let call = call_transfer(6, 15); + let hash = blake2_256(&call.encode()); + let threshold = 2; + + assert_ok!(Multisig::approve_as_multi( + RuntimeOrigin::signed(1), + threshold, + vec![2, 3], + None, + hash, + Weight::zero() + )); + + assert_noop!( + Multisig::poke_deposit( + RuntimeOrigin::signed(1), + threshold, + vec![3, 2], // Unordered + hash + ), + Error::<Test>::SignatoriesOutOfOrder + ); + }); +} + +#[test] +fn poke_deposit_fails_for_non_existent_multisig() { + new_test_ext().execute_with(|| { + assert_noop!( + Multisig::poke_deposit(RuntimeOrigin::signed(1), 2, vec![2, 3], [0; 32]), + Error::<Test>::NotFound + ); + }); +} + +#[test] +fn poke_deposit_fails_for_non_owner() { + new_test_ext().execute_with(|| { + let call = call_transfer(6, 15); + let hash = blake2_256(&call.encode()); + let threshold = 2; + + assert_ok!(Multisig::approve_as_multi( + RuntimeOrigin::signed(1), + threshold, + vec![2, 3], + None, + hash, + Weight::zero() + )); + + // Try to poke from non-owner (account 2) + assert_noop!( + Multisig::poke_deposit( + RuntimeOrigin::signed(2), + threshold, + vec![1, 3], // Note: signatories adjusted for different caller + hash + ), + Error::<Test>::NotOwner + ); + }); +} + +#[test] +fn poke_deposit_charges_fee_when_deposit_unchanged() { + new_test_ext().execute_with(|| { + let call = call_transfer(6, 15); + let hash = blake2_256(&call.encode()); + let threshold = 2; + let other_signatories = vec![2, 3]; + + assert_ok!(Multisig::approve_as_multi( + RuntimeOrigin::signed(1), + threshold, + other_signatories.clone(), + None, + hash, + Weight::zero() + )); + + let initial_deposit = Balances::reserved_balance(1); + let initial_free = Balances::free_balance(1); + + // Poke without changing deposit requirements + let result = + Multisig::poke_deposit(RuntimeOrigin::signed(1), threshold, other_signatories, hash); + assert_ok!(result.as_ref()); + assert_eq!(result.unwrap().pays_fee, Pays::Yes); + + // Verify balances unchanged (except for fee) + assert_eq!(Balances::reserved_balance(1), initial_deposit); + assert!(Balances::free_balance(1) <= initial_free); + + // Verify no event was emitted + assert!(!System::events().iter().any(|record| matches!( + record.event, + RuntimeEvent::Multisig(Event::DepositPoked { .. }) + ))); + }); +} + +#[test] +fn poke_deposit_works_when_deposit_increases() { + new_test_ext().execute_with(|| { + let call = call_transfer(6, 15); + let hash = blake2_256(&call.encode()); + let threshold = 2; + let other_signatories = vec![2, 3]; + + assert_ok!(Multisig::approve_as_multi( + RuntimeOrigin::signed(1), + threshold, + other_signatories.clone(), + None, + hash, + Weight::zero() + )); + + // Record initial balances + let initial_deposit = Balances::reserved_balance(1); + let initial_free = Balances::free_balance(1); + let initial_base: u64 = MultisigDepositBase::get(); + let initial_factor: u64 = MultisigDepositFactor::get(); + let threshold_u64: u64 = threshold as u64; + let expected_initial_deposit = initial_base + (initial_factor * threshold_u64); + assert_eq!( + initial_deposit, expected_initial_deposit, + "Initial deposit should be 1 + (1 * 2)" + ); + + // Increase deposit requirements + MultisigDepositBase::set(3); + MultisigDepositFactor::set(2); + + // Poke the deposit + let result = + Multisig::poke_deposit(RuntimeOrigin::signed(1), threshold, other_signatories, hash); + assert_ok!(result.as_ref()); + assert_eq!(result.unwrap().pays_fee, Pays::No); + + // New deposit should be 7 (base 3 + factor 2 * threshold 2) + let new_base: u64 = MultisigDepositBase::get(); + let new_factor: u64 = MultisigDepositFactor::get(); + let expected_new_deposit = new_base + (new_factor * threshold_u64); + let deposit_increase = expected_new_deposit.saturating_sub(initial_deposit); + + // Verify exact balance changes + assert_eq!( + Balances::reserved_balance(1), + expected_new_deposit, + "Reserved balance should be exactly base(3) + factor(2) * threshold(2) = 7" + ); + assert_eq!( + Balances::free_balance(1), + initial_free.saturating_sub(deposit_increase), + "Free balance should decrease by exactly the deposit increase" + ); + + // Verify event + System::assert_has_event( + Event::DepositPoked { + who: 1, + call_hash: hash, + old_deposit: initial_deposit, + new_deposit: expected_new_deposit, + } + .into(), + ); + }); +} + +#[test] +fn poke_deposit_works_when_deposit_decreases() { + new_test_ext().execute_with(|| { + // Start with higher deposit requirements + MultisigDepositBase::set(3); + MultisigDepositFactor::set(2); + + let call = call_transfer(6, 15); + let hash = blake2_256(&call.encode()); + let threshold = 2; + let other_signatories = vec![2, 3]; + + assert_ok!(Multisig::approve_as_multi( + RuntimeOrigin::signed(1), + threshold, + other_signatories.clone(), + None, + hash, + Weight::zero() + )); + + let initial_deposit = Balances::reserved_balance(1); + let initial_free = Balances::free_balance(1); + + // Verify initial deposit calculation (3 + 2 * 2 = 7) + let initial_base: u64 = MultisigDepositBase::get(); + let initial_factor: u64 = MultisigDepositFactor::get(); + let threshold_u64: u64 = threshold as u64; + let expected_initial_deposit = initial_base + (initial_factor * threshold_u64); + assert_eq!( + initial_deposit, expected_initial_deposit, + "Initial deposit should be exactly base(3) + factor(2) * threshold(2) = 7" + ); + + // Decrease deposit requirements + MultisigDepositBase::set(1); + MultisigDepositFactor::set(1); + + // Poke the deposit + let result = + Multisig::poke_deposit(RuntimeOrigin::signed(1), threshold, other_signatories, hash); + assert_ok!(result.as_ref()); + // Doesn't pay fee + assert_eq!(result.unwrap().pays_fee, Pays::No); + + // Calculate expected new deposit (1 + 1 * 2 = 3) + let new_base: u64 = MultisigDepositBase::get(); + let new_factor: u64 = MultisigDepositFactor::get(); + let expected_new_deposit = new_base + (new_factor * threshold_u64); + let deposit_decrease = initial_deposit.saturating_sub(expected_new_deposit); + + assert_eq!( + Balances::reserved_balance(1), + expected_new_deposit, + "Reserved balance should be exactly base(1) + factor(1) * threshold(2) = 3" + ); + assert_eq!( + Balances::free_balance(1), + initial_free.saturating_add(deposit_decrease), + "Free balance should increase by exactly the deposit decrease" + ); + + System::assert_has_event( + Event::DepositPoked { + who: 1, + call_hash: hash, + old_deposit: initial_deposit, + new_deposit: expected_new_deposit, + } + .into(), + ); + }); +} + +#[test] +fn poke_deposit_handles_insufficient_balance() { + new_test_ext().execute_with(|| { + let call = call_transfer(6, 15); + let hash = blake2_256(&call.encode()); + let threshold = 2; + let other_signatories = vec![2, 3]; + + // Use account 4 which has only 5 balance + assert_ok!(Multisig::approve_as_multi( + RuntimeOrigin::signed(4), + threshold, + other_signatories.clone(), + None, + hash, + Weight::zero() + )); + + // Increase deposit requirement beyond available balance + MultisigDepositBase::set(3); + MultisigDepositFactor::set(3); + + // Should fail due to insufficient balance + assert_noop!( + Multisig::poke_deposit(RuntimeOrigin::signed(4), threshold, other_signatories, hash), + BalancesError::<Test, _>::InsufficientBalance + ); + }); +} diff --git a/substrate/frame/multisig/src/weights.rs b/substrate/frame/multisig/src/weights.rs index c86cab9b88a2b5505ffb533da951f49cc316385b..f8dd8bf355b3aee04f95cff7ae004aa70d2d9aad 100644 --- a/substrate/frame/multisig/src/weights.rs +++ b/substrate/frame/multisig/src/weights.rs @@ -35,9 +35,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! 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-02-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `4563561839a5`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `c8c7296f7413`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: @@ -78,6 +78,7 @@ pub trait WeightInfo { fn approve_as_multi_create(s: u32, ) -> Weight; fn approve_as_multi_approve(s: u32, ) -> Weight; fn cancel_as_multi(s: u32, ) -> Weight; + fn poke_deposit(s: u32, ) -> Weight; } /// Weights for `pallet_multisig` using the Substrate node and recommended hardware. @@ -92,10 +93,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3997` - // Minimum execution time: 18_003_000 picoseconds. - Weight::from_parts(18_725_906, 3997) - // Standard Error: 5 - .saturating_add(Weight::from_parts(438, 0).saturating_mul(z.into())) + // Minimum execution time: 18_622_000 picoseconds. + Weight::from_parts(20_470_382, 3997) + // Standard Error: 21 + .saturating_add(Weight::from_parts(397, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Multisig::Multisigs` (r:1 w:1) @@ -106,12 +107,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { // Proof Size summary in bytes: // Measured: `229 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 42_474_000 picoseconds. - Weight::from_parts(29_233_340, 6811) - // Standard Error: 1_664 - .saturating_add(Weight::from_parts(146_949, 0).saturating_mul(s.into())) + // Minimum execution time: 41_568_000 picoseconds. + Weight::from_parts(29_976_762, 6811) + // Standard Error: 1_712 + .saturating_add(Weight::from_parts(144_320, 0).saturating_mul(s.into())) // Standard Error: 16 - .saturating_add(Weight::from_parts(1_906, 0).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(1_819, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -123,12 +124,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { // Proof Size summary in bytes: // Measured: `185` // Estimated: `6811` - // Minimum execution time: 27_330_000 picoseconds. - Weight::from_parts(15_457_151, 6811) - // Standard Error: 561 - .saturating_add(Weight::from_parts(125_127, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_864, 0).saturating_mul(z.into())) + // Minimum execution time: 26_237_000 picoseconds. + Weight::from_parts(14_821_348, 6811) + // Standard Error: 1_425 + .saturating_add(Weight::from_parts(127_874, 0).saturating_mul(s.into())) + // Standard Error: 13 + .saturating_add(Weight::from_parts(1_968, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -146,12 +147,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { // Proof Size summary in bytes: // Measured: `288 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 50_733_000 picoseconds. - Weight::from_parts(33_524_212, 6811) - // Standard Error: 2_225 - .saturating_add(Weight::from_parts(203_100, 0).saturating_mul(s.into())) - // Standard Error: 21 - .saturating_add(Weight::from_parts(1_998, 0).saturating_mul(z.into())) + // Minimum execution time: 50_942_000 picoseconds. + Weight::from_parts(34_745_418, 6811) + // Standard Error: 2_993 + .saturating_add(Weight::from_parts(193_313, 0).saturating_mul(s.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(2_057, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -162,10 +163,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { // Proof Size summary in bytes: // Measured: `233 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 26_058_000 picoseconds. - Weight::from_parts(28_166_358, 6811) - // Standard Error: 1_433 - .saturating_add(Weight::from_parts(136_538, 0).saturating_mul(s.into())) + // Minimum execution time: 25_583_000 picoseconds. + Weight::from_parts(27_463_275, 6811) + // Standard Error: 1_158 + .saturating_add(Weight::from_parts(139_226, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -176,10 +177,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { // Proof Size summary in bytes: // Measured: `185` // Estimated: `6811` - // Minimum execution time: 13_200_000 picoseconds. - Weight::from_parts(13_894_037, 6811) - // Standard Error: 822 - .saturating_add(Weight::from_parts(122_658, 0).saturating_mul(s.into())) + // Minimum execution time: 13_086_000 picoseconds. + Weight::from_parts(14_074_258, 6811) + // Standard Error: 1_279 + .saturating_add(Weight::from_parts(126_544, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -190,10 +191,24 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { // Proof Size summary in bytes: // Measured: `357 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 26_877_000 picoseconds. - Weight::from_parts(28_686_251, 6811) - // Standard Error: 1_189 - .saturating_add(Weight::from_parts(126_933, 0).saturating_mul(s.into())) + // Minimum execution time: 26_950_000 picoseconds. + Weight::from_parts(28_623_566, 6811) + // Standard Error: 1_795 + .saturating_add(Weight::from_parts(135_351, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `357 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 25_804_000 picoseconds. + Weight::from_parts(27_349_525, 6811) + // Standard Error: 1_276 + .saturating_add(Weight::from_parts(121_813, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -210,10 +225,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3997` - // Minimum execution time: 18_003_000 picoseconds. - Weight::from_parts(18_725_906, 3997) - // Standard Error: 5 - .saturating_add(Weight::from_parts(438, 0).saturating_mul(z.into())) + // Minimum execution time: 18_622_000 picoseconds. + Weight::from_parts(20_470_382, 3997) + // Standard Error: 21 + .saturating_add(Weight::from_parts(397, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Multisig::Multisigs` (r:1 w:1) @@ -224,12 +239,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `229 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 42_474_000 picoseconds. - Weight::from_parts(29_233_340, 6811) - // Standard Error: 1_664 - .saturating_add(Weight::from_parts(146_949, 0).saturating_mul(s.into())) + // Minimum execution time: 41_568_000 picoseconds. + Weight::from_parts(29_976_762, 6811) + // Standard Error: 1_712 + .saturating_add(Weight::from_parts(144_320, 0).saturating_mul(s.into())) // Standard Error: 16 - .saturating_add(Weight::from_parts(1_906, 0).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(1_819, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -241,12 +256,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `185` // Estimated: `6811` - // Minimum execution time: 27_330_000 picoseconds. - Weight::from_parts(15_457_151, 6811) - // Standard Error: 561 - .saturating_add(Weight::from_parts(125_127, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_864, 0).saturating_mul(z.into())) + // Minimum execution time: 26_237_000 picoseconds. + Weight::from_parts(14_821_348, 6811) + // Standard Error: 1_425 + .saturating_add(Weight::from_parts(127_874, 0).saturating_mul(s.into())) + // Standard Error: 13 + .saturating_add(Weight::from_parts(1_968, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -264,12 +279,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `288 + s * (33 ±0)` // Estimated: `6811` - // Minimum execution time: 50_733_000 picoseconds. - Weight::from_parts(33_524_212, 6811) - // Standard Error: 2_225 - .saturating_add(Weight::from_parts(203_100, 0).saturating_mul(s.into())) - // Standard Error: 21 - .saturating_add(Weight::from_parts(1_998, 0).saturating_mul(z.into())) + // Minimum execution time: 50_942_000 picoseconds. + Weight::from_parts(34_745_418, 6811) + // Standard Error: 2_993 + .saturating_add(Weight::from_parts(193_313, 0).saturating_mul(s.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(2_057, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -280,10 +295,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `233 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 26_058_000 picoseconds. - Weight::from_parts(28_166_358, 6811) - // Standard Error: 1_433 - .saturating_add(Weight::from_parts(136_538, 0).saturating_mul(s.into())) + // Minimum execution time: 25_583_000 picoseconds. + Weight::from_parts(27_463_275, 6811) + // Standard Error: 1_158 + .saturating_add(Weight::from_parts(139_226, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -294,10 +309,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `185` // Estimated: `6811` - // Minimum execution time: 13_200_000 picoseconds. - Weight::from_parts(13_894_037, 6811) - // Standard Error: 822 - .saturating_add(Weight::from_parts(122_658, 0).saturating_mul(s.into())) + // Minimum execution time: 13_086_000 picoseconds. + Weight::from_parts(14_074_258, 6811) + // Standard Error: 1_279 + .saturating_add(Weight::from_parts(126_544, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -308,10 +323,24 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `357 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 26_877_000 picoseconds. - Weight::from_parts(28_686_251, 6811) - // Standard Error: 1_189 - .saturating_add(Weight::from_parts(126_933, 0).saturating_mul(s.into())) + // Minimum execution time: 26_950_000 picoseconds. + Weight::from_parts(28_623_566, 6811) + // Standard Error: 1_795 + .saturating_add(Weight::from_parts(135_351, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn poke_deposit(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `357 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 25_804_000 picoseconds. + Weight::from_parts(27_349_525, 6811) + // Standard Error: 1_276 + .saturating_add(Weight::from_parts(121_813, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/substrate/frame/referenda/src/types.rs b/substrate/frame/referenda/src/types.rs index 7bf290786cab833198bbcc2d73161e1f4aa2ede3..861b4605271f6fd0d574fdb3d2618ddd09418c00 100644 --- a/substrate/frame/referenda/src/types.rs +++ b/substrate/frame/referenda/src/types.rs @@ -217,7 +217,7 @@ where pub struct ReferendumStatus< TrackId: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, RuntimeOrigin: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, - Moment: Parameter + Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone + EncodeLike, + Moment: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone + EncodeLike, Call: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, Balance: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, Tally: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, @@ -289,7 +289,7 @@ pub enum ReferendumInfo< impl< TrackId: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, RuntimeOrigin: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, - Moment: Parameter + Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone + EncodeLike, + Moment: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone + EncodeLike, Call: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, Balance: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, Tally: Eq + PartialEq + Debug + Encode + Decode + TypeInfo + Clone, diff --git a/substrate/frame/revive/Cargo.toml b/substrate/frame/revive/Cargo.toml index a10f8935fb60d1d4df303cc129958a28d4c765e1..b3d8feb890f37abacb9fab2c93679d5b104292d7 100644 --- a/substrate/frame/revive/Cargo.toml +++ b/substrate/frame/revive/Cargo.toml @@ -23,7 +23,6 @@ derive_more = { workspace = true } environmental = { workspace = true } ethabi = { workspace = true } ethereum-types = { workspace = true, features = ["codec", "rlp", "serialize"] } -hex = { workspace = true } hex-literal = { workspace = true } impl-trait-for-tuples = { workspace = true } log = { workspace = true } @@ -87,7 +86,6 @@ std = [ "frame-benchmarking?/std", "frame-support/std", "frame-system/std", - "hex/std", "log/std", "pallet-proxy/std", "pallet-revive-fixtures?/std", diff --git a/substrate/frame/revive/fixtures/contracts/terminate_and_send_to_eve.rs b/substrate/frame/revive/fixtures/contracts/terminate_and_send_to_argument.rs similarity index 91% rename from substrate/frame/revive/fixtures/contracts/terminate_and_send_to_eve.rs rename to substrate/frame/revive/fixtures/contracts/terminate_and_send_to_argument.rs index c078f9d46c1d71bfe079051bd34a2d01eb270328..d34736de30a650075841c3e7e943fdfa293dee6a 100644 --- a/substrate/frame/revive/fixtures/contracts/terminate_and_send_to_eve.rs +++ b/substrate/frame/revive/fixtures/contracts/terminate_and_send_to_argument.rs @@ -18,7 +18,7 @@ #![no_std] #![no_main] -extern crate common; +use common::input; use uapi::{HostFn, HostFnImpl as api}; #[no_mangle] @@ -28,6 +28,6 @@ pub extern "C" fn deploy() {} #[no_mangle] #[polkavm_derive::polkavm_export] pub extern "C" fn call() { - let eve = [5u8; 20]; - api::terminate(&eve); + input!(beneficiary: &[u8; 20],); + api::terminate(&beneficiary); } diff --git a/substrate/frame/revive/src/address.rs b/substrate/frame/revive/src/address.rs index 45b5bf822dc91dd94691c00425d6c3ef3f826a2f..dc7ccd3fb5a4992bc09fde514914c91ecb697b83 100644 --- a/substrate/frame/revive/src/address.rs +++ b/substrate/frame/revive/src/address.rs @@ -17,13 +17,13 @@ //! Functions that deal contract addresses. -use crate::{ensure, AddressSuffix, Config, Error, HoldReason}; +use crate::{ensure, Config, Error, HoldReason, OriginalAccount}; use alloc::vec::Vec; use core::marker::PhantomData; use frame_support::traits::{fungible::MutateHold, tokens::Precision}; use sp_core::{Get, H160}; use sp_io::hashing::keccak_256; -use sp_runtime::{AccountId32, DispatchResult, SaturatedConversion, Saturating}; +use sp_runtime::{AccountId32, DispatchResult, Saturating}; /// Map between the native chain account id `T` and an Ethereum [`H160`]. /// @@ -40,7 +40,7 @@ use sp_runtime::{AccountId32, DispatchResult, SaturatedConversion, Saturating}; /// /// We require the mapping to be reversible. Since we are potentially dealing with types of /// different sizes one direction of the mapping is necessarily lossy. This requires the mapping to -/// make use of the [`AddressSuffix`] storage item to reverse the mapping. +/// make use of the [`OriginalAccount`] storage item to reverse the mapping. pub trait AddressMapper<T: Config>: private::Sealed { /// Convert an account id to an ethereum adress. fn to_address(account_id: &T::AccountId) -> H160; @@ -50,7 +50,7 @@ pub trait AddressMapper<T: Config>: private::Sealed { /// Same as [`Self::to_account_id`] but always returns the fallback account. /// - /// This skips the query into [`AddressSuffix`] and always returns the stateless + /// This skips the query into [`OriginalAccount`] and always returns the stateless /// fallback account. This is useful when we know for a fact that the `address` /// in question is originally a `H160`. This is usually only the case when we /// generated a new contract address. @@ -83,11 +83,10 @@ mod private { /// The mapper to be used if the account id is `AccountId32`. /// -/// It converts between addresses by either truncating the last 12 bytes or -/// suffixing them. The suffix is queried from [`AddressSuffix`] and will fall -/// back to all `0xEE` if no suffix was registered. This means contracts and -/// plain wallets controlled by an `secp256k1` always have a `0xEE` suffixed -/// account. +/// It converts between addresses by either hash then truncate the last 12 bytes or +/// suffixing them. To recover the original account id of a hashed and truncated account id we use +/// [`OriginalAccount`] and will fall back to all `0xEE` if account was found. This means contracts +/// and plain wallets controlled by an `secp256k1` always have a `0xEE` suffixed account. pub struct AccountId32Mapper<T>(PhantomData<T>); /// The mapper to be used if the account id is `H160`. @@ -100,18 +99,21 @@ where T: Config<AccountId = AccountId32>, { fn to_address(account_id: &AccountId32) -> H160 { - H160::from_slice(&<AccountId32 as AsRef<[u8; 32]>>::as_ref(&account_id)[..20]) + let account_bytes: &[u8; 32] = account_id.as_ref(); + if Self::is_eth_derived(account_id) { + // this was originally an eth address + // we just strip the 0xEE suffix to get the original address + H160::from_slice(&account_bytes[..20]) + } else { + // this is an (ed|sr)25510 derived address + // avoid truncating the public key by hashing it first + let account_hash = keccak_256(account_bytes); + H160::from_slice(&account_hash[12..]) + } } fn to_account_id(address: &H160) -> AccountId32 { - if let Some(suffix) = <AddressSuffix<T>>::get(address) { - let mut account_id = Self::to_fallback_account_id(address); - let account_bytes: &mut [u8; 32] = account_id.as_mut(); - account_bytes[20..].copy_from_slice(suffix.as_slice()); - account_id - } else { - Self::to_fallback_account_id(address) - } + <OriginalAccount<T>>::get(address).unwrap_or_else(|| Self::to_fallback_account_id(address)) } fn to_fallback_account_id(address: &H160) -> AccountId32 { @@ -124,24 +126,19 @@ where fn map(account_id: &T::AccountId) -> DispatchResult { ensure!(!Self::is_mapped(account_id), <Error<T>>::AccountAlreadyMapped); - let account_bytes: &[u8; 32] = account_id.as_ref(); - - // each mapping entry stores one AccountId32 distributed between key and value + // each mapping entry stores the address (20 bytes) and the account id (32 bytes) let deposit = T::DepositPerByte::get() - .saturating_mul(account_bytes.len().saturated_into()) + .saturating_mul(52u32.into()) .saturating_add(T::DepositPerItem::get()); - - let suffix: [u8; 12] = account_bytes[20..] - .try_into() - .expect("Skipping 20 byte of a an 32 byte array will fit into 12 bytes; qed"); T::Currency::hold(&HoldReason::AddressMapping.into(), account_id, deposit)?; - <AddressSuffix<T>>::insert(Self::to_address(account_id), suffix); + + <OriginalAccount<T>>::insert(Self::to_address(account_id), account_id); Ok(()) } fn unmap(account_id: &T::AccountId) -> DispatchResult { // will do nothing if address is not mapped so no check required - <AddressSuffix<T>>::remove(Self::to_address(account_id)); + <OriginalAccount<T>>::remove(Self::to_address(account_id)); T::Currency::release_all( &HoldReason::AddressMapping.into(), account_id, @@ -151,9 +148,24 @@ where } fn is_mapped(account_id: &T::AccountId) -> bool { + Self::is_eth_derived(account_id) || + <OriginalAccount<T>>::contains_key(Self::to_address(account_id)) + } +} + +impl<T> AccountId32Mapper<T> +where + T: Config<AccountId = AccountId32>, +{ + /// 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 + /// theoretically possible to create an ed25519 keypair that passed this filter. However, + /// this can't be used for an attack. It also won't happen by accident since everbody is using + /// sr25519 where this is not a valid public key. + fn is_eth_derived(account_id: &T::AccountId) -> bool { let account_bytes: &[u8; 32] = account_id.as_ref(); - &account_bytes[20..] == &[0xEE; 12] || - <AddressSuffix<T>>::contains_key(Self::to_address(account_id)) + &account_bytes[20..] == &[0xEE; 12] } } diff --git a/substrate/frame/revive/src/evm/api/byte.rs b/substrate/frame/revive/src/evm/api/byte.rs index f11966d0072cf64d674bd2925862720192c43924..b25ff2da27b1413c225c1a9c8a5ce4e5fd2aaabf 100644 --- a/substrate/frame/revive/src/evm/api/byte.rs +++ b/substrate/frame/revive/src/evm/api/byte.rs @@ -15,8 +15,10 @@ // See the License for the specific language governing permissions and // limitations under the License. //! Define Byte wrapper types for encoding and decoding hex strings + use super::hex_serde::HexCodec; use alloc::{vec, vec::Vec}; +use alloy_core::hex; use codec::{Decode, Encode}; use core::{ fmt::{Debug, Display, Formatter, Result as FmtResult}, diff --git a/substrate/frame/revive/src/evm/api/hex_serde.rs b/substrate/frame/revive/src/evm/api/hex_serde.rs index ba07b36fa4be6e5cba82bba719c3893cd32aafc5..250a38496a63f4c260faa8bd8f1bf8fb0f21b132 100644 --- a/substrate/frame/revive/src/evm/api/hex_serde.rs +++ b/substrate/frame/revive/src/evm/api/hex_serde.rs @@ -16,6 +16,7 @@ // limitations under the License. use alloc::{format, string::String, vec::Vec}; +use alloy_core::hex; use serde::{Deserialize, Deserializer, Serializer}; pub trait HexCodec: Sized { diff --git a/substrate/frame/revive/src/evm/api/rlp_codec.rs b/substrate/frame/revive/src/evm/api/rlp_codec.rs index 9b61cd042ec5433655c1002bcab62b6d67bd2fd7..5e9b9915352af681470918449536cc540899ecb6 100644 --- a/substrate/frame/revive/src/evm/api/rlp_codec.rs +++ b/substrate/frame/revive/src/evm/api/rlp_codec.rs @@ -557,7 +557,7 @@ mod test { ]; for (tx, json) in txs { - let raw_tx = hex::decode(tx).unwrap(); + let raw_tx = alloy_core::hex::decode(tx).unwrap(); let tx = TransactionSigned::decode(&raw_tx).unwrap(); assert_eq!(tx.signed_payload(), raw_tx); let expected_tx = serde_json::from_str(json).unwrap(); diff --git a/substrate/frame/revive/src/evm/api/signature.rs b/substrate/frame/revive/src/evm/api/signature.rs index 9f39b92b461eabbed376f31ea8cc3259363368a7..de4ac428ffe4e0ded74b796cebf306936b862e3f 100644 --- a/substrate/frame/revive/src/evm/api/signature.rs +++ b/substrate/frame/revive/src/evm/api/signature.rs @@ -15,6 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. //! Ethereum signature utilities + use super::*; use sp_core::{H160, U256}; use sp_io::{crypto::secp256k1_ecdsa_recover, hashing::keccak_256}; @@ -173,7 +174,7 @@ fn sign_and_recover_work() { )); for tx in txs { - let raw_tx = hex::decode(tx).unwrap(); + let raw_tx = alloy_core::hex::decode(tx).unwrap(); let tx = TransactionSigned::decode(&raw_tx).unwrap(); let address = tx.recover_eth_address(); diff --git a/substrate/frame/revive/src/evm/runtime.rs b/substrate/frame/revive/src/evm/runtime.rs index e593222239e5cbad32932198cc4c99f09ffc26f6..505b645f18747c6baac3efa50cfd3bae83fbe168 100644 --- a/substrate/frame/revive/src/evm/runtime.rs +++ b/substrate/frame/revive/src/evm/runtime.rs @@ -24,7 +24,7 @@ use crate::{ LOG_TARGET, }; use alloc::vec::Vec; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ dispatch::{DispatchInfo, GetDispatchInfo}, traits::{ExtrinsicCall, InherentBuilder, SignedTransactionBuilder}, @@ -59,7 +59,7 @@ pub(crate) const GAS_PRICE: u64 = 1_000u64; /// Wraps [`generic::UncheckedExtrinsic`] to support checking unsigned /// [`crate::Call::eth_transact`] extrinsic. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, Eq, RuntimeDebug)] pub struct UncheckedExtrinsic<Address, Signature, E: EthExtra>( pub generic::UncheckedExtrinsic<Address, CallOf<E::Config>, Signature, E::Extension>, ); diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index 62633a8f30b80408db5f202d46b94371a25cf483..c7af353de8cdd7c609186f38dd20dc767e5f6866 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -75,7 +75,7 @@ use scale_info::TypeInfo; use sp_core::{H160, H256, U256}; use sp_runtime::{ traits::{BadOrigin, Bounded, Convert, Dispatchable, Saturating, Zero}, - DispatchError, + AccountId32, DispatchError, }; pub use crate::{ @@ -504,7 +504,7 @@ pub mod pallet { CodeUploadDepositReserve, /// The Pallet has reserved it for storage deposit. StorageDepositReserve, - /// Deposit for creating an address mapping in [`AddressSuffix`]. + /// Deposit for creating an address mapping in [`OriginalAccount`]. AddressMapping, } @@ -539,11 +539,12 @@ pub mod pallet { /// Map a Ethereum address to its original `AccountId32`. /// - /// Stores the last 12 byte for addresses that were originally an `AccountId32` instead - /// of an `H160`. Register your `AccountId32` using [`Pallet::map_account`] in order to + /// When deriving a `H160` from an `AccountId32` we use a hash function. In order to + /// reconstruct the original account we need to store the reverse mapping here. + /// Register your `AccountId32` using [`Pallet::map_account`] in order to /// use it with this pallet. #[pallet::storage] - pub(crate) type AddressSuffix<T: Config> = StorageMap<_, Identity, H160, [u8; 12]>; + pub(crate) type OriginalAccount<T: Config> = StorageMap<_, Identity, H160, AccountId32>; #[pallet::hooks] impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { diff --git a/substrate/frame/revive/src/test_utils.rs b/substrate/frame/revive/src/test_utils.rs index acd9a4cda38a808f55aa37bc858f45ecd0484674..0f5eef7a30e2d47dba95958d50d2679532a3c8ee 100644 --- a/substrate/frame/revive/src/test_utils.rs +++ b/substrate/frame/revive/src/test_utils.rs @@ -22,10 +22,12 @@ pub mod builder; +pub use sp_runtime::AccountId32; + use crate::{BalanceOf, Config}; use frame_support::weights::Weight; +use hex_literal::hex; use sp_core::H160; -pub use sp_runtime::AccountId32; const fn ee_suffix(mut account: [u8; 32]) -> AccountId32 { let mut i = 20; @@ -36,26 +38,41 @@ const fn ee_suffix(mut account: [u8; 32]) -> AccountId32 { AccountId32::new(account) } +const fn ee_extend(address: [u8; 20]) -> AccountId32 { + let mut account = [0xEEu8; 32]; + let mut i = 0; + while i < 20 { + account[i] = address[i]; + i += 1; + } + AccountId32::new(account) +} + +// All those accounts ids end in `ee` which means they don't +// need a stateful mapping and their address is derived +// by truncation without a hash applied/ + pub const ALICE: AccountId32 = ee_suffix([1u8; 32]); pub const ALICE_ADDR: H160 = H160([1u8; 20]); -pub const ALICE_FALLBACK: AccountId32 = ee_suffix([1u8; 32]); +pub const ALICE_FALLBACK: AccountId32 = ALICE; pub const BOB: AccountId32 = ee_suffix([2u8; 32]); pub const BOB_ADDR: H160 = H160([2u8; 20]); -pub const BOB_FALLBACK: AccountId32 = ee_suffix([2u8; 32]); +pub const BOB_FALLBACK: AccountId32 = BOB; pub const CHARLIE: AccountId32 = ee_suffix([3u8; 32]); pub const CHARLIE_ADDR: H160 = H160([3u8; 20]); -pub const CHARLIE_FALLBACK: AccountId32 = ee_suffix([3u8; 32]); +pub const CHARLIE_FALLBACK: AccountId32 = CHARLIE; pub const DJANGO: AccountId32 = ee_suffix([4u8; 32]); pub const DJANGO_ADDR: H160 = H160([4u8; 20]); -pub const DJANGO_FALLBACK: AccountId32 = ee_suffix([4u8; 32]); +pub const DJANGO_FALLBACK: AccountId32 = DJANGO; -/// Eve is a non ee account and hence needs a stateful mapping. +/// Eve is a non ee account and hence needs a stateful mapping and its +/// address is derived by hashing to avoid truncating public keys. pub const EVE: AccountId32 = AccountId32::new([5u8; 32]); -pub const EVE_ADDR: H160 = H160([5u8; 20]); -pub const EVE_FALLBACK: AccountId32 = ee_suffix([5u8; 32]); +pub const EVE_ADDR: H160 = H160(hex!("e21eecd6e51cbcda5b0c5207ae87e605839e70ef")); +pub const EVE_FALLBACK: AccountId32 = ee_extend(EVE_ADDR.0); pub const GAS_LIMIT: Weight = Weight::from_parts(100_000_000_000, 3 * 1024 * 1024); diff --git a/substrate/frame/revive/src/tests.rs b/substrate/frame/revive/src/tests.rs index a20b6d0c630566b942728cfef9dc011a7b594d86..29f1b73e82c64cc02e96763b677237b15e48b778 100644 --- a/substrate/frame/revive/src/tests.rs +++ b/substrate/frame/revive/src/tests.rs @@ -4213,7 +4213,7 @@ fn origin_must_be_mapped() { #[test] fn mapped_address_works() { - let (code, _) = compile_module("terminate_and_send_to_eve").unwrap(); + let (code, _) = compile_module("terminate_and_send_to_argument").unwrap(); ExtBuilder::default().existential_deposit(100).build().execute_with(|| { <Test as Config>::Currency::set_balance(&ALICE, 1_000_000); @@ -4222,7 +4222,7 @@ fn mapped_address_works() { let Contract { addr, .. } = builder::bare_instantiate(Code::Upload(code.clone())).build_and_unwrap_contract(); assert_eq!(<Test as Config>::Currency::total_balance(&EVE_FALLBACK), 0); - builder::bare_call(addr).build_and_unwrap_result(); + builder::bare_call(addr).data(EVE_ADDR.encode()).build_and_unwrap_result(); assert_eq!(<Test as Config>::Currency::total_balance(&EVE_FALLBACK), 100); // after mapping it will be sent to the real eve account @@ -4231,12 +4231,43 @@ fn mapped_address_works() { // need some balance to pay for the map deposit <Test as Config>::Currency::set_balance(&EVE, 1_000); <Pallet<Test>>::map_account(RuntimeOrigin::signed(EVE)).unwrap(); - builder::bare_call(addr).build_and_unwrap_result(); + builder::bare_call(addr).data(EVE_ADDR.encode()).build_and_unwrap_result(); assert_eq!(<Test as Config>::Currency::total_balance(&EVE_FALLBACK), 100); assert_eq!(<Test as Config>::Currency::total_balance(&EVE), 1_100); }); } +#[test] +fn recovery_works() { + let (code, _) = compile_module("terminate_and_send_to_argument").unwrap(); + + ExtBuilder::default().existential_deposit(100).build().execute_with(|| { + <Test as Config>::Currency::set_balance(&ALICE, 1_000_000); + + // eve puts her AccountId20 as argument to terminate but forgot to register + // her AccountId32 first so now the funds are trapped in her fallback account + let Contract { addr, .. } = + builder::bare_instantiate(Code::Upload(code.clone())).build_and_unwrap_contract(); + assert_eq!(<Test as Config>::Currency::total_balance(&EVE), 0); + assert_eq!(<Test as Config>::Currency::total_balance(&EVE_FALLBACK), 0); + builder::bare_call(addr).data(EVE_ADDR.encode()).build_and_unwrap_result(); + assert_eq!(<Test as Config>::Currency::total_balance(&EVE_FALLBACK), 100); + assert_eq!(<Test as Config>::Currency::total_balance(&EVE), 0); + + let call = RuntimeCall::Balances(pallet_balances::Call::transfer_all { + dest: EVE, + keep_alive: false, + }); + + // she now uses the recovery function to move all funds from the fallback + // account to her real account + <Pallet<Test>>::dispatch_as_fallback_account(RuntimeOrigin::signed(EVE), Box::new(call)) + .unwrap(); + assert_eq!(<Test as Config>::Currency::total_balance(&EVE_FALLBACK), 0); + assert_eq!(<Test as Config>::Currency::total_balance(&EVE), 100); + }); +} + #[test] fn skip_transfer_works() { let (code_caller, _) = compile_module("call").unwrap(); diff --git a/substrate/frame/staking/src/pallet/mod.rs b/substrate/frame/staking/src/pallet/mod.rs index 2514fbd2537d7cb0821f67ce307ea03bb61e38b9..355e0a87a996ae6051ce696ebb27e3c5eb781f58 100644 --- a/substrate/frame/staking/src/pallet/mod.rs +++ b/substrate/frame/staking/src/pallet/mod.rs @@ -71,6 +71,7 @@ pub(crate) const SPECULATIVE_NUM_SPANS: u32 = 32; #[frame_support::pallet] pub mod pallet { use super::*; + use codec::HasCompact; use crate::{BenchmarkingConfig, PagedExposureMetadata, SnapshotStatus}; use frame_election_provider_support::{ElectionDataProvider, PageIndex}; @@ -120,6 +121,8 @@ pub mod pallet { /// `From<u64>`. type CurrencyBalance: sp_runtime::traits::AtLeast32BitUnsigned + codec::FullCodec + + DecodeWithMemTracking + + HasCompact<Type: DecodeWithMemTracking> + Copy + MaybeSerializeDeserialize + core::fmt::Debug diff --git a/substrate/frame/sudo/src/extension.rs b/substrate/frame/sudo/src/extension.rs index d2669de79e5471aa598d2899a458d3dde7875163..dbd127a2e5422dd3e01769241328ee0c052cff27 100644 --- a/substrate/frame/sudo/src/extension.rs +++ b/substrate/frame/sudo/src/extension.rs @@ -16,7 +16,7 @@ // limitations under the License. use crate::{Config, Key}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::{fmt, marker::PhantomData}; use frame_support::{dispatch::DispatchInfo, ensure, pallet_prelude::TransactionSource}; use scale_info::TypeInfo; @@ -37,7 +37,7 @@ use sp_runtime::{ /// fail on applying them as they are not allowed/disabled/whatever. This would be some huge dos /// vector to any kind of chain. This extension solves the dos vector by preventing any kind of /// transaction entering the pool as long as it is not signed by the sudo account. -#[derive(Clone, Eq, PartialEq, Encode, Decode, TypeInfo)] +#[derive(Clone, Eq, PartialEq, Encode, Decode, DecodeWithMemTracking, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckOnlySudoAccount<T: Config + Send + Sync>(PhantomData<T>); diff --git a/substrate/frame/support/src/dispatch.rs b/substrate/frame/support/src/dispatch.rs index 92284f370a5f33f8449996e2d10db4d471f24c0e..62bb2e35d789c9fe16457a0ccbc4b5041f741bec 100644 --- a/substrate/frame/support/src/dispatch.rs +++ b/substrate/frame/support/src/dispatch.rs @@ -126,8 +126,14 @@ impl<AccountId> RawOrigin<AccountId> { /// A type that can be used as a parameter in a dispatchable function. /// /// When using `decl_module` all arguments for call functions must implement this trait. -pub trait Parameter: Codec + EncodeLike + Clone + Eq + fmt::Debug + scale_info::TypeInfo {} -impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug + scale_info::TypeInfo {} +pub trait Parameter: + Codec + DecodeWithMemTracking + EncodeLike + Clone + Eq + fmt::Debug + scale_info::TypeInfo +{ +} +impl<T> Parameter for T where + T: Codec + DecodeWithMemTracking + EncodeLike + Clone + Eq + fmt::Debug + scale_info::TypeInfo +{ +} /// Means of classifying a dispatchable function. pub trait ClassifyDispatch<T> { @@ -1215,7 +1221,7 @@ mod per_dispatch_class_tests { #[cfg(test)] mod test_extensions { - use codec::{Decode, Encode}; + use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use sp_runtime::{ impl_tx_ext_default, @@ -1230,7 +1236,7 @@ mod test_extensions { use super::{DispatchResult, PostDispatchInfo}; /// Test extension that refunds half its cost if the preset inner flag is set. - #[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, TypeInfo)] + #[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct HalfCostIf(pub bool); impl<RuntimeCall: Dispatchable> TransactionExtension<RuntimeCall> for HalfCostIf { @@ -1272,7 +1278,7 @@ mod test_extensions { /// Test extension that refunds its cost if the actual post dispatch weight up until this point /// in the extension pipeline is less than the preset inner `ref_time` amount. - #[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, TypeInfo)] + #[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct FreeIfUnder(pub u64); impl<RuntimeCall: Dispatchable> TransactionExtension<RuntimeCall> for FreeIfUnder @@ -1318,7 +1324,7 @@ mod test_extensions { /// Test extension that sets its actual post dispatch `ref_time` weight to the preset inner /// amount. - #[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, TypeInfo)] + #[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct ActualWeightIs(pub u64); impl<RuntimeCall: Dispatchable> TransactionExtension<RuntimeCall> for ActualWeightIs { diff --git a/substrate/frame/support/src/traits/tokens/misc.rs b/substrate/frame/support/src/traits/tokens/misc.rs index 4978016603dcbdc2b58e4489404023356aaa2952..1b171df6dab72c65622d670a4b21b6cf55728fe3 100644 --- a/substrate/frame/support/src/traits/tokens/misc.rs +++ b/substrate/frame/support/src/traits/tokens/misc.rs @@ -18,7 +18,7 @@ //! Miscellaneous types. use crate::{traits::Contains, TypeInfo}; -use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, HasCompact, MaxEncodedLen}; use core::fmt::Debug; use sp_arithmetic::traits::{AtLeast32BitUnsigned, Zero}; use sp_core::RuntimeDebug; @@ -234,11 +234,26 @@ impl WithdrawReasons { /// Simple amalgamation trait to collect together properties for an AssetId under one roof. pub trait AssetId: - FullCodec + Clone + Eq + PartialEq + Debug + scale_info::TypeInfo + MaxEncodedLen + FullCodec + + DecodeWithMemTracking + + Clone + + Eq + + PartialEq + + Debug + + scale_info::TypeInfo + + MaxEncodedLen { } -impl<T: FullCodec + Clone + Eq + PartialEq + Debug + scale_info::TypeInfo + MaxEncodedLen> AssetId - for T +impl< + T: FullCodec + + DecodeWithMemTracking + + Clone + + Eq + + PartialEq + + Debug + + scale_info::TypeInfo + + MaxEncodedLen, + > AssetId for T { } @@ -246,6 +261,8 @@ impl<T: FullCodec + Clone + Eq + PartialEq + Debug + scale_info::TypeInfo + MaxE pub trait Balance: AtLeast32BitUnsigned + FullCodec + + DecodeWithMemTracking + + HasCompact<Type: DecodeWithMemTracking> + Copy + Default + Debug @@ -260,6 +277,8 @@ pub trait Balance: impl< T: AtLeast32BitUnsigned + FullCodec + + DecodeWithMemTracking + + HasCompact<Type: DecodeWithMemTracking> + Copy + Default + Debug diff --git a/substrate/frame/system/benchmarking/src/extensions.rs b/substrate/frame/system/benchmarking/src/extensions.rs index 25d6ea03557887d1554a2a417d781aaa2c79bee7..534743110fb36e87c49eeec58c5bf827b184da25 100644 --- a/substrate/frame/system/benchmarking/src/extensions.rs +++ b/substrate/frame/system/benchmarking/src/extensions.rs @@ -43,8 +43,8 @@ pub struct Pallet<T: Config>(System<T>); #[benchmarks(where T: Send + Sync, T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>, - <T::RuntimeCall as Dispatchable>::RuntimeOrigin: AsSystemOriginSigner<T::AccountId> + AsTransactionAuthorizedOrigin + Clone) -] + <T::RuntimeCall as Dispatchable>::RuntimeOrigin: AsSystemOriginSigner<T::AccountId> + AsTransactionAuthorizedOrigin + Clone, +)] mod benchmarks { use super::*; diff --git a/substrate/frame/system/src/extensions/check_genesis.rs b/substrate/frame/system/src/extensions/check_genesis.rs index 881faa2c0eafad75001defeb5a6c73fc71b07f65..81131e4b74c6263b9ed934b350828a8366bf90a4 100644 --- a/substrate/frame/system/src/extensions/check_genesis.rs +++ b/substrate/frame/system/src/extensions/check_genesis.rs @@ -16,7 +16,7 @@ // limitations under the License. use crate::{pallet_prelude::BlockNumberFor, Config, Pallet}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use sp_runtime::{ impl_tx_ext_default, @@ -30,7 +30,7 @@ use sp_runtime::{ /// /// Note that while a transaction with invalid `genesis_hash` will fail to be decoded, /// the extension does not affect any other fields of `TransactionValidity` directly. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckGenesis<T: Config + Send + Sync>(core::marker::PhantomData<T>); diff --git a/substrate/frame/system/src/extensions/check_mortality.rs b/substrate/frame/system/src/extensions/check_mortality.rs index e2c22a07a3fed9d6b3842c7b5746d99399f1f9c3..9c76ee3d8557bb0d124f4b5dd5af19cc964d1a59 100644 --- a/substrate/frame/system/src/extensions/check_mortality.rs +++ b/substrate/frame/system/src/extensions/check_mortality.rs @@ -16,7 +16,7 @@ // limitations under the License. use crate::{pallet_prelude::BlockNumberFor, BlockHash, Config, Pallet}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::pallet_prelude::TransactionSource; use scale_info::TypeInfo; use sp_runtime::{ @@ -34,7 +34,7 @@ use sp_runtime::{ /// # Transaction Validity /// /// The extension affects `longevity` of the transaction according to the [`Era`] definition. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckMortality<T: Config + Send + Sync>(pub Era, core::marker::PhantomData<T>); diff --git a/substrate/frame/system/src/extensions/check_non_zero_sender.rs b/substrate/frame/system/src/extensions/check_non_zero_sender.rs index 978eebaf3dace5542991573c942f222015148d51..0fd02d73e705489aba369385add9695e767af73f 100644 --- a/substrate/frame/system/src/extensions/check_non_zero_sender.rs +++ b/substrate/frame/system/src/extensions/check_non_zero_sender.rs @@ -16,7 +16,7 @@ // limitations under the License. use crate::Config; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use core::marker::PhantomData; use frame_support::{pallet_prelude::TransactionSource, traits::OriginTrait, DefaultNoBound}; use scale_info::TypeInfo; @@ -27,7 +27,7 @@ use sp_runtime::{ }; /// Check to ensure that the sender is not the zero address. -#[derive(Encode, Decode, DefaultNoBound, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, DefaultNoBound, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckNonZeroSender<T>(PhantomData<T>); diff --git a/substrate/frame/system/src/extensions/check_nonce.rs b/substrate/frame/system/src/extensions/check_nonce.rs index bc19a09e06a9e0d567441d066218b69377401c01..16ee8be0e2ca38b9fa19d354ae5f63c32fe67adb 100644 --- a/substrate/frame/system/src/extensions/check_nonce.rs +++ b/substrate/frame/system/src/extensions/check_nonce.rs @@ -17,7 +17,7 @@ use crate::Config; use alloc::vec; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ dispatch::DispatchInfo, pallet_prelude::TransactionSource, RuntimeDebugNoBound, }; @@ -46,7 +46,7 @@ use sp_weights::Weight; /// step. This means that other extensions ahead of `CheckNonce` in the pipeline must not alter the /// nonce during their own preparation step, or else the transaction may be rejected during dispatch /// or lead to an inconsistent account state. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckNonce<T: Config>(#[codec(compact)] pub T::Nonce); diff --git a/substrate/frame/system/src/extensions/check_spec_version.rs b/substrate/frame/system/src/extensions/check_spec_version.rs index ff86c6cd469508c3a6c0e5c6ba2ceb3bd3112c7a..f3f5f4438183cc70fb7e9438fb16243e42777278 100644 --- a/substrate/frame/system/src/extensions/check_spec_version.rs +++ b/substrate/frame/system/src/extensions/check_spec_version.rs @@ -16,7 +16,7 @@ // limitations under the License. use crate::{Config, Pallet}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use sp_runtime::{ impl_tx_ext_default, traits::TransactionExtension, @@ -29,7 +29,7 @@ use sp_runtime::{ /// /// The transaction with incorrect `spec_version` are considered invalid. The validity /// is not affected in any other way. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckSpecVersion<T: Config + Send + Sync>(core::marker::PhantomData<T>); diff --git a/substrate/frame/system/src/extensions/check_tx_version.rs b/substrate/frame/system/src/extensions/check_tx_version.rs index e3b7dfe7c928c25a2743ca85263a7d6789157c24..1992bf09714c966fd82544e7a8c453d243fc0326 100644 --- a/substrate/frame/system/src/extensions/check_tx_version.rs +++ b/substrate/frame/system/src/extensions/check_tx_version.rs @@ -16,7 +16,7 @@ // limitations under the License. use crate::{Config, Pallet}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use scale_info::TypeInfo; use sp_runtime::{ impl_tx_ext_default, traits::TransactionExtension, @@ -29,7 +29,7 @@ use sp_runtime::{ /// /// The transaction with incorrect `transaction_version` are considered invalid. The validity /// is not affected in any other way. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckTxVersion<T: Config + Send + Sync>(core::marker::PhantomData<T>); diff --git a/substrate/frame/system/src/extensions/check_weight.rs b/substrate/frame/system/src/extensions/check_weight.rs index de0303defd0c3e8c9fc502d3017127e1c08c54ac..39596fcdac5202e1bde661d222d15e6839a39f51 100644 --- a/substrate/frame/system/src/extensions/check_weight.rs +++ b/substrate/frame/system/src/extensions/check_weight.rs @@ -16,7 +16,7 @@ // limitations under the License. use crate::{limits::BlockWeights, Config, Pallet, LOG_TARGET}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ dispatch::{DispatchInfo, PostDispatchInfo}, pallet_prelude::TransactionSource, @@ -38,7 +38,7 @@ use sp_weights::Weight; /// /// This extension does not influence any fields of `TransactionValidity` in case the /// transaction is valid. -#[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, Default, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckWeight<T: Config + Send + Sync>(core::marker::PhantomData<T>); diff --git a/substrate/frame/system/src/extensions/weight_reclaim.rs b/substrate/frame/system/src/extensions/weight_reclaim.rs index 0c37422a843bb7595497e8c2cc939ac39dee1c5e..de33bfdf0a3475308921a701163c888500443192 100644 --- a/substrate/frame/system/src/extensions/weight_reclaim.rs +++ b/substrate/frame/system/src/extensions/weight_reclaim.rs @@ -16,7 +16,7 @@ // limitations under the License. use crate::Config; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::dispatch::{DispatchInfo, PostDispatchInfo}; use scale_info::TypeInfo; use sp_runtime::{ @@ -33,7 +33,7 @@ use sp_weights::Weight; /// After the dispatch of the extrinsic, calculate the unused weight using the post dispatch /// information and update the block consumed weight according to the new calculated extrinsic /// weight. -#[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, Default, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct WeightReclaim<T: Config + Send + Sync>(core::marker::PhantomData<T>); diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 8e4cc71e9d4f6000b0f45fbc0f1e2cf4912e1bd3..e0db9002ab301b0abe96a7af4f126936bf477392 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -292,6 +292,7 @@ pub struct DispatchEventInfo { #[frame_support::pallet] pub mod pallet { use crate::{self as frame_system, pallet_prelude::*, *}; + use codec::HasCompact; use frame_support::pallet_prelude::*; /// Default implementations of [`DefaultConfig`], which can be used to implement [`Config`]. @@ -531,6 +532,7 @@ pub mod pallet { /// This stores the number of previous transactions associated with a sender account. type Nonce: Parameter + + HasCompact<Type: DecodeWithMemTracking> + Member + MaybeSerializeDeserialize + Debug diff --git a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/benchmarking.rs b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/benchmarking.rs index eb2635694e9c725c0cdd68cb66503ca1e36a44c8..70df54de18d8819997038f9050f62c289bf6eb47 100644 --- a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/benchmarking.rs +++ b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/benchmarking.rs @@ -34,10 +34,8 @@ use sp_runtime::traits::{ #[benchmarks(where T::RuntimeOrigin: AsTransactionAuthorizedOrigin, T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>, + BalanceOf<T>: Send + Sync + From<u64>, T::AssetId: Send + Sync, - BalanceOf<T>: Send - + Sync - + From<u64>, <T::RuntimeCall as Dispatchable>::RuntimeOrigin: AsSystemOriginSigner<T::AccountId> + Clone, )] mod benchmarks { diff --git a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs index d6721c46422bdf4c71f56e12c5e5b4beb7b0eae9..6c07b7d724ff648ef7df8857805bea275d802e41 100644 --- a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs @@ -44,7 +44,7 @@ extern crate alloc; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ dispatch::{DispatchInfo, DispatchResult, PostDispatchInfo}, pallet_prelude::TransactionSource, @@ -172,7 +172,7 @@ pub mod pallet { /// - Payments with a native asset are charged by /// [pallet_transaction_payment::Config::OnChargeTransaction]. /// - Payments with other assets are charged by [Config::OnChargeAssetTransaction]. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct ChargeAssetTxPayment<T: Config> { #[codec(compact)] diff --git a/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs b/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs index 4a96cbcacb5804541aa6130702869b05cbd32637..d82d478b4eba2034481ac12673c2dcabac7a2598 100644 --- a/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs @@ -35,7 +35,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ dispatch::{DispatchInfo, DispatchResult, PostDispatchInfo}, pallet_prelude::{TransactionSource, Weight}, @@ -169,7 +169,7 @@ pub mod pallet { /// /// Wraps the transaction logic in [`pallet_transaction_payment`] and extends it with assets. /// An asset id of `None` falls back to the underlying transaction payment via the native currency. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct ChargeAssetTxPayment<T: Config> { #[codec(compact)] diff --git a/substrate/frame/transaction-payment/asset-tx-payment/src/payment.rs b/substrate/frame/transaction-payment/asset-tx-payment/src/payment.rs index 7b7ae855bf8f34bea492b98a912c2094fdd8343d..96a6f6721c3beaed0fd3e58efdb7e535f4e544f2 100644 --- a/substrate/frame/transaction-payment/asset-tx-payment/src/payment.rs +++ b/substrate/frame/transaction-payment/asset-tx-payment/src/payment.rs @@ -40,7 +40,14 @@ pub trait OnChargeAssetTransaction<T: Config> { /// The underlying integer type in which fees are calculated. type Balance: Balance; /// The type used to identify the assets used for transaction payment. - type AssetId: FullCodec + Clone + MaybeSerializeDeserialize + Debug + Default + Eq + TypeInfo; + type AssetId: FullCodec + + DecodeWithMemTracking + + Clone + + MaybeSerializeDeserialize + + Debug + + Default + + Eq + + TypeInfo; /// The type used to store the intermediate values between pre- and post-dispatch. type LiquidityInfo; diff --git a/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs b/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs index 5ba1d1297679eb6cc6b0d905a70a98d57b99a563..f842ef6cd7e6fa4e2150377eeee17a07aef94a2f 100644 --- a/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs @@ -36,7 +36,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ dispatch::{CheckIfFeeless, DispatchResult}, pallet_prelude::TransactionSource, @@ -81,7 +81,7 @@ pub mod pallet { } /// A [`TransactionExtension`] that skips the wrapped extension if the dispatchable is feeless. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq)] pub struct SkipCheckIfFeeless<T, S>(pub S, core::marker::PhantomData<T>); // Make this extension "invisible" from the outside (ie metadata type information) diff --git a/substrate/frame/transaction-payment/skip-feeless-payment/src/mock.rs b/substrate/frame/transaction-payment/skip-feeless-payment/src/mock.rs index cff232a0cae3c60ac349da3b96910275626c540d..3a1aff823beced271bb611053e20c4ddf39fee07 100644 --- a/substrate/frame/transaction-payment/skip-feeless-payment/src/mock.rs +++ b/substrate/frame/transaction-payment/skip-feeless-payment/src/mock.rs @@ -39,7 +39,7 @@ parameter_types! { pub static ValidateCount: u32 = 0; } -#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, TypeInfo)] +#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct DummyExtension; impl TransactionExtension<RuntimeCall> for DummyExtension { diff --git a/substrate/frame/transaction-payment/src/lib.rs b/substrate/frame/transaction-payment/src/lib.rs index 216697beac698dd33f82a15612ccdbd671e94569..c758172dd62a1c51df52dbf17b5be5995aae76cb 100644 --- a/substrate/frame/transaction-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/src/lib.rs @@ -47,7 +47,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use frame_support::{ @@ -708,7 +708,7 @@ where /// /// Operational transactions will receive an additional priority bump, so that they are normally /// considered before regular transactions. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct ChargeTransactionPayment<T: Config>(#[codec(compact)] BalanceOf<T>); diff --git a/substrate/frame/verify-signature/src/extension.rs b/substrate/frame/verify-signature/src/extension.rs index d48991e7a1daf2216e7439a4800baafddda50fe4..1f34a75b1537779a395d9cfa642545006b4d9d8e 100644 --- a/substrate/frame/verify-signature/src/extension.rs +++ b/substrate/frame/verify-signature/src/extension.rs @@ -19,7 +19,7 @@ //! the rest of the transaction extension pipeline. use crate::{Config, WeightInfo}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{pallet_prelude::TransactionSource, traits::OriginTrait}; use scale_info::TypeInfo; use sp_io::hashing::blake2_256; @@ -38,7 +38,7 @@ use sp_weights::Weight; /// functionality that traditionally signed transactions had with the implicit signature checking /// implemented in [`Checkable`](sp_runtime::traits::Checkable). It is meant to be placed ahead of /// any other extensions that do authorization work in the [`TransactionExtension`] pipeline. -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] +#[derive(Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub enum VerifySignature<T> where diff --git a/substrate/primitives/runtime/src/generic/block.rs b/substrate/primitives/runtime/src/generic/block.rs index a084a3703f9e6a8809b68f910c35c95372a517d9..687b7847ed0251780f7f93ca4a7672d29d836ad1 100644 --- a/substrate/primitives/runtime/src/generic/block.rs +++ b/substrate/primitives/runtime/src/generic/block.rs @@ -24,7 +24,7 @@ use std::fmt; use serde::{Deserialize, Serialize}; use crate::{ - codec::{Codec, Decode, Encode}, + codec::{Codec, Decode, DecodeWithMemTracking, Encode}, traits::{ self, Block as BlockT, Header as HeaderT, MaybeSerialize, MaybeSerializeDeserialize, Member, NumberFor, @@ -78,7 +78,9 @@ impl<Block: BlockT> fmt::Display for BlockId<Block> { } /// Abstraction over a substrate block. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] +#[derive( + PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, RuntimeDebug, scale_info::TypeInfo, +)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr(feature = "serde", serde(deny_unknown_fields))] @@ -99,7 +101,7 @@ where impl<Header, Extrinsic: MaybeSerialize> traits::Block for Block<Header, Extrinsic> where Header: HeaderT + MaybeSerializeDeserialize, - Extrinsic: Member + Codec + traits::ExtrinsicLike, + Extrinsic: Member + Codec + DecodeWithMemTracking + traits::ExtrinsicLike, { type Extrinsic = Extrinsic; type Header = Header; diff --git a/substrate/primitives/runtime/src/generic/era.rs b/substrate/primitives/runtime/src/generic/era.rs index bdc7e9930fb1d3a38a689337b819faa2d63d8b63..c3762b310bf9d05043246bdcb1faca457ac233f5 100644 --- a/substrate/primitives/runtime/src/generic/era.rs +++ b/substrate/primitives/runtime/src/generic/era.rs @@ -20,7 +20,7 @@ #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; -use crate::codec::{Decode, Encode, Error, Input, Output}; +use crate::codec::{Decode, DecodeWithMemTracking, Encode, Error, Input, Output}; /// Era period pub type Period = u64; @@ -29,7 +29,7 @@ pub type Period = u64; pub type Phase = u64; /// An era to describe the longevity of a transaction. -#[derive(PartialEq, Eq, Clone, Copy, sp_core::RuntimeDebug)] +#[derive(DecodeWithMemTracking, PartialEq, Eq, Clone, Copy, sp_core::RuntimeDebug)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum Era { /// The transaction is valid forever. The genesis hash must be present in the signed content. diff --git a/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs b/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs index 6b8471f848466e7c1d7efa8e534c3a9af3b1887b..6744b96fa910d6008572784110f658f999192a97 100644 --- a/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs +++ b/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs @@ -29,7 +29,7 @@ use crate::{ #[cfg(all(not(feature = "std"), feature = "serde"))] use alloc::format; use alloc::{vec, vec::Vec}; -use codec::{Compact, Decode, Encode, EncodeLike, Error, Input}; +use codec::{Compact, Decode, DecodeWithMemTracking, Encode, EncodeLike, Error, Input}; use core::fmt; use scale_info::{build::Fields, meta_type, Path, StaticTypeInfo, Type, TypeInfo, TypeParameter}; use sp_io::hashing::blake2_256; @@ -72,7 +72,7 @@ impl<Address: TypeInfo, Signature: TypeInfo, Extension: TypeInfo> SignaturePaylo /// A "header" for extrinsics leading up to the call itself. Determines the type of extrinsic and /// holds any necessary specialized data. -#[derive(Eq, PartialEq, Clone)] +#[derive(DecodeWithMemTracking, Eq, PartialEq, Clone)] pub enum Preamble<Address, Signature, Extension> { /// An extrinsic without a signature or any extension. This means it's either an inherent or /// an old-school "Unsigned" (we don't use that terminology any more since it's confusable with @@ -219,7 +219,13 @@ where /// This can be checked using [`Checkable`], yielding a [`CheckedExtrinsic`], which is the /// counterpart of this type after its signature (and other non-negotiable validity checks) have /// passed. -#[derive(PartialEq, Eq, Clone, Debug)] +#[derive(DecodeWithMemTracking, PartialEq, Eq, Clone, Debug)] +#[codec(decode_with_mem_tracking_bound( + Address: DecodeWithMemTracking, + Call: DecodeWithMemTracking, + Signature: DecodeWithMemTracking, + Extension: DecodeWithMemTracking) +)] pub struct UncheckedExtrinsic<Address, Call, Signature, Extension> { /// Information regarding the type of extrinsic this is (inherent or transaction) as well as /// associated extension (`Extension`) data if it's a transaction and a possible signature. @@ -738,7 +744,18 @@ mod tests { const TEST_ACCOUNT: TestAccountId = 0; // NOTE: this is demonstration. One can simply use `()` for testing. - #[derive(Debug, Encode, Decode, Clone, Eq, PartialEq, Ord, PartialOrd, TypeInfo)] + #[derive( + Debug, + Encode, + Decode, + DecodeWithMemTracking, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + TypeInfo, + )] struct DummyExtension; impl TransactionExtension<TestCall> for DummyExtension { const IDENTIFIER: &'static str = "DummyExtension"; diff --git a/substrate/primitives/runtime/src/lib.rs b/substrate/primitives/runtime/src/lib.rs index f0813dd33779ee7f9b9c524bb55df83bb0f84da5..b9f69b6daa10efe35b027ace9d5b7b87c78f3c03 100644 --- a/substrate/primitives/runtime/src/lib.rs +++ b/substrate/primitives/runtime/src/lib.rs @@ -968,7 +968,7 @@ macro_rules! assert_eq_error_rate_float { /// Simple blob to hold an extrinsic without committing to its format and ensure it is serialized /// correctly. -#[derive(PartialEq, Eq, Clone, Default, Encode, Decode, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Default, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct OpaqueExtrinsic(Vec<u8>); impl OpaqueExtrinsic { diff --git a/substrate/primitives/runtime/src/testing.rs b/substrate/primitives/runtime/src/testing.rs index 3f037eb153b9fb2bf7c64f9b419c3b16654d21b3..8084ff53e634e7592dc48ac84fc94a7651a5cb52 100644 --- a/substrate/primitives/runtime/src/testing.rs +++ b/substrate/primitives/runtime/src/testing.rs @@ -212,7 +212,9 @@ impl Header { } /// Testing block -#[derive(PartialEq, Eq, Clone, Serialize, Debug, Encode, Decode, TypeInfo)] +#[derive( + PartialEq, Eq, Clone, Serialize, Debug, Encode, Decode, DecodeWithMemTracking, TypeInfo, +)] pub struct Block<Xt> { /// Block header pub header: Header, @@ -227,6 +229,7 @@ impl<Xt> traits::HeaderProvider for Block<Xt> { impl< Xt: 'static + Codec + + DecodeWithMemTracking + Sized + Send + Sync @@ -273,7 +276,7 @@ where pub type TestXt<Call, Extra> = UncheckedExtrinsic<u64, Call, (), Extra>; /// Wrapper over a `u64` that can be used as a `RuntimeCall`. -#[derive(PartialEq, Eq, Debug, Clone, Encode, Decode, TypeInfo)] +#[derive(PartialEq, Eq, Debug, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct MockCallU64(pub u64); impl Dispatchable for MockCallU64 { diff --git a/substrate/primitives/runtime/src/traits/mod.rs b/substrate/primitives/runtime/src/traits/mod.rs index 3781120fa4488c07735d7eb39f9063f9e1613ee9..0cda70efa8672e77d95f4099908b32fac0ab2b5e 100644 --- a/substrate/primitives/runtime/src/traits/mod.rs +++ b/substrate/primitives/runtime/src/traits/mod.rs @@ -27,7 +27,9 @@ use crate::{ DispatchResult, }; use alloc::vec::Vec; -use codec::{Codec, Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen}; +use codec::{ + Codec, Decode, DecodeWithMemTracking, Encode, EncodeLike, FullCodec, HasCompact, MaxEncodedLen, +}; #[doc(hidden)] pub use core::{fmt::Debug, marker::PhantomData}; use impl_trait_for_tuples::impl_for_tuples; @@ -1009,6 +1011,7 @@ pub trait HashOutput: + Default + Encode + Decode + + DecodeWithMemTracking + EncodeLike + MaxEncodedLen + TypeInfo @@ -1029,6 +1032,7 @@ impl<T> HashOutput for T where + Default + Encode + Decode + + DecodeWithMemTracking + EncodeLike + MaxEncodedLen + TypeInfo @@ -1181,6 +1185,8 @@ pub trait BlockNumber: + TypeInfo + MaxEncodedLen + FullCodec + + DecodeWithMemTracking + + HasCompact<Type: DecodeWithMemTracking> { } @@ -1198,7 +1204,9 @@ impl< + Default + TypeInfo + MaxEncodedLen - + FullCodec, + + FullCodec + + DecodeWithMemTracking + + HasCompact<Type: DecodeWithMemTracking>, > BlockNumber for T { } @@ -1209,7 +1217,16 @@ impl< /// /// You can also create a `new` one from those fields. pub trait Header: - Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + TypeInfo + 'static + Clone + + Send + + Sync + + Codec + + DecodeWithMemTracking + + Eq + + MaybeSerialize + + Debug + + TypeInfo + + 'static { /// Header number. type Number: BlockNumber; @@ -1293,6 +1310,7 @@ pub trait Block: + Send + Sync + Codec + + DecodeWithMemTracking + Eq + MaybeSerialize + Debug @@ -1620,7 +1638,7 @@ pub trait AsTransactionAuthorizedOrigin { /// that should be additionally associated with the transaction. It should be plain old data. #[deprecated = "Use `TransactionExtension` instead."] pub trait SignedExtension: - Codec + Debug + Sync + Send + Clone + Eq + PartialEq + StaticTypeInfo + Codec + DecodeWithMemTracking + Debug + Sync + Send + Clone + Eq + PartialEq + StaticTypeInfo { /// Unique identifier of this signed extension. /// @@ -2344,6 +2362,7 @@ pub trait BlockIdTo<Block: self::Block> { pub trait BlockNumberProvider { /// Type of `BlockNumber` to provide. type BlockNumber: Codec + + DecodeWithMemTracking + Clone + Ord + Eq diff --git a/substrate/primitives/runtime/src/traits/transaction_extension/as_transaction_extension.rs b/substrate/primitives/runtime/src/traits/transaction_extension/as_transaction_extension.rs index 282064078fe3a28924a7691ec40abe03c866e6e3..1153926dd246c842e87511de3ec6254ea037451f 100644 --- a/substrate/primitives/runtime/src/traits/transaction_extension/as_transaction_extension.rs +++ b/substrate/primitives/runtime/src/traits/transaction_extension/as_transaction_extension.rs @@ -31,7 +31,7 @@ use crate::{ use super::*; /// Adapter to use a `SignedExtension` in the place of a `TransactionExtension`. -#[derive(TypeInfo, Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] +#[derive(TypeInfo, Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, Eq, RuntimeDebug)] #[deprecated = "Convert your SignedExtension to a TransactionExtension."] pub struct AsTransactionExtension<SE: SignedExtension>(pub SE); diff --git a/substrate/primitives/runtime/src/traits/transaction_extension/mod.rs b/substrate/primitives/runtime/src/traits/transaction_extension/mod.rs index 15be1e4c8e0a23bdd8f2dec892a3ad3f07808222..24ec6721acf222f58dacd2ff94cbe679eb4edcf9 100644 --- a/substrate/primitives/runtime/src/traits/transaction_extension/mod.rs +++ b/substrate/primitives/runtime/src/traits/transaction_extension/mod.rs @@ -25,7 +25,7 @@ use crate::{ DispatchResult, }; use alloc::vec::Vec; -use codec::{Codec, Decode, Encode}; +use codec::{Codec, Decode, DecodeWithMemTracking, Encode}; use core::fmt::Debug; #[doc(hidden)] pub use core::marker::PhantomData; @@ -228,7 +228,7 @@ pub type ValidateResult<Val, Call> = /// correct amount of weight used during the call. This is because one cannot know the actual weight /// of an extension after post dispatch without running the post dispatch ahead of time. pub trait TransactionExtension<Call: Dispatchable>: - Codec + Debug + Sync + Send + Clone + Eq + PartialEq + StaticTypeInfo + Codec + DecodeWithMemTracking + Debug + Sync + Send + Clone + Eq + PartialEq + StaticTypeInfo { /// Unique identifier of this signed extension. /// @@ -713,7 +713,7 @@ mod test { use scale_info::TypeInfo; use std::cell::RefCell; - #[derive(Clone, Debug, Eq, PartialEq, Encode, Decode, TypeInfo)] + #[derive(Clone, Debug, Eq, PartialEq, Encode, Decode, DecodeWithMemTracking, TypeInfo)] struct MockExtension { also_implicit: u8, explicit: u8, diff --git a/substrate/primitives/runtime/src/type_with_default.rs b/substrate/primitives/runtime/src/type_with_default.rs index b0eca22e5c1a422cb1fe056997f716d023f5cce6..5a1953fba92e3f1494bd5aeb9a090c95736bc25d 100644 --- a/substrate/primitives/runtime/src/type_with_default.rs +++ b/substrate/primitives/runtime/src/type_with_default.rs @@ -18,7 +18,7 @@ //! Provides a type that wraps another type and provides a default value. use crate::traits::{Bounded, One, Zero}; -use codec::{Compact, CompactAs, Decode, Encode, HasCompact, MaxEncodedLen}; +use codec::{Compact, CompactAs, Decode, DecodeWithMemTracking, Encode, HasCompact, MaxEncodedLen}; use core::{ fmt::Display, marker::PhantomData, @@ -41,7 +41,7 @@ use serde::{Deserialize, Serialize}; /// /// Passes through arithmetical and many other operations to the inner value. /// Type information for metadata is the same as the inner value's type. -#[derive(Encode, Decode, Debug, MaxEncodedLen)] +#[derive(Encode, Decode, DecodeWithMemTracking, Debug, MaxEncodedLen)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct TypeWithDefault<T, D: Get<T>>(T, PhantomData<D>); diff --git a/substrate/primitives/staking/src/lib.rs b/substrate/primitives/staking/src/lib.rs index 538cef00e268d64bb07b7c090878ec13722d6335..863e6cbe2b20f17cbf66e307769a92f72062f98c 100644 --- a/substrate/primitives/staking/src/lib.rs +++ b/substrate/primitives/staking/src/lib.rs @@ -24,7 +24,7 @@ extern crate alloc; use crate::currency_to_vote::CurrencyToVote; use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec}; -use codec::{Decode, Encode, FullCodec, HasCompact, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, HasCompact, MaxEncodedLen}; use core::ops::{Add, AddAssign, Sub, SubAssign}; use scale_info::TypeInfo; use sp_runtime::{ @@ -346,7 +346,19 @@ pub trait StakingUnchecked: StakingInterface { } /// The amount of exposure for an era that an individual nominator has (susceptible to slashing). -#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, RuntimeDebug, TypeInfo, Copy)] +#[derive( + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Encode, + Decode, + DecodeWithMemTracking, + RuntimeDebug, + TypeInfo, + Copy, +)] pub struct IndividualExposure<AccountId, Balance: HasCompact> { /// The stash account of the nominator in question. pub who: AccountId, @@ -356,7 +368,18 @@ pub struct IndividualExposure<AccountId, Balance: HasCompact> { } /// A snapshot of the stake backing a single validator in the system. -#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +#[derive( + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Encode, + Decode, + DecodeWithMemTracking, + RuntimeDebug, + TypeInfo, +)] pub struct Exposure<AccountId, Balance: HasCompact> { /// The total balance backing this validator. #[codec(compact)] diff --git a/substrate/primitives/test-primitives/src/lib.rs b/substrate/primitives/test-primitives/src/lib.rs index adc96d773694e409e0eb35337344e33c8bf0d3b9..38499f3e251c3515bc7b30c56caf426ce30cbd08 100644 --- a/substrate/primitives/test-primitives/src/lib.rs +++ b/substrate/primitives/test-primitives/src/lib.rs @@ -21,7 +21,7 @@ extern crate alloc; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; pub use sp_application_crypto; use sp_application_crypto::sr25519; @@ -31,7 +31,9 @@ pub use sp_core::{hash::H256, RuntimeDebug}; use sp_runtime::traits::{BlakeTwo256, ExtrinsicLike, Verify}; /// Extrinsic for test-runtime. -#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] +#[derive( + Clone, PartialEq, Eq, Encode, Decode, DecodeWithMemTracking, RuntimeDebug, scale_info::TypeInfo, +)] pub enum Extrinsic { IncludeData(Vec<u8>), StorageChange(Vec<u8>, Option<Vec<u8>>), diff --git a/substrate/test-utils/runtime/src/lib.rs b/substrate/test-utils/runtime/src/lib.rs index b5d3bf2dbbea79dfb4a67d03bc0f7420d5de49b5..56360071363382ce2c2972a2d337dbd8576d7d89 100644 --- a/substrate/test-utils/runtime/src/lib.rs +++ b/substrate/test-utils/runtime/src/lib.rs @@ -246,7 +246,9 @@ pub type Executive = frame_executive::Executive< AllPalletsWithSystem, >; -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +#[derive( + Copy, Clone, PartialEq, Eq, Encode, Decode, DecodeWithMemTracking, RuntimeDebug, TypeInfo, +)] pub struct CheckSubstrateCall; impl sp_runtime::traits::Printable for CheckSubstrateCall { diff --git a/substrate/utils/frame/benchmarking-cli/src/pallet/command.rs b/substrate/utils/frame/benchmarking-cli/src/pallet/command.rs index c7c5f5c478ac56feb08d57095fc54bcba64d2c9c..af9118140d91ceab76a0f68a26492919a7c4e8b9 100644 --- a/substrate/utils/frame/benchmarking-cli/src/pallet/command.rs +++ b/substrate/utils/frame/benchmarking-cli/src/pallet/command.rs @@ -27,7 +27,7 @@ use crate::{ }, }; use clap::{error::ErrorKind, CommandFactory}; -use codec::{Decode, Encode}; +use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_benchmarking::{ Analysis, BenchmarkBatch, BenchmarkBatchSplitResults, BenchmarkList, BenchmarkParameter, BenchmarkResult, BenchmarkSelector, @@ -168,6 +168,7 @@ impl PalletCmd { pub fn run<Hasher, ExtraHostFunctions>(&self, config: sc_service::Configuration) -> Result<()> where Hasher: Hash, + <Hasher as Hash>::Output: DecodeWithMemTracking, ExtraHostFunctions: HostFunctions, { self.run_with_spec::<Hasher, ExtraHostFunctions>(Some(config.chain_spec)) @@ -235,6 +236,7 @@ impl PalletCmd { ) -> Result<()> where Hasher: Hash, + <Hasher as Hash>::Output: DecodeWithMemTracking, ExtraHostFunctions: HostFunctions, { if let Err((error_kind, msg)) = self.check_args(&chain_spec) { diff --git a/umbrella/MAINTAIN.md b/umbrella/MAINTAIN.md new file mode 100644 index 0000000000000000000000000000000000000000..0f092b75ae8ec60899d927882bda636462dc9e31 --- /dev/null +++ b/umbrella/MAINTAIN.md @@ -0,0 +1,12 @@ +`polkadot-sdk` should be updated when another crate is added to or removed from the workspace. There +is a CI check to ensure that it is in sync with the +[Polkadot-sdk](https://github.com/paritytech/polkadot-sdk) workspace.​ + +All the code in this crate is generated by +[`./scripts/generate-umbrella.py`](../scripts/generate-umbrella.py). We strongly recommend using the +script for updating rather than editing the files manually. Running the script requires +[`toml`](https://pypi.org/project/toml/) and +[`cargo-workspace>=2.2.6`](https://pypi.org/project/cargo-workspace/).​ ​ +```shell​ +python3 ./scripts/generate-umbrella.py --sdk . --version 0.1.0​ +``` diff --git a/umbrella/README.md b/umbrella/README.md new file mode 100644 index 0000000000000000000000000000000000000000..91b32a72df66502c8b14734a8266e8d4a162a540 --- /dev/null +++ b/umbrella/README.md @@ -0,0 +1,183 @@ +<div align="center"> + + + + +<!-- markdownlint-disable-next-line MD044 --> +# `polkadot-sdk` + +[](https://substrate.stackexchange.com/) + +</div> + +`polkadot-sdk` is an umbrella crate for the [Polkadot +SDK](https://github.com/paritytech/polkadot-sdk), in the sense that it is an "umbrella" that +encompasses other components. More specifically, it re-exports all the crates that are needed by +builders. + +`polkadot-sdk` aims to be the entry to the Polkadot and Substrate ecosystem and make the SDK more +approachable—the entire development environment made available with **one dependency**. More +importantly, it guarantees the compatible combination of crate versions. So even if you know exactly +which crates to use, you may still benefit from using `polkadot-sdk` for painless dependency +updates. + +You may have seen another umbrella crate named `polkadot-sdk-frame`. For clarification, while +`polkadot-sdk` aims to ease dependency management, `polkadot-sdk-frame` intends to simplify +[FRAME](https://docs.polkadot.com/polkadot-protocol/glossary/#frame-framework-for-runtime-aggregation-of-modularized-entities) +pallet implementation, as demonstrated in the example below. + +## 💻 Usage + +The re-exported crates are grouped under the following feature sets. + +- `node`: Anything that you need to build a node +- `runtime`: Most things that you need to build a runtime +- `runtime-full`: Also the extended runtime features that are sometimes needed + +<details> +<summary>ðŸ‹ï¸ Power User Features</summary> + +- `experimental` +- `runtime-benchmarks` +- `serde` +- `tuples-96` +- `try-runtime` +- `with-tracing` + +The power user features are meant to use alongside `node`, `runtime`, or `runtime-full` for extra +development support. For example, if the runtime relies on [serde](https://crates.io/crates/serde) +for serialization, and needs tracing and benchmarking for debugging and profiling, the `Cargo.toml` +may contain the following. + +```toml +[dependencies] +polkadot-sdk = { version = "0.12.0", features = ["runtime", "serde"], default-features = false } + +[features] +runtime-benchmarks = ["polkadot-sdk/runtime-benchmarks"] +with-tracing = ["polkadot-sdk/with-tracing"] +``` + +```shell +cargo build --features "runtime-benchmarks,with-tracing" +``` + +Substrate's [try-runtime](https://paritytech.github.io/try-runtime-cli/try_runtime/) is an essential +tool for testing runtime protocol upgrades locally, which can be enabled with the `try-runtime` +feature. + +```toml +[dependencies] +polkadot-sdk = { version = "0.12.0", features = ["runtime"], default-features = false } + +[features] +try-runtime = ["polkadot-sdk/try-runtime"] +``` + +```shell +cargo build --features "try-runtime" +``` + +In Substrate, a runtime can be seen as a tuple of various pallets. Since the number of pallets can +vary and there is no way to anticipate it, we have to generate impl-trait for tuples of different +sizes upfront, from 0-tuple to 64-tuple to be specific (64 is chosen to balance between usability +and compile time). + +Seldomly, when the runtime grows to have more than 64 pallets, the trait implementations will cease +to apply, in which case the feature `tuples-96` (or even `tuples-128`) must be enabled (at the cost +of increased compile time). + +```toml +[dependencies] +polkadot-sdk = { version = "0.12.0", features = ["runtime", "tuples-96"], default-features = false } +``` + +In addition to all the features mentioned earlier, each exported crate is feature-gated individually +with the name identical to the crate name, to provide fine-grained control over the dependencies. +Enabling features like `node` may pull in dependencies that you don't need. As you become more +knowledgeable about the SDK, you may consider specifying the exact crate names in the `features` +list instead to reduce build time. + +</details> + +--- + +When using `polkadot-sdk` to build a node, it is a good start to enable the `node` feature. + +```toml +[dependencies] +polkadot-sdk = { version = "0.12.0", features = ["node"] } +``` + +For a runtime implementation, you need the `runtime` feature instead. Besides, you may want to opt +out of `std` with `default-features = false` to allow the runtime to be executed in environments +where `std` isn't available. + +```toml +[dependencies] +polkadot-sdk = { version = "0.12.0", features = ["runtime"], default-features = false } +``` + +When building a runtime or writing an application pallet, `polkadot-sdk-frame` can be a handy +toolkit to start with. It gathers all the common types, traits, and functions from many different +crates so that you can import them with a one-liner. + +`polkadot-sdk-frame` is also a part of `polkadot-sdk`. It is enabled by the `runtime` feature. + +```rust +// It's a convention to rename it to `frame`. +use polkadot_sdk::polkadot_sdk_frame as frame; + +#[frame::pallet(dev_mode)] +pub mod pallet { + // Import declarations aren't automatically inherited. + // Need to "re-import" to make `frame` available here. + use super::*; + // One-liner to import all the dependencies used here. + use frame::prelude::*; + + pub type Balance = u128; + + #[pallet::pallet] + pub struct Pallet<T>(_); + + #[pallet::config] + #[pallet::disable_frame_system_supertrait_check] + pub trait Config: frame_system::Config {} + + #[pallet::storage] + pub type Balances<T: Config> = StorageMap<_, _, T::AccountId, Balance>; + + impl<T: Config> Pallet<T> { + pub fn transfer( + from: T::RuntimeOrigin, + to: T::AccountId, + amount: Balance, + ) -> DispatchResult { + let sender = ensure_signed(from)?; + let sender_balance = Balances::<T>::get(&sender).ok_or("NonExistentAccount")?; + let sender_remainder = sender_balance + .checked_sub(amount) + .ok_or("InsufficientBalance")?; + + Balances::<T>::mutate(to, |b| *b = Some(b.unwrap_or(0) + amount)); + Balances::<T>::insert(&sender, sender_remainder); + + Ok(()) + } + } +} +``` + +To learn more about building with the Polkadot SDK, you may start with these +[guides](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/guides/index.html) and +our [official docs](https://docs.polkadot.com/). + +## 🚀 Versioning + +We do a stable release for the SDK every three months with a version schema reflecting the release +cadence, which is tracked in the [release +registry](https://github.com/paritytech/release-registry/). At the time of writing, the latest +version is `stable2412` (released in 2024 December). To avoid confusion, we will align the +versioning of `polkadot-sdk` with the established schema. For instance, the next stable version will +be `2503.0.0`.