From d443f148ce0aa6a51798b86c6b3ae54113786f94 Mon Sep 17 00:00:00 2001 From: Aaro Altonen <48052676+altonen@users.noreply.github.com> Date: Fri, 7 Apr 2023 11:20:17 +0300 Subject: [PATCH 01/93] Make blocks per request configurable (#13824) * Make blocks per request configurable * Correct type * Update docs * Update client/cli/src/params/network_params.rs --- client/cli/src/params/network_params.rs | 8 ++ client/network/src/config.rs | 5 ++ .../network/sync/src/block_request_handler.rs | 6 +- client/network/sync/src/blocks.rs | 2 +- client/network/sync/src/engine.rs | 9 ++ client/network/sync/src/lib.rs | 84 ++++++++++++------- 6 files changed, 81 insertions(+), 33 deletions(-) diff --git a/client/cli/src/params/network_params.rs b/client/cli/src/params/network_params.rs index acec4b2ac872a..9d61e7204295d 100644 --- a/client/cli/src/params/network_params.rs +++ b/client/cli/src/params/network_params.rs @@ -141,6 +141,13 @@ pub struct NetworkParams { verbatim_doc_comment )] pub sync: SyncMode, + + /// Maximum number of blocks per request. + /// + /// Try reducing this number from the default value if you have a slow network connection + /// and observe block requests timing out. + #[arg(long, value_name = "COUNT", default_value_t = 64)] + pub max_blocks_per_request: u32, } impl NetworkParams { @@ -230,6 +237,7 @@ impl NetworkParams { allow_private_ip, }, max_parallel_downloads: self.max_parallel_downloads, + max_blocks_per_request: self.max_blocks_per_request, enable_dht_random_walk: !self.reserved_only, allow_non_globals_in_dht, kademlia_disjoint_query_paths: self.kademlia_disjoint_query_paths, diff --git a/client/network/src/config.rs b/client/network/src/config.rs index 781ae9c786694..e00bfac79f650 100644 --- a/client/network/src/config.rs +++ b/client/network/src/config.rs @@ -566,6 +566,7 @@ pub struct NetworkConfiguration { /// List of request-response protocols that the node supports. pub request_response_protocols: Vec, + /// Configuration for the default set of nodes used for block syncing and transactions. pub default_peers_set: SetConfig, @@ -590,6 +591,9 @@ pub struct NetworkConfiguration { /// Maximum number of peers to ask the same blocks in parallel. pub max_parallel_downloads: u32, + /// Maximum number of blocks per request. + pub max_blocks_per_request: u32, + /// Initial syncing mode. pub sync_mode: SyncMode, @@ -653,6 +657,7 @@ impl NetworkConfiguration { node_name: node_name.into(), transport: TransportConfig::Normal { enable_mdns: false, allow_private_ip: true }, max_parallel_downloads: 5, + max_blocks_per_request: 64, sync_mode: SyncMode::Full, enable_dht_random_walk: true, allow_non_globals_in_dht: false, diff --git a/client/network/sync/src/block_request_handler.rs b/client/network/sync/src/block_request_handler.rs index 921efd7def622..ece565aad4b09 100644 --- a/client/network/sync/src/block_request_handler.rs +++ b/client/network/sync/src/block_request_handler.rs @@ -17,7 +17,10 @@ //! Helper for handling (i.e. answering) block requests from a remote peer via the //! `crate::request_responses::RequestResponsesBehaviour`. -use crate::schema::v1::{block_request::FromBlock, BlockResponse, Direction}; +use crate::{ + schema::v1::{block_request::FromBlock, BlockResponse, Direction}, + MAX_BLOCKS_IN_RESPONSE, +}; use codec::{Decode, Encode}; use futures::{ @@ -50,7 +53,6 @@ use std::{ }; const LOG_TARGET: &str = "sync"; -const MAX_BLOCKS_IN_RESPONSE: usize = 128; const MAX_BODY_BYTES: usize = 8 * 1024 * 1024; const MAX_NUMBER_OF_SAME_REQUESTS_PER_PEER: usize = 2; diff --git a/client/network/sync/src/blocks.rs b/client/network/sync/src/blocks.rs index 4cc1ca080d177..3c76238be1b5f 100644 --- a/client/network/sync/src/blocks.rs +++ b/client/network/sync/src/blocks.rs @@ -109,7 +109,7 @@ impl BlockCollection { pub fn needed_blocks( &mut self, who: PeerId, - count: usize, + count: u32, peer_best: NumberFor, common: NumberFor, max_parallel: u32, diff --git a/client/network/sync/src/engine.rs b/client/network/sync/src/engine.rs index e3d45a980a0b4..6fb618a571c25 100644 --- a/client/network/sync/src/engine.rs +++ b/client/network/sync/src/engine.rs @@ -264,6 +264,14 @@ where SyncOperationMode::Warp => SyncMode::Warp, }; let max_parallel_downloads = network_config.max_parallel_downloads; + let max_blocks_per_request = if network_config.max_blocks_per_request > + crate::MAX_BLOCKS_IN_RESPONSE as u32 + { + log::info!(target: "sync", "clamping maximum blocks per request to {}", crate::MAX_BLOCKS_IN_RESPONSE); + crate::MAX_BLOCKS_IN_RESPONSE as u32 + } else { + network_config.max_blocks_per_request + }; let cache_capacity = NonZeroUsize::new( (network_config.default_peers_set.in_peers as usize + network_config.default_peers_set.out_peers as usize) @@ -318,6 +326,7 @@ where roles, block_announce_validator, max_parallel_downloads, + max_blocks_per_request, warp_sync_params, metrics_registry, network_service.clone(), diff --git a/client/network/sync/src/lib.rs b/client/network/sync/src/lib.rs index 28959e7f9c886..e112a1715ced1 100644 --- a/client/network/sync/src/lib.rs +++ b/client/network/sync/src/lib.rs @@ -107,9 +107,6 @@ pub mod state_request_handler; pub mod warp; pub mod warp_request_handler; -/// Maximum blocks to request in a single packet. -const MAX_BLOCKS_TO_REQUEST: usize = 64; - /// Maximum blocks to store in the import queue. const MAX_IMPORTING_BLOCKS: usize = 2048; @@ -147,6 +144,9 @@ const MIN_PEERS_TO_START_WARP_SYNC: usize = 3; /// Maximum allowed size for a block announce. const MAX_BLOCK_ANNOUNCE_SIZE: u64 = 1024 * 1024; +/// Maximum blocks per response. +pub(crate) const MAX_BLOCKS_IN_RESPONSE: usize = 128; + mod rep { use sc_peerset::ReputationChange as Rep; /// Reputation change when a peer sent us a message that led to a @@ -311,6 +311,8 @@ pub struct ChainSync { block_announce_validator: Box + Send>, /// Maximum number of peers to ask the same blocks in parallel. max_parallel_downloads: u32, + /// Maximum blocks per request. + max_blocks_per_request: u32, /// Total number of downloaded blocks. downloaded_blocks: usize, /// All block announcement that are currently being validated. @@ -1403,6 +1405,7 @@ where roles: Roles, block_announce_validator: Box + Send>, max_parallel_downloads: u32, + max_blocks_per_request: u32, warp_sync_params: Option>, metrics_registry: Option<&Registry>, network_service: service::network::NetworkServiceHandle, @@ -1437,6 +1440,7 @@ where allowed_requests: Default::default(), block_announce_validator, max_parallel_downloads, + max_blocks_per_request, downloaded_blocks: 0, block_announce_validation: Default::default(), block_announce_validation_per_peer_stats: Default::default(), @@ -2365,6 +2369,7 @@ where let queue = &self.queue_blocks; let allowed_requests = self.allowed_requests.take(); let max_parallel = if is_major_syncing { 1 } else { self.max_parallel_downloads }; + let max_blocks_per_request = self.max_blocks_per_request; let gap_sync = &mut self.gap_sync; self.peers .iter_mut() @@ -2404,6 +2409,7 @@ where blocks, attrs, max_parallel, + max_blocks_per_request, last_finalized, best_queued, ) { @@ -2430,6 +2436,7 @@ where client.block_status(*hash).unwrap_or(BlockStatus::Unknown) } }, + max_blocks_per_request, ) { trace!(target: "sync", "Downloading fork {:?} from {}", hash, id); peer.state = PeerSyncState::DownloadingStale(hash); @@ -2442,6 +2449,7 @@ where attrs, sync.target, sync.best_queued_number, + max_blocks_per_request, ) }) { peer.state = PeerSyncState::DownloadingGap(range.start); @@ -2910,6 +2918,7 @@ fn peer_block_request( blocks: &mut BlockCollection, attrs: BlockAttributes, max_parallel_downloads: u32, + max_blocks_per_request: u32, finalized: NumberFor, best_num: NumberFor, ) -> Option<(Range>, BlockRequest)> { @@ -2925,7 +2934,7 @@ fn peer_block_request( } let range = blocks.needed_blocks( *id, - MAX_BLOCKS_TO_REQUEST, + max_blocks_per_request, peer.best_number, peer.common_number, max_parallel_downloads, @@ -2960,10 +2969,11 @@ fn peer_gap_block_request( attrs: BlockAttributes, target: NumberFor, common_number: NumberFor, + max_blocks_per_request: u32, ) -> Option<(Range>, BlockRequest)> { let range = blocks.needed_blocks( *id, - MAX_BLOCKS_TO_REQUEST, + max_blocks_per_request, std::cmp::min(peer.best_number, target), common_number, 1, @@ -2992,6 +3002,7 @@ fn fork_sync_request( finalized: NumberFor, attributes: BlockAttributes, check_block: impl Fn(&B::Hash) -> BlockStatus, + max_blocks_per_request: u32, ) -> Option<(B::Hash, BlockRequest)> { targets.retain(|hash, r| { if r.number <= finalized { @@ -3011,7 +3022,7 @@ fn fork_sync_request( // Download the fork only if it is behind or not too far ahead our tip of the chain // Otherwise it should be downloaded in full sync mode. if r.number <= best_num || - (r.number - best_num).saturated_into::() < MAX_BLOCKS_TO_REQUEST as u32 + (r.number - best_num).saturated_into::() < max_blocks_per_request as u32 { let parent_status = r.parent_hash.as_ref().map_or(BlockStatus::Unknown, check_block); let count = if parent_status == BlockStatus::Unknown { @@ -3199,6 +3210,7 @@ mod test { Roles::from(&Role::Full), block_announce_validator, 1, + 64, None, None, chain_sync_network_handle, @@ -3265,6 +3277,7 @@ mod test { Roles::from(&Role::Full), Box::new(DefaultBlockAnnounceValidator), 1, + 64, None, None, chain_sync_network_handle, @@ -3446,6 +3459,7 @@ mod test { Roles::from(&Role::Full), Box::new(DefaultBlockAnnounceValidator), 5, + 64, None, None, chain_sync_network_handle, @@ -3572,6 +3586,7 @@ mod test { Roles::from(&Role::Full), Box::new(DefaultBlockAnnounceValidator), 5, + 64, None, None, chain_sync_network_handle, @@ -3586,6 +3601,7 @@ mod test { let peer_id2 = PeerId::random(); let best_block = blocks.last().unwrap().clone(); + let max_blocks_to_request = sync.max_blocks_per_request; // Connect the node we will sync from sync.new_peer(peer_id1, best_block.hash(), *best_block.header().number()) .unwrap(); @@ -3595,8 +3611,8 @@ mod test { while best_block_num < MAX_DOWNLOAD_AHEAD { let request = get_block_request( &mut sync, - FromBlock::Number(MAX_BLOCKS_TO_REQUEST as u64 + best_block_num as u64), - MAX_BLOCKS_TO_REQUEST as u32, + FromBlock::Number(max_blocks_to_request as u64 + best_block_num as u64), + max_blocks_to_request as u32, &peer_id1, ); @@ -3610,14 +3626,14 @@ mod test { let res = sync.on_block_data(&peer_id1, Some(request), response).unwrap(); assert!(matches!( res, - OnBlockData::Import(_, blocks) if blocks.len() == MAX_BLOCKS_TO_REQUEST + OnBlockData::Import(_, blocks) if blocks.len() == max_blocks_to_request as usize ),); - best_block_num += MAX_BLOCKS_TO_REQUEST as u32; + best_block_num += max_blocks_to_request as u32; let _ = sync.on_blocks_processed( - MAX_BLOCKS_TO_REQUEST as usize, - MAX_BLOCKS_TO_REQUEST as usize, + max_blocks_to_request as usize, + max_blocks_to_request as usize, resp_blocks .iter() .rev() @@ -3675,8 +3691,8 @@ mod test { // peer 2 as well. get_block_request( &mut sync, - FromBlock::Number(peer1_from + MAX_BLOCKS_TO_REQUEST as u64), - MAX_BLOCKS_TO_REQUEST as u32, + FromBlock::Number(peer1_from + max_blocks_to_request as u64), + max_blocks_to_request as u32, &peer_id2, ); } @@ -3728,6 +3744,7 @@ mod test { Roles::from(&Role::Full), Box::new(DefaultBlockAnnounceValidator), 5, + 64, None, None, chain_sync_network_handle, @@ -3773,11 +3790,12 @@ mod test { // Now request and import the fork. let mut best_block_num = *finalized_block.header().number() as u32; + let max_blocks_to_request = sync.max_blocks_per_request; while best_block_num < *fork_blocks.last().unwrap().header().number() as u32 - 1 { let request = get_block_request( &mut sync, - FromBlock::Number(MAX_BLOCKS_TO_REQUEST as u64 + best_block_num as u64), - MAX_BLOCKS_TO_REQUEST as u32, + FromBlock::Number(max_blocks_to_request as u64 + best_block_num as u64), + max_blocks_to_request as u32, &peer_id1, ); @@ -3791,14 +3809,14 @@ mod test { let res = sync.on_block_data(&peer_id1, Some(request), response).unwrap(); assert!(matches!( res, - OnBlockData::Import(_, blocks) if blocks.len() == MAX_BLOCKS_TO_REQUEST + OnBlockData::Import(_, blocks) if blocks.len() == sync.max_blocks_per_request as usize ),); - best_block_num += MAX_BLOCKS_TO_REQUEST as u32; + best_block_num += sync.max_blocks_per_request as u32; let _ = sync.on_blocks_processed( - MAX_BLOCKS_TO_REQUEST as usize, - MAX_BLOCKS_TO_REQUEST as usize, + max_blocks_to_request as usize, + max_blocks_to_request as usize, resp_blocks .iter() .rev() @@ -3869,6 +3887,7 @@ mod test { Roles::from(&Role::Full), Box::new(DefaultBlockAnnounceValidator), 5, + 64, None, None, chain_sync_network_handle, @@ -3914,10 +3933,12 @@ mod test { // Now request and import the fork. let mut best_block_num = *finalized_block.header().number() as u32; + let max_blocks_to_request = sync.max_blocks_per_request; + let mut request = get_block_request( &mut sync, - FromBlock::Number(MAX_BLOCKS_TO_REQUEST as u64 + best_block_num as u64), - MAX_BLOCKS_TO_REQUEST as u32, + FromBlock::Number(max_blocks_to_request as u64 + best_block_num as u64), + max_blocks_to_request as u32, &peer_id1, ); let last_block_num = *fork_blocks.last().unwrap().header().number() as u32 - 1; @@ -3932,18 +3953,18 @@ mod test { let res = sync.on_block_data(&peer_id1, Some(request.clone()), response).unwrap(); assert!(matches!( res, - OnBlockData::Import(_, blocks) if blocks.len() == MAX_BLOCKS_TO_REQUEST + OnBlockData::Import(_, blocks) if blocks.len() == max_blocks_to_request as usize ),); - best_block_num += MAX_BLOCKS_TO_REQUEST as u32; + best_block_num += max_blocks_to_request as u32; if best_block_num < last_block_num { // make sure we're not getting a duplicate request in the time before the blocks are // processed request = get_block_request( &mut sync, - FromBlock::Number(MAX_BLOCKS_TO_REQUEST as u64 + best_block_num as u64), - MAX_BLOCKS_TO_REQUEST as u32, + FromBlock::Number(max_blocks_to_request as u64 + best_block_num as u64), + max_blocks_to_request as u32, &peer_id1, ); } @@ -3965,16 +3986,17 @@ mod test { // The import queue may send notifications in batches of varying size. So we simulate // this here by splitting the batch into 2 notifications. + let max_blocks_to_request = sync.max_blocks_per_request; let second_batch = notify_imported.split_off(notify_imported.len() / 2); let _ = sync.on_blocks_processed( - MAX_BLOCKS_TO_REQUEST as usize, - MAX_BLOCKS_TO_REQUEST as usize, + max_blocks_to_request as usize, + max_blocks_to_request as usize, notify_imported, ); let _ = sync.on_blocks_processed( - MAX_BLOCKS_TO_REQUEST as usize, - MAX_BLOCKS_TO_REQUEST as usize, + max_blocks_to_request as usize, + max_blocks_to_request as usize, second_batch, ); @@ -4010,6 +4032,7 @@ mod test { Roles::from(&Role::Full), Box::new(DefaultBlockAnnounceValidator), 1, + 64, None, None, chain_sync_network_handle, @@ -4055,6 +4078,7 @@ mod test { Roles::from(&Role::Full), Box::new(DefaultBlockAnnounceValidator), 1, + 64, None, None, chain_sync_network_handle, From 72dd574acf805fda1dc1e64b7bbd510e12a81312 Mon Sep 17 00:00:00 2001 From: Marcin S Date: Fri, 7 Apr 2023 12:35:41 +0200 Subject: [PATCH 02/93] WASM executor: add `OutputExceedsBounds` variant to `Error` (#13841) * WASM executor: add `OutputExceedsBounds` variant to `Error` Previously this was a `WasmError`, which is intended for runtime construction errors. However this led to confusion as output-exceeds-bounds occurs due to execution of `validate_block`. * Fix warning --- client/executor/common/src/error.rs | 5 ++++- client/executor/src/integration_tests/mod.rs | 11 ++++------- client/executor/wasmtime/src/runtime.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client/executor/common/src/error.rs b/client/executor/common/src/error.rs index c47164a60655f..2dfe0bf02df2f 100644 --- a/client/executor/common/src/error.rs +++ b/client/executor/common/src/error.rs @@ -104,6 +104,9 @@ pub enum Error { #[error("Execution aborted due to trap: {0}")] AbortedDueToTrap(MessageWithBacktrace), + + #[error("Output exceeds bounds of wasm memory")] + OutputExceedsBounds, } impl wasmi::HostError for Error {} @@ -153,7 +156,7 @@ pub enum WasmError { Instantiation(String), /// Other error happenend. - #[error("{0}")] + #[error("Other error happened while constructing the runtime: {0}")] Other(String), } diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs index 066b1497fb6ec..0148968f98a38 100644 --- a/client/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -22,7 +22,7 @@ mod linux; use assert_matches::assert_matches; use codec::{Decode, Encode}; use sc_executor_common::{ - error::{Error, WasmError}, + error::Error, runtime_blob::RuntimeBlob, wasm_runtime::{HeapAllocStrategy, WasmModule}, }; @@ -819,9 +819,8 @@ fn return_huge_len(wasm_method: WasmExecutionMethod) { Error::Runtime => { assert_matches!(wasm_method, WasmExecutionMethod::Interpreted); }, - Error::RuntimeConstruction(WasmError::Other(error)) => { + Error::OutputExceedsBounds => { assert_matches!(wasm_method, WasmExecutionMethod::Compiled { .. }); - assert_eq!(error, "output exceeds bounds of wasm memory"); }, error => panic!("unexpected error: {:?}", error), } @@ -849,9 +848,8 @@ fn return_max_memory_offset_plus_one(wasm_method: WasmExecutionMethod) { Error::Runtime => { assert_matches!(wasm_method, WasmExecutionMethod::Interpreted); }, - Error::RuntimeConstruction(WasmError::Other(error)) => { + Error::OutputExceedsBounds => { assert_matches!(wasm_method, WasmExecutionMethod::Compiled { .. }); - assert_eq!(error, "output exceeds bounds of wasm memory"); }, error => panic!("unexpected error: {:?}", error), } @@ -866,9 +864,8 @@ fn return_overflow(wasm_method: WasmExecutionMethod) { Error::Runtime => { assert_matches!(wasm_method, WasmExecutionMethod::Interpreted); }, - Error::RuntimeConstruction(WasmError::Other(error)) => { + Error::OutputExceedsBounds => { assert_matches!(wasm_method, WasmExecutionMethod::Compiled { .. }); - assert_eq!(error, "output exceeds bounds of wasm memory"); }, error => panic!("unexpected error: {:?}", error), } diff --git a/client/executor/wasmtime/src/runtime.rs b/client/executor/wasmtime/src/runtime.rs index e01a51f6cf2a7..c9a2c83e0493c 100644 --- a/client/executor/wasmtime/src/runtime.rs +++ b/client/executor/wasmtime/src/runtime.rs @@ -26,7 +26,7 @@ use crate::{ use sc_allocator::{AllocationStats, FreeingBumpHeapAllocator}; use sc_executor_common::{ - error::{Result, WasmError}, + error::{Error, Result, WasmError}, runtime_blob::{ self, DataSegmentsSnapshot, ExposedMutableGlobalsSet, GlobalsSnapshot, RuntimeBlob, }, @@ -776,7 +776,7 @@ fn extract_output_data( // Get the size of the WASM memory in bytes. let memory_size = ctx.as_context().data().memory().data_size(ctx); if checked_range(output_ptr as usize, output_len as usize, memory_size).is_none() { - Err(WasmError::Other("output exceeds bounds of wasm memory".into()))? + Err(Error::OutputExceedsBounds)? } let mut output = vec![0; output_len as usize]; From 82e824bc0d21c63943b06d753e53a1e17e5a23c3 Mon Sep 17 00:00:00 2001 From: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Date: Sat, 8 Apr 2023 20:20:13 +0300 Subject: [PATCH 03/93] Warn if pallet provided to try-state does not exist (#13858) * Warn if pallet does not exist in try-state * unwrap_or_default --- frame/support/src/traits/try_runtime.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frame/support/src/traits/try_runtime.rs b/frame/support/src/traits/try_runtime.rs index 6103f07a73c78..bebc248721c99 100644 --- a/frame/support/src/traits/try_runtime.rs +++ b/frame/support/src/traits/try_runtime.rs @@ -168,11 +168,19 @@ impl TryState::name(), Tuple::try_state) ),* )]; let mut result = Ok(()); - for (name, try_state_fn) in try_state_fns { - if pallet_names.iter().any(|n| n == name.as_bytes()) { + pallet_names.iter().for_each(|pallet_name| { + if let Some((name, try_state_fn)) = + try_state_fns.iter().find(|(name, _)| name.as_bytes() == pallet_name) + { result = result.and(try_state_fn(n.clone(), targets.clone())); + } else { + crate::log::warn!( + "Pallet {:?} not found", + sp_std::str::from_utf8(pallet_name).unwrap_or_default() + ); } - } + }); + result }, } From 2e94e253950457571e91a5df1e60f82ba7b841dd Mon Sep 17 00:00:00 2001 From: yjh Date: Mon, 10 Apr 2023 07:48:40 +0800 Subject: [PATCH 04/93] refactor(sc-executor): use wasm executor builder instead of old apis (#13740) * refactor: use builder api for all executors * improve a lot * remove unused args * cleanup deps * fix inconsistency about heap alloc * add `heap_pages` back to try-runtime * fix * chore: reduce duplicated code for sc-service-test * cleanup code * fmt * improve test executor * improve * use #[deprecated] * set runtime_cache_size: 4 * fix and improve * refactor builder * fix * fix bench * fix tests * fix warnings * fix warnings * fix * fix * update by suggestions * update name --- bin/node-template/node/src/service.rs | 7 +-- bin/node/cli/benches/transaction_pool.rs | 4 +- bin/node/cli/src/service.rs | 7 +-- bin/node/executor/benches/bench.rs | 11 ++-- bin/node/executor/tests/common.rs | 4 +- bin/node/inspect/src/command.rs | 25 ++++----- bin/node/testing/src/bench.rs | 14 ++--- client/executor/benches/bench.rs | 7 ++- client/executor/common/src/wasm_runtime.rs | 7 +++ .../src/{native_executor.rs => executor.rs} | 51 +++++++++++-------- .../executor/src/integration_tests/linux.rs | 4 +- client/executor/src/integration_tests/mod.rs | 34 ++++++------- client/executor/src/lib.rs | 25 +++++---- client/executor/src/wasm_runtime.rs | 2 +- client/executor/wasmtime/src/tests.rs | 6 +-- client/service/src/builder.rs | 35 ++++++++++--- client/service/src/client/call_executor.rs | 25 +++++---- client/service/src/client/wasm_override.rs | 28 +++++----- client/service/src/lib.rs | 6 +-- client/service/test/src/client/mod.rs | 38 +++----------- client/service/test/src/lib.rs | 8 ++- frame/system/src/tests.rs | 4 +- primitives/api/test/tests/runtime_calls.rs | 8 ++- primitives/runtime-interface/test/src/lib.rs | 3 +- test-utils/client/src/lib.rs | 4 +- test-utils/runtime/client/src/lib.rs | 7 +-- test-utils/runtime/src/system.rs | 4 +- .../benchmarking-cli/src/pallet/command.rs | 17 ++++--- utils/frame/try-runtime/cli/src/lib.rs | 28 +++++----- 29 files changed, 213 insertions(+), 210 deletions(-) rename client/executor/src/{native_executor.rs => executor.rs} (94%) diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs index dfbb5e96354e4..723d1db3eea37 100644 --- a/bin/node-template/node/src/service.rs +++ b/bin/node-template/node/src/service.rs @@ -68,12 +68,7 @@ pub fn new_partial( }) .transpose()?; - let executor = NativeElseWasmExecutor::::new( - config.wasm_method, - config.default_heap_pages, - config.max_runtime_instances, - config.runtime_cache_size, - ); + let executor = sc_service::new_native_or_wasm_executor(&config); let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( diff --git a/bin/node/cli/benches/transaction_pool.rs b/bin/node/cli/benches/transaction_pool.rs index 7488ec03363e7..abee9c846245f 100644 --- a/bin/node/cli/benches/transaction_pool.rs +++ b/bin/node/cli/benches/transaction_pool.rs @@ -27,7 +27,7 @@ use sc_client_api::execution_extensions::ExecutionStrategies; use sc_service::{ config::{ BlocksPruning, DatabaseSource, KeystoreConfig, NetworkConfiguration, OffchainWorkerConfig, - PruningMode, TransactionPoolOptions, WasmExecutionMethod, + PruningMode, TransactionPoolOptions, }, BasePath, Configuration, Role, }; @@ -69,7 +69,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase { state_pruning: Some(PruningMode::ArchiveAll), blocks_pruning: BlocksPruning::KeepAll, chain_spec: spec, - wasm_method: WasmExecutionMethod::Interpreted, + wasm_method: Default::default(), // NOTE: we enforce the use of the native runtime to make the errors more debuggable execution_strategies: ExecutionStrategies { syncing: sc_client_api::ExecutionStrategy::NativeWhenPossible, diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index ca6830085b055..7b0dfcda6ff0e 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -163,12 +163,7 @@ pub fn new_partial( }) .transpose()?; - let executor = NativeElseWasmExecutor::::new( - config.wasm_method, - config.default_heap_pages, - config.max_runtime_instances, - config.runtime_cache_size, - ); + let executor = sc_service::new_native_or_wasm_executor(&config); let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( diff --git a/bin/node/executor/benches/bench.rs b/bin/node/executor/benches/bench.rs index a8c31068e853b..aa7d9eb0f31ff 100644 --- a/bin/node/executor/benches/bench.rs +++ b/bin/node/executor/benches/bench.rs @@ -26,7 +26,7 @@ use node_executor::ExecutorDispatch; use node_primitives::{BlockNumber, Hash}; use node_testing::keyring::*; use sc_executor::{ - Externalities, NativeElseWasmExecutor, RuntimeVersionOf, WasmExecutionMethod, + Externalities, NativeElseWasmExecutor, RuntimeVersionOf, WasmExecutionMethod, WasmExecutor, WasmtimeInstantiationStrategy, }; use sp_core::{ @@ -191,12 +191,13 @@ fn bench_execute_block(c: &mut Criterion) { for strategy in execution_methods { group.bench_function(format!("{:?}", strategy), |b| { let genesis_config = node_testing::genesis::config(Some(compact_code_unwrap())); - let (use_native, wasm_method) = match strategy { - ExecutionMethod::Native => (true, WasmExecutionMethod::Interpreted), - ExecutionMethod::Wasm(wasm_method) => (false, wasm_method), + let use_native = match strategy { + ExecutionMethod::Native => true, + ExecutionMethod::Wasm(..) => false, }; - let executor = NativeElseWasmExecutor::new(wasm_method, None, 8, 2); + let executor = + NativeElseWasmExecutor::new_with_wasm_executor(WasmExecutor::builder().build()); let runtime_code = RuntimeCode { code_fetcher: &sp_core::traits::WrappedRuntimeCode(compact_code_unwrap().into()), hash: vec![1, 2, 3], diff --git a/bin/node/executor/tests/common.rs b/bin/node/executor/tests/common.rs index 2f92423ffb508..6ce9ea3a01090 100644 --- a/bin/node/executor/tests/common.rs +++ b/bin/node/executor/tests/common.rs @@ -18,7 +18,7 @@ use codec::{Decode, Encode}; use frame_support::Hashable; use frame_system::offchain::AppCrypto; -use sc_executor::{error::Result, NativeElseWasmExecutor, WasmExecutionMethod}; +use sc_executor::{error::Result, NativeElseWasmExecutor, WasmExecutor}; use sp_consensus_babe::{ digests::{PreDigest, SecondaryPlainPreDigest}, Slot, BABE_ENGINE_ID, @@ -98,7 +98,7 @@ pub fn from_block_number(n: u32) -> Header { } pub fn executor() -> NativeElseWasmExecutor { - NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8, 2) + NativeElseWasmExecutor::new_with_wasm_executor(WasmExecutor::builder().build()) } pub fn executor_call( diff --git a/bin/node/inspect/src/command.rs b/bin/node/inspect/src/command.rs index 3dca979eb9e4a..9702576833ccf 100644 --- a/bin/node/inspect/src/command.rs +++ b/bin/node/inspect/src/command.rs @@ -23,41 +23,34 @@ use crate::{ Inspector, }; use sc_cli::{CliConfiguration, ImportParams, Result, SharedParams}; -use sc_executor::NativeElseWasmExecutor; -use sc_service::{new_full_client, Configuration, NativeExecutionDispatch}; +use sc_service::{Configuration, NativeExecutionDispatch}; use sp_runtime::traits::Block; use std::str::FromStr; impl InspectCmd { /// Run the inspect command, passing the inspector. - pub fn run(&self, config: Configuration) -> Result<()> + pub fn run(&self, config: Configuration) -> Result<()> where B: Block, B::Hash: FromStr, RA: Send + Sync + 'static, - EX: NativeExecutionDispatch + 'static, + D: NativeExecutionDispatch + 'static, { - let executor = NativeElseWasmExecutor::::new( - config.wasm_method, - config.default_heap_pages, - config.max_runtime_instances, - config.runtime_cache_size, - ); - - let client = new_full_client::(&config, None, executor)?; + let executor = sc_service::new_native_or_wasm_executor::(&config); + let client = sc_service::new_full_client::(&config, None, executor)?; let inspect = Inspector::::new(client); match &self.command { InspectSubCmd::Block { input } => { let input = input.parse()?; - let res = inspect.block(input).map_err(|e| format!("{}", e))?; - println!("{}", res); + let res = inspect.block(input).map_err(|e| e.to_string())?; + println!("{res}"); Ok(()) }, InspectSubCmd::Extrinsic { input } => { let input = input.parse()?; - let res = inspect.extrinsic(input).map_err(|e| format!("{}", e))?; - println!("{}", res); + let res = inspect.extrinsic(input).map_err(|e| e.to_string())?; + println!("{res}"); Ok(()) }, } diff --git a/bin/node/testing/src/bench.rs b/bin/node/testing/src/bench.rs index 392b78241d288..9dbb26a906e6f 100644 --- a/bin/node/testing/src/bench.rs +++ b/bin/node/testing/src/bench.rs @@ -392,14 +392,14 @@ impl BenchDb { let task_executor = TaskExecutor::new(); let backend = sc_service::new_db_backend(db_config).expect("Should not fail"); - let executor = NativeElseWasmExecutor::new( - WasmExecutionMethod::Compiled { - instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite, - }, - None, - 8, - 2, + let executor = NativeElseWasmExecutor::new_with_wasm_executor( + sc_executor::WasmExecutor::builder() + .with_execution_method(WasmExecutionMethod::Compiled { + instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite, + }) + .build(), ); + let client_config = sc_service::ClientConfig::default(); let genesis_block_builder = sc_service::GenesisBlockBuilder::new( &keyring.generate_genesis(), diff --git a/client/executor/benches/bench.rs b/client/executor/benches/bench.rs index f129ebf64de12..e293329e75104 100644 --- a/client/executor/benches/bench.rs +++ b/client/executor/benches/bench.rs @@ -21,7 +21,7 @@ use codec::Encode; use sc_executor_common::{ runtime_blob::RuntimeBlob, - wasm_runtime::{HeapAllocStrategy, WasmInstance, WasmModule}, + wasm_runtime::{HeapAllocStrategy, WasmInstance, WasmModule, DEFAULT_HEAP_ALLOC_STRATEGY}, }; use sc_executor_wasmtime::InstantiationStrategy; use sc_runtime_test::wasm_binary_unwrap as test_runtime; @@ -51,13 +51,12 @@ fn initialize( ) -> Arc { let blob = RuntimeBlob::uncompress_if_needed(runtime).unwrap(); let host_functions = sp_io::SubstrateHostFunctions::host_functions(); - let extra_pages = 2048; let allow_missing_func_imports = true; match method { Method::Interpreted => sc_executor_wasmi::create_runtime( blob, - HeapAllocStrategy::Static { extra_pages }, + DEFAULT_HEAP_ALLOC_STRATEGY, host_functions, allow_missing_func_imports, ) @@ -67,7 +66,7 @@ fn initialize( allow_missing_func_imports, cache_path: None, semantics: sc_executor_wasmtime::Semantics { - heap_alloc_strategy: HeapAllocStrategy::Static { extra_pages }, + heap_alloc_strategy: DEFAULT_HEAP_ALLOC_STRATEGY, instantiation_strategy, deterministic_stack_limit: None, canonicalize_nans: false, diff --git a/client/executor/common/src/wasm_runtime.rs b/client/executor/common/src/wasm_runtime.rs index e3db7e52fc7e7..5dac77e59fa74 100644 --- a/client/executor/common/src/wasm_runtime.rs +++ b/client/executor/common/src/wasm_runtime.rs @@ -23,6 +23,13 @@ use sp_wasm_interface::Value; pub use sc_allocator::AllocationStats; +/// Default heap allocation strategy. +pub const DEFAULT_HEAP_ALLOC_STRATEGY: HeapAllocStrategy = + HeapAllocStrategy::Static { extra_pages: DEFAULT_HEAP_ALLOC_PAGES }; + +/// Default heap allocation pages. +pub const DEFAULT_HEAP_ALLOC_PAGES: u32 = 2048; + /// A method to be used to find the entrypoint when calling into the runtime /// /// Contains variants on how to resolve wasm function that will be invoked. diff --git a/client/executor/src/native_executor.rs b/client/executor/src/executor.rs similarity index 94% rename from client/executor/src/native_executor.rs rename to client/executor/src/executor.rs index c72cf3c9c91df..79250ee0d621c 100644 --- a/client/executor/src/native_executor.rs +++ b/client/executor/src/executor.rs @@ -32,16 +32,14 @@ use std::{ use codec::Encode; use sc_executor_common::{ runtime_blob::RuntimeBlob, - wasm_runtime::{AllocationStats, HeapAllocStrategy, WasmInstance, WasmModule}, + wasm_runtime::{ + AllocationStats, HeapAllocStrategy, WasmInstance, WasmModule, DEFAULT_HEAP_ALLOC_STRATEGY, + }, }; use sp_core::traits::{CallContext, CodeExecutor, Externalities, RuntimeCode}; use sp_version::{GetNativeVersion, NativeVersion, RuntimeVersion}; use sp_wasm_interface::{ExtendedHostFunctions, HostFunctions}; -/// Default heap allocation strategy. -const DEFAULT_HEAP_ALLOC_STRATEGY: HeapAllocStrategy = - HeapAllocStrategy::Static { extra_pages: 2048 }; - /// Set up the externalities and safe calling environment to execute runtime calls. /// /// If the inner closure panics, it will be caught and return an error. @@ -100,10 +98,10 @@ impl WasmExecutorBuilder { /// Create a new instance of `Self` /// /// - `method`: The wasm execution method that should be used by the executor. - pub fn new(method: WasmExecutionMethod) -> Self { + pub fn new() -> Self { Self { _phantom: PhantomData, - method, + method: WasmExecutionMethod::default(), onchain_heap_alloc_strategy: None, offchain_heap_alloc_strategy: None, max_runtime_instances: 2, @@ -113,6 +111,12 @@ impl WasmExecutorBuilder { } } + /// Create the wasm executor with execution method that should be used by the executor. + pub fn with_execution_method(mut self, method: WasmExecutionMethod) -> Self { + self.method = method; + self + } + /// Create the wasm executor with the given number of `heap_alloc_strategy` for onchain runtime /// calls. pub fn with_onchain_heap_alloc_strategy( @@ -256,6 +260,7 @@ where /// compiled execution method is used. /// /// `runtime_cache_size` - The capacity of runtime cache. + #[deprecated(note = "use `Self::builder` method instead of it")] pub fn new( method: WasmExecutionMethod, default_heap_pages: Option, @@ -283,11 +288,12 @@ where } /// Instantiate a builder for creating an instance of `Self`. - pub fn builder(method: WasmExecutionMethod) -> WasmExecutorBuilder { - WasmExecutorBuilder::new(method) + pub fn builder() -> WasmExecutorBuilder { + WasmExecutorBuilder::new() } /// Ignore missing function imports if set true. + #[deprecated(note = "use `Self::builder` method instead of it")] pub fn allow_missing_host_functions(&mut self, allow_missing_host_functions: bool) { self.allow_missing_host_functions = allow_missing_host_functions } @@ -539,6 +545,7 @@ pub struct NativeElseWasmExecutor { } impl NativeElseWasmExecutor { + /// /// Create new instance. /// /// # Parameters @@ -553,19 +560,23 @@ impl NativeElseWasmExecutor { /// `max_runtime_instances` - The number of runtime instances to keep in memory ready for reuse. /// /// `runtime_cache_size` - The capacity of runtime cache. + #[deprecated(note = "use `Self::new_with_wasm_executor` method instead of it")] pub fn new( fallback_method: WasmExecutionMethod, default_heap_pages: Option, max_runtime_instances: usize, runtime_cache_size: u8, ) -> Self { - let wasm = WasmExecutor::new( - fallback_method, - default_heap_pages, - max_runtime_instances, - None, - runtime_cache_size, - ); + let heap_pages = default_heap_pages.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| { + HeapAllocStrategy::Static { extra_pages: h as _ } + }); + let wasm = WasmExecutor::builder() + .with_execution_method(fallback_method) + .with_onchain_heap_alloc_strategy(heap_pages) + .with_offchain_heap_alloc_strategy(heap_pages) + .with_max_runtime_instances(max_runtime_instances) + .with_runtime_cache_size(runtime_cache_size) + .build(); NativeElseWasmExecutor { native_version: D::native_version(), wasm } } @@ -580,6 +591,7 @@ impl NativeElseWasmExecutor { } /// Ignore missing function imports if set true. + #[deprecated(note = "use `Self::new_with_wasm_executor` method instead of it")] pub fn allow_missing_host_functions(&mut self, allow_missing_host_functions: bool) { self.wasm.allow_missing_host_functions = allow_missing_host_functions } @@ -714,11 +726,8 @@ mod tests { #[test] fn native_executor_registers_custom_interface() { - let executor = NativeElseWasmExecutor::::new( - WasmExecutionMethod::Interpreted, - None, - 8, - 2, + let executor = NativeElseWasmExecutor::::new_with_wasm_executor( + WasmExecutor::builder().build(), ); fn extract_host_functions( diff --git a/client/executor/src/integration_tests/linux.rs b/client/executor/src/integration_tests/linux.rs index 38d75da4eb7e8..434cb69bfdd32 100644 --- a/client/executor/src/integration_tests/linux.rs +++ b/client/executor/src/integration_tests/linux.rs @@ -21,7 +21,7 @@ use super::mk_test_runtime; use crate::WasmExecutionMethod; use codec::Encode as _; -use sc_executor_common::wasm_runtime::HeapAllocStrategy; +use sc_executor_common::wasm_runtime::DEFAULT_HEAP_ALLOC_STRATEGY; mod smaps; @@ -74,7 +74,7 @@ fn memory_consumption(wasm_method: WasmExecutionMethod) { // For that we make a series of runtime calls, probing the RSS for the VMA matching the linear // memory. After the call we expect RSS to be equal to 0. - let runtime = mk_test_runtime(wasm_method, HeapAllocStrategy::Static { extra_pages: 1024 }); + let runtime = mk_test_runtime(wasm_method, DEFAULT_HEAP_ALLOC_STRATEGY); let mut instance = runtime.new_instance().unwrap(); let heap_base = instance diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs index 0148968f98a38..63a642f990642 100644 --- a/client/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -24,7 +24,7 @@ use codec::{Decode, Encode}; use sc_executor_common::{ error::Error, runtime_blob::RuntimeBlob, - wasm_runtime::{HeapAllocStrategy, WasmModule}, + wasm_runtime::{HeapAllocStrategy, WasmModule, DEFAULT_HEAP_ALLOC_STRATEGY}, }; use sc_runtime_test::wasm_binary_unwrap; use sp_core::{ @@ -114,8 +114,10 @@ fn call_in_wasm( execution_method: WasmExecutionMethod, ext: &mut E, ) -> Result, Error> { - let executor = - crate::WasmExecutor::::new(execution_method, Some(1024), 8, None, 2); + let executor = crate::WasmExecutor::::builder() + .with_execution_method(execution_method) + .build(); + executor.uncached_call( RuntimeBlob::uncompress_if_needed(wasm_binary_unwrap()).unwrap(), ext, @@ -446,13 +448,11 @@ test_wasm_execution!(should_trap_when_heap_exhausted); fn should_trap_when_heap_exhausted(wasm_method: WasmExecutionMethod) { let mut ext = TestExternalities::default(); - let executor = crate::WasmExecutor::::new( - wasm_method, - Some(17), // `17` is the initial number of pages compiled into the binary. - 8, - None, - 2, - ); + let executor = crate::WasmExecutor::::builder() + .with_execution_method(wasm_method) + // `17` is the initial number of pages compiled into the binary. + .with_onchain_heap_alloc_strategy(HeapAllocStrategy::Static { extra_pages: 17 }) + .build(); let err = executor .uncached_call( @@ -560,7 +560,7 @@ fn restoration_of_globals(wasm_method: WasmExecutionMethod) { test_wasm_execution!(interpreted_only heap_is_reset_between_calls); fn heap_is_reset_between_calls(wasm_method: WasmExecutionMethod) { - let runtime = mk_test_runtime(wasm_method, HeapAllocStrategy::Static { extra_pages: 1024 }); + let runtime = mk_test_runtime(wasm_method, DEFAULT_HEAP_ALLOC_STRATEGY); let mut instance = runtime.new_instance().unwrap(); let heap_base = instance @@ -579,13 +579,11 @@ fn heap_is_reset_between_calls(wasm_method: WasmExecutionMethod) { test_wasm_execution!(parallel_execution); fn parallel_execution(wasm_method: WasmExecutionMethod) { - let executor = std::sync::Arc::new(crate::WasmExecutor::::new( - wasm_method, - Some(1024), - 8, - None, - 2, - )); + let executor = Arc::new( + crate::WasmExecutor::::builder() + .with_execution_method(wasm_method) + .build(), + ); let threads: Vec<_> = (0..8) .map(|_| { let executor = executor.clone(); diff --git a/client/executor/src/lib.rs b/client/executor/src/lib.rs index e5bae474e9e25..42e7dc7d16bd8 100644 --- a/client/executor/src/lib.rs +++ b/client/executor/src/lib.rs @@ -32,24 +32,29 @@ #![recursion_limit = "128"] #[macro_use] -mod native_executor; +mod executor; #[cfg(test)] mod integration_tests; mod wasm_runtime; -pub use codec::Codec; -pub use native_executor::{ - with_externalities_safe, NativeElseWasmExecutor, NativeExecutionDispatch, WasmExecutor, +pub use self::{ + executor::{ + with_externalities_safe, NativeElseWasmExecutor, NativeExecutionDispatch, WasmExecutor, + }, + wasm_runtime::{read_embedded_version, WasmExecutionMethod}, }; +pub use codec::Codec; #[doc(hidden)] pub use sp_core::traits::Externalities; pub use sp_version::{NativeVersion, RuntimeVersion}; #[doc(hidden)] pub use sp_wasm_interface; -pub use wasm_runtime::{read_embedded_version, WasmExecutionMethod}; pub use wasmi; -pub use sc_executor_common::error; +pub use sc_executor_common::{ + error, + wasm_runtime::{HeapAllocStrategy, DEFAULT_HEAP_ALLOC_PAGES, DEFAULT_HEAP_ALLOC_STRATEGY}, +}; pub use sc_executor_wasmtime::InstantiationStrategy as WasmtimeInstantiationStrategy; /// Extracts the runtime version of a given runtime code. @@ -74,13 +79,7 @@ mod tests { let mut ext = TestExternalities::default(); let mut ext = ext.ext(); - let executor = WasmExecutor::::new( - WasmExecutionMethod::Interpreted, - Some(8), - 8, - None, - 2, - ); + let executor = WasmExecutor::::builder().build(); let res = executor .uncached_call( RuntimeBlob::uncompress_if_needed(wasm_binary_unwrap()).unwrap(), diff --git a/client/executor/src/wasm_runtime.rs b/client/executor/src/wasm_runtime.rs index fb3dd0f38006c..351b6f377b8af 100644 --- a/client/executor/src/wasm_runtime.rs +++ b/client/executor/src/wasm_runtime.rs @@ -434,7 +434,7 @@ where // The following unwind safety assertion is OK because if the method call panics, the // runtime will be dropped. let runtime = AssertUnwindSafe(runtime.as_ref()); - crate::native_executor::with_externalities_safe(&mut **ext, move || { + crate::executor::with_externalities_safe(&mut **ext, move || { runtime.new_instance()?.call("Core_version".into(), &[]) }) .map_err(|_| WasmError::Instantiation("panic in call to get runtime version".into()))? diff --git a/client/executor/wasmtime/src/tests.rs b/client/executor/wasmtime/src/tests.rs index 0ca6095165572..e8d7c5ab1afac 100644 --- a/client/executor/wasmtime/src/tests.rs +++ b/client/executor/wasmtime/src/tests.rs @@ -20,7 +20,7 @@ use codec::{Decode as _, Encode as _}; use sc_executor_common::{ error::Error, runtime_blob::RuntimeBlob, - wasm_runtime::{HeapAllocStrategy, WasmModule}, + wasm_runtime::{HeapAllocStrategy, WasmModule, DEFAULT_HEAP_ALLOC_STRATEGY}, }; use sc_runtime_test::wasm_binary_unwrap; @@ -93,7 +93,7 @@ impl RuntimeBuilder { instantiation_strategy, canonicalize_nans: false, deterministic_stack: false, - heap_pages: HeapAllocStrategy::Static { extra_pages: 1024 }, + heap_pages: DEFAULT_HEAP_ALLOC_STRATEGY, precompile_runtime: false, tmpdir: None, } @@ -477,7 +477,7 @@ fn test_instances_without_reuse_are_not_leaked() { deterministic_stack_limit: None, canonicalize_nans: false, parallel_compilation: true, - heap_alloc_strategy: HeapAllocStrategy::Static { extra_pages: 2048 }, + heap_alloc_strategy: DEFAULT_HEAP_ALLOC_STRATEGY, wasm_multi_value: false, wasm_bulk_memory: false, wasm_reference_types: false, diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index d399b315414f8..415fa03a10020 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -36,7 +36,10 @@ use sc_client_api::{ }; use sc_client_db::{Backend, DatabaseSettings}; use sc_consensus::import_queue::ImportQueue; -use sc_executor::RuntimeVersionOf; +use sc_executor::{ + sp_wasm_interface::HostFunctions, HeapAllocStrategy, NativeElseWasmExecutor, + NativeExecutionDispatch, RuntimeVersionOf, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY, +}; use sc_keystore::LocalKeystore; use sc_network::{config::SyncMode, NetworkService, NetworkStateInfo, NetworkStatusProvider}; use sc_network_bitswap::BitswapRequestHandler; @@ -74,11 +77,10 @@ pub type TFullClient = Client, TFullCallExecutor, TBl, TRtApi>; /// Full client backend type. -pub type TFullBackend = sc_client_db::Backend; +pub type TFullBackend = Backend; /// Full client call executor type. -pub type TFullCallExecutor = - crate::client::LocalCallExecutor, TExec>; +pub type TFullCallExecutor = crate::client::LocalCallExecutor, TExec>; type TFullParts = (TFullClient, Arc>, KeystoreContainer, TaskManager); @@ -229,6 +231,27 @@ where Ok((client, backend, keystore_container, task_manager)) } +/// Creates a [`NativeElseWasmExecutor`] according to [`Configuration`]. +pub fn new_native_or_wasm_executor( + config: &Configuration, +) -> NativeElseWasmExecutor { + NativeElseWasmExecutor::new_with_wasm_executor(new_wasm_executor(config)) +} + +/// Creates a [`WasmExecutor`] according to [`Configuration`]. +pub fn new_wasm_executor(config: &Configuration) -> WasmExecutor { + let strategy = config + .default_heap_pages + .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |p| HeapAllocStrategy::Static { extra_pages: p as _ }); + WasmExecutor::::builder() + .with_execution_method(config.wasm_method) + .with_onchain_heap_alloc_strategy(strategy) + .with_offchain_heap_alloc_strategy(strategy) + .with_max_runtime_instances(config.max_runtime_instances) + .with_runtime_cache_size(config.runtime_cache_size) + .build() +} + /// Create an instance of default DB-backend backend. pub fn new_db_backend( settings: DatabaseSettings, @@ -254,7 +277,7 @@ pub fn new_client( telemetry: Option, config: ClientConfig, ) -> Result< - crate::client::Client< + Client< Backend, crate::client::LocalCallExecutor, E>, Block, @@ -277,7 +300,7 @@ where execution_extensions, )?; - crate::client::Client::new( + Client::new( backend, executor, spawn_handle, diff --git a/client/service/src/client/call_executor.rs b/client/service/src/client/call_executor.rs index ef36768febdbd..7979c139e2a6c 100644 --- a/client/service/src/client/call_executor.rs +++ b/client/service/src/client/call_executor.rs @@ -360,7 +360,7 @@ mod tests { use super::*; use backend::Backend; use sc_client_api::in_mem; - use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod}; + use sc_executor::{NativeElseWasmExecutor, WasmExecutor}; use sp_core::{ testing::TaskExecutor, traits::{FetchRuntimeCode, WrappedRuntimeCode}, @@ -368,14 +368,18 @@ mod tests { use std::collections::HashMap; use substrate_test_runtime_client::{runtime, GenesisInit, LocalExecutorDispatch}; + fn executor() -> NativeElseWasmExecutor { + NativeElseWasmExecutor::new_with_wasm_executor( + WasmExecutor::builder() + .with_max_runtime_instances(1) + .with_runtime_cache_size(2) + .build(), + ) + } + #[test] fn should_get_override_if_exists() { - let executor = NativeElseWasmExecutor::::new( - WasmExecutionMethod::Interpreted, - Some(128), - 1, - 2, - ); + let executor = executor(); let overrides = crate::client::wasm_override::dummy_overrides(); let onchain_code = WrappedRuntimeCode(substrate_test_runtime::wasm_binary_unwrap().into()); @@ -443,12 +447,7 @@ mod tests { fn returns_runtime_version_from_substitute() { const SUBSTITUTE_SPEC_NAME: &str = "substitute-spec-name-cool"; - let executor = NativeElseWasmExecutor::::new( - WasmExecutionMethod::Interpreted, - Some(128), - 1, - 2, - ); + let executor = executor(); let backend = Arc::new(in_mem::Backend::::new()); diff --git a/client/service/src/client/wasm_override.rs b/client/service/src/client/wasm_override.rs index 3a56e5c595829..725c8ab9429ac 100644 --- a/client/service/src/client/wasm_override.rs +++ b/client/service/src/client/wasm_override.rs @@ -264,21 +264,26 @@ pub fn dummy_overrides() -> WasmOverride { #[cfg(test)] mod tests { use super::*; - use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod}; + use sc_executor::{HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor}; use std::fs::{self, File}; use substrate_test_runtime_client::LocalExecutorDispatch; + fn executor() -> NativeElseWasmExecutor { + NativeElseWasmExecutor::::new_with_wasm_executor( + WasmExecutor::builder() + .with_onchain_heap_alloc_strategy(HeapAllocStrategy::Static {extra_pages: 128}) + .with_offchain_heap_alloc_strategy(HeapAllocStrategy::Static {extra_pages: 128}) + .with_max_runtime_instances(1) + .with_runtime_cache_size(2) + .build() + ) + } + fn wasm_test(fun: F) where F: Fn(&Path, &[u8], &NativeElseWasmExecutor), { - let exec = - NativeElseWasmExecutor::::new( - WasmExecutionMethod::Interpreted, - Some(128), - 1, - 2, - ); + let exec = executor(); let bytes = substrate_test_runtime::wasm_binary_unwrap(); let dir = tempfile::tempdir().expect("Create a temporary directory"); fun(dir.path(), bytes, &exec); @@ -287,12 +292,7 @@ mod tests { #[test] fn should_get_runtime_version() { - let executor = NativeElseWasmExecutor::::new( - WasmExecutionMethod::Interpreted, - Some(128), - 1, - 2, - ); + let executor = executor(); let version = WasmOverride::runtime_version( &executor, diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 54f11ec25a02a..c0c7c537c64dc 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -56,9 +56,9 @@ use sp_runtime::{ pub use self::{ builder::{ build_network, build_offchain_workers, new_client, new_db_backend, new_full_client, - new_full_parts, new_full_parts_with_genesis_builder, spawn_tasks, BuildNetworkParams, - KeystoreContainer, NetworkStarter, SpawnTasksParams, TFullBackend, TFullCallExecutor, - TFullClient, + new_full_parts, new_full_parts_with_genesis_builder, new_native_or_wasm_executor, + spawn_tasks, BuildNetworkParams, KeystoreContainer, NetworkStarter, SpawnTasksParams, + TFullBackend, TFullCallExecutor, TFullClient, }, client::{ClientConfig, LocalCallExecutor}, error::Error, diff --git a/client/service/test/src/client/mod.rs b/client/service/test/src/client/mod.rs index e6545abf1bc73..1b282a342d5e6 100644 --- a/client/service/test/src/client/mod.rs +++ b/client/service/test/src/client/mod.rs @@ -45,6 +45,7 @@ use sp_trie::{LayoutV0, TrieConfiguration}; use std::{collections::HashSet, sync::Arc}; use substrate_test_runtime::TestAPI; use substrate_test_runtime_client::{ + new_native_or_wasm_executor, prelude::*, runtime::{ genesismap::{insert_genesis_block, GenesisConfig}, @@ -58,29 +59,6 @@ mod db; const TEST_ENGINE_ID: ConsensusEngineId = *b"TEST"; -pub struct ExecutorDispatch; - -impl sc_executor::NativeExecutionDispatch for ExecutorDispatch { - type ExtendHostFunctions = (); - - fn dispatch(method: &str, data: &[u8]) -> Option> { - substrate_test_runtime_client::runtime::api::dispatch(method, data) - } - - fn native_version() -> sc_executor::NativeVersion { - substrate_test_runtime_client::runtime::native_version() - } -} - -fn executor() -> sc_executor::NativeElseWasmExecutor { - sc_executor::NativeElseWasmExecutor::new( - sc_executor::WasmExecutionMethod::Interpreted, - None, - 8, - 2, - ) -} - fn construct_block( backend: &InMemoryBackend, number: BlockNumber, @@ -108,7 +86,7 @@ fn construct_block( StateMachine::new( backend, &mut overlay, - &executor(), + &new_native_or_wasm_executor(), "Core_initialize_block", &header.encode(), Default::default(), @@ -122,7 +100,7 @@ fn construct_block( StateMachine::new( backend, &mut overlay, - &executor(), + &new_native_or_wasm_executor(), "BlockBuilder_apply_extrinsic", &tx.encode(), Default::default(), @@ -136,7 +114,7 @@ fn construct_block( let ret_data = StateMachine::new( backend, &mut overlay, - &executor(), + &new_native_or_wasm_executor(), "BlockBuilder_finalize_block", &[], Default::default(), @@ -208,7 +186,7 @@ fn construct_genesis_should_work_with_native() { let _ = StateMachine::new( &backend, &mut overlay, - &executor(), + &new_native_or_wasm_executor(), "Core_execute_block", &b1data, Default::default(), @@ -241,7 +219,7 @@ fn construct_genesis_should_work_with_wasm() { let _ = StateMachine::new( &backend, &mut overlay, - &executor(), + &new_native_or_wasm_executor(), "Core_execute_block", &b1data, Default::default(), @@ -274,7 +252,7 @@ fn construct_genesis_with_bad_transaction_should_panic() { let r = StateMachine::new( &backend, &mut overlay, - &executor(), + &new_native_or_wasm_executor(), "Core_execute_block", &b1data, Default::default(), @@ -1910,7 +1888,7 @@ fn cleans_up_closed_notification_sinks_on_block_import() { use substrate_test_runtime_client::GenesisInit; let backend = Arc::new(sc_client_api::in_mem::Backend::new()); - let executor = substrate_test_runtime_client::new_native_executor(); + let executor = new_native_or_wasm_executor(); let client_config = sc_service::ClientConfig::default(); let genesis_block_builder = sc_service::GenesisBlockBuilder::new( diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index 8a2e5050bd5d3..0f20376fe809e 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -65,9 +65,7 @@ impl Drop for TestNet { } } -pub trait TestNetNode: - Clone + Future> + Send + 'static -{ +pub trait TestNetNode: Clone + Future> + Send + 'static { type Block: BlockT; type Backend: Backend; type Executor: CallExecutor + Send + Sync; @@ -128,7 +126,7 @@ impl Clone impl Future for TestNetComponents { - type Output = Result<(), sc_service::Error>; + type Output = Result<(), Error>; fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { Pin::new(&mut self.task_manager.lock().future()).poll(cx) @@ -248,7 +246,7 @@ fn node_config< state_pruning: Default::default(), blocks_pruning: BlocksPruning::KeepFinalized, chain_spec: Box::new((*spec).clone()), - wasm_method: sc_service::config::WasmExecutionMethod::Interpreted, + wasm_method: Default::default(), wasm_runtime_overrides: Default::default(), execution_strategies: Default::default(), rpc_http: None, diff --git a/frame/system/src/tests.rs b/frame/system/src/tests.rs index fc388800e13b4..19b8d6a487ab5 100644 --- a/frame/system/src/tests.rs +++ b/frame/system/src/tests.rs @@ -589,7 +589,7 @@ fn assert_runtime_updated_digest(num: usize) { #[test] fn set_code_with_real_wasm_blob() { - let executor = substrate_test_runtime_client::new_native_executor(); + let executor = substrate_test_runtime_client::new_native_or_wasm_executor(); let mut ext = new_test_ext(); ext.register_extension(sp_core::traits::ReadRuntimeVersionExt::new(executor)); ext.execute_with(|| { @@ -613,7 +613,7 @@ fn set_code_with_real_wasm_blob() { #[test] fn runtime_upgraded_with_set_storage() { - let executor = substrate_test_runtime_client::new_native_executor(); + let executor = substrate_test_runtime_client::new_native_or_wasm_executor(); let mut ext = new_test_ext(); ext.register_extension(sp_core::traits::ReadRuntimeVersionExt::new(executor)); ext.execute_with(|| { diff --git a/primitives/api/test/tests/runtime_calls.rs b/primitives/api/test/tests/runtime_calls.rs index b57793aad1253..956a6a25f1558 100644 --- a/primitives/api/test/tests/runtime_calls.rs +++ b/primitives/api/test/tests/runtime_calls.rs @@ -29,6 +29,7 @@ use substrate_test_runtime_client::{ use codec::Encode; use sc_block_builder::BlockBuilderProvider; use sp_consensus::SelectChain; +use substrate_test_runtime_client::sc_executor::WasmExecutor; fn calling_function_with_strat(strat: ExecutionStrategy) { let client = TestClientBuilder::new().set_execution_strategy(strat).build(); @@ -178,11 +179,8 @@ fn record_proof_works() { // Use the proof backend to execute `execute_block`. let mut overlay = Default::default(); - let executor = NativeElseWasmExecutor::::new( - WasmExecutionMethod::Interpreted, - None, - 8, - 2, + let executor = NativeElseWasmExecutor::::new_with_wasm_executor( + WasmExecutor::builder().build(), ); execution_proof_check_on_trie_backend( &backend, diff --git a/primitives/runtime-interface/test/src/lib.rs b/primitives/runtime-interface/test/src/lib.rs index 269b62333bd26..e1be3b5d99d9b 100644 --- a/primitives/runtime-interface/test/src/lib.rs +++ b/primitives/runtime-interface/test/src/lib.rs @@ -42,7 +42,8 @@ fn call_wasm_method_with_result( let executor = sc_executor::WasmExecutor::< ExtendedHostFunctions, - >::new(sc_executor::WasmExecutionMethod::Interpreted, Some(8), 8, None, 2); + >::builder() + .build(); let (result, allocation_stats) = executor.uncached_call_with_allocation_stats( RuntimeBlob::uncompress_if_needed(binary).expect("Failed to parse binary"), diff --git a/test-utils/client/src/lib.rs b/test-utils/client/src/lib.rs index c4572061c48af..fc9ba1c9e0dd9 100644 --- a/test-utils/client/src/lib.rs +++ b/test-utils/client/src/lib.rs @@ -27,7 +27,7 @@ pub use sc_client_api::{ BadBlocks, ForkBlocks, }; pub use sc_client_db::{self, Backend, BlocksPruning}; -pub use sc_executor::{self, NativeElseWasmExecutor, WasmExecutionMethod}; +pub use sc_executor::{self, NativeElseWasmExecutor, WasmExecutionMethod, WasmExecutor}; pub use sc_service::{client, RpcHandlers}; pub use sp_consensus; pub use sp_keyring::{ @@ -286,7 +286,7 @@ impl Backend: sc_client_api::backend::Backend + 'static, { let executor = executor.into().unwrap_or_else(|| { - NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8, 2) + NativeElseWasmExecutor::new_with_wasm_executor(WasmExecutor::builder().build()) }); let executor = LocalCallExecutor::new( self.backend.clone(), diff --git a/test-utils/runtime/client/src/lib.rs b/test-utils/runtime/client/src/lib.rs index 099aeab11f768..5e4b5d6a12dd9 100644 --- a/test-utils/runtime/client/src/lib.rs +++ b/test-utils/runtime/client/src/lib.rs @@ -38,6 +38,7 @@ use sp_core::{ Pair, }; use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT}; +use substrate_test_client::sc_executor::WasmExecutor; use substrate_test_runtime::genesismap::{additional_storage_with_genesis, GenesisConfig}; /// A prelude to import in tests. @@ -171,7 +172,7 @@ pub type Client = client::Client< client::LocalCallExecutor< substrate_test_runtime::Block, B, - sc_executor::NativeElseWasmExecutor, + NativeElseWasmExecutor, >, substrate_test_runtime::Block, substrate_test_runtime::RuntimeApi, @@ -290,6 +291,6 @@ pub fn new() -> Client { } /// Create a new native executor. -pub fn new_native_executor() -> NativeElseWasmExecutor { - NativeElseWasmExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8, 2) +pub fn new_native_or_wasm_executor() -> NativeElseWasmExecutor { + NativeElseWasmExecutor::new_with_wasm_executor(WasmExecutor::builder().build()) } diff --git a/test-utils/runtime/src/system.rs b/test-utils/runtime/src/system.rs index fc750531529b6..caabad336c069 100644 --- a/test-utils/runtime/src/system.rs +++ b/test-utils/runtime/src/system.rs @@ -376,7 +376,7 @@ mod tests { use super::*; use crate::{wasm_binary_unwrap, Header, Transfer}; - use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod}; + use sc_executor::{NativeElseWasmExecutor, WasmExecutor}; use sp_core::{ map, traits::{CallContext, CodeExecutor, RuntimeCode}, @@ -400,7 +400,7 @@ mod tests { } fn executor() -> NativeElseWasmExecutor { - NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8, 2) + NativeElseWasmExecutor::new_with_wasm_executor(WasmExecutor::builder().build()) } fn new_test_ext() -> TestExternalities { diff --git a/utils/frame/benchmarking-cli/src/pallet/command.rs b/utils/frame/benchmarking-cli/src/pallet/command.rs index 4d583950d7b3e..0c3b6b3e8f45c 100644 --- a/utils/frame/benchmarking-cli/src/pallet/command.rs +++ b/utils/frame/benchmarking-cli/src/pallet/command.rs @@ -27,7 +27,7 @@ use sc_cli::{ execution_method_from_cli, CliConfiguration, ExecutionStrategy, Result, SharedParams, }; use sc_client_db::BenchmarkingState; -use sc_executor::NativeElseWasmExecutor; +use sc_executor::{NativeElseWasmExecutor, WasmExecutor}; use sc_service::{Configuration, NativeExecutionDispatch}; use serde::Serialize; use sp_core::{ @@ -209,11 +209,16 @@ impl PalletCmd { // Do not enable storage tracking false, )?; - let executor = NativeElseWasmExecutor::::new( - execution_method_from_cli(self.wasm_method, self.wasmtime_instantiation_strategy), - self.heap_pages, - 2, // The runtime instances cache size. - 2, // The runtime cache size + + let method = + execution_method_from_cli(self.wasm_method, self.wasmtime_instantiation_strategy); + + let executor = NativeElseWasmExecutor::::new_with_wasm_executor( + WasmExecutor::builder() + .with_execution_method(method) + .with_max_runtime_instances(2) + .with_runtime_cache_size(2) + .build(), ); let extensions = || -> Extensions { diff --git a/utils/frame/try-runtime/cli/src/lib.rs b/utils/frame/try-runtime/cli/src/lib.rs index db690e5086a6c..cd6c48f52f45e 100644 --- a/utils/frame/try-runtime/cli/src/lib.rs +++ b/utils/frame/try-runtime/cli/src/lib.rs @@ -368,7 +368,9 @@ use sc_cli::{ WasmtimeInstantiationStrategy, DEFAULT_WASMTIME_INSTANTIATION_STRATEGY, DEFAULT_WASM_EXECUTION_METHOD, }; -use sc_executor::{sp_wasm_interface::HostFunctions, WasmExecutor}; +use sc_executor::{ + sp_wasm_interface::HostFunctions, HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY, +}; use sp_api::HashT; use sp_core::{ hexdisplay::HexDisplay, @@ -824,18 +826,20 @@ pub(crate) fn full_extensions(wasm_executor: WasmExecutor) extensions } +/// Build wasm executor by default config. pub(crate) fn build_executor(shared: &SharedParams) -> WasmExecutor { - let heap_pages = shared.heap_pages.or(Some(2048)); - let max_runtime_instances = 8; - let runtime_cache_size = 2; - - WasmExecutor::new( - execution_method_from_cli(shared.wasm_method, shared.wasmtime_instantiation_strategy), - heap_pages, - max_runtime_instances, - None, - runtime_cache_size, - ) + let heap_pages = shared + .heap_pages + .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |p| HeapAllocStrategy::Static { extra_pages: p as _ }); + + WasmExecutor::builder() + .with_execution_method(execution_method_from_cli( + shared.wasm_method, + shared.wasmtime_instantiation_strategy, + )) + .with_onchain_heap_alloc_strategy(heap_pages) + .with_offchain_heap_alloc_strategy(heap_pages) + .build() } /// Ensure that the given `ext` is compiled with `try-runtime` From 7363dce0375fd628b6bcea6e41256a0561a4a73f Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 11 Apr 2023 07:25:12 +1000 Subject: [PATCH 05/93] remove unused import (#13868) --- client/executor/benches/bench.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/executor/benches/bench.rs b/client/executor/benches/bench.rs index e293329e75104..6cce05f6c75f4 100644 --- a/client/executor/benches/bench.rs +++ b/client/executor/benches/bench.rs @@ -21,7 +21,7 @@ use codec::Encode; use sc_executor_common::{ runtime_blob::RuntimeBlob, - wasm_runtime::{HeapAllocStrategy, WasmInstance, WasmModule, DEFAULT_HEAP_ALLOC_STRATEGY}, + wasm_runtime::{WasmInstance, WasmModule, DEFAULT_HEAP_ALLOC_STRATEGY}, }; use sc_executor_wasmtime::InstantiationStrategy; use sc_runtime_test::wasm_binary_unwrap as test_runtime; From 2b61b1d22d78694bdc83d2b6cb0b3b749a0e668a Mon Sep 17 00:00:00 2001 From: yjh Date: Tue, 11 Apr 2023 18:42:49 +0800 Subject: [PATCH 06/93] chore: remove duplicated arc (#13871) --- client/executor/benches/bench.rs | 6 +++--- client/executor/src/executor.rs | 2 +- client/executor/src/integration_tests/mod.rs | 2 +- client/executor/src/wasm_runtime.rs | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/executor/benches/bench.rs b/client/executor/benches/bench.rs index 6cce05f6c75f4..772898b8c76b3 100644 --- a/client/executor/benches/bench.rs +++ b/client/executor/benches/bench.rs @@ -48,7 +48,7 @@ fn initialize( _tmpdir: &mut Option, runtime: &[u8], method: Method, -) -> Arc { +) -> Box { let blob = RuntimeBlob::uncompress_if_needed(runtime).unwrap(); let host_functions = sp_io::SubstrateHostFunctions::host_functions(); let allow_missing_func_imports = true; @@ -60,7 +60,7 @@ fn initialize( host_functions, allow_missing_func_imports, ) - .map(|runtime| -> Arc { Arc::new(runtime) }), + .map(|runtime| -> Box { Box::new(runtime) }), Method::Compiled { instantiation_strategy, precompile } => { let config = sc_executor_wasmtime::Config { allow_missing_func_imports, @@ -98,7 +98,7 @@ fn initialize( } else { sc_executor_wasmtime::create_runtime::(blob, config) } - .map(|runtime| -> Arc { Arc::new(runtime) }) + .map(|runtime| -> Box { Box::new(runtime) }) }, } .unwrap() diff --git a/client/executor/src/executor.rs b/client/executor/src/executor.rs index 79250ee0d621c..a3717f4d29002 100644 --- a/client/executor/src/executor.rs +++ b/client/executor/src/executor.rs @@ -320,7 +320,7 @@ where ) -> Result where F: FnOnce( - AssertUnwindSafe<&Arc>, + AssertUnwindSafe<&dyn WasmModule>, AssertUnwindSafe<&mut dyn WasmInstance>, Option<&RuntimeVersion>, AssertUnwindSafe<&mut dyn Externalities>, diff --git a/client/executor/src/integration_tests/mod.rs b/client/executor/src/integration_tests/mod.rs index 63a642f990642..b65aeb8d01109 100644 --- a/client/executor/src/integration_tests/mod.rs +++ b/client/executor/src/integration_tests/mod.rs @@ -483,7 +483,7 @@ fn should_trap_when_heap_exhausted(wasm_method: WasmExecutionMethod) { fn mk_test_runtime( wasm_method: WasmExecutionMethod, pages: HeapAllocStrategy, -) -> Arc { +) -> Box { let blob = RuntimeBlob::uncompress_if_needed(wasm_binary_unwrap()) .expect("failed to create a runtime blob out of test runtime"); diff --git a/client/executor/src/wasm_runtime.rs b/client/executor/src/wasm_runtime.rs index 351b6f377b8af..41a095081f8d1 100644 --- a/client/executor/src/wasm_runtime.rs +++ b/client/executor/src/wasm_runtime.rs @@ -71,14 +71,14 @@ struct VersionedRuntimeId { /// A Wasm runtime object along with its cached runtime version. struct VersionedRuntime { /// Shared runtime that can spawn instances. - module: Arc, + module: Box, /// Runtime version according to `Core_version` if any. version: Option, // TODO: Remove this once the legacy instance reuse instantiation strategy // for `wasmtime` is gone, as this only makes sense with that particular strategy. /// Cached instance pool. - instances: Arc>>>>, + instances: Vec>>>, } impl VersionedRuntime { @@ -86,7 +86,7 @@ impl VersionedRuntime { fn with_instance(&self, ext: &mut dyn Externalities, f: F) -> Result where F: FnOnce( - &Arc, + &dyn WasmModule, &mut dyn WasmInstance, Option<&RuntimeVersion>, &mut dyn Externalities, @@ -106,7 +106,7 @@ impl VersionedRuntime { .map(|r| Ok((r, false))) .unwrap_or_else(|| self.module.new_instance().map(|i| (i, true)))?; - let result = f(&self.module, &mut *instance, self.version.as_ref(), ext); + let result = f(&*self.module, &mut *instance, self.version.as_ref(), ext); if let Err(e) = &result { if new_inst { tracing::warn!( @@ -142,7 +142,7 @@ impl VersionedRuntime { // Allocate a new instance let mut instance = self.module.new_instance()?; - f(&self.module, &mut *instance, self.version.as_ref(), ext) + f(&*self.module, &mut *instance, self.version.as_ref(), ext) }, } } @@ -228,7 +228,7 @@ impl RuntimeCache { where H: HostFunctions, F: FnOnce( - &Arc, + &dyn WasmModule, &mut dyn WasmInstance, Option<&RuntimeVersion>, &mut dyn Externalities, @@ -294,7 +294,7 @@ pub fn create_wasm_runtime_with_code( blob: RuntimeBlob, allow_missing_func_imports: bool, cache_path: Option<&Path>, -) -> Result, WasmError> +) -> Result, WasmError> where H: HostFunctions, { @@ -312,7 +312,7 @@ where H::host_functions(), allow_missing_func_imports, ) - .map(|runtime| -> Arc { Arc::new(runtime) }) + .map(|runtime| -> Box { Box::new(runtime) }) }, WasmExecutionMethod::Compiled { instantiation_strategy } => sc_executor_wasmtime::create_runtime::( @@ -333,7 +333,7 @@ where }, }, ) - .map(|runtime| -> Arc { Arc::new(runtime) }), + .map(|runtime| -> Box { Box::new(runtime) }), } } @@ -448,7 +448,7 @@ where let mut instances = Vec::with_capacity(max_instances); instances.resize_with(max_instances, || Mutex::new(None)); - Ok(VersionedRuntime { module: runtime, version, instances: Arc::new(instances) }) + Ok(VersionedRuntime { module: runtime, version, instances }) } #[cfg(test)] From 932f820625b37913f901c6d25c40fe542bbeb6b5 Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Tue, 11 Apr 2023 12:57:14 +0200 Subject: [PATCH 07/93] simplify some pattern matches to appease 1.68 clippy (#13833) --- .../grandpa/src/communication/mod.rs | 4 +-- client/network/common/src/sync.rs | 4 +-- .../src/protocol/notifications/behaviour.rs | 27 +++++++------------ client/network/sync/src/blocks.rs | 2 +- client/network/transactions/src/lib.rs | 2 +- client/service/test/src/lib.rs | 5 +--- .../election-provider-multi-phase/src/lib.rs | 8 +++--- frame/offences/src/lib.rs | 2 +- frame/session/src/lib.rs | 2 +- frame/staking/src/pallet/impls.rs | 4 +-- 10 files changed, 23 insertions(+), 37 deletions(-) diff --git a/client/consensus/grandpa/src/communication/mod.rs b/client/consensus/grandpa/src/communication/mod.rs index 81365c20b1ebe..9d90035d71cbb 100644 --- a/client/consensus/grandpa/src/communication/mod.rs +++ b/client/consensus/grandpa/src/communication/mod.rs @@ -852,9 +852,7 @@ fn check_compact_commit( // check signatures on all contained precommits. let mut buf = Vec::new(); - for (i, (precommit, &(ref sig, ref id))) in - msg.precommits.iter().zip(&msg.auth_data).enumerate() - { + for (i, (precommit, (sig, id))) in msg.precommits.iter().zip(&msg.auth_data).enumerate() { use crate::communication::gossip::Misbehavior; use finality_grandpa::Message as GrandpaMessage; diff --git a/client/network/common/src/sync.rs b/client/network/common/src/sync.rs index d02a81379aea0..b01091ae01641 100644 --- a/client/network/common/src/sync.rs +++ b/client/network/common/src/sync.rs @@ -424,9 +424,9 @@ pub trait ChainSync: Send { /// /// If [`PollBlockAnnounceValidation::ImportHeader`] is returned, then the caller MUST try to /// import passed header (call `on_block_data`). The network request isn't sent in this case. - fn poll_block_announce_validation<'a>( + fn poll_block_announce_validation( &mut self, - cx: &mut std::task::Context<'a>, + cx: &mut std::task::Context<'_>, ) -> Poll>; /// Call when a peer has disconnected. diff --git a/client/network/src/protocol/notifications/behaviour.rs b/client/network/src/protocol/notifications/behaviour.rs index 74e27fa17c602..9e93389389d29 100644 --- a/client/network/src/protocol/notifications/behaviour.rs +++ b/client/network/src/protocol/notifications/behaviour.rs @@ -2628,8 +2628,7 @@ mod tests { conn, NotifsHandlerOut::OpenDesiredByRemote { protocol_index: 0 }, ); - if let Some(&PeerState::Incoming { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Incoming { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections.len(), 1); assert_eq!(connections[0], (conn, ConnectionState::OpenDesiredByRemote)); } else { @@ -2647,8 +2646,7 @@ mod tests { }, )); - if let Some(&PeerState::Incoming { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Incoming { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections.len(), 2); assert_eq!(connections[0], (conn, ConnectionState::OpenDesiredByRemote)); assert_eq!(connections[1], (conn2, ConnectionState::Closed)); @@ -2797,8 +2795,7 @@ mod tests { }, )); - if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections.len(), 1); assert_eq!(connections[0], (conn1, ConnectionState::Closed)); } else { @@ -2884,8 +2881,7 @@ mod tests { )); } - if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections[0], (conn1, ConnectionState::Closed)); assert_eq!(connections[1], (conn2, ConnectionState::Closed)); } else { @@ -2900,8 +2896,7 @@ mod tests { NotifsHandlerOut::OpenDesiredByRemote { protocol_index: 0 }, ); - if let Some(&PeerState::Enabled { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Enabled { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections[0], (conn1, ConnectionState::Opening)); assert_eq!(connections[1], (conn2, ConnectionState::Opening)); } else { @@ -3297,8 +3292,7 @@ mod tests { )); } - if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections[0], (conn1, ConnectionState::Closed)); assert_eq!(connections[1], (conn2, ConnectionState::Closed)); } else { @@ -3356,8 +3350,7 @@ mod tests { )); } - if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections[0], (conn1, ConnectionState::Closed)); assert_eq!(connections[1], (conn2, ConnectionState::Closed)); } else { @@ -3413,8 +3406,7 @@ mod tests { )); } - if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections[0], (conn1, ConnectionState::Closed)); assert_eq!(connections[1], (conn2, ConnectionState::Closed)); } else { @@ -3424,8 +3416,7 @@ mod tests { // open substreams on both active connections notif.peerset_report_connect(peer, set_id); - if let Some(&PeerState::Enabled { ref connections, .. }) = notif.peers.get(&(peer, set_id)) - { + if let Some(PeerState::Enabled { connections, .. }) = notif.peers.get(&(peer, set_id)) { assert_eq!(connections[0], (conn1, ConnectionState::Opening)); assert_eq!(connections[1], (conn2, ConnectionState::Closed)); } else { diff --git a/client/network/sync/src/blocks.rs b/client/network/sync/src/blocks.rs index 3c76238be1b5f..240c1ca1f8b26 100644 --- a/client/network/sync/src/blocks.rs +++ b/client/network/sync/src/blocks.rs @@ -89,7 +89,7 @@ impl BlockCollection { Some(&BlockRangeState::Downloading { .. }) => { trace!(target: "sync", "Inserting block data still marked as being downloaded: {}", start); }, - Some(&BlockRangeState::Complete(ref existing)) if existing.len() >= blocks.len() => { + Some(BlockRangeState::Complete(existing)) if existing.len() >= blocks.len() => { trace!(target: "sync", "Ignored block data already downloaded: {}", start); return }, diff --git a/client/network/transactions/src/lib.rs b/client/network/transactions/src/lib.rs index 381dd654b600b..f57556d3986b0 100644 --- a/client/network/transactions/src/lib.rs +++ b/client/network/transactions/src/lib.rs @@ -473,7 +473,7 @@ where let (hashes, to_send): (Vec<_>, Vec<_>) = transactions .iter() - .filter(|&(ref hash, _)| peer.known_transactions.insert(hash.clone())) + .filter(|(hash, _)| peer.known_transactions.insert(hash.clone())) .cloned() .unzip(); diff --git a/client/service/test/src/lib.rs b/client/service/test/src/lib.rs index 0f20376fe809e..29e68261a1025 100644 --- a/client/service/test/src/lib.rs +++ b/client/service/test/src/lib.rs @@ -182,10 +182,7 @@ where loop { interval.tick().await; - if full_nodes - .iter() - .all(|&(ref id, ref service, _, _)| full_predicate(*id, service)) - { + if full_nodes.iter().all(|(id, service, _, _)| full_predicate(*id, service)) { break } } diff --git a/frame/election-provider-multi-phase/src/lib.rs b/frame/election-provider-multi-phase/src/lib.rs index 80bab68074c87..3599037104d18 100644 --- a/frame/election-provider-multi-phase/src/lib.rs +++ b/frame/election-provider-multi-phase/src/lib.rs @@ -502,10 +502,10 @@ where fn eq(&self, other: &Self) -> bool { use ElectionError::*; match (self, other) { - (&Feasibility(ref x), &Feasibility(ref y)) if x == y => true, - (&Miner(ref x), &Miner(ref y)) if x == y => true, - (&DataProvider(ref x), &DataProvider(ref y)) if x == y => true, - (&Fallback(ref x), &Fallback(ref y)) if x == y => true, + (Feasibility(x), Feasibility(y)) if x == y => true, + (Miner(x), Miner(y)) if x == y => true, + (DataProvider(x), DataProvider(y)) if x == y => true, + (Fallback(x), Fallback(y)) if x == y => true, _ => false, } } diff --git a/frame/offences/src/lib.rs b/frame/offences/src/lib.rs index c89d93c12bd95..96c7c119c2038 100644 --- a/frame/offences/src/lib.rs +++ b/frame/offences/src/lib.rs @@ -247,7 +247,7 @@ impl> ReportIndexStorage { fn insert(&mut self, time_slot: &O::TimeSlot, report_id: ReportIdOf) { // Insert the report id into the list while maintaining the ordering by the time // slot. - let pos = self.same_kind_reports.partition_point(|&(ref when, _)| when <= time_slot); + let pos = self.same_kind_reports.partition_point(|(when, _)| when <= time_slot); self.same_kind_reports.insert(pos, (time_slot.clone(), report_id)); // Update the list of concurrent reports. diff --git a/frame/session/src/lib.rs b/frame/session/src/lib.rs index ed5f80e6099c1..a9f89412a71c4 100644 --- a/frame/session/src/lib.rs +++ b/frame/session/src/lib.rs @@ -678,7 +678,7 @@ impl Pallet { // since a new validator set always leads to `changed` starting // as true, we can ensure that `now_session_keys` and `next_validators` // have the same length. this function is called once per iteration. - if let Some(&(_, ref old_keys)) = now_session_keys.next() { + if let Some((_, old_keys)) = now_session_keys.next() { if old_keys != keys { changed = true; } diff --git a/frame/staking/src/pallet/impls.rs b/frame/staking/src/pallet/impls.rs index 760345e8ddb28..d5072476fb37e 100644 --- a/frame/staking/src/pallet/impls.rs +++ b/frame/staking/src/pallet/impls.rs @@ -1299,8 +1299,8 @@ where add_db_reads_writes(1, 0); // Reverse because it's more likely to find reports from recent eras. - match eras.iter().rev().find(|&&(_, ref sesh)| sesh <= &slash_session) { - Some(&(ref slash_era, _)) => *slash_era, + match eras.iter().rev().find(|&(_, sesh)| sesh <= &slash_session) { + Some((slash_era, _)) => *slash_era, // Before bonding period. defensive - should be filtered out. None => return consumed_weight, } From 416b0f50bba519146ec7ea45a67980b45cd658e7 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:07:52 +0300 Subject: [PATCH 08/93] Metadata V15: Add Runtime API metadata (#13302) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * impl_runtime_apis: Generate getters for `metadata_at` functions Signed-off-by: Alexandru Vasile * runtime: Implement new `Metadata` runtime trait Signed-off-by: Alexandru Vasile * runtime: Move `metadata_at` functions to construct_runtime macro Signed-off-by: Alexandru Vasile * contruct_runtime: Use `OpaqueMetadata` from hidden imports Signed-off-by: Alexandru Vasile * Adjust testing Signed-off-by: Alexandru Vasile * frame/tests: Add tests for the new API Signed-off-by: Alexandru Vasile * primitives/proc-macro: Helper to extract documentation literals Signed-off-by: Alexandru Vasile * primitives/proc-macro: Helper to filter all `cfg` attributes Signed-off-by: Alexandru Vasile * primitives/proc-macro: Generate documentation getters for metadata Signed-off-by: Alexandru Vasile * primitives/proc-macro: Avoid trait collision with snake case methods Signed-off-by: Alexandru Vasile * proc-macro/tests: Check doc getters Signed-off-by: Alexandru Vasile * primitives/proc-macro: Generate metadata for runtime methods Signed-off-by: Alexandru Vasile * primitives/api: Export scale-info and frame-metadata Signed-off-by: Alexandru Vasile * primitives/proc-macro: Generate metadata for runtime traits Signed-off-by: Alexandru Vasile * frame/runtime: Expose metadata v15 internally Signed-off-by: Alexandru Vasile * test: Use metadata v15 from `lexnv/md_v15_test` branch Signed-off-by: Alexandru Vasile * primitives/proc-macro: Generate crate access one module up Signed-off-by: Alexandru Vasile * frame: Implement `runtime_metadata` for mocks and tests Signed-off-by: Alexandru Vasile * primitives/proc-macro: Fix warnings Signed-off-by: Alexandru Vasile * primitives/proc-macro: Add no-docs flag Signed-off-by: Alexandru Vasile * frame: Adjust more tests Signed-off-by: Alexandru Vasile * frame/tests: Check runtime metadata correctness Signed-off-by: Alexandru Vasile * frame/benchmarking: Adjust benchmarks Signed-off-by: Alexandru Vasile * frame/benchmarks: Adjust more benchmarks Signed-off-by: Alexandru Vasile * primitives/api: Fix clippy Signed-off-by: Alexandru Vasile * primitives/proc-macro: Generate runtime metadata on the `decl_runtime_apis` Signed-off-by: Alexandru Vasile * frame: Abuse Deref to resolve `runtime_metadata` Signed-off-by: Alexandru Vasile * Revert "frame: Implement `runtime_metadata` for mocks and tests" This reverts commit e4782de008148d1f9b2758e9a919314c0a62ed9a. Revert "frame: Adjust more tests" This reverts commit de1352c8c9af14f8f45218d500885567ea0cc84f. Revert "frame/benchmarking: Adjust benchmarks" This reverts commit ae85bbeca3ea1a4dc0ab12958fa903f8c07ba53e. Signed-off-by: Alexandru Vasile Revert "frame/benchmarks: Adjust more benchmarks" This reverts commit d37aa2205e80cceaa04e7f2971bb542d4ce8a6db. * primitives/proc-macro: Remove unused imports and function Signed-off-by: Alexandru Vasile * frame/support: Adjust runtime metadata test Signed-off-by: Alexandru Vasile * primitives/tests: Remove doc getter test Signed-off-by: Alexandru Vasile * frame/support: Enable `no-metadata-docs` feature from `sp-api` Signed-off-by: Alexandru Vasile * primitives/tests: Add `TypeInfo` for test::extrinsic Signed-off-by: Alexandru Vasile * primitives/api: Expose scale-info and frame-metadata Signed-off-by: Alexandru Vasile * Update frame-metadata to include v15 Signed-off-by: Alexandru Vasile * Fix merge conflicts Signed-off-by: Alexandru Vasile * frame/metadata_ir: Add IR for runtime API metadata Signed-off-by: Alexandru Vasile * frame/metadata_ir: Convert IR to V15 Signed-off-by: Alexandru Vasile * primitives/api: Collect IR metadata for runtime API Signed-off-by: Alexandru Vasile * primitives/api: Move `metadata_ir` from frame/support Signed-off-by: Alexandru Vasile * frame/tests: Adjust testing Signed-off-by: Alexandru Vasile * frame/tests: Adjust `metadata_versions` test Signed-off-by: Alexandru Vasile * primitives/runtime_metadata: Exclude default type parameters from methods Signed-off-by: Alexandru Vasile * Update primitives/api/proc-macro/src/runtime_metadata.rs Co-authored-by: Bastian Köcher * Update primitives/api/src/metadata_ir/types.rs Co-authored-by: Bastian Köcher * Update primitives/api/src/metadata_ir/mod.rs Co-authored-by: Bastian Köcher * Update primitives/api/proc-macro/src/utils.rs Co-authored-by: Bastian Köcher * Update primitives/api/proc-macro/src/runtime_metadata.rs Co-authored-by: Bastian Köcher * Update primitives/api/proc-macro/src/runtime_metadata.rs Co-authored-by: Bastian Köcher * Update primitives/api/proc-macro/src/runtime_metadata.rs Co-authored-by: Bastian Köcher * Update primitives/api/proc-macro/src/runtime_metadata.rs Co-authored-by: Bastian Köcher * Update primitives/api/proc-macro/src/runtime_metadata.rs Co-authored-by: Bastian Köcher * Update primitives/api/proc-macro/src/runtime_metadata.rs Co-authored-by: Bastian Köcher * primitives: Fix build Signed-off-by: Alexandru Vasile * primitives/metadata-ir: Move IR to dedicated crate Signed-off-by: Alexandru Vasile * primitives: Reexport metadata-ir and frame-metadata Signed-off-by: Alexandru Vasile * frame: Use apis field instead of runtime Signed-off-by: Alexandru Vasile * Better documentation for the `Deref` abstraction Signed-off-by: Alexandru Vasile * ui-tests: Check empty `impl_runtime_apis` Signed-off-by: Alexandru Vasile * primitives: Remove unneeded bounds on generic params Signed-off-by: Alexandru Vasile * primitives: Rename `collect_where_bounds` to `get_argument_type_param` Signed-off-by: Alexandru Vasile * primitives: Generate crate access per fn call Signed-off-by: Alexandru Vasile * Revert "primitives: Remove unneeded bounds on generic params" This reverts commit 5178e38cf21cfb481156eefd628d62989201d59a. * metadata-ir: Add no-std Signed-off-by: Alexandru Vasile * primitives: Adjust where bounds Signed-off-by: Alexandru Vasile * Change `frame-metadata` branch to "origin/main" Signed-off-by: Alexandru Vasile * Update to `main` from origin Signed-off-by: Alexandru Vasile * Update frame-metadata to crates.io v15.1 Signed-off-by: Alexandru Vasile * Revert "ui-tests: Check empty `impl_runtime_apis`" This reverts commit cf78a7190ad9cba3c3bb2e78dc3d0dc382b2fea9. * Move ui test to primitives/ui Signed-off-by: Alexandru Vasile * Update frame/support/test/tests/runtime_metadata.rs Co-authored-by: Bastian Köcher * Update primitives/api/proc-macro/src/runtime_metadata.rs Co-authored-by: Bastian Köcher * Test already covered by `empty_impl_runtime_apis_call.stderr` This reverts commit 3bafb294cbe9745569bf5e5a1a2e6b4a4c1aadc5. * Retriger CI Signed-off-by: Alexandru Vasile * Import `TokenStream` as `TokenStream2` Signed-off-by: Alexandru Vasile --------- Signed-off-by: Alexandru Vasile Co-authored-by: parity-processbot <> Co-authored-by: Bastian Köcher --- Cargo.lock | 19 +- Cargo.toml | 1 + frame/support/Cargo.toml | 4 +- .../src/construct_runtime/expand/metadata.rs | 21 +- .../procedural/src/construct_runtime/mod.rs | 25 ++ frame/support/src/lib.rs | 2 +- frame/support/test/Cargo.toml | 2 + frame/support/test/tests/pallet.rs | 2 +- frame/support/test/tests/runtime_metadata.rs | 222 ++++++++++++++ primitives/api/Cargo.toml | 7 +- primitives/api/proc-macro/Cargo.toml | 3 + .../api/proc-macro/src/decl_runtime_apis.rs | 25 +- .../api/proc-macro/src/impl_runtime_apis.rs | 19 +- primitives/api/proc-macro/src/lib.rs | 1 + .../api/proc-macro/src/runtime_metadata.rs | 271 ++++++++++++++++++ primitives/api/proc-macro/src/utils.rs | 69 ++++- primitives/api/src/lib.rs | 6 +- primitives/consensus/beefy/src/lib.rs | 2 +- primitives/metadata-ir/Cargo.toml | 28 ++ .../metadata-ir/src/lib.rs | 32 ++- .../metadata-ir/src}/types.rs | 71 +++++ .../metadata-ir/src}/v14.rs | 0 primitives/metadata-ir/src/v15.rs | 188 ++++++++++++ primitives/test-primitives/Cargo.toml | 2 + primitives/test-primitives/src/lib.rs | 2 +- 25 files changed, 993 insertions(+), 31 deletions(-) create mode 100644 frame/support/test/tests/runtime_metadata.rs create mode 100644 primitives/api/proc-macro/src/runtime_metadata.rs create mode 100644 primitives/metadata-ir/Cargo.toml rename frame/support/src/metadata_ir/mod.rs => primitives/metadata-ir/src/lib.rs (76%) rename {frame/support/src/metadata_ir => primitives/metadata-ir/src}/types.rs (83%) rename {frame/support/src/metadata_ir => primitives/metadata-ir/src}/v14.rs (100%) create mode 100644 primitives/metadata-ir/src/v15.rs diff --git a/Cargo.lock b/Cargo.lock index d4185103f8c96..f55180f9ca942 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2413,9 +2413,9 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" +checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" dependencies = [ "cfg-if", "parity-scale-codec", @@ -2525,6 +2525,7 @@ dependencies = [ "rustversion", "scale-info", "serde", + "sp-api", "sp-arithmetic", "sp-core", "sp-io", @@ -10156,8 +10157,10 @@ dependencies = [ "hash-db", "log", "parity-scale-codec", + "scale-info", "sp-api-proc-macro", "sp-core", + "sp-metadata-ir", "sp-runtime", "sp-state-machine", "sp-std", @@ -10172,6 +10175,7 @@ name = "sp-api-proc-macro" version = "4.0.0-dev" dependencies = [ "Inflector", + "assert_matches", "blake2", "expander", "proc-macro-crate", @@ -10591,6 +10595,16 @@ dependencies = [ "zstd", ] +[[package]] +name = "sp-metadata-ir" +version = "0.1.0" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-std", +] + [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" @@ -10842,6 +10856,7 @@ name = "sp-test-primitives" version = "2.0.0" dependencies = [ "parity-scale-codec", + "scale-info", "serde", "sp-application-crypto", "sp-core", diff --git a/Cargo.toml b/Cargo.toml index de562ad79e47e..cae8976cca4a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -202,6 +202,7 @@ members = [ "primitives/keystore", "primitives/maybe-compressed-blob", "primitives/merkle-mountain-range", + "primitives/metadata-ir", "primitives/npos-elections", "primitives/npos-elections/fuzzer", "primitives/offchain", diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index 820658372afd9..7792fdf015ba5 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.136", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -frame-metadata = { version = "15.0.0", default-features = false, features = ["v14"] } +frame-metadata = { version = "15.1.0", default-features = false, features = ["v14", "v15-unstable"] } sp-api = { version = "4.0.0-dev", default-features = false, path = "../../primitives/api" } sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" } sp-io = { version = "7.0.0", default-features = false, path = "../../primitives/io" } @@ -74,7 +74,7 @@ runtime-benchmarks = [] try-runtime = [] # By default some types have documentation, `no-metadata-docs` allows to reduce the documentation # in the metadata. -no-metadata-docs = ["frame-support-procedural/no-metadata-docs"] +no-metadata-docs = ["frame-support-procedural/no-metadata-docs", "sp-api/no-metadata-docs"] # By default some types have documentation, `full-metadata-docs` allows to add documentation to # more types in the metadata. full-metadata-docs = ["scale-info/docs"] diff --git a/frame/support/procedural/src/construct_runtime/expand/metadata.rs b/frame/support/procedural/src/construct_runtime/expand/metadata.rs index ba6a621af7523..81fc93ba3c9ef 100644 --- a/frame/support/procedural/src/construct_runtime/expand/metadata.rs +++ b/frame/support/procedural/src/construct_runtime/expand/metadata.rs @@ -77,6 +77,24 @@ pub fn expand_runtime_metadata( quote! { impl #runtime { fn metadata_ir() -> #scrate::metadata_ir::MetadataIR { + // Each runtime must expose the `runtime_metadata()` to fetch the runtime API metadata. + // The function is implemented by calling `impl_runtime_apis!`. + // + // However, the `construct_runtime!` may be called without calling `impl_runtime_apis!`. + // Rely on the `Deref` trait to differentiate between a runtime that implements + // APIs (by macro impl_runtime_apis!) and a runtime that is simply created (by macro construct_runtime!). + // + // Both `InternalConstructRuntime` and `InternalImplRuntimeApis` expose a `runtime_metadata()` function. + // `InternalConstructRuntime` is implemented by the `construct_runtime!` for Runtime references (`& Runtime`), + // while `InternalImplRuntimeApis` is implemented by the `impl_runtime_apis!` for Runtime (`Runtime`). + // + // Therefore, the `Deref` trait will resolve the `runtime_metadata` from `impl_runtime_apis!` + // when both macros are called; and will resolve an empty `runtime_metadata` when only the `construct_runtime!` + // is called. + // + // `Deref` needs a reference for resolving the function call. + let rt = #runtime; + #scrate::metadata_ir::MetadataIR { pallets: #scrate::sp_std::vec![ #(#pallets),* ], extrinsic: #scrate::metadata_ir::ExtrinsicMetadataIR { @@ -95,7 +113,8 @@ pub fn expand_runtime_metadata( }) .collect(), }, - ty: #scrate::scale_info::meta_type::<#runtime>() + ty: #scrate::scale_info::meta_type::<#runtime>(), + apis: (&rt).runtime_metadata(), } } diff --git a/frame/support/procedural/src/construct_runtime/mod.rs b/frame/support/procedural/src/construct_runtime/mod.rs index a0d414154bfcc..c5a48a98063a4 100644 --- a/frame/support/procedural/src/construct_runtime/mod.rs +++ b/frame/support/procedural/src/construct_runtime/mod.rs @@ -296,6 +296,31 @@ fn construct_runtime_final_expansion( type RuntimeBlock = #block; } + // Each runtime must expose the `runtime_metadata()` to fetch the runtime API metadata. + // The function is implemented by calling `impl_runtime_apis!`. + // + // However, the `construct_runtime!` may be called without calling `impl_runtime_apis!`. + // Rely on the `Deref` trait to differentiate between a runtime that implements + // APIs (by macro impl_runtime_apis!) and a runtime that is simply created (by macro construct_runtime!). + // + // Both `InternalConstructRuntime` and `InternalImplRuntimeApis` expose a `runtime_metadata()` function. + // `InternalConstructRuntime` is implemented by the `construct_runtime!` for Runtime references (`& Runtime`), + // while `InternalImplRuntimeApis` is implemented by the `impl_runtime_apis!` for Runtime (`Runtime`). + // + // Therefore, the `Deref` trait will resolve the `runtime_metadata` from `impl_runtime_apis!` + // when both macros are called; and will resolve an empty `runtime_metadata` when only the `construct_runtime!` + // is called. + + #[doc(hidden)] + trait InternalConstructRuntime { + #[inline(always)] + fn runtime_metadata(&self) -> #scrate::sp_std::vec::Vec<#scrate::metadata_ir::RuntimeApiMetadataIR> { + Default::default() + } + } + #[doc(hidden)] + impl InternalConstructRuntime for &#name {} + #outer_event #outer_origin diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index ac897fef0d872..036bd93464b9f 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -50,6 +50,7 @@ pub use paste; pub use scale_info; #[cfg(feature = "std")] pub use serde; +pub use sp_api::metadata_ir; pub use sp_core::{OpaqueMetadata, Void}; #[doc(hidden)] pub use sp_core_hashing_proc_macro; @@ -80,7 +81,6 @@ pub mod error; pub mod crypto; pub mod dispatch_context; pub mod instances; -pub mod metadata_ir; pub mod migrations; pub mod traits; pub mod weights; diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index 90ef243eed6c6..ad4589c734fde 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -15,6 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.136", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +sp-api = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/api" } sp-arithmetic = { version = "6.0.0", default-features = false, path = "../../../primitives/arithmetic" } sp-io = { version = "7.0.0", path = "../../../primitives/io", default-features = false } sp-state-machine = { version = "0.13.0", optional = true, path = "../../../primitives/state-machine" } @@ -47,6 +48,7 @@ std = [ "sp-state-machine", "sp-arithmetic/std", "sp-version/std", + "sp-api/std", ] try-runtime = ["frame-support/try-runtime"] # WARNING: diff --git a/frame/support/test/tests/pallet.rs b/frame/support/test/tests/pallet.rs index 11f82c4c0d266..f1dc97223322f 100644 --- a/frame/support/test/tests/pallet.rs +++ b/frame/support/test/tests/pallet.rs @@ -1671,7 +1671,7 @@ fn metadata_at_version() { #[test] fn metadata_versions() { - assert_eq!(vec![LATEST_METADATA_VERSION], Runtime::metadata_versions()); + assert_eq!(vec![LATEST_METADATA_VERSION, u32::MAX], Runtime::metadata_versions()); } #[test] diff --git a/frame/support/test/tests/runtime_metadata.rs b/frame/support/test/tests/runtime_metadata.rs new file mode 100644 index 0000000000000..8c04c785a35af --- /dev/null +++ b/frame/support/test/tests/runtime_metadata.rs @@ -0,0 +1,222 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use frame_support::{ + metadata_ir::{ + RuntimeApiMetadataIR, RuntimeApiMethodMetadataIR, RuntimeApiMethodParamMetadataIR, + }, + traits::ConstU32, +}; +use scale_info::{form::MetaForm, meta_type}; +use sp_runtime::traits::Block as BlockT; + +pub type BlockNumber = u64; +pub type Index = u64; +pub type Header = sp_runtime::generic::Header; +pub type Block = sp_runtime::generic::Block; +pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic; + +impl frame_system::Config for Runtime { + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type BaseCallFilter = frame_support::traits::Everything; + type RuntimeOrigin = RuntimeOrigin; + type Index = u64; + type BlockNumber = u32; + type RuntimeCall = RuntimeCall; + type Hash = sp_runtime::testing::H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type AccountId = u64; + type Lookup = sp_runtime::traits::IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = ConstU32<250>; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = ConstU32<16>; +} + +frame_support::construct_runtime!( + pub enum Runtime where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic + { + System: frame_system, + } +); + +sp_api::decl_runtime_apis! { + /// ApiWithCustomVersion trait documentation + /// + /// Documentation on multiline. + pub trait Api { + fn test(data: u64); + /// something_with_block. + fn something_with_block(block: Block) -> Block; + fn function_with_two_args(data: u64, block: Block); + fn same_name(); + fn wild_card(_: u32); + } +} + +sp_api::impl_runtime_apis! { + impl self::Api for Runtime { + fn test(_data: u64) { + unimplemented!() + } + + fn something_with_block(_: Block) -> Block { + unimplemented!() + } + + fn function_with_two_args(_: u64, _: Block) { + unimplemented!() + } + + fn same_name() {} + + fn wild_card(_: u32) {} + } + + impl sp_api::Core for Runtime { + fn version() -> sp_version::RuntimeVersion { + unimplemented!() + } + fn execute_block(_: Block) { + unimplemented!() + } + fn initialize_block(_: &::Header) { + unimplemented!() + } + } +} + +#[test] +fn runtime_metadata() { + fn maybe_docs(doc: Vec<&'static str>) -> Vec<&'static str> { + if cfg!(feature = "no-metadata-docs") { + vec![] + } else { + doc + } + } + + let expected_runtime_metadata = vec![ + RuntimeApiMetadataIR { + name: "Api", + methods: vec![ + RuntimeApiMethodMetadataIR { + name: "test", + inputs: vec![RuntimeApiMethodParamMetadataIR:: { + name: "data", + ty: meta_type::(), + }], + output: meta_type::<()>(), + docs: vec![], + }, + RuntimeApiMethodMetadataIR { + name: "something_with_block", + inputs: vec![RuntimeApiMethodParamMetadataIR:: { + name: "block", + ty: meta_type::(), + }], + output: meta_type::(), + docs: maybe_docs(vec![" something_with_block."]), + }, + RuntimeApiMethodMetadataIR { + name: "function_with_two_args", + inputs: vec![ + RuntimeApiMethodParamMetadataIR:: { + name: "data", + ty: meta_type::(), + }, + RuntimeApiMethodParamMetadataIR:: { + name: "block", + ty: meta_type::(), + }, + ], + output: meta_type::<()>(), + docs: vec![], + }, + RuntimeApiMethodMetadataIR { + name: "same_name", + inputs: vec![], + output: meta_type::<()>(), + docs: vec![], + }, + RuntimeApiMethodMetadataIR { + name: "wild_card", + inputs: vec![RuntimeApiMethodParamMetadataIR:: { + name: "_", + ty: meta_type::(), + }], + output: meta_type::<()>(), + docs: vec![], + }, + ], + docs: maybe_docs(vec![ + " ApiWithCustomVersion trait documentation", + "", + " Documentation on multiline.", + ]), + }, + RuntimeApiMetadataIR { + name: "Core", + methods: vec![ + RuntimeApiMethodMetadataIR { + name: "version", + inputs: vec![], + output: meta_type::(), + docs: maybe_docs(vec![" Returns the version of the runtime."]), + }, + RuntimeApiMethodMetadataIR { + name: "execute_block", + inputs: vec![RuntimeApiMethodParamMetadataIR:: { + name: "block", + ty: meta_type::(), + }], + output: meta_type::<()>(), + docs: maybe_docs(vec![" Execute the given block."]), + }, + RuntimeApiMethodMetadataIR { + name: "initialize_block", + inputs: vec![RuntimeApiMethodParamMetadataIR:: { + name: "header", + ty: meta_type::<&::Header>(), + }], + output: meta_type::<()>(), + docs: maybe_docs(vec![" Initialize a block with the given header."]), + }, + ], + docs: maybe_docs(vec![ + " The `Core` runtime api that every Substrate runtime needs to implement.", + ]), + }, + ]; + + let rt = Runtime; + let runtime_metadata = (&rt).runtime_metadata(); + assert_eq!(runtime_metadata, expected_runtime_metadata); +} diff --git a/primitives/api/Cargo.toml b/primitives/api/Cargo.toml index ae1b3294c281f..55e3993466a6d 100644 --- a/primitives/api/Cargo.toml +++ b/primitives/api/Cargo.toml @@ -23,7 +23,8 @@ sp-state-machine = { version = "0.13.0", default-features = false, optional = tr sp-trie = { version = "7.0.0", default-features = false, optional = true, path = "../trie" } hash-db = { version = "0.16.0", optional = true } thiserror = { version = "1.0.30", optional = true } - +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +sp-metadata-ir = { version = "0.1.0", default-features = false, path = "../metadata-ir" } log = { version = "0.4.17", default-features = false } [dev-dependencies] @@ -42,6 +43,8 @@ std = [ "hash-db", "thiserror", "log/std", + "scale-info/std", + "sp-metadata-ir/std", ] # Special feature to disable logging completly. # @@ -51,3 +54,5 @@ std = [ # # This sets the max logging level to `off` for `log`. disable-logging = ["log/max_level_off"] +# Do not report the documentation in the metadata. +no-metadata-docs = [] diff --git a/primitives/api/proc-macro/Cargo.toml b/primitives/api/proc-macro/Cargo.toml index ba7c6312042c9..1ba62cc53d5aa 100644 --- a/primitives/api/proc-macro/Cargo.toml +++ b/primitives/api/proc-macro/Cargo.toml @@ -24,6 +24,9 @@ proc-macro-crate = "1.1.3" expander = "1.0.0" Inflector = "0.11.4" +[dev-dependencies] +assert_matches = "1.3.0" + # Required for the doc tests [features] default = ["std"] diff --git a/primitives/api/proc-macro/src/decl_runtime_apis.rs b/primitives/api/proc-macro/src/decl_runtime_apis.rs index 3c3056d34487b..43e1e7969c5d1 100644 --- a/primitives/api/proc-macro/src/decl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/decl_runtime_apis.rs @@ -15,16 +15,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::utils::{ - extract_parameter_names_types_and_borrows, fold_fn_decl_for_client_side, generate_crate_access, - generate_runtime_mod_name_for_trait, parse_runtime_api_version, prefix_function_with_trait, - replace_wild_card_parameter_names, return_type_extract_type, versioned_trait_name, - AllowSelfRefInParameters, -}; - -use crate::common::{ - API_VERSION_ATTRIBUTE, BLOCK_GENERIC_IDENT, CHANGED_IN_ATTRIBUTE, CORE_TRAIT_ATTRIBUTE, - RENAMED_ATTRIBUTE, SUPPORTED_ATTRIBUTE_NAMES, +use crate::{ + common::{ + API_VERSION_ATTRIBUTE, BLOCK_GENERIC_IDENT, CHANGED_IN_ATTRIBUTE, CORE_TRAIT_ATTRIBUTE, + RENAMED_ATTRIBUTE, SUPPORTED_ATTRIBUTE_NAMES, + }, + runtime_metadata::generate_decl_runtime_metadata, + utils::{ + extract_parameter_names_types_and_borrows, fold_fn_decl_for_client_side, + generate_crate_access, generate_runtime_mod_name_for_trait, parse_runtime_api_version, + prefix_function_with_trait, replace_wild_card_parameter_names, return_type_extract_type, + versioned_trait_name, AllowSelfRefInParameters, + }, }; use proc_macro2::{Span, TokenStream}; @@ -219,6 +221,7 @@ fn generate_runtime_decls(decls: &[ItemTrait]) -> Result { let mut decl = decl.clone(); let decl_span = decl.span(); extend_generics_with_block(&mut decl.generics); + let metadata = generate_decl_runtime_metadata(&decl); let mod_name = generate_runtime_mod_name_for_trait(&decl.ident); let found_attributes = remove_supported_attributes(&mut decl.attrs); let api_version = @@ -304,6 +307,8 @@ fn generate_runtime_decls(decls: &[ItemTrait]) -> Result { pub use #versioned_ident as #main_api_ident; + #metadata + pub #api_version pub #id diff --git a/primitives/api/proc-macro/src/impl_runtime_apis.rs b/primitives/api/proc-macro/src/impl_runtime_apis.rs index 0d265293ecf42..c0da8ccf30458 100644 --- a/primitives/api/proc-macro/src/impl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/impl_runtime_apis.rs @@ -15,15 +15,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::utils::{ - extract_all_signature_types, extract_block_type_from_trait_path, extract_impl_trait, - extract_parameter_names_types_and_borrows, generate_crate_access, - generate_runtime_mod_name_for_trait, parse_runtime_api_version, prefix_function_with_trait, - versioned_trait_name, AllowSelfRefInParameters, RequireQualifiedTraitPath, +use crate::{ + common::API_VERSION_ATTRIBUTE, + runtime_metadata::generate_impl_runtime_metadata, + utils::{ + extract_all_signature_types, extract_block_type_from_trait_path, extract_impl_trait, + extract_parameter_names_types_and_borrows, generate_crate_access, + generate_runtime_mod_name_for_trait, parse_runtime_api_version, prefix_function_with_trait, + versioned_trait_name, AllowSelfRefInParameters, RequireQualifiedTraitPath, + }, }; -use crate::common::API_VERSION_ATTRIBUTE; - use proc_macro2::{Span, TokenStream}; use quote::quote; @@ -685,6 +687,7 @@ fn impl_runtime_apis_impl_inner(api_impls: &[ItemImpl]) -> Result { let runtime_api_versions = generate_runtime_api_versions(api_impls)?; let wasm_interface = generate_wasm_interface(api_impls)?; let api_impls_for_runtime_api = generate_api_impl_for_runtime_api(api_impls)?; + let runtime_metadata = generate_impl_runtime_metadata(api_impls)?; let impl_ = quote!( #base_runtime_api @@ -695,6 +698,8 @@ fn impl_runtime_apis_impl_inner(api_impls: &[ItemImpl]) -> Result { #runtime_api_versions + #runtime_metadata + pub mod api { use super::*; diff --git a/primitives/api/proc-macro/src/lib.rs b/primitives/api/proc-macro/src/lib.rs index cea958426879e..d34f4b7f9cf6a 100644 --- a/primitives/api/proc-macro/src/lib.rs +++ b/primitives/api/proc-macro/src/lib.rs @@ -25,6 +25,7 @@ mod common; mod decl_runtime_apis; mod impl_runtime_apis; mod mock_impl_runtime_apis; +mod runtime_metadata; mod utils; #[proc_macro] diff --git a/primitives/api/proc-macro/src/runtime_metadata.rs b/primitives/api/proc-macro/src/runtime_metadata.rs new file mode 100644 index 0000000000000..02b03baeaeee3 --- /dev/null +++ b/primitives/api/proc-macro/src/runtime_metadata.rs @@ -0,0 +1,271 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use proc_macro2::TokenStream as TokenStream2; +use quote::quote; +use syn::{parse_quote, ItemImpl, ItemTrait, Result}; + +use crate::{ + common::CHANGED_IN_ATTRIBUTE, + utils::{ + extract_impl_trait, filter_cfg_attributes, generate_crate_access, + generate_runtime_mod_name_for_trait, get_doc_literals, RequireQualifiedTraitPath, + }, +}; + +/// Get the type parameter argument without lifetime or mutability +/// of a runtime metadata function. +/// +/// In the following example, both the `AccountId` and `Index` generic +/// type parameters must implement `scale_info::TypeInfo` because they +/// are added into the metadata using `scale_info::meta_type`. +/// +/// ```ignore +/// trait ExampleAccountNonceApi { +/// fn account_nonce<'a>(account: &'a AccountId) -> Index; +/// } +/// ``` +/// +/// Instead of returning `&'a AccountId` for the first parameter, this function +/// returns `AccountId` to place bounds around it. +fn get_type_param(ty: &syn::Type) -> syn::Type { + // Remove the lifetime and mutability of the type T to + // place bounds around it. + let ty_elem = match &ty { + syn::Type::Reference(reference) => &reference.elem, + syn::Type::Ptr(ptr) => &ptr.elem, + syn::Type::Slice(slice) => &slice.elem, + syn::Type::Array(arr) => &arr.elem, + _ => ty, + }; + + ty_elem.clone() +} + +/// Extract the documentation from the provided attributes. +/// +/// It takes into account the `no-metadata-docs` feature. +fn collect_docs(attrs: &[syn::Attribute], crate_: &TokenStream2) -> TokenStream2 { + if cfg!(feature = "no-metadata-docs") { + quote!(#crate_::vec![]) + } else { + let docs = get_doc_literals(&attrs); + quote!(#crate_::vec![ #( #docs, )* ]) + } +} + +/// Generate the runtime metadata of the provided trait. +/// +/// The metadata is exposed as a generic function on the hidden module +/// of the trait generated by the `decl_runtime_apis`. +pub fn generate_decl_runtime_metadata(decl: &ItemTrait) -> TokenStream2 { + let crate_ = generate_crate_access(); + let mut methods = Vec::new(); + + // Ensure that any function parameter that relies on the `BlockT` bounds + // also has `TypeInfo + 'static` bounds (required by `scale_info::meta_type`). + // + // For example, if a runtime API defines a method that has an input: + // `fn func(input: ::Header)` + // then the runtime metadata will imply `::Header: TypeInfo + 'static`. + // + // This restricts the bounds at the metadata level, without needing to modify the `BlockT` + // itself, since the concrete implementations are already satisfying `TypeInfo`. + let mut where_clause = Vec::new(); + for item in &decl.items { + // Collect metadata for methods only. + let syn::TraitItem::Method(method) = item else { + continue + }; + + // Collect metadata only for the latest methods. + let is_changed_in = + method.attrs.iter().any(|attr| attr.path.is_ident(CHANGED_IN_ATTRIBUTE)); + if is_changed_in { + continue + } + + let mut inputs = Vec::new(); + let signature = &method.sig; + for input in &signature.inputs { + // Exclude `self` from metadata collection. + let syn::FnArg::Typed(typed) = input else { + continue + }; + + let pat = &typed.pat; + let name = quote!(#pat).to_string(); + let ty = &typed.ty; + + where_clause.push(get_type_param(ty)); + + inputs.push(quote!( + #crate_::metadata_ir::RuntimeApiMethodParamMetadataIR { + name: #name, + ty: #crate_::scale_info::meta_type::<#ty>(), + } + )); + } + + let output = match &signature.output { + syn::ReturnType::Default => quote!(#crate_::scale_info::meta_type::<()>()), + syn::ReturnType::Type(_, ty) => { + where_clause.push(get_type_param(ty)); + quote!(#crate_::scale_info::meta_type::<#ty>()) + }, + }; + + // String method name including quotes for constructing `v15::RuntimeApiMethodMetadata`. + let method_name = signature.ident.to_string(); + let docs = collect_docs(&method.attrs, &crate_); + + // Include the method metadata only if its `cfg` features are enabled. + let attrs = filter_cfg_attributes(&method.attrs); + methods.push(quote!( + #( #attrs )* + #crate_::metadata_ir::RuntimeApiMethodMetadataIR { + name: #method_name, + inputs: #crate_::vec![ #( #inputs, )* ], + output: #output, + docs: #docs, + } + )); + } + + let trait_name_ident = &decl.ident; + let trait_name = trait_name_ident.to_string(); + let docs = collect_docs(&decl.attrs, &crate_); + let attrs = filter_cfg_attributes(&decl.attrs); + // The trait generics where already extended with `Block: BlockT`. + let mut generics = decl.generics.clone(); + for generic_param in generics.params.iter_mut() { + let syn::GenericParam::Type(ty) = generic_param else { + continue + }; + + // Default type parameters are not allowed in functions. + ty.eq_token = None; + ty.default = None; + } + + let where_clause = where_clause + .iter() + .map(|ty| quote!(#ty: #crate_::scale_info::TypeInfo + 'static)); + + quote!( + #( #attrs )* + #[inline(always)] + pub fn runtime_metadata #generics () -> #crate_::metadata_ir::RuntimeApiMetadataIR + where #( #where_clause, )* + { + #crate_::metadata_ir::RuntimeApiMetadataIR { + name: #trait_name, + methods: #crate_::vec![ #( #methods, )* ], + docs: #docs, + } + } + ) +} + +/// Implement the `runtime_metadata` function on the runtime that +/// generates the metadata for the given traits. +/// +/// The metadata of each trait is extracted from the generic function +/// exposed by `generate_decl_runtime_metadata`. +pub fn generate_impl_runtime_metadata(impls: &[ItemImpl]) -> Result { + if impls.is_empty() { + return Ok(quote!()) + } + + let crate_ = generate_crate_access(); + + // Get the name of the runtime for which the traits are implemented. + let runtime_name = &impls + .get(0) + .expect("Traits should contain at least one implementation; qed") + .self_ty; + + let mut metadata = Vec::new(); + + for impl_ in impls { + let mut trait_ = extract_impl_trait(&impl_, RequireQualifiedTraitPath::Yes)?.clone(); + + // Implementation traits are always references with a path `impl client::Core ...` + // The trait name is the last segment of this path. + let trait_name_ident = &trait_ + .segments + .last() + .as_ref() + .expect("Trait path should always contain at least one item; qed") + .ident; + + // Extract the generics from the trait to pass to the `runtime_metadata` + // function on the hidden module. + let generics = trait_ + .segments + .iter() + .find_map(|segment| { + if let syn::PathArguments::AngleBracketed(generics) = &segment.arguments { + Some(generics.clone()) + } else { + None + } + }) + .expect("Trait path should always contain at least one generic parameter; qed"); + + let mod_name = generate_runtime_mod_name_for_trait(&trait_name_ident); + // Get absolute path to the `runtime_decl_for_` module by replacing the last segment. + if let Some(segment) = trait_.segments.last_mut() { + *segment = parse_quote!(#mod_name); + } + + let attrs = filter_cfg_attributes(&impl_.attrs); + metadata.push(quote!( + #( #attrs )* + #trait_::runtime_metadata::#generics() + )); + } + + // Each runtime must expose the `runtime_metadata()` to fetch the runtime API metadata. + // The function is implemented by calling `impl_runtime_apis!`. + // + // However, the `construct_runtime!` may be called without calling `impl_runtime_apis!`. + // Rely on the `Deref` trait to differentiate between a runtime that implements + // APIs (by macro impl_runtime_apis!) and a runtime that is simply created (by macro + // construct_runtime!). + // + // Both `InternalConstructRuntime` and `InternalImplRuntimeApis` expose a `runtime_metadata()` + // function. `InternalConstructRuntime` is implemented by the `construct_runtime!` for Runtime + // references (`& Runtime`), while `InternalImplRuntimeApis` is implemented by the + // `impl_runtime_apis!` for Runtime (`Runtime`). + // + // Therefore, the `Deref` trait will resolve the `runtime_metadata` from `impl_runtime_apis!` + // when both macros are called; and will resolve an empty `runtime_metadata` when only the + // `construct_runtime!` is called. + + Ok(quote!( + #[doc(hidden)] + trait InternalImplRuntimeApis { + #[inline(always)] + fn runtime_metadata(&self) -> #crate_::vec::Vec<#crate_::metadata_ir::RuntimeApiMetadataIR> { + #crate_::vec![ #( #metadata, )* ] + } + } + #[doc(hidden)] + impl InternalImplRuntimeApis for #runtime_name {} + )) +} diff --git a/primitives/api/proc-macro/src/utils.rs b/primitives/api/proc-macro/src/utils.rs index 4444a2624b669..cffaf317fbb10 100644 --- a/primitives/api/proc-macro/src/utils.rs +++ b/primitives/api/proc-macro/src/utils.rs @@ -253,7 +253,74 @@ pub fn parse_runtime_api_version(version: &Attribute) -> Result { version.base10_parse() } -// Each versioned trait is named 'ApiNameVN' where N is the specific version. E.g. ParachainHostV2 +/// Each versioned trait is named 'ApiNameVN' where N is the specific version. E.g. ParachainHostV2 pub fn versioned_trait_name(trait_ident: &Ident, version: u64) -> Ident { format_ident!("{}V{}", trait_ident, version) } + +/// Extract the documentation from the provided attributes. +pub fn get_doc_literals(attrs: &[syn::Attribute]) -> Vec { + attrs + .iter() + .filter_map(|attr| { + let Ok(syn::Meta::NameValue(meta)) = attr.parse_meta() else { + return None + }; + + meta.path.get_ident().filter(|ident| *ident == "doc").map(|_| meta.lit) + }) + .collect() +} + +/// Filters all attributes except the cfg ones. +pub fn filter_cfg_attributes(attrs: &[syn::Attribute]) -> Vec { + attrs.iter().filter(|a| a.path.is_ident("cfg")).cloned().collect() +} + +#[cfg(test)] +mod tests { + use assert_matches::assert_matches; + + use super::*; + + #[test] + fn check_get_doc_literals() { + const FIRST: &'static str = "hello"; + const SECOND: &'static str = "WORLD"; + + let doc: Attribute = parse_quote!(#[doc = #FIRST]); + let doc_world: Attribute = parse_quote!(#[doc = #SECOND]); + + let attrs = vec![ + doc.clone(), + parse_quote!(#[derive(Debug)]), + parse_quote!(#[test]), + parse_quote!(#[allow(non_camel_case_types)]), + doc_world.clone(), + ]; + + let docs = get_doc_literals(&attrs); + assert_eq!(docs.len(), 2); + assert_matches!(&docs[0], syn::Lit::Str(val) if val.value() == FIRST); + assert_matches!(&docs[1], syn::Lit::Str(val) if val.value() == SECOND); + } + + #[test] + fn check_filter_cfg_attributes() { + let cfg_std: Attribute = parse_quote!(#[cfg(feature = "std")]); + let cfg_benchmarks: Attribute = parse_quote!(#[cfg(feature = "runtime-benchmarks")]); + + let attrs = vec![ + cfg_std.clone(), + parse_quote!(#[derive(Debug)]), + parse_quote!(#[test]), + cfg_benchmarks.clone(), + parse_quote!(#[allow(non_camel_case_types)]), + ]; + + let filtered = filter_cfg_attributes(&attrs); + assert_eq!(filtered.len(), 2); + assert_eq!(cfg_std, filtered[0]); + assert_eq!(cfg_benchmarks, filtered[1]); + } +} diff --git a/primitives/api/src/lib.rs b/primitives/api/src/lib.rs index ff101c3add947..02770280f7b90 100644 --- a/primitives/api/src/lib.rs +++ b/primitives/api/src/lib.rs @@ -76,12 +76,16 @@ pub use codec::{self, Decode, DecodeLimit, Encode}; #[cfg(feature = "std")] pub use hash_db::Hasher; #[doc(hidden)] +pub use scale_info; +#[doc(hidden)] #[cfg(not(feature = "std"))] pub use sp_core::to_substrate_wasm_fn_return_value; use sp_core::OpaqueMetadata; #[doc(hidden)] pub use sp_core::{offchain, ExecutionContext}; #[doc(hidden)] +pub use sp_metadata_ir::{self as metadata_ir, frame_metadata as metadata}; +#[doc(hidden)] #[cfg(feature = "std")] pub use sp_runtime::StateVersion; #[doc(hidden)] @@ -101,7 +105,7 @@ pub use sp_state_machine::{ StorageProof, TrieBackend, TrieBackendBuilder, }; #[doc(hidden)] -pub use sp_std::{mem, slice}; +pub use sp_std::{mem, slice, vec}; #[doc(hidden)] pub use sp_version::{create_apis_vec, ApiId, ApisVec, RuntimeVersion}; #[cfg(feature = "std")] diff --git a/primitives/consensus/beefy/src/lib.rs b/primitives/consensus/beefy/src/lib.rs index cc5d1e8cb9a3b..268e1925b4449 100644 --- a/primitives/consensus/beefy/src/lib.rs +++ b/primitives/consensus/beefy/src/lib.rs @@ -284,7 +284,7 @@ impl OnNewValidatorSet for () { /// the runtime API boundary this type is unknown and as such we keep this /// opaque representation, implementors of the runtime API will have to make /// sure that all usages of `OpaqueKeyOwnershipProof` refer to the same type. -#[derive(Decode, Encode, PartialEq)] +#[derive(Decode, Encode, PartialEq, TypeInfo)] pub struct OpaqueKeyOwnershipProof(Vec); impl OpaqueKeyOwnershipProof { /// Create a new `OpaqueKeyOwnershipProof` using the given encoded diff --git a/primitives/metadata-ir/Cargo.toml b/primitives/metadata-ir/Cargo.toml new file mode 100644 index 0000000000000..27fada9c6f34e --- /dev/null +++ b/primitives/metadata-ir/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "sp-metadata-ir" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2021" +license = "Apache-2.0" +homepage = "https://substrate.io" +repository = "https://github.com/paritytech/substrate/" +description = "Intermediate representation of the runtime metadata." +documentation = "https://docs.rs/sp-metadata-ir" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } +frame-metadata = { version = "15.1.0", default-features = false, features = ["v14", "v15-unstable"] } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +sp-std = { version = "5.0.0", default-features = false, path = "../std" } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-metadata/std", + "scale-info/std", + "sp-std/std", +] diff --git a/frame/support/src/metadata_ir/mod.rs b/primitives/metadata-ir/src/lib.rs similarity index 76% rename from frame/support/src/metadata_ir/mod.rs rename to primitives/metadata-ir/src/lib.rs index bab205d63c118..3ddc2911d4c93 100644 --- a/frame/support/src/metadata_ir/mod.rs +++ b/primitives/metadata-ir/src/lib.rs @@ -17,15 +17,28 @@ //! Intermediate representation of the runtime metadata. +#![cfg_attr(not(feature = "std"), no_std)] +#![warn(missing_docs)] + +// Re-export. +#[doc(hidden)] +pub use frame_metadata; + mod types; use frame_metadata::{RuntimeMetadataPrefixed, RuntimeMetadataV14}; pub use types::*; mod v14; +mod v15; /// Metadata V14. const V14: u32 = 14; +/// Metadata V15. +/// +/// Not yet stable, thus we set it to `u32::MAX`. +const V15: u32 = u32::MAX; + /// Transform the IR to the specified version. /// /// Use [`supported_versions`] to find supported versions. @@ -36,13 +49,18 @@ pub fn into_version(metadata: MetadataIR, version: u32) -> Option { + let v15: frame_metadata::v15::RuntimeMetadataV15 = metadata.into(); + Some(v15.into()) + }, _ => None, } } /// Returns the supported metadata versions. pub fn supported_versions() -> sp_std::vec::Vec { - sp_std::vec![V14,] + sp_std::vec![V14, V15] } /// Transform the IR to the latest stable metadata version. @@ -54,7 +72,6 @@ pub fn into_latest(metadata: MetadataIR) -> RuntimeMetadataPrefixed { #[cfg(test)] mod test { use super::*; - use crate::metadata_ir::ExtrinsicMetadataIR; use frame_metadata::{v14::META_RESERVED, RuntimeMetadata}; use scale_info::meta_type; @@ -67,6 +84,7 @@ mod test { signed_extensions: vec![], }, ty: meta_type::<()>(), + apis: vec![], } } @@ -79,4 +97,14 @@ mod test { assert!(matches!(metadata.1, RuntimeMetadata::V14(_))); } + + #[test] + fn into_version_15() { + let ir = ir_metadata(); + let metadata = into_version(ir, V15).expect("Should return prefixed metadata"); + + assert_eq!(metadata.0, META_RESERVED); + + assert!(matches!(metadata.1, RuntimeMetadata::V15(_))); + } } diff --git a/frame/support/src/metadata_ir/types.rs b/primitives/metadata-ir/src/types.rs similarity index 83% rename from frame/support/src/metadata_ir/types.rs rename to primitives/metadata-ir/src/types.rs index 087fd3dcad249..93ee54891d89f 100644 --- a/frame/support/src/metadata_ir/types.rs +++ b/primitives/metadata-ir/src/types.rs @@ -37,6 +37,77 @@ pub struct MetadataIR { pub extrinsic: ExtrinsicMetadataIR, /// The type of the `Runtime`. pub ty: T::Type, + /// Metadata of the Runtime API. + pub apis: Vec>, +} + +/// Metadata of a runtime trait. +#[derive(Clone, PartialEq, Eq, Encode, Debug)] +pub struct RuntimeApiMetadataIR { + /// Trait name. + pub name: T::String, + /// Trait methods. + pub methods: Vec>, + /// Trait documentation. + pub docs: Vec, +} + +impl IntoPortable for RuntimeApiMetadataIR { + type Output = RuntimeApiMetadataIR; + + fn into_portable(self, registry: &mut Registry) -> Self::Output { + RuntimeApiMetadataIR { + name: self.name.into_portable(registry), + methods: registry.map_into_portable(self.methods), + docs: registry.map_into_portable(self.docs), + } + } +} + +/// Metadata of a runtime method. +#[derive(Clone, PartialEq, Eq, Encode, Debug)] +pub struct RuntimeApiMethodMetadataIR { + /// Method name. + pub name: T::String, + /// Method parameters. + pub inputs: Vec>, + /// Method output. + pub output: T::Type, + /// Method documentation. + pub docs: Vec, +} + +impl IntoPortable for RuntimeApiMethodMetadataIR { + type Output = RuntimeApiMethodMetadataIR; + + fn into_portable(self, registry: &mut Registry) -> Self::Output { + RuntimeApiMethodMetadataIR { + name: self.name.into_portable(registry), + inputs: registry.map_into_portable(self.inputs), + output: registry.register_type(&self.output), + docs: registry.map_into_portable(self.docs), + } + } +} + +/// Metadata of a runtime method parameter. +#[derive(Clone, PartialEq, Eq, Encode, Debug)] +pub struct RuntimeApiMethodParamMetadataIR { + /// Parameter name. + pub name: T::String, + /// Parameter type. + pub ty: T::Type, +} + +impl IntoPortable for RuntimeApiMethodParamMetadataIR { + type Output = RuntimeApiMethodParamMetadataIR; + + fn into_portable(self, registry: &mut Registry) -> Self::Output { + RuntimeApiMethodParamMetadataIR { + name: self.name.into_portable(registry), + ty: registry.register_type(&self.ty), + } + } } /// The intermediate representation for a pallet metadata. diff --git a/frame/support/src/metadata_ir/v14.rs b/primitives/metadata-ir/src/v14.rs similarity index 100% rename from frame/support/src/metadata_ir/v14.rs rename to primitives/metadata-ir/src/v14.rs diff --git a/primitives/metadata-ir/src/v15.rs b/primitives/metadata-ir/src/v15.rs new file mode 100644 index 0000000000000..86441228d008e --- /dev/null +++ b/primitives/metadata-ir/src/v15.rs @@ -0,0 +1,188 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Convert the IR to V15 metadata. + +use super::types::{ + ExtrinsicMetadataIR, MetadataIR, PalletCallMetadataIR, PalletConstantMetadataIR, + PalletErrorMetadataIR, PalletEventMetadataIR, PalletMetadataIR, PalletStorageMetadataIR, + RuntimeApiMetadataIR, RuntimeApiMethodMetadataIR, RuntimeApiMethodParamMetadataIR, + SignedExtensionMetadataIR, StorageEntryMetadataIR, StorageEntryModifierIR, StorageEntryTypeIR, + StorageHasherIR, +}; + +use frame_metadata::v15::{ + ExtrinsicMetadata, PalletCallMetadata, PalletConstantMetadata, PalletErrorMetadata, + PalletEventMetadata, PalletMetadata, PalletStorageMetadata, RuntimeApiMetadata, + RuntimeApiMethodMetadata, RuntimeApiMethodParamMetadata, RuntimeMetadataV15, + SignedExtensionMetadata, StorageEntryMetadata, StorageEntryModifier, StorageEntryType, + StorageHasher, +}; + +impl From for RuntimeMetadataV15 { + fn from(ir: MetadataIR) -> Self { + RuntimeMetadataV15::new( + ir.pallets.into_iter().map(Into::into).collect(), + ir.extrinsic.into(), + ir.ty, + ir.apis.into_iter().map(Into::into).collect(), + ) + } +} + +impl From for RuntimeApiMetadata { + fn from(ir: RuntimeApiMetadataIR) -> Self { + RuntimeApiMetadata { + name: ir.name, + methods: ir.methods.into_iter().map(Into::into).collect(), + docs: ir.docs, + } + } +} + +impl From for RuntimeApiMethodMetadata { + fn from(ir: RuntimeApiMethodMetadataIR) -> Self { + RuntimeApiMethodMetadata { + name: ir.name, + inputs: ir.inputs.into_iter().map(Into::into).collect(), + output: ir.output, + docs: ir.docs, + } + } +} + +impl From for RuntimeApiMethodParamMetadata { + fn from(ir: RuntimeApiMethodParamMetadataIR) -> Self { + RuntimeApiMethodParamMetadata { name: ir.name, ty: ir.ty } + } +} + +impl From for PalletMetadata { + fn from(ir: PalletMetadataIR) -> Self { + PalletMetadata { + name: ir.name, + storage: ir.storage.map(Into::into), + calls: ir.calls.map(Into::into), + event: ir.event.map(Into::into), + constants: ir.constants.into_iter().map(Into::into).collect(), + error: ir.error.map(Into::into), + index: ir.index, + docs: ir.docs, + } + } +} + +impl From for StorageEntryModifier { + fn from(ir: StorageEntryModifierIR) -> Self { + match ir { + StorageEntryModifierIR::Optional => StorageEntryModifier::Optional, + StorageEntryModifierIR::Default => StorageEntryModifier::Default, + } + } +} + +impl From for StorageHasher { + fn from(ir: StorageHasherIR) -> Self { + match ir { + StorageHasherIR::Blake2_128 => StorageHasher::Blake2_128, + StorageHasherIR::Blake2_256 => StorageHasher::Blake2_256, + StorageHasherIR::Blake2_128Concat => StorageHasher::Blake2_128Concat, + StorageHasherIR::Twox128 => StorageHasher::Twox128, + StorageHasherIR::Twox256 => StorageHasher::Twox256, + StorageHasherIR::Twox64Concat => StorageHasher::Twox64Concat, + StorageHasherIR::Identity => StorageHasher::Identity, + } + } +} + +impl From for StorageEntryType { + fn from(ir: StorageEntryTypeIR) -> Self { + match ir { + StorageEntryTypeIR::Plain(ty) => StorageEntryType::Plain(ty), + StorageEntryTypeIR::Map { hashers, key, value } => StorageEntryType::Map { + hashers: hashers.into_iter().map(Into::into).collect(), + key, + value, + }, + } + } +} + +impl From for StorageEntryMetadata { + fn from(ir: StorageEntryMetadataIR) -> Self { + StorageEntryMetadata { + name: ir.name, + modifier: ir.modifier.into(), + ty: ir.ty.into(), + default: ir.default, + docs: ir.docs, + } + } +} + +impl From for PalletStorageMetadata { + fn from(ir: PalletStorageMetadataIR) -> Self { + PalletStorageMetadata { + prefix: ir.prefix, + entries: ir.entries.into_iter().map(Into::into).collect(), + } + } +} + +impl From for PalletCallMetadata { + fn from(ir: PalletCallMetadataIR) -> Self { + PalletCallMetadata { ty: ir.ty } + } +} + +impl From for PalletEventMetadata { + fn from(ir: PalletEventMetadataIR) -> Self { + PalletEventMetadata { ty: ir.ty } + } +} + +impl From for PalletConstantMetadata { + fn from(ir: PalletConstantMetadataIR) -> Self { + PalletConstantMetadata { name: ir.name, ty: ir.ty, value: ir.value, docs: ir.docs } + } +} + +impl From for PalletErrorMetadata { + fn from(ir: PalletErrorMetadataIR) -> Self { + PalletErrorMetadata { ty: ir.ty } + } +} + +impl From for SignedExtensionMetadata { + fn from(ir: SignedExtensionMetadataIR) -> Self { + SignedExtensionMetadata { + identifier: ir.identifier, + ty: ir.ty, + additional_signed: ir.additional_signed, + } + } +} + +impl From for ExtrinsicMetadata { + fn from(ir: ExtrinsicMetadataIR) -> Self { + ExtrinsicMetadata { + ty: ir.ty, + version: ir.version, + signed_extensions: ir.signed_extensions.into_iter().map(Into::into).collect(), + } + } +} diff --git a/primitives/test-primitives/Cargo.toml b/primitives/test-primitives/Cargo.toml index deb120104b717..f6d57ce70fc05 100644 --- a/primitives/test-primitives/Cargo.toml +++ b/primitives/test-primitives/Cargo.toml @@ -13,6 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../application-crypto" } sp-core = { version = "7.0.0", default-features = false, path = "../core" } @@ -28,4 +29,5 @@ std = [ "sp-application-crypto/std", "sp-core/std", "sp-runtime/std", + "scale-info/std", ] diff --git a/primitives/test-primitives/src/lib.rs b/primitives/test-primitives/src/lib.rs index 3a5f3dac40d68..035acc7a35ef6 100644 --- a/primitives/test-primitives/src/lib.rs +++ b/primitives/test-primitives/src/lib.rs @@ -28,7 +28,7 @@ pub use sp_core::{hash::H256, RuntimeDebug}; use sp_runtime::traits::{BlakeTwo256, Extrinsic as ExtrinsicT, Verify}; /// Extrinsic for test-runtime. -#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)] +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] pub enum Extrinsic { IncludeData(Vec), StorageChange(Vec, Option>), From a2f6e05cc4e77734c2fa22167dbe20c845d0702e Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Tue, 11 Apr 2023 15:53:16 +0200 Subject: [PATCH 09/93] pallet nis: remove benchmarking hack (#13759) * pallet nis: remove benchmark hack Signed-off-by: Oliver Tale-Yazdi * NearestPrefDown -> Down Tested on the kitchensink and in case that n = 10000000000000000 and d = 12000100600000000000000 it rounds the Perquintill up (correctly) since 833326347280+47318160/60000503 should round up. That triggers the path 'amount <= on_hold' in L736. Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi --- frame/nis/src/benchmarking.rs | 6 ------ frame/nis/src/lib.rs | 5 ++--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/frame/nis/src/benchmarking.rs b/frame/nis/src/benchmarking.rs index 10fee2abe3ba9..0cc9e7421d0e6 100644 --- a/frame/nis/src/benchmarking.rs +++ b/frame/nis/src/benchmarking.rs @@ -164,9 +164,6 @@ benchmarks! { Nis::::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?; Nis::::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited()); frame_system::Pallet::::set_block_number(Receipts::::get(0).unwrap().expiry); - // FIXME: Ensure that the pallet has enough funding. This should already be the case, but - // a rounding error can cause it to fail. - T::Currency::set_balance(&Nis::::account_id(), BalanceOf::::max_value() / 10u32.into()); }: _(RawOrigin::Signed(caller.clone()), 0, None) verify { assert!(Receipts::::get(0).is_none()); @@ -185,9 +182,6 @@ benchmarks! { Nis::::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited()); frame_system::Pallet::::set_block_number(Receipts::::get(0).unwrap().expiry); Nis::::communify(RawOrigin::Signed(caller.clone()).into(), 0)?; - // FIXME: Ensure that the pallet has enough funding. This should already be the case, but - // a rounding error can cause it to fail. - T::Currency::set_balance(&Nis::::account_id(), BalanceOf::::max_value() / 10u32.into()); }: _(RawOrigin::Signed(caller.clone()), 0) verify { assert!(Receipts::::get(0).is_none()); diff --git a/frame/nis/src/lib.rs b/frame/nis/src/lib.rs index 9cac5f4b616e7..c4d0d0d420290 100644 --- a/frame/nis/src/lib.rs +++ b/frame/nis/src/lib.rs @@ -1139,9 +1139,8 @@ pub mod pallet { // Now to activate the bid... let n = amount; let d = issuance.effective; - let proportion = - Perquintill::from_rational_with_rounding(n, d, Rounding::NearestPrefDown) - .defensive_unwrap_or_default(); + let proportion = Perquintill::from_rational_with_rounding(n, d, Rounding::Down) + .defensive_unwrap_or_default(); let who = bid.who; let index = summary.index; summary.proportion_owed.defensive_saturating_accrue(proportion); From a1f71b8ef5dd531b101d2c9ec1a43f40715b4db4 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Wed, 12 Apr 2023 00:17:25 +1000 Subject: [PATCH 10/93] Fix fungible and fungibles set_balance return value (#13851) * Fix fungible set_balance return value * fix fungibles set_balance return value --- frame/support/src/traits/tokens/fungible/regular.rs | 4 ++-- frame/support/src/traits/tokens/fungibles/regular.rs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frame/support/src/traits/tokens/fungible/regular.rs b/frame/support/src/traits/tokens/fungible/regular.rs index 574392cac8256..5a201b33b7cd9 100644 --- a/frame/support/src/traits/tokens/fungible/regular.rs +++ b/frame/support/src/traits/tokens/fungible/regular.rs @@ -327,9 +327,9 @@ pub trait Mutate: Inspect + Unbalanced { fn set_balance(who: &AccountId, amount: Self::Balance) -> Self::Balance { let b = Self::balance(who); if b > amount { - Self::burn_from(who, b - amount, BestEffort, Force).map(|d| amount.saturating_sub(d)) + Self::burn_from(who, b - amount, BestEffort, Force).map(|d| b.saturating_sub(d)) } else { - Self::mint_into(who, amount - b).map(|d| amount.saturating_add(d)) + Self::mint_into(who, amount - b).map(|d| b.saturating_add(d)) } .unwrap_or(b) } diff --git a/frame/support/src/traits/tokens/fungibles/regular.rs b/frame/support/src/traits/tokens/fungibles/regular.rs index 03c14988015ab..27d1a50b34805 100644 --- a/frame/support/src/traits/tokens/fungibles/regular.rs +++ b/frame/support/src/traits/tokens/fungibles/regular.rs @@ -365,10 +365,9 @@ pub trait Mutate: Inspect + Unbalanced { fn set_balance(asset: Self::AssetId, who: &AccountId, amount: Self::Balance) -> Self::Balance { let b = Self::balance(asset, who); if b > amount { - Self::burn_from(asset, who, b - amount, BestEffort, Force) - .map(|d| amount.saturating_sub(d)) + Self::burn_from(asset, who, b - amount, BestEffort, Force).map(|d| b.saturating_sub(d)) } else { - Self::mint_into(asset, who, amount - b).map(|d| amount.saturating_add(d)) + Self::mint_into(asset, who, amount - b).map(|d| b.saturating_add(d)) } .unwrap_or(b) } From ca6af5d19fc6439d2afae38d2ce68bf250663370 Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Tue, 11 Apr 2023 17:02:50 +0200 Subject: [PATCH 11/93] use stable rust toolchain in ci (#13830) cargo-fmt stays on the nightly pipeline; our fmt config uses a heap of unstable features. --- scripts/ci/gitlab/pipeline/build.yml | 3 +-- scripts/ci/gitlab/pipeline/test.yml | 27 +++++++++------------------ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/scripts/ci/gitlab/pipeline/build.yml b/scripts/ci/gitlab/pipeline/build.yml index 0a36599c70e24..806a4ef970960 100644 --- a/scripts/ci/gitlab/pipeline/build.yml +++ b/scripts/ci/gitlab/pipeline/build.yml @@ -148,7 +148,6 @@ build-rustdoc: variables: SKIP_WASM_BUILD: 1 DOC_INDEX_PAGE: "sc_service/index.html" # default redirected page - RUSTY_CACHIER_TOOLCHAIN: nightly # this variable gets overriden by "rusty-cachier environment inject", use the value as default CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target" artifacts: @@ -163,7 +162,7 @@ build-rustdoc: artifacts: false script: - rusty-cachier snapshot create - - time cargo +nightly doc --locked --workspace --all-features --verbose --no-deps + - time cargo doc --locked --workspace --all-features --verbose --no-deps - rm -f $CARGO_TARGET_DIR/doc/.lock - mv $CARGO_TARGET_DIR/doc ./crate-docs # FIXME: remove me after CI image gets nonroot diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index 331b382e41a6f..50f926215062d 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -61,21 +61,17 @@ cargo-clippy: needs: - job: cargo-fmt artifacts: false - variables: - RUSTY_CACHIER_TOOLCHAIN: nightly extends: - .docker-env - .test-refs script: - rusty-cachier snapshot create - - SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo +nightly clippy --all-targets + - SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --all-targets - rusty-cachier cache upload cargo-check-benches: stage: test variables: - # Override to use nightly toolchain - RUSTY_CACHIER_TOOLCHAIN: "nightly" CI_JOB_NAME: "cargo-check-benches" extends: - .docker-env @@ -105,7 +101,7 @@ cargo-check-benches: - echo "___Running benchmarks___"; - case ${CI_NODE_INDEX} in 1) - SKIP_WASM_BUILD=1 time cargo +nightly check --locked --benches --all; + SKIP_WASM_BUILD=1 time cargo check --locked --benches --all; cargo run --locked --release -p node-bench -- ::trie::read::small --json | tee ./artifacts/benches/$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA/::trie::read::small.json; echo "___Uploading cache for rusty-cachier___"; @@ -301,7 +297,6 @@ test-frame-examples-compile-to-wasm: - .docker-env - .test-refs variables: - RUSTY_CACHIER_TOOLCHAIN: nightly # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. RUSTFLAGS: "-C debug-assertions" @@ -309,9 +304,9 @@ test-frame-examples-compile-to-wasm: script: - rusty-cachier snapshot create - cd ./frame/examples/offchain-worker/ - - cargo +nightly build --locked --target=wasm32-unknown-unknown --no-default-features + - cargo build --locked --target=wasm32-unknown-unknown --no-default-features - cd ../basic - - cargo +nightly build --locked --target=wasm32-unknown-unknown --no-default-features + - cargo build --locked --target=wasm32-unknown-unknown --no-default-features - rusty-cachier cache upload test-linux-stable-int: @@ -344,8 +339,6 @@ check-tracing: needs: - job: test-linux-stable-int artifacts: false - variables: - RUSTY_CACHIER_TOOLCHAIN: nightly extends: - .docker-env - .test-refs @@ -353,8 +346,8 @@ check-tracing: script: - rusty-cachier snapshot create # with-tracing must be explicitly activated, we run a test to ensure this works as expected in both cases - - time cargo +nightly test --locked --manifest-path ./primitives/tracing/Cargo.toml --no-default-features - - time cargo +nightly test --locked --manifest-path ./primitives/tracing/Cargo.toml --no-default-features --features=with-tracing + - time cargo test --locked --manifest-path ./primitives/tracing/Cargo.toml --no-default-features + - time cargo test --locked --manifest-path ./primitives/tracing/Cargo.toml --no-default-features --features=with-tracing - rusty-cachier cache upload # more information about this job can be found here: @@ -369,7 +362,6 @@ test-full-crypto-feature: - .docker-env - .test-refs variables: - RUSTY_CACHIER_TOOLCHAIN: nightly # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. RUSTFLAGS: "-C debug-assertions" @@ -377,9 +369,9 @@ test-full-crypto-feature: script: - rusty-cachier snapshot create - cd primitives/core/ - - time cargo +nightly build --locked --verbose --no-default-features --features full_crypto + - time cargo build --locked --verbose --no-default-features --features full_crypto - cd ../application-crypto - - time cargo +nightly build --locked --verbose --no-default-features --features full_crypto + - time cargo build --locked --verbose --no-default-features --features full_crypto - rusty-cachier cache upload check-rustdoc: @@ -388,12 +380,11 @@ check-rustdoc: - .docker-env - .test-refs variables: - RUSTY_CACHIER_TOOLCHAIN: nightly SKIP_WASM_BUILD: 1 RUSTDOCFLAGS: "-Dwarnings" script: - rusty-cachier snapshot create - - time cargo +nightly doc --locked --workspace --all-features --verbose --no-deps + - time cargo doc --locked --workspace --all-features --verbose --no-deps - rusty-cachier cache upload cargo-check-each-crate: From da9f88dcac328d8f6de38dd61e33078c20bd6685 Mon Sep 17 00:00:00 2001 From: gupnik Date: Tue, 11 Apr 2023 20:40:10 +0530 Subject: [PATCH 12/93] Makes storage hashers optional in dev mode (#13815) * Initial changes * Adds UI test for error when _ is used without dev_mode * Minor * ".git/.scripts/commands/fmt/fmt.sh" * Adds test to verify hasher --------- Co-authored-by: command-bot <> --- .../procedural/src/pallet/expand/storage.rs | 13 +++ .../procedural/src/pallet/parse/storage.rs | 44 +++++++--- .../dev_mode_without_arg_default_hasher.rs | 33 +++++++ ...dev_mode_without_arg_default_hasher.stderr | 19 +++++ .../tests/pallet_ui/pass/dev_mode_valid.rs | 85 ++++++++++++++++++- 5 files changed, 182 insertions(+), 12 deletions(-) create mode 100644 frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.rs create mode 100644 frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.stderr diff --git a/frame/support/procedural/src/pallet/expand/storage.rs b/frame/support/procedural/src/pallet/expand/storage.rs index 8ba9ee7681ca9..efc803033d3bf 100644 --- a/frame/support/procedural/src/pallet/expand/storage.rs +++ b/frame/support/procedural/src/pallet/expand/storage.rs @@ -269,6 +269,19 @@ pub fn process_generics(def: &mut Def) -> syn::Result (5, 6, 7), }; + if storage_def.use_default_hasher { + let hasher_indices: Vec = match storage_def.metadata { + Metadata::Map { .. } | Metadata::CountedMap { .. } => vec![1], + Metadata::DoubleMap { .. } => vec![1, 3], + _ => vec![], + }; + for hasher_idx in hasher_indices { + args.args[hasher_idx] = syn::GenericArgument::Type( + syn::parse_quote!(#frame_support::Blake2_128Concat), + ); + } + } + if query_idx < args.args.len() { if let syn::GenericArgument::Type(query_kind) = args.args.index_mut(query_idx) { set_result_query_type_parameter(query_kind)?; diff --git a/frame/support/procedural/src/pallet/parse/storage.rs b/frame/support/procedural/src/pallet/parse/storage.rs index 3ed7ce54ebd64..fee6ec9f1ca87 100644 --- a/frame/support/procedural/src/pallet/parse/storage.rs +++ b/frame/support/procedural/src/pallet/parse/storage.rs @@ -185,6 +185,8 @@ pub struct StorageDef { pub unbounded: bool, /// Whether or not reads to this storage key will be ignored by benchmarking pub whitelisted: bool, + /// Whether or not a default hasher is allowed to replace `_` + pub use_default_hasher: bool, } /// The parsed generic from the @@ -325,12 +327,12 @@ fn check_generics( } } -/// Returns `(named generics, metadata, query kind)` +/// Returns `(named generics, metadata, query kind, use_default_hasher)` fn process_named_generics( storage: &StorageKind, args_span: proc_macro2::Span, args: &[syn::Binding], -) -> syn::Result<(Option, Metadata, Option)> { +) -> syn::Result<(Option, Metadata, Option, bool)> { let mut parsed = HashMap::::new(); // Ensure no duplicate. @@ -480,15 +482,16 @@ fn process_named_generics( let metadata = generics.metadata()?; let query_kind = generics.query_kind(); - Ok((Some(generics), metadata, query_kind)) + Ok((Some(generics), metadata, query_kind, false)) } -/// Returns `(named generics, metadata, query kind)` +/// Returns `(named generics, metadata, query kind, use_default_hasher)` fn process_unnamed_generics( storage: &StorageKind, args_span: proc_macro2::Span, args: &[syn::Type], -) -> syn::Result<(Option, Metadata, Option)> { + dev_mode: bool, +) -> syn::Result<(Option, Metadata, Option, bool)> { let retrieve_arg = |arg_pos| { args.get(arg_pos).cloned().ok_or_else(|| { let msg = format!( @@ -510,18 +513,28 @@ fn process_unnamed_generics( err })?; + let use_default_hasher = |arg_pos| { + if let Some(arg) = retrieve_arg(arg_pos).ok() { + dev_mode && syn::parse2::(arg.to_token_stream()).is_ok() + } else { + false + } + }; + let res = match storage { StorageKind::Value => - (None, Metadata::Value { value: retrieve_arg(1)? }, retrieve_arg(2).ok()), + (None, Metadata::Value { value: retrieve_arg(1)? }, retrieve_arg(2).ok(), false), StorageKind::Map => ( None, Metadata::Map { key: retrieve_arg(2)?, value: retrieve_arg(3)? }, retrieve_arg(4).ok(), + use_default_hasher(1), ), StorageKind::CountedMap => ( None, Metadata::CountedMap { key: retrieve_arg(2)?, value: retrieve_arg(3)? }, retrieve_arg(4).ok(), + use_default_hasher(1), ), StorageKind::DoubleMap => ( None, @@ -531,21 +544,28 @@ fn process_unnamed_generics( value: retrieve_arg(5)?, }, retrieve_arg(6).ok(), + use_default_hasher(1) && use_default_hasher(3), ), StorageKind::NMap => { let keygen = retrieve_arg(1)?; let keys = collect_keys(&keygen)?; - (None, Metadata::NMap { keys, keygen, value: retrieve_arg(2)? }, retrieve_arg(3).ok()) + ( + None, + Metadata::NMap { keys, keygen, value: retrieve_arg(2)? }, + retrieve_arg(3).ok(), + false, + ) }, }; Ok(res) } -/// Returns `(named generics, metadata, query kind)` +/// Returns `(named generics, metadata, query kind, use_default_hasher)` fn process_generics( segment: &syn::PathSegment, -) -> syn::Result<(Option, Metadata, Option)> { + dev_mode: bool, +) -> syn::Result<(Option, Metadata, Option, bool)> { let storage_kind = match &*segment.ident.to_string() { "StorageValue" => StorageKind::Value, "StorageMap" => StorageKind::Map, @@ -583,7 +603,7 @@ fn process_generics( _ => unreachable!("It is asserted above that all generics are types"), }) .collect::>(); - process_unnamed_generics(&storage_kind, args_span, &args) + process_unnamed_generics(&storage_kind, args_span, &args, dev_mode) } else if args.args.iter().all(|gen| matches!(gen, syn::GenericArgument::Binding(_))) { let args = args .args @@ -711,7 +731,8 @@ impl StorageDef { return Err(syn::Error::new(item.ty.span(), msg)) } - let (named_generics, metadata, query_kind) = process_generics(&typ.path.segments[0])?; + let (named_generics, metadata, query_kind, use_default_hasher) = + process_generics(&typ.path.segments[0], dev_mode)?; let query_kind = query_kind .map(|query_kind| { @@ -832,6 +853,7 @@ impl StorageDef { named_generics, unbounded, whitelisted, + use_default_hasher, }) } } diff --git a/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.rs b/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.rs new file mode 100644 index 0000000000000..fb1139479566a --- /dev/null +++ b/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.rs @@ -0,0 +1,33 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub use pallet::*; + +#[frame_support::pallet] +pub mod pallet { + use frame_support::pallet_prelude::*; + + // The struct on which we build all of our Pallet logic. + #[pallet::pallet] + pub struct Pallet(_); + + // Your Pallet's configuration trait, representing custom external types and interfaces. + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::storage] + type MyStorage = StorageValue<_, Vec>; + + #[pallet::storage] + type MyStorageMap = StorageMap<_, _, u32, u64>; + + #[pallet::storage] + type MyStorageDoubleMap = StorageDoubleMap<_, _, u32, _, u64, u64>; + + #[pallet::storage] + type MyCountedStorageMap = CountedStorageMap<_, _, u32, u64>; + + // Your Pallet's internal functions. + impl Pallet {} +} + +fn main() {} diff --git a/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.stderr b/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.stderr new file mode 100644 index 0000000000000..5317f5c52b9b6 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.stderr @@ -0,0 +1,19 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases + --> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:21:47 + | +21 | type MyStorageMap = StorageMap<_, _, u32, u64>; + | ^ not allowed in type signatures + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases + --> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:24:59 + | +24 | type MyStorageDoubleMap = StorageDoubleMap<_, _, u32, _, u64, u64>; + | ^ ^ not allowed in type signatures + | | + | not allowed in type signatures + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases + --> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:27:61 + | +27 | type MyCountedStorageMap = CountedStorageMap<_, _, u32, u64>; + | ^ not allowed in type signatures diff --git a/frame/support/test/tests/pallet_ui/pass/dev_mode_valid.rs b/frame/support/test/tests/pallet_ui/pass/dev_mode_valid.rs index 97e0d585d0ce9..483ed9579bd0a 100644 --- a/frame/support/test/tests/pallet_ui/pass/dev_mode_valid.rs +++ b/frame/support/test/tests/pallet_ui/pass/dev_mode_valid.rs @@ -1,5 +1,11 @@ #![cfg_attr(not(feature = "std"), no_std)] +use frame_support::{ + traits::{ + ConstU32, + }, +}; + pub use pallet::*; #[frame_support::pallet(dev_mode)] @@ -19,6 +25,16 @@ pub mod pallet { #[pallet::storage] type MyStorage = StorageValue<_, Vec>; + // The Hasher requirement skipped by `dev_mode`. + #[pallet::storage] + pub type MyStorageMap = StorageMap<_, _, u32, u64>; + + #[pallet::storage] + type MyStorageDoubleMap = StorageDoubleMap<_, _, u32, _, u64, u64>; + + #[pallet::storage] + type MyCountedStorageMap = CountedStorageMap<_, _, u32, u64>; + // Your Pallet's callable functions. #[pallet::call] impl Pallet { @@ -32,4 +48,71 @@ pub mod pallet { impl Pallet {} } -fn main() {} +impl frame_system::Config for Runtime { + type BaseCallFilter = frame_support::traits::Everything; + type RuntimeOrigin = RuntimeOrigin; + type Index = u64; + type BlockNumber = u32; + type RuntimeCall = RuntimeCall; + type Hash = sp_runtime::testing::H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type AccountId = u64; + type Lookup = sp_runtime::traits::IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = ConstU32<250>; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = ConstU32<16>; +} + +pub type Header = sp_runtime::generic::Header; +pub type Block = sp_runtime::generic::Block; +pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic; + +frame_support::construct_runtime!( + pub struct Runtime where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic + { + // Exclude part `Storage` in order not to check its metadata in tests. + System: frame_system exclude_parts { Pallet, Storage }, + Example: pallet, + } +); + +impl pallet::Config for Runtime { + +} + +fn main() { + use frame_support::{pallet_prelude::*}; + use storage::unhashed; + use sp_io::{ + hashing::{blake2_128, twox_128}, + TestExternalities, + }; + + fn blake2_128_concat(d: &[u8]) -> Vec { + let mut v = blake2_128(d).to_vec(); + v.extend_from_slice(d); + v + } + + TestExternalities::default().execute_with(|| { + pallet::MyStorageMap::::insert(1, 2); + let mut k = [twox_128(b"Example"), twox_128(b"MyStorageMap")].concat(); + k.extend(1u32.using_encoded(blake2_128_concat)); + assert_eq!(unhashed::get::(&k), Some(2u64)); + }); +} From 32221d47b68f38139323009615d69493338914e1 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Tue, 11 Apr 2023 19:12:08 +0200 Subject: [PATCH 13/93] Force incrementing of consumers (#13878) --- frame/balances/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index dcf602cd5e0bf..029a170535a10 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -782,8 +782,8 @@ pub mod pallet { } a.flags.set_new_logic(); if !a.reserved.is_zero() || !a.frozen.is_zero() { - if !system::Pallet::::can_inc_consumer(who) { - // Gah!! We have a non-zero reserve balance but no provider refs :( + if system::Pallet::::providers(who) == 0 { + // Gah!! We have no provider refs :( // This shouldn't practically happen, but we need a failsafe anyway: let's give // them enough for an ED. log::warn!( @@ -794,7 +794,7 @@ pub mod pallet { a.free = a.free.max(Self::ed()); system::Pallet::::inc_providers(who); } - let _ = system::Pallet::::inc_consumers(who).defensive(); + let _ = system::Pallet::::inc_consumers_without_limit(who).defensive(); } // Should never fail - we're only setting a bit. let _ = T::AccountStore::try_mutate_exists(who, |account| -> DispatchResult { From 2b9ca86696bf87a63f8b9a8e48ebfed9d918fbcc Mon Sep 17 00:00:00 2001 From: gupnik Date: Wed, 12 Apr 2023 13:56:40 +0530 Subject: [PATCH 14/93] Fixes error message when _ is used without dev mode (#13886) * Initial changes * Adds UI test for error when _ is used without dev_mode * Minor * ".git/.scripts/commands/fmt/fmt.sh" * Adds test to verify hasher * Fixes error message when _ is used without dev mode * Updates test * Addresses review comment --------- Co-authored-by: command-bot <> --- .../procedural/src/pallet/parse/storage.rs | 18 ++++++++++----- ...dev_mode_without_arg_default_hasher.stderr | 22 ++++++------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/frame/support/procedural/src/pallet/parse/storage.rs b/frame/support/procedural/src/pallet/parse/storage.rs index fee6ec9f1ca87..4e90a423f79ef 100644 --- a/frame/support/procedural/src/pallet/parse/storage.rs +++ b/frame/support/procedural/src/pallet/parse/storage.rs @@ -514,10 +514,16 @@ fn process_unnamed_generics( })?; let use_default_hasher = |arg_pos| { - if let Some(arg) = retrieve_arg(arg_pos).ok() { - dev_mode && syn::parse2::(arg.to_token_stream()).is_ok() + let arg = retrieve_arg(arg_pos)?; + if syn::parse2::(arg.to_token_stream()).is_ok() { + if dev_mode { + Ok(true) + } else { + let msg = "`_` can only be used in dev_mode. Please specify an appropriate hasher."; + Err(syn::Error::new(arg.span(), msg)) + } } else { - false + Ok(false) } }; @@ -528,13 +534,13 @@ fn process_unnamed_generics( None, Metadata::Map { key: retrieve_arg(2)?, value: retrieve_arg(3)? }, retrieve_arg(4).ok(), - use_default_hasher(1), + use_default_hasher(1)?, ), StorageKind::CountedMap => ( None, Metadata::CountedMap { key: retrieve_arg(2)?, value: retrieve_arg(3)? }, retrieve_arg(4).ok(), - use_default_hasher(1), + use_default_hasher(1)?, ), StorageKind::DoubleMap => ( None, @@ -544,7 +550,7 @@ fn process_unnamed_generics( value: retrieve_arg(5)?, }, retrieve_arg(6).ok(), - use_default_hasher(1) && use_default_hasher(3), + use_default_hasher(1)? && use_default_hasher(3)?, ), StorageKind::NMap => { let keygen = retrieve_arg(1)?; diff --git a/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.stderr b/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.stderr index 5317f5c52b9b6..e0dbc8c953b4e 100644 --- a/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.stderr +++ b/frame/support/test/tests/pallet_ui/dev_mode_without_arg_default_hasher.stderr @@ -1,19 +1,11 @@ -error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases +error: `_` can only be used in dev_mode. Please specify an appropriate hasher. --> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:21:47 | 21 | type MyStorageMap = StorageMap<_, _, u32, u64>; - | ^ not allowed in type signatures + | ^ -error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases - --> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:24:59 - | -24 | type MyStorageDoubleMap = StorageDoubleMap<_, _, u32, _, u64, u64>; - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases - --> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:27:61 - | -27 | type MyCountedStorageMap = CountedStorageMap<_, _, u32, u64>; - | ^ not allowed in type signatures +error[E0432]: unresolved import `pallet` + --> tests/pallet_ui/dev_mode_without_arg_default_hasher.rs:3:9 + | +3 | pub use pallet::*; + | ^^^^^^ help: a similar path exists: `test_pallet::pallet` From 4d608f9c42e8d70d835a748fa929e59a99497e90 Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Wed, 12 Apr 2023 12:05:11 +0200 Subject: [PATCH 15/93] invoke clippy with `--locked` (#13882) --- scripts/ci/gitlab/pipeline/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index 50f926215062d..bf7803d56505c 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -66,7 +66,7 @@ cargo-clippy: - .test-refs script: - rusty-cachier snapshot create - - SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --all-targets + - SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --locked --all-targets - rusty-cachier cache upload cargo-check-benches: From f751d63c1db7bbdb00930eba4ef2e2172ddac83a Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Wed, 12 Apr 2023 14:09:50 +0300 Subject: [PATCH 16/93] sc-consensus-beefy: add peer reputation cost/benefit changes (#13881) * add cost/benefit to gossip messages * report BEEFY gossip peer reputation changes * drop WorkerParams helper struct * add reputation costs to tests * add peer reputation cost/benefit to on-demand-requests protocol * include amount of signatures checked in invalid proof reputation cost Signed-off-by: Adrian Catangiu --- .../beefy/src/communication/gossip.rs | 264 ++++++++++++++---- .../consensus/beefy/src/communication/mod.rs | 33 +++ .../beefy/src/communication/peers.rs | 12 +- .../incoming_requests_handler.rs | 64 +++-- .../src/communication/request_response/mod.rs | 9 +- .../outgoing_requests_engine.rs | 76 +++-- client/consensus/beefy/src/import.rs | 1 + client/consensus/beefy/src/justification.rs | 40 +-- client/consensus/beefy/src/lib.rs | 19 +- client/consensus/beefy/src/metrics.rs | 10 +- client/consensus/beefy/src/tests.rs | 9 +- client/consensus/beefy/src/worker.rs | 118 +++----- 12 files changed, 430 insertions(+), 225 deletions(-) diff --git a/client/consensus/beefy/src/communication/gossip.rs b/client/consensus/beefy/src/communication/gossip.rs index 376172fc23370..9be648f8796c3 100644 --- a/client/consensus/beefy/src/communication/gossip.rs +++ b/client/consensus/beefy/src/communication/gossip.rs @@ -18,7 +18,7 @@ use std::{collections::BTreeMap, sync::Arc, time::Duration}; -use sc_network::PeerId; +use sc_network::{PeerId, ReputationChange}; use sc_network_gossip::{MessageIntent, ValidationResult, Validator, ValidatorContext}; use sp_core::hashing::twox_64; use sp_runtime::traits::{Block, Hash, Header, NumberFor}; @@ -26,10 +26,14 @@ use sp_runtime::traits::{Block, Hash, Header, NumberFor}; use codec::{Decode, Encode}; use log::{debug, trace}; use parking_lot::{Mutex, RwLock}; +use sc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; use wasm_timer::Instant; use crate::{ - communication::peers::KnownPeers, + communication::{ + benefit, cost, + peers::{KnownPeers, PeerReport}, + }, justification::{ proof_block_num_and_set_id, verify_with_validator_set, BeefyVersionedFinalityProof, }, @@ -47,6 +51,27 @@ const REBROADCAST_AFTER: Duration = Duration::from_secs(60); #[cfg(test)] const REBROADCAST_AFTER: Duration = Duration::from_secs(5); +#[derive(Debug, PartialEq)] +pub(super) enum Action { + // repropagate under given topic, to the given peers, applying cost/benefit to originator. + Keep(H, ReputationChange), + // discard, applying cost/benefit to originator. + Discard(ReputationChange), +} + +/// An outcome of examining a message. +#[derive(Debug, PartialEq, Clone, Copy)] +enum Consider { + /// Accept the message. + Accept, + /// Message is too early. Reject. + RejectPast, + /// Message is from the future. Reject. + RejectFuture, + /// Message cannot be evaluated. Reject. + RejectOutOfScope, +} + /// BEEFY gossip message type that gets encoded and sent on the network. #[derive(Debug, Encode, Decode)] pub(crate) enum GossipMessage { @@ -135,26 +160,47 @@ impl Filter { } } - /// Return true if `max(session_start, best_beefy) <= round <= best_grandpa`, + /// Accept if `max(session_start, best_beefy) <= round <= best_grandpa`, /// and vote `set_id` matches session set id. /// /// Latest concluded round is still considered alive to allow proper gossiping for it. - fn is_vote_accepted(&self, round: NumberFor, set_id: ValidatorSetId) -> bool { + fn consider_vote(&self, round: NumberFor, set_id: ValidatorSetId) -> Consider { self.inner .as_ref() - .map(|f| set_id == f.validator_set.id() && round >= f.start && round <= f.end) - .unwrap_or(false) + .map(|f| + // only from current set and only [filter.start, filter.end] + if set_id < f.validator_set.id() { + Consider::RejectPast + } else if set_id > f.validator_set.id() { + Consider::RejectFuture + } else if round < f.start { + Consider::RejectPast + } else if round > f.end { + Consider::RejectFuture + } else { + Consider::Accept + }) + .unwrap_or(Consider::RejectOutOfScope) } /// Return true if `round` is >= than `max(session_start, best_beefy)`, /// and proof `set_id` matches session set id. /// /// Latest concluded round is still considered alive to allow proper gossiping for it. - fn is_finality_proof_accepted(&self, round: NumberFor, set_id: ValidatorSetId) -> bool { + fn consider_finality_proof(&self, round: NumberFor, set_id: ValidatorSetId) -> Consider { self.inner .as_ref() - .map(|f| set_id == f.validator_set.id() && round >= f.start) - .unwrap_or(false) + .map(|f| + // only from current set and only >= filter.start + if round < f.start || set_id < f.validator_set.id() { + Consider::RejectPast + } else if set_id > f.validator_set.id() { + Consider::RejectFuture + } else { + Consider::Accept + } + ) + .unwrap_or(Consider::RejectOutOfScope) } /// Add new _known_ `hash` to the round's known votes. @@ -189,20 +235,26 @@ where gossip_filter: RwLock>, next_rebroadcast: Mutex, known_peers: Arc>>, + report_sender: TracingUnboundedSender, } impl GossipValidator where B: Block, { - pub fn new(known_peers: Arc>>) -> GossipValidator { - GossipValidator { + pub(crate) fn new( + known_peers: Arc>>, + ) -> (GossipValidator, TracingUnboundedReceiver) { + let (tx, rx) = tracing_unbounded("mpsc_beefy_gossip_validator", 10_000); + let val = GossipValidator { votes_topic: votes_topic::(), justifs_topic: proofs_topic::(), gossip_filter: RwLock::new(Filter::new()), next_rebroadcast: Mutex::new(Instant::now() + REBROADCAST_AFTER), known_peers, - } + report_sender: tx, + }; + (val, rx) } /// Update gossip validator filter. @@ -213,12 +265,16 @@ where self.gossip_filter.write().update(filter); } + fn report(&self, who: PeerId, cost_benefit: ReputationChange) { + let _ = self.report_sender.unbounded_send(PeerReport { who, cost_benefit }); + } + fn validate_vote( &self, vote: VoteMessage, AuthorityId, Signature>, sender: &PeerId, data: &[u8], - ) -> ValidationResult { + ) -> Action { let msg_hash = twox_64(data); let round = vote.commitment.block_number; let set_id = vote.commitment.validator_set_id; @@ -230,25 +286,37 @@ where { let filter = self.gossip_filter.read(); - if !filter.is_vote_accepted(round, set_id) { - return ValidationResult::Discard + match filter.consider_vote(round, set_id) { + Consider::RejectPast => return Action::Discard(cost::OUTDATED_MESSAGE), + Consider::RejectFuture => return Action::Discard(cost::FUTURE_MESSAGE), + Consider::RejectOutOfScope => return Action::Discard(cost::OUT_OF_SCOPE_MESSAGE), + Consider::Accept => {}, } if filter.is_known_vote(round, &msg_hash) { - return ValidationResult::ProcessAndKeep(self.votes_topic) + return Action::Keep(self.votes_topic, benefit::KNOWN_VOTE_MESSAGE) + } + + // ensure authority is part of the set. + if !filter + .validator_set() + .map(|set| set.validators().contains(&vote.id)) + .unwrap_or(false) + { + debug!(target: LOG_TARGET, "Message from voter not in validator set: {}", vote.id); + return Action::Discard(cost::UNKNOWN_VOTER) } } if BeefyKeystore::verify(&vote.id, &vote.signature, &vote.commitment.encode()) { self.gossip_filter.write().add_known_vote(round, msg_hash); - ValidationResult::ProcessAndKeep(self.votes_topic) + Action::Keep(self.votes_topic, benefit::VOTE_MESSAGE) } else { - // TODO: report peer debug!( target: LOG_TARGET, "🥩 Bad signature on message: {:?}, from: {:?}", vote, sender ); - ValidationResult::Discard + Action::Discard(cost::BAD_SIGNATURE) } } @@ -256,31 +324,38 @@ where &self, proof: BeefyVersionedFinalityProof, sender: &PeerId, - ) -> ValidationResult { + ) -> Action { let (round, set_id) = proof_block_num_and_set_id::(&proof); self.known_peers.lock().note_vote_for(*sender, round); let guard = self.gossip_filter.read(); - // Verify general usefulness of the justifications. - if !guard.is_finality_proof_accepted(round, set_id) { - return ValidationResult::Discard + // Verify general usefulness of the justification. + match guard.consider_finality_proof(round, set_id) { + Consider::RejectPast => return Action::Discard(cost::OUTDATED_MESSAGE), + Consider::RejectFuture => return Action::Discard(cost::FUTURE_MESSAGE), + Consider::RejectOutOfScope => return Action::Discard(cost::OUT_OF_SCOPE_MESSAGE), + Consider::Accept => {}, } // Verify justification signatures. guard .validator_set() .map(|validator_set| { - if let Ok(()) = verify_with_validator_set::(round, validator_set, &proof) { - ValidationResult::ProcessAndKeep(self.justifs_topic) - } else { - // TODO: report peer + if let Err((_, signatures_checked)) = + verify_with_validator_set::(round, validator_set, &proof) + { debug!( target: LOG_TARGET, "🥩 Bad signatures on message: {:?}, from: {:?}", proof, sender ); - ValidationResult::Discard + let mut cost = cost::INVALID_PROOF; + cost.value += + cost::PER_SIGNATURE_CHECKED.saturating_mul(signatures_checked as i32); + Action::Discard(cost) + } else { + Action::Keep(self.justifs_topic, benefit::VALIDATED_PROOF) } }) - .unwrap_or(ValidationResult::Discard) + .unwrap_or(Action::Discard(cost::OUT_OF_SCOPE_MESSAGE)) } } @@ -294,15 +369,32 @@ where fn validate( &self, - _context: &mut dyn ValidatorContext, + context: &mut dyn ValidatorContext, sender: &PeerId, mut data: &[u8], ) -> ValidationResult { - match GossipMessage::::decode(&mut data) { - Ok(GossipMessage::Vote(msg)) => self.validate_vote(msg, sender, data), + let raw = data; + let action = match GossipMessage::::decode(&mut data) { + Ok(GossipMessage::Vote(msg)) => self.validate_vote(msg, sender, raw), Ok(GossipMessage::FinalityProof(proof)) => self.validate_finality_proof(proof, sender), Err(e) => { debug!(target: LOG_TARGET, "Error decoding message: {}", e); + let bytes = raw.len().min(i32::MAX as usize) as i32; + let cost = ReputationChange::new( + bytes.saturating_mul(cost::PER_UNDECODABLE_BYTE), + "BEEFY: Bad packet", + ); + Action::Discard(cost) + }, + }; + match action { + Action::Keep(topic, cb) => { + self.report(*sender, cb); + context.broadcast_message(topic, data.to_vec(), false); + ValidationResult::ProcessAndKeep(topic) + }, + Action::Discard(cb) => { + self.report(*sender, cb); ValidationResult::Discard }, } @@ -314,13 +406,13 @@ where Ok(GossipMessage::Vote(msg)) => { let round = msg.commitment.block_number; let set_id = msg.commitment.validator_set_id; - let expired = !filter.is_vote_accepted(round, set_id); + let expired = filter.consider_vote(round, set_id) != Consider::Accept; trace!(target: LOG_TARGET, "🥩 Vote for round #{} expired: {}", round, expired); expired }, Ok(GossipMessage::FinalityProof(proof)) => { let (round, set_id) = proof_block_num_and_set_id::(&proof); - let expired = !filter.is_finality_proof_accepted(round, set_id); + let expired = filter.consider_finality_proof(round, set_id) != Consider::Accept; trace!( target: LOG_TARGET, "🥩 Finality proof for round #{} expired: {}", @@ -358,13 +450,13 @@ where Ok(GossipMessage::Vote(msg)) => { let round = msg.commitment.block_number; let set_id = msg.commitment.validator_set_id; - let allowed = filter.is_vote_accepted(round, set_id); + let allowed = filter.consider_vote(round, set_id) == Consider::Accept; trace!(target: LOG_TARGET, "🥩 Vote for round #{} allowed: {}", round, allowed); allowed }, Ok(GossipMessage::FinalityProof(proof)) => { let (round, set_id) = proof_block_num_and_set_id::(&proof); - let allowed = filter.is_finality_proof_accepted(round, set_id); + let allowed = filter.consider_finality_proof(round, set_id) == Consider::Accept; trace!( target: LOG_TARGET, "🥩 Finality proof for round #{} allowed: {}", @@ -409,15 +501,16 @@ pub(crate) mod tests { assert_eq!(filter.live_votes.len(), 3); assert!(filter.inner.is_none()); - assert!(!filter.is_vote_accepted(1, 1)); + assert_eq!(filter.consider_vote(1, 1), Consider::RejectOutOfScope); filter.update(GossipFilterCfg { start: 3, end: 10, validator_set: &validator_set }); assert_eq!(filter.live_votes.len(), 1); assert!(filter.live_votes.contains_key(&3)); - assert!(!filter.is_vote_accepted(2, 1)); - assert!(filter.is_vote_accepted(3, 1)); - assert!(filter.is_vote_accepted(4, 1)); - assert!(!filter.is_vote_accepted(4, 2)); + assert_eq!(filter.consider_vote(2, 1), Consider::RejectPast); + assert_eq!(filter.consider_vote(3, 1), Consider::Accept); + assert_eq!(filter.consider_vote(4, 1), Consider::Accept); + assert_eq!(filter.consider_vote(20, 1), Consider::RejectFuture); + assert_eq!(filter.consider_vote(4, 2), Consider::RejectFuture); let validator_set = ValidatorSet::::new(keys, 2).unwrap(); filter.update(GossipFilterCfg { start: 5, end: 10, validator_set: &validator_set }); @@ -430,9 +523,7 @@ pub(crate) mod tests { todo!() } - fn broadcast_message(&mut self, _topic: B::Hash, _message: Vec, _force: bool) { - todo!() - } + fn broadcast_message(&mut self, _topic: B::Hash, _message: Vec, _force: bool) {} fn send_message(&mut self, _who: &sc_network::PeerId, _message: Vec) { todo!() @@ -485,18 +576,39 @@ pub(crate) mod tests { fn should_validate_messages() { let keys = vec![Keyring::Alice.public()]; let validator_set = ValidatorSet::::new(keys.clone(), 0).unwrap(); - let gv = GossipValidator::::new(Arc::new(Mutex::new(KnownPeers::new()))); - gv.update_filter(GossipFilterCfg { start: 0, end: 10, validator_set: &validator_set }); - let sender = sc_network::PeerId::random(); + let (gv, mut report_stream) = + GossipValidator::::new(Arc::new(Mutex::new(KnownPeers::new()))); + let sender = PeerId::random(); let mut context = TestContext; + // reject message, decoding error + let bad_encoding = b"0000000000".as_slice(); + let expected_cost = ReputationChange::new( + (bad_encoding.len() as i32).saturating_mul(cost::PER_UNDECODABLE_BYTE), + "BEEFY: Bad packet", + ); + let mut expected_report = PeerReport { who: sender, cost_benefit: expected_cost }; + let res = gv.validate(&mut context, &sender, bad_encoding); + assert!(matches!(res, ValidationResult::Discard)); + assert_eq!(report_stream.try_recv().unwrap(), expected_report); + + // verify votes validation + let vote = dummy_vote(3); - let gossip_vote = GossipMessage::::Vote(vote.clone()); + let encoded = GossipMessage::::Vote(vote.clone()).encode(); - // first time the cache should be populated - let res = gv.validate(&mut context, &sender, &gossip_vote.encode()); + // filter not initialized + let res = gv.validate(&mut context, &sender, &encoded); + assert!(matches!(res, ValidationResult::Discard)); + expected_report.cost_benefit = cost::OUT_OF_SCOPE_MESSAGE; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); + gv.update_filter(GossipFilterCfg { start: 0, end: 10, validator_set: &validator_set }); + // nothing in cache first time + let res = gv.validate(&mut context, &sender, &encoded); assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); + expected_report.cost_benefit = benefit::VOTE_MESSAGE; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); assert_eq!( gv.gossip_filter .read() @@ -507,43 +619,74 @@ pub(crate) mod tests { ); // second time we should hit the cache - let res = gv.validate(&mut context, &sender, &gossip_vote.encode()); + let res = gv.validate(&mut context, &sender, &encoded); assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); + expected_report.cost_benefit = benefit::KNOWN_VOTE_MESSAGE; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); + + // reject vote, voter not in validator set + let mut bad_vote = vote.clone(); + bad_vote.id = Keyring::Bob.public(); + let bad_vote = GossipMessage::::Vote(bad_vote).encode(); + let res = gv.validate(&mut context, &sender, &bad_vote); + assert!(matches!(res, ValidationResult::Discard)); + expected_report.cost_benefit = cost::UNKNOWN_VOTER; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); - // next we should quickly reject if the round is not live - gv.update_filter(GossipFilterCfg { start: 7, end: 10, validator_set: &validator_set }); - + // reject if the round is not GRANDPA finalized + gv.update_filter(GossipFilterCfg { start: 1, end: 2, validator_set: &validator_set }); let number = vote.commitment.block_number; let set_id = vote.commitment.validator_set_id; - assert!(!gv.gossip_filter.read().is_vote_accepted(number, set_id)); + assert_eq!(gv.gossip_filter.read().consider_vote(number, set_id), Consider::RejectFuture); + let res = gv.validate(&mut context, &sender, &encoded); + assert!(matches!(res, ValidationResult::Discard)); + expected_report.cost_benefit = cost::FUTURE_MESSAGE; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); - let res = gv.validate(&mut context, &sender, &vote.encode()); + // reject if the round is not live anymore + gv.update_filter(GossipFilterCfg { start: 7, end: 10, validator_set: &validator_set }); + let number = vote.commitment.block_number; + let set_id = vote.commitment.validator_set_id; + assert_eq!(gv.gossip_filter.read().consider_vote(number, set_id), Consider::RejectPast); + let res = gv.validate(&mut context, &sender, &encoded); assert!(matches!(res, ValidationResult::Discard)); + expected_report.cost_benefit = cost::OUTDATED_MESSAGE; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); + + // now verify proofs validation // reject old proof let proof = dummy_proof(5, &validator_set); let encoded_proof = GossipMessage::::FinalityProof(proof).encode(); let res = gv.validate(&mut context, &sender, &encoded_proof); assert!(matches!(res, ValidationResult::Discard)); + expected_report.cost_benefit = cost::OUTDATED_MESSAGE; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); // accept next proof with good set_id let proof = dummy_proof(7, &validator_set); let encoded_proof = GossipMessage::::FinalityProof(proof).encode(); let res = gv.validate(&mut context, &sender, &encoded_proof); assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); + expected_report.cost_benefit = benefit::VALIDATED_PROOF; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); // accept future proof with good set_id let proof = dummy_proof(20, &validator_set); let encoded_proof = GossipMessage::::FinalityProof(proof).encode(); let res = gv.validate(&mut context, &sender, &encoded_proof); assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); + expected_report.cost_benefit = benefit::VALIDATED_PROOF; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); - // reject proof, wrong set_id + // reject proof, future set_id let bad_validator_set = ValidatorSet::::new(keys, 1).unwrap(); let proof = dummy_proof(20, &bad_validator_set); let encoded_proof = GossipMessage::::FinalityProof(proof).encode(); let res = gv.validate(&mut context, &sender, &encoded_proof); assert!(matches!(res, ValidationResult::Discard)); + expected_report.cost_benefit = cost::FUTURE_MESSAGE; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); // reject proof, bad signatures (Bob instead of Alice) let bad_validator_set = @@ -552,13 +695,16 @@ pub(crate) mod tests { let encoded_proof = GossipMessage::::FinalityProof(proof).encode(); let res = gv.validate(&mut context, &sender, &encoded_proof); assert!(matches!(res, ValidationResult::Discard)); + expected_report.cost_benefit = cost::INVALID_PROOF; + expected_report.cost_benefit.value += cost::PER_SIGNATURE_CHECKED; + assert_eq!(report_stream.try_recv().unwrap(), expected_report); } #[test] fn messages_allowed_and_expired() { let keys = vec![Keyring::Alice.public()]; let validator_set = ValidatorSet::::new(keys.clone(), 0).unwrap(); - let gv = GossipValidator::::new(Arc::new(Mutex::new(KnownPeers::new()))); + let (gv, _) = GossipValidator::::new(Arc::new(Mutex::new(KnownPeers::new()))); gv.update_filter(GossipFilterCfg { start: 0, end: 10, validator_set: &validator_set }); let sender = sc_network::PeerId::random(); let topic = Default::default(); @@ -635,7 +781,7 @@ pub(crate) mod tests { fn messages_rebroadcast() { let keys = vec![Keyring::Alice.public()]; let validator_set = ValidatorSet::::new(keys.clone(), 0).unwrap(); - let gv = GossipValidator::::new(Arc::new(Mutex::new(KnownPeers::new()))); + let (gv, _) = GossipValidator::::new(Arc::new(Mutex::new(KnownPeers::new()))); gv.update_filter(GossipFilterCfg { start: 0, end: 10, validator_set: &validator_set }); let sender = sc_network::PeerId::random(); let topic = Default::default(); diff --git a/client/consensus/beefy/src/communication/mod.rs b/client/consensus/beefy/src/communication/mod.rs index 13735a9d3211b..d8e4d22053628 100644 --- a/client/consensus/beefy/src/communication/mod.rs +++ b/client/consensus/beefy/src/communication/mod.rs @@ -73,6 +73,39 @@ pub fn beefy_peers_set_config( cfg } +// cost scalars for reporting peers. +mod cost { + use sc_network::ReputationChange as Rep; + // Message that's for an outdated round. + pub(super) const OUTDATED_MESSAGE: Rep = Rep::new(-50, "BEEFY: Past message"); + // Message that's from the future relative to our current set-id. + pub(super) const FUTURE_MESSAGE: Rep = Rep::new(-100, "BEEFY: Future message"); + // Vote message containing bad signature. + pub(super) const BAD_SIGNATURE: Rep = Rep::new(-100, "BEEFY: Bad signature"); + // Message received with vote from voter not in validator set. + pub(super) const UNKNOWN_VOTER: Rep = Rep::new(-150, "BEEFY: Unknown voter"); + // A message received that cannot be evaluated relative to our current state. + pub(super) const OUT_OF_SCOPE_MESSAGE: Rep = Rep::new(-500, "BEEFY: Out-of-scope message"); + // Message containing invalid proof. + pub(super) const INVALID_PROOF: Rep = Rep::new(-5000, "BEEFY: Invalid commit"); + // Reputation cost per signature checked for invalid proof. + pub(super) const PER_SIGNATURE_CHECKED: i32 = -25; + // Reputation cost per byte for un-decodable message. + pub(super) const PER_UNDECODABLE_BYTE: i32 = -5; + // On-demand request was refused by peer. + pub(super) const REFUSAL_RESPONSE: Rep = Rep::new(-100, "BEEFY: Proof request refused"); + // On-demand request for a proof that can't be found in the backend. + pub(super) const UNKOWN_PROOF_REQUEST: Rep = Rep::new(-150, "BEEFY: Unknown proof request"); +} + +// benefit scalars for reporting peers. +mod benefit { + use sc_network::ReputationChange as Rep; + pub(super) const VOTE_MESSAGE: Rep = Rep::new(100, "BEEFY: Round vote message"); + pub(super) const KNOWN_VOTE_MESSAGE: Rep = Rep::new(50, "BEEFY: Known vote"); + pub(super) const VALIDATED_PROOF: Rep = Rep::new(100, "BEEFY: Justification"); +} + #[cfg(test)] mod tests { use super::*; diff --git a/client/consensus/beefy/src/communication/peers.rs b/client/consensus/beefy/src/communication/peers.rs index c2fb06faddf0c..4704b8dcf4576 100644 --- a/client/consensus/beefy/src/communication/peers.rs +++ b/client/consensus/beefy/src/communication/peers.rs @@ -18,13 +18,17 @@ //! Logic for keeping track of BEEFY peers. -// TODO (issue #12296): replace this naive peer tracking with generic one that infers data -// from multiple network protocols. - -use sc_network::PeerId; +use sc_network::{PeerId, ReputationChange}; use sp_runtime::traits::{Block, NumberFor, Zero}; use std::collections::{HashMap, VecDeque}; +/// Report specifying a reputation change for a given peer. +#[derive(Debug, PartialEq)] +pub(crate) struct PeerReport { + pub who: PeerId, + pub cost_benefit: ReputationChange, +} + struct PeerData { last_voted_on: NumberFor, } diff --git a/client/consensus/beefy/src/communication/request_response/incoming_requests_handler.rs b/client/consensus/beefy/src/communication/request_response/incoming_requests_handler.rs index 1670e99828831..d4f4b59f0195e 100644 --- a/client/consensus/beefy/src/communication/request_response/incoming_requests_handler.rs +++ b/client/consensus/beefy/src/communication/request_response/incoming_requests_handler.rs @@ -32,9 +32,12 @@ use sp_runtime::traits::Block; use std::{marker::PhantomData, sync::Arc}; use crate::{ - communication::request_response::{ - on_demand_justifications_protocol_config, Error, JustificationRequest, - BEEFY_SYNC_LOG_TARGET, + communication::{ + cost, + request_response::{ + on_demand_justifications_protocol_config, Error, JustificationRequest, + BEEFY_SYNC_LOG_TARGET, + }, }, metric_inc, metrics::{register_metrics, OnDemandIncomingRequestsMetrics}, @@ -69,17 +72,20 @@ impl IncomingRequest { /// Params: /// - The raw request to decode /// - Reputation changes to apply for the peer in case decoding fails. - pub fn try_from_raw( + pub fn try_from_raw( raw: netconfig::IncomingRequest, - reputation_changes: Vec, - ) -> Result { + reputation_changes_on_err: F, + ) -> Result + where + F: FnOnce(usize) -> Vec, + { let netconfig::IncomingRequest { payload, peer, pending_response } = raw; let payload = match JustificationRequest::decode(&mut payload.as_ref()) { Ok(payload) => payload, Err(err) => { let response = netconfig::OutgoingResponse { result: Err(()), - reputation_changes, + reputation_changes: reputation_changes_on_err(payload.len()), sent_feedback: None, }; if let Err(_) = pending_response.send(response) { @@ -111,11 +117,11 @@ impl IncomingRequestReceiver { pub async fn recv(&mut self, reputation_changes: F) -> Result, Error> where B: Block, - F: FnOnce() -> Vec, + F: FnOnce(usize) -> Vec, { let req = match self.raw.next().await { None => return Err(Error::RequestChannelExhausted), - Some(raw) => IncomingRequest::::try_from_raw(raw, reputation_changes())?, + Some(raw) => IncomingRequest::::try_from_raw(raw, reputation_changes)?, }; Ok(req) } @@ -159,26 +165,20 @@ where // Sends back justification response if justification found in client backend. fn handle_request(&self, request: IncomingRequest) -> Result<(), Error> { - // TODO (issue #12293): validate `request` and change peer reputation for invalid requests. - - let maybe_encoded_proof = if let Some(hash) = - self.client.block_hash(request.payload.begin).map_err(Error::Client)? - { - self.client - .justifications(hash) - .map_err(Error::Client)? - .and_then(|justifs| justifs.get(BEEFY_ENGINE_ID).cloned()) - // No BEEFY justification present. - .ok_or(()) - } else { - Err(()) - }; - + let mut reputation_changes = vec![]; + let maybe_encoded_proof = self + .client + .block_hash(request.payload.begin) + .ok() + .flatten() + .and_then(|hash| self.client.justifications(hash).ok().flatten()) + .and_then(|justifs| justifs.get(BEEFY_ENGINE_ID).cloned()) + .ok_or_else(|| reputation_changes.push(cost::UNKOWN_PROOF_REQUEST)); request .pending_response .send(netconfig::OutgoingResponse { result: maybe_encoded_proof, - reputation_changes: Vec::new(), + reputation_changes, sent_feedback: None, }) .map_err(|_| Error::SendResponse) @@ -188,7 +188,17 @@ where pub async fn run(mut self) { trace!(target: BEEFY_SYNC_LOG_TARGET, "🥩 Running BeefyJustifsRequestHandler"); - while let Ok(request) = self.request_receiver.recv(|| vec![]).await { + while let Ok(request) = self + .request_receiver + .recv(|bytes| { + let bytes = bytes.min(i32::MAX as usize) as i32; + vec![ReputationChange::new( + bytes.saturating_mul(cost::PER_UNDECODABLE_BYTE), + "BEEFY: Bad request payload", + )] + }) + .await + { let peer = request.peer; match self.handle_request(request) { Ok(()) => { @@ -199,8 +209,8 @@ where ) }, Err(e) => { + // peer reputation changes already applied in `self.handle_request()` metric_inc!(self, beefy_failed_justification_responses); - // TODO (issue #12293): apply reputation changes here based on error type. debug!( target: BEEFY_SYNC_LOG_TARGET, "🥩 Failed to handle BEEFY justification request from {:?}: {}", peer, e, diff --git a/client/consensus/beefy/src/communication/request_response/mod.rs b/client/consensus/beefy/src/communication/request_response/mod.rs index c528d06bbe0c5..545ab18cf1d34 100644 --- a/client/consensus/beefy/src/communication/request_response/mod.rs +++ b/client/consensus/beefy/src/communication/request_response/mod.rs @@ -30,7 +30,7 @@ use codec::{Decode, Encode, Error as CodecError}; use sc_network::{config::RequestResponseConfig, PeerId}; use sp_runtime::traits::{Block, NumberFor}; -use crate::communication::beefy_protocol_name::justifications_protocol_name; +use crate::communication::{beefy_protocol_name::justifications_protocol_name, peers::PeerReport}; use incoming_requests_handler::IncomingRequestReceiver; // 10 seems reasonable, considering justifs are explicitly requested only @@ -76,7 +76,7 @@ pub struct JustificationRequest { } #[derive(Debug, thiserror::Error)] -pub enum Error { +pub(crate) enum Error { #[error(transparent)] Client(#[from] sp_blockchain::Error), @@ -99,5 +99,8 @@ pub enum Error { SendResponse, #[error("Received invalid response.")] - InvalidResponse, + InvalidResponse(PeerReport), + + #[error("Internal error while getting response.")] + ResponseError, } diff --git a/client/consensus/beefy/src/communication/request_response/outgoing_requests_engine.rs b/client/consensus/beefy/src/communication/request_response/outgoing_requests_engine.rs index fbf464bd639d9..10105ff2d417d 100644 --- a/client/consensus/beefy/src/communication/request_response/outgoing_requests_engine.rs +++ b/client/consensus/beefy/src/communication/request_response/outgoing_requests_engine.rs @@ -31,7 +31,11 @@ use sp_runtime::traits::{Block, NumberFor}; use std::{collections::VecDeque, result::Result, sync::Arc}; use crate::{ - communication::request_response::{Error, JustificationRequest, BEEFY_SYNC_LOG_TARGET}, + communication::{ + benefit, cost, + peers::PeerReport, + request_response::{Error, JustificationRequest, BEEFY_SYNC_LOG_TARGET}, + }, justification::{decode_and_verify_finality_proof, BeefyVersionedFinalityProof}, metric_inc, metrics::{register_metrics, OnDemandOutgoingRequestsMetrics}, @@ -54,6 +58,16 @@ enum State { AwaitingResponse(PeerId, RequestInfo, ResponseReceiver), } +/// Possible engine responses. +pub(crate) enum ResponseInfo { + /// No peer response available yet. + Pending, + /// Valid justification provided alongside peer reputation changes. + ValidProof(BeefyVersionedFinalityProof, PeerReport), + /// No justification yet, only peer reputation changes. + PeerReport(PeerReport), +} + pub struct OnDemandJustificationsEngine { network: Arc, protocol_name: ProtocolName, @@ -84,12 +98,10 @@ impl OnDemandJustificationsEngine { } fn reset_peers_cache_for_block(&mut self, block: NumberFor) { - // TODO (issue #12296): replace peer selection with generic one that involves all protocols. self.peers_cache = self.live_peers.lock().further_than(block); } fn try_next_peer(&mut self) -> Option { - // TODO (issue #12296): replace peer selection with generic one that involves all protocols. let live = self.live_peers.lock(); while let Some(peer) = self.peers_cache.pop_front() { if live.contains(&peer) { @@ -159,24 +171,19 @@ impl OnDemandJustificationsEngine { fn process_response( &mut self, - peer: PeerId, + peer: &PeerId, req_info: &RequestInfo, response: Result, ) -> Result, Error> { response .map_err(|e| { - metric_inc!(self, beefy_on_demand_justification_peer_hang_up); debug!( target: BEEFY_SYNC_LOG_TARGET, - "🥩 for on demand justification #{:?}, peer {:?} hung up: {:?}", - req_info.block, - peer, - e + "🥩 on-demand sc-network channel sender closed, err: {:?}", e ); - Error::InvalidResponse + Error::ResponseError })? .map_err(|e| { - metric_inc!(self, beefy_on_demand_justification_peer_error); debug!( target: BEEFY_SYNC_LOG_TARGET, "🥩 for on demand justification #{:?}, peer {:?} error: {:?}", @@ -184,7 +191,18 @@ impl OnDemandJustificationsEngine { peer, e ); - Error::InvalidResponse + match e { + RequestFailure::Refused => { + metric_inc!(self, beefy_on_demand_justification_peer_refused); + let peer_report = + PeerReport { who: *peer, cost_benefit: cost::REFUSAL_RESPONSE }; + Error::InvalidResponse(peer_report) + }, + _ => { + metric_inc!(self, beefy_on_demand_justification_peer_error); + Error::ResponseError + }, + } }) .and_then(|encoded| { decode_and_verify_finality_proof::( @@ -192,23 +210,26 @@ impl OnDemandJustificationsEngine { req_info.block, &req_info.active_set, ) - .map_err(|e| { + .map_err(|(err, signatures_checked)| { metric_inc!(self, beefy_on_demand_justification_invalid_proof); debug!( target: BEEFY_SYNC_LOG_TARGET, "🥩 for on demand justification #{:?}, peer {:?} responded with invalid proof: {:?}", - req_info.block, peer, e + req_info.block, peer, err ); - Error::InvalidResponse + let mut cost = cost::INVALID_PROOF; + cost.value += + cost::PER_SIGNATURE_CHECKED.saturating_mul(signatures_checked as i32); + Error::InvalidResponse(PeerReport { who: *peer, cost_benefit: cost }) }) }) } - pub async fn next(&mut self) -> Option> { + pub(crate) async fn next(&mut self) -> ResponseInfo { let (peer, req_info, resp) = match &mut self.state { State::Idle => { futures::future::pending::<()>().await; - return None + return ResponseInfo::Pending }, State::AwaitingResponse(peer, req_info, receiver) => { let resp = receiver.await; @@ -220,8 +241,8 @@ impl OnDemandJustificationsEngine { self.state = State::Idle; let block = req_info.block; - self.process_response(peer, &req_info, resp) - .map_err(|_| { + match self.process_response(&peer, &req_info, resp) { + Err(err) => { // No valid justification received, try next peer in our set. if let Some(peer) = self.try_next_peer() { self.request_from_peer(peer, req_info); @@ -231,15 +252,22 @@ impl OnDemandJustificationsEngine { "🥩 ran out of peers to request justif #{:?} from", block ); } - }) - .map(|proof| { + // Report peer based on error type. + if let Error::InvalidResponse(peer_report) = err { + ResponseInfo::PeerReport(peer_report) + } else { + ResponseInfo::Pending + } + }, + Ok(proof) => { metric_inc!(self, beefy_on_demand_justification_good_proof); debug!( target: BEEFY_SYNC_LOG_TARGET, "🥩 received valid on-demand justif #{:?} from {:?}", block, peer ); - proof - }) - .ok() + let peer_report = PeerReport { who: peer, cost_benefit: benefit::VALIDATED_PROOF }; + ResponseInfo::ValidProof(proof, peer_report) + }, + } } } diff --git a/client/consensus/beefy/src/import.rs b/client/consensus/beefy/src/import.rs index dd2ed92ef8353..bda8169d95013 100644 --- a/client/consensus/beefy/src/import.rs +++ b/client/consensus/beefy/src/import.rs @@ -109,6 +109,7 @@ where .ok_or_else(|| ImportError("Unknown validator set".to_string()))?; decode_and_verify_finality_proof::(&encoded[..], number, &validator_set) + .map_err(|(err, _)| err) } } diff --git a/client/consensus/beefy/src/justification.rs b/client/consensus/beefy/src/justification.rs index 5175fd17d4ea3..731acdfa63389 100644 --- a/client/consensus/beefy/src/justification.rs +++ b/client/consensus/beefy/src/justification.rs @@ -42,9 +42,9 @@ pub(crate) fn decode_and_verify_finality_proof( encoded: &[u8], target_number: NumberFor, validator_set: &ValidatorSet, -) -> Result, ConsensusError> { +) -> Result, (ConsensusError, u32)> { let proof = >::decode(&mut &*encoded) - .map_err(|_| ConsensusError::InvalidJustification)?; + .map_err(|_| (ConsensusError::InvalidJustification, 0))?; verify_with_validator_set::(target_number, validator_set, &proof).map(|_| proof) } @@ -53,14 +53,15 @@ pub(crate) fn verify_with_validator_set( target_number: NumberFor, validator_set: &ValidatorSet, proof: &BeefyVersionedFinalityProof, -) -> Result<(), ConsensusError> { +) -> Result<(), (ConsensusError, u32)> { + let mut signatures_checked = 0u32; match proof { VersionedFinalityProof::V1(signed_commitment) => { if signed_commitment.signatures.len() != validator_set.len() || signed_commitment.commitment.validator_set_id != validator_set.id() || signed_commitment.commitment.block_number != target_number { - return Err(ConsensusError::InvalidJustification) + return Err((ConsensusError::InvalidJustification, 0)) } // Arrangement of signatures in the commitment should be in the same order @@ -73,14 +74,17 @@ pub(crate) fn verify_with_validator_set( .filter(|(id, signature)| { signature .as_ref() - .map(|sig| BeefyKeystore::verify(id, sig, &message[..])) + .map(|sig| { + signatures_checked += 1; + BeefyKeystore::verify(id, sig, &message[..]) + }) .unwrap_or(false) }) .count(); if valid_signatures >= crate::round::threshold(validator_set.len()) { Ok(()) } else { - Err(ConsensusError::InvalidJustification) + Err((ConsensusError::InvalidJustification, signatures_checked)) } }, } @@ -127,16 +131,16 @@ pub(crate) mod tests { // wrong block number -> should fail verification let good_proof = proof.clone().into(); match verify_with_validator_set::(block_num + 1, &validator_set, &good_proof) { - Err(ConsensusError::InvalidJustification) => (), - _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"), + Err((ConsensusError::InvalidJustification, 0)) => (), + e => assert!(false, "Got unexpected {:?}", e), }; // wrong validator set id -> should fail verification let good_proof = proof.clone().into(); let other = ValidatorSet::new(make_beefy_ids(keys), 1).unwrap(); match verify_with_validator_set::(block_num, &other, &good_proof) { - Err(ConsensusError::InvalidJustification) => (), - _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"), + Err((ConsensusError::InvalidJustification, 0)) => (), + e => assert!(false, "Got unexpected {:?}", e), }; // wrong signatures length -> should fail verification @@ -147,8 +151,8 @@ pub(crate) mod tests { }; bad_signed_commitment.signatures.pop().flatten().unwrap(); match verify_with_validator_set::(block_num + 1, &validator_set, &bad_proof.into()) { - Err(ConsensusError::InvalidJustification) => (), - _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"), + Err((ConsensusError::InvalidJustification, 0)) => (), + e => assert!(false, "Got unexpected {:?}", e), }; // not enough signatures -> should fail verification @@ -158,9 +162,9 @@ pub(crate) mod tests { }; // remove a signature (but same length) *bad_signed_commitment.signatures.first_mut().unwrap() = None; - match verify_with_validator_set::(block_num + 1, &validator_set, &bad_proof.into()) { - Err(ConsensusError::InvalidJustification) => (), - _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"), + match verify_with_validator_set::(block_num, &validator_set, &bad_proof.into()) { + Err((ConsensusError::InvalidJustification, 2)) => (), + e => assert!(false, "Got unexpected {:?}", e), }; // not enough _correct_ signatures -> should fail verification @@ -171,9 +175,9 @@ pub(crate) mod tests { // change a signature to a different key *bad_signed_commitment.signatures.first_mut().unwrap() = Some(Keyring::Dave.sign(&bad_signed_commitment.commitment.encode())); - match verify_with_validator_set::(block_num + 1, &validator_set, &bad_proof.into()) { - Err(ConsensusError::InvalidJustification) => (), - _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"), + match verify_with_validator_set::(block_num, &validator_set, &bad_proof.into()) { + Err((ConsensusError::InvalidJustification, 3)) => (), + e => assert!(false, "Got unexpected {:?}", e), }; } diff --git a/client/consensus/beefy/src/lib.rs b/client/consensus/beefy/src/lib.rs index 3c66cc6eb716d..d3e5e4bc68936 100644 --- a/client/consensus/beefy/src/lib.rs +++ b/client/consensus/beefy/src/lib.rs @@ -52,7 +52,11 @@ use sp_consensus_beefy::{ use sp_keystore::KeystorePtr; use sp_mmr_primitives::MmrApi; use sp_runtime::traits::{Block, Zero}; -use std::{collections::VecDeque, marker::PhantomData, sync::Arc}; +use std::{ + collections::{BTreeMap, VecDeque}, + marker::PhantomData, + sync::Arc, +}; mod aux_schema; mod error; @@ -249,9 +253,10 @@ pub async fn start_beefy_gadget( let known_peers = Arc::new(Mutex::new(KnownPeers::new())); // Default votes filter is to discard everything. // Validator is updated later with correct starting round and set id. - let gossip_validator = - Arc::new(communication::gossip::GossipValidator::new(known_peers.clone())); - let mut gossip_engine = sc_network_gossip::GossipEngine::new( + let (gossip_validator, gossip_report_stream) = + communication::gossip::GossipValidator::new(known_peers.clone()); + let gossip_validator = Arc::new(gossip_validator); + let mut gossip_engine = GossipEngine::new( network.clone(), sync.clone(), gossip_protocol_name, @@ -295,7 +300,7 @@ pub async fn start_beefy_gadget( return } - let worker_params = worker::WorkerParams { + let worker = worker::BeefyWorker { backend, payload_provider, runtime, @@ -303,14 +308,14 @@ pub async fn start_beefy_gadget( key_store: key_store.into(), gossip_engine, gossip_validator, + gossip_report_stream, on_demand_justifications, links, metrics, + pending_justifications: BTreeMap::new(), persisted_state, }; - let worker = worker::BeefyWorker::<_, _, _, _, _>::new(worker_params); - futures::future::join( worker.run(block_import_justif, finality_notifications), on_demand_justifications_handler.run(), diff --git a/client/consensus/beefy/src/metrics.rs b/client/consensus/beefy/src/metrics.rs index 6653763fc6754..031748bdceab5 100644 --- a/client/consensus/beefy/src/metrics.rs +++ b/client/consensus/beefy/src/metrics.rs @@ -228,8 +228,8 @@ impl PrometheusRegister for OnDemandIncomingRequestsMetrics { pub struct OnDemandOutgoingRequestsMetrics { /// Number of times there was no good peer to request justification from pub beefy_on_demand_justification_no_peer_to_request_from: Counter, - /// Number of on-demand justification peer hang up - pub beefy_on_demand_justification_peer_hang_up: Counter, + /// Number of on-demand justification peer refused valid requests + pub beefy_on_demand_justification_peer_refused: Counter, /// Number of on-demand justification peer error pub beefy_on_demand_justification_peer_error: Counter, /// Number of on-demand justification invalid proof @@ -249,10 +249,10 @@ impl PrometheusRegister for OnDemandOutgoingRequestsMetrics { )?, registry, )?, - beefy_on_demand_justification_peer_hang_up: register( + beefy_on_demand_justification_peer_refused: register( Counter::new( - "substrate_beefy_on_demand_justification_peer_hang_up", - "Number of on-demand justification peer hang up", + "beefy_on_demand_justification_peer_refused", + "Number of on-demand justification peer refused valid requests", )?, registry, )?, diff --git a/client/consensus/beefy/src/tests.rs b/client/consensus/beefy/src/tests.rs index f36c2cd68f97f..48ecebdac3581 100644 --- a/client/consensus/beefy/src/tests.rs +++ b/client/consensus/beefy/src/tests.rs @@ -24,6 +24,7 @@ use crate::{ communication::{ gossip::{ proofs_topic, tests::sign_commitment, votes_topic, GossipFilterCfg, GossipMessage, + GossipValidator, }, request_response::{on_demand_justifications_protocol_config, BeefyJustifsRequestHandler}, }, @@ -357,8 +358,8 @@ async fn voter_init_setup( ) -> sp_blockchain::Result> { let backend = net.peer(0).client().as_backend(); let known_peers = Arc::new(Mutex::new(KnownPeers::new())); - let gossip_validator = - Arc::new(crate::communication::gossip::GossipValidator::new(known_peers)); + let (gossip_validator, _) = GossipValidator::new(known_peers); + let gossip_validator = Arc::new(gossip_validator); let mut gossip_engine = sc_network_gossip::GossipEngine::new( net.peer(0).network_service().clone(), net.peer(0).sync_service().clone(), @@ -1262,8 +1263,8 @@ async fn gossipped_finality_proofs() { let charlie = &net.peers[2]; let known_peers = Arc::new(Mutex::new(KnownPeers::::new())); // Charlie will run just the gossip engine and not the full voter. - let charlie_gossip_validator = - Arc::new(crate::communication::gossip::GossipValidator::new(known_peers)); + let (gossip_validator, _) = GossipValidator::new(known_peers); + let charlie_gossip_validator = Arc::new(gossip_validator); charlie_gossip_validator.update_filter(GossipFilterCfg:: { start: 1, end: 10, diff --git a/client/consensus/beefy/src/worker.rs b/client/consensus/beefy/src/worker.rs index 19225ec214578..c05de197d58fd 100644 --- a/client/consensus/beefy/src/worker.rs +++ b/client/consensus/beefy/src/worker.rs @@ -19,7 +19,8 @@ use crate::{ communication::{ gossip::{proofs_topic, votes_topic, GossipFilterCfg, GossipMessage, GossipValidator}, - request_response::outgoing_requests_engine::OnDemandJustificationsEngine, + peers::PeerReport, + request_response::outgoing_requests_engine::{OnDemandJustificationsEngine, ResponseInfo}, }, error::Error, justification::BeefyVersionedFinalityProof, @@ -34,7 +35,7 @@ use futures::{stream::Fuse, FutureExt, StreamExt}; use log::{debug, error, info, log_enabled, trace, warn}; use sc_client_api::{Backend, FinalityNotification, FinalityNotifications, HeaderBackend}; use sc_network_gossip::GossipEngine; -use sc_utils::notification::NotificationReceiver; +use sc_utils::{mpsc::TracingUnboundedReceiver, notification::NotificationReceiver}; use sp_api::{BlockId, ProvideRuntimeApi}; use sp_arithmetic::traits::{AtLeast32Bit, Saturating}; use sp_consensus::SyncOracle; @@ -255,20 +256,6 @@ impl VoterOracle { } } -pub(crate) struct WorkerParams { - pub backend: Arc, - pub payload_provider: P, - pub runtime: Arc, - pub sync: Arc, - pub key_store: BeefyKeystore, - pub gossip_engine: GossipEngine, - pub gossip_validator: Arc>, - pub on_demand_justifications: OnDemandJustificationsEngine, - pub links: BeefyVoterLinks, - pub metrics: Option, - pub persisted_state: PersistedState, -} - #[derive(Debug, Decode, Encode, PartialEq)] pub(crate) struct PersistedState { /// Best block we voted on. @@ -311,28 +298,29 @@ impl PersistedState { /// A BEEFY worker plays the BEEFY protocol pub(crate) struct BeefyWorker { // utilities - backend: Arc, - payload_provider: P, - runtime: Arc, - sync: Arc, - key_store: BeefyKeystore, + pub backend: Arc, + pub payload_provider: P, + pub runtime: Arc, + pub sync: Arc, + pub key_store: BeefyKeystore, // communication - gossip_engine: GossipEngine, - gossip_validator: Arc>, - on_demand_justifications: OnDemandJustificationsEngine, + pub gossip_engine: GossipEngine, + pub gossip_validator: Arc>, + pub gossip_report_stream: TracingUnboundedReceiver, + pub on_demand_justifications: OnDemandJustificationsEngine, // channels /// Links between the block importer, the background voter and the RPC layer. - links: BeefyVoterLinks, + pub links: BeefyVoterLinks, // voter state /// BEEFY client metrics. - metrics: Option, + pub metrics: Option, /// Buffer holding justifications for future processing. - pending_justifications: BTreeMap, BeefyVersionedFinalityProof>, + pub pending_justifications: BTreeMap, BeefyVersionedFinalityProof>, /// Persisted voter state. - persisted_state: PersistedState, + pub persisted_state: PersistedState, } impl BeefyWorker @@ -344,43 +332,6 @@ where R: ProvideRuntimeApi, R::Api: BeefyApi, { - /// Return a new BEEFY worker instance. - /// - /// Note that a BEEFY worker is only fully functional if a corresponding - /// BEEFY pallet has been deployed on-chain. - /// - /// The BEEFY pallet is needed in order to keep track of the BEEFY authority set. - pub(crate) fn new(worker_params: WorkerParams) -> Self { - let WorkerParams { - backend, - payload_provider, - runtime, - key_store, - sync, - gossip_engine, - gossip_validator, - on_demand_justifications, - links, - metrics, - persisted_state, - } = worker_params; - - BeefyWorker { - backend, - payload_provider, - runtime, - sync, - key_store, - gossip_engine, - gossip_validator, - on_demand_justifications, - links, - metrics, - pending_justifications: BTreeMap::new(), - persisted_state, - } - } - fn best_grandpa_block(&self) -> NumberFor { *self.persisted_state.voting_oracle.best_grandpa_block_header.number() } @@ -849,7 +800,12 @@ where // Act on changed 'state'. self.process_new_state(); + // Mutable reference used to drive the gossip engine. let mut gossip_engine = &mut self.gossip_engine; + // Use temp val and report after async section, + // to avoid having to Mutex-wrap `gossip_engine`. + let mut gossip_report: Option = None; + // Wait for, and handle external events. // The branches below only change 'state', actual voting happens afterwards, // based on the new resulting 'state'. @@ -870,11 +826,16 @@ where return; }, // Process incoming justifications as these can make some in-flight votes obsolete. - justif = self.on_demand_justifications.next().fuse() => { - if let Some(justif) = justif { - if let Err(err) = self.triage_incoming_justif(justif) { - debug!(target: LOG_TARGET, "🥩 {}", err); - } + response_info = self.on_demand_justifications.next().fuse() => { + match response_info { + ResponseInfo::ValidProof(justif, peer_report) => { + if let Err(err) = self.triage_incoming_justif(justif) { + debug!(target: LOG_TARGET, "🥩 {}", err); + } + gossip_report = Some(peer_report); + }, + ResponseInfo::PeerReport(peer_report) => gossip_report = Some(peer_report), + ResponseInfo::Pending => (), } }, justif = block_import_justif.next() => { @@ -918,6 +879,13 @@ where return; } }, + // Process peer reports. + report = self.gossip_report_stream.next() => { + gossip_report = report; + }, + } + if let Some(PeerReport { who, cost_benefit }) = gossip_report { + self.gossip_engine.report(who, cost_benefit); } } } @@ -1122,7 +1090,8 @@ pub(crate) mod tests { let network = peer.network_service().clone(); let sync = peer.sync_service().clone(); let known_peers = Arc::new(Mutex::new(KnownPeers::new())); - let gossip_validator = Arc::new(GossipValidator::new(known_peers.clone())); + let (gossip_validator, gossip_report_stream) = GossipValidator::new(known_peers.clone()); + let gossip_validator = Arc::new(gossip_validator); let gossip_engine = GossipEngine::new( network.clone(), sync.clone(), @@ -1152,7 +1121,7 @@ pub(crate) mod tests { ) .unwrap(); let payload_provider = MmrRootProvider::new(api.clone()); - let worker_params = crate::worker::WorkerParams { + BeefyWorker { backend, payload_provider, runtime: api, @@ -1160,12 +1129,13 @@ pub(crate) mod tests { links, gossip_engine, gossip_validator, + gossip_report_stream, metrics, sync: Arc::new(sync), on_demand_justifications, + pending_justifications: BTreeMap::new(), persisted_state, - }; - BeefyWorker::<_, _, _, _, _>::new(worker_params) + } } #[test] From ea9ce4c0af36310c0b0db264ab12cf4766b83750 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Wed, 12 Apr 2023 14:14:06 +0200 Subject: [PATCH 17/93] [Deps] Bump scale-info to match cumulus and polkadot (#13873) * [Deps] Bump scale-info to match cumulus and polkadot * fix Cargo.lock * fix identity * more fixes * fix * fixes * more fixes --- Cargo.lock | 8 ++--- bin/node-template/pallets/template/Cargo.toml | 2 +- bin/node-template/runtime/Cargo.toml | 2 +- bin/node/executor/Cargo.toml | 2 +- bin/node/primitives/Cargo.toml | 2 +- bin/node/runtime/Cargo.toml | 2 +- client/consensus/babe/Cargo.toml | 2 +- client/rpc-api/Cargo.toml | 2 +- frame/assets/Cargo.toml | 2 +- frame/atomic-swap/Cargo.toml | 2 +- frame/aura/Cargo.toml | 2 +- frame/authority-discovery/Cargo.toml | 2 +- frame/authorship/Cargo.toml | 2 +- frame/babe/Cargo.toml | 2 +- frame/bags-list/Cargo.toml | 2 +- frame/balances/Cargo.toml | 2 +- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- frame/benchmarking/Cargo.toml | 2 +- frame/benchmarking/pov/Cargo.toml | 2 +- frame/bounties/Cargo.toml | 2 +- frame/child-bounties/Cargo.toml | 2 +- frame/collective/Cargo.toml | 2 +- frame/contracts/Cargo.toml | 2 +- frame/contracts/primitives/Cargo.toml | 2 +- frame/conviction-voting/Cargo.toml | 2 +- frame/democracy/Cargo.toml | 2 +- .../election-provider-multi-phase/Cargo.toml | 2 +- frame/election-provider-support/Cargo.toml | 2 +- .../solution-type/fuzzer/Cargo.toml | 2 +- frame/examples/basic/Cargo.toml | 2 +- frame/examples/offchain-worker/Cargo.toml | 2 +- frame/executive/Cargo.toml | 2 +- frame/fast-unstake/Cargo.toml | 2 +- frame/glutton/Cargo.toml | 2 +- frame/grandpa/Cargo.toml | 2 +- frame/identity/Cargo.toml | 2 +- frame/identity/src/types.rs | 18 +++++----- frame/im-online/Cargo.toml | 2 +- frame/indices/Cargo.toml | 2 +- .../Cargo.toml | 2 +- frame/lottery/Cargo.toml | 2 +- frame/membership/Cargo.toml | 2 +- frame/merkle-mountain-range/Cargo.toml | 2 +- frame/message-queue/Cargo.toml | 2 +- frame/multisig/Cargo.toml | 2 +- frame/nfts/Cargo.toml | 2 +- frame/nicks/Cargo.toml | 2 +- frame/nis/Cargo.toml | 2 +- frame/node-authorization/Cargo.toml | 2 +- frame/nomination-pools/Cargo.toml | 2 +- .../nomination-pools/benchmarking/Cargo.toml | 2 +- frame/offences/Cargo.toml | 2 +- frame/preimage/Cargo.toml | 2 +- frame/proxy/Cargo.toml | 2 +- frame/recovery/Cargo.toml | 2 +- frame/referenda/Cargo.toml | 2 +- frame/remark/Cargo.toml | 2 +- frame/root-offences/Cargo.toml | 2 +- frame/root-testing/Cargo.toml | 2 +- frame/scheduler/Cargo.toml | 2 +- frame/scored-pool/Cargo.toml | 2 +- frame/session/Cargo.toml | 2 +- frame/society/Cargo.toml | 2 +- frame/staking/Cargo.toml | 2 +- frame/state-trie-migration/Cargo.toml | 2 +- frame/sudo/Cargo.toml | 2 +- frame/support/Cargo.toml | 2 +- frame/support/test/Cargo.toml | 2 +- frame/support/test/compile_pass/Cargo.toml | 2 +- frame/support/test/tests/pallet.rs | 6 ++-- .../test/tests/pallet_compatibility.rs | 36 +++++++++---------- .../tests/pallet_compatibility_instance.rs | 36 +++++++++---------- frame/system/Cargo.toml | 2 +- frame/system/benchmarking/Cargo.toml | 2 +- frame/timestamp/Cargo.toml | 2 +- frame/tips/Cargo.toml | 2 +- frame/transaction-payment/Cargo.toml | 2 +- .../asset-tx-payment/Cargo.toml | 2 +- frame/transaction-storage/Cargo.toml | 2 +- frame/treasury/Cargo.toml | 2 +- frame/uniques/Cargo.toml | 2 +- frame/utility/Cargo.toml | 2 +- frame/vesting/Cargo.toml | 2 +- frame/whitelist/Cargo.toml | 2 +- primitives/application-crypto/Cargo.toml | 2 +- primitives/arithmetic/Cargo.toml | 2 +- primitives/authority-discovery/Cargo.toml | 2 +- primitives/consensus/aura/Cargo.toml | 2 +- primitives/consensus/babe/Cargo.toml | 2 +- primitives/consensus/beefy/Cargo.toml | 2 +- primitives/consensus/grandpa/Cargo.toml | 2 +- primitives/consensus/vrf/Cargo.toml | 2 +- primitives/core/Cargo.toml | 2 +- primitives/inherents/Cargo.toml | 2 +- primitives/merkle-mountain-range/Cargo.toml | 2 +- primitives/npos-elections/Cargo.toml | 2 +- primitives/npos-elections/fuzzer/Cargo.toml | 2 +- primitives/runtime/Cargo.toml | 2 +- primitives/runtime/src/generic/digest.rs | 8 ++--- primitives/session/Cargo.toml | 2 +- primitives/staking/Cargo.toml | 2 +- .../transaction-storage-proof/Cargo.toml | 2 +- primitives/trie/Cargo.toml | 2 +- primitives/version/Cargo.toml | 2 +- primitives/weights/Cargo.toml | 2 +- test-utils/runtime/Cargo.toml | 2 +- .../rpc/state-trie-migration-rpc/Cargo.toml | 2 +- 108 files changed, 158 insertions(+), 158 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f55180f9ca942..6a1f29aa28e20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9698,9 +9698,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +checksum = "0cfdffd972d76b22f3d7f81c8be34b2296afd3a25e0a547bd9abe340a4dbbe97" dependencies = [ "bitvec", "cfg-if", @@ -9712,9 +9712,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +checksum = "61fa974aea2d63dd18a4ec3a49d59af9f34178c73a4f56d2f18205628d00681e" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml index ddf7c6e52fb2f..bb6d8c511af7e 100644 --- a/bin/node-template/pallets/template/Cargo.toml +++ b/bin/node-template/pallets/template/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../../../../frame/benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../../../../frame/support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../../frame/system" } diff --git a/bin/node-template/runtime/Cargo.toml b/bin/node-template/runtime/Cargo.toml index 8915061c17c6d..930c5b5c49ade 100644 --- a/bin/node-template/runtime/Cargo.toml +++ b/bin/node-template/runtime/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } pallet-aura = { version = "4.0.0-dev", default-features = false, path = "../../../frame/aura" } pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../../frame/balances" } diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml index cb661f536f7b7..c4711adcb0e82 100644 --- a/bin/node/executor/Cargo.toml +++ b/bin/node/executor/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2" } -scale-info = { version = "2.1.1", features = ["derive"] } +scale-info = { version = "2.5.0", features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", path = "../../../frame/benchmarking" } node-primitives = { version = "2.0.0", path = "../primitives" } kitchensink-runtime = { version = "3.0.0-dev", path = "../runtime" } diff --git a/bin/node/primitives/Cargo.toml b/bin/node/primitives/Cargo.toml index 1f515f3e3a5b5..78cbf67ce7710 100644 --- a/bin/node/primitives/Cargo.toml +++ b/bin/node/primitives/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../frame/system" } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../../../primitives/application-crypto" } sp-core = { version = "7.0.0", default-features = false, path = "../../../primitives/core" } diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index bc9f3af9d879a..65a8d208d7f4c 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -20,7 +20,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = "derive", "max-encoded-len", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } static_assertions = "1.1.0" log = { version = "0.4.17", default-features = false } diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index 8088bef9d7e1b..d10ef21c4dad4 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] async-trait = "0.1.57" -scale-info = { version = "2.1.1", features = ["derive"] } +scale-info = { version = "2.5.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", features = ["derive"] } futures = "0.3.21" log = "0.4.17" diff --git a/client/rpc-api/Cargo.toml b/client/rpc-api/Cargo.toml index 261339f131888..ba18a1d4fc70d 100644 --- a/client/rpc-api/Cargo.toml +++ b/client/rpc-api/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2" } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0.85" thiserror = "1.0" diff --git a/frame/assets/Cargo.toml b/frame/assets/Cargo.toml index 6fe0e3e6c3042..d3adc47f5f803 100644 --- a/frame/assets/Cargo.toml +++ b/frame/assets/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" } # Needed for various traits. In our case, `OnFinalize`. sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/atomic-swap/Cargo.toml b/frame/atomic-swap/Cargo.toml index 9c3bcf73af985..fb0f9c0e47957 100644 --- a/frame/atomic-swap/Cargo.toml +++ b/frame/atomic-swap/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-core = { version = "7.0.0", default-features = false, path = "../../primitives/core" } diff --git a/frame/aura/Cargo.toml b/frame/aura/Cargo.toml index d2fd5a5b9c372..ee6465ad3967f 100644 --- a/frame/aura/Cargo.toml +++ b/frame/aura/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } pallet-timestamp = { version = "4.0.0-dev", default-features = false, path = "../timestamp" } diff --git a/frame/authority-discovery/Cargo.toml b/frame/authority-discovery/Cargo.toml index 50c6c411c5ae0..d8693bd85bffb 100644 --- a/frame/authority-discovery/Cargo.toml +++ b/frame/authority-discovery/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } pallet-session = { version = "4.0.0-dev", default-features = false, features = [ diff --git a/frame/authorship/Cargo.toml b/frame/authorship/Cargo.toml index a205c51f9c62d..6d8cdd9371e94 100644 --- a/frame/authorship/Cargo.toml +++ b/frame/authorship/Cargo.toml @@ -17,7 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = "derive", ] } impl-trait-for-tuples = "0.2.2" -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index aa581392721ae..c4f6592dba9e1 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/bags-list/Cargo.toml b/frame/bags-list/Cargo.toml index 379698b1d39e1..1678ce1ba2ac6 100644 --- a/frame/bags-list/Cargo.toml +++ b/frame/bags-list/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # parity codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } # primitives sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index 9646a934df00e..b3457dd8d141c 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 721e24282c45b..9840162149a38 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -12,7 +12,7 @@ homepage = "https://substrate.io" array-bytes = { version = "4.1", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } binary-merkle-tree = { version = "4.0.0-dev", default-features = false, path = "../../utils/binary-merkle-tree" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 3778ca5f37a56..21c96ff952731 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -10,7 +10,7 @@ homepage = "https://substrate.io" [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/benchmarking/Cargo.toml b/frame/benchmarking/Cargo.toml index 7b8a7c5eaa940..bebe74b1f4b3e 100644 --- a/frame/benchmarking/Cargo.toml +++ b/frame/benchmarking/Cargo.toml @@ -17,7 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = linregress = { version = "0.5.1", optional = true } log = { version = "0.4.17", default-features = false } paste = "1.0" -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-support-procedural = { version = "4.0.0-dev", default-features = false, path = "../support/procedural" } diff --git a/frame/benchmarking/pov/Cargo.toml b/frame/benchmarking/pov/Cargo.toml index d885821bc1fc7..28358142b674a 100644 --- a/frame/benchmarking/pov/Cargo.toml +++ b/frame/benchmarking/pov/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" } diff --git a/frame/bounties/Cargo.toml b/frame/bounties/Cargo.toml index dcb1adae05777..a2f39ccd7ec0b 100644 --- a/frame/bounties/Cargo.toml +++ b/frame/bounties/Cargo.toml @@ -17,7 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = "derive", ] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/child-bounties/Cargo.toml b/frame/child-bounties/Cargo.toml index 8d29b7619759d..48fa222616152 100644 --- a/frame/child-bounties/Cargo.toml +++ b/frame/child-bounties/Cargo.toml @@ -17,7 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = "derive", ] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/collective/Cargo.toml b/frame/collective/Cargo.toml index 26cd5a8ab44cc..7ae8817474a47 100644 --- a/frame/collective/Cargo.toml +++ b/frame/collective/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index f357a21b9cf5e..6ab60846fd412 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -19,7 +19,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = "derive", "max-encoded-len", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } log = { version = "0.4", default-features = false } wasm-instrument = { version = "0.4", default-features = false } serde = { version = "1", optional = true, features = ["derive"] } diff --git a/frame/contracts/primitives/Cargo.toml b/frame/contracts/primitives/Cargo.toml index 2460edc5a7b2f..b643f03a9d511 100644 --- a/frame/contracts/primitives/Cargo.toml +++ b/frame/contracts/primitives/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] bitflags = "1.0" -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } # Substrate Dependencies (This crate should not rely on frame) diff --git a/frame/conviction-voting/Cargo.toml b/frame/conviction-voting/Cargo.toml index d112c54fb64a7..f9390d6b6efe1 100644 --- a/frame/conviction-voting/Cargo.toml +++ b/frame/conviction-voting/Cargo.toml @@ -18,7 +18,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = "derive", "max-encoded-len", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/democracy/Cargo.toml b/frame/democracy/Cargo.toml index fa107218cf698..1f46bfaed8c0b 100644 --- a/frame/democracy/Cargo.toml +++ b/frame/democracy/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/election-provider-multi-phase/Cargo.toml b/frame/election-provider-multi-phase/Cargo.toml index aa734850aae43..c88ed0120fe59 100644 --- a/frame/election-provider-multi-phase/Cargo.toml +++ b/frame/election-provider-multi-phase/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = [ +scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } log = { version = "0.4.17", default-features = false } diff --git a/frame/election-provider-support/Cargo.toml b/frame/election-provider-support/Cargo.toml index 114caee793f1a..a519d964c60dc 100644 --- a/frame/election-provider-support/Cargo.toml +++ b/frame/election-provider-support/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-election-provider-solution-type = { version = "4.0.0-dev", path = "solution-type" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/election-provider-support/solution-type/fuzzer/Cargo.toml b/frame/election-provider-support/solution-type/fuzzer/Cargo.toml index 9275692788d48..580e5eba9247d 100644 --- a/frame/election-provider-support/solution-type/fuzzer/Cargo.toml +++ b/frame/election-provider-support/solution-type/fuzzer/Cargo.toml @@ -18,7 +18,7 @@ honggfuzz = "0.5" rand = { version = "0.8", features = ["std", "small_rng"] } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-election-provider-solution-type = { version = "4.0.0-dev", path = ".." } frame-election-provider-support = { version = "4.0.0-dev", path = "../.." } sp-arithmetic = { version = "6.0.0", path = "../../../../primitives/arithmetic" } diff --git a/frame/examples/basic/Cargo.toml b/frame/examples/basic/Cargo.toml index 2f854011b0abd..848d4bbc94d72 100644 --- a/frame/examples/basic/Cargo.toml +++ b/frame/examples/basic/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" } diff --git a/frame/examples/offchain-worker/Cargo.toml b/frame/examples/offchain-worker/Cargo.toml index fb4c12ae0b61d..e582b0f99714f 100644 --- a/frame/examples/offchain-worker/Cargo.toml +++ b/frame/examples/offchain-worker/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } lite-json = { version = "0.2.0", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" } sp-core = { version = "7.0.0", default-features = false, path = "../../../primitives/core" } diff --git a/frame/executive/Cargo.toml b/frame/executive/Cargo.toml index 1636cb3929d92..ed661b8ac9493 100644 --- a/frame/executive/Cargo.toml +++ b/frame/executive/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } frame-try-runtime = { version = "0.10.0-dev", default-features = false, path = "../try-runtime", optional = true } diff --git a/frame/fast-unstake/Cargo.toml b/frame/fast-unstake/Cargo.toml index 8e4df2f2b9eb5..93fceefa2de51 100644 --- a/frame/fast-unstake/Cargo.toml +++ b/frame/fast-unstake/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/glutton/Cargo.toml b/frame/glutton/Cargo.toml index c0f0312464ee6..bee0d3db625fb 100644 --- a/frame/glutton/Cargo.toml +++ b/frame/glutton/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] blake2 = { version = "0.10.4", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } log = { version = "0.4.14", default-features = false } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/grandpa/Cargo.toml b/frame/grandpa/Cargo.toml index 4eb796cf0c6b3..288d63512588b 100644 --- a/frame/grandpa/Cargo.toml +++ b/frame/grandpa/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index c1a250368fade..23c690889e19c 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] } enumflags2 = { version = "0.7.4" } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/identity/src/types.rs b/frame/identity/src/types.rs index 4d59a528021a0..1837b30b027f9 100644 --- a/frame/identity/src/types.rs +++ b/frame/identity/src/types.rs @@ -442,7 +442,7 @@ mod tests { let mut registry = scale_info::Registry::new(); let type_id = registry.register_type(&scale_info::meta_type::()); let registry: scale_info::PortableRegistry = registry.into(); - let type_info = registry.resolve(type_id.id()).unwrap(); + let type_info = registry.resolve(type_id.id).unwrap(); let check_type_info = |data: &Data| { let variant_name = match data { @@ -453,20 +453,20 @@ mod tests { Data::ShaThree256(_) => "ShaThree256".to_string(), Data::Raw(bytes) => format!("Raw{}", bytes.len()), }; - if let scale_info::TypeDef::Variant(variant) = type_info.type_def() { + if let scale_info::TypeDef::Variant(variant) = &type_info.type_def { let variant = variant - .variants() + .variants .iter() - .find(|v| v.name() == &variant_name) + .find(|v| v.name == variant_name) .expect(&format!("Expected to find variant {}", variant_name)); let field_arr_len = variant - .fields() + .fields .first() - .and_then(|f| registry.resolve(f.ty().id())) + .and_then(|f| registry.resolve(f.ty.id)) .map(|ty| { - if let scale_info::TypeDef::Array(arr) = ty.type_def() { - arr.len() + if let scale_info::TypeDef::Array(arr) = &ty.type_def { + arr.len } else { panic!("Should be an array type") } @@ -474,7 +474,7 @@ mod tests { .unwrap_or(0); let encoded = data.encode(); - assert_eq!(encoded[0], variant.index()); + assert_eq!(encoded[0], variant.index); assert_eq!(encoded.len() as u32 - 1, field_arr_len); } else { panic!("Should be a variant type") diff --git a/frame/im-online/Cargo.toml b/frame/im-online/Cargo.toml index d76fba4fb6495..881139ad5aa84 100644 --- a/frame/im-online/Cargo.toml +++ b/frame/im-online/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/indices/Cargo.toml b/frame/indices/Cargo.toml index b667916ebcb49..6895f076da22d 100644 --- a/frame/indices/Cargo.toml +++ b/frame/indices/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/insecure-randomness-collective-flip/Cargo.toml b/frame/insecure-randomness-collective-flip/Cargo.toml index 68ccfadfc8edf..bcebff6a9663f 100644 --- a/frame/insecure-randomness-collective-flip/Cargo.toml +++ b/frame/insecure-randomness-collective-flip/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } safe-mix = { version = "1.0", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/lottery/Cargo.toml b/frame/lottery/Cargo.toml index 8c1bf30106852..4d8839612b2ef 100644 --- a/frame/lottery/Cargo.toml +++ b/frame/lottery/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/membership/Cargo.toml b/frame/membership/Cargo.toml index bba5700cdd848..330d9401df2c7 100644 --- a/frame/membership/Cargo.toml +++ b/frame/membership/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/merkle-mountain-range/Cargo.toml b/frame/merkle-mountain-range/Cargo.toml index 3f7180f79adbe..5f6094af1648e 100644 --- a/frame/merkle-mountain-range/Cargo.toml +++ b/frame/merkle-mountain-range/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/message-queue/Cargo.toml b/frame/message-queue/Cargo.toml index 115200b826763..404e678137211 100644 --- a/frame/message-queue/Cargo.toml +++ b/frame/message-queue/Cargo.toml @@ -10,7 +10,7 @@ description = "FRAME pallet to queue and process messages" [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.137", optional = true, features = ["derive"] } log = { version = "0.4.17", default-features = false } diff --git a/frame/multisig/Cargo.toml b/frame/multisig/Cargo.toml index 5cd744124ef24..98a15c5a5aada 100644 --- a/frame/multisig/Cargo.toml +++ b/frame/multisig/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/nfts/Cargo.toml b/frame/nfts/Cargo.toml index 59aa4e091fe68..96d46dacbbd0c 100644 --- a/frame/nfts/Cargo.toml +++ b/frame/nfts/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } enumflags2 = { version = "0.7.5" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/nicks/Cargo.toml b/frame/nicks/Cargo.toml index 1c829efc2d601..50fc4ef68788f 100644 --- a/frame/nicks/Cargo.toml +++ b/frame/nicks/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-io = { version = "7.0.0", default-features = false, path = "../../primitives/io" } diff --git a/frame/nis/Cargo.toml b/frame/nis/Cargo.toml index a5fc29cd79150..c12d4f2c0a1eb 100644 --- a/frame/nis/Cargo.toml +++ b/frame/nis/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/node-authorization/Cargo.toml b/frame/node-authorization/Cargo.toml index c60ce1d12ce09..ed3f59a9a1e24 100644 --- a/frame/node-authorization/Cargo.toml +++ b/frame/node-authorization/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-core = { version = "7.0.0", default-features = false, path = "../../primitives/core" } diff --git a/frame/nomination-pools/Cargo.toml b/frame/nomination-pools/Cargo.toml index d51bcec51f478..c92d9b5124697 100644 --- a/frame/nomination-pools/Cargo.toml +++ b/frame/nomination-pools/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # parity codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } # FRAME frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/nomination-pools/benchmarking/Cargo.toml b/frame/nomination-pools/benchmarking/Cargo.toml index b96024af7d3c5..4f757cafa2fd1 100644 --- a/frame/nomination-pools/benchmarking/Cargo.toml +++ b/frame/nomination-pools/benchmarking/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # parity codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } # FRAME frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../../benchmarking" } diff --git a/frame/offences/Cargo.toml b/frame/offences/Cargo.toml index 47ae264a69cf8..6ebe870a78c9b 100644 --- a/frame/offences/Cargo.toml +++ b/frame/offences/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/preimage/Cargo.toml b/frame/preimage/Cargo.toml index 6bc6c8c53c012..57dda88b1e70a 100644 --- a/frame/preimage/Cargo.toml +++ b/frame/preimage/Cargo.toml @@ -10,7 +10,7 @@ description = "FRAME pallet for storing preimages of hashes" [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/proxy/Cargo.toml b/frame/proxy/Cargo.toml index 5c69fcfb9f55e..065cbe5eba252 100644 --- a/frame/proxy/Cargo.toml +++ b/frame/proxy/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/recovery/Cargo.toml b/frame/recovery/Cargo.toml index 3c25c0002b709..b2e3236e4dfc5 100644 --- a/frame/recovery/Cargo.toml +++ b/frame/recovery/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/referenda/Cargo.toml b/frame/referenda/Cargo.toml index ac4c8044da359..5a092c63beec0 100644 --- a/frame/referenda/Cargo.toml +++ b/frame/referenda/Cargo.toml @@ -17,7 +17,7 @@ assert_matches = { version = "1.5", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } sp-arithmetic = { version = "6.0.0", default-features = false, path = "../../primitives/arithmetic" } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } diff --git a/frame/remark/Cargo.toml b/frame/remark/Cargo.toml index 151cc38884490..5fc595d710680 100644 --- a/frame/remark/Cargo.toml +++ b/frame/remark/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/root-offences/Cargo.toml b/frame/root-offences/Cargo.toml index fd1f7c6325ea2..58fa281dc3d76 100644 --- a/frame/root-offences/Cargo.toml +++ b/frame/root-offences/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } pallet-session = { version = "4.0.0-dev", features = [ "historical" ], path = "../../frame/session", default-features = false } pallet-staking = { version = "4.0.0-dev", default-features = false, path = "../../frame/staking" } diff --git a/frame/root-testing/Cargo.toml b/frame/root-testing/Cargo.toml index 09262b3d31db2..6e8c13f775de0 100644 --- a/frame/root-testing/Cargo.toml +++ b/frame/root-testing/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-core = { version = "7.0.0", default-features = false, path = "../../primitives/core" } diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index 9a67e68a01640..50afac933f119 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -12,7 +12,7 @@ readme = "README.md" [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/scored-pool/Cargo.toml b/frame/scored-pool/Cargo.toml index d44fc1b2f1548..f38743e8b5f96 100644 --- a/frame/scored-pool/Cargo.toml +++ b/frame/scored-pool/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-io = { version = "7.0.0", default-features = false, path = "../../primitives/io" } diff --git a/frame/session/Cargo.toml b/frame/session/Cargo.toml index bd28bffffd8d9..ccf3f7d86e497 100644 --- a/frame/session/Cargo.toml +++ b/frame/session/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } impl-trait-for-tuples = "0.2.2" log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } pallet-timestamp = { version = "4.0.0-dev", default-features = false, path = "../timestamp" } diff --git a/frame/society/Cargo.toml b/frame/society/Cargo.toml index ddc6ea6aac7d7..ab74e39e4f83b 100644 --- a/frame/society/Cargo.toml +++ b/frame/society/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } rand_chacha = { version = "0.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/staking/Cargo.toml b/frame/staking/Cargo.toml index 79c0bb5c2a32d..c20f003108d76 100644 --- a/frame/staking/Cargo.toml +++ b/frame/staking/Cargo.toml @@ -17,7 +17,7 @@ serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" } sp-io = { version = "7.0.0", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" } diff --git a/frame/state-trie-migration/Cargo.toml b/frame/state-trie-migration/Cargo.toml index 36b5912a60302..8485db5a3c98d 100644 --- a/frame/state-trie-migration/Cargo.toml +++ b/frame/state-trie-migration/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.133", optional = true } thousands = { version = "0.2.0", optional = true } zstd = { version = "0.11.2", default-features = false, optional = true } diff --git a/frame/sudo/Cargo.toml b/frame/sudo/Cargo.toml index 56d04b172c268..e1161497b1744 100644 --- a/frame/sudo/Cargo.toml +++ b/frame/sudo/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } sp-io = { version = "7.0.0", default-features = false, path = "../../primitives/io" } diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index 7792fdf015ba5..f62609585818a 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.136", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-metadata = { version = "15.1.0", default-features = false, features = ["v14", "v15-unstable"] } sp-api = { version = "4.0.0-dev", default-features = false, path = "../../primitives/api" } sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" } diff --git a/frame/support/test/Cargo.toml b/frame/support/test/Cargo.toml index ad4589c734fde..9564b6a04d7e7 100644 --- a/frame/support/test/Cargo.toml +++ b/frame/support/test/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.136", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/api" } sp-arithmetic = { version = "6.0.0", default-features = false, path = "../../../primitives/arithmetic" } sp-io = { version = "7.0.0", path = "../../../primitives/io", default-features = false } diff --git a/frame/support/test/compile_pass/Cargo.toml b/frame/support/test/compile_pass/Cargo.toml index dd5e1b996db9c..4466c24d64f15 100644 --- a/frame/support/test/compile_pass/Cargo.toml +++ b/frame/support/test/compile_pass/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, path = "../../" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../system" } sp-core = { version = "7.0.0", default-features = false, path = "../../../../primitives/core" } diff --git a/frame/support/test/tests/pallet.rs b/frame/support/test/tests/pallet.rs index f1dc97223322f..f3c4e07403af8 100644 --- a/frame/support/test/tests/pallet.rs +++ b/frame/support/test/tests/pallet.rs @@ -1616,9 +1616,9 @@ fn metadata() { }, ]; - let empty_doc = pallets[0].event.as_ref().unwrap().ty.type_info().docs().is_empty() && - pallets[0].error.as_ref().unwrap().ty.type_info().docs().is_empty() && - pallets[0].calls.as_ref().unwrap().ty.type_info().docs().is_empty(); + let empty_doc = pallets[0].event.as_ref().unwrap().ty.type_info().docs.is_empty() && + pallets[0].error.as_ref().unwrap().ty.type_info().docs.is_empty() && + pallets[0].calls.as_ref().unwrap().ty.type_info().docs.is_empty(); if cfg!(feature = "no-metadata-docs") { assert!(empty_doc) diff --git a/frame/support/test/tests/pallet_compatibility.rs b/frame/support/test/tests/pallet_compatibility.rs index 077b3c96e992c..610316ecf1a6f 100644 --- a/frame/support/test/tests/pallet_compatibility.rs +++ b/frame/support/test/tests/pallet_compatibility.rs @@ -295,14 +295,14 @@ mod test { }; let assert_meta_types = |ty_id1, ty_id2| { - let ty1 = types.resolve(ty_id1).map(|ty| ty.type_def()); - let ty2 = types.resolve(ty_id2).map(|ty| ty.type_def()); + let ty1 = types.resolve(ty_id1).map(|ty| ty.type_def.clone()); + let ty2 = types.resolve(ty_id2).map(|ty| ty.type_def.clone()); pretty_assertions::assert_eq!(ty1, ty2); }; - let get_enum_variants = |ty_id| match types.resolve(ty_id).map(|ty| ty.type_def()) { + let get_enum_variants = |ty_id| match types.resolve(ty_id).map(|ty| ty.type_def.clone()) { Some(ty) => match ty { - scale_info::TypeDef::Variant(var) => var.variants(), + scale_info::TypeDef::Variant(var) => var.variants, _ => panic!("Expected variant type"), }, _ => panic!("No type found"), @@ -314,12 +314,12 @@ mod test { for i in 0..vs1.len() { let v1 = &vs2[i]; let v2 = &vs2[i]; - assert_eq!(v1.fields().len(), v2.fields().len()); - for f in 0..v1.fields().len() { - let f1 = &v1.fields()[f]; - let f2 = &v2.fields()[f]; - pretty_assertions::assert_eq!(f1.name(), f2.name()); - pretty_assertions::assert_eq!(f1.ty(), f2.ty()); + assert_eq!(v1.fields.len(), v2.fields.len()); + for f in 0..v1.fields.len() { + let f1 = &v1.fields[f]; + let f2 = &v2.fields[f]; + pretty_assertions::assert_eq!(f1.name, f2.name); + pretty_assertions::assert_eq!(f1.ty, f2.ty); } } }; @@ -328,21 +328,21 @@ mod test { let calls1 = pallets[1].calls.as_ref().unwrap(); let calls2 = pallets[2].calls.as_ref().unwrap(); - assert_meta_types(calls1.ty.id(), calls2.ty.id()); + assert_meta_types(calls1.ty.id, calls2.ty.id); // event: check variants and fields but ignore the type name which will be different - let event1_variants = get_enum_variants(pallets[1].event.as_ref().unwrap().ty.id()); - let event2_variants = get_enum_variants(pallets[2].event.as_ref().unwrap().ty.id()); - assert_enum_variants(event1_variants, event2_variants); + let event1_variants = get_enum_variants(pallets[1].event.as_ref().unwrap().ty.id); + let event2_variants = get_enum_variants(pallets[2].event.as_ref().unwrap().ty.id); + assert_enum_variants(&event1_variants, &event2_variants); - let err1 = get_enum_variants(pallets[1].error.as_ref().unwrap().ty.id()) + let err1 = get_enum_variants(pallets[1].error.as_ref().unwrap().ty.id) .iter() - .filter(|v| v.name() == "__Ignore") + .filter(|v| v.name == "__Ignore") .cloned() .collect::>(); - let err2 = get_enum_variants(pallets[2].error.as_ref().unwrap().ty.id()) + let err2 = get_enum_variants(pallets[2].error.as_ref().unwrap().ty.id) .iter() - .filter(|v| v.name() == "__Ignore") + .filter(|v| v.name == "__Ignore") .cloned() .collect::>(); assert_enum_variants(&err1, &err2); diff --git a/frame/support/test/tests/pallet_compatibility_instance.rs b/frame/support/test/tests/pallet_compatibility_instance.rs index c641556beda20..73014d99657c9 100644 --- a/frame/support/test/tests/pallet_compatibility_instance.rs +++ b/frame/support/test/tests/pallet_compatibility_instance.rs @@ -298,9 +298,9 @@ mod test { _ => unreachable!(), }; - let get_enum_variants = |ty_id| match types.resolve(ty_id).map(|ty| ty.type_def()) { + let get_enum_variants = |ty_id| match types.resolve(ty_id).map(|ty| ty.type_def.clone()) { Some(ty) => match ty { - scale_info::TypeDef::Variant(var) => var.variants(), + scale_info::TypeDef::Variant(var) => var.variants, _ => panic!("Expected variant type"), }, _ => panic!("No type found"), @@ -312,12 +312,12 @@ mod test { for i in 0..vs1.len() { let v1 = &vs2[i]; let v2 = &vs2[i]; - assert_eq!(v1.fields().len(), v2.fields().len()); - for f in 0..v1.fields().len() { - let f1 = &v1.fields()[f]; - let f2 = &v2.fields()[f]; - pretty_assertions::assert_eq!(f1.name(), f2.name()); - pretty_assertions::assert_eq!(f1.ty(), f2.ty()); + assert_eq!(v1.fields.len(), v2.fields.len()); + for f in 0..v1.fields.len() { + let f1 = &v1.fields[f]; + let f2 = &v2.fields[f]; + pretty_assertions::assert_eq!(f1.name, f2.name); + pretty_assertions::assert_eq!(f1.ty, f2.ty); } } }; @@ -325,23 +325,23 @@ mod test { for i in vec![1, 3, 5].into_iter() { pretty_assertions::assert_eq!(pallets[i].storage, pallets[i + 1].storage); - let call1_variants = get_enum_variants(pallets[i].calls.as_ref().unwrap().ty.id()); - let call2_variants = get_enum_variants(pallets[i + 1].calls.as_ref().unwrap().ty.id()); - assert_enum_variants(call1_variants, call2_variants); + let call1_variants = get_enum_variants(pallets[i].calls.as_ref().unwrap().ty.id); + let call2_variants = get_enum_variants(pallets[i + 1].calls.as_ref().unwrap().ty.id); + assert_enum_variants(&call1_variants, &call2_variants); // event: check variants and fields but ignore the type name which will be different - let event1_variants = get_enum_variants(pallets[i].event.as_ref().unwrap().ty.id()); - let event2_variants = get_enum_variants(pallets[i + 1].event.as_ref().unwrap().ty.id()); - assert_enum_variants(event1_variants, event2_variants); + let event1_variants = get_enum_variants(pallets[i].event.as_ref().unwrap().ty.id); + let event2_variants = get_enum_variants(pallets[i + 1].event.as_ref().unwrap().ty.id); + assert_enum_variants(&event1_variants, &event2_variants); - let err1 = get_enum_variants(pallets[i].error.as_ref().unwrap().ty.id()) + let err1 = get_enum_variants(pallets[i].error.as_ref().unwrap().ty.id) .iter() - .filter(|v| v.name() == "__Ignore") + .filter(|v| v.name == "__Ignore") .cloned() .collect::>(); - let err2 = get_enum_variants(pallets[i + 1].error.as_ref().unwrap().ty.id()) + let err2 = get_enum_variants(pallets[i + 1].error.as_ref().unwrap().ty.id) .iter() - .filter(|v| v.name() == "__Ignore") + .filter(|v| v.name == "__Ignore") .cloned() .collect::>(); assert_enum_variants(&err1, &err2); diff --git a/frame/system/Cargo.toml b/frame/system/Cargo.toml index 5a6c89aae32ea..c97eb66382ed6 100644 --- a/frame/system/Cargo.toml +++ b/frame/system/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } sp-core = { version = "7.0.0", default-features = false, path = "../../primitives/core" } diff --git a/frame/system/benchmarking/Cargo.toml b/frame/system/benchmarking/Cargo.toml index 8f00097254609..50009387a2088 100644 --- a/frame/system/benchmarking/Cargo.toml +++ b/frame/system/benchmarking/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" } diff --git a/frame/timestamp/Cargo.toml b/frame/timestamp/Cargo.toml index 84c56da24e9d4..0f28955259cce 100644 --- a/frame/timestamp/Cargo.toml +++ b/frame/timestamp/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/tips/Cargo.toml b/frame/tips/Cargo.toml index c7db61613c03a..caed4edec5f48 100644 --- a/frame/tips/Cargo.toml +++ b/frame/tips/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/transaction-payment/Cargo.toml b/frame/transaction-payment/Cargo.toml index 0c98796e4d1a7..b1e22d3e9145a 100644 --- a/frame/transaction-payment/Cargo.toml +++ b/frame/transaction-payment/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/transaction-payment/asset-tx-payment/Cargo.toml b/frame/transaction-payment/asset-tx-payment/Cargo.toml index 324e17a0808a4..574eb9e23742b 100644 --- a/frame/transaction-payment/asset-tx-payment/Cargo.toml +++ b/frame/transaction-payment/asset-tx-payment/Cargo.toml @@ -26,7 +26,7 @@ frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = " # Other dependencies codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } [dev-dependencies] diff --git a/frame/transaction-storage/Cargo.toml b/frame/transaction-storage/Cargo.toml index c23be8194d87f..aa19ce3fe2840 100644 --- a/frame/transaction-storage/Cargo.toml +++ b/frame/transaction-storage/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] array-bytes = { version = "4.1", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/treasury/Cargo.toml b/frame/treasury/Cargo.toml index 23fcb7944bfb7..f3c06735f8871 100644 --- a/frame/treasury/Cargo.toml +++ b/frame/treasury/Cargo.toml @@ -18,7 +18,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = "max-encoded-len", ] } impl-trait-for-tuples = "0.2.2" -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/uniques/Cargo.toml b/frame/uniques/Cargo.toml index a01ea60d8c3e5..f88a862daba48 100644 --- a/frame/uniques/Cargo.toml +++ b/frame/uniques/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/utility/Cargo.toml b/frame/utility/Cargo.toml index c00255e3d33d8..a30feec467804 100644 --- a/frame/utility/Cargo.toml +++ b/frame/utility/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index c18d1f45e038b..2aa095bd74bff 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -17,7 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = "derive", ] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/frame/whitelist/Cargo.toml b/frame/whitelist/Cargo.toml index 56ceaca9f81a4..21ecc4be374d3 100644 --- a/frame/whitelist/Cargo.toml +++ b/frame/whitelist/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] } -scale-info = { version = "2.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } diff --git a/primitives/application-crypto/Cargo.toml b/primitives/application-crypto/Cargo.toml index e7aa118dfd6ac..37b58bc2bf649 100644 --- a/primitives/application-crypto/Cargo.toml +++ b/primitives/application-crypto/Cargo.toml @@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-core = { version = "7.0.0", default-features = false, path = "../core" } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true, features = ["derive"] } sp-std = { version = "5.0.0", default-features = false, path = "../std" } sp-io = { version = "7.0.0", default-features = false, path = "../io" } diff --git a/primitives/arithmetic/Cargo.toml b/primitives/arithmetic/Cargo.toml index b3fc6abc33ffd..92eebd4a6d8d6 100644 --- a/primitives/arithmetic/Cargo.toml +++ b/primitives/arithmetic/Cargo.toml @@ -20,7 +20,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = ] } integer-sqrt = "0.1.2" num-traits = { version = "0.2.8", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } static_assertions = "1.1.0" sp-std = { version = "5.0.0", default-features = false, path = "../std" } diff --git a/primitives/authority-discovery/Cargo.toml b/primitives/authority-discovery/Cargo.toml index ff36cf58d366e..e3a82b5fda514 100644 --- a/primitives/authority-discovery/Cargo.toml +++ b/primitives/authority-discovery/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default-features = false, path = "../api" } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../application-crypto" } sp-runtime = { version = "7.0.0", default-features = false, path = "../runtime" } diff --git a/primitives/consensus/aura/Cargo.toml b/primitives/consensus/aura/Cargo.toml index 001dc4a69aca4..94a031a547368 100644 --- a/primitives/consensus/aura/Cargo.toml +++ b/primitives/consensus/aura/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] async-trait = { version = "0.1.57", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default-features = false, path = "../../api" } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../../application-crypto" } sp-consensus = { version = "0.10.0-dev", optional = true, path = "../common" } diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index 334fff2811941..d106cd0d0c875 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] async-trait = { version = "0.1.57", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } merlin = { version = "2.0", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } sp-api = { version = "4.0.0-dev", default-features = false, path = "../../api" } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../../application-crypto" } diff --git a/primitives/consensus/beefy/Cargo.toml b/primitives/consensus/beefy/Cargo.toml index 657569d122b05..144c8452d71b0 100644 --- a/primitives/consensus/beefy/Cargo.toml +++ b/primitives/consensus/beefy/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default-features = false, path = "../../api" } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../../application-crypto" } sp-core = { version = "7.0.0", default-features = false, path = "../../core" } diff --git a/primitives/consensus/grandpa/Cargo.toml b/primitives/consensus/grandpa/Cargo.toml index 5536cf73558d9..446471da8361a 100644 --- a/primitives/consensus/grandpa/Cargo.toml +++ b/primitives/consensus/grandpa/Cargo.toml @@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } grandpa = { package = "finality-grandpa", version = "0.16.2", default-features = false, features = ["derive-codec"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } sp-api = { version = "4.0.0-dev", default-features = false, path = "../../api" } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../../application-crypto" } diff --git a/primitives/consensus/vrf/Cargo.toml b/primitives/consensus/vrf/Cargo.toml index a4f92c30cca03..e7b4f0f0dec0e 100644 --- a/primitives/consensus/vrf/Cargo.toml +++ b/primitives/consensus/vrf/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false } +scale-info = { version = "2.5.0", default-features = false } schnorrkel = { version = "0.9.1", default-features = false, features = ["preaudit_deprecated", "u64_backend"] } sp-core = { version = "7.0.0", default-features = false, path = "../../core" } sp-runtime = { version = "7.0.0", default-features = false, path = "../../runtime" } diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 9b253fd154675..1edd28b3fca7e 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive","max-encoded-len"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } serde = { version = "1.0.136", optional = true, features = ["derive"] } bounded-collections = { version = "0.1.4", default-features = false } diff --git a/primitives/inherents/Cargo.toml b/primitives/inherents/Cargo.toml index fd073db69a6af..2f5616770d681 100644 --- a/primitives/inherents/Cargo.toml +++ b/primitives/inherents/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] async-trait = { version = "0.1.57", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } impl-trait-for-tuples = "0.2.2" thiserror = { version = "1.0.30", optional = true } sp-core = { version = "7.0.0", default-features = false, path = "../core" } diff --git a/primitives/merkle-mountain-range/Cargo.toml b/primitives/merkle-mountain-range/Cargo.toml index 97add1ed1d37c..cb3d6ddd51ad2 100644 --- a/primitives/merkle-mountain-range/Cargo.toml +++ b/primitives/merkle-mountain-range/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } mmr-lib = { package = "ckb-merkle-mountain-range", version = "0.5.2", default-features = false } serde = { version = "1.0.136", features = ["derive"], optional = true } diff --git a/primitives/npos-elections/Cargo.toml b/primitives/npos-elections/Cargo.toml index 7a4bdbd679f0e..50a7a5bcd6088 100644 --- a/primitives/npos-elections/Cargo.toml +++ b/primitives/npos-elections/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } sp-arithmetic = { version = "6.0.0", default-features = false, path = "../arithmetic" } sp-core = { version = "7.0.0", default-features = false, path = "../core" } diff --git a/primitives/npos-elections/fuzzer/Cargo.toml b/primitives/npos-elections/fuzzer/Cargo.toml index 8a058cc92edcf..d7cc684546a5f 100644 --- a/primitives/npos-elections/fuzzer/Cargo.toml +++ b/primitives/npos-elections/fuzzer/Cargo.toml @@ -18,7 +18,7 @@ clap = { version = "4.0.9", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } honggfuzz = "0.5" rand = { version = "0.8", features = ["std", "small_rng"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-npos-elections = { version = "4.0.0-dev", path = ".." } sp-runtime = { version = "7.0.0", path = "../../runtime" } diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index 3976de60cdcf9..056cfa3ddd3a4 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -21,7 +21,7 @@ impl-trait-for-tuples = "0.2.2" log = { version = "0.4.17", default-features = false } paste = "1.0" rand = { version = "0.8.5", optional = true } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../application-crypto" } sp-arithmetic = { version = "6.0.0", default-features = false, path = "../arithmetic" } diff --git a/primitives/runtime/src/generic/digest.rs b/primitives/runtime/src/generic/digest.rs index 73741ba5d1dae..143fc2ce58d90 100644 --- a/primitives/runtime/src/generic/digest.rs +++ b/primitives/runtime/src/generic/digest.rs @@ -453,8 +453,8 @@ mod tests { #[test] fn digest_item_type_info() { let type_info = DigestItem::type_info(); - let variants = if let scale_info::TypeDef::Variant(variant) = type_info.type_def() { - variant.variants() + let variants = if let scale_info::TypeDef::Variant(variant) = type_info.type_def { + variant.variants } else { panic!("Should be a TypeDef::TypeDefVariant") }; @@ -475,10 +475,10 @@ mod tests { let encoded = digest_item.encode(); let variant = variants .iter() - .find(|v| v.name() == &variant_name) + .find(|v| v.name == variant_name) .expect(&format!("Variant {} not found", variant_name)); - assert_eq!(encoded[0], variant.index()) + assert_eq!(encoded[0], variant.index) }; check(DigestItemType::Other); diff --git a/primitives/session/Cargo.toml b/primitives/session/Cargo.toml index 31ec009ab2c64..6f362974b91b4 100644 --- a/primitives/session/Cargo.toml +++ b/primitives/session/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default-features = false, path = "../api" } sp-core = { version = "7.0.0", default-features = false, path = "../core" } sp-runtime = { version = "7.0.0", optional = true, path = "../runtime" } diff --git a/primitives/staking/Cargo.toml b/primitives/staking/Cargo.toml index a8e5a543dbf75..f92bca2788c41 100644 --- a/primitives/staking/Cargo.toml +++ b/primitives/staking/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-core = { version = "7.0.0", default-features = false, path = "../core" } sp-runtime = { version = "7.0.0", default-features = false, path = "../runtime" } sp-std = { version = "5.0.0", default-features = false, path = "../std" } diff --git a/primitives/transaction-storage-proof/Cargo.toml b/primitives/transaction-storage-proof/Cargo.toml index 565d3d8d29f1c..72d3175a577cf 100644 --- a/primitives/transaction-storage-proof/Cargo.toml +++ b/primitives/transaction-storage-proof/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] async-trait = { version = "0.1.57", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", optional = true } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-core = { version = "7.0.0", optional = true, path = "../core" } sp-inherents = { version = "4.0.0-dev", default-features = false, path = "../inherents" } sp-runtime = { version = "7.0.0", default-features = false, path = "../runtime" } diff --git a/primitives/trie/Cargo.toml b/primitives/trie/Cargo.toml index 0dacb76d9f27a..be02303003fd0 100644 --- a/primitives/trie/Cargo.toml +++ b/primitives/trie/Cargo.toml @@ -26,7 +26,7 @@ lazy_static = { version = "1.4.0", optional = true } memory-db = { version = "0.32.0", default-features = false } nohash-hasher = { version = "0.2.0", optional = true } parking_lot = { version = "0.12.1", optional = true } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } thiserror = { version = "1.0.30", optional = true } tracing = { version = "0.1.29", optional = true } trie-db = { version = "0.27.0", default-features = false } diff --git a/primitives/version/Cargo.toml b/primitives/version/Cargo.toml index 7d32c540f9a10..6b425aa7b9d27 100644 --- a/primitives/version/Cargo.toml +++ b/primitives/version/Cargo.toml @@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } impl-serde = { version = "0.4.0", optional = true } parity-wasm = { version = "0.45", optional = true } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } thiserror = { version = "1.0.30", optional = true } sp-core-hashing-proc-macro = { version = "5.0.0", path = "../core/hashing/proc-macro" } diff --git a/primitives/weights/Cargo.toml b/primitives/weights/Cargo.toml index 2368b913b3b2f..af1b5647e24d7 100644 --- a/primitives/weights/Cargo.toml +++ b/primitives/weights/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true, features = ["derive"] } smallvec = "1.8.0" sp-arithmetic = { version = "6.0.0", default-features = false, path = "../arithmetic" } diff --git a/test-utils/runtime/Cargo.toml b/test-utils/runtime/Cargo.toml index 1dcdec0dbf059..68267e91d62cf 100644 --- a/test-utils/runtime/Cargo.toml +++ b/test-utils/runtime/Cargo.toml @@ -20,7 +20,7 @@ sp-consensus-babe = { version = "0.10.0-dev", default-features = false, path = " sp-consensus-beefy = { version = "4.0.0-dev", default-features = false, path = "../../primitives/consensus/beefy" } sp-block-builder = { version = "4.0.0-dev", default-features = false, path = "../../primitives/block-builder" } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-inherents = { version = "4.0.0-dev", default-features = false, path = "../../primitives/inherents" } sp-keyring = { version = "7.0.0", optional = true, path = "../../primitives/keyring" } memory-db = { version = "0.32.0", default-features = false } diff --git a/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml b/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml index 3689a87da8ae5..91f50014667cc 100644 --- a/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml +++ b/utils/frame/rpc/state-trie-migration-rpc/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } serde = { version = "1", features = ["derive"] } log = { version = "0.4.17", default-features = false } From b4f857e14768ebdffe0993886e397c54387b90ee Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Wed, 12 Apr 2023 16:49:10 +0200 Subject: [PATCH 18/93] contracts: add sr25519_verify (#13724) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * wip * fix * wip * fix lint * rm fixture fix * missing comment * fix lint * add comment to the wsm file * fix comment * Apply suggestions from code review Co-authored-by: Sasha Gryaznov * wip * wip weights * wip weights * PR comment: test with return code * wip * PR review add mock test * remove * lint * Update frame/contracts/fixtures/sr25519_verify.wat * fix comments * Update frame/contracts/src/benchmarking/mod.rs * Update frame/contracts/src/wasm/runtime.rs * Update frame/contracts/fixtures/sr25519_verify.wat * Update frame/contracts/src/benchmarking/mod.rs * fix lint * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * Update frame/contracts/src/wasm/runtime.rs Co-authored-by: Alexander Theißen * PR: review use unstable + remove arbitrary index 4 * Add benchmark for calculating overhead of calling sr25519_verify * fix message length encoding * fix weights * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts * Apply suggestions from code review * Update frame/contracts/src/wasm/runtime.rs * Update frame/contracts/src/wasm/runtime.rs * Update frame/contracts/src/benchmarking/mod.rs * Update frame/contracts/src/benchmarking/mod.rs * Update frame/contracts/src/schedule.rs Co-authored-by: Sasha Gryaznov * Update frame/contracts/src/schedule.rs Co-authored-by: Sasha Gryaznov * Update frame/contracts/src/wasm/runtime.rs * Update frame/contracts/src/wasm/runtime.rs Co-authored-by: Sasha Gryaznov * PR review --------- Co-authored-by: Sasha Gryaznov Co-authored-by: command-bot <> Co-authored-by: Alexander Theißen --- frame/contracts/fixtures/sr25519_verify.wat | 55 + frame/contracts/src/benchmarking/mod.rs | 107 +- frame/contracts/src/exec.rs | 16 +- frame/contracts/src/schedule.rs | 10 +- frame/contracts/src/tests.rs | 66 + frame/contracts/src/wasm/mod.rs | 49 + frame/contracts/src/wasm/runtime.rs | 47 + frame/contracts/src/weights.rs | 1876 ++++++++++--------- 8 files changed, 1332 insertions(+), 894 deletions(-) create mode 100644 frame/contracts/fixtures/sr25519_verify.wat diff --git a/frame/contracts/fixtures/sr25519_verify.wat b/frame/contracts/fixtures/sr25519_verify.wat new file mode 100644 index 0000000000000..2da1ceb87eab0 --- /dev/null +++ b/frame/contracts/fixtures/sr25519_verify.wat @@ -0,0 +1,55 @@ +;; This contract: +;; 1) Reads signature, message and public key from the input +;; 2) Calls and return the result of sr25519_verify + +(module + ;; import the host functions from the seal0 module + (import "seal0" "sr25519_verify" (func $sr25519_verify (param i32 i32 i32 i32) (result i32))) + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) + + ;; give the program 1 page of memory + (import "env" "memory" (memory 1 1)) + + ;; [0, 4) length of signature + message + public key - 64 + 11 + 32 = 107 bytes + ;; write the length of the input (6b = 107) bytes at offset 0 + (data (i32.const 0) "\6b") + + (func (export "deploy")) + + (func (export "call") + ;; define local variables + (local $signature_ptr i32) + (local $pub_key_ptr i32) + (local $message_len i32) + (local $message_ptr i32) + + ;; set the pointers to the memory locations + ;; Memory layout during `call` + ;; [10, 74) signature + ;; [74, 106) public key + ;; [106, 117) message (11 bytes) + (local.set $signature_ptr (i32.const 10)) + (local.set $pub_key_ptr (i32.const 74)) + (local.set $message_ptr (i32.const 106)) + + ;; store the input into the memory, starting at the signature and + ;; up to 107 bytes stored at offset 0 + (call $seal_input (local.get $signature_ptr) (i32.const 0)) + + ;; call sr25519_verify and store the return code + (i32.store + (i32.const 0) + (call $sr25519_verify + (local.get $signature_ptr) + (local.get $pub_key_ptr) + (i32.const 11) + (local.get $message_ptr) + ) + ) + + ;; exit with success and take transfer return code to the output buffer + (call $seal_return (i32.const 0) (i32.const 0) (i32.const 4)) + ) +) + diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 1bb6f3395fcef..98a3dc36b7b68 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -2008,9 +2008,114 @@ benchmarks! { let origin = RawOrigin::Signed(instance.caller.clone()); }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) + // `n`: Message input length to verify in bytes. + #[pov_mode = Measured] + seal_sr25519_verify_per_byte { + let n in 0 .. T::MaxCodeLen::get() - 255; // need some buffer so the code size does not + // exceed the max code size. + + let message = (0..n).zip((32u8..127u8).cycle()).map(|(_, c)| c).collect::>(); + let message_len = message.len() as i32; + + let key_type = sp_core::crypto::KeyTypeId(*b"code"); + let pub_key = sp_io::crypto::sr25519_generate(key_type, None); + let sig = sp_io::crypto::sr25519_sign(key_type, &pub_key, &message).expect("Generates signature"); + let sig = AsRef::<[u8; 64]>::as_ref(&sig).to_vec(); + + let code = WasmModule::::from(ModuleDefinition { + memory: Some(ImportedMemory::max::()), + imported_functions: vec![ImportedFunction { + module: "seal0", + name: "sr25519_verify", + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], + return_type: Some(ValueType::I32), + }], + data_segments: vec![ + DataSegment { + offset: 0, + value: sig, + }, + DataSegment { + offset: 64, + value: pub_key.to_vec(), + }, + DataSegment { + offset: 96, + value: message, + }, + ], + call_body: Some(body::plain(vec![ + Instruction::I32Const(0), // signature_ptr + Instruction::I32Const(64), // pub_key_ptr + Instruction::I32Const(message_len), // message_len + Instruction::I32Const(96), // message_ptr + Instruction::Call(0), + Instruction::Drop, + Instruction::End, + ])), + .. Default::default() + }); + + let instance = Contract::::new(code, vec![])?; + let origin = RawOrigin::Signed(instance.caller.clone()); + }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) + // Only calling the function itself with valid arguments. // It generates different private keys and signatures for the message "Hello world". - // This is a slow call: We redeuce the number of runs. + // This is a slow call: We reduce the number of runs. + #[pov_mode = Measured] + seal_sr25519_verify { + let r in 0 .. API_BENCHMARK_RUNS / 10; + + let message = b"Hello world".to_vec(); + let message_len = message.len() as i32; + let key_type = sp_core::crypto::KeyTypeId(*b"code"); + let sig_params = (0..r) + .map(|i| { + let pub_key = sp_io::crypto::sr25519_generate(key_type, None); + let sig = sp_io::crypto::sr25519_sign(key_type, &pub_key, &message).expect("Generates signature"); + let data: [u8; 96] = [AsRef::<[u8]>::as_ref(&sig), AsRef::<[u8]>::as_ref(&pub_key)].concat().try_into().unwrap(); + data + }) + .flatten() + .collect::>(); + let sig_params_len = sig_params.len() as i32; + + let code = WasmModule::::from(ModuleDefinition { + memory: Some(ImportedMemory::max::()), + imported_functions: vec![ImportedFunction { + module: "seal0", + name: "sr25519_verify", + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], + return_type: Some(ValueType::I32), + }], + data_segments: vec![ + DataSegment { + offset: 0, + value: sig_params + }, + DataSegment { + offset: sig_params_len as u32, + value: message, + }, + ], + call_body: Some(body::repeated_dyn(r, vec![ + Counter(0, 96), // signature_ptr + Counter(64, 96), // pub_key_ptr + Regular(Instruction::I32Const(message_len)), // message_len + Regular(Instruction::I32Const(sig_params_len)), // message_ptr + Regular(Instruction::Call(0)), + Regular(Instruction::Drop), + ])), + .. Default::default() + }); + let instance = Contract::::new(code, vec![])?; + let origin = RawOrigin::Signed(instance.caller.clone()); + }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) + + // Only calling the function itself with valid arguments. + // It generates different private keys and signatures for the message "Hello world". + // This is a slow call: We reduce the number of runs. #[pov_mode = Measured] seal_ecdsa_recover { let r in 0 .. API_BENCHMARK_RUNS / 10; diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 03e1c4fd32585..574f4495e479f 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -35,7 +35,10 @@ use frame_support::{ use frame_system::RawOrigin; use pallet_contracts_primitives::ExecReturnValue; use smallvec::{Array, SmallVec}; -use sp_core::ecdsa::Public as ECDSAPublic; +use sp_core::{ + ecdsa::Public as ECDSAPublic, + sr25519::{Public as SR25519Public, Signature as SR25519Signature}, +}; use sp_io::{crypto::secp256k1_ecdsa_recover_compressed, hashing::blake2_256}; use sp_runtime::traits::{Convert, Hash}; use sp_std::{marker::PhantomData, mem, prelude::*, vec::Vec}; @@ -272,6 +275,9 @@ pub trait Ext: sealing::Sealed { /// Recovers ECDSA compressed public key based on signature and message hash. fn ecdsa_recover(&self, signature: &[u8; 65], message_hash: &[u8; 32]) -> Result<[u8; 33], ()>; + /// Verify a sr25519 signature. + fn sr25519_verify(&self, signature: &[u8; 64], message: &[u8], pub_key: &[u8; 32]) -> bool; + /// Returns Ethereum address from the ECDSA compressed public key. fn ecdsa_to_eth_address(&self, pk: &[u8; 33]) -> Result<[u8; 20], ()>; @@ -1347,6 +1353,14 @@ where secp256k1_ecdsa_recover_compressed(signature, message_hash).map_err(|_| ()) } + fn sr25519_verify(&self, signature: &[u8; 64], message: &[u8], pub_key: &[u8; 32]) -> bool { + sp_io::crypto::sr25519_verify( + &SR25519Signature(*signature), + message, + &SR25519Public(*pub_key), + ) + } + fn ecdsa_to_eth_address(&self, pk: &[u8; 33]) -> Result<[u8; 20], ()> { ECDSAPublic(*pk).to_eth_address() } diff --git a/frame/contracts/src/schedule.rs b/frame/contracts/src/schedule.rs index ccf1e98bd2382..747540bce6359 100644 --- a/frame/contracts/src/schedule.rs +++ b/frame/contracts/src/schedule.rs @@ -139,7 +139,7 @@ impl Limits { /// Describes the weight for all categories of supported wasm instructions. /// /// There there is one field for each wasm instruction that describes the weight to -/// execute one instruction of that name. There are a few execptions: +/// execute one instruction of that name. There are a few exceptions: /// /// 1. If there is a i64 and a i32 variant of an instruction we use the weight /// of the former for both. @@ -409,6 +409,12 @@ pub struct HostFnWeights { /// Weight of calling `seal_ecdsa_to_eth_address`. pub ecdsa_to_eth_address: Weight, + /// Weight of calling `sr25519_verify`. + pub sr25519_verify: Weight, + + /// Weight per byte of calling `sr25519_verify`. + pub sr25519_verify_per_byte: Weight, + /// Weight of calling `reentrance_count`. pub reentrance_count: Weight, @@ -616,6 +622,8 @@ impl Default for HostFnWeights { hash_blake2_128: cost!(seal_hash_blake2_128), hash_blake2_128_per_byte: cost!(seal_hash_blake2_128_per_byte), ecdsa_recover: cost!(seal_ecdsa_recover), + sr25519_verify: cost!(seal_sr25519_verify), + sr25519_verify_per_byte: cost!(seal_sr25519_verify_per_byte), ecdsa_to_eth_address: cost!(seal_ecdsa_to_eth_address), reentrance_count: cost!(seal_reentrance_count), account_reentrance_count: cost!(seal_account_reentrance_count), diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index bae6c1946e183..ac1fb07bf5ce0 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -2900,6 +2900,72 @@ fn ecdsa_recover() { }) } +#[test] +fn sr25519_verify() { + let (wasm, _code_hash) = compile_module::("sr25519_verify").unwrap(); + + ExtBuilder::default().existential_deposit(50).build().execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + + // Instantiate the sr25519_verify contract. + let addr = Contracts::bare_instantiate( + ALICE, + 100_000, + GAS_LIMIT, + None, + Code::Upload(wasm), + vec![], + vec![], + false, + ) + .result + .unwrap() + .account_id; + + let call_with = |message: &[u8; 11]| { + // Alice's signature for "hello world" + #[rustfmt::skip] + let signature: [u8; 64] = [ + 184, 49, 74, 238, 78, 165, 102, 252, 22, 92, 156, 176, 124, 118, 168, 116, 247, + 99, 0, 94, 2, 45, 9, 170, 73, 222, 182, 74, 60, 32, 75, 64, 98, 174, 69, 55, 83, + 85, 180, 98, 208, 75, 231, 57, 205, 62, 4, 105, 26, 136, 172, 17, 123, 99, 90, 255, + 228, 54, 115, 63, 30, 207, 205, 131, + ]; + + // Alice's public key + #[rustfmt::skip] + let public_key: [u8; 32] = [ + 212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, + 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125, + ]; + + let mut params = vec![]; + params.extend_from_slice(&signature); + params.extend_from_slice(&public_key); + params.extend_from_slice(message); + + >::bare_call( + ALICE, + addr.clone(), + 0, + GAS_LIMIT, + None, + params, + false, + Determinism::Enforced, + ) + .result + .unwrap() + }; + + // verification should succeed for "hello world" + assert_return_code!(call_with(&b"hello world"), RuntimeReturnCode::Success); + + // verification should fail for other messages + assert_return_code!(call_with(&b"hello worlD"), RuntimeReturnCode::Sr25519VerifyFailed); + }) +} + #[test] fn upload_code_works() { let (wasm, code_hash) = compile_module::("dummy").unwrap(); diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index e4e8bea7eb04a..c8f1be6dd9db1 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -434,6 +434,7 @@ mod tests { gas_meter: GasMeter, debug_buffer: Vec, ecdsa_recover: RefCell>, + sr25519_verify: RefCell, [u8; 32])>>, code_hashes: Vec>, } @@ -458,6 +459,7 @@ mod tests { gas_meter: GasMeter::new(Weight::from_parts(10_000_000_000, 10 * 1024 * 1024)), debug_buffer: Default::default(), ecdsa_recover: Default::default(), + sr25519_verify: Default::default(), } } } @@ -612,6 +614,10 @@ mod tests { self.ecdsa_recover.borrow_mut().push((*signature, *message_hash)); Ok([3; 33]) } + fn sr25519_verify(&self, signature: &[u8; 64], message: &[u8], pub_key: &[u8; 32]) -> bool { + self.sr25519_verify.borrow_mut().push((*signature, message.to_vec(), *pub_key)); + true + } fn contract_info(&mut self) -> &mut crate::ContractInfo { unimplemented!() } @@ -1319,6 +1325,49 @@ mod tests { ); } + #[test] + fn contract_sr25519() { + const CODE_SR25519: &str = r#" +(module + (import "seal0" "sr25519_verify" (func $sr25519_verify (param i32 i32 i32 i32) (result i32))) + (import "env" "memory" (memory 1 1)) + (func (export "call") + (drop + (call $sr25519_verify + (i32.const 0) ;; Pointer to signature. + (i32.const 64) ;; Pointer to public key. + (i32.const 16) ;; message length. + (i32.const 96) ;; Pointer to message. + ) + ) + ) + (func (export "deploy")) + + ;; Signature (64 bytes) + (data (i32.const 0) + "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" + "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" + "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" + "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" + ) + + ;; public key (32 bytes) + (data (i32.const 64) + "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" + "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" + ) + + ;; message. (16 bytes) + (data (i32.const 96) + "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" + ) +) +"#; + let mut mock_ext = MockExt::default(); + assert_ok!(execute(&CODE_SR25519, vec![], &mut mock_ext)); + assert_eq!(mock_ext.sr25519_verify.into_inner(), [([1; 64], [1; 16].to_vec(), [1; 32])]); + } + const CODE_GET_STORAGE: &str = r#" (module (import "seal0" "seal_get_storage" (func $seal_get_storage (param i32 i32 i32) (result i32))) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 88b5b87dda411..19eb0fb50739b 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -109,6 +109,8 @@ pub enum ReturnCode { /// ECDSA compressed pubkey conversion into Ethereum address failed (most probably /// wrong pubkey provided). EcdsaRecoverFailed = 11, + /// sr25519 signature verification failed. + Sr25519VerifyFailed = 12, } impl From for ReturnCode { @@ -251,6 +253,8 @@ pub enum RuntimeCosts { HashBlake128(u32), /// Weight of calling `seal_ecdsa_recover`. EcdsaRecovery, + /// Weight of calling `seal_sr25519_verify` for the given input size. + Sr25519Verify(u32), /// Weight charged by a chain extension through `seal_call_chain_extension`. ChainExtension(Weight), /// Weight charged for calling into the runtime. @@ -336,6 +340,9 @@ impl RuntimeCosts { .hash_blake2_128 .saturating_add(s.hash_blake2_128_per_byte.saturating_mul(len.into())), EcdsaRecovery => s.ecdsa_recover, + Sr25519Verify(len) => s + .sr25519_verify + .saturating_add(s.sr25519_verify_per_byte.saturating_mul(len.into())), ChainExtension(weight) => weight, CallRuntime(weight) => weight, SetCodeHash => s.set_code_hash, @@ -2466,6 +2473,46 @@ pub mod env { } } + /// Verify a sr25519 signature + /// + /// # Parameters + /// + /// - `signature_ptr`: the pointer into the linear memory where the signature is placed. Should + /// be a value of 64 bytes. + /// - `pub_key_ptr`: the pointer into the linear memory where the public key is placed. Should + /// be a value of 32 bytes. + /// - `message_len`: the length of the message payload. + /// - `message_ptr`: the pointer into the linear memory where the message is placed. + /// + /// # Errors + /// + /// - `ReturnCode::Sr25519VerifyFailed + #[unstable] + fn sr25519_verify( + ctx: _, + memory: _, + signature_ptr: u32, + pub_key_ptr: u32, + message_len: u32, + message_ptr: u32, + ) -> Result { + ctx.charge_gas(RuntimeCosts::Sr25519Verify(message_len))?; + + let mut signature: [u8; 64] = [0; 64]; + ctx.read_sandbox_memory_into_buf(memory, signature_ptr, &mut signature)?; + + let mut pub_key: [u8; 32] = [0; 32]; + ctx.read_sandbox_memory_into_buf(memory, pub_key_ptr, &mut pub_key)?; + + let message: Vec = ctx.read_sandbox_memory(memory, message_ptr, message_len)?; + + if ctx.ext.sr25519_verify(&signature, &message, &pub_key) { + Ok(ReturnCode::Success) + } else { + Ok(ReturnCode::Sr25519VerifyFailed) + } + } + /// Replace the contract code at the specified address with new code. /// /// # Note diff --git a/frame/contracts/src/weights.rs b/frame/contracts/src/weights.rs index 22a24aa27fe01..8e81364acf449 100644 --- a/frame/contracts/src/weights.rs +++ b/frame/contracts/src/weights.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -108,6 +108,8 @@ pub trait WeightInfo { fn seal_hash_blake2_256_per_byte(n: u32, ) -> Weight; fn seal_hash_blake2_128(r: u32, ) -> Weight; fn seal_hash_blake2_128_per_byte(n: u32, ) -> Weight; + fn seal_sr25519_verify_per_byte(n: u32, ) -> Weight; + fn seal_sr25519_verify(r: u32, ) -> Weight; fn seal_ecdsa_recover(r: u32, ) -> Weight; fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight; fn seal_set_code_hash(r: u32, ) -> Weight; @@ -176,8 +178,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 2_677_000 picoseconds. - Weight::from_parts(2_899_000, 1594) + // Minimum execution time: 2_503_000 picoseconds. + Weight::from_parts(2_603_000, 1594) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Skipped Metadata (r:0 w:0) @@ -187,10 +189,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `488 + k * (69 ±0)` // Estimated: `478 + k * (70 ±0)` - // Minimum execution time: 14_006_000 picoseconds. - Weight::from_parts(8_735_946, 478) - // Standard Error: 1_370 - .saturating_add(Weight::from_parts(989_501, 0).saturating_mul(k.into())) + // Minimum execution time: 13_292_000 picoseconds. + Weight::from_parts(9_180_439, 478) + // Standard Error: 997 + .saturating_add(Weight::from_parts(967_522, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -206,10 +208,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `238 + c * (1 ±0)` // Estimated: `3951 + c * (2 ±0)` - // Minimum execution time: 30_951_000 picoseconds. - Weight::from_parts(25_988_560, 3951) - // Standard Error: 57 - .saturating_add(Weight::from_parts(54_692, 0).saturating_mul(c.into())) + // Minimum execution time: 30_822_000 picoseconds. + Weight::from_parts(26_457_115, 3951) + // Standard Error: 58 + .saturating_add(Weight::from_parts(54_868, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 2).saturating_mul(c.into())) @@ -229,10 +231,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `707` // Estimated: `21400 + c * (5 ±0)` - // Minimum execution time: 263_107_000 picoseconds. - Weight::from_parts(268_289_665, 21400) - // Standard Error: 33 - .saturating_add(Weight::from_parts(38_534, 0).saturating_mul(c.into())) + // Minimum execution time: 263_719_000 picoseconds. + Weight::from_parts(275_281_941, 21400) + // Standard Error: 32 + .saturating_add(Weight::from_parts(37_880, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 5).saturating_mul(c.into())) @@ -260,14 +262,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `270` // Estimated: `26207` - // Minimum execution time: 3_122_319_000 picoseconds. - Weight::from_parts(487_802_180, 26207) - // Standard Error: 345 - .saturating_add(Weight::from_parts(108_237, 0).saturating_mul(c.into())) - // Standard Error: 20 - .saturating_add(Weight::from_parts(1_166, 0).saturating_mul(i.into())) - // Standard Error: 20 - .saturating_add(Weight::from_parts(1_505, 0).saturating_mul(s.into())) + // Minimum execution time: 3_133_756_000 picoseconds. + Weight::from_parts(556_483_545, 26207) + // Standard Error: 294 + .saturating_add(Weight::from_parts(107_914, 0).saturating_mul(c.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_143, 0).saturating_mul(i.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_456, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -291,12 +293,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `482` // Estimated: `28521` - // Minimum execution time: 1_650_623_000 picoseconds. - Weight::from_parts(286_494_456, 28521) + // Minimum execution time: 1_646_953_000 picoseconds. + Weight::from_parts(262_115_215, 28521) // Standard Error: 8 - .saturating_add(Weight::from_parts(1_438, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_454, 0).saturating_mul(i.into())) // Standard Error: 8 - .saturating_add(Weight::from_parts(1_453, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_463, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -314,8 +316,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `759` // Estimated: `21615` - // Minimum execution time: 191_046_000 picoseconds. - Weight::from_parts(192_544_000, 21615) + // Minimum execution time: 190_769_000 picoseconds. + Weight::from_parts(191_717_000, 21615) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -332,10 +334,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `7366` - // Minimum execution time: 244_260_000 picoseconds. - Weight::from_parts(254_693_985, 7366) - // Standard Error: 80 - .saturating_add(Weight::from_parts(108_246, 0).saturating_mul(c.into())) + // Minimum execution time: 246_204_000 picoseconds. + Weight::from_parts(243_234_754, 7366) + // Standard Error: 78 + .saturating_add(Weight::from_parts(109_232, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -351,8 +353,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `255` // Estimated: `7950` - // Minimum execution time: 33_492_000 picoseconds. - Weight::from_parts(34_079_000, 7950) + // Minimum execution time: 33_516_000 picoseconds. + Weight::from_parts(33_995_000, 7950) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -366,8 +368,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `570` // Estimated: `19530` - // Minimum execution time: 33_475_000 picoseconds. - Weight::from_parts(33_856_000, 19530) + // Minimum execution time: 33_255_000 picoseconds. + Weight::from_parts(33_692_000, 19530) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -386,10 +388,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `781 + r * (6 ±0)` // Estimated: `21730 + r * (30 ±0)` - // Minimum execution time: 234_197_000 picoseconds. - Weight::from_parts(236_830_305, 21730) - // Standard Error: 818 - .saturating_add(Weight::from_parts(336_446, 0).saturating_mul(r.into())) + // Minimum execution time: 235_074_000 picoseconds. + Weight::from_parts(243_735_179, 21730) + // Standard Error: 972 + .saturating_add(Weight::from_parts(328_571, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -409,10 +411,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `839 + r * (240 ±0)` // Estimated: `21835 + r * (3675 ±0)` - // Minimum execution time: 235_872_000 picoseconds. - Weight::from_parts(78_877_890, 21835) - // Standard Error: 6_405 - .saturating_add(Weight::from_parts(3_358_341, 0).saturating_mul(r.into())) + // Minimum execution time: 236_455_000 picoseconds. + Weight::from_parts(81_818_936, 21835) + // Standard Error: 5_874 + .saturating_add(Weight::from_parts(3_316_006, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -433,10 +435,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `831 + r * (244 ±0)` // Estimated: `21855 + r * (3695 ±0)` - // Minimum execution time: 239_035_000 picoseconds. - Weight::from_parts(93_255_085, 21855) - // Standard Error: 5_922 - .saturating_add(Weight::from_parts(4_144_910, 0).saturating_mul(r.into())) + // Minimum execution time: 237_724_000 picoseconds. + Weight::from_parts(91_384_964, 21855) + // Standard Error: 5_828 + .saturating_add(Weight::from_parts(4_063_221, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -457,10 +459,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `788 + r * (6 ±0)` // Estimated: `21770 + r * (30 ±0)` - // Minimum execution time: 236_507_000 picoseconds. - Weight::from_parts(238_253_211, 21770) - // Standard Error: 975 - .saturating_add(Weight::from_parts(413_919, 0).saturating_mul(r.into())) + // Minimum execution time: 236_144_000 picoseconds. + Weight::from_parts(239_917_873, 21770) + // Standard Error: 629 + .saturating_add(Weight::from_parts(409_752, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -480,10 +482,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `778 + r * (3 ±0)` // Estimated: `21735 + r * (15 ±0)` - // Minimum execution time: 235_521_000 picoseconds. - Weight::from_parts(238_397_362, 21735) - // Standard Error: 452 - .saturating_add(Weight::from_parts(160_860, 0).saturating_mul(r.into())) + // Minimum execution time: 232_946_000 picoseconds. + Weight::from_parts(243_163_112, 21735) + // Standard Error: 1_940 + .saturating_add(Weight::from_parts(162_705, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 15).saturating_mul(r.into())) @@ -503,10 +505,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `782 + r * (6 ±0)` // Estimated: `21740 + r * (30 ±0)` - // Minimum execution time: 234_722_000 picoseconds. - Weight::from_parts(242_936_096, 21740) - // Standard Error: 1_178 - .saturating_add(Weight::from_parts(329_075, 0).saturating_mul(r.into())) + // Minimum execution time: 235_301_000 picoseconds. + Weight::from_parts(240_802_312, 21740) + // Standard Error: 5_362 + .saturating_add(Weight::from_parts(339_001, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -526,10 +528,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `783 + r * (6 ±0)` // Estimated: `21725 + r * (30 ±0)` - // Minimum execution time: 235_654_000 picoseconds. - Weight::from_parts(245_887_792, 21725) - // Standard Error: 903 - .saturating_add(Weight::from_parts(325_168, 0).saturating_mul(r.into())) + // Minimum execution time: 235_683_000 picoseconds. + Weight::from_parts(237_357_276, 21725) + // Standard Error: 726 + .saturating_add(Weight::from_parts(333_264, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -549,10 +551,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `922 + r * (6 ±0)` // Estimated: `24633 + r * (30 ±0)` - // Minimum execution time: 233_599_000 picoseconds. - Weight::from_parts(251_561_602, 24633) - // Standard Error: 3_348 - .saturating_add(Weight::from_parts(1_475_443, 0).saturating_mul(r.into())) + // Minimum execution time: 234_327_000 picoseconds. + Weight::from_parts(239_792_456, 24633) + // Standard Error: 3_460 + .saturating_add(Weight::from_parts(1_496_090, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -572,10 +574,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `792 + r * (6 ±0)` // Estimated: `21825 + r * (30 ±0)` - // Minimum execution time: 235_087_000 picoseconds. - Weight::from_parts(235_855_322, 21825) - // Standard Error: 867 - .saturating_add(Weight::from_parts(346_707, 0).saturating_mul(r.into())) + // Minimum execution time: 235_466_000 picoseconds. + Weight::from_parts(242_580_658, 21825) + // Standard Error: 1_439 + .saturating_add(Weight::from_parts(323_842, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -595,10 +597,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `790 + r * (6 ±0)` // Estimated: `21815 + r * (30 ±0)` - // Minimum execution time: 237_103_000 picoseconds. - Weight::from_parts(239_272_188, 21815) - // Standard Error: 892 - .saturating_add(Weight::from_parts(328_334, 0).saturating_mul(r.into())) + // Minimum execution time: 238_529_000 picoseconds. + Weight::from_parts(249_276_722, 21815) + // Standard Error: 1_216 + .saturating_add(Weight::from_parts(328_600, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -618,10 +620,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `787 + r * (6 ±0)` // Estimated: `21805 + r * (30 ±0)` - // Minimum execution time: 234_761_000 picoseconds. - Weight::from_parts(238_601_784, 21805) - // Standard Error: 725 - .saturating_add(Weight::from_parts(325_758, 0).saturating_mul(r.into())) + // Minimum execution time: 234_360_000 picoseconds. + Weight::from_parts(239_927_876, 21805) + // Standard Error: 541 + .saturating_add(Weight::from_parts(319_553, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -641,10 +643,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `778 + r * (6 ±0)` // Estimated: `21735 + r * (30 ±0)` - // Minimum execution time: 235_249_000 picoseconds. - Weight::from_parts(239_861_242, 21735) - // Standard Error: 751 - .saturating_add(Weight::from_parts(325_795, 0).saturating_mul(r.into())) + // Minimum execution time: 234_461_000 picoseconds. + Weight::from_parts(239_682_633, 21735) + // Standard Error: 544 + .saturating_add(Weight::from_parts(322_943, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -666,10 +668,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `856 + r * (10 ±0)` // Estimated: `24446 + r * (60 ±0)` - // Minimum execution time: 234_912_000 picoseconds. - Weight::from_parts(254_783_734, 24446) - // Standard Error: 1_610 - .saturating_add(Weight::from_parts(1_307_506, 0).saturating_mul(r.into())) + // Minimum execution time: 234_862_000 picoseconds. + Weight::from_parts(252_614_390, 24446) + // Standard Error: 1_180 + .saturating_add(Weight::from_parts(1_313_286, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 60).saturating_mul(r.into())) @@ -689,10 +691,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `745 + r * (4 ±0)` // Estimated: `21555 + r * (20 ±0)` - // Minimum execution time: 160_125_000 picoseconds. - Weight::from_parts(164_915_574, 21555) - // Standard Error: 332 - .saturating_add(Weight::from_parts(132_326, 0).saturating_mul(r.into())) + // Minimum execution time: 161_003_000 picoseconds. + Weight::from_parts(165_793_675, 21555) + // Standard Error: 323 + .saturating_add(Weight::from_parts(128_941, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(r.into())) @@ -712,10 +714,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `780 + r * (6 ±0)` // Estimated: `21740 + r * (30 ±0)` - // Minimum execution time: 234_717_000 picoseconds. - Weight::from_parts(238_540_521, 21740) - // Standard Error: 599 - .saturating_add(Weight::from_parts(277_303, 0).saturating_mul(r.into())) + // Minimum execution time: 235_192_000 picoseconds. + Weight::from_parts(241_225_671, 21740) + // Standard Error: 1_132 + .saturating_add(Weight::from_parts(272_760, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -735,10 +737,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `784` // Estimated: `21740` - // Minimum execution time: 235_792_000 picoseconds. - Weight::from_parts(244_114_692, 21740) + // Minimum execution time: 238_050_000 picoseconds. + Weight::from_parts(241_274_832, 21740) // Standard Error: 1 - .saturating_add(Weight::from_parts(589, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(590, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -757,10 +759,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `768 + r * (45 ±0)` // Estimated: `21660 + r * (225 ±0)` - // Minimum execution time: 231_166_000 picoseconds. - Weight::from_parts(233_339_177, 21660) - // Standard Error: 155_889 - .saturating_add(Weight::from_parts(3_124_322, 0).saturating_mul(r.into())) + // Minimum execution time: 231_807_000 picoseconds. + Weight::from_parts(234_264_848, 21660) + // Standard Error: 185_298 + .saturating_add(Weight::from_parts(1_000_351, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 225).saturating_mul(r.into())) @@ -780,10 +782,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `778` // Estimated: `21775` - // Minimum execution time: 235_721_000 picoseconds. - Weight::from_parts(237_413_703, 21775) - // Standard Error: 1 - .saturating_add(Weight::from_parts(177, 0).saturating_mul(n.into())) + // Minimum execution time: 234_347_000 picoseconds. + Weight::from_parts(234_774_467, 21775) + // Standard Error: 0 + .saturating_add(Weight::from_parts(183, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -808,10 +810,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `810 + r * (356 ±0)` // Estimated: `26094 + r * (15904 ±0)` - // Minimum execution time: 233_525_000 picoseconds. - Weight::from_parts(235_871_034, 26094) - // Standard Error: 235_338 - .saturating_add(Weight::from_parts(118_659_865, 0).saturating_mul(r.into())) + // Minimum execution time: 234_356_000 picoseconds. + Weight::from_parts(236_844_659, 26094) + // Standard Error: 161_035 + .saturating_add(Weight::from_parts(110_725_340, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -835,10 +837,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `825 + r * (10 ±0)` // Estimated: `24283 + r * (60 ±0)` - // Minimum execution time: 235_007_000 picoseconds. - Weight::from_parts(248_419_686, 24283) - // Standard Error: 1_847 - .saturating_add(Weight::from_parts(1_815_822, 0).saturating_mul(r.into())) + // Minimum execution time: 234_248_000 picoseconds. + Weight::from_parts(255_712_101, 24283) + // Standard Error: 1_474 + .saturating_add(Weight::from_parts(1_753_943, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 60).saturating_mul(r.into())) @@ -858,10 +860,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `778 + r * (10 ±0)` // Estimated: `21735 + r * (50 ±0)` - // Minimum execution time: 232_912_000 picoseconds. - Weight::from_parts(256_142_885, 21735) - // Standard Error: 2_741 - .saturating_add(Weight::from_parts(3_542_482, 0).saturating_mul(r.into())) + // Minimum execution time: 232_456_000 picoseconds. + Weight::from_parts(230_738_907, 21735) + // Standard Error: 4_163 + .saturating_add(Weight::from_parts(3_496_817, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 50).saturating_mul(r.into())) @@ -882,12 +884,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `797 + t * (32 ±0)` // Estimated: `21840 + t * (2640 ±0)` - // Minimum execution time: 251_018_000 picoseconds. - Weight::from_parts(245_280_765, 21840) - // Standard Error: 90_317 - .saturating_add(Weight::from_parts(2_434_496, 0).saturating_mul(t.into())) + // Minimum execution time: 251_638_000 picoseconds. + Weight::from_parts(244_791_817, 21840) + // Standard Error: 89_537 + .saturating_add(Weight::from_parts(2_459_492, 0).saturating_mul(t.into())) // Standard Error: 25 - .saturating_add(Weight::from_parts(599, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(626, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -909,10 +911,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `777 + r * (7 ±0)` // Estimated: `21725 + r * (35 ±0)` - // Minimum execution time: 164_022_000 picoseconds. - Weight::from_parts(168_658_387, 21725) - // Standard Error: 685 - .saturating_add(Weight::from_parts(238_133, 0).saturating_mul(r.into())) + // Minimum execution time: 164_736_000 picoseconds. + Weight::from_parts(164_496_597, 21725) + // Standard Error: 4_619 + .saturating_add(Weight::from_parts(252_013, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 35).saturating_mul(r.into())) @@ -932,10 +934,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `125728` // Estimated: `269977` - // Minimum execution time: 351_043_000 picoseconds. - Weight::from_parts(353_707_344, 269977) - // Standard Error: 3 - .saturating_add(Weight::from_parts(752, 0).saturating_mul(i.into())) + // Minimum execution time: 352_146_000 picoseconds. + Weight::from_parts(357_758_251, 269977) + // Standard Error: 1 + .saturating_add(Weight::from_parts(735, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -946,10 +948,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `845 + r * (292 ±0)` // Estimated: `843 + r * (293 ±0)` - // Minimum execution time: 235_854_000 picoseconds. - Weight::from_parts(133_986_225, 843) - // Standard Error: 9_550 - .saturating_add(Weight::from_parts(6_093_051, 0).saturating_mul(r.into())) + // Minimum execution time: 236_170_000 picoseconds. + Weight::from_parts(136_284_582, 843) + // Standard Error: 10_269 + .saturating_add(Weight::from_parts(5_995_228, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -963,10 +965,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1304` // Estimated: `1280` - // Minimum execution time: 252_321_000 picoseconds. - Weight::from_parts(285_820_577, 1280) - // Standard Error: 60 - .saturating_add(Weight::from_parts(600, 0).saturating_mul(n.into())) + // Minimum execution time: 253_837_000 picoseconds. + Weight::from_parts(287_029_261, 1280) + // Standard Error: 51 + .saturating_add(Weight::from_parts(534, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -977,10 +979,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1167 + n * (1 ±0)` // Estimated: `1167 + n * (1 ±0)` - // Minimum execution time: 252_047_000 picoseconds. - Weight::from_parts(254_244_310, 1167) - // Standard Error: 15 - .saturating_add(Weight::from_parts(144, 0).saturating_mul(n.into())) + // Minimum execution time: 253_037_000 picoseconds. + Weight::from_parts(256_401_533, 1167) + // Standard Error: 18 + .saturating_add(Weight::from_parts(32, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -992,10 +994,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `841 + r * (288 ±0)` // Estimated: `845 + r * (289 ±0)` - // Minimum execution time: 235_697_000 picoseconds. - Weight::from_parts(143_200_942, 845) - // Standard Error: 11_358 - .saturating_add(Weight::from_parts(5_934_318, 0).saturating_mul(r.into())) + // Minimum execution time: 236_800_000 picoseconds. + Weight::from_parts(134_748_031, 845) + // Standard Error: 9_560 + .saturating_add(Weight::from_parts(5_923_187, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1009,10 +1011,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1163 + n * (1 ±0)` // Estimated: `1163 + n * (1 ±0)` - // Minimum execution time: 250_360_000 picoseconds. - Weight::from_parts(252_712_722, 1163) - // Standard Error: 15 - .saturating_add(Weight::from_parts(130, 0).saturating_mul(n.into())) + // Minimum execution time: 250_601_000 picoseconds. + Weight::from_parts(253_618_803, 1163) + // Standard Error: 18 + .saturating_add(Weight::from_parts(74, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1024,10 +1026,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `835 + r * (296 ±0)` // Estimated: `840 + r * (297 ±0)` - // Minimum execution time: 235_613_000 picoseconds. - Weight::from_parts(150_213_792, 840) - // Standard Error: 8_617 - .saturating_add(Weight::from_parts(4_962_874, 0).saturating_mul(r.into())) + // Minimum execution time: 236_194_000 picoseconds. + Weight::from_parts(152_630_909, 840) + // Standard Error: 8_573 + .saturating_add(Weight::from_parts(4_896_099, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1040,10 +1042,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1179 + n * (1 ±0)` // Estimated: `1179 + n * (1 ±0)` - // Minimum execution time: 249_137_000 picoseconds. - Weight::from_parts(253_529_386, 1179) - // Standard Error: 41 - .saturating_add(Weight::from_parts(612, 0).saturating_mul(n.into())) + // Minimum execution time: 250_989_000 picoseconds. + Weight::from_parts(260_170_747, 1179) + // Standard Error: 162 + .saturating_add(Weight::from_parts(224, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1055,10 +1057,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `856 + r * (288 ±0)` // Estimated: `857 + r * (289 ±0)` - // Minimum execution time: 235_659_000 picoseconds. - Weight::from_parts(158_846_683, 857) - // Standard Error: 7_806 - .saturating_add(Weight::from_parts(4_728_537, 0).saturating_mul(r.into())) + // Minimum execution time: 236_574_000 picoseconds. + Weight::from_parts(155_573_955, 857) + // Standard Error: 10_270 + .saturating_add(Weight::from_parts(4_667_644, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1071,10 +1073,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1166 + n * (1 ±0)` // Estimated: `1166 + n * (1 ±0)` - // Minimum execution time: 248_553_000 picoseconds. - Weight::from_parts(250_703_269, 1166) - // Standard Error: 17 - .saturating_add(Weight::from_parts(163, 0).saturating_mul(n.into())) + // Minimum execution time: 249_502_000 picoseconds. + Weight::from_parts(251_496_311, 1166) + // Standard Error: 26 + .saturating_add(Weight::from_parts(186, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1086,10 +1088,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `829 + r * (296 ±0)` // Estimated: `836 + r * (297 ±0)` - // Minimum execution time: 236_431_000 picoseconds. - Weight::from_parts(131_745_419, 836) - // Standard Error: 10_161 - .saturating_add(Weight::from_parts(6_182_174, 0).saturating_mul(r.into())) + // Minimum execution time: 236_030_000 picoseconds. + Weight::from_parts(128_595_856, 836) + // Standard Error: 10_530 + .saturating_add(Weight::from_parts(6_072_638, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1103,10 +1105,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1180 + n * (1 ±0)` // Estimated: `1180 + n * (1 ±0)` - // Minimum execution time: 252_551_000 picoseconds. - Weight::from_parts(254_517_030, 1180) - // Standard Error: 16 - .saturating_add(Weight::from_parts(712, 0).saturating_mul(n.into())) + // Minimum execution time: 254_027_000 picoseconds. + Weight::from_parts(260_739_475, 1180) + // Standard Error: 115 + .saturating_add(Weight::from_parts(330, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1126,10 +1128,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1373 + r * (45 ±0)` // Estimated: `26753 + r * (2700 ±0)` - // Minimum execution time: 236_663_000 picoseconds. - Weight::from_parts(237_485_000, 26753) - // Standard Error: 42_414 - .saturating_add(Weight::from_parts(36_849_514, 0).saturating_mul(r.into())) + // Minimum execution time: 237_634_000 picoseconds. + Weight::from_parts(238_177_000, 26753) + // Standard Error: 23_320 + .saturating_add(Weight::from_parts(35_467_618, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) @@ -1151,10 +1153,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1237 + r * (256 ±0)` // Estimated: `26028 + r * (6235 ±0)` - // Minimum execution time: 237_101_000 picoseconds. - Weight::from_parts(237_827_000, 26028) - // Standard Error: 82_878 - .saturating_add(Weight::from_parts(211_777_724, 0).saturating_mul(r.into())) + // Minimum execution time: 237_076_000 picoseconds. + Weight::from_parts(237_792_000, 26028) + // Standard Error: 91_566 + .saturating_add(Weight::from_parts(212_893_975, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1176,10 +1178,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0 + r * (502 ±0)` // Estimated: `21755 + r * (6329 ±3)` - // Minimum execution time: 241_213_000 picoseconds. - Weight::from_parts(241_900_000, 21755) - // Standard Error: 99_976 - .saturating_add(Weight::from_parts(207_520_077, 0).saturating_mul(r.into())) + // Minimum execution time: 236_275_000 picoseconds. + Weight::from_parts(236_849_000, 21755) + // Standard Error: 92_724 + .saturating_add(Weight::from_parts(207_159_396, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1202,12 +1204,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1154 + t * (204 ±0)` // Estimated: `31015 + t * (5970 ±0)` - // Minimum execution time: 414_784_000 picoseconds. - Weight::from_parts(384_902_379, 31015) - // Standard Error: 1_228_593 - .saturating_add(Weight::from_parts(33_226_901, 0).saturating_mul(t.into())) + // Minimum execution time: 412_628_000 picoseconds. + Weight::from_parts(385_108_035, 31015) + // Standard Error: 1_002_078 + .saturating_add(Weight::from_parts(31_204_678, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(601, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(598, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(5_u64)) @@ -1233,10 +1235,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1301 + r * (254 ±0)` // Estimated: `30977 + r * (16635 ±0)` - // Minimum execution time: 236_963_000 picoseconds. - Weight::from_parts(237_711_000, 30977) - // Standard Error: 265_576 - .saturating_add(Weight::from_parts(347_359_908, 0).saturating_mul(r.into())) + // Minimum execution time: 237_161_000 picoseconds. + Weight::from_parts(237_620_000, 30977) + // Standard Error: 258_036 + .saturating_add(Weight::from_parts(344_869_637, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(6_u64)) @@ -1264,14 +1266,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1071 + t * (187 ±0)` // Estimated: `42684 + t * (3588 ±2)` - // Minimum execution time: 1_615_191_000 picoseconds. - Weight::from_parts(337_408_450, 42684) - // Standard Error: 4_581_951 - .saturating_add(Weight::from_parts(115_730_776, 0).saturating_mul(t.into())) + // Minimum execution time: 1_613_172_000 picoseconds. + Weight::from_parts(326_952_137, 42684) + // Standard Error: 4_738_925 + .saturating_add(Weight::from_parts(113_657_996, 0).saturating_mul(t.into())) // Standard Error: 7 - .saturating_add(Weight::from_parts(1_171, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_173, 0).saturating_mul(i.into())) // Standard Error: 7 - .saturating_add(Weight::from_parts(1_346, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_347, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(10_u64)) @@ -1293,10 +1295,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `777 + r * (8 ±0)` // Estimated: `21710 + r * (40 ±0)` - // Minimum execution time: 233_601_000 picoseconds. - Weight::from_parts(246_594_905, 21710) - // Standard Error: 2_840 - .saturating_add(Weight::from_parts(578_751, 0).saturating_mul(r.into())) + // Minimum execution time: 233_679_000 picoseconds. + Weight::from_parts(238_638_820, 21710) + // Standard Error: 681 + .saturating_add(Weight::from_parts(573_320, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) @@ -1316,10 +1318,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `785` // Estimated: `21745` - // Minimum execution time: 233_735_000 picoseconds. - Weight::from_parts(243_432_330, 21745) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3_927, 0).saturating_mul(n.into())) + // Minimum execution time: 235_992_000 picoseconds. + Weight::from_parts(219_924_252, 21745) + // Standard Error: 5 + .saturating_add(Weight::from_parts(3_978, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1338,10 +1340,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` // Estimated: `21725 + r * (40 ±0)` - // Minimum execution time: 232_173_000 picoseconds. - Weight::from_parts(239_806_011, 21725) - // Standard Error: 1_530 - .saturating_add(Weight::from_parts(749_641, 0).saturating_mul(r.into())) + // Minimum execution time: 240_661_000 picoseconds. + Weight::from_parts(238_809_422, 21725) + // Standard Error: 820 + .saturating_add(Weight::from_parts(741_326, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) @@ -1361,10 +1363,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `787` // Estimated: `21765` - // Minimum execution time: 235_046_000 picoseconds. - Weight::from_parts(229_500_792, 21765) + // Minimum execution time: 235_136_000 picoseconds. + Weight::from_parts(228_678_487, 21765) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_166, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_164, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1383,10 +1385,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` // Estimated: `21740 + r * (40 ±0)` - // Minimum execution time: 231_708_000 picoseconds. - Weight::from_parts(235_347_566, 21740) - // Standard Error: 987 - .saturating_add(Weight::from_parts(428_819, 0).saturating_mul(r.into())) + // Minimum execution time: 233_364_000 picoseconds. + Weight::from_parts(243_294_285, 21740) + // Standard Error: 1_607 + .saturating_add(Weight::from_parts(413_186, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) @@ -1406,10 +1408,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `787` // Estimated: `21785` - // Minimum execution time: 234_068_000 picoseconds. - Weight::from_parts(226_519_852, 21785) + // Minimum execution time: 234_315_000 picoseconds. + Weight::from_parts(225_569_537, 21785) // Standard Error: 1 - .saturating_add(Weight::from_parts(916, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(919, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1428,10 +1430,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` // Estimated: `21745 + r * (40 ±0)` - // Minimum execution time: 231_872_000 picoseconds. - Weight::from_parts(236_694_763, 21745) - // Standard Error: 870 - .saturating_add(Weight::from_parts(420_853, 0).saturating_mul(r.into())) + // Minimum execution time: 233_288_000 picoseconds. + Weight::from_parts(239_289_154, 21745) + // Standard Error: 612 + .saturating_add(Weight::from_parts(414_275, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) @@ -1451,10 +1453,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `787` // Estimated: `21755` - // Minimum execution time: 233_707_000 picoseconds. - Weight::from_parts(226_312_559, 21755) - // Standard Error: 2 - .saturating_add(Weight::from_parts(924, 0).saturating_mul(n.into())) + // Minimum execution time: 233_686_000 picoseconds. + Weight::from_parts(227_406_694, 21755) + // Standard Error: 1 + .saturating_add(Weight::from_parts(919, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1468,15 +1470,61 @@ impl WeightInfo for SubstrateWeight { /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Measured) /// Storage: System EventTopics (r:2 w:2) /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Measured) + /// The range of component `n` is `[0, 125697]`. + fn seal_sr25519_verify_per_byte(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `916 + n * (1 ±0)` + // Estimated: `22375 + n * (5 ±0)` + // Minimum execution time: 287_258_000 picoseconds. + Weight::from_parts(290_941_609, 22375) + // Standard Error: 8 + .saturating_add(Weight::from_parts(4_785, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 5).saturating_mul(n.into())) + } + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) + /// Storage: Contracts ContractInfoOf (r:1 w:1) + /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(290), added: 2765, mode: Measured) + /// Storage: Contracts CodeStorage (r:1 w:0) + /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, 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 EventTopics (r:2 w:2) + /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Measured) + /// The range of component `r` is `[0, 160]`. + fn seal_sr25519_verify(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `728 + r * (112 ±0)` + // Estimated: `21455 + r * (560 ±0)` + // Minimum execution time: 238_340_000 picoseconds. + Weight::from_parts(246_009_851, 21455) + // Standard Error: 21_677 + .saturating_add(Weight::from_parts(48_139_487, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 560).saturating_mul(r.into())) + } + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) + /// Storage: Contracts ContractInfoOf (r:1 w:1) + /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(290), added: 2765, mode: Measured) + /// Storage: Contracts CodeStorage (r:1 w:0) + /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, 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 EventTopics (r:2 w:2) + /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Measured) /// The range of component `r` is `[0, 160]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `822 + r * (76 ±0)` // Estimated: `21705 + r * (385 ±0)` - // Minimum execution time: 234_962_000 picoseconds. - Weight::from_parts(252_611_292, 21705) - // Standard Error: 20_134 - .saturating_add(Weight::from_parts(37_745_358, 0).saturating_mul(r.into())) + // Minimum execution time: 236_244_000 picoseconds. + Weight::from_parts(253_749_242, 21705) + // Standard Error: 19_216 + .saturating_add(Weight::from_parts(37_706_782, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 385).saturating_mul(r.into())) @@ -1496,10 +1544,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `792 + r * (42 ±0)` // Estimated: `21775 + r * (210 ±0)` - // Minimum execution time: 234_869_000 picoseconds. - Weight::from_parts(240_188_331, 21775) - // Standard Error: 9_910 - .saturating_add(Weight::from_parts(9_332_432, 0).saturating_mul(r.into())) + // Minimum execution time: 235_770_000 picoseconds. + Weight::from_parts(230_780_347, 21775) + // Standard Error: 12_015 + .saturating_add(Weight::from_parts(9_584_947, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 210).saturating_mul(r.into())) @@ -1520,11 +1568,11 @@ impl WeightInfo for SubstrateWeight { fn seal_set_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + r * (964 ±0)` - // Estimated: `29920 + r * (11544 ±10)` - // Minimum execution time: 235_036_000 picoseconds. - Weight::from_parts(235_538_000, 29920) - // Standard Error: 47_360 - .saturating_add(Weight::from_parts(22_113_144, 0).saturating_mul(r.into())) + // Estimated: `29920 + r * (11544 ±7)` + // Minimum execution time: 235_857_000 picoseconds. + Weight::from_parts(236_482_000, 29920) + // Standard Error: 47_818 + .saturating_add(Weight::from_parts(21_765_273, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1546,10 +1594,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `773 + r * (3 ±0)` // Estimated: `21735 + r * (15 ±0)` - // Minimum execution time: 237_884_000 picoseconds. - Weight::from_parts(243_315_095, 21735) - // Standard Error: 560 - .saturating_add(Weight::from_parts(162_206, 0).saturating_mul(r.into())) + // Minimum execution time: 235_388_000 picoseconds. + Weight::from_parts(240_149_512, 21735) + // Standard Error: 555 + .saturating_add(Weight::from_parts(162_666, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 15).saturating_mul(r.into())) @@ -1569,10 +1617,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1975 + r * (39 ±0)` // Estimated: `27145 + r * (200 ±0)` - // Minimum execution time: 239_402_000 picoseconds. - Weight::from_parts(267_214_783, 27145) - // Standard Error: 1_166 - .saturating_add(Weight::from_parts(261_915, 0).saturating_mul(r.into())) + // Minimum execution time: 237_485_000 picoseconds. + Weight::from_parts(268_044_053, 27145) + // Standard Error: 1_147 + .saturating_add(Weight::from_parts(260_572, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 200).saturating_mul(r.into())) @@ -1594,10 +1642,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `776 + r * (3 ±0)` // Estimated: `24004 + r * (18 ±0)` - // Minimum execution time: 233_153_000 picoseconds. - Weight::from_parts(238_999_965, 24004) - // Standard Error: 291 - .saturating_add(Weight::from_parts(143_971, 0).saturating_mul(r.into())) + // Minimum execution time: 234_123_000 picoseconds. + Weight::from_parts(245_872_832, 24004) + // Standard Error: 943 + .saturating_add(Weight::from_parts(136_460, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 18).saturating_mul(r.into())) @@ -1607,510 +1655,510 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_706_000 picoseconds. - Weight::from_parts(1_962_558, 0) + // Minimum execution time: 1_606_000 picoseconds. + Weight::from_parts(1_845_698, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_000, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_995, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_870_000 picoseconds. - Weight::from_parts(2_481_243, 0) + // Minimum execution time: 1_711_000 picoseconds. + Weight::from_parts(2_281_581, 0) // Standard Error: 4 - .saturating_add(Weight::from_parts(6_346, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(6_354, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_830_000 picoseconds. - Weight::from_parts(2_389_658, 0) + // Minimum execution time: 1_680_000 picoseconds. + Weight::from_parts(2_269_238, 0) // Standard Error: 4 - .saturating_add(Weight::from_parts(5_997, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(6_014, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_734_000 picoseconds. - Weight::from_parts(2_170_618, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(7_919, 0).saturating_mul(r.into())) + // Minimum execution time: 1_592_000 picoseconds. + Weight::from_parts(2_010_963, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(7_927, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_661_000 picoseconds. - Weight::from_parts(1_945_771, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(10_840, 0).saturating_mul(r.into())) + // Minimum execution time: 1_631_000 picoseconds. + Weight::from_parts(1_936_549, 0) + // Standard Error: 6 + .saturating_add(Weight::from_parts(10_426, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_682_000 picoseconds. - Weight::from_parts(1_970_774, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(4_569, 0).saturating_mul(r.into())) + // Minimum execution time: 1_616_000 picoseconds. + Weight::from_parts(1_938_716, 0) + // Standard Error: 15 + .saturating_add(Weight::from_parts(4_525, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_668_000 picoseconds. - Weight::from_parts(1_227_080, 0) - // Standard Error: 76 - .saturating_add(Weight::from_parts(8_066, 0).saturating_mul(r.into())) + // Minimum execution time: 1_535_000 picoseconds. + Weight::from_parts(1_109_860, 0) + // Standard Error: 77 + .saturating_add(Weight::from_parts(7_998, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_653_000 picoseconds. - Weight::from_parts(1_394_759, 0) - // Standard Error: 39 - .saturating_add(Weight::from_parts(9_566, 0).saturating_mul(r.into())) + // Minimum execution time: 1_594_000 picoseconds. + Weight::from_parts(1_478_654, 0) + // Standard Error: 36 + .saturating_add(Weight::from_parts(9_525, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_771_000 picoseconds. - Weight::from_parts(1_905_594, 0) - // Standard Error: 147 - .saturating_add(Weight::from_parts(925, 0).saturating_mul(e.into())) + // Minimum execution time: 1_730_000 picoseconds. + Weight::from_parts(1_836_342, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(206, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_863_000 picoseconds. - Weight::from_parts(2_472_635, 0) - // Standard Error: 13 - .saturating_add(Weight::from_parts(17_892, 0).saturating_mul(r.into())) + // Minimum execution time: 1_607_000 picoseconds. + Weight::from_parts(2_150_133, 0) + // Standard Error: 17 + .saturating_add(Weight::from_parts(18_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_013_000 picoseconds. - Weight::from_parts(3_077_100, 0) - // Standard Error: 18 - .saturating_add(Weight::from_parts(24_287, 0).saturating_mul(r.into())) + // Minimum execution time: 1_824_000 picoseconds. + Weight::from_parts(3_119_825, 0) + // Standard Error: 15 + .saturating_add(Weight::from_parts(25_304, 0).saturating_mul(r.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_818_000 picoseconds. - Weight::from_parts(2_109_143, 0) - // Standard Error: 34 - .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(l.into())) + // Minimum execution time: 1_692_000 picoseconds. + Weight::from_parts(1_927_049, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(1_217, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_083_000 picoseconds. - Weight::from_parts(3_291_328, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(2_505, 0).saturating_mul(r.into())) + // Minimum execution time: 2_795_000 picoseconds. + Weight::from_parts(3_107_843, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(2_445, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_987_000 picoseconds. - Weight::from_parts(3_276_863, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(3_617, 0).saturating_mul(r.into())) + // Minimum execution time: 2_815_000 picoseconds. + Weight::from_parts(3_114_618, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(3_639, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_942_000 picoseconds. - Weight::from_parts(3_350_581, 0) + // Minimum execution time: 2_861_000 picoseconds. + Weight::from_parts(3_193_592, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(3_976, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_957, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_867_000 picoseconds. - Weight::from_parts(2_920_748, 0) - // Standard Error: 44 - .saturating_add(Weight::from_parts(8_229, 0).saturating_mul(r.into())) + // Minimum execution time: 1_710_000 picoseconds. + Weight::from_parts(2_148_021, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(8_391, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_757_000 picoseconds. - Weight::from_parts(2_235_198, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(8_815, 0).saturating_mul(r.into())) + // Minimum execution time: 1_663_000 picoseconds. + Weight::from_parts(2_170_373, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(8_812, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_824_000 picoseconds. - Weight::from_parts(1_941_816, 0) - // Standard Error: 86 - .saturating_add(Weight::from_parts(4_043, 0).saturating_mul(r.into())) + // Minimum execution time: 1_662_000 picoseconds. + Weight::from_parts(2_601_398, 0) + // Standard Error: 198 + .saturating_add(Weight::from_parts(3_851, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 16]`. fn instr_memory_grow(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_793_000 picoseconds. - Weight::from_parts(1_104_829, 0) - // Standard Error: 137_800 - .saturating_add(Weight::from_parts(13_336_784, 0).saturating_mul(r.into())) + // Minimum execution time: 1_603_000 picoseconds. + Weight::from_parts(332_932, 0) + // Standard Error: 137_529 + .saturating_add(Weight::from_parts(13_233_734, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_693_000 picoseconds. - Weight::from_parts(2_037_305, 0) + // Minimum execution time: 1_613_000 picoseconds. + Weight::from_parts(1_922_391, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(4_044, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_903, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_751_000 picoseconds. - Weight::from_parts(2_082_016, 0) + // Minimum execution time: 1_522_000 picoseconds. + Weight::from_parts(1_920_023, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_767, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_751_000 picoseconds. - Weight::from_parts(2_110_625, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(3_754, 0).saturating_mul(r.into())) + // Minimum execution time: 1_590_000 picoseconds. + Weight::from_parts(1_867_406, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(3_910, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_756_000 picoseconds. - Weight::from_parts(2_100_327, 0) + // Minimum execution time: 1_577_000 picoseconds. + Weight::from_parts(1_918_037, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_664, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_673, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_643_000 picoseconds. - Weight::from_parts(2_169_153, 0) + // Minimum execution time: 1_589_000 picoseconds. + Weight::from_parts(1_917_901, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(3_961, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_956, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_704_000 picoseconds. - Weight::from_parts(2_049_172, 0) + // Minimum execution time: 1_573_000 picoseconds. + Weight::from_parts(1_902_324, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_833, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_865, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_726_000 picoseconds. - Weight::from_parts(2_064_387, 0) + // Minimum execution time: 1_586_000 picoseconds. + Weight::from_parts(1_953_738, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_745, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_696_000 picoseconds. - Weight::from_parts(2_426_905, 0) - // Standard Error: 56 - .saturating_add(Weight::from_parts(5_915, 0).saturating_mul(r.into())) + // Minimum execution time: 1_598_000 picoseconds. + Weight::from_parts(1_912_180, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_994, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_617_000 picoseconds. - Weight::from_parts(2_035_161, 0) - // Standard Error: 94 - .saturating_add(Weight::from_parts(6_073, 0).saturating_mul(r.into())) + // Minimum execution time: 1_573_000 picoseconds. + Weight::from_parts(1_943_725, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_998, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_756_000 picoseconds. - Weight::from_parts(2_098_926, 0) + // Minimum execution time: 1_584_000 picoseconds. + Weight::from_parts(1_949_209, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(6_002, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_991, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_706_000 picoseconds. - Weight::from_parts(2_257_972, 0) - // Standard Error: 23 - .saturating_add(Weight::from_parts(5_982, 0).saturating_mul(r.into())) + // Minimum execution time: 1_576_000 picoseconds. + Weight::from_parts(1_927_466, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_005, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_761_000 picoseconds. - Weight::from_parts(2_114_141, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(5_815, 0).saturating_mul(r.into())) + // Minimum execution time: 1_566_000 picoseconds. + Weight::from_parts(2_004_312, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_799, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_700_000 picoseconds. - Weight::from_parts(2_053_201, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(6_137, 0).saturating_mul(r.into())) + // Minimum execution time: 1_538_000 picoseconds. + Weight::from_parts(1_922_703, 0) + // Standard Error: 9 + .saturating_add(Weight::from_parts(6_129, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_705_000 picoseconds. - Weight::from_parts(2_101_782, 0) + // Minimum execution time: 1_575_000 picoseconds. + Weight::from_parts(1_978_271, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(6_014, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_991, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_856_000 picoseconds. - Weight::from_parts(2_149_707, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(6_086, 0).saturating_mul(r.into())) + // Minimum execution time: 1_572_000 picoseconds. + Weight::from_parts(4_028_578, 0) + // Standard Error: 263 + .saturating_add(Weight::from_parts(5_784, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_739_000 picoseconds. - Weight::from_parts(2_143_216, 0) + // Minimum execution time: 1_615_000 picoseconds. + Weight::from_parts(1_962_065, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(5_934, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_945, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_716_000 picoseconds. - Weight::from_parts(2_065_762, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(6_009, 0).saturating_mul(r.into())) + // Minimum execution time: 1_578_000 picoseconds. + Weight::from_parts(1_909_721, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_993, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_664_000 picoseconds. - Weight::from_parts(3_062_283, 0) - // Standard Error: 94 - .saturating_add(Weight::from_parts(5_645, 0).saturating_mul(r.into())) + // Minimum execution time: 1_609_000 picoseconds. + Weight::from_parts(1_926_472, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_888, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_671_000 picoseconds. - Weight::from_parts(2_011_145, 0) - // Standard Error: 44 - .saturating_add(Weight::from_parts(6_220, 0).saturating_mul(r.into())) + // Minimum execution time: 1_620_000 picoseconds. + Weight::from_parts(2_875_196, 0) + // Standard Error: 177 + .saturating_add(Weight::from_parts(5_990, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_759_000 picoseconds. - Weight::from_parts(2_095_420, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(5_723, 0).saturating_mul(r.into())) + // Minimum execution time: 1_570_000 picoseconds. + Weight::from_parts(2_155_483, 0) + // Standard Error: 83 + .saturating_add(Weight::from_parts(5_675, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_672_000 picoseconds. - Weight::from_parts(2_184_044, 0) + // Minimum execution time: 1_558_000 picoseconds. + Weight::from_parts(2_108_263, 0) // Standard Error: 5 - .saturating_add(Weight::from_parts(11_782, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(11_755, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_752_000 picoseconds. - Weight::from_parts(2_276_209, 0) - // Standard Error: 5 - .saturating_add(Weight::from_parts(10_513, 0).saturating_mul(r.into())) + // Minimum execution time: 1_568_000 picoseconds. + Weight::from_parts(1_606_397, 0) + // Standard Error: 51 + .saturating_add(Weight::from_parts(11_011, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_711_000 picoseconds. - Weight::from_parts(2_720_989, 0) + // Minimum execution time: 1_630_000 picoseconds. + Weight::from_parts(2_872_487, 0) // Standard Error: 24 - .saturating_add(Weight::from_parts(11_884, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(11_761, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_713_000 picoseconds. - Weight::from_parts(2_091_403, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(10_628, 0).saturating_mul(r.into())) + // Minimum execution time: 1_575_000 picoseconds. + Weight::from_parts(2_385_398, 0) + // Standard Error: 45 + .saturating_add(Weight::from_parts(10_650, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_704_000 picoseconds. - Weight::from_parts(2_054_652, 0) + // Minimum execution time: 1_622_000 picoseconds. + Weight::from_parts(1_957_246, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_672, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_659, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_743_000 picoseconds. - Weight::from_parts(2_032_806, 0) - // Standard Error: 19 - .saturating_add(Weight::from_parts(5_795, 0).saturating_mul(r.into())) + // Minimum execution time: 1_551_000 picoseconds. + Weight::from_parts(1_897_168, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_774, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_667_000 picoseconds. - Weight::from_parts(2_031_702, 0) - // Standard Error: 5 - .saturating_add(Weight::from_parts(5_923, 0).saturating_mul(r.into())) + // Minimum execution time: 1_549_000 picoseconds. + Weight::from_parts(1_915_938, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_915, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_735_000 picoseconds. - Weight::from_parts(2_946_634, 0) - // Standard Error: 54 - .saturating_add(Weight::from_parts(5_685, 0).saturating_mul(r.into())) + // Minimum execution time: 1_617_000 picoseconds. + Weight::from_parts(1_932_618, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_854, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_652_000 picoseconds. - Weight::from_parts(2_023_049, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(6_146, 0).saturating_mul(r.into())) + // Minimum execution time: 1_617_000 picoseconds. + Weight::from_parts(1_937_566, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(6_134, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_654_000 picoseconds. - Weight::from_parts(2_148_951, 0) + // Minimum execution time: 1_584_000 picoseconds. + Weight::from_parts(1_980_681, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(5_869, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_730_000 picoseconds. - Weight::from_parts(2_130_543, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_999, 0).saturating_mul(r.into())) + // Minimum execution time: 1_542_000 picoseconds. + Weight::from_parts(2_131_567, 0) + // Standard Error: 57 + .saturating_add(Weight::from_parts(6_010, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_728_000 picoseconds. - Weight::from_parts(2_172_886, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_843, 0).saturating_mul(r.into())) + // Minimum execution time: 1_609_000 picoseconds. + Weight::from_parts(1_643_214, 0) + // Standard Error: 91 + .saturating_add(Weight::from_parts(6_062, 0).saturating_mul(r.into())) } } @@ -2122,8 +2170,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 2_677_000 picoseconds. - Weight::from_parts(2_899_000, 1594) + // Minimum execution time: 2_503_000 picoseconds. + Weight::from_parts(2_603_000, 1594) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Skipped Metadata (r:0 w:0) @@ -2133,10 +2181,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `488 + k * (69 ±0)` // Estimated: `478 + k * (70 ±0)` - // Minimum execution time: 14_006_000 picoseconds. - Weight::from_parts(8_735_946, 478) - // Standard Error: 1_370 - .saturating_add(Weight::from_parts(989_501, 0).saturating_mul(k.into())) + // Minimum execution time: 13_292_000 picoseconds. + Weight::from_parts(9_180_439, 478) + // Standard Error: 997 + .saturating_add(Weight::from_parts(967_522, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -2152,10 +2200,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `238 + c * (1 ±0)` // Estimated: `3951 + c * (2 ±0)` - // Minimum execution time: 30_951_000 picoseconds. - Weight::from_parts(25_988_560, 3951) - // Standard Error: 57 - .saturating_add(Weight::from_parts(54_692, 0).saturating_mul(c.into())) + // Minimum execution time: 30_822_000 picoseconds. + Weight::from_parts(26_457_115, 3951) + // Standard Error: 58 + .saturating_add(Weight::from_parts(54_868, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 2).saturating_mul(c.into())) @@ -2175,10 +2223,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `707` // Estimated: `21400 + c * (5 ±0)` - // Minimum execution time: 263_107_000 picoseconds. - Weight::from_parts(268_289_665, 21400) - // Standard Error: 33 - .saturating_add(Weight::from_parts(38_534, 0).saturating_mul(c.into())) + // Minimum execution time: 263_719_000 picoseconds. + Weight::from_parts(275_281_941, 21400) + // Standard Error: 32 + .saturating_add(Weight::from_parts(37_880, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 5).saturating_mul(c.into())) @@ -2206,14 +2254,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `270` // Estimated: `26207` - // Minimum execution time: 3_122_319_000 picoseconds. - Weight::from_parts(487_802_180, 26207) - // Standard Error: 345 - .saturating_add(Weight::from_parts(108_237, 0).saturating_mul(c.into())) - // Standard Error: 20 - .saturating_add(Weight::from_parts(1_166, 0).saturating_mul(i.into())) - // Standard Error: 20 - .saturating_add(Weight::from_parts(1_505, 0).saturating_mul(s.into())) + // Minimum execution time: 3_133_756_000 picoseconds. + Weight::from_parts(556_483_545, 26207) + // Standard Error: 294 + .saturating_add(Weight::from_parts(107_914, 0).saturating_mul(c.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_143, 0).saturating_mul(i.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_456, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2237,12 +2285,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `482` // Estimated: `28521` - // Minimum execution time: 1_650_623_000 picoseconds. - Weight::from_parts(286_494_456, 28521) + // Minimum execution time: 1_646_953_000 picoseconds. + Weight::from_parts(262_115_215, 28521) // Standard Error: 8 - .saturating_add(Weight::from_parts(1_438, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_454, 0).saturating_mul(i.into())) // Standard Error: 8 - .saturating_add(Weight::from_parts(1_453, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_463, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -2260,8 +2308,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `759` // Estimated: `21615` - // Minimum execution time: 191_046_000 picoseconds. - Weight::from_parts(192_544_000, 21615) + // Minimum execution time: 190_769_000 picoseconds. + Weight::from_parts(191_717_000, 21615) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2278,10 +2326,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `7366` - // Minimum execution time: 244_260_000 picoseconds. - Weight::from_parts(254_693_985, 7366) - // Standard Error: 80 - .saturating_add(Weight::from_parts(108_246, 0).saturating_mul(c.into())) + // Minimum execution time: 246_204_000 picoseconds. + Weight::from_parts(243_234_754, 7366) + // Standard Error: 78 + .saturating_add(Weight::from_parts(109_232, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2297,8 +2345,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `255` // Estimated: `7950` - // Minimum execution time: 33_492_000 picoseconds. - Weight::from_parts(34_079_000, 7950) + // Minimum execution time: 33_516_000 picoseconds. + Weight::from_parts(33_995_000, 7950) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2312,8 +2360,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `570` // Estimated: `19530` - // Minimum execution time: 33_475_000 picoseconds. - Weight::from_parts(33_856_000, 19530) + // Minimum execution time: 33_255_000 picoseconds. + Weight::from_parts(33_692_000, 19530) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2332,10 +2380,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `781 + r * (6 ±0)` // Estimated: `21730 + r * (30 ±0)` - // Minimum execution time: 234_197_000 picoseconds. - Weight::from_parts(236_830_305, 21730) - // Standard Error: 818 - .saturating_add(Weight::from_parts(336_446, 0).saturating_mul(r.into())) + // Minimum execution time: 235_074_000 picoseconds. + Weight::from_parts(243_735_179, 21730) + // Standard Error: 972 + .saturating_add(Weight::from_parts(328_571, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2355,10 +2403,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `839 + r * (240 ±0)` // Estimated: `21835 + r * (3675 ±0)` - // Minimum execution time: 235_872_000 picoseconds. - Weight::from_parts(78_877_890, 21835) - // Standard Error: 6_405 - .saturating_add(Weight::from_parts(3_358_341, 0).saturating_mul(r.into())) + // Minimum execution time: 236_455_000 picoseconds. + Weight::from_parts(81_818_936, 21835) + // Standard Error: 5_874 + .saturating_add(Weight::from_parts(3_316_006, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2379,10 +2427,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `831 + r * (244 ±0)` // Estimated: `21855 + r * (3695 ±0)` - // Minimum execution time: 239_035_000 picoseconds. - Weight::from_parts(93_255_085, 21855) - // Standard Error: 5_922 - .saturating_add(Weight::from_parts(4_144_910, 0).saturating_mul(r.into())) + // Minimum execution time: 237_724_000 picoseconds. + Weight::from_parts(91_384_964, 21855) + // Standard Error: 5_828 + .saturating_add(Weight::from_parts(4_063_221, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2403,10 +2451,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `788 + r * (6 ±0)` // Estimated: `21770 + r * (30 ±0)` - // Minimum execution time: 236_507_000 picoseconds. - Weight::from_parts(238_253_211, 21770) - // Standard Error: 975 - .saturating_add(Weight::from_parts(413_919, 0).saturating_mul(r.into())) + // Minimum execution time: 236_144_000 picoseconds. + Weight::from_parts(239_917_873, 21770) + // Standard Error: 629 + .saturating_add(Weight::from_parts(409_752, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2426,10 +2474,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `778 + r * (3 ±0)` // Estimated: `21735 + r * (15 ±0)` - // Minimum execution time: 235_521_000 picoseconds. - Weight::from_parts(238_397_362, 21735) - // Standard Error: 452 - .saturating_add(Weight::from_parts(160_860, 0).saturating_mul(r.into())) + // Minimum execution time: 232_946_000 picoseconds. + Weight::from_parts(243_163_112, 21735) + // Standard Error: 1_940 + .saturating_add(Weight::from_parts(162_705, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 15).saturating_mul(r.into())) @@ -2449,10 +2497,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `782 + r * (6 ±0)` // Estimated: `21740 + r * (30 ±0)` - // Minimum execution time: 234_722_000 picoseconds. - Weight::from_parts(242_936_096, 21740) - // Standard Error: 1_178 - .saturating_add(Weight::from_parts(329_075, 0).saturating_mul(r.into())) + // Minimum execution time: 235_301_000 picoseconds. + Weight::from_parts(240_802_312, 21740) + // Standard Error: 5_362 + .saturating_add(Weight::from_parts(339_001, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2472,10 +2520,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `783 + r * (6 ±0)` // Estimated: `21725 + r * (30 ±0)` - // Minimum execution time: 235_654_000 picoseconds. - Weight::from_parts(245_887_792, 21725) - // Standard Error: 903 - .saturating_add(Weight::from_parts(325_168, 0).saturating_mul(r.into())) + // Minimum execution time: 235_683_000 picoseconds. + Weight::from_parts(237_357_276, 21725) + // Standard Error: 726 + .saturating_add(Weight::from_parts(333_264, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2495,10 +2543,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `922 + r * (6 ±0)` // Estimated: `24633 + r * (30 ±0)` - // Minimum execution time: 233_599_000 picoseconds. - Weight::from_parts(251_561_602, 24633) - // Standard Error: 3_348 - .saturating_add(Weight::from_parts(1_475_443, 0).saturating_mul(r.into())) + // Minimum execution time: 234_327_000 picoseconds. + Weight::from_parts(239_792_456, 24633) + // Standard Error: 3_460 + .saturating_add(Weight::from_parts(1_496_090, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2518,10 +2566,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `792 + r * (6 ±0)` // Estimated: `21825 + r * (30 ±0)` - // Minimum execution time: 235_087_000 picoseconds. - Weight::from_parts(235_855_322, 21825) - // Standard Error: 867 - .saturating_add(Weight::from_parts(346_707, 0).saturating_mul(r.into())) + // Minimum execution time: 235_466_000 picoseconds. + Weight::from_parts(242_580_658, 21825) + // Standard Error: 1_439 + .saturating_add(Weight::from_parts(323_842, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2541,10 +2589,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `790 + r * (6 ±0)` // Estimated: `21815 + r * (30 ±0)` - // Minimum execution time: 237_103_000 picoseconds. - Weight::from_parts(239_272_188, 21815) - // Standard Error: 892 - .saturating_add(Weight::from_parts(328_334, 0).saturating_mul(r.into())) + // Minimum execution time: 238_529_000 picoseconds. + Weight::from_parts(249_276_722, 21815) + // Standard Error: 1_216 + .saturating_add(Weight::from_parts(328_600, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2564,10 +2612,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `787 + r * (6 ±0)` // Estimated: `21805 + r * (30 ±0)` - // Minimum execution time: 234_761_000 picoseconds. - Weight::from_parts(238_601_784, 21805) - // Standard Error: 725 - .saturating_add(Weight::from_parts(325_758, 0).saturating_mul(r.into())) + // Minimum execution time: 234_360_000 picoseconds. + Weight::from_parts(239_927_876, 21805) + // Standard Error: 541 + .saturating_add(Weight::from_parts(319_553, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2587,10 +2635,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `778 + r * (6 ±0)` // Estimated: `21735 + r * (30 ±0)` - // Minimum execution time: 235_249_000 picoseconds. - Weight::from_parts(239_861_242, 21735) - // Standard Error: 751 - .saturating_add(Weight::from_parts(325_795, 0).saturating_mul(r.into())) + // Minimum execution time: 234_461_000 picoseconds. + Weight::from_parts(239_682_633, 21735) + // Standard Error: 544 + .saturating_add(Weight::from_parts(322_943, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2612,10 +2660,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `856 + r * (10 ±0)` // Estimated: `24446 + r * (60 ±0)` - // Minimum execution time: 234_912_000 picoseconds. - Weight::from_parts(254_783_734, 24446) - // Standard Error: 1_610 - .saturating_add(Weight::from_parts(1_307_506, 0).saturating_mul(r.into())) + // Minimum execution time: 234_862_000 picoseconds. + Weight::from_parts(252_614_390, 24446) + // Standard Error: 1_180 + .saturating_add(Weight::from_parts(1_313_286, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 60).saturating_mul(r.into())) @@ -2635,10 +2683,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `745 + r * (4 ±0)` // Estimated: `21555 + r * (20 ±0)` - // Minimum execution time: 160_125_000 picoseconds. - Weight::from_parts(164_915_574, 21555) - // Standard Error: 332 - .saturating_add(Weight::from_parts(132_326, 0).saturating_mul(r.into())) + // Minimum execution time: 161_003_000 picoseconds. + Weight::from_parts(165_793_675, 21555) + // Standard Error: 323 + .saturating_add(Weight::from_parts(128_941, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(r.into())) @@ -2658,10 +2706,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `780 + r * (6 ±0)` // Estimated: `21740 + r * (30 ±0)` - // Minimum execution time: 234_717_000 picoseconds. - Weight::from_parts(238_540_521, 21740) - // Standard Error: 599 - .saturating_add(Weight::from_parts(277_303, 0).saturating_mul(r.into())) + // Minimum execution time: 235_192_000 picoseconds. + Weight::from_parts(241_225_671, 21740) + // Standard Error: 1_132 + .saturating_add(Weight::from_parts(272_760, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) @@ -2681,10 +2729,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `784` // Estimated: `21740` - // Minimum execution time: 235_792_000 picoseconds. - Weight::from_parts(244_114_692, 21740) + // Minimum execution time: 238_050_000 picoseconds. + Weight::from_parts(241_274_832, 21740) // Standard Error: 1 - .saturating_add(Weight::from_parts(589, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(590, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -2703,10 +2751,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `768 + r * (45 ±0)` // Estimated: `21660 + r * (225 ±0)` - // Minimum execution time: 231_166_000 picoseconds. - Weight::from_parts(233_339_177, 21660) - // Standard Error: 155_889 - .saturating_add(Weight::from_parts(3_124_322, 0).saturating_mul(r.into())) + // Minimum execution time: 231_807_000 picoseconds. + Weight::from_parts(234_264_848, 21660) + // Standard Error: 185_298 + .saturating_add(Weight::from_parts(1_000_351, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 225).saturating_mul(r.into())) @@ -2726,10 +2774,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `778` // Estimated: `21775` - // Minimum execution time: 235_721_000 picoseconds. - Weight::from_parts(237_413_703, 21775) - // Standard Error: 1 - .saturating_add(Weight::from_parts(177, 0).saturating_mul(n.into())) + // Minimum execution time: 234_347_000 picoseconds. + Weight::from_parts(234_774_467, 21775) + // Standard Error: 0 + .saturating_add(Weight::from_parts(183, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -2754,10 +2802,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `810 + r * (356 ±0)` // Estimated: `26094 + r * (15904 ±0)` - // Minimum execution time: 233_525_000 picoseconds. - Weight::from_parts(235_871_034, 26094) - // Standard Error: 235_338 - .saturating_add(Weight::from_parts(118_659_865, 0).saturating_mul(r.into())) + // Minimum execution time: 234_356_000 picoseconds. + Weight::from_parts(236_844_659, 26094) + // Standard Error: 161_035 + .saturating_add(Weight::from_parts(110_725_340, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((6_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2781,10 +2829,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `825 + r * (10 ±0)` // Estimated: `24283 + r * (60 ±0)` - // Minimum execution time: 235_007_000 picoseconds. - Weight::from_parts(248_419_686, 24283) - // Standard Error: 1_847 - .saturating_add(Weight::from_parts(1_815_822, 0).saturating_mul(r.into())) + // Minimum execution time: 234_248_000 picoseconds. + Weight::from_parts(255_712_101, 24283) + // Standard Error: 1_474 + .saturating_add(Weight::from_parts(1_753_943, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 60).saturating_mul(r.into())) @@ -2804,10 +2852,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `778 + r * (10 ±0)` // Estimated: `21735 + r * (50 ±0)` - // Minimum execution time: 232_912_000 picoseconds. - Weight::from_parts(256_142_885, 21735) - // Standard Error: 2_741 - .saturating_add(Weight::from_parts(3_542_482, 0).saturating_mul(r.into())) + // Minimum execution time: 232_456_000 picoseconds. + Weight::from_parts(230_738_907, 21735) + // Standard Error: 4_163 + .saturating_add(Weight::from_parts(3_496_817, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 50).saturating_mul(r.into())) @@ -2828,12 +2876,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `797 + t * (32 ±0)` // Estimated: `21840 + t * (2640 ±0)` - // Minimum execution time: 251_018_000 picoseconds. - Weight::from_parts(245_280_765, 21840) - // Standard Error: 90_317 - .saturating_add(Weight::from_parts(2_434_496, 0).saturating_mul(t.into())) + // Minimum execution time: 251_638_000 picoseconds. + Weight::from_parts(244_791_817, 21840) + // Standard Error: 89_537 + .saturating_add(Weight::from_parts(2_459_492, 0).saturating_mul(t.into())) // Standard Error: 25 - .saturating_add(Weight::from_parts(599, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(626, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2855,10 +2903,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `777 + r * (7 ±0)` // Estimated: `21725 + r * (35 ±0)` - // Minimum execution time: 164_022_000 picoseconds. - Weight::from_parts(168_658_387, 21725) - // Standard Error: 685 - .saturating_add(Weight::from_parts(238_133, 0).saturating_mul(r.into())) + // Minimum execution time: 164_736_000 picoseconds. + Weight::from_parts(164_496_597, 21725) + // Standard Error: 4_619 + .saturating_add(Weight::from_parts(252_013, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 35).saturating_mul(r.into())) @@ -2878,10 +2926,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `125728` // Estimated: `269977` - // Minimum execution time: 351_043_000 picoseconds. - Weight::from_parts(353_707_344, 269977) - // Standard Error: 3 - .saturating_add(Weight::from_parts(752, 0).saturating_mul(i.into())) + // Minimum execution time: 352_146_000 picoseconds. + Weight::from_parts(357_758_251, 269977) + // Standard Error: 1 + .saturating_add(Weight::from_parts(735, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -2892,10 +2940,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `845 + r * (292 ±0)` // Estimated: `843 + r * (293 ±0)` - // Minimum execution time: 235_854_000 picoseconds. - Weight::from_parts(133_986_225, 843) - // Standard Error: 9_550 - .saturating_add(Weight::from_parts(6_093_051, 0).saturating_mul(r.into())) + // Minimum execution time: 236_170_000 picoseconds. + Weight::from_parts(136_284_582, 843) + // Standard Error: 10_269 + .saturating_add(Weight::from_parts(5_995_228, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2909,10 +2957,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1304` // Estimated: `1280` - // Minimum execution time: 252_321_000 picoseconds. - Weight::from_parts(285_820_577, 1280) - // Standard Error: 60 - .saturating_add(Weight::from_parts(600, 0).saturating_mul(n.into())) + // Minimum execution time: 253_837_000 picoseconds. + Weight::from_parts(287_029_261, 1280) + // Standard Error: 51 + .saturating_add(Weight::from_parts(534, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2923,10 +2971,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1167 + n * (1 ±0)` // Estimated: `1167 + n * (1 ±0)` - // Minimum execution time: 252_047_000 picoseconds. - Weight::from_parts(254_244_310, 1167) - // Standard Error: 15 - .saturating_add(Weight::from_parts(144, 0).saturating_mul(n.into())) + // Minimum execution time: 253_037_000 picoseconds. + Weight::from_parts(256_401_533, 1167) + // Standard Error: 18 + .saturating_add(Weight::from_parts(32, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -2938,10 +2986,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `841 + r * (288 ±0)` // Estimated: `845 + r * (289 ±0)` - // Minimum execution time: 235_697_000 picoseconds. - Weight::from_parts(143_200_942, 845) - // Standard Error: 11_358 - .saturating_add(Weight::from_parts(5_934_318, 0).saturating_mul(r.into())) + // Minimum execution time: 236_800_000 picoseconds. + Weight::from_parts(134_748_031, 845) + // Standard Error: 9_560 + .saturating_add(Weight::from_parts(5_923_187, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2955,10 +3003,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1163 + n * (1 ±0)` // Estimated: `1163 + n * (1 ±0)` - // Minimum execution time: 250_360_000 picoseconds. - Weight::from_parts(252_712_722, 1163) - // Standard Error: 15 - .saturating_add(Weight::from_parts(130, 0).saturating_mul(n.into())) + // Minimum execution time: 250_601_000 picoseconds. + Weight::from_parts(253_618_803, 1163) + // Standard Error: 18 + .saturating_add(Weight::from_parts(74, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -2970,10 +3018,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `835 + r * (296 ±0)` // Estimated: `840 + r * (297 ±0)` - // Minimum execution time: 235_613_000 picoseconds. - Weight::from_parts(150_213_792, 840) - // Standard Error: 8_617 - .saturating_add(Weight::from_parts(4_962_874, 0).saturating_mul(r.into())) + // Minimum execution time: 236_194_000 picoseconds. + Weight::from_parts(152_630_909, 840) + // Standard Error: 8_573 + .saturating_add(Weight::from_parts(4_896_099, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2986,10 +3034,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1179 + n * (1 ±0)` // Estimated: `1179 + n * (1 ±0)` - // Minimum execution time: 249_137_000 picoseconds. - Weight::from_parts(253_529_386, 1179) - // Standard Error: 41 - .saturating_add(Weight::from_parts(612, 0).saturating_mul(n.into())) + // Minimum execution time: 250_989_000 picoseconds. + Weight::from_parts(260_170_747, 1179) + // Standard Error: 162 + .saturating_add(Weight::from_parts(224, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -3001,10 +3049,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `856 + r * (288 ±0)` // Estimated: `857 + r * (289 ±0)` - // Minimum execution time: 235_659_000 picoseconds. - Weight::from_parts(158_846_683, 857) - // Standard Error: 7_806 - .saturating_add(Weight::from_parts(4_728_537, 0).saturating_mul(r.into())) + // Minimum execution time: 236_574_000 picoseconds. + Weight::from_parts(155_573_955, 857) + // Standard Error: 10_270 + .saturating_add(Weight::from_parts(4_667_644, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3017,10 +3065,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1166 + n * (1 ±0)` // Estimated: `1166 + n * (1 ±0)` - // Minimum execution time: 248_553_000 picoseconds. - Weight::from_parts(250_703_269, 1166) - // Standard Error: 17 - .saturating_add(Weight::from_parts(163, 0).saturating_mul(n.into())) + // Minimum execution time: 249_502_000 picoseconds. + Weight::from_parts(251_496_311, 1166) + // Standard Error: 26 + .saturating_add(Weight::from_parts(186, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -3032,10 +3080,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `829 + r * (296 ±0)` // Estimated: `836 + r * (297 ±0)` - // Minimum execution time: 236_431_000 picoseconds. - Weight::from_parts(131_745_419, 836) - // Standard Error: 10_161 - .saturating_add(Weight::from_parts(6_182_174, 0).saturating_mul(r.into())) + // Minimum execution time: 236_030_000 picoseconds. + Weight::from_parts(128_595_856, 836) + // Standard Error: 10_530 + .saturating_add(Weight::from_parts(6_072_638, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3049,10 +3097,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1180 + n * (1 ±0)` // Estimated: `1180 + n * (1 ±0)` - // Minimum execution time: 252_551_000 picoseconds. - Weight::from_parts(254_517_030, 1180) - // Standard Error: 16 - .saturating_add(Weight::from_parts(712, 0).saturating_mul(n.into())) + // Minimum execution time: 254_027_000 picoseconds. + Weight::from_parts(260_739_475, 1180) + // Standard Error: 115 + .saturating_add(Weight::from_parts(330, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -3072,10 +3120,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1373 + r * (45 ±0)` // Estimated: `26753 + r * (2700 ±0)` - // Minimum execution time: 236_663_000 picoseconds. - Weight::from_parts(237_485_000, 26753) - // Standard Error: 42_414 - .saturating_add(Weight::from_parts(36_849_514, 0).saturating_mul(r.into())) + // Minimum execution time: 237_634_000 picoseconds. + Weight::from_parts(238_177_000, 26753) + // Standard Error: 23_320 + .saturating_add(Weight::from_parts(35_467_618, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) @@ -3097,10 +3145,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1237 + r * (256 ±0)` // Estimated: `26028 + r * (6235 ±0)` - // Minimum execution time: 237_101_000 picoseconds. - Weight::from_parts(237_827_000, 26028) - // Standard Error: 82_878 - .saturating_add(Weight::from_parts(211_777_724, 0).saturating_mul(r.into())) + // Minimum execution time: 237_076_000 picoseconds. + Weight::from_parts(237_792_000, 26028) + // Standard Error: 91_566 + .saturating_add(Weight::from_parts(212_893_975, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3122,10 +3170,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0 + r * (502 ±0)` // Estimated: `21755 + r * (6329 ±3)` - // Minimum execution time: 241_213_000 picoseconds. - Weight::from_parts(241_900_000, 21755) - // Standard Error: 99_976 - .saturating_add(Weight::from_parts(207_520_077, 0).saturating_mul(r.into())) + // Minimum execution time: 236_275_000 picoseconds. + Weight::from_parts(236_849_000, 21755) + // Standard Error: 92_724 + .saturating_add(Weight::from_parts(207_159_396, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3148,12 +3196,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1154 + t * (204 ±0)` // Estimated: `31015 + t * (5970 ±0)` - // Minimum execution time: 414_784_000 picoseconds. - Weight::from_parts(384_902_379, 31015) - // Standard Error: 1_228_593 - .saturating_add(Weight::from_parts(33_226_901, 0).saturating_mul(t.into())) + // Minimum execution time: 412_628_000 picoseconds. + Weight::from_parts(385_108_035, 31015) + // Standard Error: 1_002_078 + .saturating_add(Weight::from_parts(31_204_678, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(601, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(598, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(5_u64)) @@ -3179,10 +3227,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1301 + r * (254 ±0)` // Estimated: `30977 + r * (16635 ±0)` - // Minimum execution time: 236_963_000 picoseconds. - Weight::from_parts(237_711_000, 30977) - // Standard Error: 265_576 - .saturating_add(Weight::from_parts(347_359_908, 0).saturating_mul(r.into())) + // Minimum execution time: 237_161_000 picoseconds. + Weight::from_parts(237_620_000, 30977) + // Standard Error: 258_036 + .saturating_add(Weight::from_parts(344_869_637, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().reads((6_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(6_u64)) @@ -3210,14 +3258,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1071 + t * (187 ±0)` // Estimated: `42684 + t * (3588 ±2)` - // Minimum execution time: 1_615_191_000 picoseconds. - Weight::from_parts(337_408_450, 42684) - // Standard Error: 4_581_951 - .saturating_add(Weight::from_parts(115_730_776, 0).saturating_mul(t.into())) + // Minimum execution time: 1_613_172_000 picoseconds. + Weight::from_parts(326_952_137, 42684) + // Standard Error: 4_738_925 + .saturating_add(Weight::from_parts(113_657_996, 0).saturating_mul(t.into())) // Standard Error: 7 - .saturating_add(Weight::from_parts(1_171, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_173, 0).saturating_mul(i.into())) // Standard Error: 7 - .saturating_add(Weight::from_parts(1_346, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_347, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(10_u64)) @@ -3239,10 +3287,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `777 + r * (8 ±0)` // Estimated: `21710 + r * (40 ±0)` - // Minimum execution time: 233_601_000 picoseconds. - Weight::from_parts(246_594_905, 21710) - // Standard Error: 2_840 - .saturating_add(Weight::from_parts(578_751, 0).saturating_mul(r.into())) + // Minimum execution time: 233_679_000 picoseconds. + Weight::from_parts(238_638_820, 21710) + // Standard Error: 681 + .saturating_add(Weight::from_parts(573_320, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) @@ -3262,10 +3310,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `785` // Estimated: `21745` - // Minimum execution time: 233_735_000 picoseconds. - Weight::from_parts(243_432_330, 21745) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3_927, 0).saturating_mul(n.into())) + // Minimum execution time: 235_992_000 picoseconds. + Weight::from_parts(219_924_252, 21745) + // Standard Error: 5 + .saturating_add(Weight::from_parts(3_978, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3284,10 +3332,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` // Estimated: `21725 + r * (40 ±0)` - // Minimum execution time: 232_173_000 picoseconds. - Weight::from_parts(239_806_011, 21725) - // Standard Error: 1_530 - .saturating_add(Weight::from_parts(749_641, 0).saturating_mul(r.into())) + // Minimum execution time: 240_661_000 picoseconds. + Weight::from_parts(238_809_422, 21725) + // Standard Error: 820 + .saturating_add(Weight::from_parts(741_326, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) @@ -3307,10 +3355,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `787` // Estimated: `21765` - // Minimum execution time: 235_046_000 picoseconds. - Weight::from_parts(229_500_792, 21765) + // Minimum execution time: 235_136_000 picoseconds. + Weight::from_parts(228_678_487, 21765) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_166, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_164, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3329,10 +3377,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` // Estimated: `21740 + r * (40 ±0)` - // Minimum execution time: 231_708_000 picoseconds. - Weight::from_parts(235_347_566, 21740) - // Standard Error: 987 - .saturating_add(Weight::from_parts(428_819, 0).saturating_mul(r.into())) + // Minimum execution time: 233_364_000 picoseconds. + Weight::from_parts(243_294_285, 21740) + // Standard Error: 1_607 + .saturating_add(Weight::from_parts(413_186, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) @@ -3352,10 +3400,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `787` // Estimated: `21785` - // Minimum execution time: 234_068_000 picoseconds. - Weight::from_parts(226_519_852, 21785) + // Minimum execution time: 234_315_000 picoseconds. + Weight::from_parts(225_569_537, 21785) // Standard Error: 1 - .saturating_add(Weight::from_parts(916, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(919, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3374,10 +3422,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` // Estimated: `21745 + r * (40 ±0)` - // Minimum execution time: 231_872_000 picoseconds. - Weight::from_parts(236_694_763, 21745) - // Standard Error: 870 - .saturating_add(Weight::from_parts(420_853, 0).saturating_mul(r.into())) + // Minimum execution time: 233_288_000 picoseconds. + Weight::from_parts(239_289_154, 21745) + // Standard Error: 612 + .saturating_add(Weight::from_parts(414_275, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) @@ -3397,10 +3445,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `787` // Estimated: `21755` - // Minimum execution time: 233_707_000 picoseconds. - Weight::from_parts(226_312_559, 21755) - // Standard Error: 2 - .saturating_add(Weight::from_parts(924, 0).saturating_mul(n.into())) + // Minimum execution time: 233_686_000 picoseconds. + Weight::from_parts(227_406_694, 21755) + // Standard Error: 1 + .saturating_add(Weight::from_parts(919, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3414,15 +3462,61 @@ impl WeightInfo for () { /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Measured) /// Storage: System EventTopics (r:2 w:2) /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Measured) + /// The range of component `n` is `[0, 125697]`. + fn seal_sr25519_verify_per_byte(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `916 + n * (1 ±0)` + // Estimated: `22375 + n * (5 ±0)` + // Minimum execution time: 287_258_000 picoseconds. + Weight::from_parts(290_941_609, 22375) + // Standard Error: 8 + .saturating_add(Weight::from_parts(4_785, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 5).saturating_mul(n.into())) + } + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) + /// Storage: Contracts ContractInfoOf (r:1 w:1) + /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(290), added: 2765, mode: Measured) + /// Storage: Contracts CodeStorage (r:1 w:0) + /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, 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 EventTopics (r:2 w:2) + /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Measured) + /// The range of component `r` is `[0, 160]`. + fn seal_sr25519_verify(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `728 + r * (112 ±0)` + // Estimated: `21455 + r * (560 ±0)` + // Minimum execution time: 238_340_000 picoseconds. + Weight::from_parts(246_009_851, 21455) + // Standard Error: 21_677 + .saturating_add(Weight::from_parts(48_139_487, 0).saturating_mul(r.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 560).saturating_mul(r.into())) + } + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) + /// Storage: Contracts ContractInfoOf (r:1 w:1) + /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(290), added: 2765, mode: Measured) + /// Storage: Contracts CodeStorage (r:1 w:0) + /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, 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 EventTopics (r:2 w:2) + /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Measured) /// The range of component `r` is `[0, 160]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `822 + r * (76 ±0)` // Estimated: `21705 + r * (385 ±0)` - // Minimum execution time: 234_962_000 picoseconds. - Weight::from_parts(252_611_292, 21705) - // Standard Error: 20_134 - .saturating_add(Weight::from_parts(37_745_358, 0).saturating_mul(r.into())) + // Minimum execution time: 236_244_000 picoseconds. + Weight::from_parts(253_749_242, 21705) + // Standard Error: 19_216 + .saturating_add(Weight::from_parts(37_706_782, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 385).saturating_mul(r.into())) @@ -3442,10 +3536,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `792 + r * (42 ±0)` // Estimated: `21775 + r * (210 ±0)` - // Minimum execution time: 234_869_000 picoseconds. - Weight::from_parts(240_188_331, 21775) - // Standard Error: 9_910 - .saturating_add(Weight::from_parts(9_332_432, 0).saturating_mul(r.into())) + // Minimum execution time: 235_770_000 picoseconds. + Weight::from_parts(230_780_347, 21775) + // Standard Error: 12_015 + .saturating_add(Weight::from_parts(9_584_947, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 210).saturating_mul(r.into())) @@ -3466,11 +3560,11 @@ impl WeightInfo for () { fn seal_set_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + r * (964 ±0)` - // Estimated: `29920 + r * (11544 ±10)` - // Minimum execution time: 235_036_000 picoseconds. - Weight::from_parts(235_538_000, 29920) - // Standard Error: 47_360 - .saturating_add(Weight::from_parts(22_113_144, 0).saturating_mul(r.into())) + // Estimated: `29920 + r * (11544 ±7)` + // Minimum execution time: 235_857_000 picoseconds. + Weight::from_parts(236_482_000, 29920) + // Standard Error: 47_818 + .saturating_add(Weight::from_parts(21_765_273, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3492,10 +3586,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `773 + r * (3 ±0)` // Estimated: `21735 + r * (15 ±0)` - // Minimum execution time: 237_884_000 picoseconds. - Weight::from_parts(243_315_095, 21735) - // Standard Error: 560 - .saturating_add(Weight::from_parts(162_206, 0).saturating_mul(r.into())) + // Minimum execution time: 235_388_000 picoseconds. + Weight::from_parts(240_149_512, 21735) + // Standard Error: 555 + .saturating_add(Weight::from_parts(162_666, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 15).saturating_mul(r.into())) @@ -3515,10 +3609,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1975 + r * (39 ±0)` // Estimated: `27145 + r * (200 ±0)` - // Minimum execution time: 239_402_000 picoseconds. - Weight::from_parts(267_214_783, 27145) - // Standard Error: 1_166 - .saturating_add(Weight::from_parts(261_915, 0).saturating_mul(r.into())) + // Minimum execution time: 237_485_000 picoseconds. + Weight::from_parts(268_044_053, 27145) + // Standard Error: 1_147 + .saturating_add(Weight::from_parts(260_572, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 200).saturating_mul(r.into())) @@ -3540,10 +3634,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `776 + r * (3 ±0)` // Estimated: `24004 + r * (18 ±0)` - // Minimum execution time: 233_153_000 picoseconds. - Weight::from_parts(238_999_965, 24004) - // Standard Error: 291 - .saturating_add(Weight::from_parts(143_971, 0).saturating_mul(r.into())) + // Minimum execution time: 234_123_000 picoseconds. + Weight::from_parts(245_872_832, 24004) + // Standard Error: 943 + .saturating_add(Weight::from_parts(136_460, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 18).saturating_mul(r.into())) @@ -3553,509 +3647,509 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_706_000 picoseconds. - Weight::from_parts(1_962_558, 0) + // Minimum execution time: 1_606_000 picoseconds. + Weight::from_parts(1_845_698, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_000, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_995, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_870_000 picoseconds. - Weight::from_parts(2_481_243, 0) + // Minimum execution time: 1_711_000 picoseconds. + Weight::from_parts(2_281_581, 0) // Standard Error: 4 - .saturating_add(Weight::from_parts(6_346, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(6_354, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_830_000 picoseconds. - Weight::from_parts(2_389_658, 0) + // Minimum execution time: 1_680_000 picoseconds. + Weight::from_parts(2_269_238, 0) // Standard Error: 4 - .saturating_add(Weight::from_parts(5_997, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(6_014, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_734_000 picoseconds. - Weight::from_parts(2_170_618, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(7_919, 0).saturating_mul(r.into())) + // Minimum execution time: 1_592_000 picoseconds. + Weight::from_parts(2_010_963, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(7_927, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_661_000 picoseconds. - Weight::from_parts(1_945_771, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(10_840, 0).saturating_mul(r.into())) + // Minimum execution time: 1_631_000 picoseconds. + Weight::from_parts(1_936_549, 0) + // Standard Error: 6 + .saturating_add(Weight::from_parts(10_426, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_682_000 picoseconds. - Weight::from_parts(1_970_774, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(4_569, 0).saturating_mul(r.into())) + // Minimum execution time: 1_616_000 picoseconds. + Weight::from_parts(1_938_716, 0) + // Standard Error: 15 + .saturating_add(Weight::from_parts(4_525, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_668_000 picoseconds. - Weight::from_parts(1_227_080, 0) - // Standard Error: 76 - .saturating_add(Weight::from_parts(8_066, 0).saturating_mul(r.into())) + // Minimum execution time: 1_535_000 picoseconds. + Weight::from_parts(1_109_860, 0) + // Standard Error: 77 + .saturating_add(Weight::from_parts(7_998, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_653_000 picoseconds. - Weight::from_parts(1_394_759, 0) - // Standard Error: 39 - .saturating_add(Weight::from_parts(9_566, 0).saturating_mul(r.into())) + // Minimum execution time: 1_594_000 picoseconds. + Weight::from_parts(1_478_654, 0) + // Standard Error: 36 + .saturating_add(Weight::from_parts(9_525, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_771_000 picoseconds. - Weight::from_parts(1_905_594, 0) - // Standard Error: 147 - .saturating_add(Weight::from_parts(925, 0).saturating_mul(e.into())) + // Minimum execution time: 1_730_000 picoseconds. + Weight::from_parts(1_836_342, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(206, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_863_000 picoseconds. - Weight::from_parts(2_472_635, 0) - // Standard Error: 13 - .saturating_add(Weight::from_parts(17_892, 0).saturating_mul(r.into())) + // Minimum execution time: 1_607_000 picoseconds. + Weight::from_parts(2_150_133, 0) + // Standard Error: 17 + .saturating_add(Weight::from_parts(18_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_013_000 picoseconds. - Weight::from_parts(3_077_100, 0) - // Standard Error: 18 - .saturating_add(Weight::from_parts(24_287, 0).saturating_mul(r.into())) + // Minimum execution time: 1_824_000 picoseconds. + Weight::from_parts(3_119_825, 0) + // Standard Error: 15 + .saturating_add(Weight::from_parts(25_304, 0).saturating_mul(r.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_818_000 picoseconds. - Weight::from_parts(2_109_143, 0) - // Standard Error: 34 - .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(l.into())) + // Minimum execution time: 1_692_000 picoseconds. + Weight::from_parts(1_927_049, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(1_217, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_083_000 picoseconds. - Weight::from_parts(3_291_328, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(2_505, 0).saturating_mul(r.into())) + // Minimum execution time: 2_795_000 picoseconds. + Weight::from_parts(3_107_843, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(2_445, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_987_000 picoseconds. - Weight::from_parts(3_276_863, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(3_617, 0).saturating_mul(r.into())) + // Minimum execution time: 2_815_000 picoseconds. + Weight::from_parts(3_114_618, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(3_639, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_942_000 picoseconds. - Weight::from_parts(3_350_581, 0) + // Minimum execution time: 2_861_000 picoseconds. + Weight::from_parts(3_193_592, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(3_976, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_957, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_867_000 picoseconds. - Weight::from_parts(2_920_748, 0) - // Standard Error: 44 - .saturating_add(Weight::from_parts(8_229, 0).saturating_mul(r.into())) + // Minimum execution time: 1_710_000 picoseconds. + Weight::from_parts(2_148_021, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(8_391, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_757_000 picoseconds. - Weight::from_parts(2_235_198, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(8_815, 0).saturating_mul(r.into())) + // Minimum execution time: 1_663_000 picoseconds. + Weight::from_parts(2_170_373, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(8_812, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_824_000 picoseconds. - Weight::from_parts(1_941_816, 0) - // Standard Error: 86 - .saturating_add(Weight::from_parts(4_043, 0).saturating_mul(r.into())) + // Minimum execution time: 1_662_000 picoseconds. + Weight::from_parts(2_601_398, 0) + // Standard Error: 198 + .saturating_add(Weight::from_parts(3_851, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 16]`. fn instr_memory_grow(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_793_000 picoseconds. - Weight::from_parts(1_104_829, 0) - // Standard Error: 137_800 - .saturating_add(Weight::from_parts(13_336_784, 0).saturating_mul(r.into())) + // Minimum execution time: 1_603_000 picoseconds. + Weight::from_parts(332_932, 0) + // Standard Error: 137_529 + .saturating_add(Weight::from_parts(13_233_734, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_693_000 picoseconds. - Weight::from_parts(2_037_305, 0) + // Minimum execution time: 1_613_000 picoseconds. + Weight::from_parts(1_922_391, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(4_044, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_903, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_751_000 picoseconds. - Weight::from_parts(2_082_016, 0) + // Minimum execution time: 1_522_000 picoseconds. + Weight::from_parts(1_920_023, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_767, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_751_000 picoseconds. - Weight::from_parts(2_110_625, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(3_754, 0).saturating_mul(r.into())) + // Minimum execution time: 1_590_000 picoseconds. + Weight::from_parts(1_867_406, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(3_910, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_756_000 picoseconds. - Weight::from_parts(2_100_327, 0) + // Minimum execution time: 1_577_000 picoseconds. + Weight::from_parts(1_918_037, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_664, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_673, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_643_000 picoseconds. - Weight::from_parts(2_169_153, 0) + // Minimum execution time: 1_589_000 picoseconds. + Weight::from_parts(1_917_901, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(3_961, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_956, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_704_000 picoseconds. - Weight::from_parts(2_049_172, 0) + // Minimum execution time: 1_573_000 picoseconds. + Weight::from_parts(1_902_324, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_833, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_865, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_726_000 picoseconds. - Weight::from_parts(2_064_387, 0) + // Minimum execution time: 1_586_000 picoseconds. + Weight::from_parts(1_953_738, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_745, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_696_000 picoseconds. - Weight::from_parts(2_426_905, 0) - // Standard Error: 56 - .saturating_add(Weight::from_parts(5_915, 0).saturating_mul(r.into())) + // Minimum execution time: 1_598_000 picoseconds. + Weight::from_parts(1_912_180, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_994, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_617_000 picoseconds. - Weight::from_parts(2_035_161, 0) - // Standard Error: 94 - .saturating_add(Weight::from_parts(6_073, 0).saturating_mul(r.into())) + // Minimum execution time: 1_573_000 picoseconds. + Weight::from_parts(1_943_725, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_998, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_756_000 picoseconds. - Weight::from_parts(2_098_926, 0) + // Minimum execution time: 1_584_000 picoseconds. + Weight::from_parts(1_949_209, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(6_002, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_991, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_706_000 picoseconds. - Weight::from_parts(2_257_972, 0) - // Standard Error: 23 - .saturating_add(Weight::from_parts(5_982, 0).saturating_mul(r.into())) + // Minimum execution time: 1_576_000 picoseconds. + Weight::from_parts(1_927_466, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_005, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_761_000 picoseconds. - Weight::from_parts(2_114_141, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(5_815, 0).saturating_mul(r.into())) + // Minimum execution time: 1_566_000 picoseconds. + Weight::from_parts(2_004_312, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_799, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_700_000 picoseconds. - Weight::from_parts(2_053_201, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(6_137, 0).saturating_mul(r.into())) + // Minimum execution time: 1_538_000 picoseconds. + Weight::from_parts(1_922_703, 0) + // Standard Error: 9 + .saturating_add(Weight::from_parts(6_129, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_705_000 picoseconds. - Weight::from_parts(2_101_782, 0) + // Minimum execution time: 1_575_000 picoseconds. + Weight::from_parts(1_978_271, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(6_014, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_991, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_856_000 picoseconds. - Weight::from_parts(2_149_707, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(6_086, 0).saturating_mul(r.into())) + // Minimum execution time: 1_572_000 picoseconds. + Weight::from_parts(4_028_578, 0) + // Standard Error: 263 + .saturating_add(Weight::from_parts(5_784, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_739_000 picoseconds. - Weight::from_parts(2_143_216, 0) + // Minimum execution time: 1_615_000 picoseconds. + Weight::from_parts(1_962_065, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(5_934, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_945, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_716_000 picoseconds. - Weight::from_parts(2_065_762, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(6_009, 0).saturating_mul(r.into())) + // Minimum execution time: 1_578_000 picoseconds. + Weight::from_parts(1_909_721, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_993, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_664_000 picoseconds. - Weight::from_parts(3_062_283, 0) - // Standard Error: 94 - .saturating_add(Weight::from_parts(5_645, 0).saturating_mul(r.into())) + // Minimum execution time: 1_609_000 picoseconds. + Weight::from_parts(1_926_472, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_888, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_671_000 picoseconds. - Weight::from_parts(2_011_145, 0) - // Standard Error: 44 - .saturating_add(Weight::from_parts(6_220, 0).saturating_mul(r.into())) + // Minimum execution time: 1_620_000 picoseconds. + Weight::from_parts(2_875_196, 0) + // Standard Error: 177 + .saturating_add(Weight::from_parts(5_990, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_759_000 picoseconds. - Weight::from_parts(2_095_420, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(5_723, 0).saturating_mul(r.into())) + // Minimum execution time: 1_570_000 picoseconds. + Weight::from_parts(2_155_483, 0) + // Standard Error: 83 + .saturating_add(Weight::from_parts(5_675, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_672_000 picoseconds. - Weight::from_parts(2_184_044, 0) + // Minimum execution time: 1_558_000 picoseconds. + Weight::from_parts(2_108_263, 0) // Standard Error: 5 - .saturating_add(Weight::from_parts(11_782, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(11_755, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_752_000 picoseconds. - Weight::from_parts(2_276_209, 0) - // Standard Error: 5 - .saturating_add(Weight::from_parts(10_513, 0).saturating_mul(r.into())) + // Minimum execution time: 1_568_000 picoseconds. + Weight::from_parts(1_606_397, 0) + // Standard Error: 51 + .saturating_add(Weight::from_parts(11_011, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_711_000 picoseconds. - Weight::from_parts(2_720_989, 0) + // Minimum execution time: 1_630_000 picoseconds. + Weight::from_parts(2_872_487, 0) // Standard Error: 24 - .saturating_add(Weight::from_parts(11_884, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(11_761, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_713_000 picoseconds. - Weight::from_parts(2_091_403, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(10_628, 0).saturating_mul(r.into())) + // Minimum execution time: 1_575_000 picoseconds. + Weight::from_parts(2_385_398, 0) + // Standard Error: 45 + .saturating_add(Weight::from_parts(10_650, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_704_000 picoseconds. - Weight::from_parts(2_054_652, 0) + // Minimum execution time: 1_622_000 picoseconds. + Weight::from_parts(1_957_246, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_672, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_659, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_743_000 picoseconds. - Weight::from_parts(2_032_806, 0) - // Standard Error: 19 - .saturating_add(Weight::from_parts(5_795, 0).saturating_mul(r.into())) + // Minimum execution time: 1_551_000 picoseconds. + Weight::from_parts(1_897_168, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_774, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_667_000 picoseconds. - Weight::from_parts(2_031_702, 0) - // Standard Error: 5 - .saturating_add(Weight::from_parts(5_923, 0).saturating_mul(r.into())) + // Minimum execution time: 1_549_000 picoseconds. + Weight::from_parts(1_915_938, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_915, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_735_000 picoseconds. - Weight::from_parts(2_946_634, 0) - // Standard Error: 54 - .saturating_add(Weight::from_parts(5_685, 0).saturating_mul(r.into())) + // Minimum execution time: 1_617_000 picoseconds. + Weight::from_parts(1_932_618, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(5_854, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_652_000 picoseconds. - Weight::from_parts(2_023_049, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(6_146, 0).saturating_mul(r.into())) + // Minimum execution time: 1_617_000 picoseconds. + Weight::from_parts(1_937_566, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(6_134, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_654_000 picoseconds. - Weight::from_parts(2_148_951, 0) + // Minimum execution time: 1_584_000 picoseconds. + Weight::from_parts(1_980_681, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(5_869, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_730_000 picoseconds. - Weight::from_parts(2_130_543, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_999, 0).saturating_mul(r.into())) + // Minimum execution time: 1_542_000 picoseconds. + Weight::from_parts(2_131_567, 0) + // Standard Error: 57 + .saturating_add(Weight::from_parts(6_010, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_728_000 picoseconds. - Weight::from_parts(2_172_886, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_843, 0).saturating_mul(r.into())) + // Minimum execution time: 1_609_000 picoseconds. + Weight::from_parts(1_643_214, 0) + // Standard Error: 91 + .saturating_add(Weight::from_parts(6_062, 0).saturating_mul(r.into())) } } From f0d3bbbbc3da6c5455dea0c7cb18f9d0862b5558 Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Wed, 12 Apr 2023 14:42:22 -0400 Subject: [PATCH 19/93] Globally upgrade to syn 2.x and latest quote and proc_macro2 1x versions (#13846) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * globally upgrade quote to latest 1.0.x (1.0.26) * globally upgrade syn to final 1.0.x version (1.0.109) * globally upgrade proc-macro2 to 1.0.56 * upgrade to syn v2.0.13 and fix everything except NestedMeta * fix parse nested metadata code in decl_runtime_apis.rs * Port more stuff to syn 2.0 * Make the rest compile * Ignore error * update to syn 2.0.14 --------- Co-authored-by: Bastian Köcher --- Cargo.lock | 36 +++--- bin/node/cli/tests/telemetry.rs | 5 +- client/chain-spec/derive/Cargo.toml | 6 +- client/chain-spec/derive/src/impls.rs | 2 +- client/consensus/babe/src/lib.rs | 5 +- client/db/src/pinned_blocks_cache.rs | 5 +- client/service/test/src/client/mod.rs | 5 +- client/state-db/src/lib.rs | 10 +- client/tracing/proc-macro/Cargo.toml | 6 +- frame/contracts/proc-macro/Cargo.toml | 6 +- frame/contracts/proc-macro/src/lib.rs | 10 +- .../solution-type/Cargo.toml | 6 +- .../solution-type/src/lib.rs | 4 +- frame/nfts/src/tests.rs | 6 +- frame/scheduler/src/migration.rs | 10 +- frame/staking/reward-curve/Cargo.toml | 6 +- frame/support/procedural/Cargo.toml | 6 +- frame/support/procedural/src/benchmark.rs | 90 ++++++------- .../procedural/src/construct_runtime/mod.rs | 2 +- .../procedural/src/construct_runtime/parse.rs | 31 ++--- .../procedural/src/default_no_bound.rs | 4 +- .../procedural/src/pallet/expand/call.rs | 10 +- .../procedural/src/pallet/expand/constants.rs | 2 +- .../src/pallet/expand/documentation.rs | 119 ++++++------------ .../procedural/src/pallet/expand/storage.rs | 25 ++-- .../procedural/src/pallet/parse/call.rs | 6 +- .../procedural/src/pallet/parse/composite.rs | 25 ++-- .../procedural/src/pallet/parse/config.rs | 36 ++++-- .../procedural/src/pallet/parse/error.rs | 2 +- .../src/pallet/parse/extra_constants.rs | 4 +- .../procedural/src/pallet/parse/helper.rs | 9 +- .../procedural/src/pallet/parse/hooks.rs | 2 +- .../procedural/src/pallet/parse/storage.rs | 12 +- .../procedural/src/pallet/parse/type_value.rs | 6 +- frame/support/procedural/src/pallet_error.rs | 79 +++++------- .../genesis_config/genesis_config_def.rs | 7 +- frame/support/procedural/src/storage/mod.rs | 4 +- .../src/storage/print_pallet_upgrade.rs | 14 +-- frame/support/procedural/tools/Cargo.toml | 6 +- .../procedural/tools/derive/Cargo.toml | 6 +- frame/support/procedural/tools/src/lib.rs | 13 +- .../pallet_ui/pallet_doc_arg_non_path.stderr | 2 +- .../tests/pallet_ui/pallet_doc_empty.stderr | 2 +- .../pallet_ui/pallet_doc_invalid_arg.stderr | 2 +- .../pallet_ui/pallet_doc_multiple_args.stderr | 2 +- ...result_query_parenthesized_generics.stderr | 4 +- primitives/api/proc-macro/Cargo.toml | 6 +- .../api/proc-macro/src/decl_runtime_apis.rs | 91 ++++++-------- .../api/proc-macro/src/impl_runtime_apis.rs | 6 +- .../proc-macro/src/mock_impl_runtime_apis.rs | 8 +- .../api/proc-macro/src/runtime_metadata.rs | 4 +- primitives/api/proc-macro/src/utils.rs | 14 ++- primitives/arithmetic/src/per_things.rs | 10 +- primitives/core/hashing/proc-macro/Cargo.toml | 6 +- primitives/debug-derive/Cargo.toml | 6 +- .../runtime-interface/proc-macro/Cargo.toml | 6 +- .../bare_function_interface.rs | 15 ++- .../host_function_interface.rs | 6 +- .../src/runtime_interface/trait_decl_impl.rs | 18 +-- .../runtime-interface/proc-macro/src/utils.rs | 26 ++-- primitives/version/proc-macro/Cargo.toml | 6 +- test-utils/derive/Cargo.toml | 6 +- 62 files changed, 409 insertions(+), 485 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6a1f29aa28e20..b0a96af545b2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2351,7 +2351,7 @@ dependencies = [ "quote", "scale-info", "sp-arithmetic", - "syn 1.0.109", + "syn 2.0.14", "trybuild", ] @@ -2489,7 +2489,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -2500,7 +2500,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -2509,7 +2509,7 @@ version = "3.0.0" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -2724,7 +2724,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -5912,7 +5912,7 @@ version = "4.0.0-dev" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -6795,7 +6795,7 @@ dependencies = [ "proc-macro2", "quote", "sp-runtime", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -8401,7 +8401,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -9630,7 +9630,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -10181,7 +10181,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -10490,7 +10490,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -10507,7 +10507,7 @@ version = "5.0.0" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -10737,7 +10737,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -10962,7 +10962,7 @@ dependencies = [ "proc-macro2", "quote", "sp-version", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -11388,7 +11388,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] @@ -11444,9 +11444,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.13" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5" dependencies = [ "proc-macro2", "quote", @@ -11705,7 +11705,7 @@ checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] diff --git a/bin/node/cli/tests/telemetry.rs b/bin/node/cli/tests/telemetry.rs index f6e46775a22fb..176d2e81ad06b 100644 --- a/bin/node/cli/tests/telemetry.rs +++ b/bin/node/cli/tests/telemetry.rs @@ -57,8 +57,9 @@ async fn telemetry_works() { } }, - Event::TextFrame { .. } => - panic!("Got a TextFrame over the socket, this is a bug"), + Event::TextFrame { .. } => { + panic!("Got a TextFrame over the socket, this is a bug") + }, // Connection has been closed. Event::ConnectionError { .. } => {}, diff --git a/client/chain-spec/derive/Cargo.toml b/client/chain-spec/derive/Cargo.toml index d733bda9b1692..c16cd45a99433 100644 --- a/client/chain-spec/derive/Cargo.toml +++ b/client/chain-spec/derive/Cargo.toml @@ -16,6 +16,6 @@ proc-macro = true [dependencies] proc-macro-crate = "1.1.3" -proc-macro2 = "1.0.37" -quote = "1.0.10" -syn = "1.0.98" +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = "2.0.14" diff --git a/client/chain-spec/derive/src/impls.rs b/client/chain-spec/derive/src/impls.rs index e54c1895e4a4b..c0624897c133e 100644 --- a/client/chain-spec/derive/src/impls.rs +++ b/client/chain-spec/derive/src/impls.rs @@ -35,7 +35,7 @@ pub fn extension_derive(ast: &DeriveInput) -> proc_macro::TokenStream { .named .iter() .find_map(|f| { - if f.attrs.iter().any(|attr| attr.path.is_ident(ATTRIBUTE_NAME)) { + if f.attrs.iter().any(|attr| attr.path().is_ident(ATTRIBUTE_NAME)) { let typ = &f.ty; Some(quote! { #typ }) } else { diff --git a/client/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs index a59870ced0693..e540cae1f7e76 100644 --- a/client/consensus/babe/src/lib.rs +++ b/client/consensus/babe/src/lib.rs @@ -556,8 +556,9 @@ fn aux_storage_cleanup + HeaderBackend, Block: B Ok(meta) => { hashes.insert(meta.parent); }, - Err(err) => - warn!(target: LOG_TARGET, "Failed to lookup metadata for block `{:?}`: {}", first, err,), + Err(err) => { + warn!(target: LOG_TARGET, "Failed to lookup metadata for block `{:?}`: {}", first, err,) + }, } // Cleans data for finalized block's ancestors diff --git a/client/db/src/pinned_blocks_cache.rs b/client/db/src/pinned_blocks_cache.rs index f50a7081df6a8..7b346b4631eee 100644 --- a/client/db/src/pinned_blocks_cache.rs +++ b/client/db/src/pinned_blocks_cache.rs @@ -149,8 +149,9 @@ impl PinnedBlocksCache { self.cache.len() ); }, - None => - log::warn!(target: LOG_TARGET, "Unable to bump reference count. hash = {}", hash), + None => { + log::warn!(target: LOG_TARGET, "Unable to bump reference count. hash = {}", hash) + }, }; } diff --git a/client/service/test/src/client/mod.rs b/client/service/test/src/client/mod.rs index 1b282a342d5e6..520a9b52feab0 100644 --- a/client/service/test/src/client/mod.rs +++ b/client/service/test/src/client/mod.rs @@ -158,8 +158,9 @@ fn finality_notification_check( assert_eq!(notif.hash, *finalized.last().unwrap()); assert_eq!(stale_heads, stale_heads_expected); }, - Err(TryRecvError::Closed) => - panic!("unexpected notification result, client send channel was closed"), + Err(TryRecvError::Closed) => { + panic!("unexpected notification result, client send channel was closed") + }, Err(TryRecvError::Empty) => assert!(finalized.is_empty()), } } diff --git a/client/state-db/src/lib.rs b/client/state-db/src/lib.rs index b41240d629b91..c656f126ae6eb 100644 --- a/client/state-db/src/lib.rs +++ b/client/state-db/src/lib.rs @@ -187,12 +187,14 @@ impl fmt::Debug for StateDbError { "Incompatible pruning modes [stored: {:?}; requested: {:?}]", stored, requested ), - Self::TooManySiblingBlocks { number } => - write!(f, "Too many sibling blocks at #{number} inserted"), + Self::TooManySiblingBlocks { number } => { + write!(f, "Too many sibling blocks at #{number} inserted") + }, Self::BlockAlreadyExists => write!(f, "Block already exists"), Self::Metadata(message) => write!(f, "Invalid metadata: {}", message), - Self::BlockUnavailable => - write!(f, "Trying to get a block record from db while it is not commit to db yet"), + Self::BlockUnavailable => { + write!(f, "Trying to get a block record from db while it is not commit to db yet") + }, Self::BlockMissing => write!(f, "Block record is missing from the pruning window"), } } diff --git a/client/tracing/proc-macro/Cargo.toml b/client/tracing/proc-macro/Cargo.toml index 031f1fe49d970..54078fe1f2cae 100644 --- a/client/tracing/proc-macro/Cargo.toml +++ b/client/tracing/proc-macro/Cargo.toml @@ -16,6 +16,6 @@ proc-macro = true [dependencies] proc-macro-crate = "1.1.3" -proc-macro2 = "1.0.37" -quote = { version = "1.0.10", features = ["proc-macro"] } -syn = { version = "1.0.98", features = ["proc-macro", "full", "extra-traits", "parsing"] } +proc-macro2 = "1.0.56" +quote = { version = "1.0.26", features = ["proc-macro"] } +syn = { version = "2.0.14", features = ["proc-macro", "full", "extra-traits", "parsing"] } diff --git a/frame/contracts/proc-macro/Cargo.toml b/frame/contracts/proc-macro/Cargo.toml index 08dafcc6a8fca..c700d1e335639 100644 --- a/frame/contracts/proc-macro/Cargo.toml +++ b/frame/contracts/proc-macro/Cargo.toml @@ -15,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -proc-macro2 = "1" -quote = "1" -syn = { version = "1.0.98", features = ["full"] } +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full"] } [dev-dependencies] diff --git a/frame/contracts/proc-macro/src/lib.rs b/frame/contracts/proc-macro/src/lib.rs index d54470dd06f97..a6a8187bc8aaa 100644 --- a/frame/contracts/proc-macro/src/lib.rs +++ b/frame/contracts/proc-macro/src/lib.rs @@ -209,13 +209,13 @@ impl HostFn { "only #[version()], #[unstable], #[prefixed_alias] and #[deprecated] attributes are allowed."; let span = item.span(); let mut attrs = item.attrs.clone(); - attrs.retain(|a| !a.path.is_ident("doc")); + attrs.retain(|a| !a.path().is_ident("doc")); let mut maybe_version = None; let mut is_stable = true; let mut alias_to = None; let mut not_deprecated = true; while let Some(attr) = attrs.pop() { - let ident = attr.path.get_ident().ok_or(err(span, msg))?.to_string(); + let ident = attr.path().get_ident().ok_or(err(span, msg))?.to_string(); match ident.as_str() { "version" => { if maybe_version.is_some() { @@ -377,7 +377,7 @@ impl EnvDef { _ => None, }; - let selector = |a: &syn::Attribute| a.path.is_ident("prefixed_alias"); + let selector = |a: &syn::Attribute| a.path().is_ident("prefixed_alias"); let aliases = items .iter() @@ -401,7 +401,7 @@ impl EnvDef { } fn is_valid_special_arg(idx: usize, arg: &FnArg) -> bool { - let pat = if let FnArg::Typed(pat) = arg { pat } else { return false }; + let FnArg::Typed(pat) = arg else { return false }; let ident = if let syn::Pat::Ident(ref ident) = *pat.pat { &ident.ident } else { return false }; let name_ok = match idx { 0 => ident == "ctx" || ident == "_ctx", @@ -434,7 +434,7 @@ fn expand_func_doc(func: &HostFn) -> TokenStream2 { ); quote! { #[doc = #alias_doc] } } else { - let docs = func.item.attrs.iter().filter(|a| a.path.is_ident("doc")).map(|d| { + let docs = func.item.attrs.iter().filter(|a| a.path().is_ident("doc")).map(|d| { let docs = d.to_token_stream(); quote! { #docs } }); diff --git a/frame/election-provider-support/solution-type/Cargo.toml b/frame/election-provider-support/solution-type/Cargo.toml index eb9598dca20b8..95ad6f226663b 100644 --- a/frame/election-provider-support/solution-type/Cargo.toml +++ b/frame/election-provider-support/solution-type/Cargo.toml @@ -15,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -syn = { version = "1.0.98", features = ["full", "visit"] } -quote = "1.0" -proc-macro2 = "1.0.37" +syn = { version = "2.0.14", features = ["full", "visit"] } +quote = "1.0.26" +proc-macro2 = "1.0.56" proc-macro-crate = "1.1.3" [dev-dependencies] diff --git a/frame/election-provider-support/solution-type/src/lib.rs b/frame/election-provider-support/solution-type/src/lib.rs index f79554321d54e..6938953071a7c 100644 --- a/frame/election-provider-support/solution-type/src/lib.rs +++ b/frame/election-provider-support/solution-type/src/lib.rs @@ -161,7 +161,7 @@ fn check_attributes(input: ParseStream) -> syn::Result { return Ok(false) } let attr = attrs.pop().expect("attributes vec with len 1 can be popped."); - if attr.path.is_ident("compact") { + if attr.path().is_ident("compact") { Ok(true) } else { Err(syn::Error::new_spanned(attr, "compact solution can accept only #[compact]")) @@ -200,7 +200,7 @@ impl Parse for SolutionDef { format!("Expected binding: `{} = ...`", expected), )) }, - syn::GenericArgument::Binding(syn::Binding { ident, ty, .. }) => { + syn::GenericArgument::AssocType(syn::AssocType { ident, ty, .. }) => { // check that we have the right keyword for this position in the argument list if ident == expected { Ok(ty.clone()) diff --git a/frame/nfts/src/tests.rs b/frame/nfts/src/tests.rs index 0fc6fcd15c45f..d36f8b54e2b91 100644 --- a/frame/nfts/src/tests.rs +++ b/frame/nfts/src/tests.rs @@ -2700,7 +2700,11 @@ fn claim_swap_should_work() { Balances::make_free_balance_be(&user_1, initial_balance); Balances::make_free_balance_be(&user_2, initial_balance); - assert_ok!(Nfts::force_create(RuntimeOrigin::root(), user_1.clone(), default_collection_config())); + assert_ok!(Nfts::force_create( + RuntimeOrigin::root(), + user_1.clone(), + default_collection_config() + )); assert_ok!(Nfts::mint( RuntimeOrigin::signed(user_1.clone()), diff --git a/frame/scheduler/src/migration.rs b/frame/scheduler/src/migration.rs index e641d2895aa0c..5b3a7631eeac9 100644 --- a/frame/scheduler/src/migration.rs +++ b/frame/scheduler/src/migration.rs @@ -297,8 +297,9 @@ pub mod v4 { target: TARGET, "Did not clean up any agendas. v4::CleanupAgendas can be removed." ), - Some(n) => - log::info!(target: TARGET, "Cleaned up {} agendas, now {}", n, new_agendas), + Some(n) => { + log::info!(target: TARGET, "Cleaned up {} agendas, now {}", n, new_agendas) + }, None => unreachable!( "Number of agendas cannot increase, old {} new {}", old_agendas, new_agendas @@ -560,8 +561,9 @@ mod test { "Agenda {} should be removed", i ), - Some(new) => - assert_eq!(Agenda::::get(i as u64), new, "Agenda wrong {}", i), + Some(new) => { + assert_eq!(Agenda::::get(i as u64), new, "Agenda wrong {}", i) + }, } } }); diff --git a/frame/staking/reward-curve/Cargo.toml b/frame/staking/reward-curve/Cargo.toml index c761517ea6829..4a97d20a5f0af 100644 --- a/frame/staking/reward-curve/Cargo.toml +++ b/frame/staking/reward-curve/Cargo.toml @@ -16,9 +16,9 @@ proc-macro = true [dependencies] proc-macro-crate = "1.1.3" -proc-macro2 = "1.0.37" -quote = "1.0.10" -syn = { version = "1.0.98", features = ["full", "visit"] } +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full", "visit"] } [dev-dependencies] sp-runtime = { version = "7.0.0", path = "../../../primitives/runtime" } diff --git a/frame/support/procedural/Cargo.toml b/frame/support/procedural/Cargo.toml index 6dbdd3b3a594d..d57b81a3444fe 100644 --- a/frame/support/procedural/Cargo.toml +++ b/frame/support/procedural/Cargo.toml @@ -19,9 +19,9 @@ derive-syn-parse = "0.1.5" Inflector = "0.11.4" cfg-expr = "0.10.3" itertools = "0.10.3" -proc-macro2 = "1.0.37" -quote = "1.0.10" -syn = { version = "1.0.98", features = ["full"] } +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full"] } frame-support-procedural-tools = { version = "4.0.0-dev", path = "./tools" } proc-macro-warning = { version = "0.2.0", default-features = false } diff --git a/frame/support/procedural/src/benchmark.rs b/frame/support/procedural/src/benchmark.rs index 4f9994b6cd073..cf091e7cb0cf7 100644 --- a/frame/support/procedural/src/benchmark.rs +++ b/frame/support/procedural/src/benchmark.rs @@ -21,14 +21,13 @@ use derive_syn_parse::Parse; use frame_support_procedural_tools::generate_crate_access_2018; use proc_macro::TokenStream; use proc_macro2::{Ident, Span, TokenStream as TokenStream2}; -use quote::{quote, quote_spanned, ToTokens}; +use quote::{quote, ToTokens}; use syn::{ - parenthesized, parse::{Nothing, ParseStream}, parse_quote, punctuated::Punctuated, spanned::Spanned, - token::{Colon2, Comma, Gt, Lt, Paren}, + token::{Comma, Gt, Lt, PathSep}, Attribute, Error, Expr, ExprBlock, ExprCall, ExprPath, FnArg, Item, ItemFn, ItemMod, LitInt, Pat, Path, PathArguments, PathSegment, Result, ReturnType, Signature, Stmt, Token, Type, TypePath, Visibility, WhereClause, @@ -45,6 +44,9 @@ mod keywords { custom_keyword!(skip_meta); custom_keyword!(BenchmarkError); custom_keyword!(Result); + + pub const BENCHMARK_TOKEN: &str = stringify!(benchmark); + pub const BENCHMARKS_TOKEN: &str = stringify!(benchmarks); } /// This represents the raw parsed data for a param definition such as `x: Linear<10, 20>`. @@ -95,27 +97,20 @@ impl syn::parse::Parse for BenchmarkAttrKeyword { impl syn::parse::Parse for BenchmarkAttrs { fn parse(input: ParseStream) -> syn::Result { - let lookahead = input.lookahead1(); - if !lookahead.peek(Paren) { - let _nothing: Nothing = input.parse()?; - return Ok(BenchmarkAttrs { skip_meta: false, extra: false }) - } - let content; - let _paren: Paren = parenthesized!(content in input); let mut extra = false; let mut skip_meta = false; - let args = Punctuated::::parse_terminated(&content)?; + let args = Punctuated::::parse_terminated(&input)?; for arg in args.into_iter() { match arg { BenchmarkAttrKeyword::Extra => { if extra { - return Err(content.error("`extra` can only be specified once")) + return Err(input.error("`extra` can only be specified once")) } extra = true; }, BenchmarkAttrKeyword::SkipMeta => { if skip_meta { - return Err(content.error("`skip_meta` can only be specified once")) + return Err(input.error("`skip_meta` can only be specified once")) } skip_meta = true; }, @@ -150,8 +145,6 @@ struct BenchmarkDef { call_def: BenchmarkCallDef, verify_stmts: Vec, last_stmt: Option, - extra: bool, - skip_meta: bool, fn_sig: Signature, fn_vis: Visibility, fn_attrs: Vec, @@ -218,7 +211,7 @@ fn parse_params(item_fn: &ItemFn) -> Result> { return Err(Error::new( var_span, "Benchmark parameter names must consist of a single lowercase letter (a-z) and no other characters.", - )) + )); }; let name = ident.ident.to_token_stream().to_string(); if name.len() > 1 { @@ -253,9 +246,9 @@ fn parse_params(item_fn: &ItemFn) -> Result> { /// Used in several places where the `#[extrinsic_call]` or `#[body]` annotation is missing fn missing_call(item_fn: &ItemFn) -> Result { return Err(Error::new( - item_fn.block.brace_token.span, + item_fn.block.brace_token.span.join(), "No valid #[extrinsic_call] or #[block] annotation could be found in benchmark function body." - )) + )); } /// Finds the `BenchmarkCallDef` and its index (within the list of stmts for the fn) and @@ -264,10 +257,10 @@ fn missing_call(item_fn: &ItemFn) -> Result { fn parse_call_def(item_fn: &ItemFn) -> Result<(usize, BenchmarkCallDef)> { // #[extrinsic_call] / #[block] handling let call_defs = item_fn.block.stmts.iter().enumerate().filter_map(|(i, child)| { - if let Stmt::Semi(Expr::Call(expr_call), _semi) = child { + if let Stmt::Expr(Expr::Call(expr_call), _semi) = child { // #[extrinsic_call] case expr_call.attrs.iter().enumerate().find_map(|(k, attr)| { - let segment = attr.path.segments.last()?; + let segment = attr.path().segments.last()?; let _: keywords::extrinsic_call = syn::parse(segment.ident.to_token_stream().into()).ok()?; let mut expr_call = expr_call.clone(); @@ -281,10 +274,10 @@ fn parse_call_def(item_fn: &ItemFn) -> Result<(usize, BenchmarkCallDef)> { Some(Ok((i, BenchmarkCallDef::ExtrinsicCall { origin, expr_call, attr_span: attr.span() }))) }) - } else if let Stmt::Expr(Expr::Block(block)) = child { + } else if let Stmt::Expr(Expr::Block(block), _) = child { // #[block] case block.attrs.iter().enumerate().find_map(|(k, attr)| { - let segment = attr.path.segments.last()?; + let segment = attr.path().segments.last()?; let _: keywords::block = syn::parse(segment.ident.to_token_stream().into()).ok()?; let mut block = block.clone(); @@ -310,7 +303,7 @@ fn parse_call_def(item_fn: &ItemFn) -> Result<(usize, BenchmarkCallDef)> { impl BenchmarkDef { /// Constructs a [`BenchmarkDef`] by traversing an existing [`ItemFn`] node. - pub fn from(item_fn: &ItemFn, extra: bool, skip_meta: bool) -> Result { + pub fn from(item_fn: &ItemFn) -> Result { let params = parse_params(item_fn)?; ensure_valid_return_type(item_fn)?; let (i, call_def) = parse_call_def(&item_fn)?; @@ -346,8 +339,6 @@ impl BenchmarkDef { call_def, verify_stmts, last_stmt, - extra, - skip_meta, fn_sig: item_fn.sig.clone(), fn_vis: item_fn.vis.clone(), fn_attrs: item_fn.attrs.clone(), @@ -375,7 +366,7 @@ pub fn benchmarks( let mod_attrs: Vec<&Attribute> = module .attrs .iter() - .filter(|attr| syn::parse2::(attr.to_token_stream()).is_err()) + .filter(|attr| !attr.path().is_ident(keywords::BENCHMARKS_TOKEN)) .collect(); let mut benchmark_names: Vec = Vec::new(); @@ -391,35 +382,32 @@ pub fn benchmarks( let Item::Fn(func) = stmt else { return None }; // find #[benchmark] attribute on function def - let benchmark_attr = func.attrs.iter().find_map(|attr| { - let seg = attr.path.segments.last()?; - syn::parse::(seg.ident.to_token_stream().into()).ok()?; - Some(attr) - })?; + let benchmark_attr = + func.attrs.iter().find(|attr| attr.path().is_ident(keywords::BENCHMARK_TOKEN))?; Some((benchmark_attr.clone(), func.clone(), stmt)) }); // parse individual benchmark defs and args for (benchmark_attr, func, stmt) in benchmark_fn_metas { - // parse any args provided to #[benchmark] - let attr_tokens = benchmark_attr.tokens.to_token_stream().into(); - let benchmark_args: BenchmarkAttrs = syn::parse(attr_tokens)?; - // parse benchmark def - let benchmark_def = - BenchmarkDef::from(&func, benchmark_args.extra, benchmark_args.skip_meta)?; + let benchmark_def = BenchmarkDef::from(&func)?; // record benchmark name let name = &func.sig.ident; benchmark_names.push(name.clone()); - // record name sets - if benchmark_def.extra { - extra_benchmark_names.push(name.clone()); - } - if benchmark_def.skip_meta { - skip_meta_benchmark_names.push(name.clone()) + // Check if we need to parse any args + if benchmark_attr.meta.require_path_only().is_err() { + // parse any args provided to #[benchmark] + let benchmark_attrs: BenchmarkAttrs = benchmark_attr.parse_args()?; + + // record name sets + if benchmark_attrs.extra { + extra_benchmark_names.push(name.clone()); + } else if benchmark_attrs.skip_meta { + skip_meta_benchmark_names.push(name.clone()); + } } // expand benchmark @@ -787,7 +775,8 @@ fn expand_benchmark( // determine call name (handles `_` and normal call syntax) let expr_span = expr_call.span(); let call_err = || { - quote_spanned!(expr_span=> "Extrinsic call must be a function call or `_`".to_compile_error()).into() + syn::Error::new(expr_span, "Extrinsic call must be a function call or `_`") + .to_compile_error() }; let call_name = match *expr_call.func { Expr::Path(expr_path) => { @@ -795,10 +784,9 @@ fn expand_benchmark( let Some(segment) = expr_path.path.segments.last() else { return call_err(); }; segment.ident.to_string() }, - Expr::Verbatim(tokens) => { + Expr::Infer(_) => { // `_` style // replace `_` with fn name - let Ok(_) = syn::parse::(tokens.to_token_stream().into()) else { return call_err(); }; name.to_string() }, _ => return call_err(), @@ -806,7 +794,7 @@ fn expand_benchmark( // modify extrinsic call to be prefixed with "new_call_variant" let call_name = format!("new_call_variant_{}", call_name); - let mut punct: Punctuated = Punctuated::new(); + let mut punct: Punctuated = Punctuated::new(); punct.push(PathSegment { arguments: PathArguments::None, ident: Ident::new(call_name.as_str(), Span::call_site()), @@ -847,11 +835,10 @@ fn expand_benchmark( let vis = benchmark_def.fn_vis; // remove #[benchmark] attribute - let fn_attrs: Vec<&Attribute> = benchmark_def + let fn_attrs = benchmark_def .fn_attrs .iter() - .filter(|attr| !syn::parse2::(attr.path.to_token_stream()).is_ok()) - .collect(); + .filter(|attr| !attr.path().is_ident(keywords::BENCHMARK_TOKEN)); // modify signature generics, ident, and inputs, e.g: // before: `fn bench(u: Linear<1, 100>) -> Result<(), BenchmarkError>` @@ -874,10 +861,11 @@ fn expand_benchmark( Some(stmt) => quote!(#stmt), None => quote!(Ok(())), }; + let fn_attrs_clone = fn_attrs.clone(); let fn_def = quote! { #( - #fn_attrs + #fn_attrs_clone )* #vis #sig { #( diff --git a/frame/support/procedural/src/construct_runtime/mod.rs b/frame/support/procedural/src/construct_runtime/mod.rs index c5a48a98063a4..1af44fc00a0ec 100644 --- a/frame/support/procedural/src/construct_runtime/mod.rs +++ b/frame/support/procedural/src/construct_runtime/mod.rs @@ -224,7 +224,7 @@ fn construct_runtime_final_expansion( let system_pallet = pallets.iter().find(|decl| decl.name == SYSTEM_PALLET_NAME).ok_or_else(|| { syn::Error::new( - pallets_token.span, + pallets_token.span.join(), "`System` pallet declaration is missing. \ Please add this line: `System: frame_system::{Pallet, Call, Storage, Config, Event},`", ) diff --git a/frame/support/procedural/src/construct_runtime/parse.rs b/frame/support/procedural/src/construct_runtime/parse.rs index 5e6979f1d2b3b..f819a90d1b5cd 100644 --- a/frame/support/procedural/src/construct_runtime/parse.rs +++ b/frame/support/procedural/src/construct_runtime/parse.rs @@ -17,6 +17,7 @@ use frame_support_procedural_tools::syn_ext as ext; use proc_macro2::{Span, TokenStream}; +use quote::ToTokens; use std::collections::{HashMap, HashSet}; use syn::{ ext::IdentExt, @@ -444,21 +445,21 @@ impl PalletPartKeyword { } } -impl Spanned for PalletPartKeyword { - fn span(&self) -> Span { +impl ToTokens for PalletPartKeyword { + fn to_tokens(&self, tokens: &mut TokenStream) { match self { - Self::Pallet(inner) => inner.span(), - Self::Call(inner) => inner.span(), - Self::Storage(inner) => inner.span(), - Self::Event(inner) => inner.span(), - Self::Config(inner) => inner.span(), - Self::Origin(inner) => inner.span(), - Self::Inherent(inner) => inner.span(), - Self::ValidateUnsigned(inner) => inner.span(), - Self::FreezeReason(inner) => inner.span(), - Self::HoldReason(inner) => inner.span(), - Self::LockId(inner) => inner.span(), - Self::SlashReason(inner) => inner.span(), + Self::Pallet(inner) => inner.to_tokens(tokens), + Self::Call(inner) => inner.to_tokens(tokens), + Self::Storage(inner) => inner.to_tokens(tokens), + Self::Event(inner) => inner.to_tokens(tokens), + Self::Config(inner) => inner.to_tokens(tokens), + Self::Origin(inner) => inner.to_tokens(tokens), + Self::Inherent(inner) => inner.to_tokens(tokens), + Self::ValidateUnsigned(inner) => inner.to_tokens(tokens), + Self::FreezeReason(inner) => inner.to_tokens(tokens), + Self::HoldReason(inner) => inner.to_tokens(tokens), + Self::LockId(inner) => inner.to_tokens(tokens), + Self::SlashReason(inner) => inner.to_tokens(tokens), } } } @@ -681,7 +682,7 @@ fn convert_pallets(pallets: Vec) -> syn::Result proc_macro::To let default_variants = enum_ .variants .into_iter() - .filter(|variant| variant.attrs.iter().any(|attr| attr.path.is_ident("default"))) + .filter(|variant| variant.attrs.iter().any(|attr| attr.path().is_ident("default"))) .collect::>(); match &*default_variants { @@ -80,7 +80,7 @@ pub fn derive_default_no_bound(input: proc_macro::TokenStream) -> proc_macro::To let variant_attrs = default_variant .attrs .iter() - .filter(|a| a.path.is_ident("default")) + .filter(|a| a.path().is_ident("default")) .collect::>(); // check that there is only one #[default] attribute on the variant diff --git a/frame/support/procedural/src/pallet/expand/call.rs b/frame/support/procedural/src/pallet/expand/call.rs index 74075848d9e9b..aa5af9d54882f 100644 --- a/frame/support/procedural/src/pallet/expand/call.rs +++ b/frame/support/procedural/src/pallet/expand/call.rs @@ -188,7 +188,7 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream { .map(|c| &mut def.item.content.as_mut().expect("Checked by def parser").1[c.index]) { item_impl.items.iter_mut().for_each(|i| { - if let syn::ImplItem::Method(method) = i { + if let syn::ImplItem::Fn(method) = i { let block = &method.block; method.block = syn::parse_quote! {{ // We execute all dispatchable in a new storage layer, allowing them @@ -206,13 +206,7 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream { method .attrs .iter() - .find(|attr| { - if let Ok(syn::Meta::List(syn::MetaList { path, .. })) = attr.parse_meta() { - path.segments.last().map(|seg| seg.ident == "allow").unwrap_or(false) - } else { - false - } - }) + .find(|attr| attr.path().is_ident("allow")) .map_or(proc_macro2::TokenStream::new(), |attr| attr.to_token_stream()) }) .collect::>(); diff --git a/frame/support/procedural/src/pallet/expand/constants.rs b/frame/support/procedural/src/pallet/expand/constants.rs index 21fa492a75b56..6e1cd3df627f3 100644 --- a/frame/support/procedural/src/pallet/expand/constants.rs +++ b/frame/support/procedural/src/pallet/expand/constants.rs @@ -23,7 +23,7 @@ struct ConstDef { /// The type in Get, e.g. `u32` in `type Foo: Get;`, but `Self` is replaced by `T` pub type_: syn::Type, /// The doc associated - pub doc: Vec, + pub doc: Vec, /// default_byte implementation pub default_byte_impl: proc_macro2::TokenStream, /// Constant name for Metadata (optional) diff --git a/frame/support/procedural/src/pallet/expand/documentation.rs b/frame/support/procedural/src/pallet/expand/documentation.rs index 1aa46cf572847..4e6347e83bb73 100644 --- a/frame/support/procedural/src/pallet/expand/documentation.rs +++ b/frame/support/procedural/src/pallet/expand/documentation.rs @@ -16,54 +16,24 @@ // limitations under the License. use crate::pallet::Def; -use derive_syn_parse::Parse; use proc_macro2::TokenStream; use quote::ToTokens; -use syn::{ - parse::{self, Parse, ParseStream}, - spanned::Spanned, - Attribute, Lit, -}; +use syn::{spanned::Spanned, Attribute, Lit, LitStr}; const DOC: &'static str = "doc"; const PALLET_DOC: &'static str = "pallet_doc"; -mod keywords { - syn::custom_keyword!(include_str); -} - /// Get the documentation file path from the `pallet_doc` attribute. /// /// Supported format: /// `#[pallet_doc(PATH)]`: The path of the file from which the documentation is loaded fn parse_pallet_doc_value(attr: &Attribute) -> syn::Result { - let span = attr.span(); - - let meta = attr.parse_meta()?; - let syn::Meta::List(metalist) = meta else { - let msg = "The `pallet_doc` attribute must receive arguments as a list. Supported format: `pallet_doc(PATH)`"; - return Err(syn::Error::new(span, msg)) - }; + let lit: syn::LitStr = attr.parse_args().map_err(|_| { + let msg = "The `pallet_doc` received an unsupported argument. Supported format: `pallet_doc(\"PATH\")`"; + syn::Error::new(attr.span(), msg) + })?; - let paths: Vec<_> = metalist - .nested - .into_iter() - .map(|nested| { - let syn::NestedMeta::Lit(lit) = nested else { - let msg = "The `pallet_doc` received an unsupported argument. Supported format: `pallet_doc(PATH)`"; - return Err(syn::Error::new(span, msg)) - }; - - Ok(lit) - }) - .collect::>()?; - - if paths.len() != 1 { - let msg = "The `pallet_doc` attribute must receive only one argument. Supported format: `pallet_doc(PATH)`"; - return Err(syn::Error::new(span, msg)) - } - - Ok(DocMetaValue::Path(paths[0].clone())) + Ok(DocMetaValue::Path(lit)) } /// Get the value from the `doc` comment attribute: @@ -71,47 +41,22 @@ fn parse_pallet_doc_value(attr: &Attribute) -> syn::Result { /// Supported formats: /// - `#[doc = "A doc string"]`: Documentation as a string literal /// - `#[doc = include_str!(PATH)]`: Documentation obtained from a path -fn parse_doc_value(attr: &Attribute) -> Option { - let Some(ident) = attr.path.get_ident() else { - return None - }; - if ident != DOC { - return None +fn parse_doc_value(attr: &Attribute) -> syn::Result> { + if !attr.path().is_ident(DOC) { + return Ok(None) } - let parser = |input: ParseStream| DocParser::parse(input); - let result = parse::Parser::parse2(parser, attr.tokens.clone()).ok()?; + let meta = attr.meta.require_name_value()?; - if let Some(lit) = result.lit { - Some(DocMetaValue::Lit(lit)) - } else if let Some(include_doc) = result.include_doc { - Some(DocMetaValue::Path(include_doc.lit)) - } else { - None + match &meta.value { + syn::Expr::Lit(lit) => Ok(Some(DocMetaValue::Lit(lit.lit.clone()))), + syn::Expr::Macro(mac) if mac.mac.path.is_ident("include_str") => + Ok(Some(DocMetaValue::Path(mac.mac.parse_body()?))), + _ => + Err(syn::Error::new(attr.span(), "Expected `= \"docs\"` or `= include_str!(\"PATH\")`")), } } -/// Parse the include_str attribute. -#[derive(Debug, Parse)] -struct IncludeDocParser { - _include_str: keywords::include_str, - _eq_token: syn::token::Bang, - #[paren] - _paren: syn::token::Paren, - #[inside(_paren)] - lit: Lit, -} - -/// Parse the doc literal. -#[derive(Debug, Parse)] -struct DocParser { - _eq_token: syn::token::Eq, - #[peek(Lit)] - lit: Option, - #[parse_if(lit.is_none())] - include_doc: Option, -} - /// Supported documentation tokens. #[derive(Debug)] enum DocMetaValue { @@ -124,7 +69,7 @@ enum DocMetaValue { /// The string literal represents the file `PATH`. /// /// `#[doc = include_str!(PATH)]` - Path(Lit), + Path(LitStr), } impl ToTokens for DocMetaValue { @@ -179,33 +124,39 @@ pub fn expand_documentation(def: &mut Def) -> proc_macro2::TokenStream { let mut index = 0; while index < def.item.attrs.len() { let attr = &def.item.attrs[index]; - if let Some(ident) = attr.path.get_ident() { - if ident == PALLET_DOC { - let elem = def.item.attrs.remove(index); - pallet_docs.push(elem); - // Do not increment the index, we have just removed the - // element from the attributes. - continue - } + if attr.path().get_ident().map_or(false, |i| *i == PALLET_DOC) { + pallet_docs.push(def.item.attrs.remove(index)); + // Do not increment the index, we have just removed the + // element from the attributes. + continue } index += 1; } // Capture the `#[doc = include_str!("../README.md")]` and `#[doc = "Documentation"]`. - let mut docs: Vec<_> = def.item.attrs.iter().filter_map(parse_doc_value).collect(); + let docs = match def + .item + .attrs + .iter() + .filter_map(|v| parse_doc_value(v).transpose()) + .collect::>>() + { + Ok(r) => r, + Err(err) => return err.into_compile_error(), + }; // Capture the `#[pallet_doc("../README.md")]`. - let pallet_docs: Vec<_> = match pallet_docs + let pallet_docs = match pallet_docs .into_iter() .map(|attr| parse_pallet_doc_value(&attr)) - .collect::>() + .collect::>>() { Ok(docs) => docs, Err(err) => return err.into_compile_error(), }; - docs.extend(pallet_docs); + let docs = docs.iter().chain(pallet_docs.iter()); quote::quote!( impl<#type_impl_gen> #pallet_ident<#type_use_gen> #where_clauses{ diff --git a/frame/support/procedural/src/pallet/expand/storage.rs b/frame/support/procedural/src/pallet/expand/storage.rs index efc803033d3bf..c742ddcd25fbc 100644 --- a/frame/support/procedural/src/pallet/expand/storage.rs +++ b/frame/support/procedural/src/pallet/expand/storage.rs @@ -384,10 +384,11 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { QueryKind::OptionQuery => quote::quote_spanned!(storage.attr_span => Option<#value> ), - QueryKind::ResultQuery(error_path, _) => + QueryKind::ResultQuery(error_path, _) => { quote::quote_spanned!(storage.attr_span => Result<#value, #error_path> - ), + ) + }, QueryKind::ValueQuery => quote::quote!(#value), }; quote::quote_spanned!(storage.attr_span => @@ -407,10 +408,11 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { QueryKind::OptionQuery => quote::quote_spanned!(storage.attr_span => Option<#value> ), - QueryKind::ResultQuery(error_path, _) => + QueryKind::ResultQuery(error_path, _) => { quote::quote_spanned!(storage.attr_span => Result<#value, #error_path> - ), + ) + }, QueryKind::ValueQuery => quote::quote!(#value), }; quote::quote_spanned!(storage.attr_span => @@ -432,10 +434,11 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { QueryKind::OptionQuery => quote::quote_spanned!(storage.attr_span => Option<#value> ), - QueryKind::ResultQuery(error_path, _) => + QueryKind::ResultQuery(error_path, _) => { quote::quote_spanned!(storage.attr_span => Result<#value, #error_path> - ), + ) + }, QueryKind::ValueQuery => quote::quote!(#value), }; quote::quote_spanned!(storage.attr_span => @@ -457,10 +460,11 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { QueryKind::OptionQuery => quote::quote_spanned!(storage.attr_span => Option<#value> ), - QueryKind::ResultQuery(error_path, _) => + QueryKind::ResultQuery(error_path, _) => { quote::quote_spanned!(storage.attr_span => Result<#value, #error_path> - ), + ) + }, QueryKind::ValueQuery => quote::quote!(#value), }; quote::quote_spanned!(storage.attr_span => @@ -484,10 +488,11 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { QueryKind::OptionQuery => quote::quote_spanned!(storage.attr_span => Option<#value> ), - QueryKind::ResultQuery(error_path, _) => + QueryKind::ResultQuery(error_path, _) => { quote::quote_spanned!(storage.attr_span => Result<#value, #error_path> - ), + ) + }, QueryKind::ValueQuery => quote::quote!(#value), }; quote::quote_spanned!(storage.attr_span => diff --git a/frame/support/procedural/src/pallet/parse/call.rs b/frame/support/procedural/src/pallet/parse/call.rs index 5b90c2d98b85e..ae1c039c9ddde 100644 --- a/frame/support/procedural/src/pallet/parse/call.rs +++ b/frame/support/procedural/src/pallet/parse/call.rs @@ -45,7 +45,7 @@ pub struct CallDef { /// The span of the pallet::call attribute. pub attr_span: proc_macro2::Span, /// Docs, specified on the impl Block. - pub docs: Vec, + pub docs: Vec, } /// Definition of dispatchable typically: `#[weight...] fn foo(origin .., param1: ...) -> ..` @@ -62,7 +62,7 @@ pub struct CallVariantDef { /// Whether an explicit call index was specified. pub explicit_call_index: bool, /// Docs, used for metadata. - pub docs: Vec, + pub docs: Vec, /// Attributes annotated at the top of the dispatchable function. pub attrs: Vec, } @@ -173,7 +173,7 @@ impl CallDef { let mut indices = HashMap::new(); let mut last_index: Option = None; for item in &mut item_impl.items { - if let syn::ImplItem::Method(method) = item { + if let syn::ImplItem::Fn(method) = item { if !matches!(method.vis, syn::Visibility::Public(_)) { let msg = "Invalid pallet::call, dispatchable function must be public: \ `pub fn`"; diff --git a/frame/support/procedural/src/pallet/parse/composite.rs b/frame/support/procedural/src/pallet/parse/composite.rs index 2406f10d50a33..2bbfcd2e998ab 100644 --- a/frame/support/procedural/src/pallet/parse/composite.rs +++ b/frame/support/procedural/src/pallet/parse/composite.rs @@ -32,14 +32,14 @@ pub mod keyword { SlashReason(SlashReason), } - impl Spanned for CompositeKeyword { - fn span(&self) -> proc_macro2::Span { + impl ToTokens for CompositeKeyword { + fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { use CompositeKeyword::*; match self { - FreezeReason(inner) => inner.span(), - HoldReason(inner) => inner.span(), - LockId(inner) => inner.span(), - SlashReason(inner) => inner.span(), + FreezeReason(inner) => inner.to_tokens(tokens), + HoldReason(inner) => inner.to_tokens(tokens), + LockId(inner) => inner.to_tokens(tokens), + SlashReason(inner) => inner.to_tokens(tokens), } } } @@ -109,14 +109,11 @@ impl CompositeDef { } let has_derive_attr = item.attrs.iter().any(|attr| { - attr.parse_meta() - .ok() - .map(|meta| match meta { - syn::Meta::List(syn::MetaList { path, .. }) => - path.get_ident().map(|ident| ident == "derive").unwrap_or(false), - _ => false, - }) - .unwrap_or(false) + if let syn::Meta::List(syn::MetaList { path, .. }) = &attr.meta { + path.get_ident().map(|ident| ident == "derive").unwrap_or(false) + } else { + false + } }); if !has_derive_attr { diff --git a/frame/support/procedural/src/pallet/parse/config.rs b/frame/support/procedural/src/pallet/parse/config.rs index 4d22e50ef2bbf..7b52c1664ba45 100644 --- a/frame/support/procedural/src/pallet/parse/config.rs +++ b/frame/support/procedural/src/pallet/parse/config.rs @@ -61,7 +61,7 @@ pub struct ConstMetadataDef { /// The type in Get, e.g. `u32` in `type Foo: Get;`, but `Self` is replaced by `T` pub type_: syn::Type, /// The doc associated - pub doc: Vec, + pub doc: Vec, } impl TryFrom<&syn::TraitItemType> for ConstMetadataDef { @@ -124,23 +124,35 @@ impl syn::parse::Parse for DisableFrameSystemSupertraitCheck { } /// Parse for `#[pallet::constant]` -pub struct TypeAttrConst(proc_macro2::Span); - -impl Spanned for TypeAttrConst { - fn span(&self) -> proc_macro2::Span { - self.0 - } +pub struct TypeAttrConst { + pound_token: syn::Token![#], + bracket_token: syn::token::Bracket, + pallet_ident: syn::Ident, + path_sep_token: syn::token::PathSep, + constant_keyword: keyword::constant, } impl syn::parse::Parse for TypeAttrConst { fn parse(input: syn::parse::ParseStream) -> syn::Result { - input.parse::()?; + let pound_token = input.parse::()?; let content; - syn::bracketed!(content in input); - content.parse::()?; - content.parse::()?; + let bracket_token = syn::bracketed!(content in input); + let pallet_ident = content.parse::()?; + let path_sep_token = content.parse::()?; + let constant_keyword = content.parse::()?; - Ok(TypeAttrConst(content.parse::()?.span())) + Ok(Self { pound_token, bracket_token, pallet_ident, path_sep_token, constant_keyword }) + } +} + +impl ToTokens for TypeAttrConst { + fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { + self.pound_token.to_tokens(tokens); + self.bracket_token.surround(tokens, |tokens| { + self.pallet_ident.to_tokens(tokens); + self.path_sep_token.to_tokens(tokens); + self.constant_keyword.to_tokens(tokens); + }) } } diff --git a/frame/support/procedural/src/pallet/parse/error.rs b/frame/support/procedural/src/pallet/parse/error.rs index f344c5d27a877..6f82ce61fc93f 100644 --- a/frame/support/procedural/src/pallet/parse/error.rs +++ b/frame/support/procedural/src/pallet/parse/error.rs @@ -37,7 +37,7 @@ pub struct ErrorDef { /// The index of error item in pallet module. pub index: usize, /// Variants ident, optional field and doc literals (ordered as declaration order) - pub variants: Vec<(syn::Ident, Option, Vec)>, + pub variants: Vec<(syn::Ident, Option, Vec)>, /// A set of usage of instance, must be check for consistency with trait. pub instances: Vec, /// The keyword error used (contains span). diff --git a/frame/support/procedural/src/pallet/parse/extra_constants.rs b/frame/support/procedural/src/pallet/parse/extra_constants.rs index 8e85d2c2622d5..2ba6c44b7d158 100644 --- a/frame/support/procedural/src/pallet/parse/extra_constants.rs +++ b/frame/support/procedural/src/pallet/parse/extra_constants.rs @@ -50,7 +50,7 @@ pub struct ExtraConstantDef { /// The type returned by the function pub type_: syn::Type, /// The doc associated - pub doc: Vec, + pub doc: Vec, /// Optional MetaData Name pub metadata_name: Option, } @@ -100,7 +100,7 @@ impl ExtraConstantsDef { let mut extra_constants = vec![]; for impl_item in &mut item.items { - let method = if let syn::ImplItem::Method(method) = impl_item { + let method = if let syn::ImplItem::Fn(method) = impl_item { method } else { let msg = "Invalid pallet::call, only method accepted"; diff --git a/frame/support/procedural/src/pallet/parse/helper.rs b/frame/support/procedural/src/pallet/parse/helper.rs index 4814dce5a3dfa..3cdbfb1f591d9 100644 --- a/frame/support/procedural/src/pallet/parse/helper.rs +++ b/frame/support/procedural/src/pallet/parse/helper.rs @@ -54,7 +54,7 @@ where let attrs = if let Some(attrs) = item.mut_item_attrs() { attrs } else { return Ok(None) }; if let Some(index) = attrs.iter().position(|attr| { - attr.path.segments.first().map_or(false, |segment| segment.ident == "pallet") + attr.path().segments.first().map_or(false, |segment| segment.ident == "pallet") }) { let pallet_attr = attrs.remove(index); Ok(Some(syn::parse2(pallet_attr.into_token_stream())?)) @@ -82,7 +82,7 @@ pub fn get_item_cfg_attrs(attrs: &[syn::Attribute]) -> Vec { attrs .iter() .filter_map(|attr| { - if attr.path.segments.first().map_or(false, |segment| segment.ident == "cfg") { + if attr.path().segments.first().map_or(false, |segment| segment.ident == "cfg") { Some(attr.clone()) } else { None @@ -101,7 +101,6 @@ impl MutItemAttrs for syn::Item { Self::ForeignMod(item) => Some(item.attrs.as_mut()), Self::Impl(item) => Some(item.attrs.as_mut()), Self::Macro(item) => Some(item.attrs.as_mut()), - Self::Macro2(item) => Some(item.attrs.as_mut()), Self::Mod(item) => Some(item.attrs.as_mut()), Self::Static(item) => Some(item.attrs.as_mut()), Self::Struct(item) => Some(item.attrs.as_mut()), @@ -119,7 +118,7 @@ impl MutItemAttrs for syn::TraitItem { fn mut_item_attrs(&mut self) -> Option<&mut Vec> { match self { Self::Const(item) => Some(item.attrs.as_mut()), - Self::Method(item) => Some(item.attrs.as_mut()), + Self::Fn(item) => Some(item.attrs.as_mut()), Self::Type(item) => Some(item.attrs.as_mut()), Self::Macro(item) => Some(item.attrs.as_mut()), _ => None, @@ -139,7 +138,7 @@ impl MutItemAttrs for syn::ItemMod { } } -impl MutItemAttrs for syn::ImplItemMethod { +impl MutItemAttrs for syn::ImplItemFn { fn mut_item_attrs(&mut self) -> Option<&mut Vec> { Some(&mut self.attrs) } diff --git a/frame/support/procedural/src/pallet/parse/hooks.rs b/frame/support/procedural/src/pallet/parse/hooks.rs index f941df5f29272..37d7d22f4b6bb 100644 --- a/frame/support/procedural/src/pallet/parse/hooks.rs +++ b/frame/support/procedural/src/pallet/parse/hooks.rs @@ -71,7 +71,7 @@ impl HooksDef { } let has_runtime_upgrade = item.items.iter().any(|i| match i { - syn::ImplItem::Method(method) => method.sig.ident == "on_runtime_upgrade", + syn::ImplItem::Fn(method) => method.sig.ident == "on_runtime_upgrade", _ => false, }); diff --git a/frame/support/procedural/src/pallet/parse/storage.rs b/frame/support/procedural/src/pallet/parse/storage.rs index 4e90a423f79ef..16c0851ce7a04 100644 --- a/frame/support/procedural/src/pallet/parse/storage.rs +++ b/frame/support/procedural/src/pallet/parse/storage.rs @@ -159,7 +159,7 @@ pub struct StorageDef { /// The keys and value metadata of the storage. pub metadata: Metadata, /// The doc associated to the storage. - pub docs: Vec, + pub docs: Vec, /// A set of usage of instance, must be check for consistency with config. pub instances: Vec, /// Optional getter to generate. If some then query_kind is ensured to be some as well. @@ -270,7 +270,7 @@ enum StorageKind { /// Check the generics in the `map` contains the generics in `gen` may contains generics in /// `optional_gen`, and doesn't contains any other. fn check_generics( - map: &HashMap, + map: &HashMap, mandatory_generics: &[&str], optional_generics: &[&str], storage_type_name: &str, @@ -331,9 +331,9 @@ fn check_generics( fn process_named_generics( storage: &StorageKind, args_span: proc_macro2::Span, - args: &[syn::Binding], + args: &[syn::AssocType], ) -> syn::Result<(Option, Metadata, Option, bool)> { - let mut parsed = HashMap::::new(); + let mut parsed = HashMap::::new(); // Ensure no duplicate. for arg in args { @@ -610,12 +610,12 @@ fn process_generics( }) .collect::>(); process_unnamed_generics(&storage_kind, args_span, &args, dev_mode) - } else if args.args.iter().all(|gen| matches!(gen, syn::GenericArgument::Binding(_))) { + } else if args.args.iter().all(|gen| matches!(gen, syn::GenericArgument::AssocType(_))) { let args = args .args .iter() .map(|gen| match gen { - syn::GenericArgument::Binding(gen) => gen.clone(), + syn::GenericArgument::AssocType(gen) => gen.clone(), _ => unreachable!("It is asserted above that all generics are bindings"), }) .collect::>(); diff --git a/frame/support/procedural/src/pallet/parse/type_value.rs b/frame/support/procedural/src/pallet/parse/type_value.rs index 4b80506889dfd..4d9db30b3a788 100644 --- a/frame/support/procedural/src/pallet/parse/type_value.rs +++ b/frame/support/procedural/src/pallet/parse/type_value.rs @@ -39,7 +39,7 @@ pub struct TypeValueDef { /// The span of the pallet::type_value attribute. pub attr_span: proc_macro2::Span, /// Docs on the item. - pub docs: Vec, + pub docs: Vec, } impl TypeValueDef { @@ -57,9 +57,9 @@ impl TypeValueDef { let mut docs = vec![]; for attr in &item.attrs { - if let Ok(syn::Meta::NameValue(meta)) = attr.parse_meta() { + if let syn::Meta::NameValue(meta) = &attr.meta { if meta.path.get_ident().map_or(false, |ident| ident == "doc") { - docs.push(meta.lit); + docs.push(meta.value.clone()); continue } } diff --git a/frame/support/procedural/src/pallet_error.rs b/frame/support/procedural/src/pallet_error.rs index fb0bf52f69094..246a5bd4a219a 100644 --- a/frame/support/procedural/src/pallet_error.rs +++ b/frame/support/procedural/src/pallet_error.rs @@ -17,7 +17,6 @@ use frame_support_procedural_tools::generate_crate_access_2018; use quote::ToTokens; -use std::str::FromStr; // Derive `PalletError` pub fn derive_pallet_error(input: proc_macro::TokenStream) -> proc_macro::TokenStream { @@ -117,38 +116,24 @@ fn generate_field_types( let attrs = &field.attrs; for attr in attrs { - if attr.path.is_ident("codec") { - match attr.parse_meta()? { - syn::Meta::List(ref meta_list) if meta_list.nested.len() == 1 => { - match meta_list - .nested - .first() - .expect("Just checked that there is one item; qed") - { - syn::NestedMeta::Meta(syn::Meta::Path(path)) - if path.get_ident().map_or(false, |i| i == "skip") => - return Ok(None), - - syn::NestedMeta::Meta(syn::Meta::Path(path)) - if path.get_ident().map_or(false, |i| i == "compact") => - { - let field_ty = &field.ty; - return Ok(Some(quote::quote!(#scrate::codec::Compact<#field_ty>))) - }, - - syn::NestedMeta::Meta(syn::Meta::NameValue(syn::MetaNameValue { - path, - lit: syn::Lit::Str(lit_str), - .. - })) if path.get_ident().map_or(false, |i| i == "encoded_as") => { - let ty = proc_macro2::TokenStream::from_str(&lit_str.value())?; - return Ok(Some(ty)) - }, - - _ => (), - } - }, - _ => (), + if attr.path().is_ident("codec") { + let mut res = None; + + attr.parse_nested_meta(|meta| { + if meta.path.is_ident("skip") { + res = Some(None); + } else if meta.path.is_ident("compact") { + let field_ty = &field.ty; + res = Some(Some(quote::quote!(#scrate::codec::Compact<#field_ty>))); + } else if meta.path.is_ident("compact") { + res = Some(Some(meta.value()?.parse()?)); + } + + Ok(()) + })?; + + if let Some(v) = res { + return Ok(v) } } } @@ -163,22 +148,18 @@ fn generate_variant_field_types( let attrs = &variant.attrs; for attr in attrs { - if attr.path.is_ident("codec") { - match attr.parse_meta()? { - syn::Meta::List(ref meta_list) if meta_list.nested.len() == 1 => { - match meta_list - .nested - .first() - .expect("Just checked that there is one item; qed") - { - syn::NestedMeta::Meta(syn::Meta::Path(path)) - if path.get_ident().map_or(false, |i| i == "skip") => - return Ok(None), - - _ => (), - } - }, - _ => (), + if attr.path().is_ident("codec") { + let mut skip = false; + + // We ignore the error intentionally as this isn't `codec(skip)` when + // `parse_nested_meta` fails. + let _ = attr.parse_nested_meta(|meta| { + skip = meta.path.is_ident("skip"); + Ok(()) + }); + + if skip { + return Ok(None) } } } diff --git a/frame/support/procedural/src/storage/genesis_config/genesis_config_def.rs b/frame/support/procedural/src/storage/genesis_config/genesis_config_def.rs index 491db59184fd9..31e9996ee51f4 100644 --- a/frame/support/procedural/src/storage/genesis_config/genesis_config_def.rs +++ b/frame/support/procedural/src/storage/genesis_config/genesis_config_def.rs @@ -133,14 +133,13 @@ impl GenesisConfigDef { .attrs .iter() .map(|attr| { - let meta = attr.parse_meta()?; - if meta.path().is_ident("cfg") { + if attr.meta.path().is_ident("cfg") { return Err(syn::Error::new( - meta.span(), + attr.meta.span(), "extra genesis config items do not support `cfg` attribute", )) } - Ok(meta) + Ok(attr.meta.clone()) }) .collect::>()?; diff --git a/frame/support/procedural/src/storage/mod.rs b/frame/support/procedural/src/storage/mod.rs index 3d3b1443d393f..c04862256a7bc 100644 --- a/frame/support/procedural/src/storage/mod.rs +++ b/frame/support/procedural/src/storage/mod.rs @@ -332,8 +332,8 @@ impl StorageLineDefExt { let doc_attrs = storage_def .attrs .iter() - .filter_map(|a| a.parse_meta().ok()) - .filter(|m| m.path().is_ident("doc")) + .filter(|a| a.meta.path().is_ident("doc")) + .map(|a| a.meta.clone()) .collect(); Self { diff --git a/frame/support/procedural/src/storage/print_pallet_upgrade.rs b/frame/support/procedural/src/storage/print_pallet_upgrade.rs index 03f09a7edb48e..4e330fd4b85f2 100644 --- a/frame/support/procedural/src/storage/print_pallet_upgrade.rs +++ b/frame/support/procedural/src/storage/print_pallet_upgrade.rs @@ -273,14 +273,12 @@ pub fn maybe_print_pallet_upgrade(def: &super::DeclStorageDefExt) { doc = line.doc_attrs.iter().fold(String::new(), |mut res, attr| { if let syn::Meta::NameValue(name_value) = attr { if name_value.path.is_ident("doc") { - if let syn::Lit::Str(string) = &name_value.lit { - res = format!( - "{} - ///{}", - res, - string.value(), - ); - } + res = format!( + "{} + ///{}", + res, + name_value.value.to_token_stream(), + ); } } res diff --git a/frame/support/procedural/tools/Cargo.toml b/frame/support/procedural/tools/Cargo.toml index 755483f7db9aa..bf828b01b6f76 100644 --- a/frame/support/procedural/tools/Cargo.toml +++ b/frame/support/procedural/tools/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] proc-macro-crate = "1.1.3" -proc-macro2 = "1.0.37" -quote = "1.0.10" -syn = { version = "1.0.98", features = ["full", "visit", "extra-traits"] } +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full", "visit", "extra-traits"] } frame-support-procedural-tools-derive = { version = "3.0.0", path = "./derive" } diff --git a/frame/support/procedural/tools/derive/Cargo.toml b/frame/support/procedural/tools/derive/Cargo.toml index a688ee13a7d17..81b5a8487449b 100644 --- a/frame/support/procedural/tools/derive/Cargo.toml +++ b/frame/support/procedural/tools/derive/Cargo.toml @@ -15,6 +15,6 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -proc-macro2 = "1.0.37" -quote = { version = "1.0.10", features = ["proc-macro"] } -syn = { version = "1.0.98", features = ["proc-macro", "full", "extra-traits", "parsing"] } +proc-macro2 = "1.0.56" +quote = { version = "1.0.26", features = ["proc-macro"] } +syn = { version = "2.0.14", features = ["proc-macro", "full", "extra-traits", "parsing"] } diff --git a/frame/support/procedural/tools/src/lib.rs b/frame/support/procedural/tools/src/lib.rs index 385b20ad05dc8..541accc8ab96a 100644 --- a/frame/support/procedural/tools/src/lib.rs +++ b/frame/support/procedural/tools/src/lib.rs @@ -102,16 +102,15 @@ pub fn clean_type_string(input: &str) -> String { } /// Return all doc attributes literals found. -pub fn get_doc_literals(attrs: &[syn::Attribute]) -> Vec { +pub fn get_doc_literals(attrs: &[syn::Attribute]) -> Vec { attrs .iter() .filter_map(|attr| { - if let Ok(syn::Meta::NameValue(meta)) = attr.parse_meta() { - if meta.path.get_ident().map_or(false, |ident| ident == "doc") { - Some(meta.lit) - } else { - None - } + if let syn::Meta::NameValue(meta) = &attr.meta { + meta.path + .get_ident() + .filter(|ident| *ident == "doc") + .map(|_| meta.value.clone()) } else { None } diff --git a/frame/support/test/tests/pallet_ui/pallet_doc_arg_non_path.stderr b/frame/support/test/tests/pallet_ui/pallet_doc_arg_non_path.stderr index ba60479c07202..9a1249dd36f37 100644 --- a/frame/support/test/tests/pallet_ui/pallet_doc_arg_non_path.stderr +++ b/frame/support/test/tests/pallet_ui/pallet_doc_arg_non_path.stderr @@ -1,4 +1,4 @@ -error: The `pallet_doc` received an unsupported argument. Supported format: `pallet_doc(PATH)` +error: The `pallet_doc` received an unsupported argument. Supported format: `pallet_doc("PATH")` --> tests/pallet_ui/pallet_doc_arg_non_path.rs:3:1 | 3 | #[pallet_doc(X)] diff --git a/frame/support/test/tests/pallet_ui/pallet_doc_empty.stderr b/frame/support/test/tests/pallet_ui/pallet_doc_empty.stderr index d6a189d7918f5..a220cbe9e9990 100644 --- a/frame/support/test/tests/pallet_ui/pallet_doc_empty.stderr +++ b/frame/support/test/tests/pallet_ui/pallet_doc_empty.stderr @@ -1,4 +1,4 @@ -error: The `pallet_doc` attribute must receive arguments as a list. Supported format: `pallet_doc(PATH)` +error: The `pallet_doc` received an unsupported argument. Supported format: `pallet_doc("PATH")` --> tests/pallet_ui/pallet_doc_empty.rs:3:1 | 3 | #[pallet_doc] diff --git a/frame/support/test/tests/pallet_ui/pallet_doc_invalid_arg.stderr b/frame/support/test/tests/pallet_ui/pallet_doc_invalid_arg.stderr index 9dd03978934a4..bee7c708507d2 100644 --- a/frame/support/test/tests/pallet_ui/pallet_doc_invalid_arg.stderr +++ b/frame/support/test/tests/pallet_ui/pallet_doc_invalid_arg.stderr @@ -1,4 +1,4 @@ -error: The `pallet_doc` attribute must receive arguments as a list. Supported format: `pallet_doc(PATH)` +error: The `pallet_doc` received an unsupported argument. Supported format: `pallet_doc("PATH")` --> tests/pallet_ui/pallet_doc_invalid_arg.rs:3:1 | 3 | #[pallet_doc = "invalid"] diff --git a/frame/support/test/tests/pallet_ui/pallet_doc_multiple_args.stderr b/frame/support/test/tests/pallet_ui/pallet_doc_multiple_args.stderr index 58ad75a0a2aec..e769555438e13 100644 --- a/frame/support/test/tests/pallet_ui/pallet_doc_multiple_args.stderr +++ b/frame/support/test/tests/pallet_ui/pallet_doc_multiple_args.stderr @@ -1,4 +1,4 @@ -error: The `pallet_doc` attribute must receive only one argument. Supported format: `pallet_doc(PATH)` +error: The `pallet_doc` received an unsupported argument. Supported format: `pallet_doc("PATH")` --> tests/pallet_ui/pallet_doc_multiple_args.rs:3:1 | 3 | #[pallet_doc("A", "B")] diff --git a/frame/support/test/tests/pallet_ui/storage_result_query_parenthesized_generics.stderr b/frame/support/test/tests/pallet_ui/storage_result_query_parenthesized_generics.stderr index caffd846f272a..89ddd1599ac97 100644 --- a/frame/support/test/tests/pallet_ui/storage_result_query_parenthesized_generics.stderr +++ b/frame/support/test/tests/pallet_ui/storage_result_query_parenthesized_generics.stderr @@ -1,5 +1,5 @@ -error: Invalid pallet::storage, unexpected generic args for ResultQuery, expected angle-bracketed arguments, found `(NonExistentValue)` +error: expected `,` --> tests/pallet_ui/storage_result_query_parenthesized_generics.rs:18:55 | 18 | type Foo = StorageValue<_, u8, ResultQuery(NonExistentValue)>; - | ^^^^^^^^^^^^^^^^^^ + | ^ diff --git a/primitives/api/proc-macro/Cargo.toml b/primitives/api/proc-macro/Cargo.toml index 1ba62cc53d5aa..594c20e82c94e 100644 --- a/primitives/api/proc-macro/Cargo.toml +++ b/primitives/api/proc-macro/Cargo.toml @@ -16,9 +16,9 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -quote = "1.0.10" -syn = { version = "1.0.98", features = ["full", "fold", "extra-traits", "visit"] } -proc-macro2 = "1.0.37" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full", "fold", "extra-traits", "visit"] } +proc-macro2 = "1.0.56" blake2 = { version = "0.10.4", default-features = false } proc-macro-crate = "1.1.3" expander = "1.0.0" diff --git a/primitives/api/proc-macro/src/decl_runtime_apis.rs b/primitives/api/proc-macro/src/decl_runtime_apis.rs index 43e1e7969c5d1..cde33c19016bd 100644 --- a/primitives/api/proc-macro/src/decl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/decl_runtime_apis.rs @@ -38,9 +38,10 @@ use syn::{ parse::{Error, Parse, ParseStream, Result}, parse_macro_input, parse_quote, spanned::Spanned, + token::Comma, visit::{self, Visit}, - Attribute, FnArg, GenericParam, Generics, Ident, ItemTrait, Lit, Meta, NestedMeta, TraitBound, - TraitItem, TraitItemMethod, + Attribute, FnArg, GenericParam, Generics, Ident, ItemTrait, LitInt, LitStr, TraitBound, + TraitItem, TraitItemFn, }; use std::collections::{BTreeMap, HashMap}; @@ -76,7 +77,7 @@ fn extend_generics_with_block(generics: &mut Generics) { /// attribute body as `TokenStream`. fn remove_supported_attributes(attrs: &mut Vec) -> HashMap<&'static str, Attribute> { let mut result = HashMap::new(); - attrs.retain(|v| match SUPPORTED_ATTRIBUTE_NAMES.iter().find(|a| v.path.is_ident(a)) { + attrs.retain(|v| match SUPPORTED_ATTRIBUTE_NAMES.iter().find(|a| v.path().is_ident(a)) { Some(attribute) => { result.insert(*attribute, v.clone()); false @@ -159,7 +160,7 @@ impl Fold for ReplaceBlockWithNodeBlock { /// ``` fn generate_versioned_api_traits( api: ItemTrait, - methods: BTreeMap>, + methods: BTreeMap>, ) -> Vec { let mut result = Vec::::new(); for (version, _) in &methods { @@ -169,7 +170,7 @@ fn generate_versioned_api_traits( // Add the methods from the current version and all previous one. Versions are sorted so // it's safe to stop early. for (_, m) in methods.iter().take_while(|(v, _)| v <= &version) { - versioned_trait.items.extend(m.iter().cloned().map(|m| TraitItem::Method(m))); + versioned_trait.items.extend(m.iter().cloned().map(|m| TraitItem::Fn(m))); } result.push(versioned_trait); @@ -180,37 +181,29 @@ fn generate_versioned_api_traits( /// Try to parse the given `Attribute` as `renamed` attribute. fn parse_renamed_attribute(renamed: &Attribute) -> Result<(String, u32)> { - let meta = renamed.parse_meta()?; - - let err = Err(Error::new( - meta.span(), + let err = || { + Error::new( + renamed.span(), &format!( - "Unexpected `{renamed}` attribute. The supported format is `{renamed}(\"old_name\", version_it_was_renamed)`", - renamed = RENAMED_ATTRIBUTE, - ) + "Unexpected `{RENAMED_ATTRIBUTE}` attribute. \ + The supported format is `{RENAMED_ATTRIBUTE}(\"old_name\", version_it_was_renamed)`", + ), ) - ); - - match meta { - Meta::List(list) => - if list.nested.len() > 2 && list.nested.is_empty() { - err - } else { - let mut itr = list.nested.iter(); - let old_name = match itr.next() { - Some(NestedMeta::Lit(Lit::Str(i))) => i.value(), - _ => return err, - }; - - let version = match itr.next() { - Some(NestedMeta::Lit(Lit::Int(i))) => i.base10_parse()?, - _ => return err, - }; - - Ok((old_name, version)) - }, - _ => err, - } + }; + + renamed + .parse_args_with(|input: ParseStream| { + let old_name: LitStr = input.parse()?; + let _comma: Comma = input.parse()?; + let version: LitInt = input.parse()?; + + if !input.is_empty() { + return Err(input.error("No more arguments expected")) + } + + Ok((old_name.value(), version.base10_parse()?)) + }) + .map_err(|_| err()) } /// Generate the declaration of the trait for the runtime. @@ -230,12 +223,12 @@ fn generate_runtime_decls(decls: &[ItemTrait]) -> Result { let trait_api_version = get_api_version(&found_attributes)?; - let mut methods_by_version: BTreeMap> = BTreeMap::new(); + let mut methods_by_version: BTreeMap> = BTreeMap::new(); // Process the items in the declaration. The filter_map function below does a lot of stuff // because the method attributes are stripped at this point decl.items.iter_mut().for_each(|i| match i { - TraitItem::Method(ref mut method) => { + TraitItem::Fn(ref mut method) => { let method_attrs = remove_supported_attributes(&mut method.attrs); let mut method_version = trait_api_version; // validate the api version for the method (if any) and generate default @@ -364,9 +357,8 @@ impl<'a> ToClientSideDecl<'a> { let mut result = Vec::new(); items.into_iter().for_each(|i| match i { - TraitItem::Method(method) => { - let (fn_decl, fn_decl_ctx) = - self.fold_trait_item_method(method, trait_generics_num); + TraitItem::Fn(method) => { + let (fn_decl, fn_decl_ctx) = self.fold_trait_item_fn(method, trait_generics_num); result.push(fn_decl.into()); result.push(fn_decl_ctx.into()); }, @@ -376,11 +368,11 @@ impl<'a> ToClientSideDecl<'a> { result } - fn fold_trait_item_method( + fn fold_trait_item_fn( &mut self, - method: TraitItemMethod, + method: TraitItemFn, trait_generics_num: usize, - ) -> (TraitItemMethod, TraitItemMethod) { + ) -> (TraitItemFn, TraitItemFn) { let crate_ = self.crate_; let context = quote!( #crate_::ExecutionContext::OffchainCall(None) ); let fn_decl = self.create_method_decl(method.clone(), context, trait_generics_num); @@ -391,9 +383,9 @@ impl<'a> ToClientSideDecl<'a> { fn create_method_decl_with_context( &mut self, - method: TraitItemMethod, + method: TraitItemFn, trait_generics_num: usize, - ) -> TraitItemMethod { + ) -> TraitItemFn { let crate_ = self.crate_; let context_arg: syn::FnArg = parse_quote!( context: #crate_::ExecutionContext ); let mut fn_decl_ctx = self.create_method_decl(method, quote!(context), trait_generics_num); @@ -409,10 +401,10 @@ impl<'a> ToClientSideDecl<'a> { /// the actual call into the runtime. fn create_method_decl( &mut self, - mut method: TraitItemMethod, + mut method: TraitItemFn, context: TokenStream, trait_generics_num: usize, - ) -> TraitItemMethod { + ) -> TraitItemFn { let params = match extract_parameter_names_types_and_borrows( &method.sig, AllowSelfRefInParameters::No, @@ -661,7 +653,7 @@ impl CheckTraitDecl { /// All errors will be collected in `self.errors`. fn check(&mut self, trait_: &ItemTrait) { self.check_method_declarations(trait_.items.iter().filter_map(|i| match i { - TraitItem::Method(method) => Some(method), + TraitItem::Fn(method) => Some(method), _ => None, })); @@ -671,10 +663,7 @@ impl CheckTraitDecl { /// Check that the given method declarations are correct. /// /// Any error is stored in `self.errors`. - fn check_method_declarations<'a>( - &mut self, - methods: impl Iterator, - ) { + fn check_method_declarations<'a>(&mut self, methods: impl Iterator) { let mut method_to_signature_changed = HashMap::>>::new(); methods.into_iter().for_each(|method| { diff --git a/primitives/api/proc-macro/src/impl_runtime_apis.rs b/primitives/api/proc-macro/src/impl_runtime_apis.rs index c0da8ccf30458..b8dcf625df45e 100644 --- a/primitives/api/proc-macro/src/impl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/impl_runtime_apis.rs @@ -139,7 +139,7 @@ fn generate_impl_calls( .ident; for item in &impl_.items { - if let ImplItem::Method(method) = item { + if let ImplItem::Fn(method) = item { let impl_call = generate_impl_call(&method.sig, &impl_.self_ty, input, &impl_trait)?; @@ -720,7 +720,7 @@ fn impl_runtime_apis_impl_inner(api_impls: &[ItemImpl]) -> Result { // Filters all attributes except the cfg ones. fn filter_cfg_attrs(attrs: &[Attribute]) -> Vec { - attrs.iter().filter(|a| a.path.is_ident("cfg")).cloned().collect() + attrs.iter().filter(|a| a.path().is_ident("cfg")).cloned().collect() } // Extracts the value of `API_VERSION_ATTRIBUTE` and handles errors. @@ -732,7 +732,7 @@ fn extract_api_version(attrs: &Vec, span: Span) -> Result // First fetch all `API_VERSION_ATTRIBUTE` values (should be only one) let api_ver = attrs .iter() - .filter(|a| a.path.is_ident(API_VERSION_ATTRIBUTE)) + .filter(|a| a.path().is_ident(API_VERSION_ATTRIBUTE)) .collect::>(); if api_ver.len() > 1 { diff --git a/primitives/api/proc-macro/src/mock_impl_runtime_apis.rs b/primitives/api/proc-macro/src/mock_impl_runtime_apis.rs index fc0a754e26730..be8c8ca0f8527 100644 --- a/primitives/api/proc-macro/src/mock_impl_runtime_apis.rs +++ b/primitives/api/proc-macro/src/mock_impl_runtime_apis.rs @@ -192,7 +192,7 @@ fn implement_common_api_traits(block_type: TypePath, self_ty: Type) -> Result) -> bool { let mut found = false; attributes.retain(|attr| { - if attr.path.is_ident(ADVANCED_ATTRIBUTE) { + if attr.path().is_ident(ADVANCED_ATTRIBUTE) { found = true; false } else { @@ -258,7 +258,7 @@ impl<'a> FoldRuntimeApiImpl<'a> { // We also need to overwrite all the `_with_context` methods. To do this, // we clone all methods and add them again with the new name plus one more argument. impl_item.items.extend(impl_item.items.clone().into_iter().filter_map(|i| { - if let syn::ImplItem::Method(mut m) = i { + if let syn::ImplItem::Fn(mut m) = i { m.sig.ident = quote::format_ident!("{}_with_context", m.sig.ident); m.sig.inputs.insert(2, parse_quote!( _: #crate_::ExecutionContext )); @@ -290,7 +290,7 @@ impl<'a> FoldRuntimeApiImpl<'a> { } impl<'a> Fold for FoldRuntimeApiImpl<'a> { - fn fold_impl_item_method(&mut self, mut input: syn::ImplItemMethod) -> syn::ImplItemMethod { + fn fold_impl_item_fn(&mut self, mut input: syn::ImplItemFn) -> syn::ImplItemFn { let block = { let crate_ = generate_crate_access(); let is_advanced = has_advanced_attribute(&mut input.attrs); @@ -377,7 +377,7 @@ impl<'a> Fold for FoldRuntimeApiImpl<'a> { ) }; - let mut input = fold::fold_impl_item_method(self, input); + let mut input = fold::fold_impl_item_fn(self, input); // We need to set the block, after we modified the rest of the ast, otherwise we would // modify our generated block as well. input.block = block; diff --git a/primitives/api/proc-macro/src/runtime_metadata.rs b/primitives/api/proc-macro/src/runtime_metadata.rs index 02b03baeaeee3..ae78fb52dbd5a 100644 --- a/primitives/api/proc-macro/src/runtime_metadata.rs +++ b/primitives/api/proc-macro/src/runtime_metadata.rs @@ -88,13 +88,13 @@ pub fn generate_decl_runtime_metadata(decl: &ItemTrait) -> TokenStream2 { let mut where_clause = Vec::new(); for item in &decl.items { // Collect metadata for methods only. - let syn::TraitItem::Method(method) = item else { + let syn::TraitItem::Fn(method) = item else { continue }; // Collect metadata only for the latest methods. let is_changed_in = - method.attrs.iter().any(|attr| attr.path.is_ident(CHANGED_IN_ATTRIBUTE)); + method.attrs.iter().any(|attr| attr.path().is_ident(CHANGED_IN_ATTRIBUTE)); if is_changed_in { continue } diff --git a/primitives/api/proc-macro/src/utils.rs b/primitives/api/proc-macro/src/utils.rs index cffaf317fbb10..6716be142febc 100644 --- a/primitives/api/proc-macro/src/utils.rs +++ b/primitives/api/proc-macro/src/utils.rs @@ -22,7 +22,7 @@ use syn::{ ImplItem, ItemImpl, Pat, Path, PathArguments, Result, ReturnType, Signature, Type, TypePath, }; -use quote::{format_ident, quote}; +use quote::{format_ident, quote, ToTokens}; use proc_macro_crate::{crate_name, FoundCrate}; @@ -158,7 +158,7 @@ pub fn extract_all_signature_types(items: &[ImplItem]) -> Vec { items .iter() .filter_map(|i| match i { - ImplItem::Method(method) => Some(&method.sig), + ImplItem::Fn(method) => Some(&method.sig), _ => None, }) .flat_map(|sig| { @@ -263,18 +263,20 @@ pub fn get_doc_literals(attrs: &[syn::Attribute]) -> Vec { attrs .iter() .filter_map(|attr| { - let Ok(syn::Meta::NameValue(meta)) = attr.parse_meta() else { + let syn::Meta::NameValue(meta) = &attr.meta else { return None }; - - meta.path.get_ident().filter(|ident| *ident == "doc").map(|_| meta.lit) + let Ok(lit) = syn::parse2::(meta.value.to_token_stream()) else { + unreachable!("non-lit doc attribute values do not exist"); + }; + meta.path.get_ident().filter(|ident| *ident == "doc").map(|_| lit) }) .collect() } /// Filters all attributes except the cfg ones. pub fn filter_cfg_attributes(attrs: &[syn::Attribute]) -> Vec { - attrs.iter().filter(|a| a.path.is_ident("cfg")).cloned().collect() + attrs.iter().filter(|a| a.path().is_ident("cfg")).cloned().collect() } #[cfg(test)] diff --git a/primitives/arithmetic/src/per_things.rs b/primitives/arithmetic/src/per_things.rs index c4cb5196602ea..611a4e05e1027 100644 --- a/primitives/arithmetic/src/per_things.rs +++ b/primitives/arithmetic/src/per_things.rs @@ -527,16 +527,18 @@ where rem_mul_div_inner += 1.into(); } }, - Rounding::NearestPrefDown => + Rounding::NearestPrefDown => { if rem_mul_upper % denom_upper > denom_upper / 2.into() { // `rem * numer / denom` is less than `numer`, so this will not overflow. rem_mul_div_inner += 1.into(); - }, - Rounding::NearestPrefUp => + } + }, + Rounding::NearestPrefUp => { if rem_mul_upper % denom_upper >= denom_upper / 2.into() + denom_upper % 2.into() { // `rem * numer / denom` is less than `numer`, so this will not overflow. rem_mul_div_inner += 1.into(); - }, + } + }, } rem_mul_div_inner.into() } diff --git a/primitives/core/hashing/proc-macro/Cargo.toml b/primitives/core/hashing/proc-macro/Cargo.toml index 6d9747de871c7..66e9667c8468c 100644 --- a/primitives/core/hashing/proc-macro/Cargo.toml +++ b/primitives/core/hashing/proc-macro/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -proc-macro2 = "1.0.37" -quote = "1.0.6" -syn = { version = "1.0.98", features = ["full", "parsing"] } +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full", "parsing"] } sp-core-hashing = { version = "5.0.0", default-features = false, path = "../" } diff --git a/primitives/debug-derive/Cargo.toml b/primitives/debug-derive/Cargo.toml index a903b704410c2..183d7bd5a7720 100644 --- a/primitives/debug-derive/Cargo.toml +++ b/primitives/debug-derive/Cargo.toml @@ -17,9 +17,9 @@ targets = ["x86_64-unknown-linux-gnu"] proc-macro = true [dependencies] -quote = "1.0.10" -syn = "1.0.98" -proc-macro2 = "1.0" +quote = "1.0.26" +syn = "2.0.14" +proc-macro2 = "1.0.56" [features] default = [ "std" ] diff --git a/primitives/runtime-interface/proc-macro/Cargo.toml b/primitives/runtime-interface/proc-macro/Cargo.toml index 9bc7161012cb1..3a63c1ef55dab 100644 --- a/primitives/runtime-interface/proc-macro/Cargo.toml +++ b/primitives/runtime-interface/proc-macro/Cargo.toml @@ -18,6 +18,6 @@ proc-macro = true [dependencies] Inflector = "0.11.4" proc-macro-crate = "1.1.3" -proc-macro2 = "1.0.37" -quote = "1.0.10" -syn = { version = "1.0.98", features = ["full", "visit", "fold", "extra-traits"] } +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full", "visit", "fold", "extra-traits"] } diff --git a/primitives/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs b/primitives/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs index 16c1cffb78158..77a29bec3807f 100644 --- a/primitives/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs +++ b/primitives/runtime-interface/proc-macro/src/runtime_interface/bare_function_interface.rs @@ -36,8 +36,7 @@ use crate::utils::{ }; use syn::{ - parse_quote, spanned::Spanned, FnArg, Ident, ItemTrait, Result, Signature, Token, - TraitItemMethod, + parse_quote, spanned::Spanned, FnArg, Ident, ItemTrait, Result, Signature, Token, TraitItemFn, }; use proc_macro2::{Span, TokenStream}; @@ -116,7 +115,7 @@ fn function_no_std_impl( quote! {} }; - let attrs = method.attrs.iter().filter(|a| !a.path.is_ident("version")); + let attrs = method.attrs.iter().filter(|a| !a.path().is_ident("version")); let cfg_wasm_only = if is_wasm_only { quote! { #[cfg(target_arch = "wasm32")] } @@ -139,12 +138,12 @@ fn function_no_std_impl( /// Generate call to latest function version for `cfg((feature = "std")` /// /// This should generate simple `fn func(..) { func_version_(..) }`. -fn function_std_latest_impl(method: &TraitItemMethod, latest_version: u32) -> Result { +fn function_std_latest_impl(method: &TraitItemFn, latest_version: u32) -> Result { let function_name = &method.sig.ident; let args = get_function_arguments(&method.sig).map(FnArg::Typed); let arg_names = get_function_argument_names(&method.sig).collect::>(); let return_value = &method.sig.output; - let attrs = method.attrs.iter().filter(|a| !a.path.is_ident("version")); + let attrs = method.attrs.iter().filter(|a| !a.path().is_ident("version")); let latest_function_name = create_function_ident_with_version(&method.sig.ident, latest_version); @@ -162,7 +161,7 @@ fn function_std_latest_impl(method: &TraitItemMethod, latest_version: u32) -> Re /// Generates the bare function implementation for `cfg(feature = "std")`. fn function_std_impl( trait_name: &Ident, - method: &TraitItemMethod, + method: &TraitItemFn, version: u32, is_wasm_only: bool, tracing: bool, @@ -185,7 +184,7 @@ fn function_std_impl( .take(1), ); let return_value = &method.sig.output; - let attrs = method.attrs.iter().filter(|a| !a.path.is_ident("version")); + let attrs = method.attrs.iter().filter(|a| !a.path().is_ident("version")); // Don't make the function public accessible when this is a wasm only interface. let call_to_trait = generate_call_to_trait(trait_name, method, version, is_wasm_only); let call_to_trait = if !tracing { @@ -210,7 +209,7 @@ fn function_std_impl( /// Generate the call to the interface trait. fn generate_call_to_trait( trait_name: &Ident, - method: &TraitItemMethod, + method: &TraitItemFn, version: u32, is_wasm_only: bool, ) -> TokenStream { diff --git a/primitives/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs b/primitives/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs index fb751c69bc86d..f3cdcf7fd54a9 100644 --- a/primitives/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs +++ b/primitives/runtime-interface/proc-macro/src/runtime_interface/host_function_interface.rs @@ -30,7 +30,7 @@ use crate::utils::{ }; use syn::{ - spanned::Spanned, Error, Ident, ItemTrait, Pat, Result, ReturnType, Signature, TraitItemMethod, + spanned::Spanned, Error, Ident, ItemTrait, Pat, Result, ReturnType, Signature, TraitItemFn, }; use proc_macro2::{Span, TokenStream}; @@ -78,7 +78,7 @@ pub fn generate(trait_def: &ItemTrait, is_wasm_only: bool) -> Result Result { @@ -136,7 +136,7 @@ fn generate_extern_host_function( } /// Generate the host exchangeable function for the given method. -fn generate_exchangeable_host_function(method: &TraitItemMethod) -> Result { +fn generate_exchangeable_host_function(method: &TraitItemFn) -> Result { let crate_ = generate_crate_access(); let arg_types = get_function_argument_types(&method.sig); let function = &method.sig.ident; diff --git a/primitives/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs b/primitives/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs index 4a3a688e5c3bd..540e930b0c14b 100644 --- a/primitives/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs +++ b/primitives/runtime-interface/proc-macro/src/runtime_interface/trait_decl_impl.rs @@ -26,7 +26,7 @@ use crate::utils::{ use syn::{ fold::{self, Fold}, spanned::Spanned, - Error, Generics, ItemTrait, Receiver, Result, TraitItemMethod, Type, Visibility, + Error, Generics, ItemTrait, Receiver, Result, TraitItemFn, Type, Visibility, }; use proc_macro2::TokenStream; @@ -51,7 +51,7 @@ pub fn process(trait_def: &ItemTrait, is_wasm_only: bool) -> Result struct ToEssentialTraitDef { /// All errors found while doing the conversion. errors: Vec, - methods: Vec, + methods: Vec, } impl ToEssentialTraitDef { @@ -59,7 +59,7 @@ impl ToEssentialTraitDef { ToEssentialTraitDef { errors: vec![], methods: vec![] } } - fn into_methods(self) -> Result> { + fn into_methods(self) -> Result> { let mut errors = self.errors; let methods = self.methods; if let Some(first_error) = errors.pop() { @@ -72,8 +72,8 @@ impl ToEssentialTraitDef { } } - fn process(&mut self, method: &TraitItemMethod, version: u32) { - let mut folded = self.fold_trait_item_method(method.clone()); + fn process(&mut self, method: &TraitItemFn, version: u32) { + let mut folded = self.fold_trait_item_fn(method.clone()); folded.sig.ident = create_function_ident_with_version(&folded.sig.ident, version); self.methods.push(folded); } @@ -90,7 +90,7 @@ impl ToEssentialTraitDef { } impl Fold for ToEssentialTraitDef { - fn fold_trait_item_method(&mut self, mut method: TraitItemMethod) -> TraitItemMethod { + fn fold_trait_item_fn(&mut self, mut method: TraitItemFn) -> TraitItemFn { if method.default.take().is_none() { self.push_error(&method, "Methods need to have an implementation."); } @@ -105,9 +105,9 @@ impl Fold for ToEssentialTraitDef { self.error_on_generic_parameters(&method.sig.generics); - method.attrs.retain(|a| !a.path.is_ident("version")); + method.attrs.retain(|a| !a.path().is_ident("version")); - fold::fold_trait_item_method(self, method) + fold::fold_trait_item_fn(self, method) } fn fold_item_trait(&mut self, mut trait_def: ItemTrait) -> ItemTrait { @@ -154,7 +154,7 @@ fn impl_trait_for_externalities(trait_def: &ItemTrait, is_wasm_only: bool) -> Re let interface = get_runtime_interface(trait_def)?; let methods = interface.all_versions().map(|(version, method)| { let mut cloned = (*method).clone(); - cloned.attrs.retain(|a| !a.path.is_ident("version")); + cloned.attrs.retain(|a| !a.path().is_ident("version")); cloned.sig.ident = create_function_ident_with_version(&cloned.sig.ident, version); cloned }); diff --git a/primitives/runtime-interface/proc-macro/src/utils.rs b/primitives/runtime-interface/proc-macro/src/utils.rs index 07f9b5ce09802..9818fd6842a63 100644 --- a/primitives/runtime-interface/proc-macro/src/utils.rs +++ b/primitives/runtime-interface/proc-macro/src/utils.rs @@ -21,7 +21,7 @@ use proc_macro2::{Span, TokenStream}; use syn::{ parse::Parse, parse_quote, spanned::Spanned, token, Error, FnArg, Ident, ItemTrait, LitInt, - Pat, PatType, Result, Signature, TraitItem, TraitItemMethod, Type, + Pat, PatType, Result, Signature, TraitItem, TraitItemFn, Type, }; use proc_macro_crate::{crate_name, FoundCrate}; @@ -41,23 +41,23 @@ mod attributes { /// A concrete, specific version of a runtime interface function. pub struct RuntimeInterfaceFunction { - item: TraitItemMethod, + item: TraitItemFn, should_trap_on_return: bool, } impl std::ops::Deref for RuntimeInterfaceFunction { - type Target = TraitItemMethod; + type Target = TraitItemFn; fn deref(&self) -> &Self::Target { &self.item } } impl RuntimeInterfaceFunction { - fn new(item: &TraitItemMethod) -> Result { + fn new(item: &TraitItemFn) -> Result { let mut item = item.clone(); let mut should_trap_on_return = false; item.attrs.retain(|attr| { - if attr.path.is_ident("trap_on_return") { + if attr.path().is_ident("trap_on_return") { should_trap_on_return = true; false } else { @@ -87,7 +87,7 @@ struct RuntimeInterfaceFunctionSet { } impl RuntimeInterfaceFunctionSet { - fn new(version: VersionAttribute, trait_item: &TraitItemMethod) -> Result { + fn new(version: VersionAttribute, trait_item: &TraitItemFn) -> Result { Ok(Self { latest_version_to_call: version.is_callable().then(|| version.version), versions: BTreeMap::from([( @@ -115,11 +115,7 @@ impl RuntimeInterfaceFunctionSet { } /// Add a different version of the function. - fn add_version( - &mut self, - version: VersionAttribute, - trait_item: &TraitItemMethod, - ) -> Result<()> { + fn add_version(&mut self, version: VersionAttribute, trait_item: &TraitItemFn) -> Result<()> { if let Some(existing_item) = self.versions.get(&version.version) { let mut err = Error::new(trait_item.span(), "Duplicated version attribute"); err.combine(Error::new( @@ -275,9 +271,9 @@ pub fn get_function_argument_types_ref_and_mut( } /// Returns an iterator over all trait methods for the given trait definition. -fn get_trait_methods(trait_def: &ItemTrait) -> impl Iterator { +fn get_trait_methods(trait_def: &ItemTrait) -> impl Iterator { trait_def.items.iter().filter_map(|i| match i { - TraitItem::Method(ref method) => Some(method), + TraitItem::Fn(ref method) => Some(method), _ => None, }) } @@ -326,10 +322,10 @@ impl Parse for VersionAttribute { } /// Return [`VersionAttribute`], if present. -fn get_item_version(item: &TraitItemMethod) -> Result> { +fn get_item_version(item: &TraitItemFn) -> Result> { item.attrs .iter() - .find(|attr| attr.path.is_ident("version")) + .find(|attr| attr.path().is_ident("version")) .map(|attr| attr.parse_args()) .transpose() } diff --git a/primitives/version/proc-macro/Cargo.toml b/primitives/version/proc-macro/Cargo.toml index abe9e579a20da..aac41dd43dd08 100644 --- a/primitives/version/proc-macro/Cargo.toml +++ b/primitives/version/proc-macro/Cargo.toml @@ -17,9 +17,9 @@ proc-macro = true [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", features = [ "derive" ] } -proc-macro2 = "1.0.37" -quote = "1.0.10" -syn = { version = "1.0.98", features = ["full", "fold", "extra-traits", "visit"] } +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full", "fold", "extra-traits", "visit"] } [dev-dependencies] sp-version = { version = "5.0.0", path = ".." } diff --git a/test-utils/derive/Cargo.toml b/test-utils/derive/Cargo.toml index b55ace822ceb3..f3e38ada2b30d 100644 --- a/test-utils/derive/Cargo.toml +++ b/test-utils/derive/Cargo.toml @@ -11,9 +11,9 @@ publish = false [dependencies] proc-macro-crate = "1.1.3" -proc-macro2 = "1.0.37" -quote = "1.0.10" -syn = { version = "1.0.98", features = ["full"] } +proc-macro2 = "1.0.56" +quote = "1.0.26" +syn = { version = "2.0.14", features = ["full"] } [lib] proc-macro = true From 07c77323010d54410143103c2617ebc12e0a12f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Apr 2023 22:50:31 +0000 Subject: [PATCH 20/93] Bump zstd from 0.11.2+zstd.1.5.2 to 0.12.3+zstd.1.5.2 (#13671) Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.11.2+zstd.1.5.2 to 0.12.3+zstd.1.5.2. - [Release notes](https://github.com/gyscos/zstd-rs/releases) - [Commits](https://github.com/gyscos/zstd-rs/commits) --- updated-dependencies: - dependency-name: zstd dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 31 +++++++++++++++++---- frame/state-trie-migration/Cargo.toml | 2 +- primitives/maybe-compressed-blob/Cargo.toml | 2 +- primitives/runtime/Cargo.toml | 2 +- utils/frame/try-runtime/cli/Cargo.toml | 2 +- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0a96af545b2f..fc0b37baed4ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6836,7 +6836,7 @@ dependencies = [ "substrate-state-trie-migration-rpc", "thousands", "tokio", - "zstd", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -10592,7 +10592,7 @@ name = "sp-maybe-compressed-blob" version = "4.1.0-dev" dependencies = [ "thiserror", - "zstd", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -10703,7 +10703,7 @@ dependencies = [ "sp-tracing", "sp-weights", "substrate-test-runtime-client", - "zstd", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -12052,7 +12052,7 @@ dependencies = [ "substrate-cli-test-utils", "substrate-rpc-client", "tokio", - "zstd", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -12596,7 +12596,7 @@ dependencies = [ "sha2 0.10.6", "toml", "windows-sys 0.42.0", - "zstd", + "zstd 0.11.2+zstd.1.5.2", ] [[package]] @@ -13317,7 +13317,16 @@ version = "0.11.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" dependencies = [ - "zstd-safe", + "zstd-safe 5.0.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.12.3+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" +dependencies = [ + "zstd-safe 6.0.5+zstd.1.5.4", ] [[package]] @@ -13330,6 +13339,16 @@ dependencies = [ "zstd-sys", ] +[[package]] +name = "zstd-safe" +version = "6.0.5+zstd.1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" +dependencies = [ + "libc", + "zstd-sys", +] + [[package]] name = "zstd-sys" version = "2.0.7+zstd.1.5.4" diff --git a/frame/state-trie-migration/Cargo.toml b/frame/state-trie-migration/Cargo.toml index 8485db5a3c98d..9cd875932ceaf 100644 --- a/frame/state-trie-migration/Cargo.toml +++ b/frame/state-trie-migration/Cargo.toml @@ -17,7 +17,7 @@ log = { version = "0.4.17", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.133", optional = true } thousands = { version = "0.2.0", optional = true } -zstd = { version = "0.11.2", default-features = false, optional = true } +zstd = { version = "0.12.3", default-features = false, optional = true } frame-benchmarking = { default-features = false, optional = true, path = "../benchmarking" } frame-support = { default-features = false, path = "../support" } frame-system = { default-features = false, path = "../system" } diff --git a/primitives/maybe-compressed-blob/Cargo.toml b/primitives/maybe-compressed-blob/Cargo.toml index 7e2780aa23355..67f93c517274c 100644 --- a/primitives/maybe-compressed-blob/Cargo.toml +++ b/primitives/maybe-compressed-blob/Cargo.toml @@ -12,4 +12,4 @@ readme = "README.md" [dependencies] thiserror = "1.0" -zstd = { version = "0.11.2", default-features = false } +zstd = { version = "0.12.3", default-features = false } diff --git a/primitives/runtime/Cargo.toml b/primitives/runtime/Cargo.toml index 056cfa3ddd3a4..4ec55162e9774 100644 --- a/primitives/runtime/Cargo.toml +++ b/primitives/runtime/Cargo.toml @@ -33,7 +33,7 @@ sp-weights = { version = "4.0.0", default-features = false, path = "../weights" [dev-dependencies] rand = "0.8.5" serde_json = "1.0.85" -zstd = { version = "0.11.2", default-features = false } +zstd = { version = "0.12.3", default-features = false } sp-api = { version = "4.0.0-dev", path = "../api" } sp-state-machine = { version = "0.13.0", path = "../state-machine" } sp-tracing = { version = "6.0.0", path = "../../primitives/tracing" } diff --git a/utils/frame/try-runtime/cli/Cargo.toml b/utils/frame/try-runtime/cli/Cargo.toml index a4d24986eddff..686d27eefbf13 100644 --- a/utils/frame/try-runtime/cli/Cargo.toml +++ b/utils/frame/try-runtime/cli/Cargo.toml @@ -42,7 +42,7 @@ log = "0.4.17" parity-scale-codec = "3.2.2" serde = "1.0.136" serde_json = "1.0.85" -zstd = { version = "0.11.2", default-features = false } +zstd = { version = "0.12.3", default-features = false } [dev-dependencies] assert_cmd = "2.0.10" From a6cb6d0fb79c303c9af513e856abfb61fc6d8d74 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:30:42 +0200 Subject: [PATCH 21/93] Bump toml from 0.5.11 to 0.7.3 (#13619) Bumps [toml](https://github.com/toml-rs/toml) from 0.5.11 to 0.7.3. - [Release notes](https://github.com/toml-rs/toml/releases) - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.5.11...toml-v0.7.3) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 58 +++++++++++++++++++++++++++++++++-- utils/wasm-builder/Cargo.toml | 2 +- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc0b37baed4ff..45542b8c269e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7523,7 +7523,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" dependencies = [ "thiserror", - "toml", + "toml 0.5.11", ] [[package]] @@ -9946,6 +9946,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + [[package]] name = "sha-1" version = "0.9.8" @@ -11411,7 +11420,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum", "tempfile", - "toml", + "toml 0.7.3", "walkdir", "wasm-opt", ] @@ -11768,6 +11777,40 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tower" version = "0.4.13" @@ -12594,7 +12637,7 @@ dependencies = [ "rustix 0.36.8", "serde", "sha2 0.10.6", - "toml", + "toml 0.5.11", "windows-sys 0.42.0", "zstd 0.11.2+zstd.1.5.2", ] @@ -13184,6 +13227,15 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +[[package]] +name = "winnow" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.10.1" diff --git a/utils/wasm-builder/Cargo.toml b/utils/wasm-builder/Cargo.toml index c1ef006b5a92f..e1444a24042d1 100644 --- a/utils/wasm-builder/Cargo.toml +++ b/utils/wasm-builder/Cargo.toml @@ -18,7 +18,7 @@ build-helper = "0.1.1" cargo_metadata = "0.15.2" strum = { version = "0.24.1", features = ["derive"] } tempfile = "3.1.0" -toml = "0.5.4" +toml = "0.7.3" walkdir = "2.3.2" sp-maybe-compressed-blob = { version = "4.1.0-dev", path = "../../primitives/maybe-compressed-blob" } filetime = "0.2.16" From be58e48f609c044fb832d78cf0f85c51e894d2dc Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 13 Apr 2023 15:11:58 +0200 Subject: [PATCH 22/93] Fixes PoV over-estimation (#13766) * Align log Signed-off-by: Oliver Tale-Yazdi * Use max instead of sum Signed-off-by: Oliver Tale-Yazdi * Make comment ordering deterministic Signed-off-by: Oliver Tale-Yazdi * Dont add Pov overhead when all is ignored Signed-off-by: Oliver Tale-Yazdi * Update test pallet weights Signed-off-by: Oliver Tale-Yazdi * Re-run weights on bm2 Signed-off-by: Oliver Tale-Yazdi * Fix test Signed-off-by: Oliver Tale-Yazdi * Actually use new weights Fucked up the merge for this file... Signed-off-by: Oliver Tale-Yazdi * Update contract weights Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi --- frame/alliance/src/weights.rs | 475 ++-- frame/assets/src/weights.rs | 347 +-- frame/bags-list/src/weights.rs | 43 +- frame/balances/src/weights.rs | 85 +- frame/benchmarking/pov/src/benchmarking.rs | 1 + frame/benchmarking/pov/src/tests.rs | 4 +- frame/benchmarking/pov/src/weights.rs | 555 ++-- frame/benchmarking/src/weights.rs | 63 +- frame/bounties/src/weights.rs | 151 +- frame/child-bounties/src/weights.rs | 111 +- frame/collective/src/weights.rs | 355 ++- frame/contracts/src/weights.rs | 2239 ++++++++--------- frame/conviction-voting/src/weights.rs | 147 +- frame/core-fellowship/src/weights.rs | 123 +- frame/democracy/src/weights.rs | 423 ++-- .../src/weights.rs | 207 +- frame/elections-phragmen/src/weights.rs | 267 +- frame/fast-unstake/src/weights.rs | 119 +- frame/glutton/src/weights.rs | 123 +- frame/identity/src/weights.rs | 359 ++- frame/im-online/src/weights.rs | 39 +- frame/indices/src/weights.rs | 55 +- frame/lottery/src/weights.rs | 79 +- frame/membership/src/weights.rs | 163 +- frame/message-queue/src/weights.rs | 111 +- frame/multisig/src/weights.rs | 147 +- frame/nfts/src/weights.rs | 503 ++-- frame/nis/src/weights.rs | 299 ++- frame/nomination-pools/src/weights.rs | 335 +-- frame/preimage/src/weights.rs | 115 +- frame/proxy/src/weights.rs | 215 +- frame/ranked-collective/src/weights.rs | 115 +- frame/recovery/src/weights.rs | 139 +- frame/referenda/src/weights.rs | 355 ++- frame/remark/src/weights.rs | 23 +- frame/salary/src/weights.rs | 83 +- frame/scheduler/src/weights.rs | 163 +- frame/session/src/weights.rs | 31 +- frame/staking/src/weights.rs | 563 +++-- frame/state-trie-migration/src/weights.rs | 75 +- frame/support/src/weights/block_weights.rs | 20 +- .../support/src/weights/extrinsic_weights.rs | 20 +- frame/system/src/weights.rs | 87 +- frame/timestamp/src/weights.rs | 27 +- frame/tips/src/weights.rs | 139 +- frame/transaction-storage/src/weights.rs | 47 +- frame/treasury/src/weights.rs | 91 +- frame/uniques/src/weights.rs | 327 ++- frame/utility/src/weights.rs | 71 +- frame/vesting/src/weights.rs | 295 ++- frame/whitelist/src/weights.rs | 67 +- scripts/run_all_benchmarks.sh | 2 +- .../benchmarking-cli/src/pallet/command.rs | 2 +- .../benchmarking-cli/src/pallet/writer.rs | 8 +- 54 files changed, 5500 insertions(+), 5508 deletions(-) diff --git a/frame/alliance/src/weights.rs b/frame/alliance/src/weights.rs index a9756c2d27127..0276a9844a4a9 100644 --- a/frame/alliance/src/weights.rs +++ b/frame/alliance/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_alliance //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_alliance -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -92,19 +89,19 @@ impl WeightInfo for SubstrateWeight { fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `618 + m * (32 ±0) + p * (36 ±0)` - // Estimated: `15463 + m * (124 ±0) + p * (148 ±0)` - // Minimum execution time: 32_788_000 picoseconds. - Weight::from_parts(36_725_375, 15463) - // Standard Error: 138 - .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(b.into())) - // Standard Error: 1_445 - .saturating_add(Weight::from_parts(9_861, 0).saturating_mul(m.into())) - // Standard Error: 1_427 - .saturating_add(Weight::from_parts(127_304, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (31 ±0) + p * (37 ±0)` + // Minimum execution time: 32_316_000 picoseconds. + Weight::from_parts(35_185_484, 6676) + // Standard Error: 83 + .saturating_add(Weight::from_parts(1_089, 0).saturating_mul(b.into())) + // Standard Error: 871 + .saturating_add(Weight::from_parts(21_235, 0).saturating_mul(m.into())) + // Standard Error: 860 + .saturating_add(Weight::from_parts(120_353, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 124).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 148).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 31).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -114,11 +111,11 @@ impl WeightInfo for SubstrateWeight { fn vote(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1042 + m * (64 ±0)` - // Estimated: `11182 + m * (64 ±0)` - // Minimum execution time: 26_632_000 picoseconds. - Weight::from_parts(28_918_089, 11182) - // Standard Error: 947 - .saturating_add(Weight::from_parts(56_565, 0).saturating_mul(m.into())) + // Estimated: `6676 + m * (64 ±0)` + // Minimum execution time: 25_982_000 picoseconds. + Weight::from_parts(28_118_657, 6676) + // Standard Error: 855 + .saturating_add(Weight::from_parts(61_309, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) @@ -138,17 +135,17 @@ impl WeightInfo for SubstrateWeight { fn close_early_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `622 + m * (96 ±0) + p * (37 ±0)` - // Estimated: `15551 + m * (384 ±0) + p * (148 ±0)` - // Minimum execution time: 40_937_000 picoseconds. - Weight::from_parts(39_361_123, 15551) - // Standard Error: 1_609 - .saturating_add(Weight::from_parts(43_225, 0).saturating_mul(m.into())) - // Standard Error: 1_569 - .saturating_add(Weight::from_parts(112_935, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (96 ±0) + p * (37 ±0)` + // Minimum execution time: 40_922_000 picoseconds. + Weight::from_parts(39_098_903, 6676) + // Standard Error: 714 + .saturating_add(Weight::from_parts(44_125, 0).saturating_mul(m.into())) + // Standard Error: 696 + .saturating_add(Weight::from_parts(111_263, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 384).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 148).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 96).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -166,19 +163,19 @@ impl WeightInfo for SubstrateWeight { fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `903 + m * (96 ±0) + p * (41 ±0)` - // Estimated: `20072 + m * (392 ±0) + p * (160 ±0)` - // Minimum execution time: 51_569_000 picoseconds. - Weight::from_parts(50_722_448, 20072) - // Standard Error: 120 - .saturating_add(Weight::from_parts(474, 0).saturating_mul(b.into())) - // Standard Error: 1_271 - .saturating_add(Weight::from_parts(48_855, 0).saturating_mul(m.into())) - // Standard Error: 1_239 - .saturating_add(Weight::from_parts(139_022, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (98 ±0) + p * (40 ±0)` + // Minimum execution time: 51_890_000 picoseconds. + Weight::from_parts(49_880_817, 6676) + // Standard Error: 81 + .saturating_add(Weight::from_parts(688, 0).saturating_mul(b.into())) + // Standard Error: 862 + .saturating_add(Weight::from_parts(54_419, 0).saturating_mul(m.into())) + // Standard Error: 840 + .saturating_add(Weight::from_parts(122_253, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 392).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 160).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 98).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -197,17 +194,17 @@ impl WeightInfo for SubstrateWeight { fn close_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `622 + m * (96 ±0) + p * (37 ±0)` - // Estimated: `17666 + m * (480 ±0) + p * (185 ±0)` - // Minimum execution time: 42_084_000 picoseconds. - Weight::from_parts(39_907_823, 17666) - // Standard Error: 899 - .saturating_add(Weight::from_parts(46_642, 0).saturating_mul(m.into())) - // Standard Error: 888 - .saturating_add(Weight::from_parts(114_161, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (96 ±0) + p * (37 ±0)` + // Minimum execution time: 42_391_000 picoseconds. + Weight::from_parts(40_156_254, 6676) + // Standard Error: 728 + .saturating_add(Weight::from_parts(47_889, 0).saturating_mul(m.into())) + // Standard Error: 719 + .saturating_add(Weight::from_parts(112_596, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 480).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 185).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 96).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -227,19 +224,19 @@ impl WeightInfo for SubstrateWeight { fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `591 + m * (96 ±0) + p * (36 ±0)` - // Estimated: `17471 + m * (485 ±0) + p * (180 ±0)` - // Minimum execution time: 42_322_000 picoseconds. - Weight::from_parts(38_753_429, 17471) - // Standard Error: 78 - .saturating_add(Weight::from_parts(1_053, 0).saturating_mul(b.into())) - // Standard Error: 841 - .saturating_add(Weight::from_parts(51_720, 0).saturating_mul(m.into())) - // Standard Error: 811 - .saturating_add(Weight::from_parts(113_343, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (97 ±0) + p * (36 ±0)` + // Minimum execution time: 42_320_000 picoseconds. + Weight::from_parts(40_205_526, 6676) + // Standard Error: 64 + .saturating_add(Weight::from_parts(49, 0).saturating_mul(b.into())) + // Standard Error: 690 + .saturating_add(Weight::from_parts(46_508, 0).saturating_mul(m.into())) + // Standard Error: 665 + .saturating_add(Weight::from_parts(112_222, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 485).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 97).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Alliance Members (r:2 w:2) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -250,13 +247,13 @@ impl WeightInfo for SubstrateWeight { fn init_members(m: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `217` - // Estimated: `14064` - // Minimum execution time: 33_217_000 picoseconds. - Weight::from_parts(24_495_505, 14064) - // Standard Error: 412 - .saturating_add(Weight::from_parts(108_405, 0).saturating_mul(m.into())) - // Standard Error: 407 - .saturating_add(Weight::from_parts(95_707, 0).saturating_mul(z.into())) + // Estimated: `12362` + // Minimum execution time: 32_509_000 picoseconds. + Weight::from_parts(23_584_337, 12362) + // Standard Error: 377 + .saturating_add(Weight::from_parts(114_917, 0).saturating_mul(m.into())) + // Standard Error: 373 + .saturating_add(Weight::from_parts(97_593, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -278,24 +275,24 @@ impl WeightInfo for SubstrateWeight { fn disband(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + x * (50 ±0) + y * (51 ±0) + z * (251 ±0)` - // Estimated: `35975 + x * (2587 ±0) + y * (2590 ±0) + z * (3113 ±1)` - // Minimum execution time: 278_029_000 picoseconds. - Weight::from_parts(279_353_000, 35975) - // Standard Error: 23_655 - .saturating_add(Weight::from_parts(519_330, 0).saturating_mul(x.into())) - // Standard Error: 23_541 - .saturating_add(Weight::from_parts(547_382, 0).saturating_mul(y.into())) - // Standard Error: 47_040 - .saturating_add(Weight::from_parts(10_939_685, 0).saturating_mul(z.into())) + // Estimated: `12362 + x * (2539 ±0) + y * (2539 ±0) + z * (2603 ±1)` + // Minimum execution time: 275_061_000 picoseconds. + Weight::from_parts(565_248, 12362) + // Standard Error: 15_948 + .saturating_add(Weight::from_parts(1_636_348, 0).saturating_mul(x.into())) + // Standard Error: 15_761 + .saturating_add(Weight::from_parts(1_580_146, 0).saturating_mul(y.into())) + // Standard Error: 31_496 + .saturating_add(Weight::from_parts(17_217_382, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(y.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(z.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(z.into()))) - .saturating_add(Weight::from_parts(0, 2587).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 2590).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 3113).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 2539).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2539).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(z.into())) } /// Storage: Alliance Rule (r:0 w:1) /// Proof: Alliance Rule (max_values: Some(1), max_size: Some(87), added: 582, mode: MaxEncodedLen) @@ -303,8 +300,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_129_000 picoseconds. - Weight::from_parts(10_370_000, 0) + // Minimum execution time: 10_261_000 picoseconds. + Weight::from_parts(10_389_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Alliance Announcements (r:1 w:1) @@ -313,8 +310,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `246` // Estimated: `10187` - // Minimum execution time: 13_601_000 picoseconds. - Weight::from_parts(13_823_000, 10187) + // Minimum execution time: 13_483_000 picoseconds. + Weight::from_parts(13_805_000, 10187) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -324,8 +321,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319` // Estimated: `10187` - // Minimum execution time: 14_953_000 picoseconds. - Weight::from_parts(15_239_000, 10187) + // Minimum execution time: 14_816_000 picoseconds. + Weight::from_parts(15_163_000, 10187) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -340,9 +337,9 @@ impl WeightInfo for SubstrateWeight { fn join_alliance() -> Weight { // Proof Size summary in bytes: // Measured: `468` - // Estimated: `26328` - // Minimum execution time: 42_947_000 picoseconds. - Weight::from_parts(43_602_000, 26328) + // Estimated: `18048` + // Minimum execution time: 46_149_000 picoseconds. + Weight::from_parts(46_827_000, 18048) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -353,9 +350,9 @@ impl WeightInfo for SubstrateWeight { fn nominate_ally() -> Weight { // Proof Size summary in bytes: // Measured: `367` - // Estimated: `22735` - // Minimum execution time: 28_787_000 picoseconds. - Weight::from_parts(29_286_000, 22735) + // Estimated: `18048` + // Minimum execution time: 28_463_000 picoseconds. + Weight::from_parts(28_730_000, 18048) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -370,9 +367,9 @@ impl WeightInfo for SubstrateWeight { fn elevate_ally() -> Weight { // Proof Size summary in bytes: // Measured: `443` - // Estimated: `15176` - // Minimum execution time: 28_476_000 picoseconds. - Weight::from_parts(28_972_000, 15176) + // Estimated: `12362` + // Minimum execution time: 28_401_000 picoseconds. + Weight::from_parts(28_717_000, 12362) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -389,9 +386,9 @@ impl WeightInfo for SubstrateWeight { fn give_retirement_notice() -> Weight { // Proof Size summary in bytes: // Measured: `443` - // Estimated: `26548` - // Minimum execution time: 36_773_000 picoseconds. - Weight::from_parts(38_123_000, 26548) + // Estimated: `23734` + // Minimum execution time: 36_538_000 picoseconds. + Weight::from_parts(37_197_000, 23734) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -406,9 +403,9 @@ impl WeightInfo for SubstrateWeight { fn retire() -> Weight { // Proof Size summary in bytes: // Measured: `687` - // Estimated: `17315` - // Minimum execution time: 37_814_000 picoseconds. - Weight::from_parts(38_353_000, 17315) + // Estimated: `6676` + // Minimum execution time: 42_324_000 picoseconds. + Weight::from_parts(42_890_000, 6676) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -427,9 +424,9 @@ impl WeightInfo for SubstrateWeight { fn kick_member() -> Weight { // Proof Size summary in bytes: // Measured: `707` - // Estimated: `28776` - // Minimum execution time: 62_194_000 picoseconds. - Weight::from_parts(63_925_000, 28776) + // Estimated: `18048` + // Minimum execution time: 68_003_000 picoseconds. + Weight::from_parts(68_657_000, 18048) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -442,13 +439,13 @@ impl WeightInfo for SubstrateWeight { fn add_unscrupulous_items(n: u32, l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `246` - // Estimated: `31874` - // Minimum execution time: 8_369_000 picoseconds. - Weight::from_parts(8_462_000, 31874) - // Standard Error: 3_347 - .saturating_add(Weight::from_parts(1_567_757, 0).saturating_mul(n.into())) - // Standard Error: 1_310 - .saturating_add(Weight::from_parts(72_697, 0).saturating_mul(l.into())) + // Estimated: `27187` + // Minimum execution time: 8_304_000 picoseconds. + Weight::from_parts(8_424_000, 27187) + // Standard Error: 2_765 + .saturating_add(Weight::from_parts(1_529_793, 0).saturating_mul(n.into())) + // Standard Error: 1_082 + .saturating_add(Weight::from_parts(71_352, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -460,14 +457,14 @@ impl WeightInfo for SubstrateWeight { /// The range of component `l` is `[0, 255]`. fn remove_unscrupulous_items(n: u32, l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + n * (289 ±0) + l * (100 ±0)` - // Estimated: `31874` - // Minimum execution time: 8_309_000 picoseconds. - Weight::from_parts(8_450_000, 31874) - // Standard Error: 185_163 - .saturating_add(Weight::from_parts(16_348_419, 0).saturating_mul(n.into())) - // Standard Error: 72_518 - .saturating_add(Weight::from_parts(337_571, 0).saturating_mul(l.into())) + // Measured: `0 + l * (100 ±0) + n * (289 ±0)` + // Estimated: `27187` + // Minimum execution time: 8_348_000 picoseconds. + Weight::from_parts(8_505_000, 27187) + // Standard Error: 187_398 + .saturating_add(Weight::from_parts(16_545_597, 0).saturating_mul(n.into())) + // Standard Error: 73_393 + .saturating_add(Weight::from_parts(350_415, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -482,9 +479,9 @@ impl WeightInfo for SubstrateWeight { fn abdicate_fellow_status() -> Weight { // Proof Size summary in bytes: // Measured: `443` - // Estimated: `20862` - // Minimum execution time: 35_363_000 picoseconds. - Weight::from_parts(35_665_000, 20862) + // Estimated: `18048` + // Minimum execution time: 34_461_000 picoseconds. + Weight::from_parts(34_992_000, 18048) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -508,19 +505,19 @@ impl WeightInfo for () { fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `618 + m * (32 ±0) + p * (36 ±0)` - // Estimated: `15463 + m * (124 ±0) + p * (148 ±0)` - // Minimum execution time: 32_788_000 picoseconds. - Weight::from_parts(36_725_375, 15463) - // Standard Error: 138 - .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(b.into())) - // Standard Error: 1_445 - .saturating_add(Weight::from_parts(9_861, 0).saturating_mul(m.into())) - // Standard Error: 1_427 - .saturating_add(Weight::from_parts(127_304, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (31 ±0) + p * (37 ±0)` + // Minimum execution time: 32_316_000 picoseconds. + Weight::from_parts(35_185_484, 6676) + // Standard Error: 83 + .saturating_add(Weight::from_parts(1_089, 0).saturating_mul(b.into())) + // Standard Error: 871 + .saturating_add(Weight::from_parts(21_235, 0).saturating_mul(m.into())) + // Standard Error: 860 + .saturating_add(Weight::from_parts(120_353, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 124).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 148).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 31).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -530,11 +527,11 @@ impl WeightInfo for () { fn vote(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1042 + m * (64 ±0)` - // Estimated: `11182 + m * (64 ±0)` - // Minimum execution time: 26_632_000 picoseconds. - Weight::from_parts(28_918_089, 11182) - // Standard Error: 947 - .saturating_add(Weight::from_parts(56_565, 0).saturating_mul(m.into())) + // Estimated: `6676 + m * (64 ±0)` + // Minimum execution time: 25_982_000 picoseconds. + Weight::from_parts(28_118_657, 6676) + // Standard Error: 855 + .saturating_add(Weight::from_parts(61_309, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) @@ -554,17 +551,17 @@ impl WeightInfo for () { fn close_early_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `622 + m * (96 ±0) + p * (37 ±0)` - // Estimated: `15551 + m * (384 ±0) + p * (148 ±0)` - // Minimum execution time: 40_937_000 picoseconds. - Weight::from_parts(39_361_123, 15551) - // Standard Error: 1_609 - .saturating_add(Weight::from_parts(43_225, 0).saturating_mul(m.into())) - // Standard Error: 1_569 - .saturating_add(Weight::from_parts(112_935, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (96 ±0) + p * (37 ±0)` + // Minimum execution time: 40_922_000 picoseconds. + Weight::from_parts(39_098_903, 6676) + // Standard Error: 714 + .saturating_add(Weight::from_parts(44_125, 0).saturating_mul(m.into())) + // Standard Error: 696 + .saturating_add(Weight::from_parts(111_263, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 384).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 148).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 96).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -582,19 +579,19 @@ impl WeightInfo for () { fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `903 + m * (96 ±0) + p * (41 ±0)` - // Estimated: `20072 + m * (392 ±0) + p * (160 ±0)` - // Minimum execution time: 51_569_000 picoseconds. - Weight::from_parts(50_722_448, 20072) - // Standard Error: 120 - .saturating_add(Weight::from_parts(474, 0).saturating_mul(b.into())) - // Standard Error: 1_271 - .saturating_add(Weight::from_parts(48_855, 0).saturating_mul(m.into())) - // Standard Error: 1_239 - .saturating_add(Weight::from_parts(139_022, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (98 ±0) + p * (40 ±0)` + // Minimum execution time: 51_890_000 picoseconds. + Weight::from_parts(49_880_817, 6676) + // Standard Error: 81 + .saturating_add(Weight::from_parts(688, 0).saturating_mul(b.into())) + // Standard Error: 862 + .saturating_add(Weight::from_parts(54_419, 0).saturating_mul(m.into())) + // Standard Error: 840 + .saturating_add(Weight::from_parts(122_253, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 392).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 160).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 98).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -613,17 +610,17 @@ impl WeightInfo for () { fn close_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `622 + m * (96 ±0) + p * (37 ±0)` - // Estimated: `17666 + m * (480 ±0) + p * (185 ±0)` - // Minimum execution time: 42_084_000 picoseconds. - Weight::from_parts(39_907_823, 17666) - // Standard Error: 899 - .saturating_add(Weight::from_parts(46_642, 0).saturating_mul(m.into())) - // Standard Error: 888 - .saturating_add(Weight::from_parts(114_161, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (96 ±0) + p * (37 ±0)` + // Minimum execution time: 42_391_000 picoseconds. + Weight::from_parts(40_156_254, 6676) + // Standard Error: 728 + .saturating_add(Weight::from_parts(47_889, 0).saturating_mul(m.into())) + // Standard Error: 719 + .saturating_add(Weight::from_parts(112_596, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 480).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 185).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 96).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -643,19 +640,19 @@ impl WeightInfo for () { fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `591 + m * (96 ±0) + p * (36 ±0)` - // Estimated: `17471 + m * (485 ±0) + p * (180 ±0)` - // Minimum execution time: 42_322_000 picoseconds. - Weight::from_parts(38_753_429, 17471) - // Standard Error: 78 - .saturating_add(Weight::from_parts(1_053, 0).saturating_mul(b.into())) - // Standard Error: 841 - .saturating_add(Weight::from_parts(51_720, 0).saturating_mul(m.into())) - // Standard Error: 811 - .saturating_add(Weight::from_parts(113_343, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (97 ±0) + p * (36 ±0)` + // Minimum execution time: 42_320_000 picoseconds. + Weight::from_parts(40_205_526, 6676) + // Standard Error: 64 + .saturating_add(Weight::from_parts(49, 0).saturating_mul(b.into())) + // Standard Error: 690 + .saturating_add(Weight::from_parts(46_508, 0).saturating_mul(m.into())) + // Standard Error: 665 + .saturating_add(Weight::from_parts(112_222, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 485).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 97).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Alliance Members (r:2 w:2) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -666,13 +663,13 @@ impl WeightInfo for () { fn init_members(m: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `217` - // Estimated: `14064` - // Minimum execution time: 33_217_000 picoseconds. - Weight::from_parts(24_495_505, 14064) - // Standard Error: 412 - .saturating_add(Weight::from_parts(108_405, 0).saturating_mul(m.into())) - // Standard Error: 407 - .saturating_add(Weight::from_parts(95_707, 0).saturating_mul(z.into())) + // Estimated: `12362` + // Minimum execution time: 32_509_000 picoseconds. + Weight::from_parts(23_584_337, 12362) + // Standard Error: 377 + .saturating_add(Weight::from_parts(114_917, 0).saturating_mul(m.into())) + // Standard Error: 373 + .saturating_add(Weight::from_parts(97_593, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -694,24 +691,24 @@ impl WeightInfo for () { fn disband(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + x * (50 ±0) + y * (51 ±0) + z * (251 ±0)` - // Estimated: `35975 + x * (2587 ±0) + y * (2590 ±0) + z * (3113 ±1)` - // Minimum execution time: 278_029_000 picoseconds. - Weight::from_parts(279_353_000, 35975) - // Standard Error: 23_655 - .saturating_add(Weight::from_parts(519_330, 0).saturating_mul(x.into())) - // Standard Error: 23_541 - .saturating_add(Weight::from_parts(547_382, 0).saturating_mul(y.into())) - // Standard Error: 47_040 - .saturating_add(Weight::from_parts(10_939_685, 0).saturating_mul(z.into())) + // Estimated: `12362 + x * (2539 ±0) + y * (2539 ±0) + z * (2603 ±1)` + // Minimum execution time: 275_061_000 picoseconds. + Weight::from_parts(565_248, 12362) + // Standard Error: 15_948 + .saturating_add(Weight::from_parts(1_636_348, 0).saturating_mul(x.into())) + // Standard Error: 15_761 + .saturating_add(Weight::from_parts(1_580_146, 0).saturating_mul(y.into())) + // Standard Error: 31_496 + .saturating_add(Weight::from_parts(17_217_382, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(y.into()))) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(z.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(z.into()))) - .saturating_add(Weight::from_parts(0, 2587).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 2590).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 3113).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 2539).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2539).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(z.into())) } /// Storage: Alliance Rule (r:0 w:1) /// Proof: Alliance Rule (max_values: Some(1), max_size: Some(87), added: 582, mode: MaxEncodedLen) @@ -719,8 +716,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_129_000 picoseconds. - Weight::from_parts(10_370_000, 0) + // Minimum execution time: 10_261_000 picoseconds. + Weight::from_parts(10_389_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Alliance Announcements (r:1 w:1) @@ -729,8 +726,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `246` // Estimated: `10187` - // Minimum execution time: 13_601_000 picoseconds. - Weight::from_parts(13_823_000, 10187) + // Minimum execution time: 13_483_000 picoseconds. + Weight::from_parts(13_805_000, 10187) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -740,8 +737,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319` // Estimated: `10187` - // Minimum execution time: 14_953_000 picoseconds. - Weight::from_parts(15_239_000, 10187) + // Minimum execution time: 14_816_000 picoseconds. + Weight::from_parts(15_163_000, 10187) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -756,9 +753,9 @@ impl WeightInfo for () { fn join_alliance() -> Weight { // Proof Size summary in bytes: // Measured: `468` - // Estimated: `26328` - // Minimum execution time: 42_947_000 picoseconds. - Weight::from_parts(43_602_000, 26328) + // Estimated: `18048` + // Minimum execution time: 46_149_000 picoseconds. + Weight::from_parts(46_827_000, 18048) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -769,9 +766,9 @@ impl WeightInfo for () { fn nominate_ally() -> Weight { // Proof Size summary in bytes: // Measured: `367` - // Estimated: `22735` - // Minimum execution time: 28_787_000 picoseconds. - Weight::from_parts(29_286_000, 22735) + // Estimated: `18048` + // Minimum execution time: 28_463_000 picoseconds. + Weight::from_parts(28_730_000, 18048) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -786,9 +783,9 @@ impl WeightInfo for () { fn elevate_ally() -> Weight { // Proof Size summary in bytes: // Measured: `443` - // Estimated: `15176` - // Minimum execution time: 28_476_000 picoseconds. - Weight::from_parts(28_972_000, 15176) + // Estimated: `12362` + // Minimum execution time: 28_401_000 picoseconds. + Weight::from_parts(28_717_000, 12362) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -805,9 +802,9 @@ impl WeightInfo for () { fn give_retirement_notice() -> Weight { // Proof Size summary in bytes: // Measured: `443` - // Estimated: `26548` - // Minimum execution time: 36_773_000 picoseconds. - Weight::from_parts(38_123_000, 26548) + // Estimated: `23734` + // Minimum execution time: 36_538_000 picoseconds. + Weight::from_parts(37_197_000, 23734) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -822,9 +819,9 @@ impl WeightInfo for () { fn retire() -> Weight { // Proof Size summary in bytes: // Measured: `687` - // Estimated: `17315` - // Minimum execution time: 37_814_000 picoseconds. - Weight::from_parts(38_353_000, 17315) + // Estimated: `6676` + // Minimum execution time: 42_324_000 picoseconds. + Weight::from_parts(42_890_000, 6676) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -843,9 +840,9 @@ impl WeightInfo for () { fn kick_member() -> Weight { // Proof Size summary in bytes: // Measured: `707` - // Estimated: `28776` - // Minimum execution time: 62_194_000 picoseconds. - Weight::from_parts(63_925_000, 28776) + // Estimated: `18048` + // Minimum execution time: 68_003_000 picoseconds. + Weight::from_parts(68_657_000, 18048) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -858,13 +855,13 @@ impl WeightInfo for () { fn add_unscrupulous_items(n: u32, l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `246` - // Estimated: `31874` - // Minimum execution time: 8_369_000 picoseconds. - Weight::from_parts(8_462_000, 31874) - // Standard Error: 3_347 - .saturating_add(Weight::from_parts(1_567_757, 0).saturating_mul(n.into())) - // Standard Error: 1_310 - .saturating_add(Weight::from_parts(72_697, 0).saturating_mul(l.into())) + // Estimated: `27187` + // Minimum execution time: 8_304_000 picoseconds. + Weight::from_parts(8_424_000, 27187) + // Standard Error: 2_765 + .saturating_add(Weight::from_parts(1_529_793, 0).saturating_mul(n.into())) + // Standard Error: 1_082 + .saturating_add(Weight::from_parts(71_352, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -876,14 +873,14 @@ impl WeightInfo for () { /// The range of component `l` is `[0, 255]`. fn remove_unscrupulous_items(n: u32, l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + n * (289 ±0) + l * (100 ±0)` - // Estimated: `31874` - // Minimum execution time: 8_309_000 picoseconds. - Weight::from_parts(8_450_000, 31874) - // Standard Error: 185_163 - .saturating_add(Weight::from_parts(16_348_419, 0).saturating_mul(n.into())) - // Standard Error: 72_518 - .saturating_add(Weight::from_parts(337_571, 0).saturating_mul(l.into())) + // Measured: `0 + l * (100 ±0) + n * (289 ±0)` + // Estimated: `27187` + // Minimum execution time: 8_348_000 picoseconds. + Weight::from_parts(8_505_000, 27187) + // Standard Error: 187_398 + .saturating_add(Weight::from_parts(16_545_597, 0).saturating_mul(n.into())) + // Standard Error: 73_393 + .saturating_add(Weight::from_parts(350_415, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -898,9 +895,9 @@ impl WeightInfo for () { fn abdicate_fellow_status() -> Weight { // Proof Size summary in bytes: // Measured: `443` - // Estimated: `20862` - // Minimum execution time: 35_363_000 picoseconds. - Weight::from_parts(35_665_000, 20862) + // Estimated: `18048` + // Minimum execution time: 34_461_000 picoseconds. + Weight::from_parts(34_992_000, 18048) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } diff --git a/frame/assets/src/weights.rs b/frame/assets/src/weights.rs index 0d6c41b458db0..4cc90e25f43fa 100644 --- a/frame/assets/src/weights.rs +++ b/frame/assets/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_assets //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_assets -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -90,9 +87,9 @@ impl WeightInfo for SubstrateWeight { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `293` - // Estimated: `7268` - // Minimum execution time: 27_756_000 picoseconds. - Weight::from_parts(28_637_000, 7268) + // Estimated: `3675` + // Minimum execution time: 33_678_000 picoseconds. + Weight::from_parts(34_320_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -102,8 +99,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `153` // Estimated: `3675` - // Minimum execution time: 15_402_000 picoseconds. - Weight::from_parts(15_803_000, 3675) + // Minimum execution time: 15_521_000 picoseconds. + Weight::from_parts(16_035_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -113,8 +110,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `385` // Estimated: `3675` - // Minimum execution time: 16_027_000 picoseconds. - Weight::from_parts(16_372_000, 3675) + // Minimum execution time: 15_921_000 picoseconds. + Weight::from_parts(16_153_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -128,16 +125,16 @@ impl WeightInfo for SubstrateWeight { fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` - // Estimated: `8232 + c * (5180 ±0)` - // Minimum execution time: 20_667_000 picoseconds. - Weight::from_parts(20_930_000, 8232) - // Standard Error: 7_226 - .saturating_add(Weight::from_parts(12_759_091, 0).saturating_mul(c.into())) + // Estimated: `3675 + c * (2603 ±0)` + // Minimum execution time: 21_242_000 picoseconds. + Weight::from_parts(21_532_000, 3675) + // Standard Error: 6_449 + .saturating_add(Weight::from_parts(13_150_845, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 5180).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(c.into())) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) @@ -147,11 +144,11 @@ impl WeightInfo for SubstrateWeight { fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `522 + a * (86 ±0)` - // Estimated: `7288 + a * (2623 ±0)` - // Minimum execution time: 20_798_000 picoseconds. - Weight::from_parts(21_129_000, 7288) - // Standard Error: 7_484 - .saturating_add(Weight::from_parts(12_761_996, 0).saturating_mul(a.into())) + // Estimated: `3675 + a * (2623 ±0)` + // Minimum execution time: 21_604_000 picoseconds. + Weight::from_parts(21_881_000, 3675) + // Standard Error: 4_225 + .saturating_add(Weight::from_parts(15_968_205, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -165,9 +162,9 @@ impl WeightInfo for SubstrateWeight { fn finish_destroy() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7280` - // Minimum execution time: 15_870_000 picoseconds. - Weight::from_parts(16_280_000, 7280) + // Estimated: `3675` + // Minimum execution time: 16_465_000 picoseconds. + Weight::from_parts(16_775_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -178,9 +175,9 @@ impl WeightInfo for SubstrateWeight { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7242` - // Minimum execution time: 28_556_000 picoseconds. - Weight::from_parts(28_972_000, 7242) + // Estimated: `3675` + // Minimum execution time: 30_709_000 picoseconds. + Weight::from_parts(31_159_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -191,9 +188,9 @@ impl WeightInfo for SubstrateWeight { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `459` - // Estimated: `7242` - // Minimum execution time: 35_379_000 picoseconds. - Weight::from_parts(35_826_000, 7242) + // Estimated: `3675` + // Minimum execution time: 36_944_000 picoseconds. + Weight::from_parts(38_166_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -206,9 +203,9 @@ impl WeightInfo for SubstrateWeight { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `498` - // Estimated: `13412` - // Minimum execution time: 48_837_000 picoseconds. - Weight::from_parts(49_305_000, 13412) + // Estimated: `6144` + // Minimum execution time: 52_497_000 picoseconds. + Weight::from_parts(53_147_000, 6144) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -221,9 +218,9 @@ impl WeightInfo for SubstrateWeight { fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: // Measured: `498` - // Estimated: `13412` - // Minimum execution time: 43_603_000 picoseconds. - Weight::from_parts(44_142_000, 13412) + // Estimated: `6144` + // Minimum execution time: 46_203_000 picoseconds. + Weight::from_parts(46_853_000, 6144) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -236,9 +233,9 @@ impl WeightInfo for SubstrateWeight { fn force_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `498` - // Estimated: `13412` - // Minimum execution time: 49_691_000 picoseconds. - Weight::from_parts(50_402_000, 13412) + // Estimated: `6144` + // Minimum execution time: 52_911_000 picoseconds. + Weight::from_parts(55_511_000, 6144) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -249,9 +246,9 @@ impl WeightInfo for SubstrateWeight { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `459` - // Estimated: `7242` - // Minimum execution time: 19_600_000 picoseconds. - Weight::from_parts(20_435_000, 7242) + // Estimated: `3675` + // Minimum execution time: 20_308_000 picoseconds. + Weight::from_parts(20_524_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -262,9 +259,9 @@ impl WeightInfo for SubstrateWeight { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `459` - // Estimated: `7242` - // Minimum execution time: 19_396_000 picoseconds. - Weight::from_parts(19_745_000, 7242) + // Estimated: `3675` + // Minimum execution time: 20_735_000 picoseconds. + Weight::from_parts(21_026_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -274,8 +271,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_503_000 picoseconds. - Weight::from_parts(15_788_000, 3675) + // Minimum execution time: 16_148_000 picoseconds. + Weight::from_parts(16_404_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -285,8 +282,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_874_000 picoseconds. - Weight::from_parts(16_190_000, 3675) + // Minimum execution time: 16_075_000 picoseconds. + Weight::from_parts(16_542_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -297,9 +294,9 @@ impl WeightInfo for SubstrateWeight { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7280` - // Minimum execution time: 17_067_000 picoseconds. - Weight::from_parts(17_355_000, 7280) + // Estimated: `3675` + // Minimum execution time: 17_866_000 picoseconds. + Weight::from_parts(18_129_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -309,8 +306,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `351` // Estimated: `3675` - // Minimum execution time: 16_155_000 picoseconds. - Weight::from_parts(16_442_000, 3675) + // Minimum execution time: 16_637_000 picoseconds. + Weight::from_parts(16_918_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -320,12 +317,14 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(_n: u32, _s: u32, ) -> Weight { + fn set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7280` - // Minimum execution time: 27_270_000 picoseconds. - Weight::from_parts(28_634_060, 7280) + // Estimated: `3675` + // Minimum execution time: 33_304_000 picoseconds. + Weight::from_parts(34_764_544, 3675) + // Standard Error: 634 + .saturating_add(Weight::from_parts(4_733, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -336,9 +335,9 @@ impl WeightInfo for SubstrateWeight { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `515` - // Estimated: `7280` - // Minimum execution time: 27_469_000 picoseconds. - Weight::from_parts(27_911_000, 7280) + // Estimated: `3675` + // Minimum execution time: 33_640_000 picoseconds. + Weight::from_parts(34_100_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -348,14 +347,16 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(_n: u32, s: u32, ) -> Weight { + fn force_set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `190` - // Estimated: `7280` - // Minimum execution time: 16_008_000 picoseconds. - Weight::from_parts(17_007_654, 7280) - // Standard Error: 527 - .saturating_add(Weight::from_parts(4_158, 0).saturating_mul(s.into())) + // Estimated: `3675` + // Minimum execution time: 16_549_000 picoseconds. + Weight::from_parts(17_337_982, 3675) + // Standard Error: 586 + .saturating_add(Weight::from_parts(4_584, 0).saturating_mul(n.into())) + // Standard Error: 586 + .saturating_add(Weight::from_parts(4_288, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -366,9 +367,9 @@ impl WeightInfo for SubstrateWeight { fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `515` - // Estimated: `7280` - // Minimum execution time: 27_118_000 picoseconds. - Weight::from_parts(27_776_000, 7280) + // Estimated: `3675` + // Minimum execution time: 34_183_000 picoseconds. + Weight::from_parts(34_577_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -378,8 +379,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `351` // Estimated: `3675` - // Minimum execution time: 14_776_000 picoseconds. - Weight::from_parts(15_281_000, 3675) + // Minimum execution time: 15_505_000 picoseconds. + Weight::from_parts(15_784_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -390,9 +391,9 @@ impl WeightInfo for SubstrateWeight { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `385` - // Estimated: `7288` - // Minimum execution time: 31_324_000 picoseconds. - Weight::from_parts(32_161_000, 7288) + // Estimated: `3675` + // Minimum execution time: 38_762_000 picoseconds. + Weight::from_parts(39_138_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -407,9 +408,9 @@ impl WeightInfo for SubstrateWeight { fn transfer_approved() -> Weight { // Proof Size summary in bytes: // Measured: `668` - // Estimated: `17025` - // Minimum execution time: 63_750_000 picoseconds. - Weight::from_parts(64_828_000, 17025) + // Estimated: `6144` + // Minimum execution time: 73_396_000 picoseconds. + Weight::from_parts(73_986_000, 6144) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -420,9 +421,9 @@ impl WeightInfo for SubstrateWeight { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `555` - // Estimated: `7288` - // Minimum execution time: 32_698_000 picoseconds. - Weight::from_parts(33_309_000, 7288) + // Estimated: `3675` + // Minimum execution time: 39_707_000 picoseconds. + Weight::from_parts(40_222_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -433,9 +434,9 @@ impl WeightInfo for SubstrateWeight { fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `555` - // Estimated: `7288` - // Minimum execution time: 33_147_000 picoseconds. - Weight::from_parts(33_620_000, 7288) + // Estimated: `3675` + // Minimum execution time: 40_357_000 picoseconds. + Weight::from_parts(40_731_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -445,8 +446,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `351` // Estimated: `3675` - // Minimum execution time: 15_910_000 picoseconds. - Weight::from_parts(16_315_000, 3675) + // Minimum execution time: 16_937_000 picoseconds. + Weight::from_parts(17_219_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -461,9 +462,9 @@ impl WeightInfo for () { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `293` - // Estimated: `7268` - // Minimum execution time: 27_756_000 picoseconds. - Weight::from_parts(28_637_000, 7268) + // Estimated: `3675` + // Minimum execution time: 33_678_000 picoseconds. + Weight::from_parts(34_320_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -473,8 +474,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `153` // Estimated: `3675` - // Minimum execution time: 15_402_000 picoseconds. - Weight::from_parts(15_803_000, 3675) + // Minimum execution time: 15_521_000 picoseconds. + Weight::from_parts(16_035_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -484,8 +485,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `385` // Estimated: `3675` - // Minimum execution time: 16_027_000 picoseconds. - Weight::from_parts(16_372_000, 3675) + // Minimum execution time: 15_921_000 picoseconds. + Weight::from_parts(16_153_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -499,16 +500,16 @@ impl WeightInfo for () { fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` - // Estimated: `8232 + c * (5180 ±0)` - // Minimum execution time: 20_667_000 picoseconds. - Weight::from_parts(20_930_000, 8232) - // Standard Error: 7_226 - .saturating_add(Weight::from_parts(12_759_091, 0).saturating_mul(c.into())) + // Estimated: `3675 + c * (2603 ±0)` + // Minimum execution time: 21_242_000 picoseconds. + Weight::from_parts(21_532_000, 3675) + // Standard Error: 6_449 + .saturating_add(Weight::from_parts(13_150_845, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 5180).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(c.into())) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) @@ -518,11 +519,11 @@ impl WeightInfo for () { fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `522 + a * (86 ±0)` - // Estimated: `7288 + a * (2623 ±0)` - // Minimum execution time: 20_798_000 picoseconds. - Weight::from_parts(21_129_000, 7288) - // Standard Error: 7_484 - .saturating_add(Weight::from_parts(12_761_996, 0).saturating_mul(a.into())) + // Estimated: `3675 + a * (2623 ±0)` + // Minimum execution time: 21_604_000 picoseconds. + Weight::from_parts(21_881_000, 3675) + // Standard Error: 4_225 + .saturating_add(Weight::from_parts(15_968_205, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -536,9 +537,9 @@ impl WeightInfo for () { fn finish_destroy() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7280` - // Minimum execution time: 15_870_000 picoseconds. - Weight::from_parts(16_280_000, 7280) + // Estimated: `3675` + // Minimum execution time: 16_465_000 picoseconds. + Weight::from_parts(16_775_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -549,9 +550,9 @@ impl WeightInfo for () { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7242` - // Minimum execution time: 28_556_000 picoseconds. - Weight::from_parts(28_972_000, 7242) + // Estimated: `3675` + // Minimum execution time: 30_709_000 picoseconds. + Weight::from_parts(31_159_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -562,9 +563,9 @@ impl WeightInfo for () { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `459` - // Estimated: `7242` - // Minimum execution time: 35_379_000 picoseconds. - Weight::from_parts(35_826_000, 7242) + // Estimated: `3675` + // Minimum execution time: 36_944_000 picoseconds. + Weight::from_parts(38_166_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -577,9 +578,9 @@ impl WeightInfo for () { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `498` - // Estimated: `13412` - // Minimum execution time: 48_837_000 picoseconds. - Weight::from_parts(49_305_000, 13412) + // Estimated: `6144` + // Minimum execution time: 52_497_000 picoseconds. + Weight::from_parts(53_147_000, 6144) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -592,9 +593,9 @@ impl WeightInfo for () { fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: // Measured: `498` - // Estimated: `13412` - // Minimum execution time: 43_603_000 picoseconds. - Weight::from_parts(44_142_000, 13412) + // Estimated: `6144` + // Minimum execution time: 46_203_000 picoseconds. + Weight::from_parts(46_853_000, 6144) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -607,9 +608,9 @@ impl WeightInfo for () { fn force_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `498` - // Estimated: `13412` - // Minimum execution time: 49_691_000 picoseconds. - Weight::from_parts(50_402_000, 13412) + // Estimated: `6144` + // Minimum execution time: 52_911_000 picoseconds. + Weight::from_parts(55_511_000, 6144) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -620,9 +621,9 @@ impl WeightInfo for () { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `459` - // Estimated: `7242` - // Minimum execution time: 19_600_000 picoseconds. - Weight::from_parts(20_435_000, 7242) + // Estimated: `3675` + // Minimum execution time: 20_308_000 picoseconds. + Weight::from_parts(20_524_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -633,9 +634,9 @@ impl WeightInfo for () { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `459` - // Estimated: `7242` - // Minimum execution time: 19_396_000 picoseconds. - Weight::from_parts(19_745_000, 7242) + // Estimated: `3675` + // Minimum execution time: 20_735_000 picoseconds. + Weight::from_parts(21_026_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -645,8 +646,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_503_000 picoseconds. - Weight::from_parts(15_788_000, 3675) + // Minimum execution time: 16_148_000 picoseconds. + Weight::from_parts(16_404_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -656,8 +657,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_874_000 picoseconds. - Weight::from_parts(16_190_000, 3675) + // Minimum execution time: 16_075_000 picoseconds. + Weight::from_parts(16_542_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -668,9 +669,9 @@ impl WeightInfo for () { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7280` - // Minimum execution time: 17_067_000 picoseconds. - Weight::from_parts(17_355_000, 7280) + // Estimated: `3675` + // Minimum execution time: 17_866_000 picoseconds. + Weight::from_parts(18_129_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -680,8 +681,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `351` // Estimated: `3675` - // Minimum execution time: 16_155_000 picoseconds. - Weight::from_parts(16_442_000, 3675) + // Minimum execution time: 16_637_000 picoseconds. + Weight::from_parts(16_918_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -691,12 +692,14 @@ impl WeightInfo for () { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(_n: u32, _s: u32, ) -> Weight { + fn set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7280` - // Minimum execution time: 27_270_000 picoseconds. - Weight::from_parts(28_634_060, 7280) + // Estimated: `3675` + // Minimum execution time: 33_304_000 picoseconds. + Weight::from_parts(34_764_544, 3675) + // Standard Error: 634 + .saturating_add(Weight::from_parts(4_733, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -707,9 +710,9 @@ impl WeightInfo for () { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `515` - // Estimated: `7280` - // Minimum execution time: 27_469_000 picoseconds. - Weight::from_parts(27_911_000, 7280) + // Estimated: `3675` + // Minimum execution time: 33_640_000 picoseconds. + Weight::from_parts(34_100_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -719,14 +722,16 @@ impl WeightInfo for () { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(_n: u32, s: u32, ) -> Weight { + fn force_set_metadata(n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `190` - // Estimated: `7280` - // Minimum execution time: 16_008_000 picoseconds. - Weight::from_parts(17_007_654, 7280) - // Standard Error: 527 - .saturating_add(Weight::from_parts(4_158, 0).saturating_mul(s.into())) + // Estimated: `3675` + // Minimum execution time: 16_549_000 picoseconds. + Weight::from_parts(17_337_982, 3675) + // Standard Error: 586 + .saturating_add(Weight::from_parts(4_584, 0).saturating_mul(n.into())) + // Standard Error: 586 + .saturating_add(Weight::from_parts(4_288, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -737,9 +742,9 @@ impl WeightInfo for () { fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `515` - // Estimated: `7280` - // Minimum execution time: 27_118_000 picoseconds. - Weight::from_parts(27_776_000, 7280) + // Estimated: `3675` + // Minimum execution time: 34_183_000 picoseconds. + Weight::from_parts(34_577_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -749,8 +754,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `351` // Estimated: `3675` - // Minimum execution time: 14_776_000 picoseconds. - Weight::from_parts(15_281_000, 3675) + // Minimum execution time: 15_505_000 picoseconds. + Weight::from_parts(15_784_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -761,9 +766,9 @@ impl WeightInfo for () { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `385` - // Estimated: `7288` - // Minimum execution time: 31_324_000 picoseconds. - Weight::from_parts(32_161_000, 7288) + // Estimated: `3675` + // Minimum execution time: 38_762_000 picoseconds. + Weight::from_parts(39_138_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -778,9 +783,9 @@ impl WeightInfo for () { fn transfer_approved() -> Weight { // Proof Size summary in bytes: // Measured: `668` - // Estimated: `17025` - // Minimum execution time: 63_750_000 picoseconds. - Weight::from_parts(64_828_000, 17025) + // Estimated: `6144` + // Minimum execution time: 73_396_000 picoseconds. + Weight::from_parts(73_986_000, 6144) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -791,9 +796,9 @@ impl WeightInfo for () { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `555` - // Estimated: `7288` - // Minimum execution time: 32_698_000 picoseconds. - Weight::from_parts(33_309_000, 7288) + // Estimated: `3675` + // Minimum execution time: 39_707_000 picoseconds. + Weight::from_parts(40_222_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -804,9 +809,9 @@ impl WeightInfo for () { fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `555` - // Estimated: `7288` - // Minimum execution time: 33_147_000 picoseconds. - Weight::from_parts(33_620_000, 7288) + // Estimated: `3675` + // Minimum execution time: 40_357_000 picoseconds. + Weight::from_parts(40_731_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -816,8 +821,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `351` // Estimated: `3675` - // Minimum execution time: 15_910_000 picoseconds. - Weight::from_parts(16_315_000, 3675) + // Minimum execution time: 16_937_000 picoseconds. + Weight::from_parts(17_219_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/bags-list/src/weights.rs b/frame/bags-list/src/weights.rs index 30efe1ef0cb38..f2b65beba2c80 100644 --- a/frame/bags-list/src/weights.rs +++ b/frame/bags-list/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_bags_list //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_bags_list -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -70,9 +67,9 @@ impl WeightInfo for SubstrateWeight { fn rebag_non_terminal() -> Weight { // Proof Size summary in bytes: // Measured: `1724` - // Estimated: `23146` - // Minimum execution time: 63_526_000 picoseconds. - Weight::from_parts(64_125_000, 23146) + // Estimated: `11506` + // Minimum execution time: 63_335_000 picoseconds. + Weight::from_parts(64_097_000, 11506) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -87,9 +84,9 @@ impl WeightInfo for SubstrateWeight { fn rebag_terminal() -> Weight { // Proof Size summary in bytes: // Measured: `1618` - // Estimated: `23074` - // Minimum execution time: 62_404_000 picoseconds. - Weight::from_parts(63_178_000, 23074) + // Estimated: `8877` + // Minimum execution time: 62_151_000 picoseconds. + Weight::from_parts(62_827_000, 8877) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -106,9 +103,9 @@ impl WeightInfo for SubstrateWeight { fn put_in_front_of() -> Weight { // Proof Size summary in bytes: // Measured: `1930` - // Estimated: `30748` - // Minimum execution time: 69_938_000 picoseconds. - Weight::from_parts(70_723_000, 30748) + // Estimated: `11506` + // Minimum execution time: 69_179_000 picoseconds. + Weight::from_parts(69_898_000, 11506) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -127,9 +124,9 @@ impl WeightInfo for () { fn rebag_non_terminal() -> Weight { // Proof Size summary in bytes: // Measured: `1724` - // Estimated: `23146` - // Minimum execution time: 63_526_000 picoseconds. - Weight::from_parts(64_125_000, 23146) + // Estimated: `11506` + // Minimum execution time: 63_335_000 picoseconds. + Weight::from_parts(64_097_000, 11506) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -144,9 +141,9 @@ impl WeightInfo for () { fn rebag_terminal() -> Weight { // Proof Size summary in bytes: // Measured: `1618` - // Estimated: `23074` - // Minimum execution time: 62_404_000 picoseconds. - Weight::from_parts(63_178_000, 23074) + // Estimated: `8877` + // Minimum execution time: 62_151_000 picoseconds. + Weight::from_parts(62_827_000, 8877) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -163,9 +160,9 @@ impl WeightInfo for () { fn put_in_front_of() -> Weight { // Proof Size summary in bytes: // Measured: `1930` - // Estimated: `30748` - // Minimum execution time: 69_938_000 picoseconds. - Weight::from_parts(70_723_000, 30748) + // Estimated: `11506` + // Minimum execution time: 69_179_000 picoseconds. + Weight::from_parts(69_898_000, 11506) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } diff --git a/frame/balances/src/weights.rs b/frame/balances/src/weights.rs index a2a9f0019b931..f35d9c697028b 100644 --- a/frame/balances/src/weights.rs +++ b/frame/balances/src/weights.rs @@ -18,26 +18,25 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: -// target/production/substrate +// ./target/production/substrate // benchmark // pallet +// --chain=dev // --steps=50 // --repeat=20 +// --pallet=pallet_balances // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json -// --pallet=pallet_balances -// --chain=dev -// --header=./HEADER-APACHE2 // --output=./frame/balances/src/weights.rs +// --header=./HEADER-APACHE2 // --template=./.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -68,8 +67,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 36_551_000 picoseconds. - Weight::from_parts(37_150_000, 3593) + // Minimum execution time: 59_458_000 picoseconds. + Weight::from_parts(60_307_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -79,8 +78,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_246_000 picoseconds. - Weight::from_parts(28_647_000, 3593) + // Minimum execution time: 43_056_000 picoseconds. + Weight::from_parts(43_933_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -90,8 +89,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 17_407_000 picoseconds. - Weight::from_parts(17_827_000, 3593) + // Minimum execution time: 17_428_000 picoseconds. + Weight::from_parts(17_731_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -101,8 +100,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 20_941_000 picoseconds. - Weight::from_parts(21_383_000, 3593) + // Minimum execution time: 22_809_000 picoseconds. + Weight::from_parts(23_225_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -112,8 +111,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 38_741_000 picoseconds. - Weight::from_parts(39_201_000, 6196) + // Minimum execution time: 56_929_000 picoseconds. + Weight::from_parts(57_688_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -123,8 +122,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 33_791_000 picoseconds. - Weight::from_parts(34_500_000, 3593) + // Minimum execution time: 49_820_000 picoseconds. + Weight::from_parts(50_832_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -134,8 +133,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 16_538_000 picoseconds. - Weight::from_parts(16_859_000, 3593) + // Minimum execution time: 20_270_000 picoseconds. + Weight::from_parts(20_597_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -146,10 +145,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0 + u * (135 ±0)` // Estimated: `990 + u * (2603 ±0)` - // Minimum execution time: 19_851_000 picoseconds. - Weight::from_parts(20_099_000, 990) - // Standard Error: 15_586 - .saturating_add(Weight::from_parts(14_892_860, 0).saturating_mul(u.into())) + // Minimum execution time: 19_847_000 picoseconds. + Weight::from_parts(20_053_000, 990) + // Standard Error: 11_643 + .saturating_add(Weight::from_parts(14_563_782, 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())) @@ -164,8 +163,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 36_551_000 picoseconds. - Weight::from_parts(37_150_000, 3593) + // Minimum execution time: 59_458_000 picoseconds. + Weight::from_parts(60_307_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -175,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_246_000 picoseconds. - Weight::from_parts(28_647_000, 3593) + // Minimum execution time: 43_056_000 picoseconds. + Weight::from_parts(43_933_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -186,8 +185,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 17_407_000 picoseconds. - Weight::from_parts(17_827_000, 3593) + // Minimum execution time: 17_428_000 picoseconds. + Weight::from_parts(17_731_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -197,8 +196,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 20_941_000 picoseconds. - Weight::from_parts(21_383_000, 3593) + // Minimum execution time: 22_809_000 picoseconds. + Weight::from_parts(23_225_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -208,8 +207,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 38_741_000 picoseconds. - Weight::from_parts(39_201_000, 6196) + // Minimum execution time: 56_929_000 picoseconds. + Weight::from_parts(57_688_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -219,8 +218,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 33_791_000 picoseconds. - Weight::from_parts(34_500_000, 3593) + // Minimum execution time: 49_820_000 picoseconds. + Weight::from_parts(50_832_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -230,8 +229,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 16_538_000 picoseconds. - Weight::from_parts(16_859_000, 3593) + // Minimum execution time: 20_270_000 picoseconds. + Weight::from_parts(20_597_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -242,10 +241,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0 + u * (135 ±0)` // Estimated: `990 + u * (2603 ±0)` - // Minimum execution time: 19_851_000 picoseconds. - Weight::from_parts(20_099_000, 990) - // Standard Error: 15_586 - .saturating_add(Weight::from_parts(14_892_860, 0).saturating_mul(u.into())) + // Minimum execution time: 19_847_000 picoseconds. + Weight::from_parts(20_053_000, 990) + // Standard Error: 11_643 + .saturating_add(Weight::from_parts(14_563_782, 0).saturating_mul(u.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(u.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) diff --git a/frame/benchmarking/pov/src/benchmarking.rs b/frame/benchmarking/pov/src/benchmarking.rs index 46a98ae3ff183..27191e37219fd 100644 --- a/frame/benchmarking/pov/src/benchmarking.rs +++ b/frame/benchmarking/pov/src/benchmarking.rs @@ -192,6 +192,7 @@ frame_benchmarking::benchmarks! { // Same as above, but we still expect a mathematical worst case PoV size for the bounded one. storage_value_bounded_and_unbounded_read { + (0..1024).for_each(|i| Map1M::::insert(i, i)); }: { assert!(UnboundedValue::::get().is_none()); assert!(BoundedValue::::get().is_none()); diff --git a/frame/benchmarking/pov/src/tests.rs b/frame/benchmarking/pov/src/tests.rs index 19156b93060bc..b908925cccd8e 100644 --- a/frame/benchmarking/pov/src/tests.rs +++ b/frame/benchmarking/pov/src/tests.rs @@ -144,9 +144,9 @@ fn unbounded_read_best_effort() { fn partial_unbounded_read_best_effort() { let w_unbounded = W::storage_value_unbounded_read().proof_size(); let w_bounded = W::storage_value_bounded_read().proof_size(); - let w_partial = W::storage_value_bounded_and_unbounded_read().proof_size(); + let w_both = W::storage_value_bounded_and_unbounded_read().proof_size(); - assert_eq!(w_bounded + w_unbounded, w_partial, "The bounded part increases the PoV"); + assert!(w_both > w_bounded && w_both > w_unbounded, "The bounded part increases the PoV"); } #[test] diff --git a/frame/benchmarking/pov/src/weights.rs b/frame/benchmarking/pov/src/weights.rs index df6dba33b2dd3..f16ac7fbc2733 100644 --- a/frame/benchmarking/pov/src/weights.rs +++ b/frame/benchmarking/pov/src/weights.rs @@ -2,7 +2,7 @@ //! Autogenerated weights for frame_benchmarking_pallet_pov //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `i9`, CPU: `13th Gen Intel(R) Core(TM) i9-13900K` //! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 @@ -28,7 +28,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions needed for frame_benchmarking_pallet_pov. pub trait WeightInfo { @@ -61,6 +61,7 @@ pub trait WeightInfo { fn storage_map_partial_unbounded_ignored_read(i: u32, ) -> Weight; fn emit_event() -> Weight; fn noop() -> Weight; + fn storage_iteration() -> Weight; } /// Weights for frame_benchmarking_pallet_pov using the Substrate node and recommended hardware. @@ -72,9 +73,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `1489` - // Minimum execution time: 1_968 nanoseconds. - Weight::from_parts(2_060_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) + // Minimum execution time: 1_706_000 picoseconds. + Weight::from_parts(1_788_000, 1489) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov Value (r:1 w:0) @@ -83,9 +83,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `0` - // Minimum execution time: 1_934 nanoseconds. - Weight::from_parts(2_092_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 1_661_000 picoseconds. + Weight::from_parts(1_718_000, 0) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov Value (r:1 w:0) @@ -95,10 +94,9 @@ impl WeightInfo for SubstrateWeight { fn storage_single_value_ignored_some_read() -> Weight { // Proof Size summary in bytes: // Measured: `160` - // Estimated: `1649` - // Minimum execution time: 2_605 nanoseconds. - Weight::from_parts(2_786_000, 0) - .saturating_add(Weight::from_parts(0, 1649)) + // Estimated: `1489` + // Minimum execution time: 2_226_000 picoseconds. + Weight::from_parts(2_365_000, 1489) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: Pov Value (r:1 w:0) @@ -107,9 +105,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `136` // Estimated: `1489` - // Minimum execution time: 2_019 nanoseconds. - Weight::from_parts(2_214_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) + // Minimum execution time: 1_785_000 picoseconds. + Weight::from_parts(1_980_000, 1489) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov Value (r:0 w:1) @@ -118,9 +115,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 279 nanoseconds. - Weight::from_parts(357_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 254_000 picoseconds. + Weight::from_parts(326_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Pov Value (r:0 w:1) @@ -129,9 +125,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 291 nanoseconds. - Weight::from_parts(378_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 239_000 picoseconds. + Weight::from_parts(277_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Pov Map1M (r:1 w:0) @@ -140,9 +135,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1275` // Estimated: `4740` - // Minimum execution time: 5_077 nanoseconds. - Weight::from_parts(5_400_000, 0) - .saturating_add(Weight::from_parts(0, 4740)) + // Minimum execution time: 4_760_000 picoseconds. + Weight::from_parts(5_051_000, 4740) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov Map1M (r:1 w:0) @@ -151,9 +145,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1544` // Estimated: `5009` - // Minimum execution time: 5_878 nanoseconds. - Weight::from_parts(6_239_000, 0) - .saturating_add(Weight::from_parts(0, 5009)) + // Minimum execution time: 5_490_000 picoseconds. + Weight::from_parts(5_703_000, 5009) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov Map1M (r:1 w:0) @@ -162,9 +155,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2044` // Estimated: `5509` - // Minimum execution time: 7_282 nanoseconds. - Weight::from_parts(8_022_000, 0) - .saturating_add(Weight::from_parts(0, 5509)) + // Minimum execution time: 6_397_000 picoseconds. + Weight::from_parts(7_084_000, 5509) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov Map1M (r:100 w:0) @@ -175,19 +167,18 @@ impl WeightInfo for SubstrateWeight { /// The range of component `m` is `[0, 100]`. fn storage_map_read_per_component(n: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `515 + n * (188 ±0) + m * (188 ±0)` - // Estimated: `1980 + n * (3006 ±0) + m * (2511 ±0)` - // Minimum execution time: 195_406 nanoseconds. - Weight::from_parts(129_093_464, 0) - .saturating_add(Weight::from_parts(0, 1980)) - // Standard Error: 12_134 - .saturating_add(Weight::from_parts(855_330, 0).saturating_mul(n.into())) - // Standard Error: 12_134 - .saturating_add(Weight::from_parts(870_523, 0).saturating_mul(m.into())) + // Measured: `515 + m * (188 ±0) + n * (188 ±0)` + // Estimated: `990 + m * (2511 ±0) + n * (3006 ±0)` + // Minimum execution time: 181_481_000 picoseconds. + Weight::from_parts(129_275_141, 990) + // Standard Error: 13_049 + .saturating_add(Weight::from_parts(787_667, 0).saturating_mul(n.into())) + // Standard Error: 13_049 + .saturating_add(Weight::from_parts(830_378, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_parts(0, 3006).saturating_mul(n.into())) .saturating_add(Weight::from_parts(0, 2511).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 3006).saturating_mul(n.into())) } /// Storage: Pov Map1M (r:100 w:0) /// Proof: Pov Map1M (max_values: Some(1000000), max_size: Some(36), added: 2511, mode: Ignored) @@ -197,19 +188,18 @@ impl WeightInfo for SubstrateWeight { /// The range of component `m` is `[0, 100]`. fn storage_map_read_per_component_one_ignored(n: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `515 + n * (188 ±0) + m * (188 ±0)` - // Estimated: `1685 + n * (3195 ±0) + m * (189 ±0)` - // Minimum execution time: 195_053 nanoseconds. - Weight::from_parts(131_322_479, 0) - .saturating_add(Weight::from_parts(0, 1685)) - // Standard Error: 12_161 - .saturating_add(Weight::from_parts(843_047, 0).saturating_mul(n.into())) - // Standard Error: 12_161 - .saturating_add(Weight::from_parts(858_668, 0).saturating_mul(m.into())) + // Measured: `515 + m * (188 ±0) + n * (188 ±0)` + // Estimated: `1685 + m * (189 ±0) + n * (3006 ±0)` + // Minimum execution time: 181_925_000 picoseconds. + Weight::from_parts(134_416_814, 1685) + // Standard Error: 15_678 + .saturating_add(Weight::from_parts(827_168, 0).saturating_mul(n.into())) + // Standard Error: 15_678 + .saturating_add(Weight::from_parts(813_655, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_parts(0, 3195).saturating_mul(n.into())) .saturating_add(Weight::from_parts(0, 189).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 3006).saturating_mul(n.into())) } /// Storage: Pov Map1M (r:1 w:0) /// Proof: Pov Map1M (max_values: Some(1000000), max_size: Some(36), added: 2511, mode: MaxEncodedLen) @@ -218,11 +208,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `170` // Estimated: `3501` - // Minimum execution time: 22 nanoseconds. - Weight::from_parts(2_334_945, 0) - .saturating_add(Weight::from_parts(0, 3501)) - // Standard Error: 624 - .saturating_add(Weight::from_parts(282_046, 0).saturating_mul(n.into())) + // Minimum execution time: 20_000 picoseconds. + Weight::from_parts(2_006_399, 3501) + // Standard Error: 808 + .saturating_add(Weight::from_parts(263_609, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov Map1M (r:100 w:0) @@ -232,11 +221,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `147 + n * (40 ±0)` // Estimated: `990 + n * (2511 ±0)` - // Minimum execution time: 20 nanoseconds. - Weight::from_parts(525_027, 0) - .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 2_767 - .saturating_add(Weight::from_parts(3_887_350, 0).saturating_mul(n.into())) + // Minimum execution time: 21_000 picoseconds. + Weight::from_parts(3_940_044, 990) + // Standard Error: 4_906 + .saturating_add(Weight::from_parts(3_454_882, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2511).saturating_mul(n.into())) } @@ -247,11 +235,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `21938 + n * (57 ±0)` // Estimated: `990 + n * (2543 ±0)` - // Minimum execution time: 34 nanoseconds. - Weight::from_parts(18_341_393, 0) - .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 1_312 - .saturating_add(Weight::from_parts(2_053_135, 0).saturating_mul(n.into())) + // Minimum execution time: 28_000 picoseconds. + Weight::from_parts(20_674_869, 990) + // Standard Error: 3_035 + .saturating_add(Weight::from_parts(1_995_730, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2543).saturating_mul(n.into())) } @@ -261,9 +248,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1518` - // Minimum execution time: 1_163 nanoseconds. - Weight::from_parts(1_274_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) + // Minimum execution time: 1_091_000 picoseconds. + Weight::from_parts(1_181_000, 1518) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov UnboundedValue (r:1 w:0) @@ -272,9 +258,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 1_167 nanoseconds. - Weight::from_parts(1_367_000, 0) - .saturating_add(Weight::from_parts(0, 1594)) + // Minimum execution time: 1_079_000 picoseconds. + Weight::from_parts(1_176_000, 1594) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov UnboundedValue (r:1 w:0) @@ -283,9 +268,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `0` - // Minimum execution time: 1_155 nanoseconds. - Weight::from_parts(1_248_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 1_101_000 picoseconds. + Weight::from_parts(1_160_000, 0) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov UnboundedValue (r:1 w:0) @@ -294,11 +278,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Pov BoundedValue (max_values: Some(1), max_size: Some(33), added: 528, mode: MaxEncodedLen) fn storage_value_bounded_and_unbounded_read() -> Weight { // Proof Size summary in bytes: - // Measured: `109` - // Estimated: `3112` - // Minimum execution time: 1_424 nanoseconds. - Weight::from_parts(1_601_000, 0) - .saturating_add(Weight::from_parts(0, 3112)) + // Measured: `147` + // Estimated: `1632` + // Minimum execution time: 2_143_000 picoseconds. + Weight::from_parts(2_280_000, 1632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: Pov LargeValue (r:1 w:0) @@ -306,13 +289,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `l` is `[0, 4194304]`. fn measured_storage_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `174 + l * (1 ±0)` - // Estimated: `1656 + l * (1 ±0)` - // Minimum execution time: 1_744 nanoseconds. - Weight::from_parts(1_800_000, 0) - .saturating_add(Weight::from_parts(0, 1656)) - // Standard Error: 4 - .saturating_add(Weight::from_parts(443, 0).saturating_mul(l.into())) + // Measured: `142 + l * (1 ±0)` + // Estimated: `1626 + l * (1 ±0)` + // Minimum execution time: 1_665_000 picoseconds. + Weight::from_parts(1_725_000, 1626) + // Standard Error: 3 + .saturating_add(Weight::from_parts(376, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(l.into())) } @@ -321,13 +303,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `l` is `[0, 4194304]`. fn mel_storage_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `174 + l * (1 ±0)` + // Measured: `142 + l * (1 ±0)` // Estimated: `4195793` - // Minimum execution time: 1_770 nanoseconds. - Weight::from_parts(1_813_000, 0) - .saturating_add(Weight::from_parts(0, 4195793)) - // Standard Error: 6 - .saturating_add(Weight::from_parts(495, 0).saturating_mul(l.into())) + // Minimum execution time: 1_640_000 picoseconds. + Weight::from_parts(1_724_000, 4195793) + // Standard Error: 4 + .saturating_add(Weight::from_parts(395, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Pov LargeValue (r:1 w:0) @@ -337,15 +318,14 @@ impl WeightInfo for SubstrateWeight { /// The range of component `l` is `[0, 4194304]`. fn measured_storage_double_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235 + l * (2 ±0)` - // Estimated: `3428 + l * (4 ±0)` - // Minimum execution time: 2_349 nanoseconds. - Weight::from_parts(2_423_000, 0) - .saturating_add(Weight::from_parts(0, 3428)) - // Standard Error: 11 - .saturating_add(Weight::from_parts(950, 0).saturating_mul(l.into())) + // Measured: `171 + l * (2 ±0)` + // Estimated: `1655 + l * (2 ±0)` + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(2_358_000, 1655) + // Standard Error: 8 + .saturating_add(Weight::from_parts(737, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(Weight::from_parts(0, 4).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(0, 2).saturating_mul(l.into())) } /// Storage: Pov LargeValue (r:1 w:0) /// Proof: Pov LargeValue (max_values: Some(1), max_size: Some(4194308), added: 4194803, mode: MaxEncodedLen) @@ -354,13 +334,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `l` is `[0, 4194304]`. fn mel_storage_double_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235 + l * (2 ±0)` - // Estimated: `8391586` - // Minimum execution time: 2_315 nanoseconds. - Weight::from_parts(2_409_000, 0) - .saturating_add(Weight::from_parts(0, 8391586)) - // Standard Error: 12 - .saturating_add(Weight::from_parts(984, 0).saturating_mul(l.into())) + // Measured: `171 + l * (2 ±0)` + // Estimated: `4195793` + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_233_000, 4195793) + // Standard Error: 5 + .saturating_add(Weight::from_parts(639, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: Pov LargeValue (r:1 w:0) @@ -370,13 +349,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `l` is `[0, 4194304]`. fn mel_mixed_storage_double_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235 + l * (2 ±0)` - // Estimated: `4197507 + l * (2 ±0)` - // Minimum execution time: 2_370 nanoseconds. - Weight::from_parts(2_474_000, 0) - .saturating_add(Weight::from_parts(0, 4197507)) - // Standard Error: 11 - .saturating_add(Weight::from_parts(956, 0).saturating_mul(l.into())) + // Measured: `171 + l * (2 ±0)` + // Estimated: `4195793 + l * (2 ±0)` + // Minimum execution time: 2_149_000 picoseconds. + Weight::from_parts(2_256_000, 4195793) + // Standard Error: 6 + .saturating_add(Weight::from_parts(677, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 2).saturating_mul(l.into())) } @@ -387,13 +365,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `l` is `[0, 4194304]`. fn measured_mixed_storage_double_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235 + l * (2 ±0)` - // Estimated: `4197507 + l * (2 ±0)` - // Minimum execution time: 2_375 nanoseconds. - Weight::from_parts(2_420_000, 0) - .saturating_add(Weight::from_parts(0, 4197507)) - // Standard Error: 9 - .saturating_add(Weight::from_parts(914, 0).saturating_mul(l.into())) + // Measured: `171 + l * (2 ±0)` + // Estimated: `4195793 + l * (2 ±0)` + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_319_000, 4195793) + // Standard Error: 5 + .saturating_add(Weight::from_parts(664, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 2).saturating_mul(l.into())) } @@ -404,15 +381,14 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[0, 1000]`. fn storage_map_unbounded_both_measured_read(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `293 + i * (8 ±0)` - // Estimated: `7504 + i * (16 ±0)` - // Minimum execution time: 3_305 nanoseconds. - Weight::from_parts(3_689_335, 0) - .saturating_add(Weight::from_parts(0, 7504)) - // Standard Error: 29 - .saturating_add(Weight::from_parts(638, 0).saturating_mul(i.into())) + // Measured: `229 + i * (8 ±0)` + // Estimated: `3693 + i * (8 ±0)` + // Minimum execution time: 3_071_000 picoseconds. + Weight::from_parts(3_487_712, 3693) + // Standard Error: 26 + .saturating_add(Weight::from_parts(748, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(Weight::from_parts(0, 16).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(i.into())) } /// Storage: Pov Map1M (r:1 w:0) /// Proof: Pov Map1M (max_values: Some(1000000), max_size: Some(36), added: 2511, mode: MaxEncodedLen) @@ -421,13 +397,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[0, 1000]`. fn storage_map_partial_unbounded_read(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `260 + i * (4 ±0)` - // Estimated: `7223 + i * (4 ±0)` - // Minimum execution time: 3_469 nanoseconds. - Weight::from_parts(3_878_896, 0) - .saturating_add(Weight::from_parts(0, 7223)) - // Standard Error: 33 - .saturating_add(Weight::from_parts(356, 0).saturating_mul(i.into())) + // Measured: `228 + i * (4 ±0)` + // Estimated: `3692 + i * (4 ±0)` + // Minimum execution time: 3_150_000 picoseconds. + Weight::from_parts(3_582_963, 3692) + // Standard Error: 18 + .saturating_add(Weight::from_parts(380, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 4).saturating_mul(i.into())) } @@ -438,13 +413,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[0, 1000]`. fn storage_map_partial_unbounded_ignored_read(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `260 + i * (4 ±0)` - // Estimated: `3758 + i * (4 ±0)` - // Minimum execution time: 3_442 nanoseconds. - Weight::from_parts(3_881_051, 0) - .saturating_add(Weight::from_parts(0, 3758)) - // Standard Error: 35 - .saturating_add(Weight::from_parts(384, 0).saturating_mul(i.into())) + // Measured: `228 + i * (4 ±0)` + // Estimated: `3501 + i * (4 ±0)` + // Minimum execution time: 3_092_000 picoseconds. + Weight::from_parts(3_595_328, 3501) + // Standard Error: 20 + .saturating_add(Weight::from_parts(243, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 4).saturating_mul(i.into())) } @@ -452,17 +426,25 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_619 nanoseconds. - Weight::from_parts(1_728_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 1_705_000 picoseconds. + Weight::from_parts(1_818_000, 0) } fn noop() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 546 nanoseconds. - Weight::from_parts(640_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 533_000 picoseconds. + Weight::from_parts(587_000, 0) + } + /// Storage: Pov UnboundedMapTwox (r:65001 w:0) + /// Proof Skipped: Pov UnboundedMapTwox (max_values: None, max_size: None, mode: Measured) + fn storage_iteration() -> Weight { + // Proof Size summary in bytes: + // Measured: `17985289` + // Estimated: `178863754` + // Minimum execution time: 118_753_057_000 picoseconds. + Weight::from_parts(121_396_503_000, 178863754) + .saturating_add(T::DbWeight::get().reads(65001_u64)) } } @@ -474,9 +456,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `136` // Estimated: `1489` - // Minimum execution time: 1_968 nanoseconds. - Weight::from_parts(2_060_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) + // Minimum execution time: 1_706_000 picoseconds. + Weight::from_parts(1_788_000, 1489) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov Value (r:1 w:0) @@ -485,9 +466,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `136` // Estimated: `0` - // Minimum execution time: 1_934 nanoseconds. - Weight::from_parts(2_092_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 1_661_000 picoseconds. + Weight::from_parts(1_718_000, 0) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov Value (r:1 w:0) @@ -497,10 +477,9 @@ impl WeightInfo for () { fn storage_single_value_ignored_some_read() -> Weight { // Proof Size summary in bytes: // Measured: `160` - // Estimated: `1649` - // Minimum execution time: 2_605 nanoseconds. - Weight::from_parts(2_786_000, 0) - .saturating_add(Weight::from_parts(0, 1649)) + // Estimated: `1489` + // Minimum execution time: 2_226_000 picoseconds. + Weight::from_parts(2_365_000, 1489) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: Pov Value (r:1 w:0) @@ -509,9 +488,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `136` // Estimated: `1489` - // Minimum execution time: 2_019 nanoseconds. - Weight::from_parts(2_214_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) + // Minimum execution time: 1_785_000 picoseconds. + Weight::from_parts(1_980_000, 1489) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov Value (r:0 w:1) @@ -520,9 +498,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 279 nanoseconds. - Weight::from_parts(357_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 254_000 picoseconds. + Weight::from_parts(326_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Pov Value (r:0 w:1) @@ -531,9 +508,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 291 nanoseconds. - Weight::from_parts(378_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 239_000 picoseconds. + Weight::from_parts(277_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Pov Map1M (r:1 w:0) @@ -542,9 +518,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1275` // Estimated: `4740` - // Minimum execution time: 5_077 nanoseconds. - Weight::from_parts(5_400_000, 0) - .saturating_add(Weight::from_parts(0, 4740)) + // Minimum execution time: 4_760_000 picoseconds. + Weight::from_parts(5_051_000, 4740) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov Map1M (r:1 w:0) @@ -553,9 +528,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1544` // Estimated: `5009` - // Minimum execution time: 5_878 nanoseconds. - Weight::from_parts(6_239_000, 0) - .saturating_add(Weight::from_parts(0, 5009)) + // Minimum execution time: 5_490_000 picoseconds. + Weight::from_parts(5_703_000, 5009) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov Map1M (r:1 w:0) @@ -564,9 +538,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2044` // Estimated: `5509` - // Minimum execution time: 7_282 nanoseconds. - Weight::from_parts(8_022_000, 0) - .saturating_add(Weight::from_parts(0, 5509)) + // Minimum execution time: 6_397_000 picoseconds. + Weight::from_parts(7_084_000, 5509) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov Map1M (r:100 w:0) @@ -577,19 +550,18 @@ impl WeightInfo for () { /// The range of component `m` is `[0, 100]`. fn storage_map_read_per_component(n: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `515 + n * (188 ±0) + m * (188 ±0)` - // Estimated: `1980 + n * (3006 ±0) + m * (2511 ±0)` - // Minimum execution time: 195_406 nanoseconds. - Weight::from_parts(129_093_464, 0) - .saturating_add(Weight::from_parts(0, 1980)) - // Standard Error: 12_134 - .saturating_add(Weight::from_parts(855_330, 0).saturating_mul(n.into())) - // Standard Error: 12_134 - .saturating_add(Weight::from_parts(870_523, 0).saturating_mul(m.into())) + // Measured: `515 + m * (188 ±0) + n * (188 ±0)` + // Estimated: `990 + m * (2511 ±0) + n * (3006 ±0)` + // Minimum execution time: 181_481_000 picoseconds. + Weight::from_parts(129_275_141, 990) + // Standard Error: 13_049 + .saturating_add(Weight::from_parts(787_667, 0).saturating_mul(n.into())) + // Standard Error: 13_049 + .saturating_add(Weight::from_parts(830_378, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_parts(0, 3006).saturating_mul(n.into())) .saturating_add(Weight::from_parts(0, 2511).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 3006).saturating_mul(n.into())) } /// Storage: Pov Map1M (r:100 w:0) /// Proof: Pov Map1M (max_values: Some(1000000), max_size: Some(36), added: 2511, mode: Ignored) @@ -599,19 +571,18 @@ impl WeightInfo for () { /// The range of component `m` is `[0, 100]`. fn storage_map_read_per_component_one_ignored(n: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `515 + n * (188 ±0) + m * (188 ±0)` - // Estimated: `1685 + n * (3195 ±0) + m * (189 ±0)` - // Minimum execution time: 195_053 nanoseconds. - Weight::from_parts(131_322_479, 0) - .saturating_add(Weight::from_parts(0, 1685)) - // Standard Error: 12_161 - .saturating_add(Weight::from_parts(843_047, 0).saturating_mul(n.into())) - // Standard Error: 12_161 - .saturating_add(Weight::from_parts(858_668, 0).saturating_mul(m.into())) + // Measured: `515 + m * (188 ±0) + n * (188 ±0)` + // Estimated: `1685 + m * (189 ±0) + n * (3006 ±0)` + // Minimum execution time: 181_925_000 picoseconds. + Weight::from_parts(134_416_814, 1685) + // Standard Error: 15_678 + .saturating_add(Weight::from_parts(827_168, 0).saturating_mul(n.into())) + // Standard Error: 15_678 + .saturating_add(Weight::from_parts(813_655, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(m.into()))) - .saturating_add(Weight::from_parts(0, 3195).saturating_mul(n.into())) .saturating_add(Weight::from_parts(0, 189).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 3006).saturating_mul(n.into())) } /// Storage: Pov Map1M (r:1 w:0) /// Proof: Pov Map1M (max_values: Some(1000000), max_size: Some(36), added: 2511, mode: MaxEncodedLen) @@ -620,11 +591,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `170` // Estimated: `3501` - // Minimum execution time: 22 nanoseconds. - Weight::from_parts(2_334_945, 0) - .saturating_add(Weight::from_parts(0, 3501)) - // Standard Error: 624 - .saturating_add(Weight::from_parts(282_046, 0).saturating_mul(n.into())) + // Minimum execution time: 20_000 picoseconds. + Weight::from_parts(2_006_399, 3501) + // Standard Error: 808 + .saturating_add(Weight::from_parts(263_609, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov Map1M (r:100 w:0) @@ -634,11 +604,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `147 + n * (40 ±0)` // Estimated: `990 + n * (2511 ±0)` - // Minimum execution time: 20 nanoseconds. - Weight::from_parts(525_027, 0) - .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 2_767 - .saturating_add(Weight::from_parts(3_887_350, 0).saturating_mul(n.into())) + // Minimum execution time: 21_000 picoseconds. + Weight::from_parts(3_940_044, 990) + // Standard Error: 4_906 + .saturating_add(Weight::from_parts(3_454_882, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2511).saturating_mul(n.into())) } @@ -649,11 +618,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `21938 + n * (57 ±0)` // Estimated: `990 + n * (2543 ±0)` - // Minimum execution time: 34 nanoseconds. - Weight::from_parts(18_341_393, 0) - .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 1_312 - .saturating_add(Weight::from_parts(2_053_135, 0).saturating_mul(n.into())) + // Minimum execution time: 28_000 picoseconds. + Weight::from_parts(20_674_869, 990) + // Standard Error: 3_035 + .saturating_add(Weight::from_parts(1_995_730, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2543).saturating_mul(n.into())) } @@ -663,9 +631,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1518` - // Minimum execution time: 1_163 nanoseconds. - Weight::from_parts(1_274_000, 0) - .saturating_add(Weight::from_parts(0, 1518)) + // Minimum execution time: 1_091_000 picoseconds. + Weight::from_parts(1_181_000, 1518) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov UnboundedValue (r:1 w:0) @@ -674,9 +641,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 1_167 nanoseconds. - Weight::from_parts(1_367_000, 0) - .saturating_add(Weight::from_parts(0, 1594)) + // Minimum execution time: 1_079_000 picoseconds. + Weight::from_parts(1_176_000, 1594) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov UnboundedValue (r:1 w:0) @@ -685,9 +651,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `0` - // Minimum execution time: 1_155 nanoseconds. - Weight::from_parts(1_248_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 1_101_000 picoseconds. + Weight::from_parts(1_160_000, 0) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov UnboundedValue (r:1 w:0) @@ -696,11 +661,10 @@ impl WeightInfo for () { /// Proof: Pov BoundedValue (max_values: Some(1), max_size: Some(33), added: 528, mode: MaxEncodedLen) fn storage_value_bounded_and_unbounded_read() -> Weight { // Proof Size summary in bytes: - // Measured: `109` - // Estimated: `3112` - // Minimum execution time: 1_424 nanoseconds. - Weight::from_parts(1_601_000, 0) - .saturating_add(Weight::from_parts(0, 3112)) + // Measured: `147` + // Estimated: `1632` + // Minimum execution time: 2_143_000 picoseconds. + Weight::from_parts(2_280_000, 1632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: Pov LargeValue (r:1 w:0) @@ -708,13 +672,12 @@ impl WeightInfo for () { /// The range of component `l` is `[0, 4194304]`. fn measured_storage_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `174 + l * (1 ±0)` - // Estimated: `1656 + l * (1 ±0)` - // Minimum execution time: 1_744 nanoseconds. - Weight::from_parts(1_800_000, 0) - .saturating_add(Weight::from_parts(0, 1656)) - // Standard Error: 4 - .saturating_add(Weight::from_parts(443, 0).saturating_mul(l.into())) + // Measured: `142 + l * (1 ±0)` + // Estimated: `1626 + l * (1 ±0)` + // Minimum execution time: 1_665_000 picoseconds. + Weight::from_parts(1_725_000, 1626) + // Standard Error: 3 + .saturating_add(Weight::from_parts(376, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(l.into())) } @@ -723,13 +686,12 @@ impl WeightInfo for () { /// The range of component `l` is `[0, 4194304]`. fn mel_storage_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `174 + l * (1 ±0)` + // Measured: `142 + l * (1 ±0)` // Estimated: `4195793` - // Minimum execution time: 1_770 nanoseconds. - Weight::from_parts(1_813_000, 0) - .saturating_add(Weight::from_parts(0, 4195793)) - // Standard Error: 6 - .saturating_add(Weight::from_parts(495, 0).saturating_mul(l.into())) + // Minimum execution time: 1_640_000 picoseconds. + Weight::from_parts(1_724_000, 4195793) + // Standard Error: 4 + .saturating_add(Weight::from_parts(395, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Pov LargeValue (r:1 w:0) @@ -739,15 +701,14 @@ impl WeightInfo for () { /// The range of component `l` is `[0, 4194304]`. fn measured_storage_double_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235 + l * (2 ±0)` - // Estimated: `3428 + l * (4 ±0)` - // Minimum execution time: 2_349 nanoseconds. - Weight::from_parts(2_423_000, 0) - .saturating_add(Weight::from_parts(0, 3428)) - // Standard Error: 11 - .saturating_add(Weight::from_parts(950, 0).saturating_mul(l.into())) + // Measured: `171 + l * (2 ±0)` + // Estimated: `1655 + l * (2 ±0)` + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(2_358_000, 1655) + // Standard Error: 8 + .saturating_add(Weight::from_parts(737, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(Weight::from_parts(0, 4).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(0, 2).saturating_mul(l.into())) } /// Storage: Pov LargeValue (r:1 w:0) /// Proof: Pov LargeValue (max_values: Some(1), max_size: Some(4194308), added: 4194803, mode: MaxEncodedLen) @@ -756,13 +717,12 @@ impl WeightInfo for () { /// The range of component `l` is `[0, 4194304]`. fn mel_storage_double_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235 + l * (2 ±0)` - // Estimated: `8391586` - // Minimum execution time: 2_315 nanoseconds. - Weight::from_parts(2_409_000, 0) - .saturating_add(Weight::from_parts(0, 8391586)) - // Standard Error: 12 - .saturating_add(Weight::from_parts(984, 0).saturating_mul(l.into())) + // Measured: `171 + l * (2 ±0)` + // Estimated: `4195793` + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_233_000, 4195793) + // Standard Error: 5 + .saturating_add(Weight::from_parts(639, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: Pov LargeValue (r:1 w:0) @@ -772,13 +732,12 @@ impl WeightInfo for () { /// The range of component `l` is `[0, 4194304]`. fn mel_mixed_storage_double_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235 + l * (2 ±0)` - // Estimated: `4197507 + l * (2 ±0)` - // Minimum execution time: 2_370 nanoseconds. - Weight::from_parts(2_474_000, 0) - .saturating_add(Weight::from_parts(0, 4197507)) - // Standard Error: 11 - .saturating_add(Weight::from_parts(956, 0).saturating_mul(l.into())) + // Measured: `171 + l * (2 ±0)` + // Estimated: `4195793 + l * (2 ±0)` + // Minimum execution time: 2_149_000 picoseconds. + Weight::from_parts(2_256_000, 4195793) + // Standard Error: 6 + .saturating_add(Weight::from_parts(677, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 2).saturating_mul(l.into())) } @@ -789,13 +748,12 @@ impl WeightInfo for () { /// The range of component `l` is `[0, 4194304]`. fn measured_mixed_storage_double_value_read_linear_size(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235 + l * (2 ±0)` - // Estimated: `4197507 + l * (2 ±0)` - // Minimum execution time: 2_375 nanoseconds. - Weight::from_parts(2_420_000, 0) - .saturating_add(Weight::from_parts(0, 4197507)) - // Standard Error: 9 - .saturating_add(Weight::from_parts(914, 0).saturating_mul(l.into())) + // Measured: `171 + l * (2 ±0)` + // Estimated: `4195793 + l * (2 ±0)` + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_319_000, 4195793) + // Standard Error: 5 + .saturating_add(Weight::from_parts(664, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 2).saturating_mul(l.into())) } @@ -806,15 +764,14 @@ impl WeightInfo for () { /// The range of component `i` is `[0, 1000]`. fn storage_map_unbounded_both_measured_read(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `293 + i * (8 ±0)` - // Estimated: `7504 + i * (16 ±0)` - // Minimum execution time: 3_305 nanoseconds. - Weight::from_parts(3_689_335, 0) - .saturating_add(Weight::from_parts(0, 7504)) - // Standard Error: 29 - .saturating_add(Weight::from_parts(638, 0).saturating_mul(i.into())) + // Measured: `229 + i * (8 ±0)` + // Estimated: `3693 + i * (8 ±0)` + // Minimum execution time: 3_071_000 picoseconds. + Weight::from_parts(3_487_712, 3693) + // Standard Error: 26 + .saturating_add(Weight::from_parts(748, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(Weight::from_parts(0, 16).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(i.into())) } /// Storage: Pov Map1M (r:1 w:0) /// Proof: Pov Map1M (max_values: Some(1000000), max_size: Some(36), added: 2511, mode: MaxEncodedLen) @@ -823,13 +780,12 @@ impl WeightInfo for () { /// The range of component `i` is `[0, 1000]`. fn storage_map_partial_unbounded_read(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `260 + i * (4 ±0)` - // Estimated: `7223 + i * (4 ±0)` - // Minimum execution time: 3_469 nanoseconds. - Weight::from_parts(3_878_896, 0) - .saturating_add(Weight::from_parts(0, 7223)) - // Standard Error: 33 - .saturating_add(Weight::from_parts(356, 0).saturating_mul(i.into())) + // Measured: `228 + i * (4 ±0)` + // Estimated: `3692 + i * (4 ±0)` + // Minimum execution time: 3_150_000 picoseconds. + Weight::from_parts(3_582_963, 3692) + // Standard Error: 18 + .saturating_add(Weight::from_parts(380, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 4).saturating_mul(i.into())) } @@ -840,13 +796,12 @@ impl WeightInfo for () { /// The range of component `i` is `[0, 1000]`. fn storage_map_partial_unbounded_ignored_read(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `260 + i * (4 ±0)` - // Estimated: `3758 + i * (4 ±0)` - // Minimum execution time: 3_442 nanoseconds. - Weight::from_parts(3_881_051, 0) - .saturating_add(Weight::from_parts(0, 3758)) - // Standard Error: 35 - .saturating_add(Weight::from_parts(384, 0).saturating_mul(i.into())) + // Measured: `228 + i * (4 ±0)` + // Estimated: `3501 + i * (4 ±0)` + // Minimum execution time: 3_092_000 picoseconds. + Weight::from_parts(3_595_328, 3501) + // Standard Error: 20 + .saturating_add(Weight::from_parts(243, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 4).saturating_mul(i.into())) } @@ -854,16 +809,24 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_619 nanoseconds. - Weight::from_parts(1_728_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 1_705_000 picoseconds. + Weight::from_parts(1_818_000, 0) } fn noop() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 546 nanoseconds. - Weight::from_parts(640_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Minimum execution time: 533_000 picoseconds. + Weight::from_parts(587_000, 0) + } + /// Storage: Pov UnboundedMapTwox (r:65001 w:0) + /// Proof Skipped: Pov UnboundedMapTwox (max_values: None, max_size: None, mode: Measured) + fn storage_iteration() -> Weight { + // Proof Size summary in bytes: + // Measured: `17985289` + // Estimated: `178863754` + // Minimum execution time: 118_753_057_000 picoseconds. + Weight::from_parts(121_396_503_000, 178863754) + .saturating_add(RocksDbWeight::get().reads(65001_u64)) } } diff --git a/frame/benchmarking/src/weights.rs b/frame/benchmarking/src/weights.rs index aa24b99ace2a7..25e2702f702d1 100644 --- a/frame/benchmarking/src/weights.rs +++ b/frame/benchmarking/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for frame_benchmarking //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=frame_benchmarking -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -67,49 +64,49 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 205_000 picoseconds. - Weight::from_parts(263_483, 0) + // Minimum execution time: 173_000 picoseconds. + Weight::from_parts(205_895, 0) } /// The range of component `i` is `[0, 1000000]`. fn subtraction(_i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 186_000 picoseconds. - Weight::from_parts(257_588, 0) + // Minimum execution time: 180_000 picoseconds. + Weight::from_parts(206_967, 0) } /// The range of component `i` is `[0, 1000000]`. fn multiplication(_i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 192_000 picoseconds. - Weight::from_parts(264_271, 0) + // Minimum execution time: 174_000 picoseconds. + Weight::from_parts(214_304, 0) } /// The range of component `i` is `[0, 1000000]`. fn division(_i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 191_000 picoseconds. - Weight::from_parts(250_785, 0) + // Minimum execution time: 173_000 picoseconds. + Weight::from_parts(207_804, 0) } fn hashing() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 21_405_207_000 picoseconds. - Weight::from_parts(21_534_243_000, 0) + // Minimum execution time: 21_173_551_000 picoseconds. + Weight::from_parts(21_256_886_000, 0) } /// The range of component `i` is `[0, 100]`. fn sr25519_verification(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 255_000 picoseconds. - Weight::from_parts(271_000, 0) - // Standard Error: 12_788 - .saturating_add(Weight::from_parts(47_469_387, 0).saturating_mul(i.into())) + // Minimum execution time: 208_000 picoseconds. + Weight::from_parts(1_227_077, 0) + // Standard Error: 9_390 + .saturating_add(Weight::from_parts(47_152_841, 0).saturating_mul(i.into())) } } @@ -120,48 +117,48 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 205_000 picoseconds. - Weight::from_parts(263_483, 0) + // Minimum execution time: 173_000 picoseconds. + Weight::from_parts(205_895, 0) } /// The range of component `i` is `[0, 1000000]`. fn subtraction(_i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 186_000 picoseconds. - Weight::from_parts(257_588, 0) + // Minimum execution time: 180_000 picoseconds. + Weight::from_parts(206_967, 0) } /// The range of component `i` is `[0, 1000000]`. fn multiplication(_i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 192_000 picoseconds. - Weight::from_parts(264_271, 0) + // Minimum execution time: 174_000 picoseconds. + Weight::from_parts(214_304, 0) } /// The range of component `i` is `[0, 1000000]`. fn division(_i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 191_000 picoseconds. - Weight::from_parts(250_785, 0) + // Minimum execution time: 173_000 picoseconds. + Weight::from_parts(207_804, 0) } fn hashing() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 21_405_207_000 picoseconds. - Weight::from_parts(21_534_243_000, 0) + // Minimum execution time: 21_173_551_000 picoseconds. + Weight::from_parts(21_256_886_000, 0) } /// The range of component `i` is `[0, 100]`. fn sr25519_verification(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 255_000 picoseconds. - Weight::from_parts(271_000, 0) - // Standard Error: 12_788 - .saturating_add(Weight::from_parts(47_469_387, 0).saturating_mul(i.into())) + // Minimum execution time: 208_000 picoseconds. + Weight::from_parts(1_227_077, 0) + // Standard Error: 9_390 + .saturating_add(Weight::from_parts(47_152_841, 0).saturating_mul(i.into())) } } diff --git a/frame/bounties/src/weights.rs b/frame/bounties/src/weights.rs index b0459fee62eb1..5a84adf08210c 100644 --- a/frame/bounties/src/weights.rs +++ b/frame/bounties/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_bounties //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_bounties -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -76,12 +73,14 @@ impl WeightInfo for SubstrateWeight { /// Storage: Bounties Bounties (r:0 w:1) /// Proof: Bounties Bounties (max_values: None, max_size: Some(177), added: 2652, mode: MaxEncodedLen) /// The range of component `d` is `[0, 300]`. - fn propose_bounty(_d: u32, ) -> Weight { + fn propose_bounty(d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `276` - // Estimated: `5082` - // Minimum execution time: 26_271_000 picoseconds. - Weight::from_parts(28_048_901, 5082) + // Estimated: `3593` + // Minimum execution time: 30_793_000 picoseconds. + Weight::from_parts(31_509_544, 3593) + // Standard Error: 168 + .saturating_add(Weight::from_parts(2_219, 0).saturating_mul(d.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -92,9 +91,9 @@ impl WeightInfo for SubstrateWeight { fn approve_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `368` - // Estimated: `5529` - // Minimum execution time: 12_573_000 picoseconds. - Weight::from_parts(12_827_000, 5529) + // Estimated: `3642` + // Minimum execution time: 12_471_000 picoseconds. + Weight::from_parts(12_677_000, 3642) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -104,8 +103,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3642` - // Minimum execution time: 10_555_000 picoseconds. - Weight::from_parts(10_857_000, 3642) + // Minimum execution time: 10_560_000 picoseconds. + Weight::from_parts(10_744_000, 3642) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -116,9 +115,9 @@ impl WeightInfo for SubstrateWeight { fn unassign_curator() -> Weight { // Proof Size summary in bytes: // Measured: `564` - // Estimated: `7235` - // Minimum execution time: 26_003_000 picoseconds. - Weight::from_parts(26_291_000, 7235) + // Estimated: `3642` + // Minimum execution time: 30_980_000 picoseconds. + Weight::from_parts(31_354_000, 3642) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -129,9 +128,9 @@ impl WeightInfo for SubstrateWeight { fn accept_curator() -> Weight { // Proof Size summary in bytes: // Measured: `560` - // Estimated: `7235` - // Minimum execution time: 24_371_000 picoseconds. - Weight::from_parts(24_781_000, 7235) + // Estimated: `3642` + // Minimum execution time: 29_257_000 picoseconds. + Weight::from_parts(29_656_000, 3642) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -142,9 +141,9 @@ impl WeightInfo for SubstrateWeight { fn award_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `538` - // Estimated: `7123` - // Minimum execution time: 20_688_000 picoseconds. - Weight::from_parts(20_909_000, 7123) + // Estimated: `3642` + // Minimum execution time: 20_662_000 picoseconds. + Weight::from_parts(20_956_000, 3642) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -159,9 +158,9 @@ impl WeightInfo for SubstrateWeight { fn claim_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `902` - // Estimated: `15934` - // Minimum execution time: 78_933_000 picoseconds. - Weight::from_parts(79_884_000, 15934) + // Estimated: `8799` + // Minimum execution time: 119_287_000 picoseconds. + Weight::from_parts(121_468_000, 8799) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -176,9 +175,9 @@ impl WeightInfo for SubstrateWeight { fn close_bounty_proposed() -> Weight { // Proof Size summary in bytes: // Measured: `582` - // Estimated: `10716` - // Minimum execution time: 32_332_000 picoseconds. - Weight::from_parts(32_833_000, 10716) + // Estimated: `3642` + // Minimum execution time: 37_759_000 picoseconds. + Weight::from_parts(38_185_000, 3642) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -193,9 +192,9 @@ impl WeightInfo for SubstrateWeight { fn close_bounty_active() -> Weight { // Proof Size summary in bytes: // Measured: `818` - // Estimated: `13319` - // Minimum execution time: 55_686_000 picoseconds. - Weight::from_parts(56_271_000, 13319) + // Estimated: `6196` + // Minimum execution time: 80_332_000 picoseconds. + Weight::from_parts(81_328_000, 6196) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -205,8 +204,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `424` // Estimated: `3642` - // Minimum execution time: 16_414_000 picoseconds. - Weight::from_parts(16_681_000, 3642) + // Minimum execution time: 16_301_000 picoseconds. + Weight::from_parts(16_611_000, 3642) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -220,16 +219,16 @@ impl WeightInfo for SubstrateWeight { fn spend_funds(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `4 + b * (297 ±0)` - // Estimated: `3867 + b * (7858 ±0)` - // Minimum execution time: 5_398_000 picoseconds. - Weight::from_parts(4_478_947, 3867) - // Standard Error: 41_860 - .saturating_add(Weight::from_parts(33_082_606, 0).saturating_mul(b.into())) + // Estimated: `1887 + b * (5206 ±0)` + // Minimum execution time: 5_430_000 picoseconds. + Weight::from_parts(4_463_976, 1887) + // Standard Error: 43_695 + .saturating_add(Weight::from_parts(39_370_113, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into()))) - .saturating_add(Weight::from_parts(0, 7858).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 5206).saturating_mul(b.into())) } } @@ -244,12 +243,14 @@ impl WeightInfo for () { /// Storage: Bounties Bounties (r:0 w:1) /// Proof: Bounties Bounties (max_values: None, max_size: Some(177), added: 2652, mode: MaxEncodedLen) /// The range of component `d` is `[0, 300]`. - fn propose_bounty(_d: u32, ) -> Weight { + fn propose_bounty(d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `276` - // Estimated: `5082` - // Minimum execution time: 26_271_000 picoseconds. - Weight::from_parts(28_048_901, 5082) + // Estimated: `3593` + // Minimum execution time: 30_793_000 picoseconds. + Weight::from_parts(31_509_544, 3593) + // Standard Error: 168 + .saturating_add(Weight::from_parts(2_219, 0).saturating_mul(d.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -260,9 +261,9 @@ impl WeightInfo for () { fn approve_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `368` - // Estimated: `5529` - // Minimum execution time: 12_573_000 picoseconds. - Weight::from_parts(12_827_000, 5529) + // Estimated: `3642` + // Minimum execution time: 12_471_000 picoseconds. + Weight::from_parts(12_677_000, 3642) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -272,8 +273,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3642` - // Minimum execution time: 10_555_000 picoseconds. - Weight::from_parts(10_857_000, 3642) + // Minimum execution time: 10_560_000 picoseconds. + Weight::from_parts(10_744_000, 3642) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -284,9 +285,9 @@ impl WeightInfo for () { fn unassign_curator() -> Weight { // Proof Size summary in bytes: // Measured: `564` - // Estimated: `7235` - // Minimum execution time: 26_003_000 picoseconds. - Weight::from_parts(26_291_000, 7235) + // Estimated: `3642` + // Minimum execution time: 30_980_000 picoseconds. + Weight::from_parts(31_354_000, 3642) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -297,9 +298,9 @@ impl WeightInfo for () { fn accept_curator() -> Weight { // Proof Size summary in bytes: // Measured: `560` - // Estimated: `7235` - // Minimum execution time: 24_371_000 picoseconds. - Weight::from_parts(24_781_000, 7235) + // Estimated: `3642` + // Minimum execution time: 29_257_000 picoseconds. + Weight::from_parts(29_656_000, 3642) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -310,9 +311,9 @@ impl WeightInfo for () { fn award_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `538` - // Estimated: `7123` - // Minimum execution time: 20_688_000 picoseconds. - Weight::from_parts(20_909_000, 7123) + // Estimated: `3642` + // Minimum execution time: 20_662_000 picoseconds. + Weight::from_parts(20_956_000, 3642) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -327,9 +328,9 @@ impl WeightInfo for () { fn claim_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `902` - // Estimated: `15934` - // Minimum execution time: 78_933_000 picoseconds. - Weight::from_parts(79_884_000, 15934) + // Estimated: `8799` + // Minimum execution time: 119_287_000 picoseconds. + Weight::from_parts(121_468_000, 8799) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -344,9 +345,9 @@ impl WeightInfo for () { fn close_bounty_proposed() -> Weight { // Proof Size summary in bytes: // Measured: `582` - // Estimated: `10716` - // Minimum execution time: 32_332_000 picoseconds. - Weight::from_parts(32_833_000, 10716) + // Estimated: `3642` + // Minimum execution time: 37_759_000 picoseconds. + Weight::from_parts(38_185_000, 3642) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -361,9 +362,9 @@ impl WeightInfo for () { fn close_bounty_active() -> Weight { // Proof Size summary in bytes: // Measured: `818` - // Estimated: `13319` - // Minimum execution time: 55_686_000 picoseconds. - Weight::from_parts(56_271_000, 13319) + // Estimated: `6196` + // Minimum execution time: 80_332_000 picoseconds. + Weight::from_parts(81_328_000, 6196) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -373,8 +374,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `424` // Estimated: `3642` - // Minimum execution time: 16_414_000 picoseconds. - Weight::from_parts(16_681_000, 3642) + // Minimum execution time: 16_301_000 picoseconds. + Weight::from_parts(16_611_000, 3642) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -388,15 +389,15 @@ impl WeightInfo for () { fn spend_funds(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `4 + b * (297 ±0)` - // Estimated: `3867 + b * (7858 ±0)` - // Minimum execution time: 5_398_000 picoseconds. - Weight::from_parts(4_478_947, 3867) - // Standard Error: 41_860 - .saturating_add(Weight::from_parts(33_082_606, 0).saturating_mul(b.into())) + // Estimated: `1887 + b * (5206 ±0)` + // Minimum execution time: 5_430_000 picoseconds. + Weight::from_parts(4_463_976, 1887) + // Standard Error: 43_695 + .saturating_add(Weight::from_parts(39_370_113, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(b.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into()))) - .saturating_add(Weight::from_parts(0, 7858).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 5206).saturating_mul(b.into())) } } diff --git a/frame/child-bounties/src/weights.rs b/frame/child-bounties/src/weights.rs index 92be77c49dc9c..be30e80a19f27 100644 --- a/frame/child-bounties/src/weights.rs +++ b/frame/child-bounties/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_child_bounties //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_child_bounties -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -77,14 +74,12 @@ impl WeightInfo for SubstrateWeight { /// Storage: ChildBounties ChildBounties (r:0 w:1) /// Proof: ChildBounties ChildBounties (max_values: None, max_size: Some(145), added: 2620, mode: MaxEncodedLen) /// The range of component `d` is `[0, 300]`. - fn add_child_bounty(d: u32, ) -> Weight { + fn add_child_bounty(_d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `678` - // Estimated: `14808` - // Minimum execution time: 54_017_000 picoseconds. - Weight::from_parts(55_142_443, 14808) - // Standard Error: 310 - .saturating_add(Weight::from_parts(1_199, 0).saturating_mul(d.into())) + // Estimated: `6196` + // Minimum execution time: 69_784_000 picoseconds. + Weight::from_parts(71_225_354, 6196) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -97,9 +92,9 @@ impl WeightInfo for SubstrateWeight { fn propose_curator() -> Weight { // Proof Size summary in bytes: // Measured: `732` - // Estimated: `10745` - // Minimum execution time: 19_222_000 picoseconds. - Weight::from_parts(19_446_000, 10745) + // Estimated: `3642` + // Minimum execution time: 19_008_000 picoseconds. + Weight::from_parts(19_219_000, 3642) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -112,9 +107,9 @@ impl WeightInfo for SubstrateWeight { fn accept_curator() -> Weight { // Proof Size summary in bytes: // Measured: `878` - // Estimated: `10845` - // Minimum execution time: 31_049_000 picoseconds. - Weight::from_parts(31_546_000, 10845) + // Estimated: `3642` + // Minimum execution time: 35_457_000 picoseconds. + Weight::from_parts(36_088_000, 3642) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -127,9 +122,9 @@ impl WeightInfo for SubstrateWeight { fn unassign_curator() -> Weight { // Proof Size summary in bytes: // Measured: `878` - // Estimated: `10845` - // Minimum execution time: 33_860_000 picoseconds. - Weight::from_parts(34_897_000, 10845) + // Estimated: `3642` + // Minimum execution time: 38_244_000 picoseconds. + Weight::from_parts(38_611_000, 3642) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -140,9 +135,9 @@ impl WeightInfo for SubstrateWeight { fn award_child_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `775` - // Estimated: `7252` - // Minimum execution time: 23_178_000 picoseconds. - Weight::from_parts(23_412_000, 7252) + // Estimated: `3642` + // Minimum execution time: 22_762_000 picoseconds. + Weight::from_parts(23_249_000, 3642) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -157,9 +152,9 @@ impl WeightInfo for SubstrateWeight { fn claim_child_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `648` - // Estimated: `15890` - // Minimum execution time: 76_189_000 picoseconds. - Weight::from_parts(76_770_000, 15890) + // Estimated: `8799` + // Minimum execution time: 112_019_000 picoseconds. + Weight::from_parts(113_190_000, 8799) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -178,9 +173,9 @@ impl WeightInfo for SubstrateWeight { fn close_child_bounty_added() -> Weight { // Proof Size summary in bytes: // Measured: `978` - // Estimated: `20422` - // Minimum execution time: 55_161_000 picoseconds. - Weight::from_parts(55_578_000, 20422) + // Estimated: `6196` + // Minimum execution time: 72_477_000 picoseconds. + Weight::from_parts(73_573_000, 6196) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -199,9 +194,9 @@ impl WeightInfo for SubstrateWeight { fn close_child_bounty_active() -> Weight { // Proof Size summary in bytes: // Measured: `1165` - // Estimated: `23025` - // Minimum execution time: 67_815_000 picoseconds. - Weight::from_parts(68_620_000, 23025) + // Estimated: `8799` + // Minimum execution time: 91_049_000 picoseconds. + Weight::from_parts(91_874_000, 8799) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -222,14 +217,12 @@ impl WeightInfo for () { /// Storage: ChildBounties ChildBounties (r:0 w:1) /// Proof: ChildBounties ChildBounties (max_values: None, max_size: Some(145), added: 2620, mode: MaxEncodedLen) /// The range of component `d` is `[0, 300]`. - fn add_child_bounty(d: u32, ) -> Weight { + fn add_child_bounty(_d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `678` - // Estimated: `14808` - // Minimum execution time: 54_017_000 picoseconds. - Weight::from_parts(55_142_443, 14808) - // Standard Error: 310 - .saturating_add(Weight::from_parts(1_199, 0).saturating_mul(d.into())) + // Estimated: `6196` + // Minimum execution time: 69_784_000 picoseconds. + Weight::from_parts(71_225_354, 6196) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -242,9 +235,9 @@ impl WeightInfo for () { fn propose_curator() -> Weight { // Proof Size summary in bytes: // Measured: `732` - // Estimated: `10745` - // Minimum execution time: 19_222_000 picoseconds. - Weight::from_parts(19_446_000, 10745) + // Estimated: `3642` + // Minimum execution time: 19_008_000 picoseconds. + Weight::from_parts(19_219_000, 3642) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -257,9 +250,9 @@ impl WeightInfo for () { fn accept_curator() -> Weight { // Proof Size summary in bytes: // Measured: `878` - // Estimated: `10845` - // Minimum execution time: 31_049_000 picoseconds. - Weight::from_parts(31_546_000, 10845) + // Estimated: `3642` + // Minimum execution time: 35_457_000 picoseconds. + Weight::from_parts(36_088_000, 3642) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -272,9 +265,9 @@ impl WeightInfo for () { fn unassign_curator() -> Weight { // Proof Size summary in bytes: // Measured: `878` - // Estimated: `10845` - // Minimum execution time: 33_860_000 picoseconds. - Weight::from_parts(34_897_000, 10845) + // Estimated: `3642` + // Minimum execution time: 38_244_000 picoseconds. + Weight::from_parts(38_611_000, 3642) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -285,9 +278,9 @@ impl WeightInfo for () { fn award_child_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `775` - // Estimated: `7252` - // Minimum execution time: 23_178_000 picoseconds. - Weight::from_parts(23_412_000, 7252) + // Estimated: `3642` + // Minimum execution time: 22_762_000 picoseconds. + Weight::from_parts(23_249_000, 3642) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -302,9 +295,9 @@ impl WeightInfo for () { fn claim_child_bounty() -> Weight { // Proof Size summary in bytes: // Measured: `648` - // Estimated: `15890` - // Minimum execution time: 76_189_000 picoseconds. - Weight::from_parts(76_770_000, 15890) + // Estimated: `8799` + // Minimum execution time: 112_019_000 picoseconds. + Weight::from_parts(113_190_000, 8799) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -323,9 +316,9 @@ impl WeightInfo for () { fn close_child_bounty_added() -> Weight { // Proof Size summary in bytes: // Measured: `978` - // Estimated: `20422` - // Minimum execution time: 55_161_000 picoseconds. - Weight::from_parts(55_578_000, 20422) + // Estimated: `6196` + // Minimum execution time: 72_477_000 picoseconds. + Weight::from_parts(73_573_000, 6196) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -344,9 +337,9 @@ impl WeightInfo for () { fn close_child_bounty_active() -> Weight { // Proof Size summary in bytes: // Measured: `1165` - // Estimated: `23025` - // Minimum execution time: 67_815_000 picoseconds. - Weight::from_parts(68_620_000, 23025) + // Estimated: `8799` + // Minimum execution time: 91_049_000 picoseconds. + Weight::from_parts(91_874_000, 8799) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } diff --git a/frame/collective/src/weights.rs b/frame/collective/src/weights.rs index 2199c02052009..bf739daca0931 100644 --- a/frame/collective/src/weights.rs +++ b/frame/collective/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_collective //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_collective -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -80,19 +77,19 @@ impl WeightInfo for SubstrateWeight { fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + m * (3232 ±0) + p * (3190 ±0)` - // Estimated: `19428 + m * (7799 ±24) + p * (10110 ±24)` - // Minimum execution time: 18_772_000 picoseconds. - Weight::from_parts(18_931_000, 19428) - // Standard Error: 65_247 - .saturating_add(Weight::from_parts(5_050_136, 0).saturating_mul(m.into())) - // Standard Error: 65_247 - .saturating_add(Weight::from_parts(8_235_069, 0).saturating_mul(p.into())) + // Estimated: `15861 + m * (1967 ±23) + p * (4332 ±23)` + // Minimum execution time: 19_398_000 picoseconds. + Weight::from_parts(19_542_000, 15861) + // Standard Error: 71_395 + .saturating_add(Weight::from_parts(5_630_062, 0).saturating_mul(m.into())) + // Standard Error: 71_395 + .saturating_add(Weight::from_parts(8_634_133, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 7799).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 10110).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1967).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 4332).saturating_mul(p.into())) } /// Storage: Council Members (r:1 w:0) /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) @@ -102,12 +99,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `202 + m * (32 ±0)` // Estimated: `1688 + m * (32 ±0)` - // Minimum execution time: 17_741_000 picoseconds. - Weight::from_parts(17_580_031, 1688) - // Standard Error: 113 - .saturating_add(Weight::from_parts(941, 0).saturating_mul(b.into())) - // Standard Error: 1_170 - .saturating_add(Weight::from_parts(17_329, 0).saturating_mul(m.into())) + // Minimum execution time: 17_579_000 picoseconds. + Weight::from_parts(16_874_624, 1688) + // Standard Error: 34 + .saturating_add(Weight::from_parts(1_617, 0).saturating_mul(b.into())) + // Standard Error: 353 + .saturating_add(Weight::from_parts(19_759, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } @@ -120,15 +117,15 @@ impl WeightInfo for SubstrateWeight { fn propose_execute(b: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `202 + m * (32 ±0)` - // Estimated: `5356 + m * (64 ±0)` - // Minimum execution time: 20_214_000 picoseconds. - Weight::from_parts(19_508_816, 5356) - // Standard Error: 46 - .saturating_add(Weight::from_parts(1_646, 0).saturating_mul(b.into())) - // Standard Error: 475 - .saturating_add(Weight::from_parts(27_145, 0).saturating_mul(m.into())) + // Estimated: `3668 + m * (32 ±0)` + // Minimum execution time: 20_339_000 picoseconds. + Weight::from_parts(19_534_549, 3668) + // Standard Error: 45 + .saturating_add(Weight::from_parts(1_636, 0).saturating_mul(b.into())) + // Standard Error: 469 + .saturating_add(Weight::from_parts(28_178, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } /// Storage: Council Members (r:1 w:0) /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) @@ -146,19 +143,19 @@ impl WeightInfo for SubstrateWeight { fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `492 + m * (32 ±0) + p * (36 ±0)` - // Estimated: `10015 + m * (165 ±0) + p * (180 ±0)` - // Minimum execution time: 27_872_000 picoseconds. - Weight::from_parts(28_010_227, 10015) - // Standard Error: 90 - .saturating_add(Weight::from_parts(2_643, 0).saturating_mul(b.into())) - // Standard Error: 944 - .saturating_add(Weight::from_parts(17_897, 0).saturating_mul(m.into())) - // Standard Error: 932 - .saturating_add(Weight::from_parts(122_368, 0).saturating_mul(p.into())) + // Estimated: `3884 + m * (33 ±0) + p * (36 ±0)` + // Minimum execution time: 27_793_000 picoseconds. + Weight::from_parts(28_095_462, 3884) + // Standard Error: 82 + .saturating_add(Weight::from_parts(2_646, 0).saturating_mul(b.into())) + // Standard Error: 861 + .saturating_add(Weight::from_parts(22_332, 0).saturating_mul(m.into())) + // Standard Error: 850 + .saturating_add(Weight::from_parts(121_560, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 165).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 33).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Council Members (r:1 w:0) /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) @@ -168,14 +165,14 @@ impl WeightInfo for SubstrateWeight { fn vote(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `941 + m * (64 ±0)` - // Estimated: `6830 + m * (128 ±0)` - // Minimum execution time: 22_518_000 picoseconds. - Weight::from_parts(23_281_512, 6830) - // Standard Error: 647 - .saturating_add(Weight::from_parts(53_974, 0).saturating_mul(m.into())) + // Estimated: `4405 + m * (64 ±0)` + // Minimum execution time: 23_096_000 picoseconds. + Weight::from_parts(23_793_304, 4405) + // Standard Error: 675 + .saturating_add(Weight::from_parts(51_741, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 128).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: Council Voting (r:1 w:1) /// Proof Skipped: Council Voting (max_values: None, max_size: None, mode: Measured) @@ -190,17 +187,17 @@ impl WeightInfo for SubstrateWeight { fn close_early_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `530 + m * (64 ±0) + p * (36 ±0)` - // Estimated: `8475 + m * (260 ±0) + p * (144 ±0)` - // Minimum execution time: 29_020_000 picoseconds. - Weight::from_parts(29_009_937, 8475) - // Standard Error: 809 - .saturating_add(Weight::from_parts(31_952, 0).saturating_mul(m.into())) - // Standard Error: 789 - .saturating_add(Weight::from_parts(124_282, 0).saturating_mul(p.into())) + // Estimated: `3975 + m * (65 ±0) + p * (36 ±0)` + // Minimum execution time: 29_635_000 picoseconds. + Weight::from_parts(29_574_124, 3975) + // Standard Error: 755 + .saturating_add(Weight::from_parts(29_126, 0).saturating_mul(m.into())) + // Standard Error: 737 + .saturating_add(Weight::from_parts(123_438, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 260).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 144).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 65).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Council Voting (r:1 w:1) /// Proof Skipped: Council Voting (max_values: None, max_size: None, mode: Measured) @@ -216,20 +213,20 @@ impl WeightInfo for SubstrateWeight { fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `832 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)` - // Estimated: `12636 + b * (4 ±0) + m * (264 ±0) + p * (160 ±0)` - // Minimum execution time: 41_541_000 picoseconds. - Weight::from_parts(43_640_322, 12636) - // Standard Error: 104 - .saturating_add(Weight::from_parts(2_178, 0).saturating_mul(b.into())) - // Standard Error: 1_101 - .saturating_add(Weight::from_parts(20_512, 0).saturating_mul(m.into())) - // Standard Error: 1_073 - .saturating_add(Weight::from_parts(133_112, 0).saturating_mul(p.into())) + // Estimated: `4149 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)` + // Minimum execution time: 41_934_000 picoseconds. + Weight::from_parts(44_022_379, 4149) + // Standard Error: 105 + .saturating_add(Weight::from_parts(2_266, 0).saturating_mul(b.into())) + // Standard Error: 1_112 + .saturating_add(Weight::from_parts(18_074, 0).saturating_mul(m.into())) + // Standard Error: 1_084 + .saturating_add(Weight::from_parts(132_405, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 4).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 264).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 160).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: Council Voting (r:1 w:1) /// Proof Skipped: Council Voting (max_values: None, max_size: None, mode: Measured) @@ -246,17 +243,17 @@ impl WeightInfo for SubstrateWeight { fn close_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `550 + m * (64 ±0) + p * (36 ±0)` - // Estimated: `10570 + m * (325 ±0) + p * (180 ±0)` - // Minimum execution time: 32_773_000 picoseconds. - Weight::from_parts(33_031_550, 10570) - // Standard Error: 1_205 - .saturating_add(Weight::from_parts(26_143, 0).saturating_mul(m.into())) - // Standard Error: 1_175 - .saturating_add(Weight::from_parts(137_503, 0).saturating_mul(p.into())) + // Estimated: `3995 + m * (65 ±0) + p * (36 ±0)` + // Minimum execution time: 33_146_000 picoseconds. + Weight::from_parts(31_957_128, 3995) + // Standard Error: 2_321 + .saturating_add(Weight::from_parts(31_272, 0).saturating_mul(m.into())) + // Standard Error: 2_264 + .saturating_add(Weight::from_parts(156_129, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 325).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 65).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Council Voting (r:1 w:1) /// Proof Skipped: Council Voting (max_values: None, max_size: None, mode: Measured) @@ -274,20 +271,20 @@ impl WeightInfo for SubstrateWeight { fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `852 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)` - // Estimated: `14905 + b * (5 ±0) + m * (330 ±0) + p * (200 ±0)` - // Minimum execution time: 44_855_000 picoseconds. - Weight::from_parts(47_307_460, 14905) + // Estimated: `4169 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)` + // Minimum execution time: 44_278_000 picoseconds. + Weight::from_parts(46_039_907, 4169) // Standard Error: 100 - .saturating_add(Weight::from_parts(1_536, 0).saturating_mul(b.into())) - // Standard Error: 1_065 - .saturating_add(Weight::from_parts(20_549, 0).saturating_mul(m.into())) - // Standard Error: 1_038 - .saturating_add(Weight::from_parts(133_143, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(2_257, 0).saturating_mul(b.into())) + // Standard Error: 1_062 + .saturating_add(Weight::from_parts(25_055, 0).saturating_mul(m.into())) + // Standard Error: 1_035 + .saturating_add(Weight::from_parts(136_282, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 5).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 330).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 200).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: Council Proposals (r:1 w:1) /// Proof Skipped: Council Proposals (max_values: Some(1), max_size: None, mode: Measured) @@ -299,14 +296,14 @@ impl WeightInfo for SubstrateWeight { fn disapprove_proposal(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `359 + p * (32 ±0)` - // Estimated: `2562 + p * (96 ±0)` - // Minimum execution time: 16_420_000 picoseconds. - Weight::from_parts(18_236_525, 2562) - // Standard Error: 894 - .saturating_add(Weight::from_parts(115_590, 0).saturating_mul(p.into())) + // Estimated: `1844 + p * (32 ±0)` + // Minimum execution time: 16_500_000 picoseconds. + Weight::from_parts(18_376_538, 1844) + // Standard Error: 755 + .saturating_add(Weight::from_parts(113_189, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 96).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into())) } } @@ -326,19 +323,19 @@ impl WeightInfo for () { fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + m * (3232 ±0) + p * (3190 ±0)` - // Estimated: `19428 + m * (7799 ±24) + p * (10110 ±24)` - // Minimum execution time: 18_772_000 picoseconds. - Weight::from_parts(18_931_000, 19428) - // Standard Error: 65_247 - .saturating_add(Weight::from_parts(5_050_136, 0).saturating_mul(m.into())) - // Standard Error: 65_247 - .saturating_add(Weight::from_parts(8_235_069, 0).saturating_mul(p.into())) + // Estimated: `15861 + m * (1967 ±23) + p * (4332 ±23)` + // Minimum execution time: 19_398_000 picoseconds. + Weight::from_parts(19_542_000, 15861) + // Standard Error: 71_395 + .saturating_add(Weight::from_parts(5_630_062, 0).saturating_mul(m.into())) + // Standard Error: 71_395 + .saturating_add(Weight::from_parts(8_634_133, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 7799).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 10110).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1967).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 4332).saturating_mul(p.into())) } /// Storage: Council Members (r:1 w:0) /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) @@ -348,12 +345,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `202 + m * (32 ±0)` // Estimated: `1688 + m * (32 ±0)` - // Minimum execution time: 17_741_000 picoseconds. - Weight::from_parts(17_580_031, 1688) - // Standard Error: 113 - .saturating_add(Weight::from_parts(941, 0).saturating_mul(b.into())) - // Standard Error: 1_170 - .saturating_add(Weight::from_parts(17_329, 0).saturating_mul(m.into())) + // Minimum execution time: 17_579_000 picoseconds. + Weight::from_parts(16_874_624, 1688) + // Standard Error: 34 + .saturating_add(Weight::from_parts(1_617, 0).saturating_mul(b.into())) + // Standard Error: 353 + .saturating_add(Weight::from_parts(19_759, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } @@ -366,15 +363,15 @@ impl WeightInfo for () { fn propose_execute(b: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `202 + m * (32 ±0)` - // Estimated: `5356 + m * (64 ±0)` - // Minimum execution time: 20_214_000 picoseconds. - Weight::from_parts(19_508_816, 5356) - // Standard Error: 46 - .saturating_add(Weight::from_parts(1_646, 0).saturating_mul(b.into())) - // Standard Error: 475 - .saturating_add(Weight::from_parts(27_145, 0).saturating_mul(m.into())) + // Estimated: `3668 + m * (32 ±0)` + // Minimum execution time: 20_339_000 picoseconds. + Weight::from_parts(19_534_549, 3668) + // Standard Error: 45 + .saturating_add(Weight::from_parts(1_636, 0).saturating_mul(b.into())) + // Standard Error: 469 + .saturating_add(Weight::from_parts(28_178, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } /// Storage: Council Members (r:1 w:0) /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) @@ -392,19 +389,19 @@ impl WeightInfo for () { fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `492 + m * (32 ±0) + p * (36 ±0)` - // Estimated: `10015 + m * (165 ±0) + p * (180 ±0)` - // Minimum execution time: 27_872_000 picoseconds. - Weight::from_parts(28_010_227, 10015) - // Standard Error: 90 - .saturating_add(Weight::from_parts(2_643, 0).saturating_mul(b.into())) - // Standard Error: 944 - .saturating_add(Weight::from_parts(17_897, 0).saturating_mul(m.into())) - // Standard Error: 932 - .saturating_add(Weight::from_parts(122_368, 0).saturating_mul(p.into())) + // Estimated: `3884 + m * (33 ±0) + p * (36 ±0)` + // Minimum execution time: 27_793_000 picoseconds. + Weight::from_parts(28_095_462, 3884) + // Standard Error: 82 + .saturating_add(Weight::from_parts(2_646, 0).saturating_mul(b.into())) + // Standard Error: 861 + .saturating_add(Weight::from_parts(22_332, 0).saturating_mul(m.into())) + // Standard Error: 850 + .saturating_add(Weight::from_parts(121_560, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 165).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 33).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Council Members (r:1 w:0) /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) @@ -414,14 +411,14 @@ impl WeightInfo for () { fn vote(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `941 + m * (64 ±0)` - // Estimated: `6830 + m * (128 ±0)` - // Minimum execution time: 22_518_000 picoseconds. - Weight::from_parts(23_281_512, 6830) - // Standard Error: 647 - .saturating_add(Weight::from_parts(53_974, 0).saturating_mul(m.into())) + // Estimated: `4405 + m * (64 ±0)` + // Minimum execution time: 23_096_000 picoseconds. + Weight::from_parts(23_793_304, 4405) + // Standard Error: 675 + .saturating_add(Weight::from_parts(51_741, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 128).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: Council Voting (r:1 w:1) /// Proof Skipped: Council Voting (max_values: None, max_size: None, mode: Measured) @@ -436,17 +433,17 @@ impl WeightInfo for () { fn close_early_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `530 + m * (64 ±0) + p * (36 ±0)` - // Estimated: `8475 + m * (260 ±0) + p * (144 ±0)` - // Minimum execution time: 29_020_000 picoseconds. - Weight::from_parts(29_009_937, 8475) - // Standard Error: 809 - .saturating_add(Weight::from_parts(31_952, 0).saturating_mul(m.into())) - // Standard Error: 789 - .saturating_add(Weight::from_parts(124_282, 0).saturating_mul(p.into())) + // Estimated: `3975 + m * (65 ±0) + p * (36 ±0)` + // Minimum execution time: 29_635_000 picoseconds. + Weight::from_parts(29_574_124, 3975) + // Standard Error: 755 + .saturating_add(Weight::from_parts(29_126, 0).saturating_mul(m.into())) + // Standard Error: 737 + .saturating_add(Weight::from_parts(123_438, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 260).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 144).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 65).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Council Voting (r:1 w:1) /// Proof Skipped: Council Voting (max_values: None, max_size: None, mode: Measured) @@ -462,20 +459,20 @@ impl WeightInfo for () { fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `832 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)` - // Estimated: `12636 + b * (4 ±0) + m * (264 ±0) + p * (160 ±0)` - // Minimum execution time: 41_541_000 picoseconds. - Weight::from_parts(43_640_322, 12636) - // Standard Error: 104 - .saturating_add(Weight::from_parts(2_178, 0).saturating_mul(b.into())) - // Standard Error: 1_101 - .saturating_add(Weight::from_parts(20_512, 0).saturating_mul(m.into())) - // Standard Error: 1_073 - .saturating_add(Weight::from_parts(133_112, 0).saturating_mul(p.into())) + // Estimated: `4149 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)` + // Minimum execution time: 41_934_000 picoseconds. + Weight::from_parts(44_022_379, 4149) + // Standard Error: 105 + .saturating_add(Weight::from_parts(2_266, 0).saturating_mul(b.into())) + // Standard Error: 1_112 + .saturating_add(Weight::from_parts(18_074, 0).saturating_mul(m.into())) + // Standard Error: 1_084 + .saturating_add(Weight::from_parts(132_405, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 4).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 264).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 160).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: Council Voting (r:1 w:1) /// Proof Skipped: Council Voting (max_values: None, max_size: None, mode: Measured) @@ -492,17 +489,17 @@ impl WeightInfo for () { fn close_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `550 + m * (64 ±0) + p * (36 ±0)` - // Estimated: `10570 + m * (325 ±0) + p * (180 ±0)` - // Minimum execution time: 32_773_000 picoseconds. - Weight::from_parts(33_031_550, 10570) - // Standard Error: 1_205 - .saturating_add(Weight::from_parts(26_143, 0).saturating_mul(m.into())) - // Standard Error: 1_175 - .saturating_add(Weight::from_parts(137_503, 0).saturating_mul(p.into())) + // Estimated: `3995 + m * (65 ±0) + p * (36 ±0)` + // Minimum execution time: 33_146_000 picoseconds. + Weight::from_parts(31_957_128, 3995) + // Standard Error: 2_321 + .saturating_add(Weight::from_parts(31_272, 0).saturating_mul(m.into())) + // Standard Error: 2_264 + .saturating_add(Weight::from_parts(156_129, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 325).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 65).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Council Voting (r:1 w:1) /// Proof Skipped: Council Voting (max_values: None, max_size: None, mode: Measured) @@ -520,20 +517,20 @@ impl WeightInfo for () { fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `852 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)` - // Estimated: `14905 + b * (5 ±0) + m * (330 ±0) + p * (200 ±0)` - // Minimum execution time: 44_855_000 picoseconds. - Weight::from_parts(47_307_460, 14905) + // Estimated: `4169 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)` + // Minimum execution time: 44_278_000 picoseconds. + Weight::from_parts(46_039_907, 4169) // Standard Error: 100 - .saturating_add(Weight::from_parts(1_536, 0).saturating_mul(b.into())) - // Standard Error: 1_065 - .saturating_add(Weight::from_parts(20_549, 0).saturating_mul(m.into())) - // Standard Error: 1_038 - .saturating_add(Weight::from_parts(133_143, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(2_257, 0).saturating_mul(b.into())) + // Standard Error: 1_062 + .saturating_add(Weight::from_parts(25_055, 0).saturating_mul(m.into())) + // Standard Error: 1_035 + .saturating_add(Weight::from_parts(136_282, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 5).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 330).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 200).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: Council Proposals (r:1 w:1) /// Proof Skipped: Council Proposals (max_values: Some(1), max_size: None, mode: Measured) @@ -545,13 +542,13 @@ impl WeightInfo for () { fn disapprove_proposal(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `359 + p * (32 ±0)` - // Estimated: `2562 + p * (96 ±0)` - // Minimum execution time: 16_420_000 picoseconds. - Weight::from_parts(18_236_525, 2562) - // Standard Error: 894 - .saturating_add(Weight::from_parts(115_590, 0).saturating_mul(p.into())) + // Estimated: `1844 + p * (32 ±0)` + // Minimum execution time: 16_500_000 picoseconds. + Weight::from_parts(18_376_538, 1844) + // Standard Error: 755 + .saturating_add(Weight::from_parts(113_189, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 96).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into())) } } diff --git a/frame/contracts/src/weights.rs b/frame/contracts/src/weights.rs index 8e81364acf449..cdaba7f59b72f 100644 --- a/frame/contracts/src/weights.rs +++ b/frame/contracts/src/weights.rs @@ -18,26 +18,25 @@ //! Autogenerated weights for pallet_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: -// target/production/substrate +// ./target/production/substrate // benchmark // pallet +// --chain=dev // --steps=50 // --repeat=20 +// --pallet=pallet_contracts // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json -// --pallet=pallet_contracts -// --chain=dev -// --header=./HEADER-APACHE2 // --output=./frame/contracts/src/weights.rs +// --header=./HEADER-APACHE2 // --template=./.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -45,7 +44,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions needed for pallet_contracts. pub trait WeightInfo { @@ -178,8 +177,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 2_503_000 picoseconds. - Weight::from_parts(2_603_000, 1594) + // Minimum execution time: 2_565_000 picoseconds. + Weight::from_parts(2_759_000, 1594) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Skipped Metadata (r:0 w:0) @@ -189,10 +188,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `488 + k * (69 ±0)` // Estimated: `478 + k * (70 ±0)` - // Minimum execution time: 13_292_000 picoseconds. - Weight::from_parts(9_180_439, 478) - // Standard Error: 997 - .saturating_add(Weight::from_parts(967_522, 0).saturating_mul(k.into())) + // Minimum execution time: 13_480_000 picoseconds. + Weight::from_parts(10_153_869, 478) + // Standard Error: 427 + .saturating_add(Weight::from_parts(958_726, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -207,14 +206,14 @@ impl WeightInfo for SubstrateWeight { fn reinstrument(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `238 + c * (1 ±0)` - // Estimated: `3951 + c * (2 ±0)` - // Minimum execution time: 30_822_000 picoseconds. - Weight::from_parts(26_457_115, 3951) - // Standard Error: 58 - .saturating_add(Weight::from_parts(54_868, 0).saturating_mul(c.into())) + // Estimated: `3708 + c * (1 ±0)` + // Minimum execution time: 30_406_000 picoseconds. + Weight::from_parts(28_467_370, 3708) + // Standard Error: 46 + .saturating_add(Weight::from_parts(53_724, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 2).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) } /// Storage: Contracts ContractInfoOf (r:1 w:1) /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(290), added: 2765, mode: Measured) @@ -230,14 +229,14 @@ impl WeightInfo for SubstrateWeight { fn call_with_code_per_byte(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `707` - // Estimated: `21400 + c * (5 ±0)` - // Minimum execution time: 263_719_000 picoseconds. - Weight::from_parts(275_281_941, 21400) - // Standard Error: 32 - .saturating_add(Weight::from_parts(37_880, 0).saturating_mul(c.into())) + // Estimated: `6656 + c * (1 ±0)` + // Minimum execution time: 263_198_000 picoseconds. + Weight::from_parts(276_162_279, 6656) + // Standard Error: 18 + .saturating_add(Weight::from_parts(37_378, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 5).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) } /// Storage: Contracts OwnerInfoOf (r:1 w:1) /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Measured) @@ -261,15 +260,15 @@ impl WeightInfo for SubstrateWeight { fn instantiate_with_code(c: u32, i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `270` - // Estimated: `26207` - // Minimum execution time: 3_133_756_000 picoseconds. - Weight::from_parts(556_483_545, 26207) - // Standard Error: 294 - .saturating_add(Weight::from_parts(107_914, 0).saturating_mul(c.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(1_143, 0).saturating_mul(i.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(1_456, 0).saturating_mul(s.into())) + // Estimated: `8659` + // Minimum execution time: 3_132_259_000 picoseconds. + Weight::from_parts(513_284_834, 8659) + // Standard Error: 280 + .saturating_add(Weight::from_parts(106_723, 0).saturating_mul(c.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(1_166, 0).saturating_mul(i.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(1_436, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -292,13 +291,13 @@ impl WeightInfo for SubstrateWeight { fn instantiate(i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `482` - // Estimated: `28521` - // Minimum execution time: 1_646_953_000 picoseconds. - Weight::from_parts(262_115_215, 28521) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_454, 0).saturating_mul(i.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_463, 0).saturating_mul(s.into())) + // Estimated: `6408` + // Minimum execution time: 1_646_604_000 picoseconds. + Weight::from_parts(271_369_256, 6408) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_426, 0).saturating_mul(i.into())) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_438, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -315,9 +314,9 @@ impl WeightInfo for SubstrateWeight { fn call() -> Weight { // Proof Size summary in bytes: // Measured: `759` - // Estimated: `21615` - // Minimum execution time: 190_769_000 picoseconds. - Weight::from_parts(191_717_000, 21615) + // Estimated: `6699` + // Minimum execution time: 191_360_000 picoseconds. + Weight::from_parts(192_625_000, 6699) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -333,11 +332,11 @@ impl WeightInfo for SubstrateWeight { fn upload_code(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `109` - // Estimated: `7366` - // Minimum execution time: 246_204_000 picoseconds. - Weight::from_parts(243_234_754, 7366) - // Standard Error: 78 - .saturating_add(Weight::from_parts(109_232, 0).saturating_mul(c.into())) + // Estimated: `3574` + // Minimum execution time: 245_207_000 picoseconds. + Weight::from_parts(244_703_457, 3574) + // Standard Error: 61 + .saturating_add(Weight::from_parts(106_850, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -352,9 +351,9 @@ impl WeightInfo for SubstrateWeight { fn remove_code() -> Weight { // Proof Size summary in bytes: // Measured: `255` - // Estimated: `7950` - // Minimum execution time: 33_516_000 picoseconds. - Weight::from_parts(33_995_000, 7950) + // Estimated: `3720` + // Minimum execution time: 33_560_000 picoseconds. + Weight::from_parts(33_833_000, 3720) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -367,9 +366,9 @@ impl WeightInfo for SubstrateWeight { fn set_code() -> Weight { // Proof Size summary in bytes: // Measured: `570` - // Estimated: `19530` - // Minimum execution time: 33_255_000 picoseconds. - Weight::from_parts(33_692_000, 19530) + // Estimated: `8985` + // Minimum execution time: 33_288_000 picoseconds. + Weight::from_parts(33_775_000, 8985) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -387,14 +386,14 @@ impl WeightInfo for SubstrateWeight { fn seal_caller(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `781 + r * (6 ±0)` - // Estimated: `21730 + r * (30 ±0)` - // Minimum execution time: 235_074_000 picoseconds. - Weight::from_parts(243_735_179, 21730) - // Standard Error: 972 - .saturating_add(Weight::from_parts(328_571, 0).saturating_mul(r.into())) + // Estimated: `6722 + r * (6 ±0)` + // Minimum execution time: 234_292_000 picoseconds. + Weight::from_parts(235_941_911, 6722) + // Standard Error: 413 + .saturating_add(Weight::from_parts(339_913, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -410,15 +409,15 @@ impl WeightInfo for SubstrateWeight { fn seal_is_contract(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `839 + r * (240 ±0)` - // Estimated: `21835 + r * (3675 ±0)` - // Minimum execution time: 236_455_000 picoseconds. - Weight::from_parts(81_818_936, 21835) - // Standard Error: 5_874 - .saturating_add(Weight::from_parts(3_316_006, 0).saturating_mul(r.into())) + // Estimated: `6743 + r * (2715 ±0)` + // Minimum execution time: 236_273_000 picoseconds. + Weight::from_parts(74_380_906, 6743) + // Standard Error: 5_745 + .saturating_add(Weight::from_parts(3_331_781, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 3675).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2715).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -434,15 +433,15 @@ impl WeightInfo for SubstrateWeight { fn seal_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `831 + r * (244 ±0)` - // Estimated: `21855 + r * (3695 ±0)` - // Minimum execution time: 237_724_000 picoseconds. - Weight::from_parts(91_384_964, 21855) - // Standard Error: 5_828 - .saturating_add(Weight::from_parts(4_063_221, 0).saturating_mul(r.into())) + // Estimated: `6747 + r * (2719 ±0)` + // Minimum execution time: 236_573_000 picoseconds. + Weight::from_parts(82_473_906, 6747) + // Standard Error: 5_510 + .saturating_add(Weight::from_parts(4_131_820, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 3695).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2719).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -458,14 +457,14 @@ impl WeightInfo for SubstrateWeight { fn seal_own_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `788 + r * (6 ±0)` - // Estimated: `21770 + r * (30 ±0)` - // Minimum execution time: 236_144_000 picoseconds. - Weight::from_parts(239_917_873, 21770) - // Standard Error: 629 - .saturating_add(Weight::from_parts(409_752, 0).saturating_mul(r.into())) + // Estimated: `6730 + r * (6 ±0)` + // Minimum execution time: 235_878_000 picoseconds. + Weight::from_parts(238_387_359, 6730) + // Standard Error: 318 + .saturating_add(Weight::from_parts(409_923, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -481,14 +480,14 @@ impl WeightInfo for SubstrateWeight { fn seal_caller_is_origin(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `778 + r * (3 ±0)` - // Estimated: `21735 + r * (15 ±0)` - // Minimum execution time: 232_946_000 picoseconds. - Weight::from_parts(243_163_112, 21735) - // Standard Error: 1_940 - .saturating_add(Weight::from_parts(162_705, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (3 ±0)` + // Minimum execution time: 233_476_000 picoseconds. + Weight::from_parts(238_014_452, 6723) + // Standard Error: 145 + .saturating_add(Weight::from_parts(165_823, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 15).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -504,14 +503,14 @@ impl WeightInfo for SubstrateWeight { fn seal_address(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `782 + r * (6 ±0)` - // Estimated: `21740 + r * (30 ±0)` - // Minimum execution time: 235_301_000 picoseconds. - Weight::from_parts(240_802_312, 21740) - // Standard Error: 5_362 - .saturating_add(Weight::from_parts(339_001, 0).saturating_mul(r.into())) + // Estimated: `6724 + r * (6 ±0)` + // Minimum execution time: 235_490_000 picoseconds. + Weight::from_parts(240_039_685, 6724) + // Standard Error: 330 + .saturating_add(Weight::from_parts(332_291, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -527,14 +526,14 @@ impl WeightInfo for SubstrateWeight { fn seal_gas_left(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `783 + r * (6 ±0)` - // Estimated: `21725 + r * (30 ±0)` - // Minimum execution time: 235_683_000 picoseconds. - Weight::from_parts(237_357_276, 21725) - // Standard Error: 726 - .saturating_add(Weight::from_parts(333_264, 0).saturating_mul(r.into())) + // Estimated: `6721 + r * (6 ±0)` + // Minimum execution time: 236_093_000 picoseconds. + Weight::from_parts(238_513_328, 6721) + // Standard Error: 206 + .saturating_add(Weight::from_parts(328_899, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:2 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -550,14 +549,14 @@ impl WeightInfo for SubstrateWeight { fn seal_balance(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `922 + r * (6 ±0)` - // Estimated: `24633 + r * (30 ±0)` - // Minimum execution time: 234_327_000 picoseconds. - Weight::from_parts(239_792_456, 24633) - // Standard Error: 3_460 - .saturating_add(Weight::from_parts(1_496_090, 0).saturating_mul(r.into())) + // Estimated: `6846 + r * (6 ±0)` + // Minimum execution time: 234_801_000 picoseconds. + Weight::from_parts(243_519_159, 6846) + // Standard Error: 1_367 + .saturating_add(Weight::from_parts(1_449_599, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -573,14 +572,14 @@ impl WeightInfo for SubstrateWeight { fn seal_value_transferred(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `792 + r * (6 ±0)` - // Estimated: `21825 + r * (30 ±0)` - // Minimum execution time: 235_466_000 picoseconds. - Weight::from_parts(242_580_658, 21825) - // Standard Error: 1_439 - .saturating_add(Weight::from_parts(323_842, 0).saturating_mul(r.into())) + // Estimated: `6741 + r * (6 ±0)` + // Minimum execution time: 236_765_000 picoseconds. + Weight::from_parts(237_843_244, 6741) + // Standard Error: 308 + .saturating_add(Weight::from_parts(329_911, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -596,14 +595,14 @@ impl WeightInfo for SubstrateWeight { fn seal_minimum_balance(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `790 + r * (6 ±0)` - // Estimated: `21815 + r * (30 ±0)` - // Minimum execution time: 238_529_000 picoseconds. - Weight::from_parts(249_276_722, 21815) - // Standard Error: 1_216 - .saturating_add(Weight::from_parts(328_600, 0).saturating_mul(r.into())) + // Estimated: `6739 + r * (6 ±0)` + // Minimum execution time: 236_690_000 picoseconds. + Weight::from_parts(241_743_164, 6739) + // Standard Error: 333 + .saturating_add(Weight::from_parts(324_693, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -619,14 +618,14 @@ impl WeightInfo for SubstrateWeight { fn seal_block_number(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `787 + r * (6 ±0)` - // Estimated: `21805 + r * (30 ±0)` - // Minimum execution time: 234_360_000 picoseconds. - Weight::from_parts(239_927_876, 21805) - // Standard Error: 541 - .saturating_add(Weight::from_parts(319_553, 0).saturating_mul(r.into())) + // Estimated: `6737 + r * (6 ±0)` + // Minimum execution time: 236_149_000 picoseconds. + Weight::from_parts(239_090_707, 6737) + // Standard Error: 246 + .saturating_add(Weight::from_parts(344_488, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -642,14 +641,14 @@ impl WeightInfo for SubstrateWeight { fn seal_now(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `778 + r * (6 ±0)` - // Estimated: `21735 + r * (30 ±0)` - // Minimum execution time: 234_461_000 picoseconds. - Weight::from_parts(239_682_633, 21735) - // Standard Error: 544 - .saturating_add(Weight::from_parts(322_943, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (6 ±0)` + // Minimum execution time: 235_057_000 picoseconds. + Weight::from_parts(237_752_870, 6723) + // Standard Error: 236 + .saturating_add(Weight::from_parts(328_235, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -667,14 +666,14 @@ impl WeightInfo for SubstrateWeight { fn seal_weight_to_fee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `856 + r * (10 ±0)` - // Estimated: `24446 + r * (60 ±0)` - // Minimum execution time: 234_862_000 picoseconds. - Weight::from_parts(252_614_390, 24446) - // Standard Error: 1_180 - .saturating_add(Weight::from_parts(1_313_286, 0).saturating_mul(r.into())) + // Estimated: `6796 + r * (10 ±0)` + // Minimum execution time: 234_995_000 picoseconds. + Weight::from_parts(246_473_554, 6796) + // Standard Error: 1_015 + .saturating_add(Weight::from_parts(1_337_653, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 60).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 10).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -690,14 +689,14 @@ impl WeightInfo for SubstrateWeight { fn seal_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `745 + r * (4 ±0)` - // Estimated: `21555 + r * (20 ±0)` - // Minimum execution time: 161_003_000 picoseconds. - Weight::from_parts(165_793_675, 21555) - // Standard Error: 323 - .saturating_add(Weight::from_parts(128_941, 0).saturating_mul(r.into())) + // Estimated: `6687 + r * (4 ±0)` + // Minimum execution time: 160_445_000 picoseconds. + Weight::from_parts(165_558_135, 6687) + // Standard Error: 234 + .saturating_add(Weight::from_parts(133_607, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 20).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 4).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -713,14 +712,14 @@ impl WeightInfo for SubstrateWeight { fn seal_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `780 + r * (6 ±0)` - // Estimated: `21740 + r * (30 ±0)` - // Minimum execution time: 235_192_000 picoseconds. - Weight::from_parts(241_225_671, 21740) - // Standard Error: 1_132 - .saturating_add(Weight::from_parts(272_760, 0).saturating_mul(r.into())) + // Estimated: `6724 + r * (6 ±0)` + // Minimum execution time: 235_065_000 picoseconds. + Weight::from_parts(237_797_177, 6724) + // Standard Error: 336 + .saturating_add(Weight::from_parts(267_302, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -736,11 +735,11 @@ impl WeightInfo for SubstrateWeight { fn seal_input_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `784` - // Estimated: `21740` - // Minimum execution time: 238_050_000 picoseconds. - Weight::from_parts(241_274_832, 21740) - // Standard Error: 1 - .saturating_add(Weight::from_parts(590, 0).saturating_mul(n.into())) + // Estimated: `6724` + // Minimum execution time: 236_215_000 picoseconds. + Weight::from_parts(239_347_313, 6724) + // Standard Error: 0 + .saturating_add(Weight::from_parts(587, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -758,14 +757,14 @@ impl WeightInfo for SubstrateWeight { fn seal_return(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `768 + r * (45 ±0)` - // Estimated: `21660 + r * (225 ±0)` - // Minimum execution time: 231_807_000 picoseconds. - Weight::from_parts(234_264_848, 21660) - // Standard Error: 185_298 - .saturating_add(Weight::from_parts(1_000_351, 0).saturating_mul(r.into())) + // Estimated: `6708 + r * (45 ±0)` + // Minimum execution time: 231_571_000 picoseconds. + Weight::from_parts(233_477_918, 6708) + // Standard Error: 95_776 + .saturating_add(Weight::from_parts(1_733_181, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 225).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 45).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -781,11 +780,11 @@ impl WeightInfo for SubstrateWeight { fn seal_return_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `778` - // Estimated: `21775` - // Minimum execution time: 234_347_000 picoseconds. - Weight::from_parts(234_774_467, 21775) + // Estimated: `6731` + // Minimum execution time: 234_956_000 picoseconds. + Weight::from_parts(236_785_051, 6731) // Standard Error: 0 - .saturating_add(Weight::from_parts(183, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(177, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -809,16 +808,16 @@ impl WeightInfo for SubstrateWeight { fn seal_terminate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `810 + r * (356 ±0)` - // Estimated: `26094 + r * (15904 ±0)` - // Minimum execution time: 234_356_000 picoseconds. - Weight::from_parts(236_844_659, 26094) - // Standard Error: 161_035 - .saturating_add(Weight::from_parts(110_725_340, 0).saturating_mul(r.into())) + // Estimated: `6750 + r * (7781 ±0)` + // Minimum execution time: 234_275_000 picoseconds. + Weight::from_parts(236_776_769, 6750) + // Standard Error: 137_203 + .saturating_add(Weight::from_parts(110_758_930, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((8_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 15904).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 7781).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -836,14 +835,14 @@ impl WeightInfo for SubstrateWeight { fn seal_random(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `825 + r * (10 ±0)` - // Estimated: `24283 + r * (60 ±0)` - // Minimum execution time: 234_248_000 picoseconds. - Weight::from_parts(255_712_101, 24283) - // Standard Error: 1_474 - .saturating_add(Weight::from_parts(1_753_943, 0).saturating_mul(r.into())) + // Estimated: `6769 + r * (10 ±0)` + // Minimum execution time: 235_593_000 picoseconds. + Weight::from_parts(253_731_242, 6769) + // Standard Error: 2_129 + .saturating_add(Weight::from_parts(1_771_297, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 60).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 10).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -859,14 +858,14 @@ impl WeightInfo for SubstrateWeight { fn seal_deposit_event(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `778 + r * (10 ±0)` - // Estimated: `21735 + r * (50 ±0)` - // Minimum execution time: 232_456_000 picoseconds. - Weight::from_parts(230_738_907, 21735) - // Standard Error: 4_163 - .saturating_add(Weight::from_parts(3_496_817, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (10 ±0)` + // Minimum execution time: 232_124_000 picoseconds. + Weight::from_parts(245_904_447, 6723) + // Standard Error: 2_185 + .saturating_add(Weight::from_parts(3_470_410, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 50).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 10).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -883,18 +882,18 @@ impl WeightInfo for SubstrateWeight { fn seal_deposit_event_per_topic_and_byte(t: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `797 + t * (32 ±0)` - // Estimated: `21840 + t * (2640 ±0)` - // Minimum execution time: 251_638_000 picoseconds. - Weight::from_parts(244_791_817, 21840) - // Standard Error: 89_537 - .saturating_add(Weight::from_parts(2_459_492, 0).saturating_mul(t.into())) - // Standard Error: 25 - .saturating_add(Weight::from_parts(626, 0).saturating_mul(n.into())) + // Estimated: `6744 + t * (2508 ±0)` + // Minimum execution time: 250_301_000 picoseconds. + Weight::from_parts(245_292_258, 6744) + // Standard Error: 29_864 + .saturating_add(Weight::from_parts(2_163_531, 0).saturating_mul(t.into())) + // Standard Error: 8 + .saturating_add(Weight::from_parts(583, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) - .saturating_add(Weight::from_parts(0, 2640).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 2508).saturating_mul(t.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -910,14 +909,14 @@ impl WeightInfo for SubstrateWeight { fn seal_debug_message(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `777 + r * (7 ±0)` - // Estimated: `21725 + r * (35 ±0)` - // Minimum execution time: 164_736_000 picoseconds. - Weight::from_parts(164_496_597, 21725) - // Standard Error: 4_619 - .saturating_add(Weight::from_parts(252_013, 0).saturating_mul(r.into())) + // Estimated: `6721 + r * (7 ±0)` + // Minimum execution time: 165_711_000 picoseconds. + Weight::from_parts(168_792_571, 6721) + // Standard Error: 216 + .saturating_add(Weight::from_parts(230_285, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 35).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 7).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) @@ -933,11 +932,11 @@ impl WeightInfo for SubstrateWeight { fn seal_debug_message_per_byte(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `125728` - // Estimated: `269977` - // Minimum execution time: 352_146_000 picoseconds. - Weight::from_parts(357_758_251, 269977) - // Standard Error: 1 - .saturating_add(Weight::from_parts(735, 0).saturating_mul(i.into())) + // Estimated: `131670` + // Minimum execution time: 348_928_000 picoseconds. + Weight::from_parts(352_224_793, 131670) + // Standard Error: 0 + .saturating_add(Weight::from_parts(731, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -948,10 +947,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `845 + r * (292 ±0)` // Estimated: `843 + r * (293 ±0)` - // Minimum execution time: 236_170_000 picoseconds. - Weight::from_parts(136_284_582, 843) - // Standard Error: 10_269 - .saturating_add(Weight::from_parts(5_995_228, 0).saturating_mul(r.into())) + // Minimum execution time: 236_418_000 picoseconds. + Weight::from_parts(129_862_840, 843) + // Standard Error: 9_733 + .saturating_add(Weight::from_parts(6_005_187, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -965,10 +964,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1304` // Estimated: `1280` - // Minimum execution time: 253_837_000 picoseconds. - Weight::from_parts(287_029_261, 1280) - // Standard Error: 51 - .saturating_add(Weight::from_parts(534, 0).saturating_mul(n.into())) + // Minimum execution time: 251_599_000 picoseconds. + Weight::from_parts(285_284_665, 1280) + // Standard Error: 46 + .saturating_add(Weight::from_parts(410, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -979,10 +978,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1167 + n * (1 ±0)` // Estimated: `1167 + n * (1 ±0)` - // Minimum execution time: 253_037_000 picoseconds. - Weight::from_parts(256_401_533, 1167) - // Standard Error: 18 - .saturating_add(Weight::from_parts(32, 0).saturating_mul(n.into())) + // Minimum execution time: 251_309_000 picoseconds. + Weight::from_parts(253_555_552, 1167) + // Standard Error: 9 + .saturating_add(Weight::from_parts(27, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -994,10 +993,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `841 + r * (288 ±0)` // Estimated: `845 + r * (289 ±0)` - // Minimum execution time: 236_800_000 picoseconds. - Weight::from_parts(134_748_031, 845) - // Standard Error: 9_560 - .saturating_add(Weight::from_parts(5_923_187, 0).saturating_mul(r.into())) + // Minimum execution time: 235_441_000 picoseconds. + Weight::from_parts(132_980_942, 845) + // Standard Error: 9_421 + .saturating_add(Weight::from_parts(5_854_896, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1011,9 +1010,9 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1163 + n * (1 ±0)` // Estimated: `1163 + n * (1 ±0)` - // Minimum execution time: 250_601_000 picoseconds. - Weight::from_parts(253_618_803, 1163) - // Standard Error: 18 + // Minimum execution time: 249_967_000 picoseconds. + Weight::from_parts(252_122_186, 1163) + // Standard Error: 10 .saturating_add(Weight::from_parts(74, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) @@ -1026,10 +1025,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `835 + r * (296 ±0)` // Estimated: `840 + r * (297 ±0)` - // Minimum execution time: 236_194_000 picoseconds. - Weight::from_parts(152_630_909, 840) - // Standard Error: 8_573 - .saturating_add(Weight::from_parts(4_896_099, 0).saturating_mul(r.into())) + // Minimum execution time: 235_647_000 picoseconds. + Weight::from_parts(145_525_169, 840) + // Standard Error: 8_553 + .saturating_add(Weight::from_parts(4_948_021, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1042,10 +1041,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1179 + n * (1 ±0)` // Estimated: `1179 + n * (1 ±0)` - // Minimum execution time: 250_989_000 picoseconds. - Weight::from_parts(260_170_747, 1179) - // Standard Error: 162 - .saturating_add(Weight::from_parts(224, 0).saturating_mul(n.into())) + // Minimum execution time: 249_576_000 picoseconds. + Weight::from_parts(250_747_191, 1179) + // Standard Error: 8 + .saturating_add(Weight::from_parts(717, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1057,10 +1056,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `856 + r * (288 ±0)` // Estimated: `857 + r * (289 ±0)` - // Minimum execution time: 236_574_000 picoseconds. - Weight::from_parts(155_573_955, 857) - // Standard Error: 10_270 - .saturating_add(Weight::from_parts(4_667_644, 0).saturating_mul(r.into())) + // Minimum execution time: 236_110_000 picoseconds. + Weight::from_parts(148_420_625, 857) + // Standard Error: 8_175 + .saturating_add(Weight::from_parts(4_684_126, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1073,10 +1072,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1166 + n * (1 ±0)` // Estimated: `1166 + n * (1 ±0)` - // Minimum execution time: 249_502_000 picoseconds. - Weight::from_parts(251_496_311, 1166) - // Standard Error: 26 - .saturating_add(Weight::from_parts(186, 0).saturating_mul(n.into())) + // Minimum execution time: 247_800_000 picoseconds. + Weight::from_parts(249_410_575, 1166) + // Standard Error: 6 + .saturating_add(Weight::from_parts(99, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1088,10 +1087,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `829 + r * (296 ±0)` // Estimated: `836 + r * (297 ±0)` - // Minimum execution time: 236_030_000 picoseconds. - Weight::from_parts(128_595_856, 836) - // Standard Error: 10_530 - .saturating_add(Weight::from_parts(6_072_638, 0).saturating_mul(r.into())) + // Minimum execution time: 235_251_000 picoseconds. + Weight::from_parts(128_816_707, 836) + // Standard Error: 9_887 + .saturating_add(Weight::from_parts(6_167_176, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -1105,10 +1104,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1180 + n * (1 ±0)` // Estimated: `1180 + n * (1 ±0)` - // Minimum execution time: 254_027_000 picoseconds. - Weight::from_parts(260_739_475, 1180) - // Standard Error: 115 - .saturating_add(Weight::from_parts(330, 0).saturating_mul(n.into())) + // Minimum execution time: 250_401_000 picoseconds. + Weight::from_parts(253_298_243, 1180) + // Standard Error: 9 + .saturating_add(Weight::from_parts(667, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1127,16 +1126,16 @@ impl WeightInfo for SubstrateWeight { fn seal_transfer(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1373 + r * (45 ±0)` - // Estimated: `26753 + r * (2700 ±0)` - // Minimum execution time: 237_634_000 picoseconds. - Weight::from_parts(238_177_000, 26753) - // Standard Error: 23_320 - .saturating_add(Weight::from_parts(35_467_618, 0).saturating_mul(r.into())) + // Estimated: `7270 + r * (2520 ±0)` + // Minimum execution time: 236_470_000 picoseconds. + Weight::from_parts(98_898_727, 7270) + // Standard Error: 33_316 + .saturating_add(Weight::from_parts(35_149_946, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 2700).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1152,16 +1151,16 @@ impl WeightInfo for SubstrateWeight { fn seal_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1237 + r * (256 ±0)` - // Estimated: `26028 + r * (6235 ±0)` - // Minimum execution time: 237_076_000 picoseconds. - Weight::from_parts(237_792_000, 26028) - // Standard Error: 91_566 - .saturating_add(Weight::from_parts(212_893_975, 0).saturating_mul(r.into())) + // Estimated: `7125 + r * (2732 ±0)` + // Minimum execution time: 238_303_000 picoseconds. + Weight::from_parts(239_024_000, 7125) + // Standard Error: 65_907 + .saturating_add(Weight::from_parts(209_419_071, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 6235).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2732).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1177,16 +1176,16 @@ impl WeightInfo for SubstrateWeight { fn seal_delegate_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + r * (502 ±0)` - // Estimated: `21755 + r * (6329 ±3)` - // Minimum execution time: 236_275_000 picoseconds. - Weight::from_parts(236_849_000, 21755) - // Standard Error: 92_724 - .saturating_add(Weight::from_parts(207_159_396, 0).saturating_mul(r.into())) + // Estimated: `6727 + r * (2572 ±10)` + // Minimum execution time: 235_961_000 picoseconds. + Weight::from_parts(236_939_000, 6727) + // Standard Error: 83_087 + .saturating_add(Weight::from_parts(205_646_517, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 6329).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2572).saturating_mul(r.into())) } /// Storage: System Account (r:3 w:2) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1203,18 +1202,18 @@ impl WeightInfo for SubstrateWeight { fn seal_call_per_transfer_clone_byte(t: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1154 + t * (204 ±0)` - // Estimated: `31015 + t * (5970 ±0)` - // Minimum execution time: 412_628_000 picoseconds. - Weight::from_parts(385_108_035, 31015) - // Standard Error: 1_002_078 - .saturating_add(Weight::from_parts(31_204_678, 0).saturating_mul(t.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(598, 0).saturating_mul(c.into())) + // Estimated: `9569 + t * (5154 ±0)` + // Minimum execution time: 410_156_000 picoseconds. + Weight::from_parts(378_378_143, 9569) + // Standard Error: 285_172 + .saturating_add(Weight::from_parts(34_736_740, 0).saturating_mul(t.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(591, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(5_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(t.into()))) - .saturating_add(Weight::from_parts(0, 5970).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 5154).saturating_mul(t.into())) } /// Storage: System Account (r:1602 w:1602) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1234,16 +1233,16 @@ impl WeightInfo for SubstrateWeight { fn seal_instantiate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1301 + r * (254 ±0)` - // Estimated: `30977 + r * (16635 ±0)` - // Minimum execution time: 237_161_000 picoseconds. - Weight::from_parts(237_620_000, 30977) - // Standard Error: 258_036 - .saturating_add(Weight::from_parts(344_869_637, 0).saturating_mul(r.into())) + // Estimated: `7131 + r * (5205 ±0)` + // Minimum execution time: 236_748_000 picoseconds. + Weight::from_parts(237_129_000, 7131) + // Standard Error: 280_059 + .saturating_add(Weight::from_parts(341_428_013, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(6_u64)) .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 16635).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 5205).saturating_mul(r.into())) } /// Storage: System Account (r:4 w:4) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1265,20 +1264,20 @@ impl WeightInfo for SubstrateWeight { fn seal_instantiate_per_transfer_input_salt_byte(t: u32, i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1071 + t * (187 ±0)` - // Estimated: `42684 + t * (3588 ±2)` - // Minimum execution time: 1_613_172_000 picoseconds. - Weight::from_parts(326_952_137, 42684) - // Standard Error: 4_738_925 - .saturating_add(Weight::from_parts(113_657_996, 0).saturating_mul(t.into())) - // Standard Error: 7 - .saturating_add(Weight::from_parts(1_173, 0).saturating_mul(i.into())) - // Standard Error: 7 - .saturating_add(Weight::from_parts(1_347, 0).saturating_mul(s.into())) + // Estimated: `9492 + t * (2634 ±2)` + // Minimum execution time: 1_613_796_000 picoseconds. + Weight::from_parts(340_002_206, 9492) + // Standard Error: 4_296_381 + .saturating_add(Weight::from_parts(115_239_834, 0).saturating_mul(t.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(1_145, 0).saturating_mul(i.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(1_315, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(10_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) - .saturating_add(Weight::from_parts(0, 3588).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 2634).saturating_mul(t.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1294,14 +1293,14 @@ impl WeightInfo for SubstrateWeight { fn seal_hash_sha2_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `777 + r * (8 ±0)` - // Estimated: `21710 + r * (40 ±0)` - // Minimum execution time: 233_679_000 picoseconds. - Weight::from_parts(238_638_820, 21710) - // Standard Error: 681 - .saturating_add(Weight::from_parts(573_320, 0).saturating_mul(r.into())) + // Estimated: `6718 + r * (8 ±0)` + // Minimum execution time: 233_111_000 picoseconds. + Weight::from_parts(238_643_933, 6718) + // Standard Error: 184 + .saturating_add(Weight::from_parts(572_296, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1317,11 +1316,11 @@ impl WeightInfo for SubstrateWeight { fn seal_hash_sha2_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `785` - // Estimated: `21745` - // Minimum execution time: 235_992_000 picoseconds. - Weight::from_parts(219_924_252, 21745) - // Standard Error: 5 - .saturating_add(Weight::from_parts(3_978, 0).saturating_mul(n.into())) + // Estimated: `6725` + // Minimum execution time: 234_746_000 picoseconds. + Weight::from_parts(229_815_552, 6725) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_892, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1339,14 +1338,14 @@ impl WeightInfo for SubstrateWeight { fn seal_hash_keccak_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` - // Estimated: `21725 + r * (40 ±0)` - // Minimum execution time: 240_661_000 picoseconds. - Weight::from_parts(238_809_422, 21725) - // Standard Error: 820 - .saturating_add(Weight::from_parts(741_326, 0).saturating_mul(r.into())) + // Estimated: `6721 + r * (8 ±0)` + // Minimum execution time: 232_732_000 picoseconds. + Weight::from_parts(239_007_209, 6721) + // Standard Error: 256 + .saturating_add(Weight::from_parts(733_879, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1362,11 +1361,11 @@ impl WeightInfo for SubstrateWeight { fn seal_hash_keccak_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `787` - // Estimated: `21765` - // Minimum execution time: 235_136_000 picoseconds. - Weight::from_parts(228_678_487, 21765) - // Standard Error: 2 - .saturating_add(Weight::from_parts(3_164, 0).saturating_mul(n.into())) + // Estimated: `6729` + // Minimum execution time: 234_184_000 picoseconds. + Weight::from_parts(227_603_375, 6729) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_127, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1384,14 +1383,14 @@ impl WeightInfo for SubstrateWeight { fn seal_hash_blake2_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` - // Estimated: `21740 + r * (40 ±0)` - // Minimum execution time: 233_364_000 picoseconds. - Weight::from_parts(243_294_285, 21740) - // Standard Error: 1_607 - .saturating_add(Weight::from_parts(413_186, 0).saturating_mul(r.into())) + // Estimated: `6724 + r * (8 ±0)` + // Minimum execution time: 233_038_000 picoseconds. + Weight::from_parts(238_515_817, 6724) + // Standard Error: 255 + .saturating_add(Weight::from_parts(413_343, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1407,11 +1406,11 @@ impl WeightInfo for SubstrateWeight { fn seal_hash_blake2_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `787` - // Estimated: `21785` - // Minimum execution time: 234_315_000 picoseconds. - Weight::from_parts(225_569_537, 21785) + // Estimated: `6733` + // Minimum execution time: 232_996_000 picoseconds. + Weight::from_parts(226_706_997, 6733) // Standard Error: 1 - .saturating_add(Weight::from_parts(919, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(908, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1429,14 +1428,14 @@ impl WeightInfo for SubstrateWeight { fn seal_hash_blake2_128(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` - // Estimated: `21745 + r * (40 ±0)` - // Minimum execution time: 233_288_000 picoseconds. - Weight::from_parts(239_289_154, 21745) - // Standard Error: 612 - .saturating_add(Weight::from_parts(414_275, 0).saturating_mul(r.into())) + // Estimated: `6725 + r * (8 ±0)` + // Minimum execution time: 232_292_000 picoseconds. + Weight::from_parts(237_997_001, 6725) + // Standard Error: 219 + .saturating_add(Weight::from_parts(410_177, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1452,11 +1451,11 @@ impl WeightInfo for SubstrateWeight { fn seal_hash_blake2_128_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `787` - // Estimated: `21755` - // Minimum execution time: 233_686_000 picoseconds. - Weight::from_parts(227_406_694, 21755) + // Estimated: `6727` + // Minimum execution time: 234_815_000 picoseconds. + Weight::from_parts(226_317_150, 6727) // Standard Error: 1 - .saturating_add(Weight::from_parts(919, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(911, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1473,15 +1472,15 @@ impl WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `916 + n * (1 ±0)` - // Estimated: `22375 + n * (5 ±0)` - // Minimum execution time: 287_258_000 picoseconds. - Weight::from_parts(290_941_609, 22375) - // Standard Error: 8 - .saturating_add(Weight::from_parts(4_785, 0).saturating_mul(n.into())) + // Measured: `912 + n * (1 ±0)` + // Estimated: `6848 + n * (1 ±0)` + // Minimum execution time: 286_323_000 picoseconds. + Weight::from_parts(290_287_955, 6848) + // Standard Error: 1 + .saturating_add(Weight::from_parts(4_693, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 5).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1496,15 +1495,15 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 160]`. fn seal_sr25519_verify(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `728 + r * (112 ±0)` - // Estimated: `21455 + r * (560 ±0)` - // Minimum execution time: 238_340_000 picoseconds. - Weight::from_parts(246_009_851, 21455) - // Standard Error: 21_677 - .saturating_add(Weight::from_parts(48_139_487, 0).saturating_mul(r.into())) + // Measured: `727 + r * (112 ±0)` + // Estimated: `6666 + r * (112 ±0)` + // Minimum execution time: 235_938_000 picoseconds. + Weight::from_parts(242_728_358, 6666) + // Standard Error: 9_725 + .saturating_add(Weight::from_parts(47_527_740, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 560).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 112).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1520,14 +1519,14 @@ impl WeightInfo for SubstrateWeight { fn seal_ecdsa_recover(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `822 + r * (76 ±0)` - // Estimated: `21705 + r * (385 ±0)` - // Minimum execution time: 236_244_000 picoseconds. - Weight::from_parts(253_749_242, 21705) - // Standard Error: 19_216 - .saturating_add(Weight::from_parts(37_706_782, 0).saturating_mul(r.into())) + // Estimated: `6716 + r * (77 ±0)` + // Minimum execution time: 236_108_000 picoseconds. + Weight::from_parts(248_577_226, 6716) + // Standard Error: 9_565 + .saturating_add(Weight::from_parts(36_733_552, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 385).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 77).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1543,14 +1542,14 @@ impl WeightInfo for SubstrateWeight { fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `792 + r * (42 ±0)` - // Estimated: `21775 + r * (210 ±0)` - // Minimum execution time: 235_770_000 picoseconds. - Weight::from_parts(230_780_347, 21775) - // Standard Error: 12_015 - .saturating_add(Weight::from_parts(9_584_947, 0).saturating_mul(r.into())) + // Estimated: `6731 + r * (42 ±0)` + // Minimum execution time: 236_440_000 picoseconds. + Weight::from_parts(240_771_418, 6731) + // Standard Error: 1_849 + .saturating_add(Weight::from_parts(9_185_896, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 210).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 42).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1568,16 +1567,16 @@ impl WeightInfo for SubstrateWeight { fn seal_set_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + r * (964 ±0)` - // Estimated: `29920 + r * (11544 ±7)` - // Minimum execution time: 235_857_000 picoseconds. - Weight::from_parts(236_482_000, 29920) - // Standard Error: 47_818 - .saturating_add(Weight::from_parts(21_765_273, 0).saturating_mul(r.into())) + // Estimated: `8190 + r * (3090 ±10)` + // Minimum execution time: 235_056_000 picoseconds. + Weight::from_parts(235_743_000, 8190) + // Standard Error: 46_122 + .saturating_add(Weight::from_parts(21_447_984, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 11544).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 3090).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1593,14 +1592,14 @@ impl WeightInfo for SubstrateWeight { fn seal_reentrance_count(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `773 + r * (3 ±0)` - // Estimated: `21735 + r * (15 ±0)` - // Minimum execution time: 235_388_000 picoseconds. - Weight::from_parts(240_149_512, 21735) - // Standard Error: 555 - .saturating_add(Weight::from_parts(162_666, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (3 ±0)` + // Minimum execution time: 235_213_000 picoseconds. + Weight::from_parts(239_456_464, 6723) + // Standard Error: 130 + .saturating_add(Weight::from_parts(159_851, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 15).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1616,14 +1615,14 @@ impl WeightInfo for SubstrateWeight { fn seal_account_reentrance_count(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1975 + r * (39 ±0)` - // Estimated: `27145 + r * (200 ±0)` - // Minimum execution time: 237_485_000 picoseconds. - Weight::from_parts(268_044_053, 27145) - // Standard Error: 1_147 - .saturating_add(Weight::from_parts(260_572, 0).saturating_mul(r.into())) + // Estimated: `7805 + r * (40 ±0)` + // Minimum execution time: 237_886_000 picoseconds. + Weight::from_parts(262_430_157, 7805) + // Standard Error: 939 + .saturating_add(Weight::from_parts(260_005, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 200).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -1641,524 +1640,524 @@ impl WeightInfo for SubstrateWeight { fn seal_instantiation_nonce(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `776 + r * (3 ±0)` - // Estimated: `24004 + r * (18 ±0)` - // Minimum execution time: 234_123_000 picoseconds. - Weight::from_parts(245_872_832, 24004) - // Standard Error: 943 - .saturating_add(Weight::from_parts(136_460, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (3 ±0)` + // Minimum execution time: 234_014_000 picoseconds. + Weight::from_parts(240_042_671, 6723) + // Standard Error: 152 + .saturating_add(Weight::from_parts(138_382, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 18).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_606_000 picoseconds. - Weight::from_parts(1_845_698, 0) + // Minimum execution time: 1_533_000 picoseconds. + Weight::from_parts(1_846_015, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(2_995, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_935, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_711_000 picoseconds. - Weight::from_parts(2_281_581, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(6_354, 0).saturating_mul(r.into())) + // Minimum execution time: 1_671_000 picoseconds. + Weight::from_parts(2_197_197, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(6_335, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_680_000 picoseconds. - Weight::from_parts(2_269_238, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(6_014, 0).saturating_mul(r.into())) + // Minimum execution time: 1_665_000 picoseconds. + Weight::from_parts(2_200_545, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(6_011, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_592_000 picoseconds. - Weight::from_parts(2_010_963, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(7_927, 0).saturating_mul(r.into())) + // Minimum execution time: 1_545_000 picoseconds. + Weight::from_parts(1_977_462, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(7_901, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_631_000 picoseconds. - Weight::from_parts(1_936_549, 0) - // Standard Error: 6 - .saturating_add(Weight::from_parts(10_426, 0).saturating_mul(r.into())) + // Minimum execution time: 1_515_000 picoseconds. + Weight::from_parts(1_866_184, 0) + // Standard Error: 4 + .saturating_add(Weight::from_parts(10_514, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_616_000 picoseconds. - Weight::from_parts(1_938_716, 0) - // Standard Error: 15 - .saturating_add(Weight::from_parts(4_525, 0).saturating_mul(r.into())) + // Minimum execution time: 1_618_000 picoseconds. + Weight::from_parts(1_895_104, 0) + // Standard Error: 12 + .saturating_add(Weight::from_parts(4_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_535_000 picoseconds. - Weight::from_parts(1_109_860, 0) - // Standard Error: 77 - .saturating_add(Weight::from_parts(7_998, 0).saturating_mul(r.into())) + // Minimum execution time: 1_510_000 picoseconds. + Weight::from_parts(1_779_998, 0) + // Standard Error: 8 + .saturating_add(Weight::from_parts(6_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_594_000 picoseconds. - Weight::from_parts(1_478_654, 0) - // Standard Error: 36 - .saturating_add(Weight::from_parts(9_525, 0).saturating_mul(r.into())) + // Minimum execution time: 1_529_000 picoseconds. + Weight::from_parts(1_726_996, 0) + // Standard Error: 26 + .saturating_add(Weight::from_parts(9_199, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_730_000 picoseconds. - Weight::from_parts(1_836_342, 0) - // Standard Error: 14 - .saturating_add(Weight::from_parts(206, 0).saturating_mul(e.into())) + // Minimum execution time: 1_682_000 picoseconds. + Weight::from_parts(1_789_910, 0) + // Standard Error: 16 + .saturating_add(Weight::from_parts(42, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_607_000 picoseconds. - Weight::from_parts(2_150_133, 0) - // Standard Error: 17 - .saturating_add(Weight::from_parts(18_630, 0).saturating_mul(r.into())) + // Minimum execution time: 1_539_000 picoseconds. + Weight::from_parts(2_093_056, 0) + // Standard Error: 27 + .saturating_add(Weight::from_parts(18_917, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_824_000 picoseconds. - Weight::from_parts(3_119_825, 0) - // Standard Error: 15 - .saturating_add(Weight::from_parts(25_304, 0).saturating_mul(r.into())) + // Minimum execution time: 1_851_000 picoseconds. + Weight::from_parts(3_134_610, 0) + // Standard Error: 34 + .saturating_add(Weight::from_parts(24_714, 0).saturating_mul(r.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_692_000 picoseconds. - Weight::from_parts(1_927_049, 0) + // Minimum execution time: 1_654_000 picoseconds. + Weight::from_parts(1_885_921, 0) // Standard Error: 14 - .saturating_add(Weight::from_parts(1_217, 0).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(1_243, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_795_000 picoseconds. - Weight::from_parts(3_107_843, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(2_445, 0).saturating_mul(r.into())) + // Minimum execution time: 2_744_000 picoseconds. + Weight::from_parts(3_014_725, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_447, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_815_000 picoseconds. - Weight::from_parts(3_114_618, 0) + // Minimum execution time: 2_881_000 picoseconds. + Weight::from_parts(3_137_711, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(3_639, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_608, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_861_000 picoseconds. - Weight::from_parts(3_193_592, 0) + // Minimum execution time: 2_809_000 picoseconds. + Weight::from_parts(3_142_066, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(3_957, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_841, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_710_000 picoseconds. - Weight::from_parts(2_148_021, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(8_391, 0).saturating_mul(r.into())) + // Minimum execution time: 1_704_000 picoseconds. + Weight::from_parts(2_083_619, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(8_366, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_663_000 picoseconds. - Weight::from_parts(2_170_373, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(8_812, 0).saturating_mul(r.into())) + // Minimum execution time: 1_652_000 picoseconds. + Weight::from_parts(2_048_256, 0) + // Standard Error: 5 + .saturating_add(Weight::from_parts(8_826, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_662_000 picoseconds. - Weight::from_parts(2_601_398, 0) - // Standard Error: 198 - .saturating_add(Weight::from_parts(3_851, 0).saturating_mul(r.into())) + // Minimum execution time: 1_671_000 picoseconds. + Weight::from_parts(1_924_626, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_746, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 16]`. fn instr_memory_grow(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_603_000 picoseconds. - Weight::from_parts(332_932, 0) - // Standard Error: 137_529 - .saturating_add(Weight::from_parts(13_233_734, 0).saturating_mul(r.into())) + // Minimum execution time: 1_585_000 picoseconds. + Weight::from_parts(490_856, 0) + // Standard Error: 133_673 + .saturating_add(Weight::from_parts(13_182_582, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_613_000 picoseconds. - Weight::from_parts(1_922_391, 0) + // Minimum execution time: 1_533_000 picoseconds. + Weight::from_parts(1_851_563, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_903, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_820, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_522_000 picoseconds. - Weight::from_parts(1_920_023, 0) + // Minimum execution time: 1_564_000 picoseconds. + Weight::from_parts(1_914_178, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_876, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_590_000 picoseconds. - Weight::from_parts(1_867_406, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3_910, 0).saturating_mul(r.into())) + // Minimum execution time: 1_559_000 picoseconds. + Weight::from_parts(1_886_992, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(3_731, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_577_000 picoseconds. - Weight::from_parts(1_918_037, 0) + // Minimum execution time: 1_553_000 picoseconds. + Weight::from_parts(1_886_545, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_673, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_658, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_589_000 picoseconds. - Weight::from_parts(1_917_901, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3_956, 0).saturating_mul(r.into())) + // Minimum execution time: 1_507_000 picoseconds. + Weight::from_parts(1_853_647, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(3_852, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_573_000 picoseconds. - Weight::from_parts(1_902_324, 0) + // Minimum execution time: 1_554_000 picoseconds. + Weight::from_parts(1_868_877, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_865, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_806, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_586_000 picoseconds. - Weight::from_parts(1_953_738, 0) + // Minimum execution time: 1_514_000 picoseconds. + Weight::from_parts(1_882_233, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_838, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_598_000 picoseconds. - Weight::from_parts(1_912_180, 0) + // Minimum execution time: 1_529_000 picoseconds. + Weight::from_parts(1_897_247, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_994, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_955, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_573_000 picoseconds. - Weight::from_parts(1_943_725, 0) + // Minimum execution time: 1_513_000 picoseconds. + Weight::from_parts(1_922_333, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_998, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_933, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_584_000 picoseconds. - Weight::from_parts(1_949_209, 0) + // Minimum execution time: 1_512_000 picoseconds. + Weight::from_parts(1_848_668, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_991, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_966, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_576_000 picoseconds. - Weight::from_parts(1_927_466, 0) + // Minimum execution time: 1_522_000 picoseconds. + Weight::from_parts(1_875_257, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(6_005, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_965, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_566_000 picoseconds. - Weight::from_parts(2_004_312, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_799, 0).saturating_mul(r.into())) + // Minimum execution time: 1_546_000 picoseconds. + Weight::from_parts(1_836_691, 0) + // Standard Error: 4 + .saturating_add(Weight::from_parts(5_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_538_000 picoseconds. - Weight::from_parts(1_922_703, 0) - // Standard Error: 9 - .saturating_add(Weight::from_parts(6_129, 0).saturating_mul(r.into())) + // Minimum execution time: 1_505_000 picoseconds. + Weight::from_parts(1_907_551, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_575_000 picoseconds. - Weight::from_parts(1_978_271, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_991, 0).saturating_mul(r.into())) + // Minimum execution time: 1_527_000 picoseconds. + Weight::from_parts(1_891_008, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_971, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_572_000 picoseconds. - Weight::from_parts(4_028_578, 0) - // Standard Error: 263 - .saturating_add(Weight::from_parts(5_784, 0).saturating_mul(r.into())) + // Minimum execution time: 1_556_000 picoseconds. + Weight::from_parts(1_910_864, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_059, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_615_000 picoseconds. - Weight::from_parts(1_962_065, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_945, 0).saturating_mul(r.into())) + // Minimum execution time: 1_544_000 picoseconds. + Weight::from_parts(1_912_650, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_943, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_578_000 picoseconds. - Weight::from_parts(1_909_721, 0) + // Minimum execution time: 1_513_000 picoseconds. + Weight::from_parts(1_855_260, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_993, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_975, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_609_000 picoseconds. - Weight::from_parts(1_926_472, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_888, 0).saturating_mul(r.into())) + // Minimum execution time: 1_521_000 picoseconds. + Weight::from_parts(1_867_259, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_846, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_620_000 picoseconds. - Weight::from_parts(2_875_196, 0) - // Standard Error: 177 - .saturating_add(Weight::from_parts(5_990, 0).saturating_mul(r.into())) + // Minimum execution time: 1_509_000 picoseconds. + Weight::from_parts(1_893_018, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_570_000 picoseconds. - Weight::from_parts(2_155_483, 0) - // Standard Error: 83 - .saturating_add(Weight::from_parts(5_675, 0).saturating_mul(r.into())) + // Minimum execution time: 1_496_000 picoseconds. + Weight::from_parts(1_886_659, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_754, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_558_000 picoseconds. - Weight::from_parts(2_108_263, 0) - // Standard Error: 5 - .saturating_add(Weight::from_parts(11_755, 0).saturating_mul(r.into())) + // Minimum execution time: 1_527_000 picoseconds. + Weight::from_parts(1_890_548, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(11_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_568_000 picoseconds. - Weight::from_parts(1_606_397, 0) - // Standard Error: 51 - .saturating_add(Weight::from_parts(11_011, 0).saturating_mul(r.into())) + // Minimum execution time: 1_518_000 picoseconds. + Weight::from_parts(1_891_903, 0) + // Standard Error: 4 + .saturating_add(Weight::from_parts(10_613, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_630_000 picoseconds. - Weight::from_parts(2_872_487, 0) - // Standard Error: 24 - .saturating_add(Weight::from_parts(11_761, 0).saturating_mul(r.into())) + // Minimum execution time: 1_504_000 picoseconds. + Weight::from_parts(1_632_694, 0) + // Standard Error: 7 + .saturating_add(Weight::from_parts(12_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_575_000 picoseconds. - Weight::from_parts(2_385_398, 0) - // Standard Error: 45 - .saturating_add(Weight::from_parts(10_650, 0).saturating_mul(r.into())) + // Minimum execution time: 1_507_000 picoseconds. + Weight::from_parts(1_878_413, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(10_737, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_622_000 picoseconds. - Weight::from_parts(1_957_246, 0) + // Minimum execution time: 1_534_000 picoseconds. + Weight::from_parts(1_898_519, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_659, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_645, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_551_000 picoseconds. - Weight::from_parts(1_897_168, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_774, 0).saturating_mul(r.into())) + // Minimum execution time: 1_503_000 picoseconds. + Weight::from_parts(1_895_532, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_745, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_549_000 picoseconds. - Weight::from_parts(1_915_938, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_915, 0).saturating_mul(r.into())) + // Minimum execution time: 1_507_000 picoseconds. + Weight::from_parts(1_868_720, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_873, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_617_000 picoseconds. - Weight::from_parts(1_932_618, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_854, 0).saturating_mul(r.into())) + // Minimum execution time: 1_513_000 picoseconds. + Weight::from_parts(1_894_207, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_617_000 picoseconds. - Weight::from_parts(1_937_566, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(6_134, 0).saturating_mul(r.into())) + // Minimum execution time: 1_473_000 picoseconds. + Weight::from_parts(1_880_224, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_107, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_584_000 picoseconds. - Weight::from_parts(1_980_681, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_842, 0).saturating_mul(r.into())) + // Minimum execution time: 1_447_000 picoseconds. + Weight::from_parts(1_884_551, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_849, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_542_000 picoseconds. - Weight::from_parts(2_131_567, 0) - // Standard Error: 57 - .saturating_add(Weight::from_parts(6_010, 0).saturating_mul(r.into())) + // Minimum execution time: 1_538_000 picoseconds. + Weight::from_parts(1_908_813, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_987, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_609_000 picoseconds. - Weight::from_parts(1_643_214, 0) - // Standard Error: 91 - .saturating_add(Weight::from_parts(6_062, 0).saturating_mul(r.into())) + // Minimum execution time: 1_538_000 picoseconds. + Weight::from_parts(1_878_015, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_848, 0).saturating_mul(r.into())) } } @@ -2170,8 +2169,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 2_503_000 picoseconds. - Weight::from_parts(2_603_000, 1594) + // Minimum execution time: 2_565_000 picoseconds. + Weight::from_parts(2_759_000, 1594) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Skipped Metadata (r:0 w:0) @@ -2181,10 +2180,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `488 + k * (69 ±0)` // Estimated: `478 + k * (70 ±0)` - // Minimum execution time: 13_292_000 picoseconds. - Weight::from_parts(9_180_439, 478) - // Standard Error: 997 - .saturating_add(Weight::from_parts(967_522, 0).saturating_mul(k.into())) + // Minimum execution time: 13_480_000 picoseconds. + Weight::from_parts(10_153_869, 478) + // Standard Error: 427 + .saturating_add(Weight::from_parts(958_726, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -2199,14 +2198,14 @@ impl WeightInfo for () { fn reinstrument(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `238 + c * (1 ±0)` - // Estimated: `3951 + c * (2 ±0)` - // Minimum execution time: 30_822_000 picoseconds. - Weight::from_parts(26_457_115, 3951) - // Standard Error: 58 - .saturating_add(Weight::from_parts(54_868, 0).saturating_mul(c.into())) + // Estimated: `3708 + c * (1 ±0)` + // Minimum execution time: 30_406_000 picoseconds. + Weight::from_parts(28_467_370, 3708) + // Standard Error: 46 + .saturating_add(Weight::from_parts(53_724, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 2).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) } /// Storage: Contracts ContractInfoOf (r:1 w:1) /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(290), added: 2765, mode: Measured) @@ -2222,14 +2221,14 @@ impl WeightInfo for () { fn call_with_code_per_byte(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `707` - // Estimated: `21400 + c * (5 ±0)` - // Minimum execution time: 263_719_000 picoseconds. - Weight::from_parts(275_281_941, 21400) - // Standard Error: 32 - .saturating_add(Weight::from_parts(37_880, 0).saturating_mul(c.into())) + // Estimated: `6656 + c * (1 ±0)` + // Minimum execution time: 263_198_000 picoseconds. + Weight::from_parts(276_162_279, 6656) + // Standard Error: 18 + .saturating_add(Weight::from_parts(37_378, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 5).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) } /// Storage: Contracts OwnerInfoOf (r:1 w:1) /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Measured) @@ -2253,15 +2252,15 @@ impl WeightInfo for () { fn instantiate_with_code(c: u32, i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `270` - // Estimated: `26207` - // Minimum execution time: 3_133_756_000 picoseconds. - Weight::from_parts(556_483_545, 26207) - // Standard Error: 294 - .saturating_add(Weight::from_parts(107_914, 0).saturating_mul(c.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(1_143, 0).saturating_mul(i.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(1_456, 0).saturating_mul(s.into())) + // Estimated: `8659` + // Minimum execution time: 3_132_259_000 picoseconds. + Weight::from_parts(513_284_834, 8659) + // Standard Error: 280 + .saturating_add(Weight::from_parts(106_723, 0).saturating_mul(c.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(1_166, 0).saturating_mul(i.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(1_436, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2284,13 +2283,13 @@ impl WeightInfo for () { fn instantiate(i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `482` - // Estimated: `28521` - // Minimum execution time: 1_646_953_000 picoseconds. - Weight::from_parts(262_115_215, 28521) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_454, 0).saturating_mul(i.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(1_463, 0).saturating_mul(s.into())) + // Estimated: `6408` + // Minimum execution time: 1_646_604_000 picoseconds. + Weight::from_parts(271_369_256, 6408) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_426, 0).saturating_mul(i.into())) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_438, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -2307,9 +2306,9 @@ impl WeightInfo for () { fn call() -> Weight { // Proof Size summary in bytes: // Measured: `759` - // Estimated: `21615` - // Minimum execution time: 190_769_000 picoseconds. - Weight::from_parts(191_717_000, 21615) + // Estimated: `6699` + // Minimum execution time: 191_360_000 picoseconds. + Weight::from_parts(192_625_000, 6699) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2325,11 +2324,11 @@ impl WeightInfo for () { fn upload_code(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `109` - // Estimated: `7366` - // Minimum execution time: 246_204_000 picoseconds. - Weight::from_parts(243_234_754, 7366) - // Standard Error: 78 - .saturating_add(Weight::from_parts(109_232, 0).saturating_mul(c.into())) + // Estimated: `3574` + // Minimum execution time: 245_207_000 picoseconds. + Weight::from_parts(244_703_457, 3574) + // Standard Error: 61 + .saturating_add(Weight::from_parts(106_850, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2344,9 +2343,9 @@ impl WeightInfo for () { fn remove_code() -> Weight { // Proof Size summary in bytes: // Measured: `255` - // Estimated: `7950` - // Minimum execution time: 33_516_000 picoseconds. - Weight::from_parts(33_995_000, 7950) + // Estimated: `3720` + // Minimum execution time: 33_560_000 picoseconds. + Weight::from_parts(33_833_000, 3720) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2359,9 +2358,9 @@ impl WeightInfo for () { fn set_code() -> Weight { // Proof Size summary in bytes: // Measured: `570` - // Estimated: `19530` - // Minimum execution time: 33_255_000 picoseconds. - Weight::from_parts(33_692_000, 19530) + // Estimated: `8985` + // Minimum execution time: 33_288_000 picoseconds. + Weight::from_parts(33_775_000, 8985) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2379,14 +2378,14 @@ impl WeightInfo for () { fn seal_caller(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `781 + r * (6 ±0)` - // Estimated: `21730 + r * (30 ±0)` - // Minimum execution time: 235_074_000 picoseconds. - Weight::from_parts(243_735_179, 21730) - // Standard Error: 972 - .saturating_add(Weight::from_parts(328_571, 0).saturating_mul(r.into())) + // Estimated: `6722 + r * (6 ±0)` + // Minimum execution time: 234_292_000 picoseconds. + Weight::from_parts(235_941_911, 6722) + // Standard Error: 413 + .saturating_add(Weight::from_parts(339_913, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2402,15 +2401,15 @@ impl WeightInfo for () { fn seal_is_contract(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `839 + r * (240 ±0)` - // Estimated: `21835 + r * (3675 ±0)` - // Minimum execution time: 236_455_000 picoseconds. - Weight::from_parts(81_818_936, 21835) - // Standard Error: 5_874 - .saturating_add(Weight::from_parts(3_316_006, 0).saturating_mul(r.into())) + // Estimated: `6743 + r * (2715 ±0)` + // Minimum execution time: 236_273_000 picoseconds. + Weight::from_parts(74_380_906, 6743) + // Standard Error: 5_745 + .saturating_add(Weight::from_parts(3_331_781, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 3675).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2715).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2426,15 +2425,15 @@ impl WeightInfo for () { fn seal_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `831 + r * (244 ±0)` - // Estimated: `21855 + r * (3695 ±0)` - // Minimum execution time: 237_724_000 picoseconds. - Weight::from_parts(91_384_964, 21855) - // Standard Error: 5_828 - .saturating_add(Weight::from_parts(4_063_221, 0).saturating_mul(r.into())) + // Estimated: `6747 + r * (2719 ±0)` + // Minimum execution time: 236_573_000 picoseconds. + Weight::from_parts(82_473_906, 6747) + // Standard Error: 5_510 + .saturating_add(Weight::from_parts(4_131_820, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 3695).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2719).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2450,14 +2449,14 @@ impl WeightInfo for () { fn seal_own_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `788 + r * (6 ±0)` - // Estimated: `21770 + r * (30 ±0)` - // Minimum execution time: 236_144_000 picoseconds. - Weight::from_parts(239_917_873, 21770) - // Standard Error: 629 - .saturating_add(Weight::from_parts(409_752, 0).saturating_mul(r.into())) + // Estimated: `6730 + r * (6 ±0)` + // Minimum execution time: 235_878_000 picoseconds. + Weight::from_parts(238_387_359, 6730) + // Standard Error: 318 + .saturating_add(Weight::from_parts(409_923, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2473,14 +2472,14 @@ impl WeightInfo for () { fn seal_caller_is_origin(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `778 + r * (3 ±0)` - // Estimated: `21735 + r * (15 ±0)` - // Minimum execution time: 232_946_000 picoseconds. - Weight::from_parts(243_163_112, 21735) - // Standard Error: 1_940 - .saturating_add(Weight::from_parts(162_705, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (3 ±0)` + // Minimum execution time: 233_476_000 picoseconds. + Weight::from_parts(238_014_452, 6723) + // Standard Error: 145 + .saturating_add(Weight::from_parts(165_823, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 15).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2496,14 +2495,14 @@ impl WeightInfo for () { fn seal_address(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `782 + r * (6 ±0)` - // Estimated: `21740 + r * (30 ±0)` - // Minimum execution time: 235_301_000 picoseconds. - Weight::from_parts(240_802_312, 21740) - // Standard Error: 5_362 - .saturating_add(Weight::from_parts(339_001, 0).saturating_mul(r.into())) + // Estimated: `6724 + r * (6 ±0)` + // Minimum execution time: 235_490_000 picoseconds. + Weight::from_parts(240_039_685, 6724) + // Standard Error: 330 + .saturating_add(Weight::from_parts(332_291, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2519,14 +2518,14 @@ impl WeightInfo for () { fn seal_gas_left(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `783 + r * (6 ±0)` - // Estimated: `21725 + r * (30 ±0)` - // Minimum execution time: 235_683_000 picoseconds. - Weight::from_parts(237_357_276, 21725) - // Standard Error: 726 - .saturating_add(Weight::from_parts(333_264, 0).saturating_mul(r.into())) + // Estimated: `6721 + r * (6 ±0)` + // Minimum execution time: 236_093_000 picoseconds. + Weight::from_parts(238_513_328, 6721) + // Standard Error: 206 + .saturating_add(Weight::from_parts(328_899, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:2 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2542,14 +2541,14 @@ impl WeightInfo for () { fn seal_balance(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `922 + r * (6 ±0)` - // Estimated: `24633 + r * (30 ±0)` - // Minimum execution time: 234_327_000 picoseconds. - Weight::from_parts(239_792_456, 24633) - // Standard Error: 3_460 - .saturating_add(Weight::from_parts(1_496_090, 0).saturating_mul(r.into())) + // Estimated: `6846 + r * (6 ±0)` + // Minimum execution time: 234_801_000 picoseconds. + Weight::from_parts(243_519_159, 6846) + // Standard Error: 1_367 + .saturating_add(Weight::from_parts(1_449_599, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2565,14 +2564,14 @@ impl WeightInfo for () { fn seal_value_transferred(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `792 + r * (6 ±0)` - // Estimated: `21825 + r * (30 ±0)` - // Minimum execution time: 235_466_000 picoseconds. - Weight::from_parts(242_580_658, 21825) - // Standard Error: 1_439 - .saturating_add(Weight::from_parts(323_842, 0).saturating_mul(r.into())) + // Estimated: `6741 + r * (6 ±0)` + // Minimum execution time: 236_765_000 picoseconds. + Weight::from_parts(237_843_244, 6741) + // Standard Error: 308 + .saturating_add(Weight::from_parts(329_911, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2588,14 +2587,14 @@ impl WeightInfo for () { fn seal_minimum_balance(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `790 + r * (6 ±0)` - // Estimated: `21815 + r * (30 ±0)` - // Minimum execution time: 238_529_000 picoseconds. - Weight::from_parts(249_276_722, 21815) - // Standard Error: 1_216 - .saturating_add(Weight::from_parts(328_600, 0).saturating_mul(r.into())) + // Estimated: `6739 + r * (6 ±0)` + // Minimum execution time: 236_690_000 picoseconds. + Weight::from_parts(241_743_164, 6739) + // Standard Error: 333 + .saturating_add(Weight::from_parts(324_693, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2611,14 +2610,14 @@ impl WeightInfo for () { fn seal_block_number(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `787 + r * (6 ±0)` - // Estimated: `21805 + r * (30 ±0)` - // Minimum execution time: 234_360_000 picoseconds. - Weight::from_parts(239_927_876, 21805) - // Standard Error: 541 - .saturating_add(Weight::from_parts(319_553, 0).saturating_mul(r.into())) + // Estimated: `6737 + r * (6 ±0)` + // Minimum execution time: 236_149_000 picoseconds. + Weight::from_parts(239_090_707, 6737) + // Standard Error: 246 + .saturating_add(Weight::from_parts(344_488, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2634,14 +2633,14 @@ impl WeightInfo for () { fn seal_now(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `778 + r * (6 ±0)` - // Estimated: `21735 + r * (30 ±0)` - // Minimum execution time: 234_461_000 picoseconds. - Weight::from_parts(239_682_633, 21735) - // Standard Error: 544 - .saturating_add(Weight::from_parts(322_943, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (6 ±0)` + // Minimum execution time: 235_057_000 picoseconds. + Weight::from_parts(237_752_870, 6723) + // Standard Error: 236 + .saturating_add(Weight::from_parts(328_235, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2659,14 +2658,14 @@ impl WeightInfo for () { fn seal_weight_to_fee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `856 + r * (10 ±0)` - // Estimated: `24446 + r * (60 ±0)` - // Minimum execution time: 234_862_000 picoseconds. - Weight::from_parts(252_614_390, 24446) - // Standard Error: 1_180 - .saturating_add(Weight::from_parts(1_313_286, 0).saturating_mul(r.into())) + // Estimated: `6796 + r * (10 ±0)` + // Minimum execution time: 234_995_000 picoseconds. + Weight::from_parts(246_473_554, 6796) + // Standard Error: 1_015 + .saturating_add(Weight::from_parts(1_337_653, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 60).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 10).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2682,14 +2681,14 @@ impl WeightInfo for () { fn seal_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `745 + r * (4 ±0)` - // Estimated: `21555 + r * (20 ±0)` - // Minimum execution time: 161_003_000 picoseconds. - Weight::from_parts(165_793_675, 21555) - // Standard Error: 323 - .saturating_add(Weight::from_parts(128_941, 0).saturating_mul(r.into())) + // Estimated: `6687 + r * (4 ±0)` + // Minimum execution time: 160_445_000 picoseconds. + Weight::from_parts(165_558_135, 6687) + // Standard Error: 234 + .saturating_add(Weight::from_parts(133_607, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 20).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 4).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2705,14 +2704,14 @@ impl WeightInfo for () { fn seal_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `780 + r * (6 ±0)` - // Estimated: `21740 + r * (30 ±0)` - // Minimum execution time: 235_192_000 picoseconds. - Weight::from_parts(241_225_671, 21740) - // Standard Error: 1_132 - .saturating_add(Weight::from_parts(272_760, 0).saturating_mul(r.into())) + // Estimated: `6724 + r * (6 ±0)` + // Minimum execution time: 235_065_000 picoseconds. + Weight::from_parts(237_797_177, 6724) + // Standard Error: 336 + .saturating_add(Weight::from_parts(267_302, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 30).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2728,11 +2727,11 @@ impl WeightInfo for () { fn seal_input_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `784` - // Estimated: `21740` - // Minimum execution time: 238_050_000 picoseconds. - Weight::from_parts(241_274_832, 21740) - // Standard Error: 1 - .saturating_add(Weight::from_parts(590, 0).saturating_mul(n.into())) + // Estimated: `6724` + // Minimum execution time: 236_215_000 picoseconds. + Weight::from_parts(239_347_313, 6724) + // Standard Error: 0 + .saturating_add(Weight::from_parts(587, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -2750,14 +2749,14 @@ impl WeightInfo for () { fn seal_return(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `768 + r * (45 ±0)` - // Estimated: `21660 + r * (225 ±0)` - // Minimum execution time: 231_807_000 picoseconds. - Weight::from_parts(234_264_848, 21660) - // Standard Error: 185_298 - .saturating_add(Weight::from_parts(1_000_351, 0).saturating_mul(r.into())) + // Estimated: `6708 + r * (45 ±0)` + // Minimum execution time: 231_571_000 picoseconds. + Weight::from_parts(233_477_918, 6708) + // Standard Error: 95_776 + .saturating_add(Weight::from_parts(1_733_181, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 225).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 45).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2773,11 +2772,11 @@ impl WeightInfo for () { fn seal_return_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `778` - // Estimated: `21775` - // Minimum execution time: 234_347_000 picoseconds. - Weight::from_parts(234_774_467, 21775) + // Estimated: `6731` + // Minimum execution time: 234_956_000 picoseconds. + Weight::from_parts(236_785_051, 6731) // Standard Error: 0 - .saturating_add(Weight::from_parts(183, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(177, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -2801,16 +2800,16 @@ impl WeightInfo for () { fn seal_terminate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `810 + r * (356 ±0)` - // Estimated: `26094 + r * (15904 ±0)` - // Minimum execution time: 234_356_000 picoseconds. - Weight::from_parts(236_844_659, 26094) - // Standard Error: 161_035 - .saturating_add(Weight::from_parts(110_725_340, 0).saturating_mul(r.into())) + // Estimated: `6750 + r * (7781 ±0)` + // Minimum execution time: 234_275_000 picoseconds. + Weight::from_parts(236_776_769, 6750) + // Standard Error: 137_203 + .saturating_add(Weight::from_parts(110_758_930, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((6_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((8_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 15904).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 7781).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2828,14 +2827,14 @@ impl WeightInfo for () { fn seal_random(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `825 + r * (10 ±0)` - // Estimated: `24283 + r * (60 ±0)` - // Minimum execution time: 234_248_000 picoseconds. - Weight::from_parts(255_712_101, 24283) - // Standard Error: 1_474 - .saturating_add(Weight::from_parts(1_753_943, 0).saturating_mul(r.into())) + // Estimated: `6769 + r * (10 ±0)` + // Minimum execution time: 235_593_000 picoseconds. + Weight::from_parts(253_731_242, 6769) + // Standard Error: 2_129 + .saturating_add(Weight::from_parts(1_771_297, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 60).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 10).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2851,14 +2850,14 @@ impl WeightInfo for () { fn seal_deposit_event(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `778 + r * (10 ±0)` - // Estimated: `21735 + r * (50 ±0)` - // Minimum execution time: 232_456_000 picoseconds. - Weight::from_parts(230_738_907, 21735) - // Standard Error: 4_163 - .saturating_add(Weight::from_parts(3_496_817, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (10 ±0)` + // Minimum execution time: 232_124_000 picoseconds. + Weight::from_parts(245_904_447, 6723) + // Standard Error: 2_185 + .saturating_add(Weight::from_parts(3_470_410, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 50).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 10).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2875,18 +2874,18 @@ impl WeightInfo for () { fn seal_deposit_event_per_topic_and_byte(t: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `797 + t * (32 ±0)` - // Estimated: `21840 + t * (2640 ±0)` - // Minimum execution time: 251_638_000 picoseconds. - Weight::from_parts(244_791_817, 21840) - // Standard Error: 89_537 - .saturating_add(Weight::from_parts(2_459_492, 0).saturating_mul(t.into())) - // Standard Error: 25 - .saturating_add(Weight::from_parts(626, 0).saturating_mul(n.into())) + // Estimated: `6744 + t * (2508 ±0)` + // Minimum execution time: 250_301_000 picoseconds. + Weight::from_parts(245_292_258, 6744) + // Standard Error: 29_864 + .saturating_add(Weight::from_parts(2_163_531, 0).saturating_mul(t.into())) + // Standard Error: 8 + .saturating_add(Weight::from_parts(583, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) - .saturating_add(Weight::from_parts(0, 2640).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 2508).saturating_mul(t.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -2902,14 +2901,14 @@ impl WeightInfo for () { fn seal_debug_message(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `777 + r * (7 ±0)` - // Estimated: `21725 + r * (35 ±0)` - // Minimum execution time: 164_736_000 picoseconds. - Weight::from_parts(164_496_597, 21725) - // Standard Error: 4_619 - .saturating_add(Weight::from_parts(252_013, 0).saturating_mul(r.into())) + // Estimated: `6721 + r * (7 ±0)` + // Minimum execution time: 165_711_000 picoseconds. + Weight::from_parts(168_792_571, 6721) + // Standard Error: 216 + .saturating_add(Weight::from_parts(230_285, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 35).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 7).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) @@ -2925,11 +2924,11 @@ impl WeightInfo for () { fn seal_debug_message_per_byte(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `125728` - // Estimated: `269977` - // Minimum execution time: 352_146_000 picoseconds. - Weight::from_parts(357_758_251, 269977) - // Standard Error: 1 - .saturating_add(Weight::from_parts(735, 0).saturating_mul(i.into())) + // Estimated: `131670` + // Minimum execution time: 348_928_000 picoseconds. + Weight::from_parts(352_224_793, 131670) + // Standard Error: 0 + .saturating_add(Weight::from_parts(731, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -2940,10 +2939,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `845 + r * (292 ±0)` // Estimated: `843 + r * (293 ±0)` - // Minimum execution time: 236_170_000 picoseconds. - Weight::from_parts(136_284_582, 843) - // Standard Error: 10_269 - .saturating_add(Weight::from_parts(5_995_228, 0).saturating_mul(r.into())) + // Minimum execution time: 236_418_000 picoseconds. + Weight::from_parts(129_862_840, 843) + // Standard Error: 9_733 + .saturating_add(Weight::from_parts(6_005_187, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2957,10 +2956,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1304` // Estimated: `1280` - // Minimum execution time: 253_837_000 picoseconds. - Weight::from_parts(287_029_261, 1280) - // Standard Error: 51 - .saturating_add(Weight::from_parts(534, 0).saturating_mul(n.into())) + // Minimum execution time: 251_599_000 picoseconds. + Weight::from_parts(285_284_665, 1280) + // Standard Error: 46 + .saturating_add(Weight::from_parts(410, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2971,10 +2970,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1167 + n * (1 ±0)` // Estimated: `1167 + n * (1 ±0)` - // Minimum execution time: 253_037_000 picoseconds. - Weight::from_parts(256_401_533, 1167) - // Standard Error: 18 - .saturating_add(Weight::from_parts(32, 0).saturating_mul(n.into())) + // Minimum execution time: 251_309_000 picoseconds. + Weight::from_parts(253_555_552, 1167) + // Standard Error: 9 + .saturating_add(Weight::from_parts(27, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -2986,10 +2985,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `841 + r * (288 ±0)` // Estimated: `845 + r * (289 ±0)` - // Minimum execution time: 236_800_000 picoseconds. - Weight::from_parts(134_748_031, 845) - // Standard Error: 9_560 - .saturating_add(Weight::from_parts(5_923_187, 0).saturating_mul(r.into())) + // Minimum execution time: 235_441_000 picoseconds. + Weight::from_parts(132_980_942, 845) + // Standard Error: 9_421 + .saturating_add(Weight::from_parts(5_854_896, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3003,9 +3002,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1163 + n * (1 ±0)` // Estimated: `1163 + n * (1 ±0)` - // Minimum execution time: 250_601_000 picoseconds. - Weight::from_parts(253_618_803, 1163) - // Standard Error: 18 + // Minimum execution time: 249_967_000 picoseconds. + Weight::from_parts(252_122_186, 1163) + // Standard Error: 10 .saturating_add(Weight::from_parts(74, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) @@ -3018,10 +3017,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `835 + r * (296 ±0)` // Estimated: `840 + r * (297 ±0)` - // Minimum execution time: 236_194_000 picoseconds. - Weight::from_parts(152_630_909, 840) - // Standard Error: 8_573 - .saturating_add(Weight::from_parts(4_896_099, 0).saturating_mul(r.into())) + // Minimum execution time: 235_647_000 picoseconds. + Weight::from_parts(145_525_169, 840) + // Standard Error: 8_553 + .saturating_add(Weight::from_parts(4_948_021, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3034,10 +3033,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1179 + n * (1 ±0)` // Estimated: `1179 + n * (1 ±0)` - // Minimum execution time: 250_989_000 picoseconds. - Weight::from_parts(260_170_747, 1179) - // Standard Error: 162 - .saturating_add(Weight::from_parts(224, 0).saturating_mul(n.into())) + // Minimum execution time: 249_576_000 picoseconds. + Weight::from_parts(250_747_191, 1179) + // Standard Error: 8 + .saturating_add(Weight::from_parts(717, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -3049,10 +3048,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `856 + r * (288 ±0)` // Estimated: `857 + r * (289 ±0)` - // Minimum execution time: 236_574_000 picoseconds. - Weight::from_parts(155_573_955, 857) - // Standard Error: 10_270 - .saturating_add(Weight::from_parts(4_667_644, 0).saturating_mul(r.into())) + // Minimum execution time: 236_110_000 picoseconds. + Weight::from_parts(148_420_625, 857) + // Standard Error: 8_175 + .saturating_add(Weight::from_parts(4_684_126, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3065,10 +3064,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1166 + n * (1 ±0)` // Estimated: `1166 + n * (1 ±0)` - // Minimum execution time: 249_502_000 picoseconds. - Weight::from_parts(251_496_311, 1166) - // Standard Error: 26 - .saturating_add(Weight::from_parts(186, 0).saturating_mul(n.into())) + // Minimum execution time: 247_800_000 picoseconds. + Weight::from_parts(249_410_575, 1166) + // Standard Error: 6 + .saturating_add(Weight::from_parts(99, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -3080,10 +3079,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `829 + r * (296 ±0)` // Estimated: `836 + r * (297 ±0)` - // Minimum execution time: 236_030_000 picoseconds. - Weight::from_parts(128_595_856, 836) - // Standard Error: 10_530 - .saturating_add(Weight::from_parts(6_072_638, 0).saturating_mul(r.into())) + // Minimum execution time: 235_251_000 picoseconds. + Weight::from_parts(128_816_707, 836) + // Standard Error: 9_887 + .saturating_add(Weight::from_parts(6_167_176, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -3097,10 +3096,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1180 + n * (1 ±0)` // Estimated: `1180 + n * (1 ±0)` - // Minimum execution time: 254_027_000 picoseconds. - Weight::from_parts(260_739_475, 1180) - // Standard Error: 115 - .saturating_add(Weight::from_parts(330, 0).saturating_mul(n.into())) + // Minimum execution time: 250_401_000 picoseconds. + Weight::from_parts(253_298_243, 1180) + // Standard Error: 9 + .saturating_add(Weight::from_parts(667, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -3119,16 +3118,16 @@ impl WeightInfo for () { fn seal_transfer(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1373 + r * (45 ±0)` - // Estimated: `26753 + r * (2700 ±0)` - // Minimum execution time: 237_634_000 picoseconds. - Weight::from_parts(238_177_000, 26753) - // Standard Error: 23_320 - .saturating_add(Weight::from_parts(35_467_618, 0).saturating_mul(r.into())) + // Estimated: `7270 + r * (2520 ±0)` + // Minimum execution time: 236_470_000 picoseconds. + Weight::from_parts(98_898_727, 7270) + // Standard Error: 33_316 + .saturating_add(Weight::from_parts(35_149_946, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 2700).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3144,16 +3143,16 @@ impl WeightInfo for () { fn seal_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1237 + r * (256 ±0)` - // Estimated: `26028 + r * (6235 ±0)` - // Minimum execution time: 237_076_000 picoseconds. - Weight::from_parts(237_792_000, 26028) - // Standard Error: 91_566 - .saturating_add(Weight::from_parts(212_893_975, 0).saturating_mul(r.into())) + // Estimated: `7125 + r * (2732 ±0)` + // Minimum execution time: 238_303_000 picoseconds. + Weight::from_parts(239_024_000, 7125) + // Standard Error: 65_907 + .saturating_add(Weight::from_parts(209_419_071, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 6235).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2732).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3169,16 +3168,16 @@ impl WeightInfo for () { fn seal_delegate_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + r * (502 ±0)` - // Estimated: `21755 + r * (6329 ±3)` - // Minimum execution time: 236_275_000 picoseconds. - Weight::from_parts(236_849_000, 21755) - // Standard Error: 92_724 - .saturating_add(Weight::from_parts(207_159_396, 0).saturating_mul(r.into())) + // Estimated: `6727 + r * (2572 ±10)` + // Minimum execution time: 235_961_000 picoseconds. + Weight::from_parts(236_939_000, 6727) + // Standard Error: 83_087 + .saturating_add(Weight::from_parts(205_646_517, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 6329).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2572).saturating_mul(r.into())) } /// Storage: System Account (r:3 w:2) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3195,18 +3194,18 @@ impl WeightInfo for () { fn seal_call_per_transfer_clone_byte(t: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1154 + t * (204 ±0)` - // Estimated: `31015 + t * (5970 ±0)` - // Minimum execution time: 412_628_000 picoseconds. - Weight::from_parts(385_108_035, 31015) - // Standard Error: 1_002_078 - .saturating_add(Weight::from_parts(31_204_678, 0).saturating_mul(t.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(598, 0).saturating_mul(c.into())) + // Estimated: `9569 + t * (5154 ±0)` + // Minimum execution time: 410_156_000 picoseconds. + Weight::from_parts(378_378_143, 9569) + // Standard Error: 285_172 + .saturating_add(Weight::from_parts(34_736_740, 0).saturating_mul(t.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(591, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(5_u64)) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(t.into()))) - .saturating_add(Weight::from_parts(0, 5970).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 5154).saturating_mul(t.into())) } /// Storage: System Account (r:1602 w:1602) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3226,16 +3225,16 @@ impl WeightInfo for () { fn seal_instantiate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1301 + r * (254 ±0)` - // Estimated: `30977 + r * (16635 ±0)` - // Minimum execution time: 237_161_000 picoseconds. - Weight::from_parts(237_620_000, 30977) - // Standard Error: 258_036 - .saturating_add(Weight::from_parts(344_869_637, 0).saturating_mul(r.into())) + // Estimated: `7131 + r * (5205 ±0)` + // Minimum execution time: 236_748_000 picoseconds. + Weight::from_parts(237_129_000, 7131) + // Standard Error: 280_059 + .saturating_add(Weight::from_parts(341_428_013, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().reads((6_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(6_u64)) .saturating_add(RocksDbWeight::get().writes((5_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 16635).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 5205).saturating_mul(r.into())) } /// Storage: System Account (r:4 w:4) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3257,20 +3256,20 @@ impl WeightInfo for () { fn seal_instantiate_per_transfer_input_salt_byte(t: u32, i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1071 + t * (187 ±0)` - // Estimated: `42684 + t * (3588 ±2)` - // Minimum execution time: 1_613_172_000 picoseconds. - Weight::from_parts(326_952_137, 42684) - // Standard Error: 4_738_925 - .saturating_add(Weight::from_parts(113_657_996, 0).saturating_mul(t.into())) - // Standard Error: 7 - .saturating_add(Weight::from_parts(1_173, 0).saturating_mul(i.into())) - // Standard Error: 7 - .saturating_add(Weight::from_parts(1_347, 0).saturating_mul(s.into())) + // Estimated: `9492 + t * (2634 ±2)` + // Minimum execution time: 1_613_796_000 picoseconds. + Weight::from_parts(340_002_206, 9492) + // Standard Error: 4_296_381 + .saturating_add(Weight::from_parts(115_239_834, 0).saturating_mul(t.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(1_145, 0).saturating_mul(i.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(1_315, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(10_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) - .saturating_add(Weight::from_parts(0, 3588).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 2634).saturating_mul(t.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3286,14 +3285,14 @@ impl WeightInfo for () { fn seal_hash_sha2_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `777 + r * (8 ±0)` - // Estimated: `21710 + r * (40 ±0)` - // Minimum execution time: 233_679_000 picoseconds. - Weight::from_parts(238_638_820, 21710) - // Standard Error: 681 - .saturating_add(Weight::from_parts(573_320, 0).saturating_mul(r.into())) + // Estimated: `6718 + r * (8 ±0)` + // Minimum execution time: 233_111_000 picoseconds. + Weight::from_parts(238_643_933, 6718) + // Standard Error: 184 + .saturating_add(Weight::from_parts(572_296, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3309,11 +3308,11 @@ impl WeightInfo for () { fn seal_hash_sha2_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `785` - // Estimated: `21745` - // Minimum execution time: 235_992_000 picoseconds. - Weight::from_parts(219_924_252, 21745) - // Standard Error: 5 - .saturating_add(Weight::from_parts(3_978, 0).saturating_mul(n.into())) + // Estimated: `6725` + // Minimum execution time: 234_746_000 picoseconds. + Weight::from_parts(229_815_552, 6725) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_892, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3331,14 +3330,14 @@ impl WeightInfo for () { fn seal_hash_keccak_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` - // Estimated: `21725 + r * (40 ±0)` - // Minimum execution time: 240_661_000 picoseconds. - Weight::from_parts(238_809_422, 21725) - // Standard Error: 820 - .saturating_add(Weight::from_parts(741_326, 0).saturating_mul(r.into())) + // Estimated: `6721 + r * (8 ±0)` + // Minimum execution time: 232_732_000 picoseconds. + Weight::from_parts(239_007_209, 6721) + // Standard Error: 256 + .saturating_add(Weight::from_parts(733_879, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3354,11 +3353,11 @@ impl WeightInfo for () { fn seal_hash_keccak_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `787` - // Estimated: `21765` - // Minimum execution time: 235_136_000 picoseconds. - Weight::from_parts(228_678_487, 21765) - // Standard Error: 2 - .saturating_add(Weight::from_parts(3_164, 0).saturating_mul(n.into())) + // Estimated: `6729` + // Minimum execution time: 234_184_000 picoseconds. + Weight::from_parts(227_603_375, 6729) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_127, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3376,14 +3375,14 @@ impl WeightInfo for () { fn seal_hash_blake2_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` - // Estimated: `21740 + r * (40 ±0)` - // Minimum execution time: 233_364_000 picoseconds. - Weight::from_parts(243_294_285, 21740) - // Standard Error: 1_607 - .saturating_add(Weight::from_parts(413_186, 0).saturating_mul(r.into())) + // Estimated: `6724 + r * (8 ±0)` + // Minimum execution time: 233_038_000 picoseconds. + Weight::from_parts(238_515_817, 6724) + // Standard Error: 255 + .saturating_add(Weight::from_parts(413_343, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3399,11 +3398,11 @@ impl WeightInfo for () { fn seal_hash_blake2_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `787` - // Estimated: `21785` - // Minimum execution time: 234_315_000 picoseconds. - Weight::from_parts(225_569_537, 21785) + // Estimated: `6733` + // Minimum execution time: 232_996_000 picoseconds. + Weight::from_parts(226_706_997, 6733) // Standard Error: 1 - .saturating_add(Weight::from_parts(919, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(908, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3421,14 +3420,14 @@ impl WeightInfo for () { fn seal_hash_blake2_128(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `779 + r * (8 ±0)` - // Estimated: `21745 + r * (40 ±0)` - // Minimum execution time: 233_288_000 picoseconds. - Weight::from_parts(239_289_154, 21745) - // Standard Error: 612 - .saturating_add(Weight::from_parts(414_275, 0).saturating_mul(r.into())) + // Estimated: `6725 + r * (8 ±0)` + // Minimum execution time: 232_292_000 picoseconds. + Weight::from_parts(237_997_001, 6725) + // Standard Error: 219 + .saturating_add(Weight::from_parts(410_177, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3444,11 +3443,11 @@ impl WeightInfo for () { fn seal_hash_blake2_128_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `787` - // Estimated: `21755` - // Minimum execution time: 233_686_000 picoseconds. - Weight::from_parts(227_406_694, 21755) + // Estimated: `6727` + // Minimum execution time: 234_815_000 picoseconds. + Weight::from_parts(226_317_150, 6727) // Standard Error: 1 - .saturating_add(Weight::from_parts(919, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(911, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3465,15 +3464,15 @@ impl WeightInfo for () { /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `916 + n * (1 ±0)` - // Estimated: `22375 + n * (5 ±0)` - // Minimum execution time: 287_258_000 picoseconds. - Weight::from_parts(290_941_609, 22375) - // Standard Error: 8 - .saturating_add(Weight::from_parts(4_785, 0).saturating_mul(n.into())) + // Measured: `912 + n * (1 ±0)` + // Estimated: `6848 + n * (1 ±0)` + // Minimum execution time: 286_323_000 picoseconds. + Weight::from_parts(290_287_955, 6848) + // Standard Error: 1 + .saturating_add(Weight::from_parts(4_693, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 5).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3488,15 +3487,15 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 160]`. fn seal_sr25519_verify(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `728 + r * (112 ±0)` - // Estimated: `21455 + r * (560 ±0)` - // Minimum execution time: 238_340_000 picoseconds. - Weight::from_parts(246_009_851, 21455) - // Standard Error: 21_677 - .saturating_add(Weight::from_parts(48_139_487, 0).saturating_mul(r.into())) + // Measured: `727 + r * (112 ±0)` + // Estimated: `6666 + r * (112 ±0)` + // Minimum execution time: 235_938_000 picoseconds. + Weight::from_parts(242_728_358, 6666) + // Standard Error: 9_725 + .saturating_add(Weight::from_parts(47_527_740, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 560).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 112).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3512,14 +3511,14 @@ impl WeightInfo for () { fn seal_ecdsa_recover(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `822 + r * (76 ±0)` - // Estimated: `21705 + r * (385 ±0)` - // Minimum execution time: 236_244_000 picoseconds. - Weight::from_parts(253_749_242, 21705) - // Standard Error: 19_216 - .saturating_add(Weight::from_parts(37_706_782, 0).saturating_mul(r.into())) + // Estimated: `6716 + r * (77 ±0)` + // Minimum execution time: 236_108_000 picoseconds. + Weight::from_parts(248_577_226, 6716) + // Standard Error: 9_565 + .saturating_add(Weight::from_parts(36_733_552, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 385).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 77).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3535,14 +3534,14 @@ impl WeightInfo for () { fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `792 + r * (42 ±0)` - // Estimated: `21775 + r * (210 ±0)` - // Minimum execution time: 235_770_000 picoseconds. - Weight::from_parts(230_780_347, 21775) - // Standard Error: 12_015 - .saturating_add(Weight::from_parts(9_584_947, 0).saturating_mul(r.into())) + // Estimated: `6731 + r * (42 ±0)` + // Minimum execution time: 236_440_000 picoseconds. + Weight::from_parts(240_771_418, 6731) + // Standard Error: 1_849 + .saturating_add(Weight::from_parts(9_185_896, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 210).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 42).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3560,16 +3559,16 @@ impl WeightInfo for () { fn seal_set_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + r * (964 ±0)` - // Estimated: `29920 + r * (11544 ±7)` - // Minimum execution time: 235_857_000 picoseconds. - Weight::from_parts(236_482_000, 29920) - // Standard Error: 47_818 - .saturating_add(Weight::from_parts(21_765_273, 0).saturating_mul(r.into())) + // Estimated: `8190 + r * (3090 ±10)` + // Minimum execution time: 235_056_000 picoseconds. + Weight::from_parts(235_743_000, 8190) + // Standard Error: 46_122 + .saturating_add(Weight::from_parts(21_447_984, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 11544).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 3090).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3585,14 +3584,14 @@ impl WeightInfo for () { fn seal_reentrance_count(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `773 + r * (3 ±0)` - // Estimated: `21735 + r * (15 ±0)` - // Minimum execution time: 235_388_000 picoseconds. - Weight::from_parts(240_149_512, 21735) - // Standard Error: 555 - .saturating_add(Weight::from_parts(162_666, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (3 ±0)` + // Minimum execution time: 235_213_000 picoseconds. + Weight::from_parts(239_456_464, 6723) + // Standard Error: 130 + .saturating_add(Weight::from_parts(159_851, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 15).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3608,14 +3607,14 @@ impl WeightInfo for () { fn seal_account_reentrance_count(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1975 + r * (39 ±0)` - // Estimated: `27145 + r * (200 ±0)` - // Minimum execution time: 237_485_000 picoseconds. - Weight::from_parts(268_044_053, 27145) - // Standard Error: 1_147 - .saturating_add(Weight::from_parts(260_572, 0).saturating_mul(r.into())) + // Estimated: `7805 + r * (40 ±0)` + // Minimum execution time: 237_886_000 picoseconds. + Weight::from_parts(262_430_157, 7805) + // Standard Error: 939 + .saturating_add(Weight::from_parts(260_005, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 200).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) } /// Storage: System Account (r:1 w:0) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: Measured) @@ -3633,523 +3632,523 @@ impl WeightInfo for () { fn seal_instantiation_nonce(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `776 + r * (3 ±0)` - // Estimated: `24004 + r * (18 ±0)` - // Minimum execution time: 234_123_000 picoseconds. - Weight::from_parts(245_872_832, 24004) - // Standard Error: 943 - .saturating_add(Weight::from_parts(136_460, 0).saturating_mul(r.into())) + // Estimated: `6723 + r * (3 ±0)` + // Minimum execution time: 234_014_000 picoseconds. + Weight::from_parts(240_042_671, 6723) + // Standard Error: 152 + .saturating_add(Weight::from_parts(138_382, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 18).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_606_000 picoseconds. - Weight::from_parts(1_845_698, 0) + // Minimum execution time: 1_533_000 picoseconds. + Weight::from_parts(1_846_015, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(2_995, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_935, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_711_000 picoseconds. - Weight::from_parts(2_281_581, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(6_354, 0).saturating_mul(r.into())) + // Minimum execution time: 1_671_000 picoseconds. + Weight::from_parts(2_197_197, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(6_335, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_680_000 picoseconds. - Weight::from_parts(2_269_238, 0) - // Standard Error: 4 - .saturating_add(Weight::from_parts(6_014, 0).saturating_mul(r.into())) + // Minimum execution time: 1_665_000 picoseconds. + Weight::from_parts(2_200_545, 0) + // Standard Error: 3 + .saturating_add(Weight::from_parts(6_011, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_592_000 picoseconds. - Weight::from_parts(2_010_963, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(7_927, 0).saturating_mul(r.into())) + // Minimum execution time: 1_545_000 picoseconds. + Weight::from_parts(1_977_462, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(7_901, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_631_000 picoseconds. - Weight::from_parts(1_936_549, 0) - // Standard Error: 6 - .saturating_add(Weight::from_parts(10_426, 0).saturating_mul(r.into())) + // Minimum execution time: 1_515_000 picoseconds. + Weight::from_parts(1_866_184, 0) + // Standard Error: 4 + .saturating_add(Weight::from_parts(10_514, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_616_000 picoseconds. - Weight::from_parts(1_938_716, 0) - // Standard Error: 15 - .saturating_add(Weight::from_parts(4_525, 0).saturating_mul(r.into())) + // Minimum execution time: 1_618_000 picoseconds. + Weight::from_parts(1_895_104, 0) + // Standard Error: 12 + .saturating_add(Weight::from_parts(4_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_535_000 picoseconds. - Weight::from_parts(1_109_860, 0) - // Standard Error: 77 - .saturating_add(Weight::from_parts(7_998, 0).saturating_mul(r.into())) + // Minimum execution time: 1_510_000 picoseconds. + Weight::from_parts(1_779_998, 0) + // Standard Error: 8 + .saturating_add(Weight::from_parts(6_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_594_000 picoseconds. - Weight::from_parts(1_478_654, 0) - // Standard Error: 36 - .saturating_add(Weight::from_parts(9_525, 0).saturating_mul(r.into())) + // Minimum execution time: 1_529_000 picoseconds. + Weight::from_parts(1_726_996, 0) + // Standard Error: 26 + .saturating_add(Weight::from_parts(9_199, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_730_000 picoseconds. - Weight::from_parts(1_836_342, 0) - // Standard Error: 14 - .saturating_add(Weight::from_parts(206, 0).saturating_mul(e.into())) + // Minimum execution time: 1_682_000 picoseconds. + Weight::from_parts(1_789_910, 0) + // Standard Error: 16 + .saturating_add(Weight::from_parts(42, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_607_000 picoseconds. - Weight::from_parts(2_150_133, 0) - // Standard Error: 17 - .saturating_add(Weight::from_parts(18_630, 0).saturating_mul(r.into())) + // Minimum execution time: 1_539_000 picoseconds. + Weight::from_parts(2_093_056, 0) + // Standard Error: 27 + .saturating_add(Weight::from_parts(18_917, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_824_000 picoseconds. - Weight::from_parts(3_119_825, 0) - // Standard Error: 15 - .saturating_add(Weight::from_parts(25_304, 0).saturating_mul(r.into())) + // Minimum execution time: 1_851_000 picoseconds. + Weight::from_parts(3_134_610, 0) + // Standard Error: 34 + .saturating_add(Weight::from_parts(24_714, 0).saturating_mul(r.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_692_000 picoseconds. - Weight::from_parts(1_927_049, 0) + // Minimum execution time: 1_654_000 picoseconds. + Weight::from_parts(1_885_921, 0) // Standard Error: 14 - .saturating_add(Weight::from_parts(1_217, 0).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(1_243, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_795_000 picoseconds. - Weight::from_parts(3_107_843, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(2_445, 0).saturating_mul(r.into())) + // Minimum execution time: 2_744_000 picoseconds. + Weight::from_parts(3_014_725, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_447, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_815_000 picoseconds. - Weight::from_parts(3_114_618, 0) + // Minimum execution time: 2_881_000 picoseconds. + Weight::from_parts(3_137_711, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(3_639, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_608, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_861_000 picoseconds. - Weight::from_parts(3_193_592, 0) + // Minimum execution time: 2_809_000 picoseconds. + Weight::from_parts(3_142_066, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(3_957, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_841, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_710_000 picoseconds. - Weight::from_parts(2_148_021, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(8_391, 0).saturating_mul(r.into())) + // Minimum execution time: 1_704_000 picoseconds. + Weight::from_parts(2_083_619, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(8_366, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_663_000 picoseconds. - Weight::from_parts(2_170_373, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(8_812, 0).saturating_mul(r.into())) + // Minimum execution time: 1_652_000 picoseconds. + Weight::from_parts(2_048_256, 0) + // Standard Error: 5 + .saturating_add(Weight::from_parts(8_826, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_662_000 picoseconds. - Weight::from_parts(2_601_398, 0) - // Standard Error: 198 - .saturating_add(Weight::from_parts(3_851, 0).saturating_mul(r.into())) + // Minimum execution time: 1_671_000 picoseconds. + Weight::from_parts(1_924_626, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_746, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 16]`. fn instr_memory_grow(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_603_000 picoseconds. - Weight::from_parts(332_932, 0) - // Standard Error: 137_529 - .saturating_add(Weight::from_parts(13_233_734, 0).saturating_mul(r.into())) + // Minimum execution time: 1_585_000 picoseconds. + Weight::from_parts(490_856, 0) + // Standard Error: 133_673 + .saturating_add(Weight::from_parts(13_182_582, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_613_000 picoseconds. - Weight::from_parts(1_922_391, 0) + // Minimum execution time: 1_533_000 picoseconds. + Weight::from_parts(1_851_563, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_903, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_820, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_522_000 picoseconds. - Weight::from_parts(1_920_023, 0) + // Minimum execution time: 1_564_000 picoseconds. + Weight::from_parts(1_914_178, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_876, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_590_000 picoseconds. - Weight::from_parts(1_867_406, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3_910, 0).saturating_mul(r.into())) + // Minimum execution time: 1_559_000 picoseconds. + Weight::from_parts(1_886_992, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(3_731, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_577_000 picoseconds. - Weight::from_parts(1_918_037, 0) + // Minimum execution time: 1_553_000 picoseconds. + Weight::from_parts(1_886_545, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_673, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_658, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_589_000 picoseconds. - Weight::from_parts(1_917_901, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3_956, 0).saturating_mul(r.into())) + // Minimum execution time: 1_507_000 picoseconds. + Weight::from_parts(1_853_647, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(3_852, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_573_000 picoseconds. - Weight::from_parts(1_902_324, 0) + // Minimum execution time: 1_554_000 picoseconds. + Weight::from_parts(1_868_877, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_865, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_806, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_586_000 picoseconds. - Weight::from_parts(1_953_738, 0) + // Minimum execution time: 1_514_000 picoseconds. + Weight::from_parts(1_882_233, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(3_838, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(3_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_598_000 picoseconds. - Weight::from_parts(1_912_180, 0) + // Minimum execution time: 1_529_000 picoseconds. + Weight::from_parts(1_897_247, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_994, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_955, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_573_000 picoseconds. - Weight::from_parts(1_943_725, 0) + // Minimum execution time: 1_513_000 picoseconds. + Weight::from_parts(1_922_333, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_998, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_933, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_584_000 picoseconds. - Weight::from_parts(1_949_209, 0) + // Minimum execution time: 1_512_000 picoseconds. + Weight::from_parts(1_848_668, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_991, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_966, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_576_000 picoseconds. - Weight::from_parts(1_927_466, 0) + // Minimum execution time: 1_522_000 picoseconds. + Weight::from_parts(1_875_257, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(6_005, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_965, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_566_000 picoseconds. - Weight::from_parts(2_004_312, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_799, 0).saturating_mul(r.into())) + // Minimum execution time: 1_546_000 picoseconds. + Weight::from_parts(1_836_691, 0) + // Standard Error: 4 + .saturating_add(Weight::from_parts(5_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_538_000 picoseconds. - Weight::from_parts(1_922_703, 0) - // Standard Error: 9 - .saturating_add(Weight::from_parts(6_129, 0).saturating_mul(r.into())) + // Minimum execution time: 1_505_000 picoseconds. + Weight::from_parts(1_907_551, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_575_000 picoseconds. - Weight::from_parts(1_978_271, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_991, 0).saturating_mul(r.into())) + // Minimum execution time: 1_527_000 picoseconds. + Weight::from_parts(1_891_008, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_971, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_572_000 picoseconds. - Weight::from_parts(4_028_578, 0) - // Standard Error: 263 - .saturating_add(Weight::from_parts(5_784, 0).saturating_mul(r.into())) + // Minimum execution time: 1_556_000 picoseconds. + Weight::from_parts(1_910_864, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_059, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_615_000 picoseconds. - Weight::from_parts(1_962_065, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_945, 0).saturating_mul(r.into())) + // Minimum execution time: 1_544_000 picoseconds. + Weight::from_parts(1_912_650, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_943, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_578_000 picoseconds. - Weight::from_parts(1_909_721, 0) + // Minimum execution time: 1_513_000 picoseconds. + Weight::from_parts(1_855_260, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_993, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_975, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_609_000 picoseconds. - Weight::from_parts(1_926_472, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_888, 0).saturating_mul(r.into())) + // Minimum execution time: 1_521_000 picoseconds. + Weight::from_parts(1_867_259, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_846, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_620_000 picoseconds. - Weight::from_parts(2_875_196, 0) - // Standard Error: 177 - .saturating_add(Weight::from_parts(5_990, 0).saturating_mul(r.into())) + // Minimum execution time: 1_509_000 picoseconds. + Weight::from_parts(1_893_018, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_570_000 picoseconds. - Weight::from_parts(2_155_483, 0) - // Standard Error: 83 - .saturating_add(Weight::from_parts(5_675, 0).saturating_mul(r.into())) + // Minimum execution time: 1_496_000 picoseconds. + Weight::from_parts(1_886_659, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_754, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_558_000 picoseconds. - Weight::from_parts(2_108_263, 0) - // Standard Error: 5 - .saturating_add(Weight::from_parts(11_755, 0).saturating_mul(r.into())) + // Minimum execution time: 1_527_000 picoseconds. + Weight::from_parts(1_890_548, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(11_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_568_000 picoseconds. - Weight::from_parts(1_606_397, 0) - // Standard Error: 51 - .saturating_add(Weight::from_parts(11_011, 0).saturating_mul(r.into())) + // Minimum execution time: 1_518_000 picoseconds. + Weight::from_parts(1_891_903, 0) + // Standard Error: 4 + .saturating_add(Weight::from_parts(10_613, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_630_000 picoseconds. - Weight::from_parts(2_872_487, 0) - // Standard Error: 24 - .saturating_add(Weight::from_parts(11_761, 0).saturating_mul(r.into())) + // Minimum execution time: 1_504_000 picoseconds. + Weight::from_parts(1_632_694, 0) + // Standard Error: 7 + .saturating_add(Weight::from_parts(12_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_575_000 picoseconds. - Weight::from_parts(2_385_398, 0) - // Standard Error: 45 - .saturating_add(Weight::from_parts(10_650, 0).saturating_mul(r.into())) + // Minimum execution time: 1_507_000 picoseconds. + Weight::from_parts(1_878_413, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(10_737, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_622_000 picoseconds. - Weight::from_parts(1_957_246, 0) + // Minimum execution time: 1_534_000 picoseconds. + Weight::from_parts(1_898_519, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(5_659, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(5_645, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_551_000 picoseconds. - Weight::from_parts(1_897_168, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_774, 0).saturating_mul(r.into())) + // Minimum execution time: 1_503_000 picoseconds. + Weight::from_parts(1_895_532, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_745, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_549_000 picoseconds. - Weight::from_parts(1_915_938, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_915, 0).saturating_mul(r.into())) + // Minimum execution time: 1_507_000 picoseconds. + Weight::from_parts(1_868_720, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_873, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_617_000 picoseconds. - Weight::from_parts(1_932_618, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_854, 0).saturating_mul(r.into())) + // Minimum execution time: 1_513_000 picoseconds. + Weight::from_parts(1_894_207, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_617_000 picoseconds. - Weight::from_parts(1_937_566, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(6_134, 0).saturating_mul(r.into())) + // Minimum execution time: 1_473_000 picoseconds. + Weight::from_parts(1_880_224, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(6_107, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_584_000 picoseconds. - Weight::from_parts(1_980_681, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(5_842, 0).saturating_mul(r.into())) + // Minimum execution time: 1_447_000 picoseconds. + Weight::from_parts(1_884_551, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_849, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_542_000 picoseconds. - Weight::from_parts(2_131_567, 0) - // Standard Error: 57 - .saturating_add(Weight::from_parts(6_010, 0).saturating_mul(r.into())) + // Minimum execution time: 1_538_000 picoseconds. + Weight::from_parts(1_908_813, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_987, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 5000]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_609_000 picoseconds. - Weight::from_parts(1_643_214, 0) - // Standard Error: 91 - .saturating_add(Weight::from_parts(6_062, 0).saturating_mul(r.into())) + // Minimum execution time: 1_538_000 picoseconds. + Weight::from_parts(1_878_015, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(5_848, 0).saturating_mul(r.into())) } } diff --git a/frame/conviction-voting/src/weights.rs b/frame/conviction-voting/src/weights.rs index 765a4276aea59..bc53855b6b18e 100644 --- a/frame/conviction-voting/src/weights.rs +++ b/frame/conviction-voting/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_conviction_voting //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_conviction_voting -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -71,15 +68,17 @@ impl WeightInfo for SubstrateWeight { /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Scheduler Agenda (r:2 w:2) /// Proof: Scheduler Agenda (max_values: None, max_size: Some(107022), added: 109497, mode: MaxEncodedLen) fn vote_new() -> Weight { // Proof Size summary in bytes: // Measured: `13074` - // Estimated: `262809` - // Minimum execution time: 94_493_000 picoseconds. - Weight::from_parts(96_510_000, 262809) - .saturating_add(T::DbWeight::get().reads(6_u64)) + // Estimated: `219984` + // Minimum execution time: 99_130_000 picoseconds. + Weight::from_parts(100_355_000, 219984) + .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: Referenda ReferendumInfoFor (r:1 w:1) @@ -90,15 +89,17 @@ impl WeightInfo for SubstrateWeight { /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Scheduler Agenda (r:2 w:2) /// Proof: Scheduler Agenda (max_values: None, max_size: Some(107022), added: 109497, mode: MaxEncodedLen) fn vote_existing() -> Weight { // Proof Size summary in bytes: // Measured: `20216` - // Estimated: `262809` - // Minimum execution time: 252_717_000 picoseconds. - Weight::from_parts(255_200_000, 262809) - .saturating_add(T::DbWeight::get().reads(6_u64)) + // Estimated: `219984` + // Minimum execution time: 276_420_000 picoseconds. + Weight::from_parts(277_433_000, 219984) + .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: ConvictionVoting VotingFor (r:1 w:1) @@ -110,9 +111,9 @@ impl WeightInfo for SubstrateWeight { fn remove_vote() -> Weight { // Proof Size summary in bytes: // Measured: `19968` - // Estimated: `254521` - // Minimum execution time: 244_844_000 picoseconds. - Weight::from_parts(247_433_000, 254521) + // Estimated: `219984` + // Minimum execution time: 241_058_000 picoseconds. + Weight::from_parts(242_235_000, 219984) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -123,9 +124,9 @@ impl WeightInfo for SubstrateWeight { fn remove_other_vote() -> Weight { // Proof Size summary in bytes: // Measured: `12675` - // Estimated: `34537` - // Minimum execution time: 46_271_000 picoseconds. - Weight::from_parts(47_639_000, 34537) + // Estimated: `30706` + // Minimum execution time: 46_385_000 picoseconds. + Weight::from_parts(46_709_000, 30706) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -139,20 +140,22 @@ impl WeightInfo for SubstrateWeight { /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `r` is `[0, 1]`. fn delegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `240 + r * (1627 ±0)` - // Estimated: `180617 + r * (111908 ±0)` - // Minimum execution time: 37_578_000 picoseconds. - Weight::from_parts(39_035_446, 180617) - // Standard Error: 160_560 - .saturating_add(Weight::from_parts(39_642_553, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) + // Estimated: `109992 + r * (109992 ±0)` + // Minimum execution time: 48_947_000 picoseconds. + Weight::from_parts(50_219_593, 109992) + // Standard Error: 70_238 + .saturating_add(Weight::from_parts(40_509_706, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 111908).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 109992).saturating_mul(r.into())) } /// Storage: ConvictionVoting VotingFor (r:2 w:2) /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) @@ -164,16 +167,16 @@ impl WeightInfo for SubstrateWeight { fn undelegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `406 + r * (1376 ±0)` - // Estimated: `172329 + r * (111908 ±0)` - // Minimum execution time: 22_997_000 picoseconds. - Weight::from_parts(24_180_222, 172329) - // Standard Error: 87_723 - .saturating_add(Weight::from_parts(36_189_677, 0).saturating_mul(r.into())) + // Estimated: `109992 + r * (109992 ±0)` + // Minimum execution time: 23_408_000 picoseconds. + Weight::from_parts(24_087_793, 109992) + // Standard Error: 31_776 + .saturating_add(Weight::from_parts(36_594_606, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 111908).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 109992).saturating_mul(r.into())) } /// Storage: ConvictionVoting VotingFor (r:1 w:1) /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) @@ -181,13 +184,15 @@ impl WeightInfo for SubstrateWeight { /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn unlock() -> Weight { // Proof Size summary in bytes: // Measured: `11734` - // Estimated: `38994` - // Minimum execution time: 55_906_000 picoseconds. - Weight::from_parts(56_819_000, 38994) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `30706` + // Minimum execution time: 65_903_000 picoseconds. + Weight::from_parts(66_460_000, 30706) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } } @@ -202,15 +207,17 @@ impl WeightInfo for () { /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Scheduler Agenda (r:2 w:2) /// Proof: Scheduler Agenda (max_values: None, max_size: Some(107022), added: 109497, mode: MaxEncodedLen) fn vote_new() -> Weight { // Proof Size summary in bytes: // Measured: `13074` - // Estimated: `262809` - // Minimum execution time: 94_493_000 picoseconds. - Weight::from_parts(96_510_000, 262809) - .saturating_add(RocksDbWeight::get().reads(6_u64)) + // Estimated: `219984` + // Minimum execution time: 99_130_000 picoseconds. + Weight::from_parts(100_355_000, 219984) + .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: Referenda ReferendumInfoFor (r:1 w:1) @@ -221,15 +228,17 @@ impl WeightInfo for () { /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Scheduler Agenda (r:2 w:2) /// Proof: Scheduler Agenda (max_values: None, max_size: Some(107022), added: 109497, mode: MaxEncodedLen) fn vote_existing() -> Weight { // Proof Size summary in bytes: // Measured: `20216` - // Estimated: `262809` - // Minimum execution time: 252_717_000 picoseconds. - Weight::from_parts(255_200_000, 262809) - .saturating_add(RocksDbWeight::get().reads(6_u64)) + // Estimated: `219984` + // Minimum execution time: 276_420_000 picoseconds. + Weight::from_parts(277_433_000, 219984) + .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: ConvictionVoting VotingFor (r:1 w:1) @@ -241,9 +250,9 @@ impl WeightInfo for () { fn remove_vote() -> Weight { // Proof Size summary in bytes: // Measured: `19968` - // Estimated: `254521` - // Minimum execution time: 244_844_000 picoseconds. - Weight::from_parts(247_433_000, 254521) + // Estimated: `219984` + // Minimum execution time: 241_058_000 picoseconds. + Weight::from_parts(242_235_000, 219984) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -254,9 +263,9 @@ impl WeightInfo for () { fn remove_other_vote() -> Weight { // Proof Size summary in bytes: // Measured: `12675` - // Estimated: `34537` - // Minimum execution time: 46_271_000 picoseconds. - Weight::from_parts(47_639_000, 34537) + // Estimated: `30706` + // Minimum execution time: 46_385_000 picoseconds. + Weight::from_parts(46_709_000, 30706) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -270,20 +279,22 @@ impl WeightInfo for () { /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `r` is `[0, 1]`. fn delegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `240 + r * (1627 ±0)` - // Estimated: `180617 + r * (111908 ±0)` - // Minimum execution time: 37_578_000 picoseconds. - Weight::from_parts(39_035_446, 180617) - // Standard Error: 160_560 - .saturating_add(Weight::from_parts(39_642_553, 0).saturating_mul(r.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Estimated: `109992 + r * (109992 ±0)` + // Minimum execution time: 48_947_000 picoseconds. + Weight::from_parts(50_219_593, 109992) + // Standard Error: 70_238 + .saturating_add(Weight::from_parts(40_509_706, 0).saturating_mul(r.into())) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 111908).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 109992).saturating_mul(r.into())) } /// Storage: ConvictionVoting VotingFor (r:2 w:2) /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) @@ -295,16 +306,16 @@ impl WeightInfo for () { fn undelegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `406 + r * (1376 ±0)` - // Estimated: `172329 + r * (111908 ±0)` - // Minimum execution time: 22_997_000 picoseconds. - Weight::from_parts(24_180_222, 172329) - // Standard Error: 87_723 - .saturating_add(Weight::from_parts(36_189_677, 0).saturating_mul(r.into())) + // Estimated: `109992 + r * (109992 ±0)` + // Minimum execution time: 23_408_000 picoseconds. + Weight::from_parts(24_087_793, 109992) + // Standard Error: 31_776 + .saturating_add(Weight::from_parts(36_594_606, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 111908).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 109992).saturating_mul(r.into())) } /// Storage: ConvictionVoting VotingFor (r:1 w:1) /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) @@ -312,13 +323,15 @@ impl WeightInfo for () { /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn unlock() -> Weight { // Proof Size summary in bytes: // Measured: `11734` - // Estimated: `38994` - // Minimum execution time: 55_906_000 picoseconds. - Weight::from_parts(56_819_000, 38994) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `30706` + // Minimum execution time: 65_903_000 picoseconds. + Weight::from_parts(66_460_000, 30706) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } } diff --git a/frame/core-fellowship/src/weights.rs b/frame/core-fellowship/src/weights.rs index d436826665069..28ebeae64733e 100644 --- a/frame/core-fellowship/src/weights.rs +++ b/frame/core-fellowship/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_core_fellowship //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_core_fellowship -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -72,8 +69,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_384_000 picoseconds. - Weight::from_parts(10_787_000, 0) + // Minimum execution time: 10_390_000 picoseconds. + Weight::from_parts(10_847_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: CoreFellowship Member (r:1 w:1) @@ -91,9 +88,9 @@ impl WeightInfo for SubstrateWeight { fn bump_offboard() -> Weight { // Proof Size summary in bytes: // Measured: `16854` - // Estimated: `35762` - // Minimum execution time: 61_847_000 picoseconds. - Weight::from_parts(62_453_000, 35762) + // Estimated: `19894` + // Minimum execution time: 61_737_000 picoseconds. + Weight::from_parts(62_207_000, 19894) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -112,9 +109,9 @@ impl WeightInfo for SubstrateWeight { fn bump_demote() -> Weight { // Proof Size summary in bytes: // Measured: `16964` - // Estimated: `35762` - // Minimum execution time: 64_449_000 picoseconds. - Weight::from_parts(65_298_000, 35762) + // Estimated: `19894` + // Minimum execution time: 64_226_000 picoseconds. + Weight::from_parts(64_678_000, 19894) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -125,9 +122,9 @@ impl WeightInfo for SubstrateWeight { fn set_active() -> Weight { // Proof Size summary in bytes: // Measured: `355` - // Estimated: `7021` - // Minimum execution time: 19_308_000 picoseconds. - Weight::from_parts(19_520_000, 7021) + // Estimated: `3514` + // Minimum execution time: 18_977_000 picoseconds. + Weight::from_parts(19_157_000, 3514) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -144,9 +141,9 @@ impl WeightInfo for SubstrateWeight { fn induct() -> Weight { // Proof Size summary in bytes: // Measured: `113` - // Estimated: `10500` - // Minimum execution time: 29_228_000 picoseconds. - Weight::from_parts(29_683_000, 10500) + // Estimated: `3514` + // Minimum execution time: 28_633_000 picoseconds. + Weight::from_parts(29_074_000, 3514) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -167,9 +164,9 @@ impl WeightInfo for SubstrateWeight { fn promote() -> Weight { // Proof Size summary in bytes: // Measured: `16832` - // Estimated: `32243` - // Minimum execution time: 59_745_000 picoseconds. - Weight::from_parts(60_290_000, 32243) + // Estimated: `19894` + // Minimum execution time: 59_008_000 picoseconds. + Weight::from_parts(59_690_000, 19894) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -182,9 +179,9 @@ impl WeightInfo for SubstrateWeight { fn offboard() -> Weight { // Proof Size summary in bytes: // Measured: `326` - // Estimated: `7021` - // Minimum execution time: 18_964_000 picoseconds. - Weight::from_parts(19_603_000, 7021) + // Estimated: `3514` + // Minimum execution time: 18_892_000 picoseconds. + Weight::from_parts(19_095_000, 3514) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -195,9 +192,9 @@ impl WeightInfo for SubstrateWeight { fn import() -> Weight { // Proof Size summary in bytes: // Measured: `280` - // Estimated: `7021` - // Minimum execution time: 18_752_000 picoseconds. - Weight::from_parts(19_035_000, 7021) + // Estimated: `3514` + // Minimum execution time: 18_107_000 picoseconds. + Weight::from_parts(18_371_000, 3514) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -210,9 +207,9 @@ impl WeightInfo for SubstrateWeight { fn approve() -> Weight { // Proof Size summary in bytes: // Measured: `16810` - // Estimated: `26915` - // Minimum execution time: 44_972_000 picoseconds. - Weight::from_parts(45_391_000, 26915) + // Estimated: `19894` + // Minimum execution time: 43_243_000 picoseconds. + Weight::from_parts(43_965_000, 19894) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -223,9 +220,9 @@ impl WeightInfo for SubstrateWeight { fn submit_evidence() -> Weight { // Proof Size summary in bytes: // Measured: `79` - // Estimated: `23408` - // Minimum execution time: 27_820_000 picoseconds. - Weight::from_parts(28_992_000, 23408) + // Estimated: `19894` + // Minimum execution time: 27_881_000 picoseconds. + Weight::from_parts(28_208_000, 19894) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -239,8 +236,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_384_000 picoseconds. - Weight::from_parts(10_787_000, 0) + // Minimum execution time: 10_390_000 picoseconds. + Weight::from_parts(10_847_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: CoreFellowship Member (r:1 w:1) @@ -258,9 +255,9 @@ impl WeightInfo for () { fn bump_offboard() -> Weight { // Proof Size summary in bytes: // Measured: `16854` - // Estimated: `35762` - // Minimum execution time: 61_847_000 picoseconds. - Weight::from_parts(62_453_000, 35762) + // Estimated: `19894` + // Minimum execution time: 61_737_000 picoseconds. + Weight::from_parts(62_207_000, 19894) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -279,9 +276,9 @@ impl WeightInfo for () { fn bump_demote() -> Weight { // Proof Size summary in bytes: // Measured: `16964` - // Estimated: `35762` - // Minimum execution time: 64_449_000 picoseconds. - Weight::from_parts(65_298_000, 35762) + // Estimated: `19894` + // Minimum execution time: 64_226_000 picoseconds. + Weight::from_parts(64_678_000, 19894) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -292,9 +289,9 @@ impl WeightInfo for () { fn set_active() -> Weight { // Proof Size summary in bytes: // Measured: `355` - // Estimated: `7021` - // Minimum execution time: 19_308_000 picoseconds. - Weight::from_parts(19_520_000, 7021) + // Estimated: `3514` + // Minimum execution time: 18_977_000 picoseconds. + Weight::from_parts(19_157_000, 3514) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -311,9 +308,9 @@ impl WeightInfo for () { fn induct() -> Weight { // Proof Size summary in bytes: // Measured: `113` - // Estimated: `10500` - // Minimum execution time: 29_228_000 picoseconds. - Weight::from_parts(29_683_000, 10500) + // Estimated: `3514` + // Minimum execution time: 28_633_000 picoseconds. + Weight::from_parts(29_074_000, 3514) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -334,9 +331,9 @@ impl WeightInfo for () { fn promote() -> Weight { // Proof Size summary in bytes: // Measured: `16832` - // Estimated: `32243` - // Minimum execution time: 59_745_000 picoseconds. - Weight::from_parts(60_290_000, 32243) + // Estimated: `19894` + // Minimum execution time: 59_008_000 picoseconds. + Weight::from_parts(59_690_000, 19894) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -349,9 +346,9 @@ impl WeightInfo for () { fn offboard() -> Weight { // Proof Size summary in bytes: // Measured: `326` - // Estimated: `7021` - // Minimum execution time: 18_964_000 picoseconds. - Weight::from_parts(19_603_000, 7021) + // Estimated: `3514` + // Minimum execution time: 18_892_000 picoseconds. + Weight::from_parts(19_095_000, 3514) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -362,9 +359,9 @@ impl WeightInfo for () { fn import() -> Weight { // Proof Size summary in bytes: // Measured: `280` - // Estimated: `7021` - // Minimum execution time: 18_752_000 picoseconds. - Weight::from_parts(19_035_000, 7021) + // Estimated: `3514` + // Minimum execution time: 18_107_000 picoseconds. + Weight::from_parts(18_371_000, 3514) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -377,9 +374,9 @@ impl WeightInfo for () { fn approve() -> Weight { // Proof Size summary in bytes: // Measured: `16810` - // Estimated: `26915` - // Minimum execution time: 44_972_000 picoseconds. - Weight::from_parts(45_391_000, 26915) + // Estimated: `19894` + // Minimum execution time: 43_243_000 picoseconds. + Weight::from_parts(43_965_000, 19894) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -390,9 +387,9 @@ impl WeightInfo for () { fn submit_evidence() -> Weight { // Proof Size summary in bytes: // Measured: `79` - // Estimated: `23408` - // Minimum execution time: 27_820_000 picoseconds. - Weight::from_parts(28_992_000, 23408) + // Estimated: `19894` + // Minimum execution time: 27_881_000 picoseconds. + Weight::from_parts(28_208_000, 19894) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/democracy/src/weights.rs b/frame/democracy/src/weights.rs index e0c970a34b372..a263f2982d862 100644 --- a/frame/democracy/src/weights.rs +++ b/frame/democracy/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_democracy //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_democracy -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -95,9 +92,9 @@ impl WeightInfo for SubstrateWeight { fn propose() -> Weight { // Proof Size summary in bytes: // Measured: `4801` - // Estimated: `26379` - // Minimum execution time: 39_171_000 picoseconds. - Weight::from_parts(39_779_000, 26379) + // Estimated: `18187` + // Minimum execution time: 43_810_000 picoseconds. + Weight::from_parts(44_439_000, 18187) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -107,8 +104,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `3556` // Estimated: `6695` - // Minimum execution time: 35_694_000 picoseconds. - Weight::from_parts(36_181_000, 6695) + // Minimum execution time: 40_003_000 picoseconds. + Weight::from_parts(40_448_000, 6695) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -118,13 +115,15 @@ impl WeightInfo for SubstrateWeight { /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn vote_new() -> Weight { // Proof Size summary in bytes: // Measured: `3470` - // Estimated: `15690` - // Minimum execution time: 50_274_000 picoseconds. - Weight::from_parts(51_216_000, 15690) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `7260` + // Minimum execution time: 54_737_000 picoseconds. + Weight::from_parts(55_154_000, 7260) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) @@ -133,13 +132,15 @@ impl WeightInfo for SubstrateWeight { /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn vote_existing() -> Weight { // Proof Size summary in bytes: // Measured: `3492` - // Estimated: `15690` - // Minimum execution time: 50_559_000 picoseconds. - Weight::from_parts(51_030_000, 15690) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `7260` + // Minimum execution time: 59_545_000 picoseconds. + Weight::from_parts(59_955_000, 7260) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) @@ -151,9 +152,9 @@ impl WeightInfo for SubstrateWeight { fn emergency_cancel() -> Weight { // Proof Size summary in bytes: // Measured: `366` - // Estimated: `10682` - // Minimum execution time: 27_539_000 picoseconds. - Weight::from_parts(28_040_000, 10682) + // Estimated: `3666` + // Minimum execution time: 27_886_000 picoseconds. + Weight::from_parts(28_372_000, 3666) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -174,9 +175,9 @@ impl WeightInfo for SubstrateWeight { fn blacklist() -> Weight { // Proof Size summary in bytes: // Measured: `5910` - // Estimated: `42332` - // Minimum execution time: 93_053_000 picoseconds. - Weight::from_parts(94_193_000, 42332) + // Estimated: `18187` + // Minimum execution time: 99_273_000 picoseconds. + Weight::from_parts(100_398_000, 18187) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -187,9 +188,9 @@ impl WeightInfo for SubstrateWeight { fn external_propose() -> Weight { // Proof Size summary in bytes: // Measured: `3416` - // Estimated: `8320` - // Minimum execution time: 14_664_000 picoseconds. - Weight::from_parts(15_064_000, 8320) + // Estimated: `6703` + // Minimum execution time: 14_946_000 picoseconds. + Weight::from_parts(15_114_000, 6703) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -199,8 +200,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_073_000 picoseconds. - Weight::from_parts(4_242_000, 0) + // Minimum execution time: 3_870_000 picoseconds. + Weight::from_parts(4_083_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Democracy NextExternal (r:0 w:1) @@ -209,8 +210,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_779_000 picoseconds. - Weight::from_parts(4_091_000, 0) + // Minimum execution time: 3_989_000 picoseconds. + Weight::from_parts(4_166_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Democracy NextExternal (r:1 w:1) @@ -224,9 +225,9 @@ impl WeightInfo for SubstrateWeight { fn fast_track() -> Weight { // Proof Size summary in bytes: // Measured: `286` - // Estimated: `6624` - // Minimum execution time: 29_596_000 picoseconds. - Weight::from_parts(30_083_000, 6624) + // Estimated: `3518` + // Minimum execution time: 29_776_000 picoseconds. + Weight::from_parts(30_186_000, 3518) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -239,9 +240,9 @@ impl WeightInfo for SubstrateWeight { fn veto_external() -> Weight { // Proof Size summary in bytes: // Measured: `3519` - // Estimated: `11838` - // Minimum execution time: 34_721_000 picoseconds. - Weight::from_parts(34_989_000, 11838) + // Estimated: `6703` + // Minimum execution time: 33_891_000 picoseconds. + Weight::from_parts(34_265_000, 6703) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -256,9 +257,9 @@ impl WeightInfo for SubstrateWeight { fn cancel_proposal() -> Weight { // Proof Size summary in bytes: // Measured: `5821` - // Estimated: `31993` - // Minimum execution time: 74_835_000 picoseconds. - Weight::from_parts(75_807_000, 31993) + // Estimated: `18187` + // Minimum execution time: 81_510_000 picoseconds. + Weight::from_parts(82_483_000, 18187) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -270,8 +271,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `271` // Estimated: `3518` - // Minimum execution time: 20_995_000 picoseconds. - Weight::from_parts(21_425_000, 3518) + // Minimum execution time: 21_164_000 picoseconds. + Weight::from_parts(21_624_000, 3518) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -285,11 +286,11 @@ impl WeightInfo for SubstrateWeight { fn on_initialize_base(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `244 + r * (86 ±0)` - // Estimated: `3968 + r * (2676 ±0)` - // Minimum execution time: 7_002_000 picoseconds. - Weight::from_parts(10_543_534, 3968) - // Standard Error: 7_286 - .saturating_add(Weight::from_parts(2_911_122, 0).saturating_mul(r.into())) + // Estimated: `1489 + r * (2676 ±0)` + // Minimum execution time: 6_925_000 picoseconds. + Weight::from_parts(10_624_198, 1489) + // Standard Error: 5_780 + .saturating_add(Weight::from_parts(2_934_169, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -311,11 +312,11 @@ impl WeightInfo for SubstrateWeight { fn on_initialize_base_with_launch_period(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `244 + r * (86 ±0)` - // Estimated: `25258 + r * (2676 ±0)` - // Minimum execution time: 10_824_000 picoseconds. - Weight::from_parts(14_187_527, 25258) - // Standard Error: 7_148 - .saturating_add(Weight::from_parts(2_886_910, 0).saturating_mul(r.into())) + // Estimated: `18187 + r * (2676 ±0)` + // Minimum execution time: 10_551_000 picoseconds. + Weight::from_parts(13_126_123, 18187) + // Standard Error: 6_391 + .saturating_add(Weight::from_parts(2_952_789, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -327,16 +328,18 @@ impl WeightInfo for SubstrateWeight { /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `r` is `[0, 99]`. fn delegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `830 + r * (108 ±0)` - // Estimated: `25554 + r * (2676 ±0)` - // Minimum execution time: 42_940_000 picoseconds. - Weight::from_parts(45_288_082, 25554) - // Standard Error: 6_380 - .saturating_add(Weight::from_parts(4_219_163, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) + // Estimated: `19800 + r * (2676 ±0)` + // Minimum execution time: 47_172_000 picoseconds. + Weight::from_parts(49_667_954, 19800) + // Standard Error: 6_129 + .saturating_add(Weight::from_parts(4_230_402, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) @@ -350,11 +353,11 @@ impl WeightInfo for SubstrateWeight { fn undelegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `493 + r * (108 ±0)` - // Estimated: `14520 + r * (2676 ±0)` - // Minimum execution time: 22_203_000 picoseconds. - Weight::from_parts(22_307_372, 14520) - // Standard Error: 7_095 - .saturating_add(Weight::from_parts(4_202_995, 0).saturating_mul(r.into())) + // Estimated: `13530 + r * (2676 ±0)` + // Minimum execution time: 22_360_000 picoseconds. + Weight::from_parts(25_063_237, 13530) + // Standard Error: 5_326 + .saturating_add(Weight::from_parts(4_163_683, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -367,44 +370,48 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_046_000 picoseconds. - Weight::from_parts(4_191_000, 0) + // Minimum execution time: 4_047_000 picoseconds. + Weight::from_parts(4_139_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Democracy VotingOf (r:1 w:1) /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `r` is `[0, 99]`. fn unlock_remove(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `563` - // Estimated: `15617` - // Minimum execution time: 22_585_000 picoseconds. - Weight::from_parts(28_461_437, 15617) - // Standard Error: 1_636 - .saturating_add(Weight::from_parts(19_140, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `7260` + // Minimum execution time: 27_322_000 picoseconds. + Weight::from_parts(39_909_589, 7260) + // Standard Error: 2_758 + .saturating_add(Weight::from_parts(29_497, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy VotingOf (r:1 w:1) /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `r` is `[0, 99]`. fn unlock_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `564 + r * (22 ±0)` - // Estimated: `15617` - // Minimum execution time: 26_674_000 picoseconds. - Weight::from_parts(27_815_260, 15617) - // Standard Error: 490 - .saturating_add(Weight::from_parts(68_478, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `7260` + // Minimum execution time: 37_082_000 picoseconds. + Weight::from_parts(38_580_061, 7260) + // Standard Error: 664 + .saturating_add(Weight::from_parts(62_401, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) @@ -415,11 +422,11 @@ impl WeightInfo for SubstrateWeight { fn remove_vote(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `728 + r * (26 ±0)` - // Estimated: `10926` - // Minimum execution time: 17_381_000 picoseconds. - Weight::from_parts(19_728_665, 10926) - // Standard Error: 1_065 - .saturating_add(Weight::from_parts(84_481, 0).saturating_mul(r.into())) + // Estimated: `7260` + // Minimum execution time: 17_528_000 picoseconds. + Weight::from_parts(20_075_412, 7260) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(81_734, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -431,11 +438,11 @@ impl WeightInfo for SubstrateWeight { fn remove_other_vote(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `728 + r * (26 ±0)` - // Estimated: `10926` - // Minimum execution time: 17_496_000 picoseconds. - Weight::from_parts(19_845_941, 10926) - // Standard Error: 1_169 - .saturating_add(Weight::from_parts(85_004, 0).saturating_mul(r.into())) + // Estimated: `7260` + // Minimum execution time: 17_517_000 picoseconds. + Weight::from_parts(20_090_718, 7260) + // Standard Error: 1_105 + .saturating_add(Weight::from_parts(82_651, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -448,9 +455,9 @@ impl WeightInfo for SubstrateWeight { fn set_external_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `356` - // Estimated: `5173` - // Minimum execution time: 19_076_000 picoseconds. - Weight::from_parts(19_650_000, 5173) + // Estimated: `3556` + // Minimum execution time: 19_234_000 picoseconds. + Weight::from_parts(19_755_000, 3556) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -461,9 +468,9 @@ impl WeightInfo for SubstrateWeight { fn clear_external_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `286` - // Estimated: `5135` - // Minimum execution time: 17_588_000 picoseconds. - Weight::from_parts(17_781_000, 5135) + // Estimated: `3518` + // Minimum execution time: 17_621_000 picoseconds. + Weight::from_parts(17_861_000, 3518) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -476,9 +483,9 @@ impl WeightInfo for SubstrateWeight { fn set_proposal_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `4888` - // Estimated: `21743` - // Minimum execution time: 34_828_000 picoseconds. - Weight::from_parts(35_364_000, 21743) + // Estimated: `18187` + // Minimum execution time: 35_785_000 picoseconds. + Weight::from_parts(36_102_000, 18187) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -489,9 +496,9 @@ impl WeightInfo for SubstrateWeight { fn clear_proposal_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `4822` - // Estimated: `21705` - // Minimum execution time: 32_035_000 picoseconds. - Weight::from_parts(32_554_000, 21705) + // Estimated: `18187` + // Minimum execution time: 33_493_000 picoseconds. + Weight::from_parts(33_747_000, 18187) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -503,8 +510,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 15_279_000 picoseconds. - Weight::from_parts(15_556_000, 3556) + // Minimum execution time: 15_557_000 picoseconds. + Weight::from_parts(15_844_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -515,9 +522,9 @@ impl WeightInfo for SubstrateWeight { fn clear_referendum_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `302` - // Estimated: `7184` - // Minimum execution time: 19_622_000 picoseconds. - Weight::from_parts(19_978_000, 7184) + // Estimated: `3666` + // Minimum execution time: 19_940_000 picoseconds. + Weight::from_parts(20_301_000, 3666) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -536,9 +543,9 @@ impl WeightInfo for () { fn propose() -> Weight { // Proof Size summary in bytes: // Measured: `4801` - // Estimated: `26379` - // Minimum execution time: 39_171_000 picoseconds. - Weight::from_parts(39_779_000, 26379) + // Estimated: `18187` + // Minimum execution time: 43_810_000 picoseconds. + Weight::from_parts(44_439_000, 18187) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -548,8 +555,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `3556` // Estimated: `6695` - // Minimum execution time: 35_694_000 picoseconds. - Weight::from_parts(36_181_000, 6695) + // Minimum execution time: 40_003_000 picoseconds. + Weight::from_parts(40_448_000, 6695) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -559,13 +566,15 @@ impl WeightInfo for () { /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn vote_new() -> Weight { // Proof Size summary in bytes: // Measured: `3470` - // Estimated: `15690` - // Minimum execution time: 50_274_000 picoseconds. - Weight::from_parts(51_216_000, 15690) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `7260` + // Minimum execution time: 54_737_000 picoseconds. + Weight::from_parts(55_154_000, 7260) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) @@ -574,13 +583,15 @@ impl WeightInfo for () { /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn vote_existing() -> Weight { // Proof Size summary in bytes: // Measured: `3492` - // Estimated: `15690` - // Minimum execution time: 50_559_000 picoseconds. - Weight::from_parts(51_030_000, 15690) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `7260` + // Minimum execution time: 59_545_000 picoseconds. + Weight::from_parts(59_955_000, 7260) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) @@ -592,9 +603,9 @@ impl WeightInfo for () { fn emergency_cancel() -> Weight { // Proof Size summary in bytes: // Measured: `366` - // Estimated: `10682` - // Minimum execution time: 27_539_000 picoseconds. - Weight::from_parts(28_040_000, 10682) + // Estimated: `3666` + // Minimum execution time: 27_886_000 picoseconds. + Weight::from_parts(28_372_000, 3666) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -615,9 +626,9 @@ impl WeightInfo for () { fn blacklist() -> Weight { // Proof Size summary in bytes: // Measured: `5910` - // Estimated: `42332` - // Minimum execution time: 93_053_000 picoseconds. - Weight::from_parts(94_193_000, 42332) + // Estimated: `18187` + // Minimum execution time: 99_273_000 picoseconds. + Weight::from_parts(100_398_000, 18187) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -628,9 +639,9 @@ impl WeightInfo for () { fn external_propose() -> Weight { // Proof Size summary in bytes: // Measured: `3416` - // Estimated: `8320` - // Minimum execution time: 14_664_000 picoseconds. - Weight::from_parts(15_064_000, 8320) + // Estimated: `6703` + // Minimum execution time: 14_946_000 picoseconds. + Weight::from_parts(15_114_000, 6703) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -640,8 +651,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_073_000 picoseconds. - Weight::from_parts(4_242_000, 0) + // Minimum execution time: 3_870_000 picoseconds. + Weight::from_parts(4_083_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Democracy NextExternal (r:0 w:1) @@ -650,8 +661,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_779_000 picoseconds. - Weight::from_parts(4_091_000, 0) + // Minimum execution time: 3_989_000 picoseconds. + Weight::from_parts(4_166_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Democracy NextExternal (r:1 w:1) @@ -665,9 +676,9 @@ impl WeightInfo for () { fn fast_track() -> Weight { // Proof Size summary in bytes: // Measured: `286` - // Estimated: `6624` - // Minimum execution time: 29_596_000 picoseconds. - Weight::from_parts(30_083_000, 6624) + // Estimated: `3518` + // Minimum execution time: 29_776_000 picoseconds. + Weight::from_parts(30_186_000, 3518) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -680,9 +691,9 @@ impl WeightInfo for () { fn veto_external() -> Weight { // Proof Size summary in bytes: // Measured: `3519` - // Estimated: `11838` - // Minimum execution time: 34_721_000 picoseconds. - Weight::from_parts(34_989_000, 11838) + // Estimated: `6703` + // Minimum execution time: 33_891_000 picoseconds. + Weight::from_parts(34_265_000, 6703) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -697,9 +708,9 @@ impl WeightInfo for () { fn cancel_proposal() -> Weight { // Proof Size summary in bytes: // Measured: `5821` - // Estimated: `31993` - // Minimum execution time: 74_835_000 picoseconds. - Weight::from_parts(75_807_000, 31993) + // Estimated: `18187` + // Minimum execution time: 81_510_000 picoseconds. + Weight::from_parts(82_483_000, 18187) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -711,8 +722,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `271` // Estimated: `3518` - // Minimum execution time: 20_995_000 picoseconds. - Weight::from_parts(21_425_000, 3518) + // Minimum execution time: 21_164_000 picoseconds. + Weight::from_parts(21_624_000, 3518) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -726,11 +737,11 @@ impl WeightInfo for () { fn on_initialize_base(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `244 + r * (86 ±0)` - // Estimated: `3968 + r * (2676 ±0)` - // Minimum execution time: 7_002_000 picoseconds. - Weight::from_parts(10_543_534, 3968) - // Standard Error: 7_286 - .saturating_add(Weight::from_parts(2_911_122, 0).saturating_mul(r.into())) + // Estimated: `1489 + r * (2676 ±0)` + // Minimum execution time: 6_925_000 picoseconds. + Weight::from_parts(10_624_198, 1489) + // Standard Error: 5_780 + .saturating_add(Weight::from_parts(2_934_169, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -752,11 +763,11 @@ impl WeightInfo for () { fn on_initialize_base_with_launch_period(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `244 + r * (86 ±0)` - // Estimated: `25258 + r * (2676 ±0)` - // Minimum execution time: 10_824_000 picoseconds. - Weight::from_parts(14_187_527, 25258) - // Standard Error: 7_148 - .saturating_add(Weight::from_parts(2_886_910, 0).saturating_mul(r.into())) + // Estimated: `18187 + r * (2676 ±0)` + // Minimum execution time: 10_551_000 picoseconds. + Weight::from_parts(13_126_123, 18187) + // Standard Error: 6_391 + .saturating_add(Weight::from_parts(2_952_789, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -768,16 +779,18 @@ impl WeightInfo for () { /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `r` is `[0, 99]`. fn delegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `830 + r * (108 ±0)` - // Estimated: `25554 + r * (2676 ±0)` - // Minimum execution time: 42_940_000 picoseconds. - Weight::from_parts(45_288_082, 25554) - // Standard Error: 6_380 - .saturating_add(Weight::from_parts(4_219_163, 0).saturating_mul(r.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Estimated: `19800 + r * (2676 ±0)` + // Minimum execution time: 47_172_000 picoseconds. + Weight::from_parts(49_667_954, 19800) + // Standard Error: 6_129 + .saturating_add(Weight::from_parts(4_230_402, 0).saturating_mul(r.into())) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) @@ -791,11 +804,11 @@ impl WeightInfo for () { fn undelegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `493 + r * (108 ±0)` - // Estimated: `14520 + r * (2676 ±0)` - // Minimum execution time: 22_203_000 picoseconds. - Weight::from_parts(22_307_372, 14520) - // Standard Error: 7_095 - .saturating_add(Weight::from_parts(4_202_995, 0).saturating_mul(r.into())) + // Estimated: `13530 + r * (2676 ±0)` + // Minimum execution time: 22_360_000 picoseconds. + Weight::from_parts(25_063_237, 13530) + // Standard Error: 5_326 + .saturating_add(Weight::from_parts(4_163_683, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -808,44 +821,48 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_046_000 picoseconds. - Weight::from_parts(4_191_000, 0) + // Minimum execution time: 4_047_000 picoseconds. + Weight::from_parts(4_139_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Democracy VotingOf (r:1 w:1) /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `r` is `[0, 99]`. fn unlock_remove(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `563` - // Estimated: `15617` - // Minimum execution time: 22_585_000 picoseconds. - Weight::from_parts(28_461_437, 15617) - // Standard Error: 1_636 - .saturating_add(Weight::from_parts(19_140, 0).saturating_mul(r.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `7260` + // Minimum execution time: 27_322_000 picoseconds. + Weight::from_parts(39_909_589, 7260) + // Standard Error: 2_758 + .saturating_add(Weight::from_parts(29_497, 0).saturating_mul(r.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Democracy VotingOf (r:1 w:1) /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `r` is `[0, 99]`. fn unlock_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `564 + r * (22 ±0)` - // Estimated: `15617` - // Minimum execution time: 26_674_000 picoseconds. - Weight::from_parts(27_815_260, 15617) - // Standard Error: 490 - .saturating_add(Weight::from_parts(68_478, 0).saturating_mul(r.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `7260` + // Minimum execution time: 37_082_000 picoseconds. + Weight::from_parts(38_580_061, 7260) + // Standard Error: 664 + .saturating_add(Weight::from_parts(62_401, 0).saturating_mul(r.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) @@ -856,11 +873,11 @@ impl WeightInfo for () { fn remove_vote(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `728 + r * (26 ±0)` - // Estimated: `10926` - // Minimum execution time: 17_381_000 picoseconds. - Weight::from_parts(19_728_665, 10926) - // Standard Error: 1_065 - .saturating_add(Weight::from_parts(84_481, 0).saturating_mul(r.into())) + // Estimated: `7260` + // Minimum execution time: 17_528_000 picoseconds. + Weight::from_parts(20_075_412, 7260) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(81_734, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -872,11 +889,11 @@ impl WeightInfo for () { fn remove_other_vote(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `728 + r * (26 ±0)` - // Estimated: `10926` - // Minimum execution time: 17_496_000 picoseconds. - Weight::from_parts(19_845_941, 10926) - // Standard Error: 1_169 - .saturating_add(Weight::from_parts(85_004, 0).saturating_mul(r.into())) + // Estimated: `7260` + // Minimum execution time: 17_517_000 picoseconds. + Weight::from_parts(20_090_718, 7260) + // Standard Error: 1_105 + .saturating_add(Weight::from_parts(82_651, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -889,9 +906,9 @@ impl WeightInfo for () { fn set_external_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `356` - // Estimated: `5173` - // Minimum execution time: 19_076_000 picoseconds. - Weight::from_parts(19_650_000, 5173) + // Estimated: `3556` + // Minimum execution time: 19_234_000 picoseconds. + Weight::from_parts(19_755_000, 3556) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -902,9 +919,9 @@ impl WeightInfo for () { fn clear_external_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `286` - // Estimated: `5135` - // Minimum execution time: 17_588_000 picoseconds. - Weight::from_parts(17_781_000, 5135) + // Estimated: `3518` + // Minimum execution time: 17_621_000 picoseconds. + Weight::from_parts(17_861_000, 3518) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -917,9 +934,9 @@ impl WeightInfo for () { fn set_proposal_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `4888` - // Estimated: `21743` - // Minimum execution time: 34_828_000 picoseconds. - Weight::from_parts(35_364_000, 21743) + // Estimated: `18187` + // Minimum execution time: 35_785_000 picoseconds. + Weight::from_parts(36_102_000, 18187) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -930,9 +947,9 @@ impl WeightInfo for () { fn clear_proposal_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `4822` - // Estimated: `21705` - // Minimum execution time: 32_035_000 picoseconds. - Weight::from_parts(32_554_000, 21705) + // Estimated: `18187` + // Minimum execution time: 33_493_000 picoseconds. + Weight::from_parts(33_747_000, 18187) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -944,8 +961,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 15_279_000 picoseconds. - Weight::from_parts(15_556_000, 3556) + // Minimum execution time: 15_557_000 picoseconds. + Weight::from_parts(15_844_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -956,9 +973,9 @@ impl WeightInfo for () { fn clear_referendum_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `302` - // Estimated: `7184` - // Minimum execution time: 19_622_000 picoseconds. - Weight::from_parts(19_978_000, 7184) + // Estimated: `3666` + // Minimum execution time: 19_940_000 picoseconds. + Weight::from_parts(20_301_000, 3666) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/election-provider-multi-phase/src/weights.rs b/frame/election-provider-multi-phase/src/weights.rs index f9dfdfc19aa3d..a1ba3514ca469 100644 --- a/frame/election-provider-multi-phase/src/weights.rs +++ b/frame/election-provider-multi-phase/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_election_provider_multi_phase //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_election_provider_multi_phase -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -85,9 +82,9 @@ impl WeightInfo for SubstrateWeight { fn on_initialize_nothing() -> Weight { // Proof Size summary in bytes: // Measured: `994` - // Estimated: `14903` - // Minimum execution time: 21_538_000 picoseconds. - Weight::from_parts(22_045_000, 14903) + // Estimated: `3481` + // Minimum execution time: 21_239_000 picoseconds. + Weight::from_parts(21_970_000, 3481) .saturating_add(T::DbWeight::get().reads(8_u64)) } /// Storage: ElectionProviderMultiPhase Round (r:1 w:0) @@ -97,9 +94,9 @@ impl WeightInfo for SubstrateWeight { fn on_initialize_open_signed() -> Weight { // Proof Size summary in bytes: // Measured: `114` - // Estimated: `3198` - // Minimum execution time: 12_696_000 picoseconds. - Weight::from_parts(12_950_000, 3198) + // Estimated: `1599` + // Minimum execution time: 13_913_000 picoseconds. + Weight::from_parts(14_329_000, 1599) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -110,9 +107,9 @@ impl WeightInfo for SubstrateWeight { fn on_initialize_open_unsigned() -> Weight { // Proof Size summary in bytes: // Measured: `114` - // Estimated: `3198` - // Minimum execution time: 14_029_000 picoseconds. - Weight::from_parts(14_288_000, 3198) + // Estimated: `1599` + // Minimum execution time: 15_377_000 picoseconds. + Weight::from_parts(15_714_000, 1599) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -123,9 +120,9 @@ impl WeightInfo for SubstrateWeight { fn finalize_signed_phase_accept_solution() -> Weight { // Proof Size summary in bytes: // Measured: `174` - // Estimated: `3767` - // Minimum execution time: 26_468_000 picoseconds. - Weight::from_parts(26_790_000, 3767) + // Estimated: `3593` + // Minimum execution time: 32_899_000 picoseconds. + Weight::from_parts(33_455_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -135,8 +132,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 18_401_000 picoseconds. - Weight::from_parts(18_686_000, 3593) + // Minimum execution time: 22_532_000 picoseconds. + Weight::from_parts(23_039_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -152,10 +149,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 266_901_000 picoseconds. - Weight::from_parts(270_251_000, 0) - // Standard Error: 1_758 - .saturating_add(Weight::from_parts(167_310, 0).saturating_mul(v.into())) + // Minimum execution time: 253_511_000 picoseconds. + Weight::from_parts(261_190_000, 0) + // Standard Error: 1_621 + .saturating_add(Weight::from_parts(157_608, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: ElectionProviderMultiPhase SignedSubmissionIndices (r:1 w:1) @@ -181,17 +178,17 @@ impl WeightInfo for SubstrateWeight { fn elect_queued(a: u32, d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `337 + a * (768 ±0) + d * (48 ±0)` - // Estimated: `16191 + a * (6912 ±0) + d * (441 ±0)` - // Minimum execution time: 286_523_000 picoseconds. - Weight::from_parts(19_101_753, 16191) - // Standard Error: 4_194 - .saturating_add(Weight::from_parts(398_102, 0).saturating_mul(a.into())) - // Standard Error: 6_287 - .saturating_add(Weight::from_parts(188_928, 0).saturating_mul(d.into())) + // Estimated: `3889 + a * (768 ±0) + d * (49 ±0)` + // Minimum execution time: 284_994_000 picoseconds. + Weight::from_parts(97_696_734, 3889) + // Standard Error: 4_172 + .saturating_add(Weight::from_parts(331_569, 0).saturating_mul(a.into())) + // Standard Error: 6_254 + .saturating_add(Weight::from_parts(92_198, 0).saturating_mul(d.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) - .saturating_add(Weight::from_parts(0, 6912).saturating_mul(a.into())) - .saturating_add(Weight::from_parts(0, 441).saturating_mul(d.into())) + .saturating_add(Weight::from_parts(0, 768).saturating_mul(a.into())) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(d.into())) } /// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0) /// Proof Skipped: ElectionProviderMultiPhase CurrentPhase (max_values: Some(1), max_size: None, mode: Measured) @@ -208,9 +205,9 @@ impl WeightInfo for SubstrateWeight { fn submit() -> Weight { // Proof Size summary in bytes: // Measured: `893` - // Estimated: `11906` - // Minimum execution time: 47_876_000 picoseconds. - Weight::from_parts(48_464_000, 11906) + // Estimated: `2378` + // Minimum execution time: 52_194_000 picoseconds. + Weight::from_parts(53_062_000, 2378) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -234,18 +231,18 @@ impl WeightInfo for SubstrateWeight { /// The range of component `d` is `[200, 400]`. fn submit_unsigned(v: u32, t: u32, a: u32, _d: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `219 + v * (553 ±0) + t * (32 ±0)` - // Estimated: `11928 + v * (3871 ±0) + t * (224 ±0)` - // Minimum execution time: 4_702_825_000 picoseconds. - Weight::from_parts(4_752_015_000, 11928) - // Standard Error: 14_906 - .saturating_add(Weight::from_parts(131_585, 0).saturating_mul(v.into())) - // Standard Error: 44_174 - .saturating_add(Weight::from_parts(4_167_676, 0).saturating_mul(a.into())) + // Measured: `219 + t * (32 ±0) + v * (553 ±0)` + // Estimated: `1704 + t * (32 ±0) + v * (553 ±0)` + // Minimum execution time: 4_843_067_000 picoseconds. + Weight::from_parts(4_860_833_000, 1704) + // Standard Error: 14_594 + .saturating_add(Weight::from_parts(76_611, 0).saturating_mul(v.into())) + // Standard Error: 43_249 + .saturating_add(Weight::from_parts(4_347_887, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 3871).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 224).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 553).saturating_mul(v.into())) } /// Storage: ElectionProviderMultiPhase DesiredTargets (r:1 w:0) /// Proof Skipped: ElectionProviderMultiPhase DesiredTargets (max_values: Some(1), max_size: None, mode: Measured) @@ -261,17 +258,17 @@ impl WeightInfo for SubstrateWeight { /// The range of component `d` is `[200, 400]`. fn feasibility_check(v: u32, t: u32, a: u32, _d: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `194 + v * (553 ±0) + t * (32 ±0)` - // Estimated: `6716 + v * (2212 ±0) + t * (128 ±0)` - // Minimum execution time: 4_069_075_000 picoseconds. - Weight::from_parts(4_105_635_000, 6716) - // Standard Error: 12_539 - .saturating_add(Weight::from_parts(163_040, 0).saturating_mul(v.into())) - // Standard Error: 37_160 - .saturating_add(Weight::from_parts(3_343_858, 0).saturating_mul(a.into())) + // Measured: `194 + t * (32 ±0) + v * (553 ±0)` + // Estimated: `1679 + t * (32 ±0) + v * (553 ±0)` + // Minimum execution time: 4_190_524_000 picoseconds. + Weight::from_parts(4_200_207_000, 1679) + // Standard Error: 12_454 + .saturating_add(Weight::from_parts(166_342, 0).saturating_mul(v.into())) + // Standard Error: 36_906 + .saturating_add(Weight::from_parts(3_493_372, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(Weight::from_parts(0, 2212).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 128).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 553).saturating_mul(v.into())) } } @@ -296,9 +293,9 @@ impl WeightInfo for () { fn on_initialize_nothing() -> Weight { // Proof Size summary in bytes: // Measured: `994` - // Estimated: `14903` - // Minimum execution time: 21_538_000 picoseconds. - Weight::from_parts(22_045_000, 14903) + // Estimated: `3481` + // Minimum execution time: 21_239_000 picoseconds. + Weight::from_parts(21_970_000, 3481) .saturating_add(RocksDbWeight::get().reads(8_u64)) } /// Storage: ElectionProviderMultiPhase Round (r:1 w:0) @@ -308,9 +305,9 @@ impl WeightInfo for () { fn on_initialize_open_signed() -> Weight { // Proof Size summary in bytes: // Measured: `114` - // Estimated: `3198` - // Minimum execution time: 12_696_000 picoseconds. - Weight::from_parts(12_950_000, 3198) + // Estimated: `1599` + // Minimum execution time: 13_913_000 picoseconds. + Weight::from_parts(14_329_000, 1599) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -321,9 +318,9 @@ impl WeightInfo for () { fn on_initialize_open_unsigned() -> Weight { // Proof Size summary in bytes: // Measured: `114` - // Estimated: `3198` - // Minimum execution time: 14_029_000 picoseconds. - Weight::from_parts(14_288_000, 3198) + // Estimated: `1599` + // Minimum execution time: 15_377_000 picoseconds. + Weight::from_parts(15_714_000, 1599) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -334,9 +331,9 @@ impl WeightInfo for () { fn finalize_signed_phase_accept_solution() -> Weight { // Proof Size summary in bytes: // Measured: `174` - // Estimated: `3767` - // Minimum execution time: 26_468_000 picoseconds. - Weight::from_parts(26_790_000, 3767) + // Estimated: `3593` + // Minimum execution time: 32_899_000 picoseconds. + Weight::from_parts(33_455_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -346,8 +343,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 18_401_000 picoseconds. - Weight::from_parts(18_686_000, 3593) + // Minimum execution time: 22_532_000 picoseconds. + Weight::from_parts(23_039_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -363,10 +360,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 266_901_000 picoseconds. - Weight::from_parts(270_251_000, 0) - // Standard Error: 1_758 - .saturating_add(Weight::from_parts(167_310, 0).saturating_mul(v.into())) + // Minimum execution time: 253_511_000 picoseconds. + Weight::from_parts(261_190_000, 0) + // Standard Error: 1_621 + .saturating_add(Weight::from_parts(157_608, 0).saturating_mul(v.into())) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: ElectionProviderMultiPhase SignedSubmissionIndices (r:1 w:1) @@ -392,17 +389,17 @@ impl WeightInfo for () { fn elect_queued(a: u32, d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `337 + a * (768 ±0) + d * (48 ±0)` - // Estimated: `16191 + a * (6912 ±0) + d * (441 ±0)` - // Minimum execution time: 286_523_000 picoseconds. - Weight::from_parts(19_101_753, 16191) - // Standard Error: 4_194 - .saturating_add(Weight::from_parts(398_102, 0).saturating_mul(a.into())) - // Standard Error: 6_287 - .saturating_add(Weight::from_parts(188_928, 0).saturating_mul(d.into())) + // Estimated: `3889 + a * (768 ±0) + d * (49 ±0)` + // Minimum execution time: 284_994_000 picoseconds. + Weight::from_parts(97_696_734, 3889) + // Standard Error: 4_172 + .saturating_add(Weight::from_parts(331_569, 0).saturating_mul(a.into())) + // Standard Error: 6_254 + .saturating_add(Weight::from_parts(92_198, 0).saturating_mul(d.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) - .saturating_add(Weight::from_parts(0, 6912).saturating_mul(a.into())) - .saturating_add(Weight::from_parts(0, 441).saturating_mul(d.into())) + .saturating_add(Weight::from_parts(0, 768).saturating_mul(a.into())) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(d.into())) } /// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0) /// Proof Skipped: ElectionProviderMultiPhase CurrentPhase (max_values: Some(1), max_size: None, mode: Measured) @@ -419,9 +416,9 @@ impl WeightInfo for () { fn submit() -> Weight { // Proof Size summary in bytes: // Measured: `893` - // Estimated: `11906` - // Minimum execution time: 47_876_000 picoseconds. - Weight::from_parts(48_464_000, 11906) + // Estimated: `2378` + // Minimum execution time: 52_194_000 picoseconds. + Weight::from_parts(53_062_000, 2378) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -445,18 +442,18 @@ impl WeightInfo for () { /// The range of component `d` is `[200, 400]`. fn submit_unsigned(v: u32, t: u32, a: u32, _d: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `219 + v * (553 ±0) + t * (32 ±0)` - // Estimated: `11928 + v * (3871 ±0) + t * (224 ±0)` - // Minimum execution time: 4_702_825_000 picoseconds. - Weight::from_parts(4_752_015_000, 11928) - // Standard Error: 14_906 - .saturating_add(Weight::from_parts(131_585, 0).saturating_mul(v.into())) - // Standard Error: 44_174 - .saturating_add(Weight::from_parts(4_167_676, 0).saturating_mul(a.into())) + // Measured: `219 + t * (32 ±0) + v * (553 ±0)` + // Estimated: `1704 + t * (32 ±0) + v * (553 ±0)` + // Minimum execution time: 4_843_067_000 picoseconds. + Weight::from_parts(4_860_833_000, 1704) + // Standard Error: 14_594 + .saturating_add(Weight::from_parts(76_611, 0).saturating_mul(v.into())) + // Standard Error: 43_249 + .saturating_add(Weight::from_parts(4_347_887, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 3871).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 224).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 553).saturating_mul(v.into())) } /// Storage: ElectionProviderMultiPhase DesiredTargets (r:1 w:0) /// Proof Skipped: ElectionProviderMultiPhase DesiredTargets (max_values: Some(1), max_size: None, mode: Measured) @@ -472,16 +469,16 @@ impl WeightInfo for () { /// The range of component `d` is `[200, 400]`. fn feasibility_check(v: u32, t: u32, a: u32, _d: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `194 + v * (553 ±0) + t * (32 ±0)` - // Estimated: `6716 + v * (2212 ±0) + t * (128 ±0)` - // Minimum execution time: 4_069_075_000 picoseconds. - Weight::from_parts(4_105_635_000, 6716) - // Standard Error: 12_539 - .saturating_add(Weight::from_parts(163_040, 0).saturating_mul(v.into())) - // Standard Error: 37_160 - .saturating_add(Weight::from_parts(3_343_858, 0).saturating_mul(a.into())) + // Measured: `194 + t * (32 ±0) + v * (553 ±0)` + // Estimated: `1679 + t * (32 ±0) + v * (553 ±0)` + // Minimum execution time: 4_190_524_000 picoseconds. + Weight::from_parts(4_200_207_000, 1679) + // Standard Error: 12_454 + .saturating_add(Weight::from_parts(166_342, 0).saturating_mul(v.into())) + // Standard Error: 36_906 + .saturating_add(Weight::from_parts(3_493_372, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(Weight::from_parts(0, 2212).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 128).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 553).saturating_mul(v.into())) } } diff --git a/frame/elections-phragmen/src/weights.rs b/frame/elections-phragmen/src/weights.rs index 0ff6ecf290036..f0ebb8639e259 100644 --- a/frame/elections-phragmen/src/weights.rs +++ b/frame/elections-phragmen/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_elections_phragmen //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_elections_phragmen -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -78,18 +75,20 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: Elections Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[1, 16]`. fn vote_equal(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `403 + v * (80 ±0)` - // Estimated: `14292 + v * (320 ±0)` - // Minimum execution time: 30_206_000 picoseconds. - Weight::from_parts(30_696_455, 14292) - // Standard Error: 1_864 - .saturating_add(Weight::from_parts(124_941, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) + // Estimated: `4764 + v * (80 ±0)` + // Minimum execution time: 33_623_000 picoseconds. + Weight::from_parts(34_531_239, 4764) + // Standard Error: 1_913 + .saturating_add(Weight::from_parts(131_360, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) } /// Storage: Elections Candidates (r:1 w:0) /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) @@ -101,18 +100,20 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: Elections Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[2, 16]`. fn vote_more(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `371 + v * (80 ±0)` - // Estimated: `14164 + v * (320 ±0)` - // Minimum execution time: 40_331_000 picoseconds. - Weight::from_parts(40_936_971, 14164) - // Standard Error: 2_377 - .saturating_add(Weight::from_parts(142_332, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) + // Estimated: `4764 + v * (80 ±0)` + // Minimum execution time: 46_106_000 picoseconds. + Weight::from_parts(47_067_453, 4764) + // Standard Error: 2_441 + .saturating_add(Weight::from_parts(130_306, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) } /// Storage: Elections Candidates (r:1 w:0) /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) @@ -124,30 +125,34 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: Elections Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[2, 16]`. fn vote_less(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `403 + v * (80 ±0)` - // Estimated: `14292 + v * (320 ±0)` - // Minimum execution time: 40_343_000 picoseconds. - Weight::from_parts(41_055_673, 14292) - // Standard Error: 3_150 - .saturating_add(Weight::from_parts(129_894, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) + // Estimated: `4764 + v * (80 ±0)` + // Minimum execution time: 46_094_000 picoseconds. + Weight::from_parts(47_054_638, 4764) + // Standard Error: 2_651 + .saturating_add(Weight::from_parts(137_251, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) } /// Storage: Elections Voting (r:1 w:1) /// Proof Skipped: Elections Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn remove_voter() -> Weight { // Proof Size summary in bytes: // Measured: `925` - // Estimated: `9154` - // Minimum execution time: 36_348_000 picoseconds. - Weight::from_parts(36_677_000, 9154) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Estimated: `4764` + // Minimum execution time: 49_652_000 picoseconds. + Weight::from_parts(50_217_000, 4764) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Elections Candidates (r:1 w:1) @@ -160,14 +165,14 @@ impl WeightInfo for SubstrateWeight { fn submit_candidacy(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1570 + c * (48 ±0)` - // Estimated: `9165 + c * (144 ±0)` - // Minimum execution time: 32_963_000 picoseconds. - Weight::from_parts(33_778_406, 9165) - // Standard Error: 2_792 - .saturating_add(Weight::from_parts(71_214, 0).saturating_mul(c.into())) + // Estimated: `3055 + c * (48 ±0)` + // Minimum execution time: 37_797_000 picoseconds. + Weight::from_parts(38_384_713, 3055) + // Standard Error: 1_008 + .saturating_add(Weight::from_parts(71_486, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 144).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) } /// Storage: Elections Candidates (r:1 w:1) /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) @@ -176,10 +181,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `285 + c * (48 ±0)` // Estimated: `1770 + c * (48 ±0)` - // Minimum execution time: 26_462_000 picoseconds. - Weight::from_parts(27_289_268, 1770) - // Standard Error: 915 - .saturating_add(Weight::from_parts(45_079, 0).saturating_mul(c.into())) + // Minimum execution time: 31_112_000 picoseconds. + Weight::from_parts(31_660_924, 1770) + // Standard Error: 754 + .saturating_add(Weight::from_parts(48_689, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) @@ -197,9 +202,9 @@ impl WeightInfo for SubstrateWeight { fn renounce_candidacy_members() -> Weight { // Proof Size summary in bytes: // Measured: `1900` - // Estimated: `15440` - // Minimum execution time: 44_414_000 picoseconds. - Weight::from_parts(44_900_000, 15440) + // Estimated: `3385` + // Minimum execution time: 47_487_000 picoseconds. + Weight::from_parts(47_795_000, 3385) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -209,8 +214,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `880` // Estimated: `2365` - // Minimum execution time: 28_688_000 picoseconds. - Weight::from_parts(29_027_000, 2365) + // Minimum execution time: 31_479_000 picoseconds. + Weight::from_parts(32_093_000, 2365) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -238,9 +243,9 @@ impl WeightInfo for SubstrateWeight { fn remove_member_with_replacement() -> Weight { // Proof Size summary in bytes: // Measured: `1900` - // Estimated: `19033` - // Minimum execution time: 50_280_000 picoseconds. - Weight::from_parts(50_906_000, 19033) + // Estimated: `3593` + // Minimum execution time: 53_395_000 picoseconds. + Weight::from_parts(53_952_000, 3593) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -254,6 +259,8 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Balances Locks (r:512 w:512) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:512 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:512 w:512) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `v` is `[256, 512]`. @@ -261,15 +268,15 @@ impl WeightInfo for SubstrateWeight { fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1115 + v * (811 ±0)` - // Estimated: `14388 + v * (12096 ±0)` - // Minimum execution time: 14_785_043_000 picoseconds. - Weight::from_parts(14_842_583_000, 14388) - // Standard Error: 242_757 - .saturating_add(Weight::from_parts(36_168_971, 0).saturating_mul(v.into())) + // Estimated: `4587 + v * (3774 ±0)` + // Minimum execution time: 18_089_406_000 picoseconds. + Weight::from_parts(18_125_024_000, 4587) + // Standard Error: 296_666 + .saturating_add(Weight::from_parts(42_527_045, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(v.into()))) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) - .saturating_add(Weight::from_parts(0, 12096).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(v.into())) } /// Storage: Elections Candidates (r:1 w:1) /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) @@ -294,22 +301,22 @@ impl WeightInfo for SubstrateWeight { /// The range of component `e` is `[512, 8192]`. fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + v * (606 ±0) + e * (28 ±0)` - // Estimated: `309059 + v * (5005 ±8) + e * (89 ±0) + c * (2135 ±7)` - // Minimum execution time: 1_074_961_000 picoseconds. - Weight::from_parts(1_079_460_000, 309059) - // Standard Error: 598_993 - .saturating_add(Weight::from_parts(17_097_981, 0).saturating_mul(v.into())) - // Standard Error: 38_432 - .saturating_add(Weight::from_parts(820_141, 0).saturating_mul(e.into())) + // Measured: `0 + e * (28 ±0) + v * (606 ±0)` + // Estimated: `178887 + c * (2135 ±7) + e * (12 ±0) + v * (2653 ±6)` + // Minimum execution time: 1_193_774_000 picoseconds. + Weight::from_parts(1_196_649_000, 178887) + // Standard Error: 617_531 + .saturating_add(Weight::from_parts(17_672_923, 0).saturating_mul(v.into())) + // Standard Error: 39_622 + .saturating_add(Weight::from_parts(846_866, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(21_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) .saturating_add(T::DbWeight::get().writes(6_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 5005).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 89).saturating_mul(e.into())) .saturating_add(Weight::from_parts(0, 2135).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 12).saturating_mul(e.into())) + .saturating_add(Weight::from_parts(0, 2653).saturating_mul(v.into())) } } @@ -325,18 +332,20 @@ impl WeightInfo for () { /// Proof Skipped: Elections Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[1, 16]`. fn vote_equal(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `403 + v * (80 ±0)` - // Estimated: `14292 + v * (320 ±0)` - // Minimum execution time: 30_206_000 picoseconds. - Weight::from_parts(30_696_455, 14292) - // Standard Error: 1_864 - .saturating_add(Weight::from_parts(124_941, 0).saturating_mul(v.into())) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Estimated: `4764 + v * (80 ±0)` + // Minimum execution time: 33_623_000 picoseconds. + Weight::from_parts(34_531_239, 4764) + // Standard Error: 1_913 + .saturating_add(Weight::from_parts(131_360, 0).saturating_mul(v.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) } /// Storage: Elections Candidates (r:1 w:0) /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) @@ -348,18 +357,20 @@ impl WeightInfo for () { /// Proof Skipped: Elections Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[2, 16]`. fn vote_more(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `371 + v * (80 ±0)` - // Estimated: `14164 + v * (320 ±0)` - // Minimum execution time: 40_331_000 picoseconds. - Weight::from_parts(40_936_971, 14164) - // Standard Error: 2_377 - .saturating_add(Weight::from_parts(142_332, 0).saturating_mul(v.into())) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Estimated: `4764 + v * (80 ±0)` + // Minimum execution time: 46_106_000 picoseconds. + Weight::from_parts(47_067_453, 4764) + // Standard Error: 2_441 + .saturating_add(Weight::from_parts(130_306, 0).saturating_mul(v.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) } /// Storage: Elections Candidates (r:1 w:0) /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) @@ -371,30 +382,34 @@ impl WeightInfo for () { /// Proof Skipped: Elections Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[2, 16]`. fn vote_less(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `403 + v * (80 ±0)` - // Estimated: `14292 + v * (320 ±0)` - // Minimum execution time: 40_343_000 picoseconds. - Weight::from_parts(41_055_673, 14292) - // Standard Error: 3_150 - .saturating_add(Weight::from_parts(129_894, 0).saturating_mul(v.into())) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Estimated: `4764 + v * (80 ±0)` + // Minimum execution time: 46_094_000 picoseconds. + Weight::from_parts(47_054_638, 4764) + // Standard Error: 2_651 + .saturating_add(Weight::from_parts(137_251, 0).saturating_mul(v.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) } /// Storage: Elections Voting (r:1 w:1) /// Proof Skipped: Elections Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn remove_voter() -> Weight { // Proof Size summary in bytes: // Measured: `925` - // Estimated: `9154` - // Minimum execution time: 36_348_000 picoseconds. - Weight::from_parts(36_677_000, 9154) - .saturating_add(RocksDbWeight::get().reads(2_u64)) + // Estimated: `4764` + // Minimum execution time: 49_652_000 picoseconds. + Weight::from_parts(50_217_000, 4764) + .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: Elections Candidates (r:1 w:1) @@ -407,14 +422,14 @@ impl WeightInfo for () { fn submit_candidacy(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1570 + c * (48 ±0)` - // Estimated: `9165 + c * (144 ±0)` - // Minimum execution time: 32_963_000 picoseconds. - Weight::from_parts(33_778_406, 9165) - // Standard Error: 2_792 - .saturating_add(Weight::from_parts(71_214, 0).saturating_mul(c.into())) + // Estimated: `3055 + c * (48 ±0)` + // Minimum execution time: 37_797_000 picoseconds. + Weight::from_parts(38_384_713, 3055) + // Standard Error: 1_008 + .saturating_add(Weight::from_parts(71_486, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 144).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) } /// Storage: Elections Candidates (r:1 w:1) /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) @@ -423,10 +438,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `285 + c * (48 ±0)` // Estimated: `1770 + c * (48 ±0)` - // Minimum execution time: 26_462_000 picoseconds. - Weight::from_parts(27_289_268, 1770) - // Standard Error: 915 - .saturating_add(Weight::from_parts(45_079, 0).saturating_mul(c.into())) + // Minimum execution time: 31_112_000 picoseconds. + Weight::from_parts(31_660_924, 1770) + // Standard Error: 754 + .saturating_add(Weight::from_parts(48_689, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) @@ -444,9 +459,9 @@ impl WeightInfo for () { fn renounce_candidacy_members() -> Weight { // Proof Size summary in bytes: // Measured: `1900` - // Estimated: `15440` - // Minimum execution time: 44_414_000 picoseconds. - Weight::from_parts(44_900_000, 15440) + // Estimated: `3385` + // Minimum execution time: 47_487_000 picoseconds. + Weight::from_parts(47_795_000, 3385) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -456,8 +471,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `880` // Estimated: `2365` - // Minimum execution time: 28_688_000 picoseconds. - Weight::from_parts(29_027_000, 2365) + // Minimum execution time: 31_479_000 picoseconds. + Weight::from_parts(32_093_000, 2365) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -485,9 +500,9 @@ impl WeightInfo for () { fn remove_member_with_replacement() -> Weight { // Proof Size summary in bytes: // Measured: `1900` - // Estimated: `19033` - // Minimum execution time: 50_280_000 picoseconds. - Weight::from_parts(50_906_000, 19033) + // Estimated: `3593` + // Minimum execution time: 53_395_000 picoseconds. + Weight::from_parts(53_952_000, 3593) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -501,6 +516,8 @@ impl WeightInfo for () { /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Balances Locks (r:512 w:512) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:512 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:512 w:512) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `v` is `[256, 512]`. @@ -508,15 +525,15 @@ impl WeightInfo for () { fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1115 + v * (811 ±0)` - // Estimated: `14388 + v * (12096 ±0)` - // Minimum execution time: 14_785_043_000 picoseconds. - Weight::from_parts(14_842_583_000, 14388) - // Standard Error: 242_757 - .saturating_add(Weight::from_parts(36_168_971, 0).saturating_mul(v.into())) + // Estimated: `4587 + v * (3774 ±0)` + // Minimum execution time: 18_089_406_000 picoseconds. + Weight::from_parts(18_125_024_000, 4587) + // Standard Error: 296_666 + .saturating_add(Weight::from_parts(42_527_045, 0).saturating_mul(v.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(v.into()))) .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(v.into()))) - .saturating_add(Weight::from_parts(0, 12096).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(v.into())) } /// Storage: Elections Candidates (r:1 w:1) /// Proof Skipped: Elections Candidates (max_values: Some(1), max_size: None, mode: Measured) @@ -541,21 +558,21 @@ impl WeightInfo for () { /// The range of component `e` is `[512, 8192]`. fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + v * (606 ±0) + e * (28 ±0)` - // Estimated: `309059 + v * (5005 ±8) + e * (89 ±0) + c * (2135 ±7)` - // Minimum execution time: 1_074_961_000 picoseconds. - Weight::from_parts(1_079_460_000, 309059) - // Standard Error: 598_993 - .saturating_add(Weight::from_parts(17_097_981, 0).saturating_mul(v.into())) - // Standard Error: 38_432 - .saturating_add(Weight::from_parts(820_141, 0).saturating_mul(e.into())) + // Measured: `0 + e * (28 ±0) + v * (606 ±0)` + // Estimated: `178887 + c * (2135 ±7) + e * (12 ±0) + v * (2653 ±6)` + // Minimum execution time: 1_193_774_000 picoseconds. + Weight::from_parts(1_196_649_000, 178887) + // Standard Error: 617_531 + .saturating_add(Weight::from_parts(17_672_923, 0).saturating_mul(v.into())) + // Standard Error: 39_622 + .saturating_add(Weight::from_parts(846_866, 0).saturating_mul(e.into())) .saturating_add(RocksDbWeight::get().reads(21_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(v.into()))) .saturating_add(RocksDbWeight::get().writes(6_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 5005).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 89).saturating_mul(e.into())) .saturating_add(Weight::from_parts(0, 2135).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 12).saturating_mul(e.into())) + .saturating_add(Weight::from_parts(0, 2653).saturating_mul(v.into())) } } diff --git a/frame/fast-unstake/src/weights.rs b/frame/fast-unstake/src/weights.rs index b47d4f056e524..27414a8a8cc0d 100644 --- a/frame/fast-unstake/src/weights.rs +++ b/frame/fast-unstake/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_fast_unstake //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_fast_unstake -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -85,6 +82,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:64 w:64) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:64 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Ledger (r:0 w:64) /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:64) @@ -93,16 +92,16 @@ impl WeightInfo for SubstrateWeight { fn on_idle_unstake(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1344 + b * (343 ±0)` - // Estimated: `23254 + b * (17642 ±0)` - // Minimum execution time: 78_484_000 picoseconds. - Weight::from_parts(39_186_541, 23254) - // Standard Error: 37_606 - .saturating_add(Weight::from_parts(42_433_199, 0).saturating_mul(b.into())) + // Estimated: `7253 + b * (3774 ±0)` + // Minimum execution time: 92_282_000 picoseconds. + Weight::from_parts(31_665_344, 7253) + // Standard Error: 35_348 + .saturating_add(Weight::from_parts(57_005_152, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) - .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(b.into()))) - .saturating_add(Weight::from_parts(0, 17642).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(b.into())) } /// Storage: FastUnstake ErasToCheckPerBlock (r:1 w:0) /// Proof: FastUnstake ErasToCheckPerBlock (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -122,19 +121,19 @@ impl WeightInfo for SubstrateWeight { /// The range of component `b` is `[1, 64]`. fn on_idle_check(v: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1512 + v * (10037 ±0) + b * (48 ±0)` - // Estimated: `20889 + v * (22551 ±0) + b * (98 ±0)` - // Minimum execution time: 1_538_727_000 picoseconds. - Weight::from_parts(1_549_586_000, 20889) - // Standard Error: 14_184_223 - .saturating_add(Weight::from_parts(452_966_006, 0).saturating_mul(v.into())) - // Standard Error: 56_752_692 - .saturating_add(Weight::from_parts(1_775_601_329, 0).saturating_mul(b.into())) + // Measured: `1512 + b * (48 ±0) + v * (10037 ±0)` + // Estimated: `7253 + b * (49 ±0) + v * (12513 ±0)` + // Minimum execution time: 1_547_716_000 picoseconds. + Weight::from_parts(1_552_476_000, 7253) + // Standard Error: 13_914_457 + .saturating_add(Weight::from_parts(445_314_876, 0).saturating_mul(v.into())) + // Standard Error: 55_673_329 + .saturating_add(Weight::from_parts(1_749_024_692, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 22551).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 98).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 12513).saturating_mul(v.into())) } /// Storage: FastUnstake ErasToCheckPerBlock (r:1 w:0) /// Proof: FastUnstake ErasToCheckPerBlock (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -162,15 +161,17 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: FastUnstake CounterForQueue (r:1 w:1) /// Proof: FastUnstake CounterForQueue (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn register_fast_unstake() -> Weight { // Proof Size summary in bytes: // Measured: `1964` - // Estimated: `45775` - // Minimum execution time: 117_552_000 picoseconds. - Weight::from_parts(118_303_000, 45775) - .saturating_add(T::DbWeight::get().reads(14_u64)) + // Estimated: `7253` + // Minimum execution time: 124_644_000 picoseconds. + Weight::from_parts(125_793_000, 7253) + .saturating_add(T::DbWeight::get().reads(15_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } /// Storage: FastUnstake ErasToCheckPerBlock (r:1 w:0) @@ -186,9 +187,9 @@ impl WeightInfo for SubstrateWeight { fn deregister() -> Weight { // Proof Size summary in bytes: // Measured: `1223` - // Estimated: `18308` - // Minimum execution time: 42_291_000 picoseconds. - Weight::from_parts(42_835_000, 18308) + // Estimated: `7253` + // Minimum execution time: 45_037_000 picoseconds. + Weight::from_parts(45_545_000, 7253) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -198,8 +199,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_551_000 picoseconds. - Weight::from_parts(3_632_000, 0) + // Minimum execution time: 3_228_000 picoseconds. + Weight::from_parts(3_428_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -230,6 +231,8 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:64 w:64) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:64 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Ledger (r:0 w:64) /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:64) @@ -238,16 +241,16 @@ impl WeightInfo for () { fn on_idle_unstake(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1344 + b * (343 ±0)` - // Estimated: `23254 + b * (17642 ±0)` - // Minimum execution time: 78_484_000 picoseconds. - Weight::from_parts(39_186_541, 23254) - // Standard Error: 37_606 - .saturating_add(Weight::from_parts(42_433_199, 0).saturating_mul(b.into())) + // Estimated: `7253 + b * (3774 ±0)` + // Minimum execution time: 92_282_000 picoseconds. + Weight::from_parts(31_665_344, 7253) + // Standard Error: 35_348 + .saturating_add(Weight::from_parts(57_005_152, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().reads((6_u64).saturating_mul(b.into()))) + .saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(b.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(RocksDbWeight::get().writes((5_u64).saturating_mul(b.into()))) - .saturating_add(Weight::from_parts(0, 17642).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(b.into())) } /// Storage: FastUnstake ErasToCheckPerBlock (r:1 w:0) /// Proof: FastUnstake ErasToCheckPerBlock (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -267,19 +270,19 @@ impl WeightInfo for () { /// The range of component `b` is `[1, 64]`. fn on_idle_check(v: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1512 + v * (10037 ±0) + b * (48 ±0)` - // Estimated: `20889 + v * (22551 ±0) + b * (98 ±0)` - // Minimum execution time: 1_538_727_000 picoseconds. - Weight::from_parts(1_549_586_000, 20889) - // Standard Error: 14_184_223 - .saturating_add(Weight::from_parts(452_966_006, 0).saturating_mul(v.into())) - // Standard Error: 56_752_692 - .saturating_add(Weight::from_parts(1_775_601_329, 0).saturating_mul(b.into())) + // Measured: `1512 + b * (48 ±0) + v * (10037 ±0)` + // Estimated: `7253 + b * (49 ±0) + v * (12513 ±0)` + // Minimum execution time: 1_547_716_000 picoseconds. + Weight::from_parts(1_552_476_000, 7253) + // Standard Error: 13_914_457 + .saturating_add(Weight::from_parts(445_314_876, 0).saturating_mul(v.into())) + // Standard Error: 55_673_329 + .saturating_add(Weight::from_parts(1_749_024_692, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(v.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 22551).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 98).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 12513).saturating_mul(v.into())) } /// Storage: FastUnstake ErasToCheckPerBlock (r:1 w:0) /// Proof: FastUnstake ErasToCheckPerBlock (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -307,15 +310,17 @@ impl WeightInfo for () { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: FastUnstake CounterForQueue (r:1 w:1) /// Proof: FastUnstake CounterForQueue (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn register_fast_unstake() -> Weight { // Proof Size summary in bytes: // Measured: `1964` - // Estimated: `45775` - // Minimum execution time: 117_552_000 picoseconds. - Weight::from_parts(118_303_000, 45775) - .saturating_add(RocksDbWeight::get().reads(14_u64)) + // Estimated: `7253` + // Minimum execution time: 124_644_000 picoseconds. + Weight::from_parts(125_793_000, 7253) + .saturating_add(RocksDbWeight::get().reads(15_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } /// Storage: FastUnstake ErasToCheckPerBlock (r:1 w:0) @@ -331,9 +336,9 @@ impl WeightInfo for () { fn deregister() -> Weight { // Proof Size summary in bytes: // Measured: `1223` - // Estimated: `18308` - // Minimum execution time: 42_291_000 picoseconds. - Weight::from_parts(42_835_000, 18308) + // Estimated: `7253` + // Minimum execution time: 45_037_000 picoseconds. + Weight::from_parts(45_545_000, 7253) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -343,8 +348,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_551_000 picoseconds. - Weight::from_parts(3_632_000, 0) + // Minimum execution time: 3_228_000 picoseconds. + Weight::from_parts(3_428_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/frame/glutton/src/weights.rs b/frame/glutton/src/weights.rs index bd409645ae8ff..82bac91c6d785 100644 --- a/frame/glutton/src/weights.rs +++ b/frame/glutton/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_glutton //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_glutton -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -74,10 +71,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `4` // Estimated: `1489` - // Minimum execution time: 10_384_000 picoseconds. - Weight::from_parts(10_598_000, 1489) - // Standard Error: 1_369 - .saturating_add(Weight::from_parts(1_580_155, 0).saturating_mul(n.into())) + // Minimum execution time: 10_410_000 picoseconds. + Weight::from_parts(10_515_000, 1489) + // Standard Error: 1_069 + .saturating_add(Weight::from_parts(1_513_013, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -91,10 +88,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `65` // Estimated: `1489` - // Minimum execution time: 11_022_000 picoseconds. - Weight::from_parts(11_319_000, 1489) - // Standard Error: 1_108 - .saturating_add(Weight::from_parts(1_048_682, 0).saturating_mul(n.into())) + // Minimum execution time: 11_105_000 picoseconds. + Weight::from_parts(584_850, 1489) + // Standard Error: 1_417 + .saturating_add(Weight::from_parts(1_054_988, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -104,10 +101,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 660_000 picoseconds. - Weight::from_parts(7_814_200, 0) - // Standard Error: 33 - .saturating_add(Weight::from_parts(94_390, 0).saturating_mul(i.into())) + // Minimum execution time: 709_000 picoseconds. + Weight::from_parts(7_409_096, 0) + // Standard Error: 23 + .saturating_add(Weight::from_parts(95_342, 0).saturating_mul(i.into())) } /// Storage: Glutton TrashData (r:5000 w:0) /// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen) @@ -116,10 +113,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `119036 + i * (1022 ±0)` // Estimated: `990 + i * (3016 ±0)` - // Minimum execution time: 712_000 picoseconds. - Weight::from_parts(814_000, 990) - // Standard Error: 1_805 - .saturating_add(Weight::from_parts(5_407_690, 0).saturating_mul(i.into())) + // Minimum execution time: 584_000 picoseconds. + Weight::from_parts(674_000, 990) + // Standard Error: 1_802 + .saturating_add(Weight::from_parts(5_360_522, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(Weight::from_parts(0, 3016).saturating_mul(i.into())) } @@ -132,9 +129,9 @@ impl WeightInfo for SubstrateWeight { fn on_idle_high_proof_waste() -> Weight { // Proof Size summary in bytes: // Measured: `1900466` - // Estimated: `5242760` - // Minimum execution time: 54_903_045_000 picoseconds. - Weight::from_parts(55_194_691_000, 5242760) + // Estimated: `5239782` + // Minimum execution time: 57_124_610_000 picoseconds. + Weight::from_parts(57_256_059_000, 5239782) .saturating_add(T::DbWeight::get().reads(1739_u64)) } /// Storage: Glutton Storage (r:1 w:0) @@ -146,9 +143,9 @@ impl WeightInfo for SubstrateWeight { fn on_idle_low_proof_waste() -> Weight { // Proof Size summary in bytes: // Measured: `9516` - // Estimated: `19048` - // Minimum execution time: 97_295_331_000 picoseconds. - Weight::from_parts(97_853_502_000, 19048) + // Estimated: `16070` + // Minimum execution time: 101_500_066_000 picoseconds. + Weight::from_parts(101_621_640_000, 16070) .saturating_add(T::DbWeight::get().reads(7_u64)) } /// Storage: Glutton Storage (r:1 w:0) @@ -158,9 +155,9 @@ impl WeightInfo for SubstrateWeight { fn empty_on_idle() -> Weight { // Proof Size summary in bytes: // Measured: `4` - // Estimated: `2978` - // Minimum execution time: 4_280_000 picoseconds. - Weight::from_parts(4_381_000, 2978) + // Estimated: `1489` + // Minimum execution time: 4_164_000 picoseconds. + Weight::from_parts(4_378_000, 1489) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: Glutton Compute (r:0 w:1) @@ -169,8 +166,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_758_000 picoseconds. - Weight::from_parts(8_988_000, 0) + // Minimum execution time: 8_795_000 picoseconds. + Weight::from_parts(9_076_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Glutton Storage (r:0 w:1) @@ -179,8 +176,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_901_000 picoseconds. - Weight::from_parts(9_291_000, 0) + // Minimum execution time: 8_979_000 picoseconds. + Weight::from_parts(9_195_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -196,10 +193,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `4` // Estimated: `1489` - // Minimum execution time: 10_384_000 picoseconds. - Weight::from_parts(10_598_000, 1489) - // Standard Error: 1_369 - .saturating_add(Weight::from_parts(1_580_155, 0).saturating_mul(n.into())) + // Minimum execution time: 10_410_000 picoseconds. + Weight::from_parts(10_515_000, 1489) + // Standard Error: 1_069 + .saturating_add(Weight::from_parts(1_513_013, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -213,10 +210,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `65` // Estimated: `1489` - // Minimum execution time: 11_022_000 picoseconds. - Weight::from_parts(11_319_000, 1489) - // Standard Error: 1_108 - .saturating_add(Weight::from_parts(1_048_682, 0).saturating_mul(n.into())) + // Minimum execution time: 11_105_000 picoseconds. + Weight::from_parts(584_850, 1489) + // Standard Error: 1_417 + .saturating_add(Weight::from_parts(1_054_988, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -226,10 +223,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 660_000 picoseconds. - Weight::from_parts(7_814_200, 0) - // Standard Error: 33 - .saturating_add(Weight::from_parts(94_390, 0).saturating_mul(i.into())) + // Minimum execution time: 709_000 picoseconds. + Weight::from_parts(7_409_096, 0) + // Standard Error: 23 + .saturating_add(Weight::from_parts(95_342, 0).saturating_mul(i.into())) } /// Storage: Glutton TrashData (r:5000 w:0) /// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen) @@ -238,10 +235,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `119036 + i * (1022 ±0)` // Estimated: `990 + i * (3016 ±0)` - // Minimum execution time: 712_000 picoseconds. - Weight::from_parts(814_000, 990) - // Standard Error: 1_805 - .saturating_add(Weight::from_parts(5_407_690, 0).saturating_mul(i.into())) + // Minimum execution time: 584_000 picoseconds. + Weight::from_parts(674_000, 990) + // Standard Error: 1_802 + .saturating_add(Weight::from_parts(5_360_522, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(Weight::from_parts(0, 3016).saturating_mul(i.into())) } @@ -254,9 +251,9 @@ impl WeightInfo for () { fn on_idle_high_proof_waste() -> Weight { // Proof Size summary in bytes: // Measured: `1900466` - // Estimated: `5242760` - // Minimum execution time: 54_903_045_000 picoseconds. - Weight::from_parts(55_194_691_000, 5242760) + // Estimated: `5239782` + // Minimum execution time: 57_124_610_000 picoseconds. + Weight::from_parts(57_256_059_000, 5239782) .saturating_add(RocksDbWeight::get().reads(1739_u64)) } /// Storage: Glutton Storage (r:1 w:0) @@ -268,9 +265,9 @@ impl WeightInfo for () { fn on_idle_low_proof_waste() -> Weight { // Proof Size summary in bytes: // Measured: `9516` - // Estimated: `19048` - // Minimum execution time: 97_295_331_000 picoseconds. - Weight::from_parts(97_853_502_000, 19048) + // Estimated: `16070` + // Minimum execution time: 101_500_066_000 picoseconds. + Weight::from_parts(101_621_640_000, 16070) .saturating_add(RocksDbWeight::get().reads(7_u64)) } /// Storage: Glutton Storage (r:1 w:0) @@ -280,9 +277,9 @@ impl WeightInfo for () { fn empty_on_idle() -> Weight { // Proof Size summary in bytes: // Measured: `4` - // Estimated: `2978` - // Minimum execution time: 4_280_000 picoseconds. - Weight::from_parts(4_381_000, 2978) + // Estimated: `1489` + // Minimum execution time: 4_164_000 picoseconds. + Weight::from_parts(4_378_000, 1489) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: Glutton Compute (r:0 w:1) @@ -291,8 +288,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_758_000 picoseconds. - Weight::from_parts(8_988_000, 0) + // Minimum execution time: 8_795_000 picoseconds. + Weight::from_parts(9_076_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Glutton Storage (r:0 w:1) @@ -301,8 +298,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_901_000 picoseconds. - Weight::from_parts(9_291_000, 0) + // Minimum execution time: 8_979_000 picoseconds. + Weight::from_parts(9_195_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/frame/identity/src/weights.rs b/frame/identity/src/weights.rs index bad6aa76854ea..faefd00fb961f 100644 --- a/frame/identity/src/weights.rs +++ b/frame/identity/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_identity //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_identity -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -79,10 +76,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `32 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 13_092_000 picoseconds. - Weight::from_parts(13_798_719, 2626) - // Standard Error: 1_553 - .saturating_add(Weight::from_parts(109_215, 0).saturating_mul(r.into())) + // Minimum execution time: 12_851_000 picoseconds. + Weight::from_parts(13_448_645, 2626) + // Standard Error: 1_636 + .saturating_add(Weight::from_parts(113_654, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -94,12 +91,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `442 + r * (5 ±0)` // Estimated: `11003` - // Minimum execution time: 30_800_000 picoseconds. - Weight::from_parts(31_140_040, 11003) - // Standard Error: 4_896 - .saturating_add(Weight::from_parts(69_348, 0).saturating_mul(r.into())) - // Standard Error: 955 - .saturating_add(Weight::from_parts(430_082, 0).saturating_mul(x.into())) + // Minimum execution time: 33_342_000 picoseconds. + Weight::from_parts(33_155_116, 11003) + // Standard Error: 2_307 + .saturating_add(Weight::from_parts(56_409, 0).saturating_mul(r.into())) + // Standard Error: 450 + .saturating_add(Weight::from_parts(437_684, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -113,11 +110,11 @@ impl WeightInfo for SubstrateWeight { fn set_subs_new(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `101` - // Estimated: `18716 + s * (2589 ±0)` - // Minimum execution time: 10_301_000 picoseconds. - Weight::from_parts(23_255_636, 18716) - // Standard Error: 5_562 - .saturating_add(Weight::from_parts(2_978_765, 0).saturating_mul(s.into())) + // Estimated: `11003 + s * (2589 ±0)` + // Minimum execution time: 10_315_000 picoseconds. + Weight::from_parts(26_535_526, 11003) + // Standard Error: 4_344 + .saturating_add(Weight::from_parts(3_016_873, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -134,11 +131,11 @@ impl WeightInfo for SubstrateWeight { fn set_subs_old(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `194 + p * (32 ±0)` - // Estimated: `17726` - // Minimum execution time: 10_095_000 picoseconds. - Weight::from_parts(23_197_533, 17726) - // Standard Error: 3_460 - .saturating_add(Weight::from_parts(1_227_498, 0).saturating_mul(p.into())) + // Estimated: `11003` + // Minimum execution time: 10_220_000 picoseconds. + Weight::from_parts(25_050_056, 11003) + // Standard Error: 3_621 + .saturating_add(Weight::from_parts(1_291_143, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) @@ -155,13 +152,13 @@ impl WeightInfo for SubstrateWeight { fn clear_identity(_r: u32, s: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `469 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)` - // Estimated: `17726` - // Minimum execution time: 51_054_000 picoseconds. - Weight::from_parts(30_184_047, 17726) - // Standard Error: 2_441 - .saturating_add(Weight::from_parts(1_221_983, 0).saturating_mul(s.into())) - // Standard Error: 2_441 - .saturating_add(Weight::from_parts(234_084, 0).saturating_mul(x.into())) + // Estimated: `11003` + // Minimum execution time: 56_018_000 picoseconds. + Weight::from_parts(37_757_186, 11003) + // Standard Error: 1_852 + .saturating_add(Weight::from_parts(1_257_980, 0).saturating_mul(s.into())) + // Standard Error: 1_852 + .saturating_add(Weight::from_parts(215_426, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) @@ -175,13 +172,13 @@ impl WeightInfo for SubstrateWeight { fn request_judgement(r: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `367 + r * (57 ±0) + x * (66 ±0)` - // Estimated: `13629` - // Minimum execution time: 32_747_000 picoseconds. - Weight::from_parts(29_557_659, 13629) - // Standard Error: 4_616 - .saturating_add(Weight::from_parts(200_494, 0).saturating_mul(r.into())) - // Standard Error: 900 - .saturating_add(Weight::from_parts(468_381, 0).saturating_mul(x.into())) + // Estimated: `11003` + // Minimum execution time: 34_792_000 picoseconds. + Weight::from_parts(35_368_327, 11003) + // Standard Error: 3_476 + .saturating_add(Weight::from_parts(78_981, 0).saturating_mul(r.into())) + // Standard Error: 678 + .saturating_add(Weight::from_parts(459_077, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -189,16 +186,14 @@ impl WeightInfo for SubstrateWeight { /// Proof: Identity IdentityOf (max_values: None, max_size: Some(7538), added: 10013, mode: MaxEncodedLen) /// The range of component `r` is `[1, 20]`. /// The range of component `x` is `[0, 100]`. - fn cancel_request(r: u32, x: u32, ) -> Weight { + fn cancel_request(_r: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `398 + x * (66 ±0)` // Estimated: `11003` - // Minimum execution time: 28_853_000 picoseconds. - Weight::from_parts(26_811_119, 11003) - // Standard Error: 15_667 - .saturating_add(Weight::from_parts(240_647, 0).saturating_mul(r.into())) - // Standard Error: 3_056 - .saturating_add(Weight::from_parts(462_536, 0).saturating_mul(x.into())) + // Minimum execution time: 31_306_000 picoseconds. + Weight::from_parts(33_304_799, 11003) + // Standard Error: 892 + .saturating_add(Weight::from_parts(451_655, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -209,10 +204,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `89 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 8_413_000 picoseconds. - Weight::from_parts(8_846_436, 2626) - // Standard Error: 1_470 - .saturating_add(Weight::from_parts(113_780, 0).saturating_mul(r.into())) + // Minimum execution time: 8_215_000 picoseconds. + Weight::from_parts(8_692_102, 2626) + // Standard Error: 1_455 + .saturating_add(Weight::from_parts(110_912, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -223,10 +218,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `89 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 8_753_000 picoseconds. - Weight::from_parts(9_143_938, 2626) - // Standard Error: 1_490 - .saturating_add(Weight::from_parts(113_406, 0).saturating_mul(r.into())) + // Minimum execution time: 8_397_000 picoseconds. + Weight::from_parts(8_787_656, 2626) + // Standard Error: 1_440 + .saturating_add(Weight::from_parts(111_212, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -237,10 +232,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `89 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 8_320_000 picoseconds. - Weight::from_parts(8_800_306, 2626) - // Standard Error: 1_345 - .saturating_add(Weight::from_parts(125_258, 0).saturating_mul(r.into())) + // Minimum execution time: 8_466_000 picoseconds. + Weight::from_parts(8_689_763, 2626) + // Standard Error: 1_536 + .saturating_add(Weight::from_parts(106_371, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -253,13 +248,13 @@ impl WeightInfo for SubstrateWeight { fn provide_judgement(r: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `445 + r * (57 ±0) + x * (66 ±0)` - // Estimated: `13629` - // Minimum execution time: 25_313_000 picoseconds. - Weight::from_parts(23_968_548, 13629) - // Standard Error: 4_143 - .saturating_add(Weight::from_parts(164_678, 0).saturating_mul(r.into())) - // Standard Error: 766 - .saturating_add(Weight::from_parts(713_576, 0).saturating_mul(x.into())) + // Estimated: `11003` + // Minimum execution time: 25_132_000 picoseconds. + Weight::from_parts(20_582_313, 11003) + // Standard Error: 10_427 + .saturating_add(Weight::from_parts(277_545, 0).saturating_mul(r.into())) + // Standard Error: 1_929 + .saturating_add(Weight::from_parts(747_966, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -277,15 +272,15 @@ impl WeightInfo for SubstrateWeight { fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `676 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)` - // Estimated: `21319` - // Minimum execution time: 64_638_000 picoseconds. - Weight::from_parts(43_317_654, 21319) - // Standard Error: 10_182 - .saturating_add(Weight::from_parts(61_967, 0).saturating_mul(r.into())) - // Standard Error: 1_988 - .saturating_add(Weight::from_parts(1_224_202, 0).saturating_mul(s.into())) - // Standard Error: 1_988 - .saturating_add(Weight::from_parts(233_897, 0).saturating_mul(x.into())) + // Estimated: `11003` + // Minimum execution time: 72_043_000 picoseconds. + Weight::from_parts(50_994_735, 11003) + // Standard Error: 9_304 + .saturating_add(Weight::from_parts(123_052, 0).saturating_mul(r.into())) + // Standard Error: 1_817 + .saturating_add(Weight::from_parts(1_256_713, 0).saturating_mul(s.into())) + // Standard Error: 1_817 + .saturating_add(Weight::from_parts(219_242, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) @@ -300,11 +295,11 @@ impl WeightInfo for SubstrateWeight { fn add_sub(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `475 + s * (36 ±0)` - // Estimated: `21305` - // Minimum execution time: 28_661_000 picoseconds. - Weight::from_parts(33_432_641, 21305) - // Standard Error: 1_547 - .saturating_add(Weight::from_parts(71_314, 0).saturating_mul(s.into())) + // Estimated: `11003` + // Minimum execution time: 30_747_000 picoseconds. + Weight::from_parts(35_975_985, 11003) + // Standard Error: 1_625 + .saturating_add(Weight::from_parts(73_263, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -316,11 +311,11 @@ impl WeightInfo for SubstrateWeight { fn rename_sub(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `591 + s * (3 ±0)` - // Estimated: `14582` - // Minimum execution time: 13_885_000 picoseconds. - Weight::from_parts(16_105_165, 14582) - // Standard Error: 562 - .saturating_add(Weight::from_parts(17_087, 0).saturating_mul(s.into())) + // Estimated: `11003` + // Minimum execution time: 13_586_000 picoseconds. + Weight::from_parts(15_909_245, 11003) + // Standard Error: 611 + .saturating_add(Weight::from_parts(16_949, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -334,11 +329,11 @@ impl WeightInfo for SubstrateWeight { fn remove_sub(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `638 + s * (35 ±0)` - // Estimated: `21305` - // Minimum execution time: 32_192_000 picoseconds. - Weight::from_parts(35_393_444, 21305) - // Standard Error: 2_198 - .saturating_add(Weight::from_parts(62_316, 0).saturating_mul(s.into())) + // Estimated: `11003` + // Minimum execution time: 34_286_000 picoseconds. + Weight::from_parts(37_391_401, 11003) + // Standard Error: 1_099 + .saturating_add(Weight::from_parts(61_165, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -350,11 +345,11 @@ impl WeightInfo for SubstrateWeight { fn quit_sub(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `564 + s * (37 ±0)` - // Estimated: `10302` - // Minimum execution time: 20_803_000 picoseconds. - Weight::from_parts(23_462_393, 10302) - // Standard Error: 1_619 - .saturating_add(Weight::from_parts(59_938, 0).saturating_mul(s.into())) + // Estimated: `6723` + // Minimum execution time: 22_197_000 picoseconds. + Weight::from_parts(24_630_311, 6723) + // Standard Error: 1_092 + .saturating_add(Weight::from_parts(63_415, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -369,10 +364,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `32 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 13_092_000 picoseconds. - Weight::from_parts(13_798_719, 2626) - // Standard Error: 1_553 - .saturating_add(Weight::from_parts(109_215, 0).saturating_mul(r.into())) + // Minimum execution time: 12_851_000 picoseconds. + Weight::from_parts(13_448_645, 2626) + // Standard Error: 1_636 + .saturating_add(Weight::from_parts(113_654, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -384,12 +379,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `442 + r * (5 ±0)` // Estimated: `11003` - // Minimum execution time: 30_800_000 picoseconds. - Weight::from_parts(31_140_040, 11003) - // Standard Error: 4_896 - .saturating_add(Weight::from_parts(69_348, 0).saturating_mul(r.into())) - // Standard Error: 955 - .saturating_add(Weight::from_parts(430_082, 0).saturating_mul(x.into())) + // Minimum execution time: 33_342_000 picoseconds. + Weight::from_parts(33_155_116, 11003) + // Standard Error: 2_307 + .saturating_add(Weight::from_parts(56_409, 0).saturating_mul(r.into())) + // Standard Error: 450 + .saturating_add(Weight::from_parts(437_684, 0).saturating_mul(x.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -403,11 +398,11 @@ impl WeightInfo for () { fn set_subs_new(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `101` - // Estimated: `18716 + s * (2589 ±0)` - // Minimum execution time: 10_301_000 picoseconds. - Weight::from_parts(23_255_636, 18716) - // Standard Error: 5_562 - .saturating_add(Weight::from_parts(2_978_765, 0).saturating_mul(s.into())) + // Estimated: `11003 + s * (2589 ±0)` + // Minimum execution time: 10_315_000 picoseconds. + Weight::from_parts(26_535_526, 11003) + // Standard Error: 4_344 + .saturating_add(Weight::from_parts(3_016_873, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(s.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -424,11 +419,11 @@ impl WeightInfo for () { fn set_subs_old(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `194 + p * (32 ±0)` - // Estimated: `17726` - // Minimum execution time: 10_095_000 picoseconds. - Weight::from_parts(23_197_533, 17726) - // Standard Error: 3_460 - .saturating_add(Weight::from_parts(1_227_498, 0).saturating_mul(p.into())) + // Estimated: `11003` + // Minimum execution time: 10_220_000 picoseconds. + Weight::from_parts(25_050_056, 11003) + // Standard Error: 3_621 + .saturating_add(Weight::from_parts(1_291_143, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) @@ -445,13 +440,13 @@ impl WeightInfo for () { fn clear_identity(_r: u32, s: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `469 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)` - // Estimated: `17726` - // Minimum execution time: 51_054_000 picoseconds. - Weight::from_parts(30_184_047, 17726) - // Standard Error: 2_441 - .saturating_add(Weight::from_parts(1_221_983, 0).saturating_mul(s.into())) - // Standard Error: 2_441 - .saturating_add(Weight::from_parts(234_084, 0).saturating_mul(x.into())) + // Estimated: `11003` + // Minimum execution time: 56_018_000 picoseconds. + Weight::from_parts(37_757_186, 11003) + // Standard Error: 1_852 + .saturating_add(Weight::from_parts(1_257_980, 0).saturating_mul(s.into())) + // Standard Error: 1_852 + .saturating_add(Weight::from_parts(215_426, 0).saturating_mul(x.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into()))) @@ -465,13 +460,13 @@ impl WeightInfo for () { fn request_judgement(r: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `367 + r * (57 ±0) + x * (66 ±0)` - // Estimated: `13629` - // Minimum execution time: 32_747_000 picoseconds. - Weight::from_parts(29_557_659, 13629) - // Standard Error: 4_616 - .saturating_add(Weight::from_parts(200_494, 0).saturating_mul(r.into())) - // Standard Error: 900 - .saturating_add(Weight::from_parts(468_381, 0).saturating_mul(x.into())) + // Estimated: `11003` + // Minimum execution time: 34_792_000 picoseconds. + Weight::from_parts(35_368_327, 11003) + // Standard Error: 3_476 + .saturating_add(Weight::from_parts(78_981, 0).saturating_mul(r.into())) + // Standard Error: 678 + .saturating_add(Weight::from_parts(459_077, 0).saturating_mul(x.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -479,16 +474,14 @@ impl WeightInfo for () { /// Proof: Identity IdentityOf (max_values: None, max_size: Some(7538), added: 10013, mode: MaxEncodedLen) /// The range of component `r` is `[1, 20]`. /// The range of component `x` is `[0, 100]`. - fn cancel_request(r: u32, x: u32, ) -> Weight { + fn cancel_request(_r: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `398 + x * (66 ±0)` // Estimated: `11003` - // Minimum execution time: 28_853_000 picoseconds. - Weight::from_parts(26_811_119, 11003) - // Standard Error: 15_667 - .saturating_add(Weight::from_parts(240_647, 0).saturating_mul(r.into())) - // Standard Error: 3_056 - .saturating_add(Weight::from_parts(462_536, 0).saturating_mul(x.into())) + // Minimum execution time: 31_306_000 picoseconds. + Weight::from_parts(33_304_799, 11003) + // Standard Error: 892 + .saturating_add(Weight::from_parts(451_655, 0).saturating_mul(x.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -499,10 +492,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `89 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 8_413_000 picoseconds. - Weight::from_parts(8_846_436, 2626) - // Standard Error: 1_470 - .saturating_add(Weight::from_parts(113_780, 0).saturating_mul(r.into())) + // Minimum execution time: 8_215_000 picoseconds. + Weight::from_parts(8_692_102, 2626) + // Standard Error: 1_455 + .saturating_add(Weight::from_parts(110_912, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -513,10 +506,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `89 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 8_753_000 picoseconds. - Weight::from_parts(9_143_938, 2626) - // Standard Error: 1_490 - .saturating_add(Weight::from_parts(113_406, 0).saturating_mul(r.into())) + // Minimum execution time: 8_397_000 picoseconds. + Weight::from_parts(8_787_656, 2626) + // Standard Error: 1_440 + .saturating_add(Weight::from_parts(111_212, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -527,10 +520,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `89 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 8_320_000 picoseconds. - Weight::from_parts(8_800_306, 2626) - // Standard Error: 1_345 - .saturating_add(Weight::from_parts(125_258, 0).saturating_mul(r.into())) + // Minimum execution time: 8_466_000 picoseconds. + Weight::from_parts(8_689_763, 2626) + // Standard Error: 1_536 + .saturating_add(Weight::from_parts(106_371, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -543,13 +536,13 @@ impl WeightInfo for () { fn provide_judgement(r: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `445 + r * (57 ±0) + x * (66 ±0)` - // Estimated: `13629` - // Minimum execution time: 25_313_000 picoseconds. - Weight::from_parts(23_968_548, 13629) - // Standard Error: 4_143 - .saturating_add(Weight::from_parts(164_678, 0).saturating_mul(r.into())) - // Standard Error: 766 - .saturating_add(Weight::from_parts(713_576, 0).saturating_mul(x.into())) + // Estimated: `11003` + // Minimum execution time: 25_132_000 picoseconds. + Weight::from_parts(20_582_313, 11003) + // Standard Error: 10_427 + .saturating_add(Weight::from_parts(277_545, 0).saturating_mul(r.into())) + // Standard Error: 1_929 + .saturating_add(Weight::from_parts(747_966, 0).saturating_mul(x.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -567,15 +560,15 @@ impl WeightInfo for () { fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `676 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)` - // Estimated: `21319` - // Minimum execution time: 64_638_000 picoseconds. - Weight::from_parts(43_317_654, 21319) - // Standard Error: 10_182 - .saturating_add(Weight::from_parts(61_967, 0).saturating_mul(r.into())) - // Standard Error: 1_988 - .saturating_add(Weight::from_parts(1_224_202, 0).saturating_mul(s.into())) - // Standard Error: 1_988 - .saturating_add(Weight::from_parts(233_897, 0).saturating_mul(x.into())) + // Estimated: `11003` + // Minimum execution time: 72_043_000 picoseconds. + Weight::from_parts(50_994_735, 11003) + // Standard Error: 9_304 + .saturating_add(Weight::from_parts(123_052, 0).saturating_mul(r.into())) + // Standard Error: 1_817 + .saturating_add(Weight::from_parts(1_256_713, 0).saturating_mul(s.into())) + // Standard Error: 1_817 + .saturating_add(Weight::from_parts(219_242, 0).saturating_mul(x.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into()))) @@ -590,11 +583,11 @@ impl WeightInfo for () { fn add_sub(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `475 + s * (36 ±0)` - // Estimated: `21305` - // Minimum execution time: 28_661_000 picoseconds. - Weight::from_parts(33_432_641, 21305) - // Standard Error: 1_547 - .saturating_add(Weight::from_parts(71_314, 0).saturating_mul(s.into())) + // Estimated: `11003` + // Minimum execution time: 30_747_000 picoseconds. + Weight::from_parts(35_975_985, 11003) + // Standard Error: 1_625 + .saturating_add(Weight::from_parts(73_263, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -606,11 +599,11 @@ impl WeightInfo for () { fn rename_sub(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `591 + s * (3 ±0)` - // Estimated: `14582` - // Minimum execution time: 13_885_000 picoseconds. - Weight::from_parts(16_105_165, 14582) - // Standard Error: 562 - .saturating_add(Weight::from_parts(17_087, 0).saturating_mul(s.into())) + // Estimated: `11003` + // Minimum execution time: 13_586_000 picoseconds. + Weight::from_parts(15_909_245, 11003) + // Standard Error: 611 + .saturating_add(Weight::from_parts(16_949, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -624,11 +617,11 @@ impl WeightInfo for () { fn remove_sub(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `638 + s * (35 ±0)` - // Estimated: `21305` - // Minimum execution time: 32_192_000 picoseconds. - Weight::from_parts(35_393_444, 21305) - // Standard Error: 2_198 - .saturating_add(Weight::from_parts(62_316, 0).saturating_mul(s.into())) + // Estimated: `11003` + // Minimum execution time: 34_286_000 picoseconds. + Weight::from_parts(37_391_401, 11003) + // Standard Error: 1_099 + .saturating_add(Weight::from_parts(61_165, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -640,11 +633,11 @@ impl WeightInfo for () { fn quit_sub(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `564 + s * (37 ±0)` - // Estimated: `10302` - // Minimum execution time: 20_803_000 picoseconds. - Weight::from_parts(23_462_393, 10302) - // Standard Error: 1_619 - .saturating_add(Weight::from_parts(59_938, 0).saturating_mul(s.into())) + // Estimated: `6723` + // Minimum execution time: 22_197_000 picoseconds. + Weight::from_parts(24_630_311, 6723) + // Standard Error: 1_092 + .saturating_add(Weight::from_parts(63_415, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/frame/im-online/src/weights.rs b/frame/im-online/src/weights.rs index f97df1c367562..64c1eb5f3a9b0 100644 --- a/frame/im-online/src/weights.rs +++ b/frame/im-online/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_im_online //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_im_online -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -72,17 +69,17 @@ impl WeightInfo for SubstrateWeight { fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `295 + k * (32 ±0)` - // Estimated: `10349544 + e * (35 ±0) + k * (64 ±0)` - // Minimum execution time: 106_224_000 picoseconds. - Weight::from_parts(79_172_319, 10349544) - // Standard Error: 259 - .saturating_add(Weight::from_parts(29_576, 0).saturating_mul(k.into())) - // Standard Error: 2_611 - .saturating_add(Weight::from_parts(422_369, 0).saturating_mul(e.into())) + // Estimated: `10024497 + e * (35 ±0) + k * (32 ±0)` + // Minimum execution time: 95_573_000 picoseconds. + Weight::from_parts(78_856_572, 10024497) + // Standard Error: 315 + .saturating_add(Weight::from_parts(22_926, 0).saturating_mul(k.into())) + // Standard Error: 3_181 + .saturating_add(Weight::from_parts(362_093, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 35).saturating_mul(e.into())) - .saturating_add(Weight::from_parts(0, 64).saturating_mul(k.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(k.into())) } } @@ -103,16 +100,16 @@ impl WeightInfo for () { fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `295 + k * (32 ±0)` - // Estimated: `10349544 + e * (35 ±0) + k * (64 ±0)` - // Minimum execution time: 106_224_000 picoseconds. - Weight::from_parts(79_172_319, 10349544) - // Standard Error: 259 - .saturating_add(Weight::from_parts(29_576, 0).saturating_mul(k.into())) - // Standard Error: 2_611 - .saturating_add(Weight::from_parts(422_369, 0).saturating_mul(e.into())) + // Estimated: `10024497 + e * (35 ±0) + k * (32 ±0)` + // Minimum execution time: 95_573_000 picoseconds. + Weight::from_parts(78_856_572, 10024497) + // Standard Error: 315 + .saturating_add(Weight::from_parts(22_926, 0).saturating_mul(k.into())) + // Standard Error: 3_181 + .saturating_add(Weight::from_parts(362_093, 0).saturating_mul(e.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 35).saturating_mul(e.into())) - .saturating_add(Weight::from_parts(0, 64).saturating_mul(k.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(k.into())) } } diff --git a/frame/indices/src/weights.rs b/frame/indices/src/weights.rs index 87160ccfbb208..21d01c14ef9a2 100644 --- a/frame/indices/src/weights.rs +++ b/frame/indices/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_indices //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_indices -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -67,8 +64,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `3534` - // Minimum execution time: 22_365_000 picoseconds. - Weight::from_parts(22_713_000, 3534) + // Minimum execution time: 27_250_000 picoseconds. + Weight::from_parts(27_829_000, 3534) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -79,9 +76,9 @@ impl WeightInfo for SubstrateWeight { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `275` - // Estimated: `7127` - // Minimum execution time: 28_380_000 picoseconds. - Weight::from_parts(29_251_000, 7127) + // Estimated: `3593` + // Minimum execution time: 37_880_000 picoseconds. + Weight::from_parts(38_329_000, 3593) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -91,8 +88,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `172` // Estimated: `3534` - // Minimum execution time: 22_932_000 picoseconds. - Weight::from_parts(23_442_000, 3534) + // Minimum execution time: 27_455_000 picoseconds. + Weight::from_parts(27_788_000, 3534) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -103,9 +100,9 @@ impl WeightInfo for SubstrateWeight { fn force_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `275` - // Estimated: `7127` - // Minimum execution time: 25_223_000 picoseconds. - Weight::from_parts(25_519_000, 7127) + // Estimated: `3593` + // Minimum execution time: 29_865_000 picoseconds. + Weight::from_parts(30_420_000, 3593) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -115,8 +112,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `172` // Estimated: `3534` - // Minimum execution time: 25_223_000 picoseconds. - Weight::from_parts(26_127_000, 3534) + // Minimum execution time: 29_689_000 picoseconds. + Weight::from_parts(30_443_000, 3534) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -130,8 +127,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `3534` - // Minimum execution time: 22_365_000 picoseconds. - Weight::from_parts(22_713_000, 3534) + // Minimum execution time: 27_250_000 picoseconds. + Weight::from_parts(27_829_000, 3534) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -142,9 +139,9 @@ impl WeightInfo for () { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `275` - // Estimated: `7127` - // Minimum execution time: 28_380_000 picoseconds. - Weight::from_parts(29_251_000, 7127) + // Estimated: `3593` + // Minimum execution time: 37_880_000 picoseconds. + Weight::from_parts(38_329_000, 3593) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -154,8 +151,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `172` // Estimated: `3534` - // Minimum execution time: 22_932_000 picoseconds. - Weight::from_parts(23_442_000, 3534) + // Minimum execution time: 27_455_000 picoseconds. + Weight::from_parts(27_788_000, 3534) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -166,9 +163,9 @@ impl WeightInfo for () { fn force_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `275` - // Estimated: `7127` - // Minimum execution time: 25_223_000 picoseconds. - Weight::from_parts(25_519_000, 7127) + // Estimated: `3593` + // Minimum execution time: 29_865_000 picoseconds. + Weight::from_parts(30_420_000, 3593) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -178,8 +175,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `172` // Estimated: `3534` - // Minimum execution time: 25_223_000 picoseconds. - Weight::from_parts(26_127_000, 3534) + // Minimum execution time: 29_689_000 picoseconds. + Weight::from_parts(30_443_000, 3534) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/lottery/src/weights.rs b/frame/lottery/src/weights.rs index c8c373ad6f88d..c21b09e7d5b92 100644 --- a/frame/lottery/src/weights.rs +++ b/frame/lottery/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_lottery //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_lottery -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -79,9 +76,9 @@ impl WeightInfo for SubstrateWeight { fn buy_ticket() -> Weight { // Proof Size summary in bytes: // Measured: `452` - // Estimated: `13121` - // Minimum execution time: 43_076_000 picoseconds. - Weight::from_parts(43_902_000, 13121) + // Estimated: `3593` + // Minimum execution time: 61_502_000 picoseconds. + Weight::from_parts(62_578_000, 3593) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -92,10 +89,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_222_000 picoseconds. - Weight::from_parts(9_166_238, 0) - // Standard Error: 3_489 - .saturating_add(Weight::from_parts(328_564, 0).saturating_mul(n.into())) + // Minimum execution time: 8_282_000 picoseconds. + Weight::from_parts(9_271_031, 0) + // Standard Error: 3_756 + .saturating_add(Weight::from_parts(349_990, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Lottery Lottery (r:1 w:1) @@ -107,9 +104,9 @@ impl WeightInfo for SubstrateWeight { fn start_lottery() -> Weight { // Proof Size summary in bytes: // Measured: `161` - // Estimated: `6596` - // Minimum execution time: 36_555_000 picoseconds. - Weight::from_parts(37_008_000, 6596) + // Estimated: `3593` + // Minimum execution time: 38_975_000 picoseconds. + Weight::from_parts(39_552_000, 3593) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -119,8 +116,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1514` - // Minimum execution time: 8_230_000 picoseconds. - Weight::from_parts(8_355_000, 1514) + // Minimum execution time: 8_243_000 picoseconds. + Weight::from_parts(8_359_000, 1514) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -137,9 +134,9 @@ impl WeightInfo for SubstrateWeight { fn on_initialize_end() -> Weight { // Proof Size summary in bytes: // Measured: `524` - // Estimated: `16787` - // Minimum execution time: 60_097_000 picoseconds. - Weight::from_parts(62_055_000, 16787) + // Estimated: `6196` + // Minimum execution time: 76_062_000 picoseconds. + Weight::from_parts(76_547_000, 6196) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -158,9 +155,9 @@ impl WeightInfo for SubstrateWeight { fn on_initialize_repeat() -> Weight { // Proof Size summary in bytes: // Measured: `524` - // Estimated: `18276` - // Minimum execution time: 61_354_000 picoseconds. - Weight::from_parts(62_429_000, 18276) + // Estimated: `6196` + // Minimum execution time: 78_089_000 picoseconds. + Weight::from_parts(78_632_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -185,9 +182,9 @@ impl WeightInfo for () { fn buy_ticket() -> Weight { // Proof Size summary in bytes: // Measured: `452` - // Estimated: `13121` - // Minimum execution time: 43_076_000 picoseconds. - Weight::from_parts(43_902_000, 13121) + // Estimated: `3593` + // Minimum execution time: 61_502_000 picoseconds. + Weight::from_parts(62_578_000, 3593) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -198,10 +195,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_222_000 picoseconds. - Weight::from_parts(9_166_238, 0) - // Standard Error: 3_489 - .saturating_add(Weight::from_parts(328_564, 0).saturating_mul(n.into())) + // Minimum execution time: 8_282_000 picoseconds. + Weight::from_parts(9_271_031, 0) + // Standard Error: 3_756 + .saturating_add(Weight::from_parts(349_990, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Lottery Lottery (r:1 w:1) @@ -213,9 +210,9 @@ impl WeightInfo for () { fn start_lottery() -> Weight { // Proof Size summary in bytes: // Measured: `161` - // Estimated: `6596` - // Minimum execution time: 36_555_000 picoseconds. - Weight::from_parts(37_008_000, 6596) + // Estimated: `3593` + // Minimum execution time: 38_975_000 picoseconds. + Weight::from_parts(39_552_000, 3593) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -225,8 +222,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1514` - // Minimum execution time: 8_230_000 picoseconds. - Weight::from_parts(8_355_000, 1514) + // Minimum execution time: 8_243_000 picoseconds. + Weight::from_parts(8_359_000, 1514) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -243,9 +240,9 @@ impl WeightInfo for () { fn on_initialize_end() -> Weight { // Proof Size summary in bytes: // Measured: `524` - // Estimated: `16787` - // Minimum execution time: 60_097_000 picoseconds. - Weight::from_parts(62_055_000, 16787) + // Estimated: `6196` + // Minimum execution time: 76_062_000 picoseconds. + Weight::from_parts(76_547_000, 6196) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -264,9 +261,9 @@ impl WeightInfo for () { fn on_initialize_repeat() -> Weight { // Proof Size summary in bytes: // Measured: `524` - // Estimated: `18276` - // Minimum execution time: 61_354_000 picoseconds. - Weight::from_parts(62_429_000, 18276) + // Estimated: `6196` + // Minimum execution time: 78_089_000 picoseconds. + Weight::from_parts(78_632_000, 6196) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } diff --git a/frame/membership/src/weights.rs b/frame/membership/src/weights.rs index 31c359b4469eb..70c50d8695dfc 100644 --- a/frame/membership/src/weights.rs +++ b/frame/membership/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_membership //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_membership -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -75,14 +72,14 @@ impl WeightInfo for SubstrateWeight { fn add_member(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `174 + m * (64 ±0)` - // Estimated: `6691 + m * (192 ±0)` - // Minimum execution time: 17_587_000 picoseconds. - Weight::from_parts(18_658_163, 6691) - // Standard Error: 710 - .saturating_add(Weight::from_parts(46_294, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 18_264_000 picoseconds. + Weight::from_parts(19_343_697, 4687) + // Standard Error: 699 + .saturating_add(Weight::from_parts(44_401, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:1) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -98,14 +95,14 @@ impl WeightInfo for SubstrateWeight { fn remove_member(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `278 + m * (64 ±0)` - // Estimated: `8520 + m * (192 ±0)` - // Minimum execution time: 20_402_000 picoseconds. - Weight::from_parts(21_165_819, 8520) - // Standard Error: 643 - .saturating_add(Weight::from_parts(45_481, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 21_092_000 picoseconds. + Weight::from_parts(22_140_391, 4687) + // Standard Error: 545 + .saturating_add(Weight::from_parts(40_638, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:1) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -121,14 +118,14 @@ impl WeightInfo for SubstrateWeight { fn swap_member(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `278 + m * (64 ±0)` - // Estimated: `8520 + m * (192 ±0)` - // Minimum execution time: 20_380_000 picoseconds. - Weight::from_parts(21_633_260, 8520) - // Standard Error: 770 - .saturating_add(Weight::from_parts(55_504, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 21_002_000 picoseconds. + Weight::from_parts(22_364_944, 4687) + // Standard Error: 752 + .saturating_add(Weight::from_parts(54_363, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:1) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -144,14 +141,14 @@ impl WeightInfo for SubstrateWeight { fn reset_member(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `278 + m * (64 ±0)` - // Estimated: `8520 + m * (192 ±0)` - // Minimum execution time: 19_989_000 picoseconds. - Weight::from_parts(22_352_059, 8520) - // Standard Error: 2_878 - .saturating_add(Weight::from_parts(156_367, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 20_443_000 picoseconds. + Weight::from_parts(22_188_301, 4687) + // Standard Error: 945 + .saturating_add(Weight::from_parts(162_799, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:1) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -167,14 +164,14 @@ impl WeightInfo for SubstrateWeight { fn change_key(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `278 + m * (64 ±0)` - // Estimated: `8520 + m * (192 ±0)` - // Minimum execution time: 21_275_000 picoseconds. - Weight::from_parts(23_344_594, 8520) - // Standard Error: 2_750 - .saturating_add(Weight::from_parts(46_736, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 21_527_000 picoseconds. + Weight::from_parts(23_146_706, 4687) + // Standard Error: 724 + .saturating_add(Weight::from_parts(55_027, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:0) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -186,11 +183,11 @@ impl WeightInfo for SubstrateWeight { fn set_prime(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32 + m * (32 ±0)` - // Estimated: `4719 + m * (32 ±0)` - // Minimum execution time: 8_087_000 picoseconds. - Weight::from_parts(8_909_627, 4719) - // Standard Error: 1_572 - .saturating_add(Weight::from_parts(17_186, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (32 ±0)` + // Minimum execution time: 8_054_000 picoseconds. + Weight::from_parts(8_558_341, 4687) + // Standard Error: 360 + .saturating_add(Weight::from_parts(16_362, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) @@ -200,14 +197,12 @@ impl WeightInfo for SubstrateWeight { /// Storage: TechnicalCommittee Prime (r:0 w:1) /// Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) /// The range of component `m` is `[1, 100]`. - fn clear_prime(m: u32, ) -> Weight { + fn clear_prime(_m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_752_000 picoseconds. - Weight::from_parts(4_081_144, 0) - // Standard Error: 229 - .saturating_add(Weight::from_parts(1_298, 0).saturating_mul(m.into())) + // Minimum execution time: 3_784_000 picoseconds. + Weight::from_parts(4_100_031, 0) .saturating_add(T::DbWeight::get().writes(2_u64)) } } @@ -226,14 +221,14 @@ impl WeightInfo for () { fn add_member(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `174 + m * (64 ±0)` - // Estimated: `6691 + m * (192 ±0)` - // Minimum execution time: 17_587_000 picoseconds. - Weight::from_parts(18_658_163, 6691) - // Standard Error: 710 - .saturating_add(Weight::from_parts(46_294, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 18_264_000 picoseconds. + Weight::from_parts(19_343_697, 4687) + // Standard Error: 699 + .saturating_add(Weight::from_parts(44_401, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:1) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -249,14 +244,14 @@ impl WeightInfo for () { fn remove_member(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `278 + m * (64 ±0)` - // Estimated: `8520 + m * (192 ±0)` - // Minimum execution time: 20_402_000 picoseconds. - Weight::from_parts(21_165_819, 8520) - // Standard Error: 643 - .saturating_add(Weight::from_parts(45_481, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 21_092_000 picoseconds. + Weight::from_parts(22_140_391, 4687) + // Standard Error: 545 + .saturating_add(Weight::from_parts(40_638, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:1) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -272,14 +267,14 @@ impl WeightInfo for () { fn swap_member(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `278 + m * (64 ±0)` - // Estimated: `8520 + m * (192 ±0)` - // Minimum execution time: 20_380_000 picoseconds. - Weight::from_parts(21_633_260, 8520) - // Standard Error: 770 - .saturating_add(Weight::from_parts(55_504, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 21_002_000 picoseconds. + Weight::from_parts(22_364_944, 4687) + // Standard Error: 752 + .saturating_add(Weight::from_parts(54_363, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:1) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -295,14 +290,14 @@ impl WeightInfo for () { fn reset_member(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `278 + m * (64 ±0)` - // Estimated: `8520 + m * (192 ±0)` - // Minimum execution time: 19_989_000 picoseconds. - Weight::from_parts(22_352_059, 8520) - // Standard Error: 2_878 - .saturating_add(Weight::from_parts(156_367, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 20_443_000 picoseconds. + Weight::from_parts(22_188_301, 4687) + // Standard Error: 945 + .saturating_add(Weight::from_parts(162_799, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:1) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -318,14 +313,14 @@ impl WeightInfo for () { fn change_key(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `278 + m * (64 ±0)` - // Estimated: `8520 + m * (192 ±0)` - // Minimum execution time: 21_275_000 picoseconds. - Weight::from_parts(23_344_594, 8520) - // Standard Error: 2_750 - .saturating_add(Weight::from_parts(46_736, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (64 ±0)` + // Minimum execution time: 21_527_000 picoseconds. + Weight::from_parts(23_146_706, 4687) + // Standard Error: 724 + .saturating_add(Weight::from_parts(55_027, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: TechnicalMembership Members (r:1 w:0) /// Proof: TechnicalMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -337,11 +332,11 @@ impl WeightInfo for () { fn set_prime(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32 + m * (32 ±0)` - // Estimated: `4719 + m * (32 ±0)` - // Minimum execution time: 8_087_000 picoseconds. - Weight::from_parts(8_909_627, 4719) - // Standard Error: 1_572 - .saturating_add(Weight::from_parts(17_186, 0).saturating_mul(m.into())) + // Estimated: `4687 + m * (32 ±0)` + // Minimum execution time: 8_054_000 picoseconds. + Weight::from_parts(8_558_341, 4687) + // Standard Error: 360 + .saturating_add(Weight::from_parts(16_362, 0).saturating_mul(m.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) @@ -351,14 +346,12 @@ impl WeightInfo for () { /// Storage: TechnicalCommittee Prime (r:0 w:1) /// Proof Skipped: TechnicalCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) /// The range of component `m` is `[1, 100]`. - fn clear_prime(m: u32, ) -> Weight { + fn clear_prime(_m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_752_000 picoseconds. - Weight::from_parts(4_081_144, 0) - // Standard Error: 229 - .saturating_add(Weight::from_parts(1_298, 0).saturating_mul(m.into())) + // Minimum execution time: 3_784_000 picoseconds. + Weight::from_parts(4_100_031, 0) .saturating_add(RocksDbWeight::get().writes(2_u64)) } } diff --git a/frame/message-queue/src/weights.rs b/frame/message-queue/src/weights.rs index fc44456db28bd..9dae12f518e44 100644 --- a/frame/message-queue/src/weights.rs +++ b/frame/message-queue/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_message_queue //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_message_queue -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -73,9 +70,9 @@ impl WeightInfo for SubstrateWeight { fn ready_ring_knit() -> Weight { // Proof Size summary in bytes: // Measured: `233` - // Estimated: `7527` - // Minimum execution time: 12_561_000 picoseconds. - Weight::from_parts(12_758_000, 7527) + // Estimated: `6038` + // Minimum execution time: 12_076_000 picoseconds. + Weight::from_parts(12_350_000, 6038) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -86,9 +83,9 @@ impl WeightInfo for SubstrateWeight { fn ready_ring_unknit() -> Weight { // Proof Size summary in bytes: // Measured: `233` - // Estimated: `7527` - // Minimum execution time: 11_854_000 picoseconds. - Weight::from_parts(12_178_000, 7527) + // Estimated: `6038` + // Minimum execution time: 11_586_000 picoseconds. + Weight::from_parts(11_912_000, 6038) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -98,8 +95,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3514` - // Minimum execution time: 7_900_000 picoseconds. - Weight::from_parts(8_046_000, 3514) + // Minimum execution time: 4_581_000 picoseconds. + Weight::from_parts(4_715_000, 3514) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -109,8 +106,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `113` // Estimated: `69049` - // Minimum execution time: 6_284_000 picoseconds. - Weight::from_parts(6_433_000, 69049) + // Minimum execution time: 5_826_000 picoseconds. + Weight::from_parts(5_932_000, 69049) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +117,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `113` // Estimated: `69049` - // Minimum execution time: 6_418_000 picoseconds. - Weight::from_parts(6_633_000, 69049) + // Minimum execution time: 6_235_000 picoseconds. + Weight::from_parts(6_430_000, 69049) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -129,8 +126,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_661_000 picoseconds. - Weight::from_parts(52_994_000, 0) + // Minimum execution time: 53_860_000 picoseconds. + Weight::from_parts(53_984_000, 0) } /// Storage: MessageQueue ServiceHead (r:1 w:1) /// Proof: MessageQueue ServiceHead (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -139,9 +136,9 @@ impl WeightInfo for SubstrateWeight { fn bump_service_head() -> Weight { // Proof Size summary in bytes: // Measured: `140` - // Estimated: `5003` - // Minimum execution time: 7_132_000 picoseconds. - Weight::from_parts(7_386_000, 5003) + // Estimated: `3514` + // Minimum execution time: 7_018_000 picoseconds. + Weight::from_parts(7_205_000, 3514) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -152,9 +149,9 @@ impl WeightInfo for SubstrateWeight { fn reap_page() -> Weight { // Proof Size summary in bytes: // Measured: `65710` - // Estimated: `72563` - // Minimum execution time: 54_377_000 picoseconds. - Weight::from_parts(54_804_000, 72563) + // Estimated: `69049` + // Minimum execution time: 53_485_000 picoseconds. + Weight::from_parts(54_154_000, 69049) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -165,9 +162,9 @@ impl WeightInfo for SubstrateWeight { fn execute_overweight_page_removed() -> Weight { // Proof Size summary in bytes: // Measured: `65710` - // Estimated: `72563` - // Minimum execution time: 69_461_000 picoseconds. - Weight::from_parts(70_016_000, 72563) + // Estimated: `69049` + // Minimum execution time: 68_830_000 picoseconds. + Weight::from_parts(69_487_000, 69049) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -178,9 +175,9 @@ impl WeightInfo for SubstrateWeight { fn execute_overweight_page_updated() -> Weight { // Proof Size summary in bytes: // Measured: `65710` - // Estimated: `72563` - // Minimum execution time: 81_787_000 picoseconds. - Weight::from_parts(83_100_000, 72563) + // Estimated: `69049` + // Minimum execution time: 81_643_000 picoseconds. + Weight::from_parts(82_399_000, 69049) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -195,9 +192,9 @@ impl WeightInfo for () { fn ready_ring_knit() -> Weight { // Proof Size summary in bytes: // Measured: `233` - // Estimated: `7527` - // Minimum execution time: 12_561_000 picoseconds. - Weight::from_parts(12_758_000, 7527) + // Estimated: `6038` + // Minimum execution time: 12_076_000 picoseconds. + Weight::from_parts(12_350_000, 6038) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -208,9 +205,9 @@ impl WeightInfo for () { fn ready_ring_unknit() -> Weight { // Proof Size summary in bytes: // Measured: `233` - // Estimated: `7527` - // Minimum execution time: 11_854_000 picoseconds. - Weight::from_parts(12_178_000, 7527) + // Estimated: `6038` + // Minimum execution time: 11_586_000 picoseconds. + Weight::from_parts(11_912_000, 6038) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -220,8 +217,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3514` - // Minimum execution time: 7_900_000 picoseconds. - Weight::from_parts(8_046_000, 3514) + // Minimum execution time: 4_581_000 picoseconds. + Weight::from_parts(4_715_000, 3514) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -231,8 +228,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `113` // Estimated: `69049` - // Minimum execution time: 6_284_000 picoseconds. - Weight::from_parts(6_433_000, 69049) + // Minimum execution time: 5_826_000 picoseconds. + Weight::from_parts(5_932_000, 69049) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -242,8 +239,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `113` // Estimated: `69049` - // Minimum execution time: 6_418_000 picoseconds. - Weight::from_parts(6_633_000, 69049) + // Minimum execution time: 6_235_000 picoseconds. + Weight::from_parts(6_430_000, 69049) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -251,8 +248,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_661_000 picoseconds. - Weight::from_parts(52_994_000, 0) + // Minimum execution time: 53_860_000 picoseconds. + Weight::from_parts(53_984_000, 0) } /// Storage: MessageQueue ServiceHead (r:1 w:1) /// Proof: MessageQueue ServiceHead (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -261,9 +258,9 @@ impl WeightInfo for () { fn bump_service_head() -> Weight { // Proof Size summary in bytes: // Measured: `140` - // Estimated: `5003` - // Minimum execution time: 7_132_000 picoseconds. - Weight::from_parts(7_386_000, 5003) + // Estimated: `3514` + // Minimum execution time: 7_018_000 picoseconds. + Weight::from_parts(7_205_000, 3514) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -274,9 +271,9 @@ impl WeightInfo for () { fn reap_page() -> Weight { // Proof Size summary in bytes: // Measured: `65710` - // Estimated: `72563` - // Minimum execution time: 54_377_000 picoseconds. - Weight::from_parts(54_804_000, 72563) + // Estimated: `69049` + // Minimum execution time: 53_485_000 picoseconds. + Weight::from_parts(54_154_000, 69049) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -287,9 +284,9 @@ impl WeightInfo for () { fn execute_overweight_page_removed() -> Weight { // Proof Size summary in bytes: // Measured: `65710` - // Estimated: `72563` - // Minimum execution time: 69_461_000 picoseconds. - Weight::from_parts(70_016_000, 72563) + // Estimated: `69049` + // Minimum execution time: 68_830_000 picoseconds. + Weight::from_parts(69_487_000, 69049) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -300,9 +297,9 @@ impl WeightInfo for () { fn execute_overweight_page_updated() -> Weight { // Proof Size summary in bytes: // Measured: `65710` - // Estimated: `72563` - // Minimum execution time: 81_787_000 picoseconds. - Weight::from_parts(83_100_000, 72563) + // Estimated: `69049` + // Minimum execution time: 81_643_000 picoseconds. + Weight::from_parts(82_399_000, 69049) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/frame/multisig/src/weights.rs b/frame/multisig/src/weights.rs index 8941ce44f9a2b..7fda4bec8352d 100644 --- a/frame/multisig/src/weights.rs +++ b/frame/multisig/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_multisig //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_multisig -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -68,10 +65,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_096_000 picoseconds. - Weight::from_parts(12_442_958, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(494, 0).saturating_mul(z.into())) + // Minimum execution time: 12_199_000 picoseconds. + Weight::from_parts(12_595_771, 0) + // Standard Error: 2 + .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) @@ -81,12 +78,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `301 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 37_609_000 picoseconds. - Weight::from_parts(32_693_100, 6811) - // Standard Error: 449 - .saturating_add(Weight::from_parts(56_623, 0).saturating_mul(s.into())) - // Standard Error: 4 - .saturating_add(Weight::from_parts(1_203, 0).saturating_mul(z.into())) + // Minimum execution time: 42_810_000 picoseconds. + Weight::from_parts(37_500_997, 6811) + // Standard Error: 308 + .saturating_add(Weight::from_parts(59_961, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_198, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -98,12 +95,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `320` // Estimated: `6811` - // Minimum execution time: 27_434_000 picoseconds. - Weight::from_parts(22_659_090, 6811) - // Standard Error: 328 - .saturating_add(Weight::from_parts(53_508, 0).saturating_mul(s.into())) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_213, 0).saturating_mul(z.into())) + // Minimum execution time: 27_775_000 picoseconds. + Weight::from_parts(22_868_524, 6811) + // Standard Error: 273 + .saturating_add(Weight::from_parts(55_219, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_202, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -116,13 +113,13 @@ impl WeightInfo for SubstrateWeight { fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `426 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 43_592_000 picoseconds. - Weight::from_parts(36_465_266, 10404) - // Standard Error: 1_049 - .saturating_add(Weight::from_parts(78_833, 0).saturating_mul(s.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_238, 0).saturating_mul(z.into())) + // Estimated: `6811` + // Minimum execution time: 48_223_000 picoseconds. + Weight::from_parts(39_193_453, 6811) + // Standard Error: 2_162 + .saturating_add(Weight::from_parts(93_763, 0).saturating_mul(s.into())) + // Standard Error: 21 + .saturating_add(Weight::from_parts(1_372, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -133,10 +130,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `301 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 30_216_000 picoseconds. - Weight::from_parts(31_430_373, 6811) - // Standard Error: 967 - .saturating_add(Weight::from_parts(57_035, 0).saturating_mul(s.into())) + // Minimum execution time: 34_775_000 picoseconds. + Weight::from_parts(35_966_626, 6811) + // Standard Error: 464 + .saturating_add(Weight::from_parts(61_492, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -147,10 +144,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `320` // Estimated: `6811` - // Minimum execution time: 19_960_000 picoseconds. - Weight::from_parts(21_281_659, 6811) - // Standard Error: 435 - .saturating_add(Weight::from_parts(56_445, 0).saturating_mul(s.into())) + // Minimum execution time: 19_947_000 picoseconds. + Weight::from_parts(21_253_025, 6811) + // Standard Error: 402 + .saturating_add(Weight::from_parts(58_491, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -161,10 +158,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `492 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 31_219_000 picoseconds. - Weight::from_parts(32_395_963, 6811) - // Standard Error: 500 - .saturating_add(Weight::from_parts(56_853, 0).saturating_mul(s.into())) + // Minimum execution time: 35_023_000 picoseconds. + Weight::from_parts(36_756_977, 6811) + // Standard Error: 547 + .saturating_add(Weight::from_parts(62_235, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -177,10 +174,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_096_000 picoseconds. - Weight::from_parts(12_442_958, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(494, 0).saturating_mul(z.into())) + // Minimum execution time: 12_199_000 picoseconds. + Weight::from_parts(12_595_771, 0) + // Standard Error: 2 + .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) @@ -190,12 +187,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `301 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 37_609_000 picoseconds. - Weight::from_parts(32_693_100, 6811) - // Standard Error: 449 - .saturating_add(Weight::from_parts(56_623, 0).saturating_mul(s.into())) - // Standard Error: 4 - .saturating_add(Weight::from_parts(1_203, 0).saturating_mul(z.into())) + // Minimum execution time: 42_810_000 picoseconds. + Weight::from_parts(37_500_997, 6811) + // Standard Error: 308 + .saturating_add(Weight::from_parts(59_961, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_198, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -207,12 +204,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `320` // Estimated: `6811` - // Minimum execution time: 27_434_000 picoseconds. - Weight::from_parts(22_659_090, 6811) - // Standard Error: 328 - .saturating_add(Weight::from_parts(53_508, 0).saturating_mul(s.into())) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_213, 0).saturating_mul(z.into())) + // Minimum execution time: 27_775_000 picoseconds. + Weight::from_parts(22_868_524, 6811) + // Standard Error: 273 + .saturating_add(Weight::from_parts(55_219, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_202, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -225,13 +222,13 @@ impl WeightInfo for () { fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `426 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 43_592_000 picoseconds. - Weight::from_parts(36_465_266, 10404) - // Standard Error: 1_049 - .saturating_add(Weight::from_parts(78_833, 0).saturating_mul(s.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_238, 0).saturating_mul(z.into())) + // Estimated: `6811` + // Minimum execution time: 48_223_000 picoseconds. + Weight::from_parts(39_193_453, 6811) + // Standard Error: 2_162 + .saturating_add(Weight::from_parts(93_763, 0).saturating_mul(s.into())) + // Standard Error: 21 + .saturating_add(Weight::from_parts(1_372, 0).saturating_mul(z.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -242,10 +239,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `301 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 30_216_000 picoseconds. - Weight::from_parts(31_430_373, 6811) - // Standard Error: 967 - .saturating_add(Weight::from_parts(57_035, 0).saturating_mul(s.into())) + // Minimum execution time: 34_775_000 picoseconds. + Weight::from_parts(35_966_626, 6811) + // Standard Error: 464 + .saturating_add(Weight::from_parts(61_492, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -256,10 +253,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `320` // Estimated: `6811` - // Minimum execution time: 19_960_000 picoseconds. - Weight::from_parts(21_281_659, 6811) - // Standard Error: 435 - .saturating_add(Weight::from_parts(56_445, 0).saturating_mul(s.into())) + // Minimum execution time: 19_947_000 picoseconds. + Weight::from_parts(21_253_025, 6811) + // Standard Error: 402 + .saturating_add(Weight::from_parts(58_491, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -270,10 +267,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `492 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 31_219_000 picoseconds. - Weight::from_parts(32_395_963, 6811) - // Standard Error: 500 - .saturating_add(Weight::from_parts(56_853, 0).saturating_mul(s.into())) + // Minimum execution time: 35_023_000 picoseconds. + Weight::from_parts(36_756_977, 6811) + // Standard Error: 547 + .saturating_add(Weight::from_parts(62_235, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/nfts/src/weights.rs b/frame/nfts/src/weights.rs index c5010a73cc7cb..19a61974a61a7 100644 --- a/frame/nfts/src/weights.rs +++ b/frame/nfts/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_nfts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_nfts -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -108,9 +105,9 @@ impl WeightInfo for SubstrateWeight { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `182` - // Estimated: `5038` - // Minimum execution time: 36_780_000 picoseconds. - Weight::from_parts(37_508_000, 5038) + // Estimated: `3549` + // Minimum execution time: 40_664_000 picoseconds. + Weight::from_parts(41_224_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -127,9 +124,9 @@ impl WeightInfo for SubstrateWeight { fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `5038` - // Minimum execution time: 25_144_000 picoseconds. - Weight::from_parts(25_800_000, 5038) + // Estimated: `3549` + // Minimum execution time: 24_725_000 picoseconds. + Weight::from_parts(25_147_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -152,16 +149,14 @@ impl WeightInfo for SubstrateWeight { /// The range of component `m` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. /// The range of component `a` is `[0, 1000]`. - fn destroy(m: u32, _c: u32, a: u32, ) -> Weight { + fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32186 + a * (332 ±0)` - // Estimated: `2538589 + a * (2921 ±0)` - // Minimum execution time: 1_122_858_000 picoseconds. - Weight::from_parts(1_094_711_913, 2538589) - // Standard Error: 4_485 - .saturating_add(Weight::from_parts(3_481, 0).saturating_mul(m.into())) - // Standard Error: 4_485 - .saturating_add(Weight::from_parts(5_520_602, 0).saturating_mul(a.into())) + // Estimated: `2523990 + a * (2921 ±0)` + // Minimum execution time: 1_100_509_000 picoseconds. + Weight::from_parts(1_081_634_178, 2523990) + // Standard Error: 3_025 + .saturating_add(Weight::from_parts(5_339_415, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(1004_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1005_u64)) @@ -183,9 +178,9 @@ impl WeightInfo for SubstrateWeight { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `421` - // Estimated: `18460` - // Minimum execution time: 48_590_000 picoseconds. - Weight::from_parts(49_260_000, 18460) + // Estimated: `4326` + // Minimum execution time: 52_464_000 picoseconds. + Weight::from_parts(52_847_000, 4326) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -204,9 +199,9 @@ impl WeightInfo for SubstrateWeight { fn force_mint() -> Weight { // Proof Size summary in bytes: // Measured: `421` - // Estimated: `18460` - // Minimum execution time: 46_646_000 picoseconds. - Weight::from_parts(47_331_000, 18460) + // Estimated: `4326` + // Minimum execution time: 50_327_000 picoseconds. + Weight::from_parts(51_093_000, 4326) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -229,9 +224,9 @@ impl WeightInfo for SubstrateWeight { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `14993` - // Minimum execution time: 46_976_000 picoseconds. - Weight::from_parts(47_606_000, 14993) + // Estimated: `4326` + // Minimum execution time: 51_342_000 picoseconds. + Weight::from_parts(51_846_000, 4326) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -252,9 +247,9 @@ impl WeightInfo for SubstrateWeight { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `14926` - // Minimum execution time: 38_013_000 picoseconds. - Weight::from_parts(38_420_000, 14926) + // Estimated: `4326` + // Minimum execution time: 38_309_000 picoseconds. + Weight::from_parts(38_672_000, 4326) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -268,11 +263,11 @@ impl WeightInfo for SubstrateWeight { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `729 + i * (108 ±0)` - // Estimated: `8077 + i * (3336 ±0)` - // Minimum execution time: 17_428_000 picoseconds. - Weight::from_parts(17_664_000, 8077) - // Standard Error: 16_385 - .saturating_add(Weight::from_parts(14_150_405, 0).saturating_mul(i.into())) + // Estimated: `3549 + i * (3336 ±0)` + // Minimum execution time: 17_525_000 picoseconds. + Weight::from_parts(17_657_000, 3549) + // Standard Error: 15_884 + .saturating_add(Weight::from_parts(16_026_633, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) @@ -285,9 +280,9 @@ impl WeightInfo for SubstrateWeight { fn lock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 21_760_000 picoseconds. - Weight::from_parts(22_063_000, 7047) + // Estimated: `3534` + // Minimum execution time: 21_814_000 picoseconds. + Weight::from_parts(22_171_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -298,9 +293,9 @@ impl WeightInfo for SubstrateWeight { fn unlock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 21_622_000 picoseconds. - Weight::from_parts(22_056_000, 7047) + // Estimated: `3534` + // Minimum execution time: 21_728_000 picoseconds. + Weight::from_parts(21_893_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -311,9 +306,9 @@ impl WeightInfo for SubstrateWeight { fn lock_collection() -> Weight { // Proof Size summary in bytes: // Measured: `306` - // Estimated: `7087` - // Minimum execution time: 18_820_000 picoseconds. - Weight::from_parts(19_212_000, 7087) + // Estimated: `3549` + // Minimum execution time: 18_359_000 picoseconds. + Weight::from_parts(19_101_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -326,9 +321,9 @@ impl WeightInfo for SubstrateWeight { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `354` - // Estimated: `7066` - // Minimum execution time: 25_433_000 picoseconds. - Weight::from_parts(25_793_000, 7066) + // Estimated: `3549` + // Minimum execution time: 24_713_000 picoseconds. + Weight::from_parts(25_032_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -339,9 +334,9 @@ impl WeightInfo for SubstrateWeight { fn set_team() -> Weight { // Proof Size summary in bytes: // Measured: `335` - // Estimated: `9627` - // Minimum execution time: 43_368_000 picoseconds. - Weight::from_parts(43_974_000, 9627) + // Estimated: `6078` + // Minimum execution time: 42_372_000 picoseconds. + Weight::from_parts(42_971_000, 6078) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -353,8 +348,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `277` // Estimated: `3549` - // Minimum execution time: 20_009_000 picoseconds. - Weight::from_parts(20_220_000, 3549) + // Minimum execution time: 19_703_000 picoseconds. + Weight::from_parts(19_993_000, 3549) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -366,8 +361,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `242` // Estimated: `3549` - // Minimum execution time: 16_048_000 picoseconds. - Weight::from_parts(16_353_000, 3549) + // Minimum execution time: 15_500_000 picoseconds. + Weight::from_parts(15_929_000, 3549) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -378,9 +373,9 @@ impl WeightInfo for SubstrateWeight { fn lock_item_properties() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 20_890_000 picoseconds. - Weight::from_parts(21_237_000, 7047) + // Estimated: `3534` + // Minimum execution time: 20_778_000 picoseconds. + Weight::from_parts(21_187_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -397,9 +392,9 @@ impl WeightInfo for SubstrateWeight { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `505` - // Estimated: `18045` - // Minimum execution time: 50_686_000 picoseconds. - Weight::from_parts(50_981_000, 18045) + // Estimated: `3911` + // Minimum execution time: 53_016_000 picoseconds. + Weight::from_parts(53_579_000, 3911) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -410,9 +405,9 @@ impl WeightInfo for SubstrateWeight { fn force_set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `310` - // Estimated: `7460` - // Minimum execution time: 28_714_000 picoseconds. - Weight::from_parts(29_044_000, 7460) + // Estimated: `3911` + // Minimum execution time: 28_790_000 picoseconds. + Weight::from_parts(29_157_000, 3911) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -427,9 +422,9 @@ impl WeightInfo for SubstrateWeight { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `916` - // Estimated: `14507` - // Minimum execution time: 46_232_000 picoseconds. - Weight::from_parts(46_738_000, 14507) + // Estimated: `3911` + // Minimum execution time: 48_584_000 picoseconds. + Weight::from_parts(49_202_000, 3911) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -440,9 +435,9 @@ impl WeightInfo for SubstrateWeight { fn approve_item_attributes() -> Weight { // Proof Size summary in bytes: // Measured: `347` - // Estimated: `8472` - // Minimum execution time: 19_332_000 picoseconds. - Weight::from_parts(19_765_000, 8472) + // Estimated: `4326` + // Minimum execution time: 19_616_000 picoseconds. + Weight::from_parts(19_972_000, 4326) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -458,11 +453,11 @@ impl WeightInfo for SubstrateWeight { fn cancel_item_attributes_approval(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `803 + n * (364 ±0)` - // Estimated: `15976 + n * (2921 ±0)` - // Minimum execution time: 29_227_000 picoseconds. - Weight::from_parts(29_661_000, 15976) - // Standard Error: 3_574 - .saturating_add(Weight::from_parts(5_442_937, 0).saturating_mul(n.into())) + // Estimated: `4326 + n * (2921 ±0)` + // Minimum execution time: 28_897_000 picoseconds. + Weight::from_parts(29_061_000, 4326) + // Standard Error: 3_139 + .saturating_add(Weight::from_parts(5_396_415, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -482,9 +477,9 @@ impl WeightInfo for SubstrateWeight { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `505` - // Estimated: `17739` - // Minimum execution time: 41_297_000 picoseconds. - Weight::from_parts(41_902_000, 17739) + // Estimated: `3605` + // Minimum execution time: 43_748_000 picoseconds. + Weight::from_parts(44_178_000, 3605) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -499,9 +494,9 @@ impl WeightInfo for SubstrateWeight { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `608` - // Estimated: `14201` - // Minimum execution time: 39_312_000 picoseconds. - Weight::from_parts(40_048_000, 14201) + // Estimated: `3605` + // Minimum execution time: 42_116_000 picoseconds. + Weight::from_parts(42_455_000, 3605) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -516,9 +511,9 @@ impl WeightInfo for SubstrateWeight { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `364` - // Estimated: `14173` - // Minimum execution time: 36_932_000 picoseconds. - Weight::from_parts(38_207_000, 14173) + // Estimated: `3552` + // Minimum execution time: 40_926_000 picoseconds. + Weight::from_parts(41_512_000, 3552) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -533,9 +528,9 @@ impl WeightInfo for SubstrateWeight { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `475` - // Estimated: `14173` - // Minimum execution time: 35_264_000 picoseconds. - Weight::from_parts(35_829_000, 14173) + // Estimated: `3552` + // Minimum execution time: 39_792_000 picoseconds. + Weight::from_parts(40_443_000, 3552) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -546,9 +541,9 @@ impl WeightInfo for SubstrateWeight { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `376` - // Estimated: `7864` - // Minimum execution time: 22_819_000 picoseconds. - Weight::from_parts(23_121_000, 7864) + // Estimated: `4326` + // Minimum execution time: 22_648_000 picoseconds. + Weight::from_parts(23_139_000, 4326) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -558,8 +553,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4326` - // Minimum execution time: 20_377_000 picoseconds. - Weight::from_parts(20_625_000, 4326) + // Minimum execution time: 20_552_000 picoseconds. + Weight::from_parts(20_920_000, 4326) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -569,8 +564,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4326` - // Minimum execution time: 19_180_000 picoseconds. - Weight::from_parts(19_468_000, 4326) + // Minimum execution time: 19_114_000 picoseconds. + Weight::from_parts(19_876_000, 4326) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -580,8 +575,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3517` - // Minimum execution time: 17_381_000 picoseconds. - Weight::from_parts(17_718_000, 3517) + // Minimum execution time: 17_089_000 picoseconds. + Weight::from_parts(17_363_000, 3517) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -592,9 +587,9 @@ impl WeightInfo for SubstrateWeight { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `306` - // Estimated: `7087` - // Minimum execution time: 20_373_000 picoseconds. - Weight::from_parts(20_662_000, 7087) + // Estimated: `3549` + // Minimum execution time: 20_667_000 picoseconds. + Weight::from_parts(20_898_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -605,9 +600,9 @@ impl WeightInfo for SubstrateWeight { fn update_mint_settings() -> Weight { // Proof Size summary in bytes: // Measured: `289` - // Estimated: `7072` - // Minimum execution time: 20_154_000 picoseconds. - Weight::from_parts(20_592_000, 7072) + // Estimated: `3538` + // Minimum execution time: 19_666_000 picoseconds. + Weight::from_parts(20_136_000, 3538) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -622,9 +617,9 @@ impl WeightInfo for SubstrateWeight { fn set_price() -> Weight { // Proof Size summary in bytes: // Measured: `484` - // Estimated: `11377` - // Minimum execution time: 25_644_000 picoseconds. - Weight::from_parts(25_999_000, 11377) + // Estimated: `4326` + // Minimum execution time: 25_778_000 picoseconds. + Weight::from_parts(26_447_000, 4326) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -645,9 +640,9 @@ impl WeightInfo for SubstrateWeight { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `671` - // Estimated: `18480` - // Minimum execution time: 51_542_000 picoseconds. - Weight::from_parts(52_203_000, 18480) + // Estimated: `4326` + // Minimum execution time: 50_809_000 picoseconds. + Weight::from_parts(51_503_000, 4326) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -656,10 +651,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_796_000 picoseconds. - Weight::from_parts(5_517_617, 0) - // Standard Error: 14_247 - .saturating_add(Weight::from_parts(3_757_796, 0).saturating_mul(n.into())) + // Minimum execution time: 2_789_000 picoseconds. + Weight::from_parts(5_528_034, 0) + // Standard Error: 14_405 + .saturating_add(Weight::from_parts(3_788_038, 0).saturating_mul(n.into())) } /// Storage: Nfts Item (r:2 w:0) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) @@ -669,8 +664,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `460` // Estimated: `7662` - // Minimum execution time: 23_218_000 picoseconds. - Weight::from_parts(23_590_000, 7662) + // Minimum execution time: 22_884_000 picoseconds. + Weight::from_parts(23_732_000, 7662) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -681,9 +676,9 @@ impl WeightInfo for SubstrateWeight { fn cancel_swap() -> Weight { // Proof Size summary in bytes: // Measured: `479` - // Estimated: `7862` - // Minimum execution time: 22_536_000 picoseconds. - Weight::from_parts(22_874_000, 7862) + // Estimated: `4326` + // Minimum execution time: 22_686_000 picoseconds. + Weight::from_parts(23_088_000, 4326) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -704,9 +699,9 @@ impl WeightInfo for SubstrateWeight { fn claim_swap() -> Weight { // Proof Size summary in bytes: // Measured: `800` - // Estimated: `24321` - // Minimum execution time: 77_372_000 picoseconds. - Weight::from_parts(78_109_000, 24321) + // Estimated: `7662` + // Minimum execution time: 77_494_000 picoseconds. + Weight::from_parts(78_650_000, 7662) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -732,11 +727,11 @@ impl WeightInfo for SubstrateWeight { fn mint_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `595` - // Estimated: `29192 + n * (2921 ±0)` - // Minimum execution time: 131_935_000 picoseconds. - Weight::from_parts(137_455_891, 29192) - // Standard Error: 31_617 - .saturating_add(Weight::from_parts(27_550_750, 0).saturating_mul(n.into())) + // Estimated: `6078 + n * (2921 ±0)` + // Minimum execution time: 139_109_000 picoseconds. + Weight::from_parts(144_449_034, 6078) + // Standard Error: 26_869 + .saturating_add(Weight::from_parts(29_961_772, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(6_u64)) @@ -759,11 +754,11 @@ impl WeightInfo for SubstrateWeight { fn set_attributes_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `625` - // Estimated: `20142 + n * (2921 ±0)` - // Minimum execution time: 77_694_000 picoseconds. - Weight::from_parts(90_089_732, 20142) - // Standard Error: 71_327 - .saturating_add(Weight::from_parts(27_832_189, 0).saturating_mul(n.into())) + // Estimated: `4326 + n * (2921 ±0)` + // Minimum execution time: 78_280_000 picoseconds. + Weight::from_parts(92_826_883, 4326) + // Standard Error: 81_125 + .saturating_add(Weight::from_parts(29_898_245, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -787,9 +782,9 @@ impl WeightInfo for () { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `182` - // Estimated: `5038` - // Minimum execution time: 36_780_000 picoseconds. - Weight::from_parts(37_508_000, 5038) + // Estimated: `3549` + // Minimum execution time: 40_664_000 picoseconds. + Weight::from_parts(41_224_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -806,9 +801,9 @@ impl WeightInfo for () { fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `5038` - // Minimum execution time: 25_144_000 picoseconds. - Weight::from_parts(25_800_000, 5038) + // Estimated: `3549` + // Minimum execution time: 24_725_000 picoseconds. + Weight::from_parts(25_147_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -831,16 +826,14 @@ impl WeightInfo for () { /// The range of component `m` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. /// The range of component `a` is `[0, 1000]`. - fn destroy(m: u32, _c: u32, a: u32, ) -> Weight { + fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32186 + a * (332 ±0)` - // Estimated: `2538589 + a * (2921 ±0)` - // Minimum execution time: 1_122_858_000 picoseconds. - Weight::from_parts(1_094_711_913, 2538589) - // Standard Error: 4_485 - .saturating_add(Weight::from_parts(3_481, 0).saturating_mul(m.into())) - // Standard Error: 4_485 - .saturating_add(Weight::from_parts(5_520_602, 0).saturating_mul(a.into())) + // Estimated: `2523990 + a * (2921 ±0)` + // Minimum execution time: 1_100_509_000 picoseconds. + Weight::from_parts(1_081_634_178, 2523990) + // Standard Error: 3_025 + .saturating_add(Weight::from_parts(5_339_415, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(1004_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(RocksDbWeight::get().writes(1005_u64)) @@ -862,9 +855,9 @@ impl WeightInfo for () { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `421` - // Estimated: `18460` - // Minimum execution time: 48_590_000 picoseconds. - Weight::from_parts(49_260_000, 18460) + // Estimated: `4326` + // Minimum execution time: 52_464_000 picoseconds. + Weight::from_parts(52_847_000, 4326) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -883,9 +876,9 @@ impl WeightInfo for () { fn force_mint() -> Weight { // Proof Size summary in bytes: // Measured: `421` - // Estimated: `18460` - // Minimum execution time: 46_646_000 picoseconds. - Weight::from_parts(47_331_000, 18460) + // Estimated: `4326` + // Minimum execution time: 50_327_000 picoseconds. + Weight::from_parts(51_093_000, 4326) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -908,9 +901,9 @@ impl WeightInfo for () { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `14993` - // Minimum execution time: 46_976_000 picoseconds. - Weight::from_parts(47_606_000, 14993) + // Estimated: `4326` + // Minimum execution time: 51_342_000 picoseconds. + Weight::from_parts(51_846_000, 4326) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -931,9 +924,9 @@ impl WeightInfo for () { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `14926` - // Minimum execution time: 38_013_000 picoseconds. - Weight::from_parts(38_420_000, 14926) + // Estimated: `4326` + // Minimum execution time: 38_309_000 picoseconds. + Weight::from_parts(38_672_000, 4326) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -947,11 +940,11 @@ impl WeightInfo for () { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `729 + i * (108 ±0)` - // Estimated: `8077 + i * (3336 ±0)` - // Minimum execution time: 17_428_000 picoseconds. - Weight::from_parts(17_664_000, 8077) - // Standard Error: 16_385 - .saturating_add(Weight::from_parts(14_150_405, 0).saturating_mul(i.into())) + // Estimated: `3549 + i * (3336 ±0)` + // Minimum execution time: 17_525_000 picoseconds. + Weight::from_parts(17_657_000, 3549) + // Standard Error: 15_884 + .saturating_add(Weight::from_parts(16_026_633, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) @@ -964,9 +957,9 @@ impl WeightInfo for () { fn lock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 21_760_000 picoseconds. - Weight::from_parts(22_063_000, 7047) + // Estimated: `3534` + // Minimum execution time: 21_814_000 picoseconds. + Weight::from_parts(22_171_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -977,9 +970,9 @@ impl WeightInfo for () { fn unlock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 21_622_000 picoseconds. - Weight::from_parts(22_056_000, 7047) + // Estimated: `3534` + // Minimum execution time: 21_728_000 picoseconds. + Weight::from_parts(21_893_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -990,9 +983,9 @@ impl WeightInfo for () { fn lock_collection() -> Weight { // Proof Size summary in bytes: // Measured: `306` - // Estimated: `7087` - // Minimum execution time: 18_820_000 picoseconds. - Weight::from_parts(19_212_000, 7087) + // Estimated: `3549` + // Minimum execution time: 18_359_000 picoseconds. + Weight::from_parts(19_101_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1005,9 +998,9 @@ impl WeightInfo for () { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `354` - // Estimated: `7066` - // Minimum execution time: 25_433_000 picoseconds. - Weight::from_parts(25_793_000, 7066) + // Estimated: `3549` + // Minimum execution time: 24_713_000 picoseconds. + Weight::from_parts(25_032_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1018,9 +1011,9 @@ impl WeightInfo for () { fn set_team() -> Weight { // Proof Size summary in bytes: // Measured: `335` - // Estimated: `9627` - // Minimum execution time: 43_368_000 picoseconds. - Weight::from_parts(43_974_000, 9627) + // Estimated: `6078` + // Minimum execution time: 42_372_000 picoseconds. + Weight::from_parts(42_971_000, 6078) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1032,8 +1025,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `277` // Estimated: `3549` - // Minimum execution time: 20_009_000 picoseconds. - Weight::from_parts(20_220_000, 3549) + // Minimum execution time: 19_703_000 picoseconds. + Weight::from_parts(19_993_000, 3549) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1045,8 +1038,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `242` // Estimated: `3549` - // Minimum execution time: 16_048_000 picoseconds. - Weight::from_parts(16_353_000, 3549) + // Minimum execution time: 15_500_000 picoseconds. + Weight::from_parts(15_929_000, 3549) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1057,9 +1050,9 @@ impl WeightInfo for () { fn lock_item_properties() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 20_890_000 picoseconds. - Weight::from_parts(21_237_000, 7047) + // Estimated: `3534` + // Minimum execution time: 20_778_000 picoseconds. + Weight::from_parts(21_187_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1076,9 +1069,9 @@ impl WeightInfo for () { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `505` - // Estimated: `18045` - // Minimum execution time: 50_686_000 picoseconds. - Weight::from_parts(50_981_000, 18045) + // Estimated: `3911` + // Minimum execution time: 53_016_000 picoseconds. + Weight::from_parts(53_579_000, 3911) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1089,9 +1082,9 @@ impl WeightInfo for () { fn force_set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `310` - // Estimated: `7460` - // Minimum execution time: 28_714_000 picoseconds. - Weight::from_parts(29_044_000, 7460) + // Estimated: `3911` + // Minimum execution time: 28_790_000 picoseconds. + Weight::from_parts(29_157_000, 3911) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1106,9 +1099,9 @@ impl WeightInfo for () { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `916` - // Estimated: `14507` - // Minimum execution time: 46_232_000 picoseconds. - Weight::from_parts(46_738_000, 14507) + // Estimated: `3911` + // Minimum execution time: 48_584_000 picoseconds. + Weight::from_parts(49_202_000, 3911) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1119,9 +1112,9 @@ impl WeightInfo for () { fn approve_item_attributes() -> Weight { // Proof Size summary in bytes: // Measured: `347` - // Estimated: `8472` - // Minimum execution time: 19_332_000 picoseconds. - Weight::from_parts(19_765_000, 8472) + // Estimated: `4326` + // Minimum execution time: 19_616_000 picoseconds. + Weight::from_parts(19_972_000, 4326) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1137,11 +1130,11 @@ impl WeightInfo for () { fn cancel_item_attributes_approval(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `803 + n * (364 ±0)` - // Estimated: `15976 + n * (2921 ±0)` - // Minimum execution time: 29_227_000 picoseconds. - Weight::from_parts(29_661_000, 15976) - // Standard Error: 3_574 - .saturating_add(Weight::from_parts(5_442_937, 0).saturating_mul(n.into())) + // Estimated: `4326 + n * (2921 ±0)` + // Minimum execution time: 28_897_000 picoseconds. + Weight::from_parts(29_061_000, 4326) + // Standard Error: 3_139 + .saturating_add(Weight::from_parts(5_396_415, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -1161,9 +1154,9 @@ impl WeightInfo for () { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `505` - // Estimated: `17739` - // Minimum execution time: 41_297_000 picoseconds. - Weight::from_parts(41_902_000, 17739) + // Estimated: `3605` + // Minimum execution time: 43_748_000 picoseconds. + Weight::from_parts(44_178_000, 3605) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1178,9 +1171,9 @@ impl WeightInfo for () { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `608` - // Estimated: `14201` - // Minimum execution time: 39_312_000 picoseconds. - Weight::from_parts(40_048_000, 14201) + // Estimated: `3605` + // Minimum execution time: 42_116_000 picoseconds. + Weight::from_parts(42_455_000, 3605) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1195,9 +1188,9 @@ impl WeightInfo for () { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `364` - // Estimated: `14173` - // Minimum execution time: 36_932_000 picoseconds. - Weight::from_parts(38_207_000, 14173) + // Estimated: `3552` + // Minimum execution time: 40_926_000 picoseconds. + Weight::from_parts(41_512_000, 3552) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1212,9 +1205,9 @@ impl WeightInfo for () { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `475` - // Estimated: `14173` - // Minimum execution time: 35_264_000 picoseconds. - Weight::from_parts(35_829_000, 14173) + // Estimated: `3552` + // Minimum execution time: 39_792_000 picoseconds. + Weight::from_parts(40_443_000, 3552) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1225,9 +1218,9 @@ impl WeightInfo for () { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `376` - // Estimated: `7864` - // Minimum execution time: 22_819_000 picoseconds. - Weight::from_parts(23_121_000, 7864) + // Estimated: `4326` + // Minimum execution time: 22_648_000 picoseconds. + Weight::from_parts(23_139_000, 4326) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1237,8 +1230,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4326` - // Minimum execution time: 20_377_000 picoseconds. - Weight::from_parts(20_625_000, 4326) + // Minimum execution time: 20_552_000 picoseconds. + Weight::from_parts(20_920_000, 4326) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1248,8 +1241,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4326` - // Minimum execution time: 19_180_000 picoseconds. - Weight::from_parts(19_468_000, 4326) + // Minimum execution time: 19_114_000 picoseconds. + Weight::from_parts(19_876_000, 4326) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1259,8 +1252,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3517` - // Minimum execution time: 17_381_000 picoseconds. - Weight::from_parts(17_718_000, 3517) + // Minimum execution time: 17_089_000 picoseconds. + Weight::from_parts(17_363_000, 3517) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1271,9 +1264,9 @@ impl WeightInfo for () { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `306` - // Estimated: `7087` - // Minimum execution time: 20_373_000 picoseconds. - Weight::from_parts(20_662_000, 7087) + // Estimated: `3549` + // Minimum execution time: 20_667_000 picoseconds. + Weight::from_parts(20_898_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1284,9 +1277,9 @@ impl WeightInfo for () { fn update_mint_settings() -> Weight { // Proof Size summary in bytes: // Measured: `289` - // Estimated: `7072` - // Minimum execution time: 20_154_000 picoseconds. - Weight::from_parts(20_592_000, 7072) + // Estimated: `3538` + // Minimum execution time: 19_666_000 picoseconds. + Weight::from_parts(20_136_000, 3538) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1301,9 +1294,9 @@ impl WeightInfo for () { fn set_price() -> Weight { // Proof Size summary in bytes: // Measured: `484` - // Estimated: `11377` - // Minimum execution time: 25_644_000 picoseconds. - Weight::from_parts(25_999_000, 11377) + // Estimated: `4326` + // Minimum execution time: 25_778_000 picoseconds. + Weight::from_parts(26_447_000, 4326) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1324,9 +1317,9 @@ impl WeightInfo for () { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `671` - // Estimated: `18480` - // Minimum execution time: 51_542_000 picoseconds. - Weight::from_parts(52_203_000, 18480) + // Estimated: `4326` + // Minimum execution time: 50_809_000 picoseconds. + Weight::from_parts(51_503_000, 4326) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1335,10 +1328,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_796_000 picoseconds. - Weight::from_parts(5_517_617, 0) - // Standard Error: 14_247 - .saturating_add(Weight::from_parts(3_757_796, 0).saturating_mul(n.into())) + // Minimum execution time: 2_789_000 picoseconds. + Weight::from_parts(5_528_034, 0) + // Standard Error: 14_405 + .saturating_add(Weight::from_parts(3_788_038, 0).saturating_mul(n.into())) } /// Storage: Nfts Item (r:2 w:0) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) @@ -1348,8 +1341,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `460` // Estimated: `7662` - // Minimum execution time: 23_218_000 picoseconds. - Weight::from_parts(23_590_000, 7662) + // Minimum execution time: 22_884_000 picoseconds. + Weight::from_parts(23_732_000, 7662) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1360,9 +1353,9 @@ impl WeightInfo for () { fn cancel_swap() -> Weight { // Proof Size summary in bytes: // Measured: `479` - // Estimated: `7862` - // Minimum execution time: 22_536_000 picoseconds. - Weight::from_parts(22_874_000, 7862) + // Estimated: `4326` + // Minimum execution time: 22_686_000 picoseconds. + Weight::from_parts(23_088_000, 4326) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1383,9 +1376,9 @@ impl WeightInfo for () { fn claim_swap() -> Weight { // Proof Size summary in bytes: // Measured: `800` - // Estimated: `24321` - // Minimum execution time: 77_372_000 picoseconds. - Weight::from_parts(78_109_000, 24321) + // Estimated: `7662` + // Minimum execution time: 77_494_000 picoseconds. + Weight::from_parts(78_650_000, 7662) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -1411,11 +1404,11 @@ impl WeightInfo for () { fn mint_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `595` - // Estimated: `29192 + n * (2921 ±0)` - // Minimum execution time: 131_935_000 picoseconds. - Weight::from_parts(137_455_891, 29192) - // Standard Error: 31_617 - .saturating_add(Weight::from_parts(27_550_750, 0).saturating_mul(n.into())) + // Estimated: `6078 + n * (2921 ±0)` + // Minimum execution time: 139_109_000 picoseconds. + Weight::from_parts(144_449_034, 6078) + // Standard Error: 26_869 + .saturating_add(Weight::from_parts(29_961_772, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(6_u64)) @@ -1438,11 +1431,11 @@ impl WeightInfo for () { fn set_attributes_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `625` - // Estimated: `20142 + n * (2921 ±0)` - // Minimum execution time: 77_694_000 picoseconds. - Weight::from_parts(90_089_732, 20142) - // Standard Error: 71_327 - .saturating_add(Weight::from_parts(27_832_189, 0).saturating_mul(n.into())) + // Estimated: `4326 + n * (2921 ±0)` + // Minimum execution time: 78_280_000 picoseconds. + Weight::from_parts(92_826_883, 4326) + // Standard Error: 81_125 + .saturating_add(Weight::from_parts(29_898_245, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) diff --git a/frame/nis/src/weights.rs b/frame/nis/src/weights.rs index 14b7b4d9c6f9a..4f92da874b5a2 100644 --- a/frame/nis/src/weights.rs +++ b/frame/nis/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_nis //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_nis -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -55,10 +52,10 @@ pub trait WeightInfo { fn place_bid_max() -> Weight; fn retract_bid(l: u32, ) -> Weight; fn fund_deficit() -> Weight; + fn communify() -> Weight; + fn privatize() -> Weight; fn thaw_private() -> Weight; fn thaw_communal() -> Weight; - fn privatize() -> Weight; - fn communify() -> Weight; fn process_queues() -> Weight; fn process_queue() -> Weight; fn process_bid() -> Weight; @@ -69,52 +66,52 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { /// Storage: Nis Queues (r:1 w:1) /// Proof: Nis Queues (max_values: None, max_size: Some(48022), added: 50497, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) /// Storage: Nis QueueTotals (r:1 w:1) /// Proof: Nis QueueTotals (max_values: Some(1), max_size: Some(6002), added: 6497, mode: MaxEncodedLen) /// The range of component `l` is `[0, 999]`. fn place_bid(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `6182 + l * (48 ±0)` - // Estimated: `63688` - // Minimum execution time: 31_160_000 picoseconds. - Weight::from_parts(39_023_414, 63688) - // Standard Error: 214 - .saturating_add(Weight::from_parts(46_106, 0).saturating_mul(l.into())) + // Measured: `6175 + l * (48 ±0)` + // Estimated: `51487` + // Minimum execution time: 49_132_000 picoseconds. + Weight::from_parts(55_373_619, 51487) + // Standard Error: 198 + .saturating_add(Weight::from_parts(44_421, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Nis Queues (r:1 w:1) /// Proof: Nis Queues (max_values: None, max_size: Some(48022), added: 50497, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) /// Storage: Nis QueueTotals (r:1 w:1) /// Proof: Nis QueueTotals (max_values: Some(1), max_size: Some(6002), added: 6497, mode: MaxEncodedLen) fn place_bid_max() -> Weight { // Proof Size summary in bytes: - // Measured: `54184` - // Estimated: `63688` - // Minimum execution time: 85_703_000 picoseconds. - Weight::from_parts(86_613_000, 63688) + // Measured: `54177` + // Estimated: `51487` + // Minimum execution time: 111_471_000 picoseconds. + Weight::from_parts(112_287_000, 51487) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Nis Queues (r:1 w:1) /// Proof: Nis Queues (max_values: None, max_size: Some(48022), added: 50497, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) /// Storage: Nis QueueTotals (r:1 w:1) /// Proof: Nis QueueTotals (max_values: Some(1), max_size: Some(6002), added: 6497, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) /// The range of component `l` is `[1, 1000]`. fn retract_bid(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `6182 + l * (48 ±0)` - // Estimated: `63688` - // Minimum execution time: 37_637_000 picoseconds. - Weight::from_parts(39_977_788, 63688) - // Standard Error: 152 - .saturating_add(Weight::from_parts(34_595, 0).saturating_mul(l.into())) + // Measured: `6175 + l * (48 ±0)` + // Estimated: `51487` + // Minimum execution time: 51_134_000 picoseconds. + Weight::from_parts(52_353_883, 51487) + // Standard Error: 161 + .saturating_add(Weight::from_parts(62_171, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -125,47 +122,32 @@ impl WeightInfo for SubstrateWeight { fn fund_deficit() -> Weight { // Proof Size summary in bytes: // Measured: `191` - // Estimated: `5118` - // Minimum execution time: 35_807_000 picoseconds. - Weight::from_parts(36_329_000, 5118) + // Estimated: `3593` + // Minimum execution time: 41_421_000 picoseconds. + Weight::from_parts(41_762_000, 3593) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Nis Receipts (r:1 w:1) /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) - /// Storage: Nis Summary (r:1 w:1) - /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:0) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) - fn thaw_private() -> Weight { - // Proof Size summary in bytes: - // Measured: `360` - // Estimated: `13378` - // Minimum execution time: 51_342_000 picoseconds. - Weight::from_parts(51_976_000, 13378) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - } - /// Storage: Nis Receipts (r:1 w:1) - /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) /// Storage: Nis Summary (r:1 w:1) /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn thaw_communal() -> Weight { + fn communify() -> Weight { // Proof Size summary in bytes: - // Measured: `773` - // Estimated: `15906` - // Minimum execution time: 76_535_000 picoseconds. - Weight::from_parts(78_073_000, 15906) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(5_u64)) + // Measured: `667` + // Estimated: `3675` + // Minimum execution time: 74_179_000 picoseconds. + Weight::from_parts(74_795_000, 3675) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: Nis Receipts (r:1 w:1) /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) @@ -177,37 +159,52 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) fn privatize() -> Weight { // Proof Size summary in bytes: - // Measured: `835` - // Estimated: `20620` - // Minimum execution time: 84_680_000 picoseconds. - Weight::from_parts(85_661_000, 20620) + // Measured: `828` + // Estimated: `3675` + // Minimum execution time: 85_252_000 picoseconds. + Weight::from_parts(85_949_000, 3675) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: Nis Receipts (r:1 w:1) /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: Nis Summary (r:1 w:1) + /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) + fn thaw_private() -> Weight { + // Proof Size summary in bytes: + // Measured: `456` + // Estimated: `3593` + // Minimum execution time: 82_100_000 picoseconds. + Weight::from_parts(82_563_000, 3593) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: Nis Receipts (r:1 w:1) + /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) /// Storage: Nis Summary (r:1 w:1) /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) - fn communify() -> Weight { + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn thaw_communal() -> Weight { // Proof Size summary in bytes: - // Measured: `674` - // Estimated: `20620` - // Minimum execution time: 72_828_000 picoseconds. - Weight::from_parts(73_553_000, 20620) - .saturating_add(T::DbWeight::get().reads(6_u64)) - .saturating_add(T::DbWeight::get().writes(6_u64)) + // Measured: `773` + // Estimated: `3675` + // Minimum execution time: 86_498_000 picoseconds. + Weight::from_parts(87_175_000, 3675) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Nis Summary (r:1 w:1) /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) @@ -218,9 +215,9 @@ impl WeightInfo for SubstrateWeight { fn process_queues() -> Weight { // Proof Size summary in bytes: // Measured: `6624` - // Estimated: `12605` - // Minimum execution time: 23_311_000 picoseconds. - Weight::from_parts(23_855_000, 12605) + // Estimated: `7487` + // Minimum execution time: 22_507_000 picoseconds. + Weight::from_parts(22_788_000, 7487) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -230,8 +227,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `51487` - // Minimum execution time: 4_485_000 picoseconds. - Weight::from_parts(4_717_000, 51487) + // Minimum execution time: 4_692_000 picoseconds. + Weight::from_parts(4_862_000, 51487) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -241,8 +238,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_837_000 picoseconds. - Weight::from_parts(12_913_000, 0) + // Minimum execution time: 8_031_000 picoseconds. + Weight::from_parts(8_183_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -251,52 +248,52 @@ impl WeightInfo for SubstrateWeight { impl WeightInfo for () { /// Storage: Nis Queues (r:1 w:1) /// Proof: Nis Queues (max_values: None, max_size: Some(48022), added: 50497, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) /// Storage: Nis QueueTotals (r:1 w:1) /// Proof: Nis QueueTotals (max_values: Some(1), max_size: Some(6002), added: 6497, mode: MaxEncodedLen) /// The range of component `l` is `[0, 999]`. fn place_bid(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `6182 + l * (48 ±0)` - // Estimated: `63688` - // Minimum execution time: 31_160_000 picoseconds. - Weight::from_parts(39_023_414, 63688) - // Standard Error: 214 - .saturating_add(Weight::from_parts(46_106, 0).saturating_mul(l.into())) + // Measured: `6175 + l * (48 ±0)` + // Estimated: `51487` + // Minimum execution time: 49_132_000 picoseconds. + Weight::from_parts(55_373_619, 51487) + // Standard Error: 198 + .saturating_add(Weight::from_parts(44_421, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Nis Queues (r:1 w:1) /// Proof: Nis Queues (max_values: None, max_size: Some(48022), added: 50497, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) /// Storage: Nis QueueTotals (r:1 w:1) /// Proof: Nis QueueTotals (max_values: Some(1), max_size: Some(6002), added: 6497, mode: MaxEncodedLen) fn place_bid_max() -> Weight { // Proof Size summary in bytes: - // Measured: `54184` - // Estimated: `63688` - // Minimum execution time: 85_703_000 picoseconds. - Weight::from_parts(86_613_000, 63688) + // Measured: `54177` + // Estimated: `51487` + // Minimum execution time: 111_471_000 picoseconds. + Weight::from_parts(112_287_000, 51487) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Nis Queues (r:1 w:1) /// Proof: Nis Queues (max_values: None, max_size: Some(48022), added: 50497, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) /// Storage: Nis QueueTotals (r:1 w:1) /// Proof: Nis QueueTotals (max_values: Some(1), max_size: Some(6002), added: 6497, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) /// The range of component `l` is `[1, 1000]`. fn retract_bid(l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `6182 + l * (48 ±0)` - // Estimated: `63688` - // Minimum execution time: 37_637_000 picoseconds. - Weight::from_parts(39_977_788, 63688) - // Standard Error: 152 - .saturating_add(Weight::from_parts(34_595, 0).saturating_mul(l.into())) + // Measured: `6175 + l * (48 ±0)` + // Estimated: `51487` + // Minimum execution time: 51_134_000 picoseconds. + Weight::from_parts(52_353_883, 51487) + // Standard Error: 161 + .saturating_add(Weight::from_parts(62_171, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -307,47 +304,32 @@ impl WeightInfo for () { fn fund_deficit() -> Weight { // Proof Size summary in bytes: // Measured: `191` - // Estimated: `5118` - // Minimum execution time: 35_807_000 picoseconds. - Weight::from_parts(36_329_000, 5118) + // Estimated: `3593` + // Minimum execution time: 41_421_000 picoseconds. + Weight::from_parts(41_762_000, 3593) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Nis Receipts (r:1 w:1) /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) - /// Storage: Nis Summary (r:1 w:1) - /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:0) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) - fn thaw_private() -> Weight { - // Proof Size summary in bytes: - // Measured: `360` - // Estimated: `13378` - // Minimum execution time: 51_342_000 picoseconds. - Weight::from_parts(51_976_000, 13378) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) - } - /// Storage: Nis Receipts (r:1 w:1) - /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) /// Storage: Nis Summary (r:1 w:1) /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn thaw_communal() -> Weight { + fn communify() -> Weight { // Proof Size summary in bytes: - // Measured: `773` - // Estimated: `15906` - // Minimum execution time: 76_535_000 picoseconds. - Weight::from_parts(78_073_000, 15906) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(5_u64)) + // Measured: `667` + // Estimated: `3675` + // Minimum execution time: 74_179_000 picoseconds. + Weight::from_parts(74_795_000, 3675) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: Nis Receipts (r:1 w:1) /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) @@ -359,37 +341,52 @@ impl WeightInfo for () { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) fn privatize() -> Weight { // Proof Size summary in bytes: - // Measured: `835` - // Estimated: `20620` - // Minimum execution time: 84_680_000 picoseconds. - Weight::from_parts(85_661_000, 20620) + // Measured: `828` + // Estimated: `3675` + // Minimum execution time: 85_252_000 picoseconds. + Weight::from_parts(85_949_000, 3675) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: Nis Receipts (r:1 w:1) /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) - /// Storage: Balances Reserves (r:1 w:1) - /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: Nis Summary (r:1 w:1) + /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) + fn thaw_private() -> Weight { + // Proof Size summary in bytes: + // Measured: `456` + // Estimated: `3593` + // Minimum execution time: 82_100_000 picoseconds. + Weight::from_parts(82_563_000, 3593) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + /// Storage: Nis Receipts (r:1 w:1) + /// Proof: Nis Receipts (max_values: None, max_size: Some(81), added: 2556, mode: MaxEncodedLen) /// Storage: Nis Summary (r:1 w:1) /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) - fn communify() -> Weight { + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn thaw_communal() -> Weight { // Proof Size summary in bytes: - // Measured: `674` - // Estimated: `20620` - // Minimum execution time: 72_828_000 picoseconds. - Weight::from_parts(73_553_000, 20620) - .saturating_add(RocksDbWeight::get().reads(6_u64)) - .saturating_add(RocksDbWeight::get().writes(6_u64)) + // Measured: `773` + // Estimated: `3675` + // Minimum execution time: 86_498_000 picoseconds. + Weight::from_parts(87_175_000, 3675) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Nis Summary (r:1 w:1) /// Proof: Nis Summary (max_values: Some(1), max_size: Some(40), added: 535, mode: MaxEncodedLen) @@ -400,9 +397,9 @@ impl WeightInfo for () { fn process_queues() -> Weight { // Proof Size summary in bytes: // Measured: `6624` - // Estimated: `12605` - // Minimum execution time: 23_311_000 picoseconds. - Weight::from_parts(23_855_000, 12605) + // Estimated: `7487` + // Minimum execution time: 22_507_000 picoseconds. + Weight::from_parts(22_788_000, 7487) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -412,8 +409,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42` // Estimated: `51487` - // Minimum execution time: 4_485_000 picoseconds. - Weight::from_parts(4_717_000, 51487) + // Minimum execution time: 4_692_000 picoseconds. + Weight::from_parts(4_862_000, 51487) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -423,8 +420,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_837_000 picoseconds. - Weight::from_parts(12_913_000, 0) + // Minimum execution time: 8_031_000 picoseconds. + Weight::from_parts(8_183_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/frame/nomination-pools/src/weights.rs b/frame/nomination-pools/src/weights.rs index 003ba93eb8a7e..0ac50d2f745ed 100644 --- a/frame/nomination-pools/src/weights.rs +++ b/frame/nomination-pools/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_nomination_pools //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_nomination_pools -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -100,6 +97,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: NominationPools CounterForPoolMembers (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -107,10 +106,10 @@ impl WeightInfo for SubstrateWeight { fn join() -> Weight { // Proof Size summary in bytes: // Measured: `3300` - // Estimated: `52435` - // Minimum execution time: 160_675_000 picoseconds. - Weight::from_parts(162_605_000, 52435) - .saturating_add(T::DbWeight::get().reads(18_u64)) + // Estimated: `8877` + // Minimum execution time: 186_523_000 picoseconds. + Weight::from_parts(187_817_000, 8877) + .saturating_add(T::DbWeight::get().reads(19_u64)) .saturating_add(T::DbWeight::get().writes(12_u64)) } /// Storage: NominationPools PoolMembers (r:1 w:1) @@ -129,6 +128,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -136,10 +137,10 @@ impl WeightInfo for SubstrateWeight { fn bond_extra_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `3310` - // Estimated: `49070` - // Minimum execution time: 156_820_000 picoseconds. - Weight::from_parts(159_798_000, 49070) - .saturating_add(T::DbWeight::get().reads(15_u64)) + // Estimated: `8877` + // Minimum execution time: 183_120_000 picoseconds. + Weight::from_parts(184_749_000, 8877) + .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().writes(12_u64)) } /// Storage: NominationPools ClaimPermissions (r:1 w:0) @@ -160,6 +161,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -167,10 +170,10 @@ impl WeightInfo for SubstrateWeight { fn bond_extra_other() -> Weight { // Proof Size summary in bytes: // Measured: `3375` - // Estimated: `52576` - // Minimum execution time: 175_820_000 picoseconds. - Weight::from_parts(177_378_000, 52576) - .saturating_add(T::DbWeight::get().reads(16_u64)) + // Estimated: `8877` + // Minimum execution time: 218_799_000 picoseconds. + Weight::from_parts(220_139_000, 8877) + .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(13_u64)) } /// Storage: NominationPools ClaimPermissions (r:1 w:0) @@ -188,9 +191,9 @@ impl WeightInfo for SubstrateWeight { fn claim_payout() -> Weight { // Proof Size summary in bytes: // Measured: `1171` - // Estimated: `19532` - // Minimum execution time: 62_011_000 picoseconds. - Weight::from_parts(62_680_000, 19532) + // Estimated: `3702` + // Minimum execution time: 79_493_000 picoseconds. + Weight::from_parts(80_266_000, 3702) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -216,6 +219,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking MinNominatorBond (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -227,10 +232,10 @@ impl WeightInfo for SubstrateWeight { fn unbond() -> Weight { // Proof Size summary in bytes: // Measured: `3586` - // Estimated: `82816` - // Minimum execution time: 163_294_000 picoseconds. - Weight::from_parts(164_375_000, 82816) - .saturating_add(T::DbWeight::get().reads(19_u64)) + // Estimated: `27847` + // Minimum execution time: 168_592_000 picoseconds. + Weight::from_parts(170_130_000, 27847) + .saturating_add(T::DbWeight::get().reads(20_u64)) .saturating_add(T::DbWeight::get().writes(13_u64)) } /// Storage: NominationPools BondedPools (r:1 w:0) @@ -243,16 +248,18 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `s` is `[0, 100]`. fn pool_withdraw_unbonded(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1687` - // Estimated: `18031` - // Minimum execution time: 54_775_000 picoseconds. - Weight::from_parts(55_724_944, 18031) - // Standard Error: 536 - .saturating_add(Weight::from_parts(10_059, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) + // Estimated: `4764` + // Minimum execution time: 63_254_000 picoseconds. + Weight::from_parts(64_154_755, 4764) + // Standard Error: 344 + .saturating_add(Weight::from_parts(8_798, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: NominationPools PoolMembers (r:1 w:1) @@ -269,6 +276,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: NominationPools CounterForPoolMembers (r:1 w:1) @@ -279,12 +288,12 @@ impl WeightInfo for SubstrateWeight { fn withdraw_unbonded_update(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2115` - // Estimated: `54662` - // Minimum execution time: 106_820_000 picoseconds. - Weight::from_parts(109_870_849, 54662) - // Standard Error: 11_111 - .saturating_add(Weight::from_parts(2_006, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(9_u64)) + // Estimated: `27847` + // Minimum execution time: 131_339_000 picoseconds. + Weight::from_parts(133_590_267, 27847) + // Standard Error: 1_058 + .saturating_add(Weight::from_parts(9_932, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } /// Storage: NominationPools PoolMembers (r:1 w:1) @@ -309,6 +318,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: NominationPools CounterForPoolMembers (r:1 w:1) /// Proof: NominationPools CounterForPoolMembers (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: NominationPools ReversePoolIdLookup (r:1 w:1) @@ -330,15 +341,13 @@ impl WeightInfo for SubstrateWeight { /// Storage: NominationPools ClaimPermissions (r:0 w:1) /// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen) /// The range of component `s` is `[0, 100]`. - fn withdraw_unbonded_kill(s: u32, ) -> Weight { + fn withdraw_unbonded_kill(_s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2470` - // Estimated: `87490` - // Minimum execution time: 170_908_000 picoseconds. - Weight::from_parts(173_616_555, 87490) - // Standard Error: 2_324 - .saturating_add(Weight::from_parts(4_397, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(20_u64)) + // Estimated: `27847` + // Minimum execution time: 219_026_000 picoseconds. + Weight::from_parts(223_230_356, 27847) + .saturating_add(T::DbWeight::get().reads(21_u64)) .saturating_add(T::DbWeight::get().writes(18_u64)) } /// Storage: NominationPools LastPoolId (r:1 w:1) @@ -371,6 +380,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: NominationPools RewardPools (r:1 w:1) /// Proof: NominationPools RewardPools (max_values: None, max_size: Some(92), added: 2567, mode: MaxEncodedLen) /// Storage: NominationPools CounterForRewardPools (r:1 w:1) @@ -386,10 +397,10 @@ impl WeightInfo for SubstrateWeight { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `1289` - // Estimated: `51410` - // Minimum execution time: 148_934_000 picoseconds. - Weight::from_parts(149_702_000, 51410) - .saturating_add(T::DbWeight::get().reads(21_u64)) + // Estimated: `6196` + // Minimum execution time: 189_710_000 picoseconds. + Weight::from_parts(190_251_000, 6196) + .saturating_add(T::DbWeight::get().reads(22_u64)) .saturating_add(T::DbWeight::get().writes(15_u64)) } /// Storage: NominationPools BondedPools (r:1 w:0) @@ -420,11 +431,11 @@ impl WeightInfo for SubstrateWeight { fn nominate(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1849` - // Estimated: `33934 + n * (2520 ±0)` - // Minimum execution time: 68_986_000 picoseconds. - Weight::from_parts(69_474_269, 33934) - // Standard Error: 6_602 - .saturating_add(Weight::from_parts(1_416_294, 0).saturating_mul(n.into())) + // Estimated: `4556 + n * (2520 ±0)` + // Minimum execution time: 70_044_000 picoseconds. + Weight::from_parts(69_307_256, 4556) + // Standard Error: 6_066 + .saturating_add(Weight::from_parts(1_517_942, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(5_u64)) @@ -439,9 +450,9 @@ impl WeightInfo for SubstrateWeight { fn set_state() -> Weight { // Proof Size summary in bytes: // Measured: `1438` - // Estimated: `11778` - // Minimum execution time: 36_300_000 picoseconds. - Weight::from_parts(36_713_000, 11778) + // Estimated: `4556` + // Minimum execution time: 36_610_000 picoseconds. + Weight::from_parts(37_212_000, 4556) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -455,11 +466,11 @@ impl WeightInfo for SubstrateWeight { fn set_metadata(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `531` - // Estimated: `8909` - // Minimum execution time: 14_976_000 picoseconds. - Weight::from_parts(15_538_088, 8909) - // Standard Error: 71 - .saturating_add(Weight::from_parts(1_548, 0).saturating_mul(n.into())) + // Estimated: `3735` + // Minimum execution time: 15_334_000 picoseconds. + Weight::from_parts(15_753_107, 3735) + // Standard Error: 62 + .saturating_add(Weight::from_parts(1_365, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -479,8 +490,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_259_000 picoseconds. - Weight::from_parts(7_499_000, 0) + // Minimum execution time: 7_156_000 picoseconds. + Weight::from_parts(7_596_000, 0) .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: NominationPools BondedPools (r:1 w:1) @@ -489,8 +500,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `531` // Estimated: `3685` - // Minimum execution time: 20_454_000 picoseconds. - Weight::from_parts(20_771_000, 3685) + // Minimum execution time: 20_342_000 picoseconds. + Weight::from_parts(20_699_000, 3685) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -515,9 +526,9 @@ impl WeightInfo for SubstrateWeight { fn chill() -> Weight { // Proof Size summary in bytes: // Measured: `2012` - // Estimated: `29455` - // Minimum execution time: 66_404_000 picoseconds. - Weight::from_parts(66_872_000, 29455) + // Estimated: `4556` + // Minimum execution time: 66_608_000 picoseconds. + Weight::from_parts(67_416_000, 4556) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -532,9 +543,9 @@ impl WeightInfo for SubstrateWeight { fn set_commission() -> Weight { // Proof Size summary in bytes: // Measured: `770` - // Estimated: `12324` - // Minimum execution time: 34_240_000 picoseconds. - Weight::from_parts(34_797_000, 12324) + // Estimated: `3685` + // Minimum execution time: 34_619_000 picoseconds. + Weight::from_parts(34_894_000, 3685) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -544,8 +555,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `571` // Estimated: `3685` - // Minimum execution time: 19_469_000 picoseconds. - Weight::from_parts(19_865_000, 3685) + // Minimum execution time: 19_676_000 picoseconds. + Weight::from_parts(19_958_000, 3685) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -555,8 +566,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `531` // Estimated: `3685` - // Minimum execution time: 20_423_000 picoseconds. - Weight::from_parts(20_620_000, 3685) + // Minimum execution time: 20_404_000 picoseconds. + Weight::from_parts(20_859_000, 3685) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -567,9 +578,9 @@ impl WeightInfo for SubstrateWeight { fn set_claim_permission() -> Weight { // Proof Size summary in bytes: // Measured: `542` - // Estimated: `7208` - // Minimum execution time: 15_346_000 picoseconds. - Weight::from_parts(15_613_000, 7208) + // Estimated: `3702` + // Minimum execution time: 15_401_000 picoseconds. + Weight::from_parts(15_706_000, 3702) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -584,9 +595,9 @@ impl WeightInfo for SubstrateWeight { fn claim_commission() -> Weight { // Proof Size summary in bytes: // Measured: `968` - // Estimated: `12324` - // Minimum execution time: 48_749_000 picoseconds. - Weight::from_parts(49_131_000, 12324) + // Estimated: `3685` + // Minimum execution time: 66_775_000 picoseconds. + Weight::from_parts(67_242_000, 3685) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -618,6 +629,8 @@ impl WeightInfo for () { /// Proof: NominationPools CounterForPoolMembers (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -625,10 +638,10 @@ impl WeightInfo for () { fn join() -> Weight { // Proof Size summary in bytes: // Measured: `3300` - // Estimated: `52435` - // Minimum execution time: 160_675_000 picoseconds. - Weight::from_parts(162_605_000, 52435) - .saturating_add(RocksDbWeight::get().reads(18_u64)) + // Estimated: `8877` + // Minimum execution time: 186_523_000 picoseconds. + Weight::from_parts(187_817_000, 8877) + .saturating_add(RocksDbWeight::get().reads(19_u64)) .saturating_add(RocksDbWeight::get().writes(12_u64)) } /// Storage: NominationPools PoolMembers (r:1 w:1) @@ -647,6 +660,8 @@ impl WeightInfo for () { /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -654,10 +669,10 @@ impl WeightInfo for () { fn bond_extra_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `3310` - // Estimated: `49070` - // Minimum execution time: 156_820_000 picoseconds. - Weight::from_parts(159_798_000, 49070) - .saturating_add(RocksDbWeight::get().reads(15_u64)) + // Estimated: `8877` + // Minimum execution time: 183_120_000 picoseconds. + Weight::from_parts(184_749_000, 8877) + .saturating_add(RocksDbWeight::get().reads(16_u64)) .saturating_add(RocksDbWeight::get().writes(12_u64)) } /// Storage: NominationPools ClaimPermissions (r:1 w:0) @@ -678,6 +693,8 @@ impl WeightInfo for () { /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -685,10 +702,10 @@ impl WeightInfo for () { fn bond_extra_other() -> Weight { // Proof Size summary in bytes: // Measured: `3375` - // Estimated: `52576` - // Minimum execution time: 175_820_000 picoseconds. - Weight::from_parts(177_378_000, 52576) - .saturating_add(RocksDbWeight::get().reads(16_u64)) + // Estimated: `8877` + // Minimum execution time: 218_799_000 picoseconds. + Weight::from_parts(220_139_000, 8877) + .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().writes(13_u64)) } /// Storage: NominationPools ClaimPermissions (r:1 w:0) @@ -706,9 +723,9 @@ impl WeightInfo for () { fn claim_payout() -> Weight { // Proof Size summary in bytes: // Measured: `1171` - // Estimated: `19532` - // Minimum execution time: 62_011_000 picoseconds. - Weight::from_parts(62_680_000, 19532) + // Estimated: `3702` + // Minimum execution time: 79_493_000 picoseconds. + Weight::from_parts(80_266_000, 3702) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -734,6 +751,8 @@ impl WeightInfo for () { /// Proof: Staking MinNominatorBond (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -745,10 +764,10 @@ impl WeightInfo for () { fn unbond() -> Weight { // Proof Size summary in bytes: // Measured: `3586` - // Estimated: `82816` - // Minimum execution time: 163_294_000 picoseconds. - Weight::from_parts(164_375_000, 82816) - .saturating_add(RocksDbWeight::get().reads(19_u64)) + // Estimated: `27847` + // Minimum execution time: 168_592_000 picoseconds. + Weight::from_parts(170_130_000, 27847) + .saturating_add(RocksDbWeight::get().reads(20_u64)) .saturating_add(RocksDbWeight::get().writes(13_u64)) } /// Storage: NominationPools BondedPools (r:1 w:0) @@ -761,16 +780,18 @@ impl WeightInfo for () { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `s` is `[0, 100]`. fn pool_withdraw_unbonded(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1687` - // Estimated: `18031` - // Minimum execution time: 54_775_000 picoseconds. - Weight::from_parts(55_724_944, 18031) - // Standard Error: 536 - .saturating_add(Weight::from_parts(10_059, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Estimated: `4764` + // Minimum execution time: 63_254_000 picoseconds. + Weight::from_parts(64_154_755, 4764) + // Standard Error: 344 + .saturating_add(Weight::from_parts(8_798, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: NominationPools PoolMembers (r:1 w:1) @@ -787,6 +808,8 @@ impl WeightInfo for () { /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: NominationPools CounterForPoolMembers (r:1 w:1) @@ -797,12 +820,12 @@ impl WeightInfo for () { fn withdraw_unbonded_update(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2115` - // Estimated: `54662` - // Minimum execution time: 106_820_000 picoseconds. - Weight::from_parts(109_870_849, 54662) - // Standard Error: 11_111 - .saturating_add(Weight::from_parts(2_006, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(9_u64)) + // Estimated: `27847` + // Minimum execution time: 131_339_000 picoseconds. + Weight::from_parts(133_590_267, 27847) + // Standard Error: 1_058 + .saturating_add(Weight::from_parts(9_932, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// Storage: NominationPools PoolMembers (r:1 w:1) @@ -827,6 +850,8 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: NominationPools CounterForPoolMembers (r:1 w:1) /// Proof: NominationPools CounterForPoolMembers (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: NominationPools ReversePoolIdLookup (r:1 w:1) @@ -848,15 +873,13 @@ impl WeightInfo for () { /// Storage: NominationPools ClaimPermissions (r:0 w:1) /// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen) /// The range of component `s` is `[0, 100]`. - fn withdraw_unbonded_kill(s: u32, ) -> Weight { + fn withdraw_unbonded_kill(_s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2470` - // Estimated: `87490` - // Minimum execution time: 170_908_000 picoseconds. - Weight::from_parts(173_616_555, 87490) - // Standard Error: 2_324 - .saturating_add(Weight::from_parts(4_397, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(20_u64)) + // Estimated: `27847` + // Minimum execution time: 219_026_000 picoseconds. + Weight::from_parts(223_230_356, 27847) + .saturating_add(RocksDbWeight::get().reads(21_u64)) .saturating_add(RocksDbWeight::get().writes(18_u64)) } /// Storage: NominationPools LastPoolId (r:1 w:1) @@ -889,6 +912,8 @@ impl WeightInfo for () { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: NominationPools RewardPools (r:1 w:1) /// Proof: NominationPools RewardPools (max_values: None, max_size: Some(92), added: 2567, mode: MaxEncodedLen) /// Storage: NominationPools CounterForRewardPools (r:1 w:1) @@ -904,10 +929,10 @@ impl WeightInfo for () { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `1289` - // Estimated: `51410` - // Minimum execution time: 148_934_000 picoseconds. - Weight::from_parts(149_702_000, 51410) - .saturating_add(RocksDbWeight::get().reads(21_u64)) + // Estimated: `6196` + // Minimum execution time: 189_710_000 picoseconds. + Weight::from_parts(190_251_000, 6196) + .saturating_add(RocksDbWeight::get().reads(22_u64)) .saturating_add(RocksDbWeight::get().writes(15_u64)) } /// Storage: NominationPools BondedPools (r:1 w:0) @@ -938,11 +963,11 @@ impl WeightInfo for () { fn nominate(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1849` - // Estimated: `33934 + n * (2520 ±0)` - // Minimum execution time: 68_986_000 picoseconds. - Weight::from_parts(69_474_269, 33934) - // Standard Error: 6_602 - .saturating_add(Weight::from_parts(1_416_294, 0).saturating_mul(n.into())) + // Estimated: `4556 + n * (2520 ±0)` + // Minimum execution time: 70_044_000 picoseconds. + Weight::from_parts(69_307_256, 4556) + // Standard Error: 6_066 + .saturating_add(Weight::from_parts(1_517_942, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(5_u64)) @@ -957,9 +982,9 @@ impl WeightInfo for () { fn set_state() -> Weight { // Proof Size summary in bytes: // Measured: `1438` - // Estimated: `11778` - // Minimum execution time: 36_300_000 picoseconds. - Weight::from_parts(36_713_000, 11778) + // Estimated: `4556` + // Minimum execution time: 36_610_000 picoseconds. + Weight::from_parts(37_212_000, 4556) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -973,11 +998,11 @@ impl WeightInfo for () { fn set_metadata(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `531` - // Estimated: `8909` - // Minimum execution time: 14_976_000 picoseconds. - Weight::from_parts(15_538_088, 8909) - // Standard Error: 71 - .saturating_add(Weight::from_parts(1_548, 0).saturating_mul(n.into())) + // Estimated: `3735` + // Minimum execution time: 15_334_000 picoseconds. + Weight::from_parts(15_753_107, 3735) + // Standard Error: 62 + .saturating_add(Weight::from_parts(1_365, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -997,8 +1022,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_259_000 picoseconds. - Weight::from_parts(7_499_000, 0) + // Minimum execution time: 7_156_000 picoseconds. + Weight::from_parts(7_596_000, 0) .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: NominationPools BondedPools (r:1 w:1) @@ -1007,8 +1032,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `531` // Estimated: `3685` - // Minimum execution time: 20_454_000 picoseconds. - Weight::from_parts(20_771_000, 3685) + // Minimum execution time: 20_342_000 picoseconds. + Weight::from_parts(20_699_000, 3685) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1033,9 +1058,9 @@ impl WeightInfo for () { fn chill() -> Weight { // Proof Size summary in bytes: // Measured: `2012` - // Estimated: `29455` - // Minimum execution time: 66_404_000 picoseconds. - Weight::from_parts(66_872_000, 29455) + // Estimated: `4556` + // Minimum execution time: 66_608_000 picoseconds. + Weight::from_parts(67_416_000, 4556) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1050,9 +1075,9 @@ impl WeightInfo for () { fn set_commission() -> Weight { // Proof Size summary in bytes: // Measured: `770` - // Estimated: `12324` - // Minimum execution time: 34_240_000 picoseconds. - Weight::from_parts(34_797_000, 12324) + // Estimated: `3685` + // Minimum execution time: 34_619_000 picoseconds. + Weight::from_parts(34_894_000, 3685) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1062,8 +1087,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `571` // Estimated: `3685` - // Minimum execution time: 19_469_000 picoseconds. - Weight::from_parts(19_865_000, 3685) + // Minimum execution time: 19_676_000 picoseconds. + Weight::from_parts(19_958_000, 3685) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1073,8 +1098,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `531` // Estimated: `3685` - // Minimum execution time: 20_423_000 picoseconds. - Weight::from_parts(20_620_000, 3685) + // Minimum execution time: 20_404_000 picoseconds. + Weight::from_parts(20_859_000, 3685) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1085,9 +1110,9 @@ impl WeightInfo for () { fn set_claim_permission() -> Weight { // Proof Size summary in bytes: // Measured: `542` - // Estimated: `7208` - // Minimum execution time: 15_346_000 picoseconds. - Weight::from_parts(15_613_000, 7208) + // Estimated: `3702` + // Minimum execution time: 15_401_000 picoseconds. + Weight::from_parts(15_706_000, 3702) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1102,9 +1127,9 @@ impl WeightInfo for () { fn claim_commission() -> Weight { // Proof Size summary in bytes: // Measured: `968` - // Estimated: `12324` - // Minimum execution time: 48_749_000 picoseconds. - Weight::from_parts(49_131_000, 12324) + // Estimated: `3685` + // Minimum execution time: 66_775_000 picoseconds. + Weight::from_parts(67_242_000, 3685) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/frame/preimage/src/weights.rs b/frame/preimage/src/weights.rs index 168cb634c2d48..2177309db1612 100644 --- a/frame/preimage/src/weights.rs +++ b/frame/preimage/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_preimage //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_preimage -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -77,10 +74,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `143` // Estimated: `3556` - // Minimum execution time: 27_010_000 picoseconds. - Weight::from_parts(27_665_000, 3556) + // Minimum execution time: 31_578_000 picoseconds. + Weight::from_parts(31_955_000, 3556) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_414, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_395, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -93,10 +90,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 16_984_000 picoseconds. - Weight::from_parts(17_455_000, 3556) + // Minimum execution time: 17_017_000 picoseconds. + Weight::from_parts(17_549_000, 3556) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_414, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_394, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -109,10 +106,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 16_579_000 picoseconds. - Weight::from_parts(16_849_000, 3556) + // Minimum execution time: 16_507_000 picoseconds. + Weight::from_parts(16_624_000, 3556) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_414, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_395, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -124,8 +121,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `289` // Estimated: `3556` - // Minimum execution time: 33_552_000 picoseconds. - Weight::from_parts(35_134_000, 3556) + // Minimum execution time: 38_016_000 picoseconds. + Weight::from_parts(38_909_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -137,8 +134,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 22_102_000 picoseconds. - Weight::from_parts(22_860_000, 3556) + // Minimum execution time: 21_408_000 picoseconds. + Weight::from_parts(22_343_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -148,8 +145,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `188` // Estimated: `3556` - // Minimum execution time: 19_590_000 picoseconds. - Weight::from_parts(20_638_000, 3556) + // Minimum execution time: 20_035_000 picoseconds. + Weight::from_parts(20_639_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -159,8 +156,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 11_689_000 picoseconds. - Weight::from_parts(12_577_000, 3556) + // Minimum execution time: 12_028_000 picoseconds. + Weight::from_parts(12_509_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -170,8 +167,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3556` - // Minimum execution time: 13_673_000 picoseconds. - Weight::from_parts(14_210_000, 3556) + // Minimum execution time: 13_568_000 picoseconds. + Weight::from_parts(14_161_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -181,8 +178,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 8_810_000 picoseconds. - Weight::from_parts(9_044_000, 3556) + // Minimum execution time: 8_538_000 picoseconds. + Weight::from_parts(8_933_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -194,8 +191,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 21_236_000 picoseconds. - Weight::from_parts(21_684_000, 3556) + // Minimum execution time: 20_692_000 picoseconds. + Weight::from_parts(21_770_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -205,8 +202,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 8_709_000 picoseconds. - Weight::from_parts(8_970_000, 3556) + // Minimum execution time: 8_572_000 picoseconds. + Weight::from_parts(8_795_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -216,8 +213,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 8_976_000 picoseconds. - Weight::from_parts(9_164_000, 3556) + // Minimum execution time: 8_266_000 picoseconds. + Weight::from_parts(8_721_000, 3556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -234,10 +231,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `143` // Estimated: `3556` - // Minimum execution time: 27_010_000 picoseconds. - Weight::from_parts(27_665_000, 3556) + // Minimum execution time: 31_578_000 picoseconds. + Weight::from_parts(31_955_000, 3556) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_414, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_395, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -250,10 +247,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 16_984_000 picoseconds. - Weight::from_parts(17_455_000, 3556) + // Minimum execution time: 17_017_000 picoseconds. + Weight::from_parts(17_549_000, 3556) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_414, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_394, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -266,10 +263,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 16_579_000 picoseconds. - Weight::from_parts(16_849_000, 3556) + // Minimum execution time: 16_507_000 picoseconds. + Weight::from_parts(16_624_000, 3556) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_414, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_395, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -281,8 +278,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `289` // Estimated: `3556` - // Minimum execution time: 33_552_000 picoseconds. - Weight::from_parts(35_134_000, 3556) + // Minimum execution time: 38_016_000 picoseconds. + Weight::from_parts(38_909_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -294,8 +291,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 22_102_000 picoseconds. - Weight::from_parts(22_860_000, 3556) + // Minimum execution time: 21_408_000 picoseconds. + Weight::from_parts(22_343_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -305,8 +302,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `188` // Estimated: `3556` - // Minimum execution time: 19_590_000 picoseconds. - Weight::from_parts(20_638_000, 3556) + // Minimum execution time: 20_035_000 picoseconds. + Weight::from_parts(20_639_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -316,8 +313,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 11_689_000 picoseconds. - Weight::from_parts(12_577_000, 3556) + // Minimum execution time: 12_028_000 picoseconds. + Weight::from_parts(12_509_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -327,8 +324,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3556` - // Minimum execution time: 13_673_000 picoseconds. - Weight::from_parts(14_210_000, 3556) + // Minimum execution time: 13_568_000 picoseconds. + Weight::from_parts(14_161_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -338,8 +335,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 8_810_000 picoseconds. - Weight::from_parts(9_044_000, 3556) + // Minimum execution time: 8_538_000 picoseconds. + Weight::from_parts(8_933_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -351,8 +348,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 21_236_000 picoseconds. - Weight::from_parts(21_684_000, 3556) + // Minimum execution time: 20_692_000 picoseconds. + Weight::from_parts(21_770_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -362,8 +359,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 8_709_000 picoseconds. - Weight::from_parts(8_970_000, 3556) + // Minimum execution time: 8_572_000 picoseconds. + Weight::from_parts(8_795_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -373,8 +370,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 8_976_000 picoseconds. - Weight::from_parts(9_164_000, 3556) + // Minimum execution time: 8_266_000 picoseconds. + Weight::from_parts(8_721_000, 3556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/proxy/src/weights.rs b/frame/proxy/src/weights.rs index 28e24c4682f18..5a6352fc7ed7f 100644 --- a/frame/proxy/src/weights.rs +++ b/frame/proxy/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_proxy //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_proxy -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -73,10 +70,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `161 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 16_407_000 picoseconds. - Weight::from_parts(17_044_509, 4706) - // Standard Error: 1_177 - .saturating_add(Weight::from_parts(36_533, 0).saturating_mul(p.into())) + // Minimum execution time: 16_542_000 picoseconds. + Weight::from_parts(17_131_651, 4706) + // Standard Error: 1_279 + .saturating_add(Weight::from_parts(31_622, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Proxy Proxies (r:1 w:0) @@ -90,13 +87,13 @@ impl WeightInfo for SubstrateWeight { fn proxy_announced(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `488 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 38_523_000 picoseconds. - Weight::from_parts(39_227_232, 13997) - // Standard Error: 5_703 - .saturating_add(Weight::from_parts(136_003, 0).saturating_mul(a.into())) - // Standard Error: 5_893 - .saturating_add(Weight::from_parts(42_397, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 41_702_000 picoseconds. + Weight::from_parts(41_868_091, 5698) + // Standard Error: 3_771 + .saturating_add(Weight::from_parts(135_604, 0).saturating_mul(a.into())) + // Standard Error: 3_896 + .saturating_add(Weight::from_parts(32_615, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -106,16 +103,14 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `a` is `[0, 31]`. /// The range of component `p` is `[1, 31]`. - fn remove_announcement(a: u32, p: u32, ) -> Weight { + fn remove_announcement(a: u32, _p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `403 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_541_000 picoseconds. - Weight::from_parts(23_402_268, 9291) - // Standard Error: 3_242 - .saturating_add(Weight::from_parts(178_017, 0).saturating_mul(a.into())) - // Standard Error: 3_349 - .saturating_add(Weight::from_parts(6_230, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_432_000 picoseconds. + Weight::from_parts(26_301_674, 5698) + // Standard Error: 1_413 + .saturating_add(Weight::from_parts(167_176, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -128,13 +123,13 @@ impl WeightInfo for SubstrateWeight { fn reject_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `403 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_539_000 picoseconds. - Weight::from_parts(23_479_286, 9291) - // Standard Error: 1_329 - .saturating_add(Weight::from_parts(174_021, 0).saturating_mul(a.into())) - // Standard Error: 1_373 - .saturating_add(Weight::from_parts(6_465, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_280_000 picoseconds. + Weight::from_parts(26_099_549, 5698) + // Standard Error: 1_458 + .saturating_add(Weight::from_parts(168_724, 0).saturating_mul(a.into())) + // Standard Error: 1_507 + .saturating_add(Weight::from_parts(2_212, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -149,13 +144,13 @@ impl WeightInfo for SubstrateWeight { fn announce(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `420 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 32_049_000 picoseconds. - Weight::from_parts(35_352_453, 13997) - // Standard Error: 4_389 - .saturating_add(Weight::from_parts(144_573, 0).saturating_mul(a.into())) - // Standard Error: 4_535 - .saturating_add(Weight::from_parts(41_849, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 35_889_000 picoseconds. + Weight::from_parts(37_535_424, 5698) + // Standard Error: 3_899 + .saturating_add(Weight::from_parts(138_757, 0).saturating_mul(a.into())) + // Standard Error: 4_028 + .saturating_add(Weight::from_parts(46_196, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -166,10 +161,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `161 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 24_491_000 picoseconds. - Weight::from_parts(25_291_582, 4706) - // Standard Error: 11_080 - .saturating_add(Weight::from_parts(68_024, 0).saturating_mul(p.into())) + // Minimum execution time: 26_876_000 picoseconds. + Weight::from_parts(27_356_694, 4706) + // Standard Error: 1_437 + .saturating_add(Weight::from_parts(68_994, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -180,10 +175,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `161 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 23_849_000 picoseconds. - Weight::from_parts(25_370_806, 4706) - // Standard Error: 8_763 - .saturating_add(Weight::from_parts(63_413, 0).saturating_mul(p.into())) + // Minimum execution time: 26_655_000 picoseconds. + Weight::from_parts(27_726_692, 4706) + // Standard Error: 1_980 + .saturating_add(Weight::from_parts(55_932, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -194,24 +189,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `161 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 19_488_000 picoseconds. - Weight::from_parts(20_219_817, 4706) - // Standard Error: 1_385 - .saturating_add(Weight::from_parts(30_354, 0).saturating_mul(p.into())) + // Minimum execution time: 23_716_000 picoseconds. + Weight::from_parts(24_660_737, 4706) + // Standard Error: 1_400 + .saturating_add(Weight::from_parts(31_679, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Proxy Proxies (r:1 w:1) /// Proof: Proxy Proxies (max_values: None, max_size: Some(1241), added: 3716, mode: MaxEncodedLen) /// The range of component `p` is `[1, 31]`. - fn create_pure(p: u32, ) -> Weight { + fn create_pure(_p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `173` // Estimated: `4706` - // Minimum execution time: 25_864_000 picoseconds. - Weight::from_parts(26_712_232, 4706) - // Standard Error: 1_331 - .saturating_add(Weight::from_parts(4_401, 0).saturating_mul(p.into())) + // Minimum execution time: 28_233_000 picoseconds. + Weight::from_parts(29_602_422, 4706) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -222,10 +215,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `198 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 20_488_000 picoseconds. - Weight::from_parts(21_135_155, 4706) - // Standard Error: 1_255 - .saturating_add(Weight::from_parts(36_312, 0).saturating_mul(p.into())) + // Minimum execution time: 24_759_000 picoseconds. + Weight::from_parts(25_533_053, 4706) + // Standard Error: 1_254 + .saturating_add(Weight::from_parts(36_331, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -240,10 +233,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `161 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 16_407_000 picoseconds. - Weight::from_parts(17_044_509, 4706) - // Standard Error: 1_177 - .saturating_add(Weight::from_parts(36_533, 0).saturating_mul(p.into())) + // Minimum execution time: 16_542_000 picoseconds. + Weight::from_parts(17_131_651, 4706) + // Standard Error: 1_279 + .saturating_add(Weight::from_parts(31_622, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Proxy Proxies (r:1 w:0) @@ -257,13 +250,13 @@ impl WeightInfo for () { fn proxy_announced(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `488 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 38_523_000 picoseconds. - Weight::from_parts(39_227_232, 13997) - // Standard Error: 5_703 - .saturating_add(Weight::from_parts(136_003, 0).saturating_mul(a.into())) - // Standard Error: 5_893 - .saturating_add(Weight::from_parts(42_397, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 41_702_000 picoseconds. + Weight::from_parts(41_868_091, 5698) + // Standard Error: 3_771 + .saturating_add(Weight::from_parts(135_604, 0).saturating_mul(a.into())) + // Standard Error: 3_896 + .saturating_add(Weight::from_parts(32_615, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -273,16 +266,14 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `a` is `[0, 31]`. /// The range of component `p` is `[1, 31]`. - fn remove_announcement(a: u32, p: u32, ) -> Weight { + fn remove_announcement(a: u32, _p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `403 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_541_000 picoseconds. - Weight::from_parts(23_402_268, 9291) - // Standard Error: 3_242 - .saturating_add(Weight::from_parts(178_017, 0).saturating_mul(a.into())) - // Standard Error: 3_349 - .saturating_add(Weight::from_parts(6_230, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_432_000 picoseconds. + Weight::from_parts(26_301_674, 5698) + // Standard Error: 1_413 + .saturating_add(Weight::from_parts(167_176, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -295,13 +286,13 @@ impl WeightInfo for () { fn reject_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `403 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_539_000 picoseconds. - Weight::from_parts(23_479_286, 9291) - // Standard Error: 1_329 - .saturating_add(Weight::from_parts(174_021, 0).saturating_mul(a.into())) - // Standard Error: 1_373 - .saturating_add(Weight::from_parts(6_465, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_280_000 picoseconds. + Weight::from_parts(26_099_549, 5698) + // Standard Error: 1_458 + .saturating_add(Weight::from_parts(168_724, 0).saturating_mul(a.into())) + // Standard Error: 1_507 + .saturating_add(Weight::from_parts(2_212, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -316,13 +307,13 @@ impl WeightInfo for () { fn announce(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `420 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 32_049_000 picoseconds. - Weight::from_parts(35_352_453, 13997) - // Standard Error: 4_389 - .saturating_add(Weight::from_parts(144_573, 0).saturating_mul(a.into())) - // Standard Error: 4_535 - .saturating_add(Weight::from_parts(41_849, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 35_889_000 picoseconds. + Weight::from_parts(37_535_424, 5698) + // Standard Error: 3_899 + .saturating_add(Weight::from_parts(138_757, 0).saturating_mul(a.into())) + // Standard Error: 4_028 + .saturating_add(Weight::from_parts(46_196, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -333,10 +324,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `161 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 24_491_000 picoseconds. - Weight::from_parts(25_291_582, 4706) - // Standard Error: 11_080 - .saturating_add(Weight::from_parts(68_024, 0).saturating_mul(p.into())) + // Minimum execution time: 26_876_000 picoseconds. + Weight::from_parts(27_356_694, 4706) + // Standard Error: 1_437 + .saturating_add(Weight::from_parts(68_994, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -347,10 +338,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `161 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 23_849_000 picoseconds. - Weight::from_parts(25_370_806, 4706) - // Standard Error: 8_763 - .saturating_add(Weight::from_parts(63_413, 0).saturating_mul(p.into())) + // Minimum execution time: 26_655_000 picoseconds. + Weight::from_parts(27_726_692, 4706) + // Standard Error: 1_980 + .saturating_add(Weight::from_parts(55_932, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -361,24 +352,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `161 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 19_488_000 picoseconds. - Weight::from_parts(20_219_817, 4706) - // Standard Error: 1_385 - .saturating_add(Weight::from_parts(30_354, 0).saturating_mul(p.into())) + // Minimum execution time: 23_716_000 picoseconds. + Weight::from_parts(24_660_737, 4706) + // Standard Error: 1_400 + .saturating_add(Weight::from_parts(31_679, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Proxy Proxies (r:1 w:1) /// Proof: Proxy Proxies (max_values: None, max_size: Some(1241), added: 3716, mode: MaxEncodedLen) /// The range of component `p` is `[1, 31]`. - fn create_pure(p: u32, ) -> Weight { + fn create_pure(_p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `173` // Estimated: `4706` - // Minimum execution time: 25_864_000 picoseconds. - Weight::from_parts(26_712_232, 4706) - // Standard Error: 1_331 - .saturating_add(Weight::from_parts(4_401, 0).saturating_mul(p.into())) + // Minimum execution time: 28_233_000 picoseconds. + Weight::from_parts(29_602_422, 4706) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -389,10 +378,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `198 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 20_488_000 picoseconds. - Weight::from_parts(21_135_155, 4706) - // Standard Error: 1_255 - .saturating_add(Weight::from_parts(36_312, 0).saturating_mul(p.into())) + // Minimum execution time: 24_759_000 picoseconds. + Weight::from_parts(25_533_053, 4706) + // Standard Error: 1_254 + .saturating_add(Weight::from_parts(36_331, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/ranked-collective/src/weights.rs b/frame/ranked-collective/src/weights.rs index e25737a1df8f0..754fcf70aaafc 100644 --- a/frame/ranked-collective/src/weights.rs +++ b/frame/ranked-collective/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_ranked_collective //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_ranked_collective -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -73,9 +70,9 @@ impl WeightInfo for SubstrateWeight { fn add_member() -> Weight { // Proof Size summary in bytes: // Measured: `109` - // Estimated: `6986` - // Minimum execution time: 19_174_000 picoseconds. - Weight::from_parts(19_391_000, 6986) + // Estimated: `3507` + // Minimum execution time: 18_480_000 picoseconds. + Weight::from_parts(18_769_000, 3507) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -91,16 +88,16 @@ impl WeightInfo for SubstrateWeight { fn remove_member(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `583 + r * (281 ±0)` - // Estimated: `14024 + r * (7547 ±0)` - // Minimum execution time: 30_972_000 picoseconds. - Weight::from_parts(35_526_205, 14024) - // Standard Error: 47_832 - .saturating_add(Weight::from_parts(12_838_739, 0).saturating_mul(r.into())) + // Estimated: `3519 + r * (2529 ±0)` + // Minimum execution time: 30_087_000 picoseconds. + Weight::from_parts(33_646_239, 3519) + // Standard Error: 22_498 + .saturating_add(Weight::from_parts(12_524_289, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 7547).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2529).saturating_mul(r.into())) } /// Storage: RankedCollective Members (r:1 w:1) /// Proof: RankedCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) @@ -114,11 +111,11 @@ impl WeightInfo for SubstrateWeight { fn promote_member(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `281 + r * (17 ±0)` - // Estimated: `6986` - // Minimum execution time: 21_573_000 picoseconds. - Weight::from_parts(22_184_210, 6986) - // Standard Error: 10_584 - .saturating_add(Weight::from_parts(289_535, 0).saturating_mul(r.into())) + // Estimated: `3507` + // Minimum execution time: 20_974_000 picoseconds. + Weight::from_parts(21_582_135, 3507) + // Standard Error: 4_965 + .saturating_add(Weight::from_parts(294_566, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -134,11 +131,11 @@ impl WeightInfo for SubstrateWeight { fn demote_member(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `599 + r * (72 ±0)` - // Estimated: `14024` - // Minimum execution time: 30_249_000 picoseconds. - Weight::from_parts(32_702_502, 14024) - // Standard Error: 26_725 - .saturating_add(Weight::from_parts(651_139, 0).saturating_mul(r.into())) + // Estimated: `3519` + // Minimum execution time: 29_621_000 picoseconds. + Weight::from_parts(32_118_301, 3519) + // Standard Error: 27_596 + .saturating_add(Weight::from_parts(647_979, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -153,9 +150,9 @@ impl WeightInfo for SubstrateWeight { fn vote() -> Weight { // Proof Size summary in bytes: // Measured: `595` - // Estimated: `230816` - // Minimum execution time: 46_972_000 picoseconds. - Weight::from_parts(47_617_000, 230816) + // Estimated: `219984` + // Minimum execution time: 46_360_000 picoseconds. + Weight::from_parts(46_793_000, 219984) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -169,11 +166,11 @@ impl WeightInfo for SubstrateWeight { fn cleanup_poll(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `429 + n * (50 ±0)` - // Estimated: `8364 + n * (2540 ±0)` - // Minimum execution time: 15_301_000 picoseconds. - Weight::from_parts(19_308_613, 8364) - // Standard Error: 1_792 - .saturating_add(Weight::from_parts(1_015_251, 0).saturating_mul(n.into())) + // Estimated: `3795 + n * (2540 ±0)` + // Minimum execution time: 14_869_000 picoseconds. + Weight::from_parts(18_545_013, 3795) + // Standard Error: 1_376 + .saturating_add(Weight::from_parts(1_005_397, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) @@ -194,9 +191,9 @@ impl WeightInfo for () { fn add_member() -> Weight { // Proof Size summary in bytes: // Measured: `109` - // Estimated: `6986` - // Minimum execution time: 19_174_000 picoseconds. - Weight::from_parts(19_391_000, 6986) + // Estimated: `3507` + // Minimum execution time: 18_480_000 picoseconds. + Weight::from_parts(18_769_000, 3507) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -212,16 +209,16 @@ impl WeightInfo for () { fn remove_member(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `583 + r * (281 ±0)` - // Estimated: `14024 + r * (7547 ±0)` - // Minimum execution time: 30_972_000 picoseconds. - Weight::from_parts(35_526_205, 14024) - // Standard Error: 47_832 - .saturating_add(Weight::from_parts(12_838_739, 0).saturating_mul(r.into())) + // Estimated: `3519 + r * (2529 ±0)` + // Minimum execution time: 30_087_000 picoseconds. + Weight::from_parts(33_646_239, 3519) + // Standard Error: 22_498 + .saturating_add(Weight::from_parts(12_524_289, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 7547).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2529).saturating_mul(r.into())) } /// Storage: RankedCollective Members (r:1 w:1) /// Proof: RankedCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) @@ -235,11 +232,11 @@ impl WeightInfo for () { fn promote_member(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `281 + r * (17 ±0)` - // Estimated: `6986` - // Minimum execution time: 21_573_000 picoseconds. - Weight::from_parts(22_184_210, 6986) - // Standard Error: 10_584 - .saturating_add(Weight::from_parts(289_535, 0).saturating_mul(r.into())) + // Estimated: `3507` + // Minimum execution time: 20_974_000 picoseconds. + Weight::from_parts(21_582_135, 3507) + // Standard Error: 4_965 + .saturating_add(Weight::from_parts(294_566, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -255,11 +252,11 @@ impl WeightInfo for () { fn demote_member(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `599 + r * (72 ±0)` - // Estimated: `14024` - // Minimum execution time: 30_249_000 picoseconds. - Weight::from_parts(32_702_502, 14024) - // Standard Error: 26_725 - .saturating_add(Weight::from_parts(651_139, 0).saturating_mul(r.into())) + // Estimated: `3519` + // Minimum execution time: 29_621_000 picoseconds. + Weight::from_parts(32_118_301, 3519) + // Standard Error: 27_596 + .saturating_add(Weight::from_parts(647_979, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -274,9 +271,9 @@ impl WeightInfo for () { fn vote() -> Weight { // Proof Size summary in bytes: // Measured: `595` - // Estimated: `230816` - // Minimum execution time: 46_972_000 picoseconds. - Weight::from_parts(47_617_000, 230816) + // Estimated: `219984` + // Minimum execution time: 46_360_000 picoseconds. + Weight::from_parts(46_793_000, 219984) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -290,11 +287,11 @@ impl WeightInfo for () { fn cleanup_poll(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `429 + n * (50 ±0)` - // Estimated: `8364 + n * (2540 ±0)` - // Minimum execution time: 15_301_000 picoseconds. - Weight::from_parts(19_308_613, 8364) - // Standard Error: 1_792 - .saturating_add(Weight::from_parts(1_015_251, 0).saturating_mul(n.into())) + // Estimated: `3795 + n * (2540 ±0)` + // Minimum execution time: 14_869_000 picoseconds. + Weight::from_parts(18_545_013, 3795) + // Standard Error: 1_376 + .saturating_add(Weight::from_parts(1_005_397, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) diff --git a/frame/recovery/src/weights.rs b/frame/recovery/src/weights.rs index 8245b9606deee..97d4c8b87aa53 100644 --- a/frame/recovery/src/weights.rs +++ b/frame/recovery/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_recovery //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_recovery -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -71,8 +68,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `281` // Estimated: `3545` - // Minimum execution time: 9_937_000 picoseconds. - Weight::from_parts(10_213_000, 3545) + // Minimum execution time: 10_405_000 picoseconds. + Weight::from_parts(10_807_000, 3545) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: Recovery Proxy (r:0 w:1) @@ -81,8 +78,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_704_000 picoseconds. - Weight::from_parts(9_997_000, 0) + // Minimum execution time: 11_198_000 picoseconds. + Weight::from_parts(11_459_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Recovery Recoverable (r:1 w:1) @@ -92,10 +89,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `175` // Estimated: `3816` - // Minimum execution time: 23_260_000 picoseconds. - Weight::from_parts(24_408_081, 3816) - // Standard Error: 3_086 - .saturating_add(Weight::from_parts(41_628, 0).saturating_mul(n.into())) + // Minimum execution time: 28_009_000 picoseconds. + Weight::from_parts(28_755_652, 3816) + // Standard Error: 3_536 + .saturating_add(Weight::from_parts(78_348, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -106,9 +103,9 @@ impl WeightInfo for SubstrateWeight { fn initiate_recovery() -> Weight { // Proof Size summary in bytes: // Measured: `272` - // Estimated: `7670` - // Minimum execution time: 28_148_000 picoseconds. - Weight::from_parts(28_577_000, 7670) + // Estimated: `3854` + // Minimum execution time: 31_233_000 picoseconds. + Weight::from_parts(31_508_000, 3854) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,11 +117,11 @@ impl WeightInfo for SubstrateWeight { fn vouch_recovery(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `360 + n * (64 ±0)` - // Estimated: `7670` - // Minimum execution time: 20_395_000 picoseconds. - Weight::from_parts(21_287_972, 7670) - // Standard Error: 4_464 - .saturating_add(Weight::from_parts(170_214, 0).saturating_mul(n.into())) + // Estimated: `3854` + // Minimum execution time: 20_542_000 picoseconds. + Weight::from_parts(21_224_065, 3854) + // Standard Error: 3_018 + .saturating_add(Weight::from_parts(171_994, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -138,11 +135,11 @@ impl WeightInfo for SubstrateWeight { fn claim_recovery(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `392 + n * (64 ±0)` - // Estimated: `11215` - // Minimum execution time: 24_902_000 picoseconds. - Weight::from_parts(25_662_621, 11215) - // Standard Error: 3_101 - .saturating_add(Weight::from_parts(60_748, 0).saturating_mul(n.into())) + // Estimated: `3854` + // Minimum execution time: 25_141_000 picoseconds. + Weight::from_parts(25_880_238, 3854) + // Standard Error: 3_156 + .saturating_add(Weight::from_parts(54_405, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -154,11 +151,11 @@ impl WeightInfo for SubstrateWeight { fn close_recovery(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `513 + n * (32 ±0)` - // Estimated: `7447` - // Minimum execution time: 30_071_000 picoseconds. - Weight::from_parts(30_727_760, 7447) - // Standard Error: 4_442 - .saturating_add(Weight::from_parts(98_153, 0).saturating_mul(n.into())) + // Estimated: `3854` + // Minimum execution time: 35_314_000 picoseconds. + Weight::from_parts(36_380_338, 3854) + // Standard Error: 7_396 + .saturating_add(Weight::from_parts(3_861, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -167,12 +164,14 @@ impl WeightInfo for SubstrateWeight { /// Storage: Recovery Recoverable (r:1 w:1) /// Proof: Recovery Recoverable (max_values: None, max_size: Some(351), added: 2826, mode: MaxEncodedLen) /// The range of component `n` is `[1, 9]`. - fn remove_recovery(_n: u32, ) -> Weight { + fn remove_recovery(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `270 + n * (32 ±0)` - // Estimated: `7670` - // Minimum execution time: 29_088_000 picoseconds. - Weight::from_parts(30_535_744, 7670) + // Estimated: `3854` + // Minimum execution time: 33_453_000 picoseconds. + Weight::from_parts(34_078_626, 3854) + // Standard Error: 2_563 + .saturating_add(Weight::from_parts(78_179, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -182,8 +181,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `281` // Estimated: `3545` - // Minimum execution time: 12_712_000 picoseconds. - Weight::from_parts(12_980_000, 3545) + // Minimum execution time: 12_196_000 picoseconds. + Weight::from_parts(12_580_000, 3545) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -197,8 +196,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `281` // Estimated: `3545` - // Minimum execution time: 9_937_000 picoseconds. - Weight::from_parts(10_213_000, 3545) + // Minimum execution time: 10_405_000 picoseconds. + Weight::from_parts(10_807_000, 3545) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: Recovery Proxy (r:0 w:1) @@ -207,8 +206,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_704_000 picoseconds. - Weight::from_parts(9_997_000, 0) + // Minimum execution time: 11_198_000 picoseconds. + Weight::from_parts(11_459_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Recovery Recoverable (r:1 w:1) @@ -218,10 +217,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `175` // Estimated: `3816` - // Minimum execution time: 23_260_000 picoseconds. - Weight::from_parts(24_408_081, 3816) - // Standard Error: 3_086 - .saturating_add(Weight::from_parts(41_628, 0).saturating_mul(n.into())) + // Minimum execution time: 28_009_000 picoseconds. + Weight::from_parts(28_755_652, 3816) + // Standard Error: 3_536 + .saturating_add(Weight::from_parts(78_348, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -232,9 +231,9 @@ impl WeightInfo for () { fn initiate_recovery() -> Weight { // Proof Size summary in bytes: // Measured: `272` - // Estimated: `7670` - // Minimum execution time: 28_148_000 picoseconds. - Weight::from_parts(28_577_000, 7670) + // Estimated: `3854` + // Minimum execution time: 31_233_000 picoseconds. + Weight::from_parts(31_508_000, 3854) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -246,11 +245,11 @@ impl WeightInfo for () { fn vouch_recovery(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `360 + n * (64 ±0)` - // Estimated: `7670` - // Minimum execution time: 20_395_000 picoseconds. - Weight::from_parts(21_287_972, 7670) - // Standard Error: 4_464 - .saturating_add(Weight::from_parts(170_214, 0).saturating_mul(n.into())) + // Estimated: `3854` + // Minimum execution time: 20_542_000 picoseconds. + Weight::from_parts(21_224_065, 3854) + // Standard Error: 3_018 + .saturating_add(Weight::from_parts(171_994, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -264,11 +263,11 @@ impl WeightInfo for () { fn claim_recovery(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `392 + n * (64 ±0)` - // Estimated: `11215` - // Minimum execution time: 24_902_000 picoseconds. - Weight::from_parts(25_662_621, 11215) - // Standard Error: 3_101 - .saturating_add(Weight::from_parts(60_748, 0).saturating_mul(n.into())) + // Estimated: `3854` + // Minimum execution time: 25_141_000 picoseconds. + Weight::from_parts(25_880_238, 3854) + // Standard Error: 3_156 + .saturating_add(Weight::from_parts(54_405, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -280,11 +279,11 @@ impl WeightInfo for () { fn close_recovery(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `513 + n * (32 ±0)` - // Estimated: `7447` - // Minimum execution time: 30_071_000 picoseconds. - Weight::from_parts(30_727_760, 7447) - // Standard Error: 4_442 - .saturating_add(Weight::from_parts(98_153, 0).saturating_mul(n.into())) + // Estimated: `3854` + // Minimum execution time: 35_314_000 picoseconds. + Weight::from_parts(36_380_338, 3854) + // Standard Error: 7_396 + .saturating_add(Weight::from_parts(3_861, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -293,12 +292,14 @@ impl WeightInfo for () { /// Storage: Recovery Recoverable (r:1 w:1) /// Proof: Recovery Recoverable (max_values: None, max_size: Some(351), added: 2826, mode: MaxEncodedLen) /// The range of component `n` is `[1, 9]`. - fn remove_recovery(_n: u32, ) -> Weight { + fn remove_recovery(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `270 + n * (32 ±0)` - // Estimated: `7670` - // Minimum execution time: 29_088_000 picoseconds. - Weight::from_parts(30_535_744, 7670) + // Estimated: `3854` + // Minimum execution time: 33_453_000 picoseconds. + Weight::from_parts(34_078_626, 3854) + // Standard Error: 2_563 + .saturating_add(Weight::from_parts(78_179, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -308,8 +309,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `281` // Estimated: `3545` - // Minimum execution time: 12_712_000 picoseconds. - Weight::from_parts(12_980_000, 3545) + // Minimum execution time: 12_196_000 picoseconds. + Weight::from_parts(12_580_000, 3545) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/referenda/src/weights.rs b/frame/referenda/src/weights.rs index 3ac0f54ed8307..464e60dc581e6 100644 --- a/frame/referenda/src/weights.rs +++ b/frame/referenda/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_referenda //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_referenda -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -95,9 +92,9 @@ impl WeightInfo for SubstrateWeight { fn submit() -> Weight { // Proof Size summary in bytes: // Measured: `220` - // Estimated: `111976` - // Minimum execution time: 36_851_000 picoseconds. - Weight::from_parts(37_183_000, 111976) + // Estimated: `110487` + // Minimum execution time: 42_285_000 picoseconds. + Weight::from_parts(42_646_000, 110487) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -108,9 +105,9 @@ impl WeightInfo for SubstrateWeight { fn place_decision_deposit_preparing() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `223815` - // Minimum execution time: 49_435_000 picoseconds. - Weight::from_parts(50_056_000, 223815) + // Estimated: `219984` + // Minimum execution time: 53_455_000 picoseconds. + Weight::from_parts(54_034_000, 219984) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -123,9 +120,9 @@ impl WeightInfo for SubstrateWeight { fn place_decision_deposit_queued() -> Weight { // Proof Size summary in bytes: // Measured: `3107` - // Estimated: `12787` - // Minimum execution time: 47_061_000 picoseconds. - Weight::from_parts(47_579_000, 12787) + // Estimated: `5477` + // Minimum execution time: 50_138_000 picoseconds. + Weight::from_parts(50_449_000, 5477) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -138,9 +135,9 @@ impl WeightInfo for SubstrateWeight { fn place_decision_deposit_not_queued() -> Weight { // Proof Size summary in bytes: // Measured: `3127` - // Estimated: `12787` - // Minimum execution time: 46_513_000 picoseconds. - Weight::from_parts(47_212_000, 12787) + // Estimated: `5477` + // Minimum execution time: 49_707_000 picoseconds. + Weight::from_parts(50_246_000, 5477) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -153,9 +150,9 @@ impl WeightInfo for SubstrateWeight { fn place_decision_deposit_passing() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `227294` - // Minimum execution time: 59_255_000 picoseconds. - Weight::from_parts(60_114_000, 227294) + // Estimated: `219984` + // Minimum execution time: 62_880_000 picoseconds. + Weight::from_parts(63_579_000, 219984) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -168,9 +165,9 @@ impl WeightInfo for SubstrateWeight { fn place_decision_deposit_failing() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `227294` - // Minimum execution time: 57_927_000 picoseconds. - Weight::from_parts(58_625_000, 227294) + // Estimated: `219984` + // Minimum execution time: 60_827_000 picoseconds. + Weight::from_parts(61_392_000, 219984) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -180,8 +177,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `351` // Estimated: `3831` - // Minimum execution time: 27_186_000 picoseconds. - Weight::from_parts(27_551_000, 3831) + // Minimum execution time: 31_991_000 picoseconds. + Weight::from_parts(32_474_000, 3831) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -191,8 +188,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `341` // Estimated: `3831` - // Minimum execution time: 27_339_000 picoseconds. - Weight::from_parts(27_828_000, 3831) + // Minimum execution time: 32_162_000 picoseconds. + Weight::from_parts(32_776_000, 3831) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -203,9 +200,9 @@ impl WeightInfo for SubstrateWeight { fn cancel() -> Weight { // Proof Size summary in bytes: // Measured: `381` - // Estimated: `223815` - // Minimum execution time: 37_081_000 picoseconds. - Weight::from_parts(38_110_000, 223815) + // Estimated: `219984` + // Minimum execution time: 37_493_000 picoseconds. + Weight::from_parts(37_979_000, 219984) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -218,9 +215,9 @@ impl WeightInfo for SubstrateWeight { fn kill() -> Weight { // Proof Size summary in bytes: // Measured: `622` - // Estimated: `227332` - // Minimum execution time: 70_195_000 picoseconds. - Weight::from_parts(71_451_000, 227332) + // Estimated: `219984` + // Minimum execution time: 80_095_000 picoseconds. + Weight::from_parts(80_831_000, 219984) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -231,9 +228,9 @@ impl WeightInfo for SubstrateWeight { fn one_fewer_deciding_queue_empty() -> Weight { // Proof Size summary in bytes: // Measured: `174` - // Estimated: `8956` - // Minimum execution time: 10_748_000 picoseconds. - Weight::from_parts(10_912_000, 8956) + // Estimated: `5477` + // Minimum execution time: 10_906_000 picoseconds. + Weight::from_parts(11_055_000, 5477) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -246,9 +243,9 @@ impl WeightInfo for SubstrateWeight { fn one_fewer_deciding_failing() -> Weight { // Proof Size summary in bytes: // Measured: `4567` - // Estimated: `229292` - // Minimum execution time: 89_144_000 picoseconds. - Weight::from_parts(90_552_000, 229292) + // Estimated: `219984` + // Minimum execution time: 90_747_000 picoseconds. + Weight::from_parts(91_407_000, 219984) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -261,9 +258,9 @@ impl WeightInfo for SubstrateWeight { fn one_fewer_deciding_passing() -> Weight { // Proof Size summary in bytes: // Measured: `4567` - // Estimated: `229292` - // Minimum execution time: 92_164_000 picoseconds. - Weight::from_parts(92_947_000, 229292) + // Estimated: `219984` + // Minimum execution time: 93_615_000 picoseconds. + Weight::from_parts(94_245_000, 219984) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -276,9 +273,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_requeued_insertion() -> Weight { // Proof Size summary in bytes: // Measured: `4588` - // Estimated: `119795` - // Minimum execution time: 59_212_000 picoseconds. - Weight::from_parts(59_843_000, 119795) + // Estimated: `110487` + // Minimum execution time: 60_945_000 picoseconds. + Weight::from_parts(61_246_000, 110487) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -291,9 +288,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_requeued_slide() -> Weight { // Proof Size summary in bytes: // Measured: `4574` - // Estimated: `119795` - // Minimum execution time: 59_049_000 picoseconds. - Weight::from_parts(59_760_000, 119795) + // Estimated: `110487` + // Minimum execution time: 60_105_000 picoseconds. + Weight::from_parts(60_544_000, 110487) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -308,9 +305,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_queued() -> Weight { // Proof Size summary in bytes: // Measured: `4548` - // Estimated: `123274` - // Minimum execution time: 61_774_000 picoseconds. - Weight::from_parts(62_480_000, 123274) + // Estimated: `110487` + // Minimum execution time: 62_251_000 picoseconds. + Weight::from_parts(62_952_000, 110487) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -325,9 +322,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_not_queued() -> Weight { // Proof Size summary in bytes: // Measured: `4582` - // Estimated: `123274` - // Minimum execution time: 61_605_000 picoseconds. - Weight::from_parts(62_385_000, 123274) + // Estimated: `110487` + // Minimum execution time: 61_527_000 picoseconds. + Weight::from_parts(62_082_000, 110487) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -338,9 +335,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_no_deposit() -> Weight { // Proof Size summary in bytes: // Measured: `333` - // Estimated: `114318` - // Minimum execution time: 24_423_000 picoseconds. - Weight::from_parts(24_747_000, 114318) + // Estimated: `110487` + // Minimum execution time: 24_897_000 picoseconds. + Weight::from_parts(25_213_000, 110487) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -351,9 +348,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_preparing() -> Weight { // Proof Size summary in bytes: // Measured: `381` - // Estimated: `114318` - // Minimum execution time: 24_487_000 picoseconds. - Weight::from_parts(24_941_000, 114318) + // Estimated: `110487` + // Minimum execution time: 25_077_000 picoseconds. + Weight::from_parts(25_385_000, 110487) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -363,8 +360,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `278` // Estimated: `3831` - // Minimum execution time: 17_454_000 picoseconds. - Weight::from_parts(17_697_000, 3831) + // Minimum execution time: 17_930_000 picoseconds. + Weight::from_parts(18_112_000, 3831) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -377,9 +374,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_begin_deciding_failing() -> Weight { // Proof Size summary in bytes: // Measured: `381` - // Estimated: `117797` - // Minimum execution time: 34_721_000 picoseconds. - Weight::from_parts(35_295_000, 117797) + // Estimated: `110487` + // Minimum execution time: 34_405_000 picoseconds. + Weight::from_parts(34_698_000, 110487) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -392,9 +389,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_begin_deciding_passing() -> Weight { // Proof Size summary in bytes: // Measured: `381` - // Estimated: `117797` - // Minimum execution time: 36_587_000 picoseconds. - Weight::from_parts(37_095_000, 117797) + // Estimated: `110487` + // Minimum execution time: 37_313_000 picoseconds. + Weight::from_parts(37_807_000, 110487) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -405,9 +402,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_begin_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `434` - // Estimated: `114318` - // Minimum execution time: 30_003_000 picoseconds. - Weight::from_parts(30_541_000, 114318) + // Estimated: `110487` + // Minimum execution time: 30_552_000 picoseconds. + Weight::from_parts(30_817_000, 110487) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -418,9 +415,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_end_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `114318` - // Minimum execution time: 30_479_000 picoseconds. - Weight::from_parts(30_900_000, 114318) + // Estimated: `110487` + // Minimum execution time: 31_100_000 picoseconds. + Weight::from_parts(31_696_000, 110487) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -431,9 +428,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_continue_not_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `434` - // Estimated: `114318` - // Minimum execution time: 27_657_000 picoseconds. - Weight::from_parts(28_054_000, 114318) + // Estimated: `110487` + // Minimum execution time: 28_777_000 picoseconds. + Weight::from_parts(29_188_000, 110487) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -444,9 +441,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_continue_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `438` - // Estimated: `114318` - // Minimum execution time: 26_713_000 picoseconds. - Weight::from_parts(27_284_000, 114318) + // Estimated: `110487` + // Minimum execution time: 26_986_000 picoseconds. + Weight::from_parts(27_283_000, 110487) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -459,9 +456,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_approved() -> Weight { // Proof Size summary in bytes: // Measured: `438` - // Estimated: `227328` - // Minimum execution time: 42_374_000 picoseconds. - Weight::from_parts(43_142_000, 227328) + // Estimated: `219984` + // Minimum execution time: 43_538_000 picoseconds. + Weight::from_parts(44_671_000, 219984) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -472,9 +469,9 @@ impl WeightInfo for SubstrateWeight { fn nudge_referendum_rejected() -> Weight { // Proof Size summary in bytes: // Measured: `434` - // Estimated: `114318` - // Minimum execution time: 30_213_000 picoseconds. - Weight::from_parts(30_633_000, 114318) + // Estimated: `110487` + // Minimum execution time: 30_559_000 picoseconds. + Weight::from_parts(31_294_000, 110487) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -487,9 +484,9 @@ impl WeightInfo for SubstrateWeight { fn set_some_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `422` - // Estimated: `7387` - // Minimum execution time: 20_887_000 picoseconds. - Weight::from_parts(21_242_000, 7387) + // Estimated: `3831` + // Minimum execution time: 21_196_000 picoseconds. + Weight::from_parts(21_593_000, 3831) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -500,9 +497,9 @@ impl WeightInfo for SubstrateWeight { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `355` - // Estimated: `7348` - // Minimum execution time: 18_702_000 picoseconds. - Weight::from_parts(18_880_000, 7348) + // Estimated: `3831` + // Minimum execution time: 18_827_000 picoseconds. + Weight::from_parts(19_171_000, 3831) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -519,9 +516,9 @@ impl WeightInfo for () { fn submit() -> Weight { // Proof Size summary in bytes: // Measured: `220` - // Estimated: `111976` - // Minimum execution time: 36_851_000 picoseconds. - Weight::from_parts(37_183_000, 111976) + // Estimated: `110487` + // Minimum execution time: 42_285_000 picoseconds. + Weight::from_parts(42_646_000, 110487) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -532,9 +529,9 @@ impl WeightInfo for () { fn place_decision_deposit_preparing() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `223815` - // Minimum execution time: 49_435_000 picoseconds. - Weight::from_parts(50_056_000, 223815) + // Estimated: `219984` + // Minimum execution time: 53_455_000 picoseconds. + Weight::from_parts(54_034_000, 219984) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -547,9 +544,9 @@ impl WeightInfo for () { fn place_decision_deposit_queued() -> Weight { // Proof Size summary in bytes: // Measured: `3107` - // Estimated: `12787` - // Minimum execution time: 47_061_000 picoseconds. - Weight::from_parts(47_579_000, 12787) + // Estimated: `5477` + // Minimum execution time: 50_138_000 picoseconds. + Weight::from_parts(50_449_000, 5477) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -562,9 +559,9 @@ impl WeightInfo for () { fn place_decision_deposit_not_queued() -> Weight { // Proof Size summary in bytes: // Measured: `3127` - // Estimated: `12787` - // Minimum execution time: 46_513_000 picoseconds. - Weight::from_parts(47_212_000, 12787) + // Estimated: `5477` + // Minimum execution time: 49_707_000 picoseconds. + Weight::from_parts(50_246_000, 5477) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -577,9 +574,9 @@ impl WeightInfo for () { fn place_decision_deposit_passing() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `227294` - // Minimum execution time: 59_255_000 picoseconds. - Weight::from_parts(60_114_000, 227294) + // Estimated: `219984` + // Minimum execution time: 62_880_000 picoseconds. + Weight::from_parts(63_579_000, 219984) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -592,9 +589,9 @@ impl WeightInfo for () { fn place_decision_deposit_failing() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `227294` - // Minimum execution time: 57_927_000 picoseconds. - Weight::from_parts(58_625_000, 227294) + // Estimated: `219984` + // Minimum execution time: 60_827_000 picoseconds. + Weight::from_parts(61_392_000, 219984) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -604,8 +601,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `351` // Estimated: `3831` - // Minimum execution time: 27_186_000 picoseconds. - Weight::from_parts(27_551_000, 3831) + // Minimum execution time: 31_991_000 picoseconds. + Weight::from_parts(32_474_000, 3831) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -615,8 +612,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `341` // Estimated: `3831` - // Minimum execution time: 27_339_000 picoseconds. - Weight::from_parts(27_828_000, 3831) + // Minimum execution time: 32_162_000 picoseconds. + Weight::from_parts(32_776_000, 3831) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -627,9 +624,9 @@ impl WeightInfo for () { fn cancel() -> Weight { // Proof Size summary in bytes: // Measured: `381` - // Estimated: `223815` - // Minimum execution time: 37_081_000 picoseconds. - Weight::from_parts(38_110_000, 223815) + // Estimated: `219984` + // Minimum execution time: 37_493_000 picoseconds. + Weight::from_parts(37_979_000, 219984) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -642,9 +639,9 @@ impl WeightInfo for () { fn kill() -> Weight { // Proof Size summary in bytes: // Measured: `622` - // Estimated: `227332` - // Minimum execution time: 70_195_000 picoseconds. - Weight::from_parts(71_451_000, 227332) + // Estimated: `219984` + // Minimum execution time: 80_095_000 picoseconds. + Weight::from_parts(80_831_000, 219984) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -655,9 +652,9 @@ impl WeightInfo for () { fn one_fewer_deciding_queue_empty() -> Weight { // Proof Size summary in bytes: // Measured: `174` - // Estimated: `8956` - // Minimum execution time: 10_748_000 picoseconds. - Weight::from_parts(10_912_000, 8956) + // Estimated: `5477` + // Minimum execution time: 10_906_000 picoseconds. + Weight::from_parts(11_055_000, 5477) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -670,9 +667,9 @@ impl WeightInfo for () { fn one_fewer_deciding_failing() -> Weight { // Proof Size summary in bytes: // Measured: `4567` - // Estimated: `229292` - // Minimum execution time: 89_144_000 picoseconds. - Weight::from_parts(90_552_000, 229292) + // Estimated: `219984` + // Minimum execution time: 90_747_000 picoseconds. + Weight::from_parts(91_407_000, 219984) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -685,9 +682,9 @@ impl WeightInfo for () { fn one_fewer_deciding_passing() -> Weight { // Proof Size summary in bytes: // Measured: `4567` - // Estimated: `229292` - // Minimum execution time: 92_164_000 picoseconds. - Weight::from_parts(92_947_000, 229292) + // Estimated: `219984` + // Minimum execution time: 93_615_000 picoseconds. + Weight::from_parts(94_245_000, 219984) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -700,9 +697,9 @@ impl WeightInfo for () { fn nudge_referendum_requeued_insertion() -> Weight { // Proof Size summary in bytes: // Measured: `4588` - // Estimated: `119795` - // Minimum execution time: 59_212_000 picoseconds. - Weight::from_parts(59_843_000, 119795) + // Estimated: `110487` + // Minimum execution time: 60_945_000 picoseconds. + Weight::from_parts(61_246_000, 110487) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -715,9 +712,9 @@ impl WeightInfo for () { fn nudge_referendum_requeued_slide() -> Weight { // Proof Size summary in bytes: // Measured: `4574` - // Estimated: `119795` - // Minimum execution time: 59_049_000 picoseconds. - Weight::from_parts(59_760_000, 119795) + // Estimated: `110487` + // Minimum execution time: 60_105_000 picoseconds. + Weight::from_parts(60_544_000, 110487) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -732,9 +729,9 @@ impl WeightInfo for () { fn nudge_referendum_queued() -> Weight { // Proof Size summary in bytes: // Measured: `4548` - // Estimated: `123274` - // Minimum execution time: 61_774_000 picoseconds. - Weight::from_parts(62_480_000, 123274) + // Estimated: `110487` + // Minimum execution time: 62_251_000 picoseconds. + Weight::from_parts(62_952_000, 110487) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -749,9 +746,9 @@ impl WeightInfo for () { fn nudge_referendum_not_queued() -> Weight { // Proof Size summary in bytes: // Measured: `4582` - // Estimated: `123274` - // Minimum execution time: 61_605_000 picoseconds. - Weight::from_parts(62_385_000, 123274) + // Estimated: `110487` + // Minimum execution time: 61_527_000 picoseconds. + Weight::from_parts(62_082_000, 110487) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -762,9 +759,9 @@ impl WeightInfo for () { fn nudge_referendum_no_deposit() -> Weight { // Proof Size summary in bytes: // Measured: `333` - // Estimated: `114318` - // Minimum execution time: 24_423_000 picoseconds. - Weight::from_parts(24_747_000, 114318) + // Estimated: `110487` + // Minimum execution time: 24_897_000 picoseconds. + Weight::from_parts(25_213_000, 110487) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -775,9 +772,9 @@ impl WeightInfo for () { fn nudge_referendum_preparing() -> Weight { // Proof Size summary in bytes: // Measured: `381` - // Estimated: `114318` - // Minimum execution time: 24_487_000 picoseconds. - Weight::from_parts(24_941_000, 114318) + // Estimated: `110487` + // Minimum execution time: 25_077_000 picoseconds. + Weight::from_parts(25_385_000, 110487) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -787,8 +784,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `278` // Estimated: `3831` - // Minimum execution time: 17_454_000 picoseconds. - Weight::from_parts(17_697_000, 3831) + // Minimum execution time: 17_930_000 picoseconds. + Weight::from_parts(18_112_000, 3831) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -801,9 +798,9 @@ impl WeightInfo for () { fn nudge_referendum_begin_deciding_failing() -> Weight { // Proof Size summary in bytes: // Measured: `381` - // Estimated: `117797` - // Minimum execution time: 34_721_000 picoseconds. - Weight::from_parts(35_295_000, 117797) + // Estimated: `110487` + // Minimum execution time: 34_405_000 picoseconds. + Weight::from_parts(34_698_000, 110487) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -816,9 +813,9 @@ impl WeightInfo for () { fn nudge_referendum_begin_deciding_passing() -> Weight { // Proof Size summary in bytes: // Measured: `381` - // Estimated: `117797` - // Minimum execution time: 36_587_000 picoseconds. - Weight::from_parts(37_095_000, 117797) + // Estimated: `110487` + // Minimum execution time: 37_313_000 picoseconds. + Weight::from_parts(37_807_000, 110487) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -829,9 +826,9 @@ impl WeightInfo for () { fn nudge_referendum_begin_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `434` - // Estimated: `114318` - // Minimum execution time: 30_003_000 picoseconds. - Weight::from_parts(30_541_000, 114318) + // Estimated: `110487` + // Minimum execution time: 30_552_000 picoseconds. + Weight::from_parts(30_817_000, 110487) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -842,9 +839,9 @@ impl WeightInfo for () { fn nudge_referendum_end_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `114318` - // Minimum execution time: 30_479_000 picoseconds. - Weight::from_parts(30_900_000, 114318) + // Estimated: `110487` + // Minimum execution time: 31_100_000 picoseconds. + Weight::from_parts(31_696_000, 110487) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -855,9 +852,9 @@ impl WeightInfo for () { fn nudge_referendum_continue_not_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `434` - // Estimated: `114318` - // Minimum execution time: 27_657_000 picoseconds. - Weight::from_parts(28_054_000, 114318) + // Estimated: `110487` + // Minimum execution time: 28_777_000 picoseconds. + Weight::from_parts(29_188_000, 110487) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -868,9 +865,9 @@ impl WeightInfo for () { fn nudge_referendum_continue_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `438` - // Estimated: `114318` - // Minimum execution time: 26_713_000 picoseconds. - Weight::from_parts(27_284_000, 114318) + // Estimated: `110487` + // Minimum execution time: 26_986_000 picoseconds. + Weight::from_parts(27_283_000, 110487) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -883,9 +880,9 @@ impl WeightInfo for () { fn nudge_referendum_approved() -> Weight { // Proof Size summary in bytes: // Measured: `438` - // Estimated: `227328` - // Minimum execution time: 42_374_000 picoseconds. - Weight::from_parts(43_142_000, 227328) + // Estimated: `219984` + // Minimum execution time: 43_538_000 picoseconds. + Weight::from_parts(44_671_000, 219984) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -896,9 +893,9 @@ impl WeightInfo for () { fn nudge_referendum_rejected() -> Weight { // Proof Size summary in bytes: // Measured: `434` - // Estimated: `114318` - // Minimum execution time: 30_213_000 picoseconds. - Weight::from_parts(30_633_000, 114318) + // Estimated: `110487` + // Minimum execution time: 30_559_000 picoseconds. + Weight::from_parts(31_294_000, 110487) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -911,9 +908,9 @@ impl WeightInfo for () { fn set_some_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `422` - // Estimated: `7387` - // Minimum execution time: 20_887_000 picoseconds. - Weight::from_parts(21_242_000, 7387) + // Estimated: `3831` + // Minimum execution time: 21_196_000 picoseconds. + Weight::from_parts(21_593_000, 3831) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -924,9 +921,9 @@ impl WeightInfo for () { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `355` - // Estimated: `7348` - // Minimum execution time: 18_702_000 picoseconds. - Weight::from_parts(18_880_000, 7348) + // Estimated: `3831` + // Minimum execution time: 18_827_000 picoseconds. + Weight::from_parts(19_171_000, 3831) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/remark/src/weights.rs b/frame/remark/src/weights.rs index bb2e91b5dfbd0..9aa56eb339fcb 100644 --- a/frame/remark/src/weights.rs +++ b/frame/remark/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_remark //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_remark -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -62,10 +59,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_284_000 picoseconds. - Weight::from_parts(4_054_843, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_094, 0).saturating_mul(l.into())) + // Minimum execution time: 9_301_000 picoseconds. + Weight::from_parts(2_516_065, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_089, 0).saturating_mul(l.into())) } } @@ -76,9 +73,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_284_000 picoseconds. - Weight::from_parts(4_054_843, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_094, 0).saturating_mul(l.into())) + // Minimum execution time: 9_301_000 picoseconds. + Weight::from_parts(2_516_065, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_089, 0).saturating_mul(l.into())) } } diff --git a/frame/salary/src/weights.rs b/frame/salary/src/weights.rs index 7195a144a65a3..074bff4da170d 100644 --- a/frame/salary/src/weights.rs +++ b/frame/salary/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_salary //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_salary -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -69,8 +66,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `4` // Estimated: `1541` - // Minimum execution time: 11_732_000 picoseconds. - Weight::from_parts(12_162_000, 1541) + // Minimum execution time: 11_785_000 picoseconds. + Weight::from_parts(12_086_000, 1541) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +77,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `86` // Estimated: `1541` - // Minimum execution time: 12_966_000 picoseconds. - Weight::from_parts(13_443_000, 1541) + // Minimum execution time: 12_721_000 picoseconds. + Weight::from_parts(13_033_000, 1541) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -94,9 +91,9 @@ impl WeightInfo for SubstrateWeight { fn induct() -> Weight { // Proof Size summary in bytes: // Measured: `362` - // Estimated: `8591` - // Minimum execution time: 20_467_000 picoseconds. - Weight::from_parts(20_782_000, 8591) + // Estimated: `3543` + // Minimum execution time: 19_516_000 picoseconds. + Weight::from_parts(19_938_000, 3543) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -109,9 +106,9 @@ impl WeightInfo for SubstrateWeight { fn register() -> Weight { // Proof Size summary in bytes: // Measured: `429` - // Estimated: `8591` - // Minimum execution time: 23_547_000 picoseconds. - Weight::from_parts(23_911_000, 8591) + // Estimated: `3543` + // Minimum execution time: 23_145_000 picoseconds. + Weight::from_parts(23_804_000, 3543) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -124,9 +121,9 @@ impl WeightInfo for SubstrateWeight { fn payout() -> Weight { // Proof Size summary in bytes: // Measured: `429` - // Estimated: `8591` - // Minimum execution time: 47_145_000 picoseconds. - Weight::from_parts(47_778_000, 8591) + // Estimated: `3543` + // Minimum execution time: 62_187_000 picoseconds. + Weight::from_parts(63_016_000, 3543) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -141,9 +138,9 @@ impl WeightInfo for SubstrateWeight { fn payout_other() -> Weight { // Proof Size summary in bytes: // Measured: `429` - // Estimated: `12184` - // Minimum execution time: 48_763_000 picoseconds. - Weight::from_parts(49_853_000, 12184) + // Estimated: `3593` + // Minimum execution time: 63_828_000 picoseconds. + Weight::from_parts(64_791_000, 3593) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -154,9 +151,9 @@ impl WeightInfo for SubstrateWeight { fn check_payment() -> Weight { // Proof Size summary in bytes: // Measured: `170` - // Estimated: `5084` - // Minimum execution time: 12_825_000 picoseconds. - Weight::from_parts(13_143_000, 5084) + // Estimated: `3543` + // Minimum execution time: 12_911_000 picoseconds. + Weight::from_parts(13_079_000, 3543) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -170,8 +167,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `4` // Estimated: `1541` - // Minimum execution time: 11_732_000 picoseconds. - Weight::from_parts(12_162_000, 1541) + // Minimum execution time: 11_785_000 picoseconds. + Weight::from_parts(12_086_000, 1541) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -181,8 +178,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `86` // Estimated: `1541` - // Minimum execution time: 12_966_000 picoseconds. - Weight::from_parts(13_443_000, 1541) + // Minimum execution time: 12_721_000 picoseconds. + Weight::from_parts(13_033_000, 1541) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -195,9 +192,9 @@ impl WeightInfo for () { fn induct() -> Weight { // Proof Size summary in bytes: // Measured: `362` - // Estimated: `8591` - // Minimum execution time: 20_467_000 picoseconds. - Weight::from_parts(20_782_000, 8591) + // Estimated: `3543` + // Minimum execution time: 19_516_000 picoseconds. + Weight::from_parts(19_938_000, 3543) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -210,9 +207,9 @@ impl WeightInfo for () { fn register() -> Weight { // Proof Size summary in bytes: // Measured: `429` - // Estimated: `8591` - // Minimum execution time: 23_547_000 picoseconds. - Weight::from_parts(23_911_000, 8591) + // Estimated: `3543` + // Minimum execution time: 23_145_000 picoseconds. + Weight::from_parts(23_804_000, 3543) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -225,9 +222,9 @@ impl WeightInfo for () { fn payout() -> Weight { // Proof Size summary in bytes: // Measured: `429` - // Estimated: `8591` - // Minimum execution time: 47_145_000 picoseconds. - Weight::from_parts(47_778_000, 8591) + // Estimated: `3543` + // Minimum execution time: 62_187_000 picoseconds. + Weight::from_parts(63_016_000, 3543) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -242,9 +239,9 @@ impl WeightInfo for () { fn payout_other() -> Weight { // Proof Size summary in bytes: // Measured: `429` - // Estimated: `12184` - // Minimum execution time: 48_763_000 picoseconds. - Weight::from_parts(49_853_000, 12184) + // Estimated: `3593` + // Minimum execution time: 63_828_000 picoseconds. + Weight::from_parts(64_791_000, 3593) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -255,9 +252,9 @@ impl WeightInfo for () { fn check_payment() -> Weight { // Proof Size summary in bytes: // Measured: `170` - // Estimated: `5084` - // Minimum execution time: 12_825_000 picoseconds. - Weight::from_parts(13_143_000, 5084) + // Estimated: `3543` + // Minimum execution time: 12_911_000 picoseconds. + Weight::from_parts(13_079_000, 3543) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/frame/scheduler/src/weights.rs b/frame/scheduler/src/weights.rs index bccb502656a72..897363f134e7b 100644 --- a/frame/scheduler/src/weights.rs +++ b/frame/scheduler/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_scheduler //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_scheduler -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -74,8 +71,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `31` // Estimated: `1489` - // Minimum execution time: 3_965_000 picoseconds. - Weight::from_parts(4_126_000, 1489) + // Minimum execution time: 3_776_000 picoseconds. + Weight::from_parts(3_992_000, 1489) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -86,10 +83,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `81 + s * (177 ±0)` // Estimated: `110487` - // Minimum execution time: 3_662_000 picoseconds. - Weight::from_parts(8_746_597, 110487) - // Standard Error: 754 - .saturating_add(Weight::from_parts(309_350, 0).saturating_mul(s.into())) + // Minimum execution time: 3_418_000 picoseconds. + Weight::from_parts(8_606_012, 110487) + // Standard Error: 769 + .saturating_add(Weight::from_parts(309_376, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -97,8 +94,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_807_000 picoseconds. - Weight::from_parts(5_963_000, 0) + // Minimum execution time: 5_624_000 picoseconds. + Weight::from_parts(5_758_000, 0) } /// Storage: Preimage PreimageFor (r:1 w:1) /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: Measured) @@ -108,11 +105,11 @@ impl WeightInfo for SubstrateWeight { fn service_task_fetched(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `179 + s * (1 ±0)` - // Estimated: `7200 + s * (1 ±0)` - // Minimum execution time: 20_188_000 picoseconds. - Weight::from_parts(20_422_000, 7200) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_143, 0).saturating_mul(s.into())) + // Estimated: `3644 + s * (1 ±0)` + // Minimum execution time: 20_150_000 picoseconds. + Weight::from_parts(20_271_000, 3644) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_132, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) @@ -123,30 +120,30 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_787_000 picoseconds. - Weight::from_parts(8_046_000, 0) + // Minimum execution time: 7_451_000 picoseconds. + Weight::from_parts(7_693_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } fn service_task_periodic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_730_000 picoseconds. - Weight::from_parts(5_901_000, 0) + // Minimum execution time: 5_477_000 picoseconds. + Weight::from_parts(5_733_000, 0) } fn execute_dispatch_signed() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_569_000 picoseconds. - Weight::from_parts(2_710_000, 0) + // Minimum execution time: 2_675_000 picoseconds. + Weight::from_parts(2_870_000, 0) } fn execute_dispatch_unsigned() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_611_000 picoseconds. - Weight::from_parts(2_765_000, 0) + // Minimum execution time: 2_697_000 picoseconds. + Weight::from_parts(2_807_000, 0) } /// Storage: Scheduler Agenda (r:1 w:1) /// Proof: Scheduler Agenda (max_values: None, max_size: Some(107022), added: 109497, mode: MaxEncodedLen) @@ -155,10 +152,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `81 + s * (177 ±0)` // Estimated: `110487` - // Minimum execution time: 14_237_000 picoseconds. - Weight::from_parts(18_553_929, 110487) - // Standard Error: 757 - .saturating_add(Weight::from_parts(327_347, 0).saturating_mul(s.into())) + // Minimum execution time: 13_921_000 picoseconds. + Weight::from_parts(18_717_223, 110487) + // Standard Error: 771 + .saturating_add(Weight::from_parts(333_102, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -171,10 +168,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `81 + s * (177 ±0)` // Estimated: `110487` - // Minimum execution time: 18_003_000 picoseconds. - Weight::from_parts(19_521_283, 110487) - // Standard Error: 901 - .saturating_add(Weight::from_parts(496_401, 0).saturating_mul(s.into())) + // Minimum execution time: 17_552_000 picoseconds. + Weight::from_parts(19_006_016, 110487) + // Standard Error: 1_115 + .saturating_add(Weight::from_parts(495_979, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -186,11 +183,11 @@ impl WeightInfo for SubstrateWeight { fn schedule_named(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `596 + s * (178 ±0)` - // Estimated: `114000` - // Minimum execution time: 17_713_000 picoseconds. - Weight::from_parts(24_442_945, 114000) - // Standard Error: 764 - .saturating_add(Weight::from_parts(330_307, 0).saturating_mul(s.into())) + // Estimated: `110487` + // Minimum execution time: 17_240_000 picoseconds. + Weight::from_parts(24_376_370, 110487) + // Standard Error: 928 + .saturating_add(Weight::from_parts(331_209, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -202,11 +199,11 @@ impl WeightInfo for SubstrateWeight { fn cancel_named(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `709 + s * (177 ±0)` - // Estimated: `114000` - // Minimum execution time: 19_808_000 picoseconds. - Weight::from_parts(22_601_896, 114000) - // Standard Error: 991 - .saturating_add(Weight::from_parts(496_702, 0).saturating_mul(s.into())) + // Estimated: `110487` + // Minimum execution time: 19_731_000 picoseconds. + Weight::from_parts(23_787_948, 110487) + // Standard Error: 1_133 + .saturating_add(Weight::from_parts(503_805, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -220,8 +217,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `31` // Estimated: `1489` - // Minimum execution time: 3_965_000 picoseconds. - Weight::from_parts(4_126_000, 1489) + // Minimum execution time: 3_776_000 picoseconds. + Weight::from_parts(3_992_000, 1489) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -232,10 +229,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `81 + s * (177 ±0)` // Estimated: `110487` - // Minimum execution time: 3_662_000 picoseconds. - Weight::from_parts(8_746_597, 110487) - // Standard Error: 754 - .saturating_add(Weight::from_parts(309_350, 0).saturating_mul(s.into())) + // Minimum execution time: 3_418_000 picoseconds. + Weight::from_parts(8_606_012, 110487) + // Standard Error: 769 + .saturating_add(Weight::from_parts(309_376, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -243,8 +240,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_807_000 picoseconds. - Weight::from_parts(5_963_000, 0) + // Minimum execution time: 5_624_000 picoseconds. + Weight::from_parts(5_758_000, 0) } /// Storage: Preimage PreimageFor (r:1 w:1) /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: Measured) @@ -254,11 +251,11 @@ impl WeightInfo for () { fn service_task_fetched(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `179 + s * (1 ±0)` - // Estimated: `7200 + s * (1 ±0)` - // Minimum execution time: 20_188_000 picoseconds. - Weight::from_parts(20_422_000, 7200) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_143, 0).saturating_mul(s.into())) + // Estimated: `3644 + s * (1 ±0)` + // Minimum execution time: 20_150_000 picoseconds. + Weight::from_parts(20_271_000, 3644) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_132, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) @@ -269,30 +266,30 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_787_000 picoseconds. - Weight::from_parts(8_046_000, 0) + // Minimum execution time: 7_451_000 picoseconds. + Weight::from_parts(7_693_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } fn service_task_periodic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_730_000 picoseconds. - Weight::from_parts(5_901_000, 0) + // Minimum execution time: 5_477_000 picoseconds. + Weight::from_parts(5_733_000, 0) } fn execute_dispatch_signed() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_569_000 picoseconds. - Weight::from_parts(2_710_000, 0) + // Minimum execution time: 2_675_000 picoseconds. + Weight::from_parts(2_870_000, 0) } fn execute_dispatch_unsigned() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_611_000 picoseconds. - Weight::from_parts(2_765_000, 0) + // Minimum execution time: 2_697_000 picoseconds. + Weight::from_parts(2_807_000, 0) } /// Storage: Scheduler Agenda (r:1 w:1) /// Proof: Scheduler Agenda (max_values: None, max_size: Some(107022), added: 109497, mode: MaxEncodedLen) @@ -301,10 +298,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `81 + s * (177 ±0)` // Estimated: `110487` - // Minimum execution time: 14_237_000 picoseconds. - Weight::from_parts(18_553_929, 110487) - // Standard Error: 757 - .saturating_add(Weight::from_parts(327_347, 0).saturating_mul(s.into())) + // Minimum execution time: 13_921_000 picoseconds. + Weight::from_parts(18_717_223, 110487) + // Standard Error: 771 + .saturating_add(Weight::from_parts(333_102, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -317,10 +314,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `81 + s * (177 ±0)` // Estimated: `110487` - // Minimum execution time: 18_003_000 picoseconds. - Weight::from_parts(19_521_283, 110487) - // Standard Error: 901 - .saturating_add(Weight::from_parts(496_401, 0).saturating_mul(s.into())) + // Minimum execution time: 17_552_000 picoseconds. + Weight::from_parts(19_006_016, 110487) + // Standard Error: 1_115 + .saturating_add(Weight::from_parts(495_979, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -332,11 +329,11 @@ impl WeightInfo for () { fn schedule_named(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `596 + s * (178 ±0)` - // Estimated: `114000` - // Minimum execution time: 17_713_000 picoseconds. - Weight::from_parts(24_442_945, 114000) - // Standard Error: 764 - .saturating_add(Weight::from_parts(330_307, 0).saturating_mul(s.into())) + // Estimated: `110487` + // Minimum execution time: 17_240_000 picoseconds. + Weight::from_parts(24_376_370, 110487) + // Standard Error: 928 + .saturating_add(Weight::from_parts(331_209, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -348,11 +345,11 @@ impl WeightInfo for () { fn cancel_named(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `709 + s * (177 ±0)` - // Estimated: `114000` - // Minimum execution time: 19_808_000 picoseconds. - Weight::from_parts(22_601_896, 114000) - // Standard Error: 991 - .saturating_add(Weight::from_parts(496_702, 0).saturating_mul(s.into())) + // Estimated: `110487` + // Minimum execution time: 19_731_000 picoseconds. + Weight::from_parts(23_787_948, 110487) + // Standard Error: 1_133 + .saturating_add(Weight::from_parts(503_805, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/frame/session/src/weights.rs b/frame/session/src/weights.rs index 3515ff4464a3a..add7f333590e1 100644 --- a/frame/session/src/weights.rs +++ b/frame/session/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_session //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_session -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -67,9 +64,9 @@ impl WeightInfo for SubstrateWeight { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `1891` - // Estimated: `22693` - // Minimum execution time: 48_165_000 picoseconds. - Weight::from_parts(48_967_000, 22693) + // Estimated: `12781` + // Minimum execution time: 48_507_000 picoseconds. + Weight::from_parts(49_214_000, 12781) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -82,9 +79,9 @@ impl WeightInfo for SubstrateWeight { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `1758` - // Estimated: `11537` - // Minimum execution time: 35_824_000 picoseconds. - Weight::from_parts(36_267_000, 11537) + // Estimated: `5223` + // Minimum execution time: 35_388_000 picoseconds. + Weight::from_parts(35_763_000, 5223) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -101,9 +98,9 @@ impl WeightInfo for () { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `1891` - // Estimated: `22693` - // Minimum execution time: 48_165_000 picoseconds. - Weight::from_parts(48_967_000, 22693) + // Estimated: `12781` + // Minimum execution time: 48_507_000 picoseconds. + Weight::from_parts(49_214_000, 12781) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -116,9 +113,9 @@ impl WeightInfo for () { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `1758` - // Estimated: `11537` - // Minimum execution time: 35_824_000 picoseconds. - Weight::from_parts(36_267_000, 11537) + // Estimated: `5223` + // Minimum execution time: 35_388_000 picoseconds. + Weight::from_parts(35_763_000, 5223) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } diff --git a/frame/staking/src/weights.rs b/frame/staking/src/weights.rs index 01d874d55660b..34b01445d965a 100644 --- a/frame/staking/src/weights.rs +++ b/frame/staking/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_staking //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_staking -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -94,15 +91,17 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:1) /// Proof: Staking Payee (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn bond() -> Weight { // Proof Size summary in bytes: // Measured: `1047` - // Estimated: `14346` - // Minimum execution time: 46_401_000 picoseconds. - Weight::from_parts(46_987_000, 14346) - .saturating_add(T::DbWeight::get().reads(4_u64)) + // Estimated: `4764` + // Minimum execution time: 54_907_000 picoseconds. + Weight::from_parts(55_685_000, 4764) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Staking Bonded (r:1 w:0) @@ -111,6 +110,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -118,10 +119,10 @@ impl WeightInfo for SubstrateWeight { fn bond_extra() -> Weight { // Proof Size summary in bytes: // Measured: `2028` - // Estimated: `27838` - // Minimum execution time: 87_755_000 picoseconds. - Weight::from_parts(88_802_000, 27838) - .saturating_add(T::DbWeight::get().reads(8_u64)) + // Estimated: `8877` + // Minimum execution time: 94_779_000 picoseconds. + Weight::from_parts(95_455_000, 8877) + .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } /// Storage: Staking Ledger (r:1 w:1) @@ -134,6 +135,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) @@ -145,10 +148,10 @@ impl WeightInfo for SubstrateWeight { fn unbond() -> Weight { // Proof Size summary in bytes: // Measured: `2233` - // Estimated: `38444` - // Minimum execution time: 95_698_000 picoseconds. - Weight::from_parts(96_971_000, 38444) - .saturating_add(T::DbWeight::get().reads(12_u64)) + // Estimated: `8877` + // Minimum execution time: 98_004_000 picoseconds. + Weight::from_parts(98_730_000, 8877) + .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } /// Storage: Staking Ledger (r:1 w:1) @@ -157,18 +160,20 @@ impl WeightInfo for SubstrateWeight { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `[0, 100]`. fn withdraw_unbonded_update(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1021` - // Estimated: `14402` - // Minimum execution time: 38_239_000 picoseconds. - Weight::from_parts(39_615_452, 14402) - // Standard Error: 447 - .saturating_add(Weight::from_parts(9_199, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) + // Estimated: `4764` + // Minimum execution time: 45_888_000 picoseconds. + Weight::from_parts(47_568_327, 4764) + // Standard Error: 402 + .saturating_add(Weight::from_parts(7_520, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Staking Ledger (r:1 w:1) @@ -195,6 +200,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:1) /// Proof: Staking Payee (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Staking SpanSlash (r:0 w:100) @@ -203,12 +210,12 @@ impl WeightInfo for SubstrateWeight { fn withdraw_unbonded_kill(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2294 + s * (4 ±0)` - // Estimated: `43999 + s * (4 ±0)` - // Minimum execution time: 84_251_000 picoseconds. - Weight::from_parts(90_113_319, 43999) - // Standard Error: 2_177 - .saturating_add(Weight::from_parts(1_278_840, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 93_288_000 picoseconds. + Weight::from_parts(99_415_523, 6248) + // Standard Error: 3_291 + .saturating_add(Weight::from_parts(1_296_734, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(12_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) @@ -238,9 +245,9 @@ impl WeightInfo for SubstrateWeight { fn validate() -> Weight { // Proof Size summary in bytes: // Measured: `1414` - // Estimated: `30249` - // Minimum execution time: 60_509_000 picoseconds. - Weight::from_parts(61_305_000, 30249) + // Estimated: `4556` + // Minimum execution time: 58_755_000 picoseconds. + Weight::from_parts(59_424_000, 4556) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -252,11 +259,11 @@ impl WeightInfo for SubstrateWeight { fn kick(k: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1260 + k * (569 ±0)` - // Estimated: `5546 + k * (3033 ±0)` - // Minimum execution time: 30_063_000 picoseconds. - Weight::from_parts(31_774_698, 5546) - // Standard Error: 11_088 - .saturating_add(Weight::from_parts(7_869_325, 0).saturating_mul(k.into())) + // Estimated: `4556 + k * (3033 ±0)` + // Minimum execution time: 29_399_000 picoseconds. + Weight::from_parts(30_443_621, 4556) + // Standard Error: 10_402 + .saturating_add(Weight::from_parts(7_890_220, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -288,11 +295,11 @@ impl WeightInfo for SubstrateWeight { fn nominate(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1888 + n * (105 ±0)` - // Estimated: `32878 + n * (2520 ±0)` - // Minimum execution time: 70_091_000 picoseconds. - Weight::from_parts(67_744_973, 32878) - // Standard Error: 12_799 - .saturating_add(Weight::from_parts(3_238_224, 0).saturating_mul(n.into())) + // Estimated: `6248 + n * (2520 ±0)` + // Minimum execution time: 68_471_000 picoseconds. + Weight::from_parts(65_972_990, 6248) + // Standard Error: 13_983 + .saturating_add(Weight::from_parts(3_255_731, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(6_u64)) @@ -315,9 +322,9 @@ impl WeightInfo for SubstrateWeight { fn chill() -> Weight { // Proof Size summary in bytes: // Measured: `1748` - // Estimated: `24862` - // Minimum execution time: 60_582_000 picoseconds. - Weight::from_parts(61_208_000, 24862) + // Estimated: `6248` + // Minimum execution time: 59_537_000 picoseconds. + Weight::from_parts(60_446_000, 6248) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -329,8 +336,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `808` // Estimated: `4556` - // Minimum execution time: 15_630_000 picoseconds. - Weight::from_parts(16_018_000, 4556) + // Minimum execution time: 15_403_000 picoseconds. + Weight::from_parts(15_676_000, 4556) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -341,9 +348,9 @@ impl WeightInfo for SubstrateWeight { fn set_controller() -> Weight { // Proof Size summary in bytes: // Measured: `907` - // Estimated: `11659` - // Minimum execution time: 23_895_000 picoseconds. - Weight::from_parts(24_306_000, 11659) + // Estimated: `8122` + // Minimum execution time: 23_316_000 picoseconds. + Weight::from_parts(23_670_000, 8122) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -353,8 +360,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_694_000 picoseconds. - Weight::from_parts(3_820_000, 0) + // Minimum execution time: 3_558_000 picoseconds. + Weight::from_parts(3_759_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Staking ForceEra (r:0 w:1) @@ -363,8 +370,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_729_000 picoseconds. - Weight::from_parts(11_086_000, 0) + // Minimum execution time: 12_724_000 picoseconds. + Weight::from_parts(13_047_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Staking ForceEra (r:0 w:1) @@ -373,8 +380,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_959_000 picoseconds. - Weight::from_parts(11_371_000, 0) + // Minimum execution time: 12_734_000 picoseconds. + Weight::from_parts(13_218_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Staking ForceEra (r:0 w:1) @@ -383,8 +390,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_101_000 picoseconds. - Weight::from_parts(11_506_000, 0) + // Minimum execution time: 12_996_000 picoseconds. + Weight::from_parts(13_375_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Staking Invulnerables (r:0 w:1) @@ -394,10 +401,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_016_000 picoseconds. - Weight::from_parts(4_454_020, 0) - // Standard Error: 82 - .saturating_add(Weight::from_parts(10_703, 0).saturating_mul(v.into())) + // Minimum execution time: 3_920_000 picoseconds. + Weight::from_parts(4_619_469, 0) + // Standard Error: 22 + .saturating_add(Weight::from_parts(10_108, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Staking Bonded (r:1 w:1) @@ -420,6 +427,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Ledger (r:0 w:1) /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:1) @@ -430,12 +439,12 @@ impl WeightInfo for SubstrateWeight { fn force_unstake(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2018 + s * (4 ±0)` - // Estimated: `37678 + s * (4 ±0)` - // Minimum execution time: 76_338_000 picoseconds. - Weight::from_parts(82_426_098, 37678) - // Standard Error: 3_761 - .saturating_add(Weight::from_parts(1_279_343, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(11_u64)) + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 86_516_000 picoseconds. + Weight::from_parts(92_324_464, 6248) + // Standard Error: 2_925 + .saturating_add(Weight::from_parts(1_286_284, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(12_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) @@ -447,10 +456,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `66639` // Estimated: `70104` - // Minimum execution time: 91_160_000 picoseconds. - Weight::from_parts(794_662_495, 70104) - // Standard Error: 51_479 - .saturating_add(Weight::from_parts(4_346_694, 0).saturating_mul(s.into())) + // Minimum execution time: 90_193_000 picoseconds. + Weight::from_parts(821_522_318, 70104) + // Standard Error: 57_922 + .saturating_add(Weight::from_parts(4_554_659, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -476,16 +485,16 @@ impl WeightInfo for SubstrateWeight { fn payout_stakers_dead_controller(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `20217 + n * (143 ±0)` - // Estimated: `63416 + n * (8024 ±1)` - // Minimum execution time: 77_845_000 picoseconds. - Weight::from_parts(86_178_186, 63416) - // Standard Error: 21_971 - .saturating_add(Weight::from_parts(26_966_654, 0).saturating_mul(n.into())) + // Estimated: `19844 + n * (2603 ±1)` + // Minimum execution time: 80_329_000 picoseconds. + Weight::from_parts(97_340_643, 19844) + // Standard Error: 22_713 + .saturating_add(Weight::from_parts(29_087_425, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 8024).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) } /// Storage: Staking CurrentEra (r:1 w:0) /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -507,25 +516,29 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:257 w:257) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:257 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `n` is `[0, 256]`. fn payout_stakers_alive_staked(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `34971 + n * (401 ±0)` - // Estimated: `93244 + n * (15898 ±0)` - // Minimum execution time: 98_209_000 picoseconds. - Weight::from_parts(102_121_432, 93244) - // Standard Error: 25_633 - .saturating_add(Weight::from_parts(39_244_200, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(10_u64)) - .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(n.into()))) + // Estimated: `32376 + n * (3774 ±0)` + // Minimum execution time: 105_591_000 picoseconds. + Weight::from_parts(111_587_915, 32376) + // Standard Error: 15_598 + .saturating_add(Weight::from_parts(48_948_195, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 15898).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(n.into())) } /// Storage: Staking Ledger (r:1 w:1) /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) @@ -538,12 +551,12 @@ impl WeightInfo for SubstrateWeight { fn rebond(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2029 + l * (7 ±0)` - // Estimated: `31431` - // Minimum execution time: 87_067_000 picoseconds. - Weight::from_parts(87_971_483, 31431) - // Standard Error: 1_668 - .saturating_add(Weight::from_parts(56_024, 0).saturating_mul(l.into())) - .saturating_add(T::DbWeight::get().reads(9_u64)) + // Estimated: `8877` + // Minimum execution time: 89_420_000 picoseconds. + Weight::from_parts(90_743_615, 8877) + // Standard Error: 1_260 + .saturating_add(Weight::from_parts(50_832, 0).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } /// Storage: System Account (r:1 w:1) @@ -568,6 +581,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: VoterList CounterForListNodes (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:1) /// Proof: Staking Payee (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Staking SpanSlash (r:0 w:100) @@ -576,12 +591,12 @@ impl WeightInfo for SubstrateWeight { fn reap_stash(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2294 + s * (4 ±0)` - // Estimated: `42515 + s * (4 ±0)` - // Minimum execution time: 90_421_000 picoseconds. - Weight::from_parts(91_873_866, 42515) - // Standard Error: 1_867 - .saturating_add(Weight::from_parts(1_275_581, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(12_u64)) + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 100_911_000 picoseconds. + Weight::from_parts(102_678_006, 6248) + // Standard Error: 2_349 + .saturating_add(Weight::from_parts(1_262_431, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(12_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) @@ -624,21 +639,21 @@ impl WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 100]`. fn new_era(v: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + v * (3598 ±0) + n * (720 ±0)` - // Estimated: `537749 + v * (16699 ±39) + n * (12763 ±3)` - // Minimum execution time: 552_452_000 picoseconds. - Weight::from_parts(555_250_000, 537749) - // Standard Error: 1_893_951 - .saturating_add(Weight::from_parts(61_059_451, 0).saturating_mul(v.into())) - // Standard Error: 188_721 - .saturating_add(Weight::from_parts(17_220_679, 0).saturating_mul(n.into())) + // Measured: `0 + n * (720 ±0) + v * (3598 ±0)` + // Estimated: `512390 + n * (3566 ±0) + v * (3566 ±0)` + // Minimum execution time: 554_712_000 picoseconds. + Weight::from_parts(556_603_000, 512390) + // Standard Error: 1_925_251 + .saturating_add(Weight::from_parts(62_627_196, 0).saturating_mul(v.into())) + // Standard Error: 191_840 + .saturating_add(Weight::from_parts(16_681_790, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(206_u64)) .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into()))) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) - .saturating_add(Weight::from_parts(0, 16699).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 12763).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(v.into())) } /// Storage: VoterList CounterForListNodes (r:1 w:0) /// Proof: VoterList CounterForListNodes (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -660,20 +675,20 @@ impl WeightInfo for SubstrateWeight { /// The range of component `n` is `[500, 1000]`. fn get_npos_voters(v: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3135 + v * (395 ±0) + n * (911 ±0)` - // Estimated: `518829 + v * (14295 ±0) + n * (11775 ±0)` - // Minimum execution time: 32_870_065_000 picoseconds. - Weight::from_parts(33_295_716_000, 518829) - // Standard Error: 371_824 - .saturating_add(Weight::from_parts(5_148_979, 0).saturating_mul(v.into())) - // Standard Error: 371_824 - .saturating_add(Weight::from_parts(3_376_262, 0).saturating_mul(n.into())) + // Measured: `3135 + n * (911 ±0) + v * (395 ±0)` + // Estimated: `512390 + n * (3566 ±0) + v * (3566 ±0)` + // Minimum execution time: 31_770_670_000 picoseconds. + Weight::from_parts(31_839_042_000, 512390) + // Standard Error: 355_382 + .saturating_add(Weight::from_parts(5_044_540, 0).saturating_mul(v.into())) + // Standard Error: 355_382 + .saturating_add(Weight::from_parts(3_205_722, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(201_u64)) .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into()))) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 14295).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 11775).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(v.into())) } /// Storage: Staking CounterForValidators (r:1 w:0) /// Proof: Staking CounterForValidators (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -683,11 +698,11 @@ impl WeightInfo for SubstrateWeight { fn get_npos_targets(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `983 + v * (50 ±0)` - // Estimated: `4999 + v * (2520 ±0)` - // Minimum execution time: 2_321_389_000 picoseconds. - Weight::from_parts(70_122_933, 4999) - // Standard Error: 7_249 - .saturating_add(Weight::from_parts(4_632_666, 0).saturating_mul(v.into())) + // Estimated: `3510 + v * (2520 ±0)` + // Minimum execution time: 2_253_567_000 picoseconds. + Weight::from_parts(61_440_613, 3510) + // Standard Error: 5_276 + .saturating_add(Weight::from_parts(4_414_153, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) .saturating_add(Weight::from_parts(0, 2520).saturating_mul(v.into())) @@ -708,8 +723,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_581_000 picoseconds. - Weight::from_parts(9_802_000, 0) + // Minimum execution time: 9_292_000 picoseconds. + Weight::from_parts(9_587_000, 0) .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: Staking MinCommission (r:0 w:1) @@ -728,8 +743,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_883_000 picoseconds. - Weight::from_parts(9_151_000, 0) + // Minimum execution time: 8_294_000 picoseconds. + Weight::from_parts(8_597_000, 0) .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: Staking Ledger (r:1 w:0) @@ -755,9 +770,9 @@ impl WeightInfo for SubstrateWeight { fn chill_other() -> Weight { // Proof Size summary in bytes: // Measured: `1871` - // Estimated: `29338` - // Minimum execution time: 77_916_000 picoseconds. - Weight::from_parts(78_877_000, 29338) + // Estimated: `6248` + // Minimum execution time: 75_742_000 picoseconds. + Weight::from_parts(76_252_000, 6248) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -768,9 +783,9 @@ impl WeightInfo for SubstrateWeight { fn force_apply_min_commission() -> Weight { // Proof Size summary in bytes: // Measured: `694` - // Estimated: `4999` - // Minimum execution time: 16_658_000 picoseconds. - Weight::from_parts(16_968_000, 4999) + // Estimated: `3510` + // Minimum execution time: 16_407_000 picoseconds. + Weight::from_parts(16_726_000, 3510) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -780,8 +795,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_982_000 picoseconds. - Weight::from_parts(5_232_000, 0) + // Minimum execution time: 4_977_000 picoseconds. + Weight::from_parts(5_224_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -796,15 +811,17 @@ impl WeightInfo for () { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:1) /// Proof: Staking Payee (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) fn bond() -> Weight { // Proof Size summary in bytes: // Measured: `1047` - // Estimated: `14346` - // Minimum execution time: 46_401_000 picoseconds. - Weight::from_parts(46_987_000, 14346) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Estimated: `4764` + // Minimum execution time: 54_907_000 picoseconds. + Weight::from_parts(55_685_000, 4764) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: Staking Bonded (r:1 w:0) @@ -813,6 +830,8 @@ impl WeightInfo for () { /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) /// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen) /// Storage: VoterList ListBags (r:2 w:2) @@ -820,10 +839,10 @@ impl WeightInfo for () { fn bond_extra() -> Weight { // Proof Size summary in bytes: // Measured: `2028` - // Estimated: `27838` - // Minimum execution time: 87_755_000 picoseconds. - Weight::from_parts(88_802_000, 27838) - .saturating_add(RocksDbWeight::get().reads(8_u64)) + // Estimated: `8877` + // Minimum execution time: 94_779_000 picoseconds. + Weight::from_parts(95_455_000, 8877) + .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } /// Storage: Staking Ledger (r:1 w:1) @@ -836,6 +855,8 @@ impl WeightInfo for () { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) @@ -847,10 +868,10 @@ impl WeightInfo for () { fn unbond() -> Weight { // Proof Size summary in bytes: // Measured: `2233` - // Estimated: `38444` - // Minimum execution time: 95_698_000 picoseconds. - Weight::from_parts(96_971_000, 38444) - .saturating_add(RocksDbWeight::get().reads(12_u64)) + // Estimated: `8877` + // Minimum execution time: 98_004_000 picoseconds. + Weight::from_parts(98_730_000, 8877) + .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// Storage: Staking Ledger (r:1 w:1) @@ -859,18 +880,20 @@ impl WeightInfo for () { /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `[0, 100]`. fn withdraw_unbonded_update(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1021` - // Estimated: `14402` - // Minimum execution time: 38_239_000 picoseconds. - Weight::from_parts(39_615_452, 14402) - // Standard Error: 447 - .saturating_add(Weight::from_parts(9_199, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Estimated: `4764` + // Minimum execution time: 45_888_000 picoseconds. + Weight::from_parts(47_568_327, 4764) + // Standard Error: 402 + .saturating_add(Weight::from_parts(7_520, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Staking Ledger (r:1 w:1) @@ -897,6 +920,8 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:1) /// Proof: Staking Payee (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Staking SpanSlash (r:0 w:100) @@ -905,12 +930,12 @@ impl WeightInfo for () { fn withdraw_unbonded_kill(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2294 + s * (4 ±0)` - // Estimated: `43999 + s * (4 ±0)` - // Minimum execution time: 84_251_000 picoseconds. - Weight::from_parts(90_113_319, 43999) - // Standard Error: 2_177 - .saturating_add(Weight::from_parts(1_278_840, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 93_288_000 picoseconds. + Weight::from_parts(99_415_523, 6248) + // Standard Error: 3_291 + .saturating_add(Weight::from_parts(1_296_734, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(12_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into()))) .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) @@ -940,9 +965,9 @@ impl WeightInfo for () { fn validate() -> Weight { // Proof Size summary in bytes: // Measured: `1414` - // Estimated: `30249` - // Minimum execution time: 60_509_000 picoseconds. - Weight::from_parts(61_305_000, 30249) + // Estimated: `4556` + // Minimum execution time: 58_755_000 picoseconds. + Weight::from_parts(59_424_000, 4556) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -954,11 +979,11 @@ impl WeightInfo for () { fn kick(k: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1260 + k * (569 ±0)` - // Estimated: `5546 + k * (3033 ±0)` - // Minimum execution time: 30_063_000 picoseconds. - Weight::from_parts(31_774_698, 5546) - // Standard Error: 11_088 - .saturating_add(Weight::from_parts(7_869_325, 0).saturating_mul(k.into())) + // Estimated: `4556 + k * (3033 ±0)` + // Minimum execution time: 29_399_000 picoseconds. + Weight::from_parts(30_443_621, 4556) + // Standard Error: 10_402 + .saturating_add(Weight::from_parts(7_890_220, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -990,11 +1015,11 @@ impl WeightInfo for () { fn nominate(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1888 + n * (105 ±0)` - // Estimated: `32878 + n * (2520 ±0)` - // Minimum execution time: 70_091_000 picoseconds. - Weight::from_parts(67_744_973, 32878) - // Standard Error: 12_799 - .saturating_add(Weight::from_parts(3_238_224, 0).saturating_mul(n.into())) + // Estimated: `6248 + n * (2520 ±0)` + // Minimum execution time: 68_471_000 picoseconds. + Weight::from_parts(65_972_990, 6248) + // Standard Error: 13_983 + .saturating_add(Weight::from_parts(3_255_731, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(6_u64)) @@ -1017,9 +1042,9 @@ impl WeightInfo for () { fn chill() -> Weight { // Proof Size summary in bytes: // Measured: `1748` - // Estimated: `24862` - // Minimum execution time: 60_582_000 picoseconds. - Weight::from_parts(61_208_000, 24862) + // Estimated: `6248` + // Minimum execution time: 59_537_000 picoseconds. + Weight::from_parts(60_446_000, 6248) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -1031,8 +1056,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `808` // Estimated: `4556` - // Minimum execution time: 15_630_000 picoseconds. - Weight::from_parts(16_018_000, 4556) + // Minimum execution time: 15_403_000 picoseconds. + Weight::from_parts(15_676_000, 4556) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1043,9 +1068,9 @@ impl WeightInfo for () { fn set_controller() -> Weight { // Proof Size summary in bytes: // Measured: `907` - // Estimated: `11659` - // Minimum execution time: 23_895_000 picoseconds. - Weight::from_parts(24_306_000, 11659) + // Estimated: `8122` + // Minimum execution time: 23_316_000 picoseconds. + Weight::from_parts(23_670_000, 8122) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1055,8 +1080,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_694_000 picoseconds. - Weight::from_parts(3_820_000, 0) + // Minimum execution time: 3_558_000 picoseconds. + Weight::from_parts(3_759_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Staking ForceEra (r:0 w:1) @@ -1065,8 +1090,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_729_000 picoseconds. - Weight::from_parts(11_086_000, 0) + // Minimum execution time: 12_724_000 picoseconds. + Weight::from_parts(13_047_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Staking ForceEra (r:0 w:1) @@ -1075,8 +1100,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_959_000 picoseconds. - Weight::from_parts(11_371_000, 0) + // Minimum execution time: 12_734_000 picoseconds. + Weight::from_parts(13_218_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Staking ForceEra (r:0 w:1) @@ -1085,8 +1110,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_101_000 picoseconds. - Weight::from_parts(11_506_000, 0) + // Minimum execution time: 12_996_000 picoseconds. + Weight::from_parts(13_375_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Staking Invulnerables (r:0 w:1) @@ -1096,10 +1121,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_016_000 picoseconds. - Weight::from_parts(4_454_020, 0) - // Standard Error: 82 - .saturating_add(Weight::from_parts(10_703, 0).saturating_mul(v.into())) + // Minimum execution time: 3_920_000 picoseconds. + Weight::from_parts(4_619_469, 0) + // Standard Error: 22 + .saturating_add(Weight::from_parts(10_108, 0).saturating_mul(v.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Staking Bonded (r:1 w:1) @@ -1122,6 +1147,8 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Ledger (r:0 w:1) /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:1) @@ -1132,12 +1159,12 @@ impl WeightInfo for () { fn force_unstake(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2018 + s * (4 ±0)` - // Estimated: `37678 + s * (4 ±0)` - // Minimum execution time: 76_338_000 picoseconds. - Weight::from_parts(82_426_098, 37678) - // Standard Error: 3_761 - .saturating_add(Weight::from_parts(1_279_343, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(11_u64)) + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 86_516_000 picoseconds. + Weight::from_parts(92_324_464, 6248) + // Standard Error: 2_925 + .saturating_add(Weight::from_parts(1_286_284, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(12_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into()))) .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) @@ -1149,10 +1176,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `66639` // Estimated: `70104` - // Minimum execution time: 91_160_000 picoseconds. - Weight::from_parts(794_662_495, 70104) - // Standard Error: 51_479 - .saturating_add(Weight::from_parts(4_346_694, 0).saturating_mul(s.into())) + // Minimum execution time: 90_193_000 picoseconds. + Weight::from_parts(821_522_318, 70104) + // Standard Error: 57_922 + .saturating_add(Weight::from_parts(4_554_659, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1178,16 +1205,16 @@ impl WeightInfo for () { fn payout_stakers_dead_controller(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `20217 + n * (143 ±0)` - // Estimated: `63416 + n * (8024 ±1)` - // Minimum execution time: 77_845_000 picoseconds. - Weight::from_parts(86_178_186, 63416) - // Standard Error: 21_971 - .saturating_add(Weight::from_parts(26_966_654, 0).saturating_mul(n.into())) + // Estimated: `19844 + n * (2603 ±1)` + // Minimum execution time: 80_329_000 picoseconds. + Weight::from_parts(97_340_643, 19844) + // Standard Error: 22_713 + .saturating_add(Weight::from_parts(29_087_425, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 8024).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) } /// Storage: Staking CurrentEra (r:1 w:0) /// Proof: Staking CurrentEra (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -1209,25 +1236,29 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:257 w:257) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:257 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `n` is `[0, 256]`. fn payout_stakers_alive_staked(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `34971 + n * (401 ±0)` - // Estimated: `93244 + n * (15898 ±0)` - // Minimum execution time: 98_209_000 picoseconds. - Weight::from_parts(102_121_432, 93244) - // Standard Error: 25_633 - .saturating_add(Weight::from_parts(39_244_200, 0).saturating_mul(n.into())) - .saturating_add(RocksDbWeight::get().reads(10_u64)) - .saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(n.into()))) + // Estimated: `32376 + n * (3774 ±0)` + // Minimum execution time: 105_591_000 picoseconds. + Weight::from_parts(111_587_915, 32376) + // Standard Error: 15_598 + .saturating_add(Weight::from_parts(48_948_195, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().reads((6_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 15898).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(n.into())) } /// Storage: Staking Ledger (r:1 w:1) /// Proof: Staking Ledger (max_values: None, max_size: Some(1091), added: 3566, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: VoterList ListNodes (r:3 w:3) @@ -1240,12 +1271,12 @@ impl WeightInfo for () { fn rebond(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2029 + l * (7 ±0)` - // Estimated: `31431` - // Minimum execution time: 87_067_000 picoseconds. - Weight::from_parts(87_971_483, 31431) - // Standard Error: 1_668 - .saturating_add(Weight::from_parts(56_024, 0).saturating_mul(l.into())) - .saturating_add(RocksDbWeight::get().reads(9_u64)) + // Estimated: `8877` + // Minimum execution time: 89_420_000 picoseconds. + Weight::from_parts(90_743_615, 8877) + // Standard Error: 1_260 + .saturating_add(Weight::from_parts(50_832, 0).saturating_mul(l.into())) + .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// Storage: System Account (r:1 w:1) @@ -1270,6 +1301,8 @@ impl WeightInfo for () { /// Proof: VoterList CounterForListNodes (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: Staking Payee (r:0 w:1) /// Proof: Staking Payee (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) /// Storage: Staking SpanSlash (r:0 w:100) @@ -1278,12 +1311,12 @@ impl WeightInfo for () { fn reap_stash(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `2294 + s * (4 ±0)` - // Estimated: `42515 + s * (4 ±0)` - // Minimum execution time: 90_421_000 picoseconds. - Weight::from_parts(91_873_866, 42515) - // Standard Error: 1_867 - .saturating_add(Weight::from_parts(1_275_581, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(12_u64)) + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 100_911_000 picoseconds. + Weight::from_parts(102_678_006, 6248) + // Standard Error: 2_349 + .saturating_add(Weight::from_parts(1_262_431, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(12_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(s.into()))) .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) @@ -1326,21 +1359,21 @@ impl WeightInfo for () { /// The range of component `n` is `[0, 100]`. fn new_era(v: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + v * (3598 ±0) + n * (720 ±0)` - // Estimated: `537749 + v * (16699 ±39) + n * (12763 ±3)` - // Minimum execution time: 552_452_000 picoseconds. - Weight::from_parts(555_250_000, 537749) - // Standard Error: 1_893_951 - .saturating_add(Weight::from_parts(61_059_451, 0).saturating_mul(v.into())) - // Standard Error: 188_721 - .saturating_add(Weight::from_parts(17_220_679, 0).saturating_mul(n.into())) + // Measured: `0 + n * (720 ±0) + v * (3598 ±0)` + // Estimated: `512390 + n * (3566 ±0) + v * (3566 ±0)` + // Minimum execution time: 554_712_000 picoseconds. + Weight::from_parts(556_603_000, 512390) + // Standard Error: 1_925_251 + .saturating_add(Weight::from_parts(62_627_196, 0).saturating_mul(v.into())) + // Standard Error: 191_840 + .saturating_add(Weight::from_parts(16_681_790, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(206_u64)) .saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(v.into()))) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(v.into()))) - .saturating_add(Weight::from_parts(0, 16699).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 12763).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(v.into())) } /// Storage: VoterList CounterForListNodes (r:1 w:0) /// Proof: VoterList CounterForListNodes (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -1362,20 +1395,20 @@ impl WeightInfo for () { /// The range of component `n` is `[500, 1000]`. fn get_npos_voters(v: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3135 + v * (395 ±0) + n * (911 ±0)` - // Estimated: `518829 + v * (14295 ±0) + n * (11775 ±0)` - // Minimum execution time: 32_870_065_000 picoseconds. - Weight::from_parts(33_295_716_000, 518829) - // Standard Error: 371_824 - .saturating_add(Weight::from_parts(5_148_979, 0).saturating_mul(v.into())) - // Standard Error: 371_824 - .saturating_add(Weight::from_parts(3_376_262, 0).saturating_mul(n.into())) + // Measured: `3135 + n * (911 ±0) + v * (395 ±0)` + // Estimated: `512390 + n * (3566 ±0) + v * (3566 ±0)` + // Minimum execution time: 31_770_670_000 picoseconds. + Weight::from_parts(31_839_042_000, 512390) + // Standard Error: 355_382 + .saturating_add(Weight::from_parts(5_044_540, 0).saturating_mul(v.into())) + // Standard Error: 355_382 + .saturating_add(Weight::from_parts(3_205_722, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(201_u64)) .saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(v.into()))) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 14295).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 11775).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(v.into())) } /// Storage: Staking CounterForValidators (r:1 w:0) /// Proof: Staking CounterForValidators (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -1385,11 +1418,11 @@ impl WeightInfo for () { fn get_npos_targets(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `983 + v * (50 ±0)` - // Estimated: `4999 + v * (2520 ±0)` - // Minimum execution time: 2_321_389_000 picoseconds. - Weight::from_parts(70_122_933, 4999) - // Standard Error: 7_249 - .saturating_add(Weight::from_parts(4_632_666, 0).saturating_mul(v.into())) + // Estimated: `3510 + v * (2520 ±0)` + // Minimum execution time: 2_253_567_000 picoseconds. + Weight::from_parts(61_440_613, 3510) + // Standard Error: 5_276 + .saturating_add(Weight::from_parts(4_414_153, 0).saturating_mul(v.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(v.into()))) .saturating_add(Weight::from_parts(0, 2520).saturating_mul(v.into())) @@ -1410,8 +1443,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_581_000 picoseconds. - Weight::from_parts(9_802_000, 0) + // Minimum execution time: 9_292_000 picoseconds. + Weight::from_parts(9_587_000, 0) .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: Staking MinCommission (r:0 w:1) @@ -1430,8 +1463,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_883_000 picoseconds. - Weight::from_parts(9_151_000, 0) + // Minimum execution time: 8_294_000 picoseconds. + Weight::from_parts(8_597_000, 0) .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: Staking Ledger (r:1 w:0) @@ -1457,9 +1490,9 @@ impl WeightInfo for () { fn chill_other() -> Weight { // Proof Size summary in bytes: // Measured: `1871` - // Estimated: `29338` - // Minimum execution time: 77_916_000 picoseconds. - Weight::from_parts(78_877_000, 29338) + // Estimated: `6248` + // Minimum execution time: 75_742_000 picoseconds. + Weight::from_parts(76_252_000, 6248) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -1470,9 +1503,9 @@ impl WeightInfo for () { fn force_apply_min_commission() -> Weight { // Proof Size summary in bytes: // Measured: `694` - // Estimated: `4999` - // Minimum execution time: 16_658_000 picoseconds. - Weight::from_parts(16_968_000, 4999) + // Estimated: `3510` + // Minimum execution time: 16_407_000 picoseconds. + Weight::from_parts(16_726_000, 3510) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1482,8 +1515,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_982_000 picoseconds. - Weight::from_parts(5_232_000, 0) + // Minimum execution time: 4_977_000 picoseconds. + Weight::from_parts(5_224_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/frame/state-trie-migration/src/weights.rs b/frame/state-trie-migration/src/weights.rs index 961cec7bcfa51..8565dd73e0c46 100644 --- a/frame/state-trie-migration/src/weights.rs +++ b/frame/state-trie-migration/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_state_trie_migration //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_state_trie_migration -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -70,9 +67,9 @@ impl WeightInfo for SubstrateWeight { fn continue_migrate() -> Weight { // Proof Size summary in bytes: // Measured: `108` - // Estimated: `4020` - // Minimum execution time: 15_449_000 picoseconds. - Weight::from_parts(16_040_000, 4020) + // Estimated: `2527` + // Minimum execution time: 17_385_000 picoseconds. + Weight::from_parts(17_766_000, 2527) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -82,16 +79,16 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1493` - // Minimum execution time: 4_632_000 picoseconds. - Weight::from_parts(4_768_000, 1493) + // Minimum execution time: 4_537_000 picoseconds. + Weight::from_parts(4_734_000, 1493) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn migrate_custom_top_success() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_596_000 picoseconds. - Weight::from_parts(9_866_000, 0) + // Minimum execution time: 10_127_000 picoseconds. + Weight::from_parts(10_384_000, 0) } /// Storage: unknown `0x666f6f` (r:1 w:1) /// Proof Skipped: unknown `0x666f6f` (r:1 w:1) @@ -99,8 +96,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `113` // Estimated: `3578` - // Minimum execution time: 27_352_000 picoseconds. - Weight::from_parts(28_089_000, 3578) + // Minimum execution time: 31_113_000 picoseconds. + Weight::from_parts(31_833_000, 3578) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -108,8 +105,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_286_000 picoseconds. - Weight::from_parts(10_761_000, 0) + // Minimum execution time: 10_445_000 picoseconds. + Weight::from_parts(10_726_000, 0) } /// Storage: unknown `0x666f6f` (r:1 w:1) /// Proof Skipped: unknown `0x666f6f` (r:1 w:1) @@ -117,8 +114,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `105` // Estimated: `3570` - // Minimum execution time: 27_355_000 picoseconds. - Weight::from_parts(28_092_000, 3570) + // Minimum execution time: 31_795_000 picoseconds. + Weight::from_parts(32_737_000, 3570) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -129,10 +126,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `197 + v * (1 ±0)` // Estimated: `3662 + v * (1 ±0)` - // Minimum execution time: 6_004_000 picoseconds. - Weight::from_parts(6_188_000, 3662) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_073, 0).saturating_mul(v.into())) + // Minimum execution time: 5_933_000 picoseconds. + Weight::from_parts(6_040_000, 3662) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_336, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(v.into())) @@ -148,9 +145,9 @@ impl WeightInfo for () { fn continue_migrate() -> Weight { // Proof Size summary in bytes: // Measured: `108` - // Estimated: `4020` - // Minimum execution time: 15_449_000 picoseconds. - Weight::from_parts(16_040_000, 4020) + // Estimated: `2527` + // Minimum execution time: 17_385_000 picoseconds. + Weight::from_parts(17_766_000, 2527) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -160,16 +157,16 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1493` - // Minimum execution time: 4_632_000 picoseconds. - Weight::from_parts(4_768_000, 1493) + // Minimum execution time: 4_537_000 picoseconds. + Weight::from_parts(4_734_000, 1493) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn migrate_custom_top_success() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_596_000 picoseconds. - Weight::from_parts(9_866_000, 0) + // Minimum execution time: 10_127_000 picoseconds. + Weight::from_parts(10_384_000, 0) } /// Storage: unknown `0x666f6f` (r:1 w:1) /// Proof Skipped: unknown `0x666f6f` (r:1 w:1) @@ -177,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `113` // Estimated: `3578` - // Minimum execution time: 27_352_000 picoseconds. - Weight::from_parts(28_089_000, 3578) + // Minimum execution time: 31_113_000 picoseconds. + Weight::from_parts(31_833_000, 3578) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -186,8 +183,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_286_000 picoseconds. - Weight::from_parts(10_761_000, 0) + // Minimum execution time: 10_445_000 picoseconds. + Weight::from_parts(10_726_000, 0) } /// Storage: unknown `0x666f6f` (r:1 w:1) /// Proof Skipped: unknown `0x666f6f` (r:1 w:1) @@ -195,8 +192,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `105` // Estimated: `3570` - // Minimum execution time: 27_355_000 picoseconds. - Weight::from_parts(28_092_000, 3570) + // Minimum execution time: 31_795_000 picoseconds. + Weight::from_parts(32_737_000, 3570) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -207,10 +204,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `197 + v * (1 ±0)` // Estimated: `3662 + v * (1 ±0)` - // Minimum execution time: 6_004_000 picoseconds. - Weight::from_parts(6_188_000, 3662) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_073, 0).saturating_mul(v.into())) + // Minimum execution time: 5_933_000 picoseconds. + Weight::from_parts(6_040_000, 3662) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_336, 0).saturating_mul(v.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(v.into())) diff --git a/frame/support/src/weights/block_weights.rs b/frame/support/src/weights/block_weights.rs index b8ac9a0383dee..b358aa473bfd7 100644 --- a/frame/support/src/weights/block_weights.rs +++ b/frame/support/src/weights/block_weights.rs @@ -16,8 +16,8 @@ // limitations under the License. //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15 (Y/M/D) -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2023-04-06 (Y/M/D) +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! //! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Development` //! WARMUPS: `10`, REPEAT: `100` @@ -44,17 +44,17 @@ parameter_types! { /// Calculated by multiplying the *Average* with `1.0` and adding `0`. /// /// Stats nanoseconds: - /// Min, Max: 402_748, 458_228 - /// Average: 412_772 - /// Median: 406_151 - /// Std-Dev: 13480.33 + /// Min, Max: 386_820, 419_676 + /// Average: 392_184 + /// Median: 389_668 + /// Std-Dev: 5285.57 /// /// Percentiles nanoseconds: - /// 99th: 450_080 - /// 95th: 445_111 - /// 75th: 414_170 + /// 99th: 406_316 + /// 95th: 399_697 + /// 75th: 396_532 pub const BlockExecutionWeight: Weight = - Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(412_772), 0); + Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(392_184), 0); } #[cfg(test)] diff --git a/frame/support/src/weights/extrinsic_weights.rs b/frame/support/src/weights/extrinsic_weights.rs index 44b1b94aeb8ba..1a6facc3d42c3 100644 --- a/frame/support/src/weights/extrinsic_weights.rs +++ b/frame/support/src/weights/extrinsic_weights.rs @@ -16,8 +16,8 @@ // limitations under the License. //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15 (Y/M/D) -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2023-04-06 (Y/M/D) +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! //! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Development` //! WARMUPS: `10`, REPEAT: `100` @@ -44,17 +44,17 @@ parameter_types! { /// Calculated by multiplying the *Average* with `1.0` and adding `0`. /// /// Stats nanoseconds: - /// Min, Max: 109_595, 114_170 - /// Average: 110_536 - /// Median: 110_233 - /// Std-Dev: 933.39 + /// Min, Max: 113_246, 114_346 + /// Average: 113_638 + /// Median: 113_641 + /// Std-Dev: 188.44 /// /// Percentiles nanoseconds: - /// 99th: 114_120 - /// 95th: 112_680 - /// 75th: 110_858 + /// 99th: 114_181 + /// 95th: 113_961 + /// 75th: 113_703 pub const ExtrinsicBaseWeight: Weight = - Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(110_536), 0); + Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(113_638), 0); } #[cfg(test)] diff --git a/frame/system/src/weights.rs b/frame/system/src/weights.rs index 34c0b62dcdd2f..96fd7a1972eb2 100644 --- a/frame/system/src/weights.rs +++ b/frame/system/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=frame_system -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -67,20 +64,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_519_000 picoseconds. - Weight::from_parts(2_576_000, 0) + // Minimum execution time: 2_430_000 picoseconds. + Weight::from_parts(2_522_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(365, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(362, 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: 8_687_000 picoseconds. - Weight::from_parts(8_875_000, 0) + // Minimum execution time: 8_738_000 picoseconds. + Weight::from_parts(8_963_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_121, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_113, 0).saturating_mul(b.into())) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -90,8 +87,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 5_281_000 picoseconds. - Weight::from_parts(5_383_000, 1485) + // Minimum execution time: 5_109_000 picoseconds. + Weight::from_parts(5_336_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -102,10 +99,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_346_000 picoseconds. - Weight::from_parts(2_491_000, 0) - // Standard Error: 815 - .saturating_add(Weight::from_parts(731_217, 0).saturating_mul(i.into())) + // Minimum execution time: 2_531_000 picoseconds. + Weight::from_parts(2_617_000, 0) + // Standard Error: 861 + .saturating_add(Weight::from_parts(761_465, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -115,10 +112,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_394_000 picoseconds. - Weight::from_parts(2_567_000, 0) - // Standard Error: 935 - .saturating_add(Weight::from_parts(554_023, 0).saturating_mul(i.into())) + // Minimum execution time: 2_631_000 picoseconds. + Weight::from_parts(2_717_000, 0) + // Standard Error: 1_097 + .saturating_add(Weight::from_parts(570_803, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -128,10 +125,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `116 + p * (69 ±0)` // Estimated: `121 + p * (70 ±0)` - // Minimum execution time: 4_706_000 picoseconds. - Weight::from_parts(4_858_000, 121) - // Standard Error: 1_291 - .saturating_add(Weight::from_parts(1_142_198, 0).saturating_mul(p.into())) + // Minimum execution time: 4_692_000 picoseconds. + Weight::from_parts(4_789_000, 121) + // Standard Error: 1_013 + .saturating_add(Weight::from_parts(1_143_616, 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, 70).saturating_mul(p.into())) @@ -145,20 +142,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_519_000 picoseconds. - Weight::from_parts(2_576_000, 0) + // Minimum execution time: 2_430_000 picoseconds. + Weight::from_parts(2_522_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(365, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(362, 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: 8_687_000 picoseconds. - Weight::from_parts(8_875_000, 0) + // Minimum execution time: 8_738_000 picoseconds. + Weight::from_parts(8_963_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_121, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_113, 0).saturating_mul(b.into())) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -168,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 5_281_000 picoseconds. - Weight::from_parts(5_383_000, 1485) + // Minimum execution time: 5_109_000 picoseconds. + Weight::from_parts(5_336_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -180,10 +177,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_346_000 picoseconds. - Weight::from_parts(2_491_000, 0) - // Standard Error: 815 - .saturating_add(Weight::from_parts(731_217, 0).saturating_mul(i.into())) + // Minimum execution time: 2_531_000 picoseconds. + Weight::from_parts(2_617_000, 0) + // Standard Error: 861 + .saturating_add(Weight::from_parts(761_465, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -193,10 +190,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_394_000 picoseconds. - Weight::from_parts(2_567_000, 0) - // Standard Error: 935 - .saturating_add(Weight::from_parts(554_023, 0).saturating_mul(i.into())) + // Minimum execution time: 2_631_000 picoseconds. + Weight::from_parts(2_717_000, 0) + // Standard Error: 1_097 + .saturating_add(Weight::from_parts(570_803, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -206,10 +203,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `116 + p * (69 ±0)` // Estimated: `121 + p * (70 ±0)` - // Minimum execution time: 4_706_000 picoseconds. - Weight::from_parts(4_858_000, 121) - // Standard Error: 1_291 - .saturating_add(Weight::from_parts(1_142_198, 0).saturating_mul(p.into())) + // Minimum execution time: 4_692_000 picoseconds. + Weight::from_parts(4_789_000, 121) + // Standard Error: 1_013 + .saturating_add(Weight::from_parts(1_143_616, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/frame/timestamp/src/weights.rs b/frame/timestamp/src/weights.rs index e1ada6f63c961..1c254bf220076 100644 --- a/frame/timestamp/src/weights.rs +++ b/frame/timestamp/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_timestamp -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -65,9 +62,9 @@ impl WeightInfo for SubstrateWeight { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `312` - // Estimated: `2986` - // Minimum execution time: 10_913_000 picoseconds. - Weight::from_parts(11_453_000, 2986) + // Estimated: `1493` + // Minimum execution time: 10_834_000 picoseconds. + Weight::from_parts(11_099_000, 1493) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -75,8 +72,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `161` // Estimated: `0` - // Minimum execution time: 4_400_000 picoseconds. - Weight::from_parts(4_550_000, 0) + // Minimum execution time: 4_472_000 picoseconds. + Weight::from_parts(4_645_000, 0) } } @@ -89,9 +86,9 @@ impl WeightInfo for () { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `312` - // Estimated: `2986` - // Minimum execution time: 10_913_000 picoseconds. - Weight::from_parts(11_453_000, 2986) + // Estimated: `1493` + // Minimum execution time: 10_834_000 picoseconds. + Weight::from_parts(11_099_000, 1493) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -99,7 +96,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `161` // Estimated: `0` - // Minimum execution time: 4_400_000 picoseconds. - Weight::from_parts(4_550_000, 0) + // Minimum execution time: 4_472_000 picoseconds. + Weight::from_parts(4_645_000, 0) } } diff --git a/frame/tips/src/weights.rs b/frame/tips/src/weights.rs index 205413d52d7ff..ec5eef8c8bd81 100644 --- a/frame/tips/src/weights.rs +++ b/frame/tips/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_tips //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_tips -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -70,11 +67,11 @@ impl WeightInfo for SubstrateWeight { fn report_awesome(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `4` - // Estimated: `6938` - // Minimum execution time: 26_789_000 picoseconds. - Weight::from_parts(27_619_925, 6938) - // Standard Error: 168 - .saturating_add(Weight::from_parts(1_352, 0).saturating_mul(r.into())) + // Estimated: `3469` + // Minimum execution time: 30_728_000 picoseconds. + Weight::from_parts(31_794_924, 3469) + // Standard Error: 171 + .saturating_add(Weight::from_parts(1_020, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -85,9 +82,9 @@ impl WeightInfo for SubstrateWeight { fn retract_tip() -> Weight { // Proof Size summary in bytes: // Measured: `221` - // Estimated: `3907` - // Minimum execution time: 25_322_000 picoseconds. - Weight::from_parts(26_107_000, 3907) + // Estimated: `3686` + // Minimum execution time: 29_183_000 picoseconds. + Weight::from_parts(30_017_000, 3686) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -99,17 +96,19 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) /// The range of component `r` is `[0, 300]`. /// The range of component `t` is `[1, 13]`. - fn tip_new(_r: u32, t: u32, ) -> Weight { + fn tip_new(r: u32, t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `526 + t * (64 ±0)` - // Estimated: `6528 + t * (192 ±0)` - // Minimum execution time: 21_112_000 picoseconds. - Weight::from_parts(21_825_317, 6528) - // Standard Error: 11_230 - .saturating_add(Weight::from_parts(86_081, 0).saturating_mul(t.into())) + // Estimated: `3991 + t * (64 ±0)` + // Minimum execution time: 20_726_000 picoseconds. + Weight::from_parts(20_964_411, 3991) + // Standard Error: 119 + .saturating_add(Weight::from_parts(1_230, 0).saturating_mul(r.into())) + // Standard Error: 2_837 + .saturating_add(Weight::from_parts(81_831, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(t.into())) } /// Storage: Elections Members (r:1 w:0) /// Proof Skipped: Elections Members (max_values: Some(1), max_size: None, mode: Measured) @@ -119,14 +118,14 @@ impl WeightInfo for SubstrateWeight { fn tip(t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `747 + t * (112 ±0)` - // Estimated: `6444 + t * (224 ±0)` - // Minimum execution time: 16_703_000 picoseconds. - Weight::from_parts(16_679_429, 6444) - // Standard Error: 18_088 - .saturating_add(Weight::from_parts(281_667, 0).saturating_mul(t.into())) + // Estimated: `4212 + t * (112 ±0)` + // Minimum execution time: 16_048_000 picoseconds. + Weight::from_parts(16_694_981, 4212) + // Standard Error: 4_480 + .saturating_add(Weight::from_parts(179_723, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 224).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 112).saturating_mul(t.into())) } /// Storage: Tips Tips (r:1 w:1) /// Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) @@ -140,26 +139,28 @@ impl WeightInfo for SubstrateWeight { fn close_tip(t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `786 + t * (112 ±0)` - // Estimated: `10874 + t * (336 ±0)` - // Minimum execution time: 46_106_000 picoseconds. - Weight::from_parts(47_844_269, 10874) - // Standard Error: 9_247 - .saturating_add(Weight::from_parts(87_804, 0).saturating_mul(t.into())) + // Estimated: `4242 + t * (112 ±0)` + // Minimum execution time: 61_319_000 picoseconds. + Weight::from_parts(62_217_195, 4242) + // Standard Error: 6_721 + .saturating_add(Weight::from_parts(186_620, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 336).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 112).saturating_mul(t.into())) } /// Storage: Tips Tips (r:1 w:1) /// Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) /// Storage: Tips Reasons (r:0 w:1) /// Proof Skipped: Tips Reasons (max_values: None, max_size: None, mode: Measured) /// The range of component `t` is `[1, 13]`. - fn slash_tip(_t: u32, ) -> Weight { + fn slash_tip(t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `269` - // Estimated: `4003` - // Minimum execution time: 15_508_000 picoseconds. - Weight::from_parts(16_207_284, 4003) + // Estimated: `3734` + // Minimum execution time: 15_397_000 picoseconds. + Weight::from_parts(15_942_494, 3734) + // Standard Error: 1_657 + .saturating_add(Weight::from_parts(4_128, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -175,11 +176,11 @@ impl WeightInfo for () { fn report_awesome(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `4` - // Estimated: `6938` - // Minimum execution time: 26_789_000 picoseconds. - Weight::from_parts(27_619_925, 6938) - // Standard Error: 168 - .saturating_add(Weight::from_parts(1_352, 0).saturating_mul(r.into())) + // Estimated: `3469` + // Minimum execution time: 30_728_000 picoseconds. + Weight::from_parts(31_794_924, 3469) + // Standard Error: 171 + .saturating_add(Weight::from_parts(1_020, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -190,9 +191,9 @@ impl WeightInfo for () { fn retract_tip() -> Weight { // Proof Size summary in bytes: // Measured: `221` - // Estimated: `3907` - // Minimum execution time: 25_322_000 picoseconds. - Weight::from_parts(26_107_000, 3907) + // Estimated: `3686` + // Minimum execution time: 29_183_000 picoseconds. + Weight::from_parts(30_017_000, 3686) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -204,17 +205,19 @@ impl WeightInfo for () { /// Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) /// The range of component `r` is `[0, 300]`. /// The range of component `t` is `[1, 13]`. - fn tip_new(_r: u32, t: u32, ) -> Weight { + fn tip_new(r: u32, t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `526 + t * (64 ±0)` - // Estimated: `6528 + t * (192 ±0)` - // Minimum execution time: 21_112_000 picoseconds. - Weight::from_parts(21_825_317, 6528) - // Standard Error: 11_230 - .saturating_add(Weight::from_parts(86_081, 0).saturating_mul(t.into())) + // Estimated: `3991 + t * (64 ±0)` + // Minimum execution time: 20_726_000 picoseconds. + Weight::from_parts(20_964_411, 3991) + // Standard Error: 119 + .saturating_add(Weight::from_parts(1_230, 0).saturating_mul(r.into())) + // Standard Error: 2_837 + .saturating_add(Weight::from_parts(81_831, 0).saturating_mul(t.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 192).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(t.into())) } /// Storage: Elections Members (r:1 w:0) /// Proof Skipped: Elections Members (max_values: Some(1), max_size: None, mode: Measured) @@ -224,14 +227,14 @@ impl WeightInfo for () { fn tip(t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `747 + t * (112 ±0)` - // Estimated: `6444 + t * (224 ±0)` - // Minimum execution time: 16_703_000 picoseconds. - Weight::from_parts(16_679_429, 6444) - // Standard Error: 18_088 - .saturating_add(Weight::from_parts(281_667, 0).saturating_mul(t.into())) + // Estimated: `4212 + t * (112 ±0)` + // Minimum execution time: 16_048_000 picoseconds. + Weight::from_parts(16_694_981, 4212) + // Standard Error: 4_480 + .saturating_add(Weight::from_parts(179_723, 0).saturating_mul(t.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 224).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 112).saturating_mul(t.into())) } /// Storage: Tips Tips (r:1 w:1) /// Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) @@ -245,26 +248,28 @@ impl WeightInfo for () { fn close_tip(t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `786 + t * (112 ±0)` - // Estimated: `10874 + t * (336 ±0)` - // Minimum execution time: 46_106_000 picoseconds. - Weight::from_parts(47_844_269, 10874) - // Standard Error: 9_247 - .saturating_add(Weight::from_parts(87_804, 0).saturating_mul(t.into())) + // Estimated: `4242 + t * (112 ±0)` + // Minimum execution time: 61_319_000 picoseconds. + Weight::from_parts(62_217_195, 4242) + // Standard Error: 6_721 + .saturating_add(Weight::from_parts(186_620, 0).saturating_mul(t.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 336).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 112).saturating_mul(t.into())) } /// Storage: Tips Tips (r:1 w:1) /// Proof Skipped: Tips Tips (max_values: None, max_size: None, mode: Measured) /// Storage: Tips Reasons (r:0 w:1) /// Proof Skipped: Tips Reasons (max_values: None, max_size: None, mode: Measured) /// The range of component `t` is `[1, 13]`. - fn slash_tip(_t: u32, ) -> Weight { + fn slash_tip(t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `269` - // Estimated: `4003` - // Minimum execution time: 15_508_000 picoseconds. - Weight::from_parts(16_207_284, 4003) + // Estimated: `3734` + // Minimum execution time: 15_397_000 picoseconds. + Weight::from_parts(15_942_494, 3734) + // Standard Error: 1_657 + .saturating_add(Weight::from_parts(4_128, 0).saturating_mul(t.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/frame/transaction-storage/src/weights.rs b/frame/transaction-storage/src/weights.rs index 2845136b7d2a9..5103ac375e97a 100644 --- a/frame/transaction-storage/src/weights.rs +++ b/frame/transaction-storage/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_transaction_storage //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_transaction_storage -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -69,11 +66,11 @@ impl WeightInfo for SubstrateWeight { fn store(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `176` - // Estimated: `41353` - // Minimum execution time: 33_286_000 picoseconds. - Weight::from_parts(33_596_000, 41353) + // Estimated: `38351` + // Minimum execution time: 36_983_000 picoseconds. + Weight::from_parts(37_296_000, 38351) // Standard Error: 2 - .saturating_add(Weight::from_parts(4_954, 0).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(4_908, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -88,9 +85,9 @@ impl WeightInfo for SubstrateWeight { fn renew() -> Weight { // Proof Size summary in bytes: // Measured: `326` - // Estimated: `81704` - // Minimum execution time: 41_892_000 picoseconds. - Weight::from_parts(42_802_000, 81704) + // Estimated: `40351` + // Minimum execution time: 44_637_000 picoseconds. + Weight::from_parts(45_464_000, 40351) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,9 +104,9 @@ impl WeightInfo for SubstrateWeight { fn check_proof_max() -> Weight { // Proof Size summary in bytes: // Measured: `37145` - // Estimated: `48332` - // Minimum execution time: 63_799_000 picoseconds. - Weight::from_parts(66_145_000, 48332) + // Estimated: `40351` + // Minimum execution time: 59_653_000 picoseconds. + Weight::from_parts(61_068_000, 40351) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -127,11 +124,11 @@ impl WeightInfo for () { fn store(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `176` - // Estimated: `41353` - // Minimum execution time: 33_286_000 picoseconds. - Weight::from_parts(33_596_000, 41353) + // Estimated: `38351` + // Minimum execution time: 36_983_000 picoseconds. + Weight::from_parts(37_296_000, 38351) // Standard Error: 2 - .saturating_add(Weight::from_parts(4_954, 0).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(4_908, 0).saturating_mul(l.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -146,9 +143,9 @@ impl WeightInfo for () { fn renew() -> Weight { // Proof Size summary in bytes: // Measured: `326` - // Estimated: `81704` - // Minimum execution time: 41_892_000 picoseconds. - Weight::from_parts(42_802_000, 81704) + // Estimated: `40351` + // Minimum execution time: 44_637_000 picoseconds. + Weight::from_parts(45_464_000, 40351) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -165,9 +162,9 @@ impl WeightInfo for () { fn check_proof_max() -> Weight { // Proof Size summary in bytes: // Measured: `37145` - // Estimated: `48332` - // Minimum execution time: 63_799_000 picoseconds. - Weight::from_parts(66_145_000, 48332) + // Estimated: `40351` + // Minimum execution time: 59_653_000 picoseconds. + Weight::from_parts(61_068_000, 40351) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/frame/treasury/src/weights.rs b/frame/treasury/src/weights.rs index a7c093a8001ec..edf1a674f73ff 100644 --- a/frame/treasury/src/weights.rs +++ b/frame/treasury/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_treasury //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_treasury -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -71,9 +68,9 @@ impl WeightInfo for SubstrateWeight { fn spend() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `3376` - // Minimum execution time: 17_010_000 picoseconds. - Weight::from_parts(17_247_000, 3376) + // Estimated: `1887` + // Minimum execution time: 16_592_000 picoseconds. + Weight::from_parts(16_959_000, 1887) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -85,8 +82,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `143` // Estimated: `1489` - // Minimum execution time: 25_780_000 picoseconds. - Weight::from_parts(41_064_000, 1489) + // Minimum execution time: 29_742_000 picoseconds. + Weight::from_parts(30_359_000, 1489) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -97,9 +94,9 @@ impl WeightInfo for SubstrateWeight { fn reject_proposal() -> Weight { // Proof Size summary in bytes: // Measured: `301` - // Estimated: `7166` - // Minimum execution time: 27_805_000 picoseconds. - Weight::from_parts(28_322_000, 7166) + // Estimated: `3593` + // Minimum execution time: 31_248_000 picoseconds. + Weight::from_parts(31_882_000, 3593) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -111,11 +108,11 @@ impl WeightInfo for SubstrateWeight { fn approve_proposal(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `470 + p * (8 ±0)` - // Estimated: `5460` - // Minimum execution time: 10_939_000 picoseconds. - Weight::from_parts(13_667_341, 5460) - // Standard Error: 907 - .saturating_add(Weight::from_parts(26_648, 0).saturating_mul(p.into())) + // Estimated: `3573` + // Minimum execution time: 10_441_000 picoseconds. + Weight::from_parts(13_061_079, 3573) + // Standard Error: 877 + .saturating_add(Weight::from_parts(26_940, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -125,8 +122,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `127` // Estimated: `1887` - // Minimum execution time: 8_261_000 picoseconds. - Weight::from_parts(8_399_000, 1887) + // Minimum execution time: 7_935_000 picoseconds. + Weight::from_parts(8_153_000, 1887) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -144,16 +141,16 @@ impl WeightInfo for SubstrateWeight { fn on_initialize_proposals(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `387 + p * (251 ±0)` - // Estimated: `7255 + p * (7789 ±0)` - // Minimum execution time: 43_781_000 picoseconds. - Weight::from_parts(68_521_487, 7255) - // Standard Error: 58_804 - .saturating_add(Weight::from_parts(33_271_211, 0).saturating_mul(p.into())) + // Estimated: `1887 + p * (5206 ±0)` + // Minimum execution time: 45_306_000 picoseconds. + Weight::from_parts(53_639_830, 1887) + // Standard Error: 32_330 + .saturating_add(Weight::from_parts(38_930_307, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 7789).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 5206).saturating_mul(p.into())) } } @@ -168,9 +165,9 @@ impl WeightInfo for () { fn spend() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `3376` - // Minimum execution time: 17_010_000 picoseconds. - Weight::from_parts(17_247_000, 3376) + // Estimated: `1887` + // Minimum execution time: 16_592_000 picoseconds. + Weight::from_parts(16_959_000, 1887) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -182,8 +179,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `143` // Estimated: `1489` - // Minimum execution time: 25_780_000 picoseconds. - Weight::from_parts(41_064_000, 1489) + // Minimum execution time: 29_742_000 picoseconds. + Weight::from_parts(30_359_000, 1489) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -194,9 +191,9 @@ impl WeightInfo for () { fn reject_proposal() -> Weight { // Proof Size summary in bytes: // Measured: `301` - // Estimated: `7166` - // Minimum execution time: 27_805_000 picoseconds. - Weight::from_parts(28_322_000, 7166) + // Estimated: `3593` + // Minimum execution time: 31_248_000 picoseconds. + Weight::from_parts(31_882_000, 3593) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -208,11 +205,11 @@ impl WeightInfo for () { fn approve_proposal(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `470 + p * (8 ±0)` - // Estimated: `5460` - // Minimum execution time: 10_939_000 picoseconds. - Weight::from_parts(13_667_341, 5460) - // Standard Error: 907 - .saturating_add(Weight::from_parts(26_648, 0).saturating_mul(p.into())) + // Estimated: `3573` + // Minimum execution time: 10_441_000 picoseconds. + Weight::from_parts(13_061_079, 3573) + // Standard Error: 877 + .saturating_add(Weight::from_parts(26_940, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -222,8 +219,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `127` // Estimated: `1887` - // Minimum execution time: 8_261_000 picoseconds. - Weight::from_parts(8_399_000, 1887) + // Minimum execution time: 7_935_000 picoseconds. + Weight::from_parts(8_153_000, 1887) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -241,15 +238,15 @@ impl WeightInfo for () { fn on_initialize_proposals(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `387 + p * (251 ±0)` - // Estimated: `7255 + p * (7789 ±0)` - // Minimum execution time: 43_781_000 picoseconds. - Weight::from_parts(68_521_487, 7255) - // Standard Error: 58_804 - .saturating_add(Weight::from_parts(33_271_211, 0).saturating_mul(p.into())) + // Estimated: `1887 + p * (5206 ±0)` + // Minimum execution time: 45_306_000 picoseconds. + Weight::from_parts(53_639_830, 1887) + // Standard Error: 32_330 + .saturating_add(Weight::from_parts(38_930_307, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 7789).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 5206).saturating_mul(p.into())) } } diff --git a/frame/uniques/src/weights.rs b/frame/uniques/src/weights.rs index 1f0e3772696f7..14a55d163e0ff 100644 --- a/frame/uniques/src/weights.rs +++ b/frame/uniques/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_uniques //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_uniques -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -90,8 +87,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `249` // Estimated: `3643` - // Minimum execution time: 27_805_000 picoseconds. - Weight::from_parts(28_303_000, 3643) + // Minimum execution time: 32_067_000 picoseconds. + Weight::from_parts(32_817_000, 3643) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -103,8 +100,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `3643` - // Minimum execution time: 16_257_000 picoseconds. - Weight::from_parts(16_626_000, 3643) + // Minimum execution time: 16_365_000 picoseconds. + Weight::from_parts(16_707_000, 3643) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -129,16 +126,16 @@ impl WeightInfo for SubstrateWeight { /// The range of component `a` is `[0, 1000]`. fn destroy(n: u32, m: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `418 + n * (76 ±0) + m * (56 ±0) + a * (107 ±0)` - // Estimated: `9210 + n * (2597 ±0) + a * (2839 ±0) + m * (2583 ±0)` - // Minimum execution time: 2_510_772_000 picoseconds. - Weight::from_parts(2_522_511_000, 9210) - // Standard Error: 27_455 - .saturating_add(Weight::from_parts(6_708_827, 0).saturating_mul(n.into())) - // Standard Error: 27_455 - .saturating_add(Weight::from_parts(375_591, 0).saturating_mul(m.into())) - // Standard Error: 27_455 - .saturating_add(Weight::from_parts(251_697, 0).saturating_mul(a.into())) + // Measured: `418 + a * (107 ±0) + m * (56 ±0) + n * (76 ±0)` + // Estimated: `3643 + a * (2839 ±0) + m * (2583 ±0) + n * (2597 ±0)` + // Minimum execution time: 2_498_918_000 picoseconds. + Weight::from_parts(2_516_809_000, 3643) + // Standard Error: 26_297 + .saturating_add(Weight::from_parts(6_648_035, 0).saturating_mul(n.into())) + // Standard Error: 26_297 + .saturating_add(Weight::from_parts(354_268, 0).saturating_mul(m.into())) + // Standard Error: 26_297 + .saturating_add(Weight::from_parts(223_770, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) @@ -147,9 +144,9 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) - .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) .saturating_add(Weight::from_parts(0, 2839).saturating_mul(a.into())) .saturating_add(Weight::from_parts(0, 2583).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) } /// Storage: Uniques Asset (r:1 w:1) /// Proof: Uniques Asset (max_values: None, max_size: Some(122), added: 2597, mode: MaxEncodedLen) @@ -162,9 +159,9 @@ impl WeightInfo for SubstrateWeight { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `349` - // Estimated: `10719` - // Minimum execution time: 33_959_000 picoseconds. - Weight::from_parts(34_380_000, 10719) + // Estimated: `3643` + // Minimum execution time: 38_157_000 picoseconds. + Weight::from_parts(38_677_000, 3643) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -179,9 +176,9 @@ impl WeightInfo for SubstrateWeight { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 34_194_000 picoseconds. - Weight::from_parts(34_808_000, 7230) + // Estimated: `3643` + // Minimum execution time: 39_069_000 picoseconds. + Weight::from_parts(40_442_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -196,9 +193,9 @@ impl WeightInfo for SubstrateWeight { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 27_841_000 picoseconds. - Weight::from_parts(28_263_000, 7230) + // Estimated: `3643` + // Minimum execution time: 28_085_000 picoseconds. + Weight::from_parts(28_403_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -210,11 +207,11 @@ impl WeightInfo for SubstrateWeight { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `805 + i * (76 ±0)` - // Estimated: `4633 + i * (2597 ±0)` - // Minimum execution time: 15_577_000 picoseconds. - Weight::from_parts(15_706_000, 4633) - // Standard Error: 17_679 - .saturating_add(Weight::from_parts(14_173_779, 0).saturating_mul(i.into())) + // Estimated: `3643 + i * (2597 ±0)` + // Minimum execution time: 16_202_000 picoseconds. + Weight::from_parts(16_380_000, 3643) + // Standard Error: 18_639 + .saturating_add(Weight::from_parts(16_047_161, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -228,9 +225,9 @@ impl WeightInfo for SubstrateWeight { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 19_474_000 picoseconds. - Weight::from_parts(19_807_000, 7230) + // Estimated: `3643` + // Minimum execution time: 20_131_000 picoseconds. + Weight::from_parts(20_535_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -241,9 +238,9 @@ impl WeightInfo for SubstrateWeight { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 19_526_000 picoseconds. - Weight::from_parts(19_818_000, 7230) + // Estimated: `3643` + // Minimum execution time: 19_895_000 picoseconds. + Weight::from_parts(20_198_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -253,8 +250,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3643` - // Minimum execution time: 15_324_000 picoseconds. - Weight::from_parts(15_599_000, 3643) + // Minimum execution time: 15_312_000 picoseconds. + Weight::from_parts(15_555_000, 3643) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -264,8 +261,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3643` - // Minimum execution time: 15_294_000 picoseconds. - Weight::from_parts(15_504_000, 3643) + // Minimum execution time: 15_145_000 picoseconds. + Weight::from_parts(15_371_000, 3643) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -278,9 +275,9 @@ impl WeightInfo for SubstrateWeight { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `423` - // Estimated: `7160` - // Minimum execution time: 24_007_000 picoseconds. - Weight::from_parts(24_555_000, 7160) + // Estimated: `3643` + // Minimum execution time: 23_800_000 picoseconds. + Weight::from_parts(23_991_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -290,8 +287,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3643` - // Minimum execution time: 15_616_000 picoseconds. - Weight::from_parts(15_897_000, 3643) + // Minimum execution time: 15_929_000 picoseconds. + Weight::from_parts(16_219_000, 3643) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -303,8 +300,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3643` - // Minimum execution time: 18_459_000 picoseconds. - Weight::from_parts(18_705_000, 3643) + // Minimum execution time: 18_617_000 picoseconds. + Weight::from_parts(19_016_000, 3643) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -317,9 +314,9 @@ impl WeightInfo for SubstrateWeight { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `547` - // Estimated: `11045` - // Minimum execution time: 39_056_000 picoseconds. - Weight::from_parts(39_513_000, 11045) + // Estimated: `3829` + // Minimum execution time: 41_982_000 picoseconds. + Weight::from_parts(42_329_000, 3829) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -332,9 +329,9 @@ impl WeightInfo for SubstrateWeight { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `936` - // Estimated: `11045` - // Minimum execution time: 37_441_000 picoseconds. - Weight::from_parts(37_859_000, 11045) + // Estimated: `3829` + // Minimum execution time: 39_921_000 picoseconds. + Weight::from_parts(40_499_000, 3829) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -345,9 +342,9 @@ impl WeightInfo for SubstrateWeight { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `415` - // Estimated: `7216` - // Minimum execution time: 29_456_000 picoseconds. - Weight::from_parts(29_930_000, 7216) + // Estimated: `3643` + // Minimum execution time: 31_774_000 picoseconds. + Weight::from_parts(32_327_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -358,9 +355,9 @@ impl WeightInfo for SubstrateWeight { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `547` - // Estimated: `7216` - // Minimum execution time: 29_817_000 picoseconds. - Weight::from_parts(30_364_000, 7216) + // Estimated: `3643` + // Minimum execution time: 32_551_000 picoseconds. + Weight::from_parts(32_891_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -371,9 +368,9 @@ impl WeightInfo for SubstrateWeight { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `349` - // Estimated: `7196` - // Minimum execution time: 29_392_000 picoseconds. - Weight::from_parts(29_878_000, 7196) + // Estimated: `3643` + // Minimum execution time: 33_490_000 picoseconds. + Weight::from_parts(34_617_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -384,9 +381,9 @@ impl WeightInfo for SubstrateWeight { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `461` - // Estimated: `7196` - // Minimum execution time: 27_234_000 picoseconds. - Weight::from_parts(27_664_000, 7196) + // Estimated: `3643` + // Minimum execution time: 31_691_000 picoseconds. + Weight::from_parts(32_042_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -397,9 +394,9 @@ impl WeightInfo for SubstrateWeight { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 20_447_000 picoseconds. - Weight::from_parts(20_886_000, 7230) + // Estimated: `3643` + // Minimum execution time: 20_738_000 picoseconds. + Weight::from_parts(21_067_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -410,9 +407,9 @@ impl WeightInfo for SubstrateWeight { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `528` - // Estimated: `7230` - // Minimum execution time: 20_934_000 picoseconds. - Weight::from_parts(21_271_000, 7230) + // Estimated: `3643` + // Minimum execution time: 20_404_000 picoseconds. + Weight::from_parts(20_999_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -422,8 +419,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `3517` - // Minimum execution time: 17_004_000 picoseconds. - Weight::from_parts(17_401_000, 3517) + // Minimum execution time: 17_047_000 picoseconds. + Weight::from_parts(17_307_000, 3517) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -434,9 +431,9 @@ impl WeightInfo for SubstrateWeight { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `349` - // Estimated: `7132` - // Minimum execution time: 17_371_000 picoseconds. - Weight::from_parts(18_103_000, 7132) + // Estimated: `3643` + // Minimum execution time: 17_829_000 picoseconds. + Weight::from_parts(18_194_000, 3643) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -448,8 +445,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3587` - // Minimum execution time: 17_624_000 picoseconds. - Weight::from_parts(17_866_000, 3587) + // Minimum execution time: 17_620_000 picoseconds. + Weight::from_parts(17_931_000, 3587) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -464,9 +461,9 @@ impl WeightInfo for SubstrateWeight { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `607` - // Estimated: `10784` - // Minimum execution time: 39_736_000 picoseconds. - Weight::from_parts(40_855_000, 10784) + // Estimated: `3643` + // Minimum execution time: 39_550_000 picoseconds. + Weight::from_parts(40_052_000, 3643) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -482,8 +479,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `249` // Estimated: `3643` - // Minimum execution time: 27_805_000 picoseconds. - Weight::from_parts(28_303_000, 3643) + // Minimum execution time: 32_067_000 picoseconds. + Weight::from_parts(32_817_000, 3643) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -495,8 +492,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `3643` - // Minimum execution time: 16_257_000 picoseconds. - Weight::from_parts(16_626_000, 3643) + // Minimum execution time: 16_365_000 picoseconds. + Weight::from_parts(16_707_000, 3643) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -521,16 +518,16 @@ impl WeightInfo for () { /// The range of component `a` is `[0, 1000]`. fn destroy(n: u32, m: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `418 + n * (76 ±0) + m * (56 ±0) + a * (107 ±0)` - // Estimated: `9210 + n * (2597 ±0) + a * (2839 ±0) + m * (2583 ±0)` - // Minimum execution time: 2_510_772_000 picoseconds. - Weight::from_parts(2_522_511_000, 9210) - // Standard Error: 27_455 - .saturating_add(Weight::from_parts(6_708_827, 0).saturating_mul(n.into())) - // Standard Error: 27_455 - .saturating_add(Weight::from_parts(375_591, 0).saturating_mul(m.into())) - // Standard Error: 27_455 - .saturating_add(Weight::from_parts(251_697, 0).saturating_mul(a.into())) + // Measured: `418 + a * (107 ±0) + m * (56 ±0) + n * (76 ±0)` + // Estimated: `3643 + a * (2839 ±0) + m * (2583 ±0) + n * (2597 ±0)` + // Minimum execution time: 2_498_918_000 picoseconds. + Weight::from_parts(2_516_809_000, 3643) + // Standard Error: 26_297 + .saturating_add(Weight::from_parts(6_648_035, 0).saturating_mul(n.into())) + // Standard Error: 26_297 + .saturating_add(Weight::from_parts(354_268, 0).saturating_mul(m.into())) + // Standard Error: 26_297 + .saturating_add(Weight::from_parts(223_770, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(m.into()))) @@ -539,9 +536,9 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(m.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(a.into()))) - .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) .saturating_add(Weight::from_parts(0, 2839).saturating_mul(a.into())) .saturating_add(Weight::from_parts(0, 2583).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) } /// Storage: Uniques Asset (r:1 w:1) /// Proof: Uniques Asset (max_values: None, max_size: Some(122), added: 2597, mode: MaxEncodedLen) @@ -554,9 +551,9 @@ impl WeightInfo for () { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `349` - // Estimated: `10719` - // Minimum execution time: 33_959_000 picoseconds. - Weight::from_parts(34_380_000, 10719) + // Estimated: `3643` + // Minimum execution time: 38_157_000 picoseconds. + Weight::from_parts(38_677_000, 3643) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -571,9 +568,9 @@ impl WeightInfo for () { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 34_194_000 picoseconds. - Weight::from_parts(34_808_000, 7230) + // Estimated: `3643` + // Minimum execution time: 39_069_000 picoseconds. + Weight::from_parts(40_442_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -588,9 +585,9 @@ impl WeightInfo for () { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 27_841_000 picoseconds. - Weight::from_parts(28_263_000, 7230) + // Estimated: `3643` + // Minimum execution time: 28_085_000 picoseconds. + Weight::from_parts(28_403_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -602,11 +599,11 @@ impl WeightInfo for () { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `805 + i * (76 ±0)` - // Estimated: `4633 + i * (2597 ±0)` - // Minimum execution time: 15_577_000 picoseconds. - Weight::from_parts(15_706_000, 4633) - // Standard Error: 17_679 - .saturating_add(Weight::from_parts(14_173_779, 0).saturating_mul(i.into())) + // Estimated: `3643 + i * (2597 ±0)` + // Minimum execution time: 16_202_000 picoseconds. + Weight::from_parts(16_380_000, 3643) + // Standard Error: 18_639 + .saturating_add(Weight::from_parts(16_047_161, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -620,9 +617,9 @@ impl WeightInfo for () { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 19_474_000 picoseconds. - Weight::from_parts(19_807_000, 7230) + // Estimated: `3643` + // Minimum execution time: 20_131_000 picoseconds. + Weight::from_parts(20_535_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -633,9 +630,9 @@ impl WeightInfo for () { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 19_526_000 picoseconds. - Weight::from_parts(19_818_000, 7230) + // Estimated: `3643` + // Minimum execution time: 19_895_000 picoseconds. + Weight::from_parts(20_198_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -645,8 +642,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3643` - // Minimum execution time: 15_324_000 picoseconds. - Weight::from_parts(15_599_000, 3643) + // Minimum execution time: 15_312_000 picoseconds. + Weight::from_parts(15_555_000, 3643) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -656,8 +653,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3643` - // Minimum execution time: 15_294_000 picoseconds. - Weight::from_parts(15_504_000, 3643) + // Minimum execution time: 15_145_000 picoseconds. + Weight::from_parts(15_371_000, 3643) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -670,9 +667,9 @@ impl WeightInfo for () { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `423` - // Estimated: `7160` - // Minimum execution time: 24_007_000 picoseconds. - Weight::from_parts(24_555_000, 7160) + // Estimated: `3643` + // Minimum execution time: 23_800_000 picoseconds. + Weight::from_parts(23_991_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -682,8 +679,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3643` - // Minimum execution time: 15_616_000 picoseconds. - Weight::from_parts(15_897_000, 3643) + // Minimum execution time: 15_929_000 picoseconds. + Weight::from_parts(16_219_000, 3643) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -695,8 +692,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `349` // Estimated: `3643` - // Minimum execution time: 18_459_000 picoseconds. - Weight::from_parts(18_705_000, 3643) + // Minimum execution time: 18_617_000 picoseconds. + Weight::from_parts(19_016_000, 3643) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -709,9 +706,9 @@ impl WeightInfo for () { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `547` - // Estimated: `11045` - // Minimum execution time: 39_056_000 picoseconds. - Weight::from_parts(39_513_000, 11045) + // Estimated: `3829` + // Minimum execution time: 41_982_000 picoseconds. + Weight::from_parts(42_329_000, 3829) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -724,9 +721,9 @@ impl WeightInfo for () { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `936` - // Estimated: `11045` - // Minimum execution time: 37_441_000 picoseconds. - Weight::from_parts(37_859_000, 11045) + // Estimated: `3829` + // Minimum execution time: 39_921_000 picoseconds. + Weight::from_parts(40_499_000, 3829) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -737,9 +734,9 @@ impl WeightInfo for () { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `415` - // Estimated: `7216` - // Minimum execution time: 29_456_000 picoseconds. - Weight::from_parts(29_930_000, 7216) + // Estimated: `3643` + // Minimum execution time: 31_774_000 picoseconds. + Weight::from_parts(32_327_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -750,9 +747,9 @@ impl WeightInfo for () { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `547` - // Estimated: `7216` - // Minimum execution time: 29_817_000 picoseconds. - Weight::from_parts(30_364_000, 7216) + // Estimated: `3643` + // Minimum execution time: 32_551_000 picoseconds. + Weight::from_parts(32_891_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -763,9 +760,9 @@ impl WeightInfo for () { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `349` - // Estimated: `7196` - // Minimum execution time: 29_392_000 picoseconds. - Weight::from_parts(29_878_000, 7196) + // Estimated: `3643` + // Minimum execution time: 33_490_000 picoseconds. + Weight::from_parts(34_617_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -776,9 +773,9 @@ impl WeightInfo for () { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `461` - // Estimated: `7196` - // Minimum execution time: 27_234_000 picoseconds. - Weight::from_parts(27_664_000, 7196) + // Estimated: `3643` + // Minimum execution time: 31_691_000 picoseconds. + Weight::from_parts(32_042_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -789,9 +786,9 @@ impl WeightInfo for () { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `495` - // Estimated: `7230` - // Minimum execution time: 20_447_000 picoseconds. - Weight::from_parts(20_886_000, 7230) + // Estimated: `3643` + // Minimum execution time: 20_738_000 picoseconds. + Weight::from_parts(21_067_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -802,9 +799,9 @@ impl WeightInfo for () { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `528` - // Estimated: `7230` - // Minimum execution time: 20_934_000 picoseconds. - Weight::from_parts(21_271_000, 7230) + // Estimated: `3643` + // Minimum execution time: 20_404_000 picoseconds. + Weight::from_parts(20_999_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -814,8 +811,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `109` // Estimated: `3517` - // Minimum execution time: 17_004_000 picoseconds. - Weight::from_parts(17_401_000, 3517) + // Minimum execution time: 17_047_000 picoseconds. + Weight::from_parts(17_307_000, 3517) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -826,9 +823,9 @@ impl WeightInfo for () { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `349` - // Estimated: `7132` - // Minimum execution time: 17_371_000 picoseconds. - Weight::from_parts(18_103_000, 7132) + // Estimated: `3643` + // Minimum execution time: 17_829_000 picoseconds. + Weight::from_parts(18_194_000, 3643) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -840,8 +837,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `326` // Estimated: `3587` - // Minimum execution time: 17_624_000 picoseconds. - Weight::from_parts(17_866_000, 3587) + // Minimum execution time: 17_620_000 picoseconds. + Weight::from_parts(17_931_000, 3587) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -856,9 +853,9 @@ impl WeightInfo for () { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `607` - // Estimated: `10784` - // Minimum execution time: 39_736_000 picoseconds. - Weight::from_parts(40_855_000, 10784) + // Estimated: `3643` + // Minimum execution time: 39_550_000 picoseconds. + Weight::from_parts(40_052_000, 3643) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } diff --git a/frame/utility/src/weights.rs b/frame/utility/src/weights.rs index 0c50de4f5df88..0ff261a33f362 100644 --- a/frame/utility/src/weights.rs +++ b/frame/utility/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_utility //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_utility -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -66,44 +63,44 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_828_000 picoseconds. - Weight::from_parts(13_806_712, 0) - // Standard Error: 2_750 - .saturating_add(Weight::from_parts(4_169_287, 0).saturating_mul(c.into())) + // Minimum execution time: 7_932_000 picoseconds. + Weight::from_parts(24_064_040, 0) + // Standard Error: 2_486 + .saturating_add(Weight::from_parts(4_238_449, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_835_000 picoseconds. - Weight::from_parts(6_305_000, 0) + // Minimum execution time: 5_536_000 picoseconds. + Weight::from_parts(5_963_000, 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: 8_010_000 picoseconds. - Weight::from_parts(10_539_696, 0) - // Standard Error: 2_681 - .saturating_add(Weight::from_parts(4_368_716, 0).saturating_mul(c.into())) + // Minimum execution time: 7_820_000 picoseconds. + Weight::from_parts(18_969_535, 0) + // Standard Error: 2_228 + .saturating_add(Weight::from_parts(4_448_073, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_139_000 picoseconds. - Weight::from_parts(10_679_000, 0) + // Minimum execution time: 9_811_000 picoseconds. + Weight::from_parts(10_162_000, 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: 7_960_000 picoseconds. - Weight::from_parts(16_874_350, 0) - // Standard Error: 3_040 - .saturating_add(Weight::from_parts(4_151_507, 0).saturating_mul(c.into())) + // Minimum execution time: 7_829_000 picoseconds. + Weight::from_parts(12_960_288, 0) + // Standard Error: 2_222 + .saturating_add(Weight::from_parts(4_272_019, 0).saturating_mul(c.into())) } } @@ -114,43 +111,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_828_000 picoseconds. - Weight::from_parts(13_806_712, 0) - // Standard Error: 2_750 - .saturating_add(Weight::from_parts(4_169_287, 0).saturating_mul(c.into())) + // Minimum execution time: 7_932_000 picoseconds. + Weight::from_parts(24_064_040, 0) + // Standard Error: 2_486 + .saturating_add(Weight::from_parts(4_238_449, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_835_000 picoseconds. - Weight::from_parts(6_305_000, 0) + // Minimum execution time: 5_536_000 picoseconds. + Weight::from_parts(5_963_000, 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: 8_010_000 picoseconds. - Weight::from_parts(10_539_696, 0) - // Standard Error: 2_681 - .saturating_add(Weight::from_parts(4_368_716, 0).saturating_mul(c.into())) + // Minimum execution time: 7_820_000 picoseconds. + Weight::from_parts(18_969_535, 0) + // Standard Error: 2_228 + .saturating_add(Weight::from_parts(4_448_073, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_139_000 picoseconds. - Weight::from_parts(10_679_000, 0) + // Minimum execution time: 9_811_000 picoseconds. + Weight::from_parts(10_162_000, 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: 7_960_000 picoseconds. - Weight::from_parts(16_874_350, 0) - // Standard Error: 3_040 - .saturating_add(Weight::from_parts(4_151_507, 0).saturating_mul(c.into())) + // Minimum execution time: 7_829_000 picoseconds. + Weight::from_parts(12_960_288, 0) + // Standard Error: 2_222 + .saturating_add(Weight::from_parts(4_272_019, 0).saturating_mul(c.into())) } } diff --git a/frame/vesting/src/weights.rs b/frame/vesting/src/weights.rs index 400984f06823d..4cf3b3dcfbfd0 100644 --- a/frame/vesting/src/weights.rs +++ b/frame/vesting/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_vesting //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_vesting -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -68,44 +65,50 @@ impl WeightInfo for SubstrateWeight { /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `l` is `[0, 49]`. /// The range of component `s` is `[1, 28]`. fn vest_locked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `381 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `9286` - // Minimum execution time: 31_657_000 picoseconds. - Weight::from_parts(30_569_947, 9286) - // Standard Error: 794 - .saturating_add(Weight::from_parts(63_114, 0).saturating_mul(l.into())) - // Standard Error: 1_413 - .saturating_add(Weight::from_parts(58_636, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Estimated: `4764` + // Minimum execution time: 36_182_000 picoseconds. + Weight::from_parts(35_159_830, 4764) + // Standard Error: 952 + .saturating_add(Weight::from_parts(63_309, 0).saturating_mul(l.into())) + // Standard Error: 1_694 + .saturating_add(Weight::from_parts(62_244, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `l` is `[0, 49]`. /// The range of component `s` is `[1, 28]`. fn vest_unlocked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `381 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `9286` - // Minimum execution time: 30_474_000 picoseconds. - Weight::from_parts(30_227_344, 9286) - // Standard Error: 1_005 - .saturating_add(Weight::from_parts(56_742, 0).saturating_mul(l.into())) - // Standard Error: 1_788 - .saturating_add(Weight::from_parts(33_890, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Estimated: `4764` + // Minimum execution time: 39_344_000 picoseconds. + Weight::from_parts(38_921_936, 4764) + // Standard Error: 1_283 + .saturating_add(Weight::from_parts(61_531, 0).saturating_mul(l.into())) + // Standard Error: 2_283 + .saturating_add(Weight::from_parts(36_175, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `l` is `[0, 49]`. @@ -113,20 +116,22 @@ impl WeightInfo for SubstrateWeight { fn vest_other_locked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `484 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 33_681_000 picoseconds. - Weight::from_parts(32_540_534, 12879) - // Standard Error: 2_642 - .saturating_add(Weight::from_parts(62_200, 0).saturating_mul(l.into())) - // Standard Error: 4_701 - .saturating_add(Weight::from_parts(69_703, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 39_461_000 picoseconds. + Weight::from_parts(38_206_465, 4764) + // Standard Error: 743 + .saturating_add(Weight::from_parts(56_973, 0).saturating_mul(l.into())) + // Standard Error: 1_322 + .saturating_add(Weight::from_parts(65_059, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `l` is `[0, 49]`. @@ -134,14 +139,14 @@ impl WeightInfo for SubstrateWeight { fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `484 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 32_255_000 picoseconds. - Weight::from_parts(31_637_918, 12879) - // Standard Error: 3_135 - .saturating_add(Weight::from_parts(62_121, 0).saturating_mul(l.into())) - // Standard Error: 5_579 - .saturating_add(Weight::from_parts(61_055, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 42_029_000 picoseconds. + Weight::from_parts(42_153_438, 4764) + // Standard Error: 1_108 + .saturating_add(Weight::from_parts(50_058, 0).saturating_mul(l.into())) + // Standard Error: 1_971 + .saturating_add(Weight::from_parts(32_391, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) @@ -150,19 +155,21 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `l` is `[0, 49]`. /// The range of component `s` is `[0, 27]`. fn vested_transfer(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `555 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 51_697_000 picoseconds. - Weight::from_parts(52_048_055, 12879) - // Standard Error: 1_598 - .saturating_add(Weight::from_parts(60_508, 0).saturating_mul(l.into())) - // Standard Error: 2_843 - .saturating_add(Weight::from_parts(37_870, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 75_223_000 picoseconds. + Weight::from_parts(76_675_778, 4764) + // Standard Error: 2_534 + .saturating_add(Weight::from_parts(70_731, 0).saturating_mul(l.into())) + // Standard Error: 4_509 + .saturating_add(Weight::from_parts(108_866, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) @@ -171,25 +178,29 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `l` is `[0, 49]`. /// The range of component `s` is `[0, 27]`. fn force_vested_transfer(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `658 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `15482` - // Minimum execution time: 54_585_000 picoseconds. - Weight::from_parts(54_492_070, 15482) - // Standard Error: 1_694 - .saturating_add(Weight::from_parts(52_633, 0).saturating_mul(l.into())) - // Standard Error: 3_014 - .saturating_add(Weight::from_parts(45_485, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) + // Estimated: `6196` + // Minimum execution time: 76_922_000 picoseconds. + Weight::from_parts(78_634_098, 6196) + // Standard Error: 2_099 + .saturating_add(Weight::from_parts(68_218, 0).saturating_mul(l.into())) + // Standard Error: 3_736 + .saturating_add(Weight::from_parts(95_990, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `l` is `[0, 49]`. @@ -197,20 +208,22 @@ impl WeightInfo for SubstrateWeight { fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `482 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 34_312_000 picoseconds. - Weight::from_parts(33_740_101, 12879) - // Standard Error: 996 - .saturating_add(Weight::from_parts(62_123, 0).saturating_mul(l.into())) - // Standard Error: 1_841 - .saturating_add(Weight::from_parts(56_463, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 39_476_000 picoseconds. + Weight::from_parts(38_261_747, 4764) + // Standard Error: 1_794 + .saturating_add(Weight::from_parts(69_639, 0).saturating_mul(l.into())) + // Standard Error: 3_313 + .saturating_add(Weight::from_parts(73_202, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `l` is `[0, 49]`. @@ -218,14 +231,14 @@ impl WeightInfo for SubstrateWeight { fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `482 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 34_965_000 picoseconds. - Weight::from_parts(33_831_484, 12879) - // Standard Error: 1_530 - .saturating_add(Weight::from_parts(59_136, 0).saturating_mul(l.into())) - // Standard Error: 2_827 - .saturating_add(Weight::from_parts(58_493, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 43_764_000 picoseconds. + Weight::from_parts(42_679_386, 4764) + // Standard Error: 1_224 + .saturating_add(Weight::from_parts(65_857, 0).saturating_mul(l.into())) + // Standard Error: 2_261 + .saturating_add(Weight::from_parts(70_861, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } } @@ -236,44 +249,50 @@ impl WeightInfo for () { /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `l` is `[0, 49]`. /// The range of component `s` is `[1, 28]`. fn vest_locked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `381 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `9286` - // Minimum execution time: 31_657_000 picoseconds. - Weight::from_parts(30_569_947, 9286) - // Standard Error: 794 - .saturating_add(Weight::from_parts(63_114, 0).saturating_mul(l.into())) - // Standard Error: 1_413 - .saturating_add(Weight::from_parts(58_636, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(2_u64)) + // Estimated: `4764` + // Minimum execution time: 36_182_000 picoseconds. + Weight::from_parts(35_159_830, 4764) + // Standard Error: 952 + .saturating_add(Weight::from_parts(63_309, 0).saturating_mul(l.into())) + // Standard Error: 1_694 + .saturating_add(Weight::from_parts(62_244, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `l` is `[0, 49]`. /// The range of component `s` is `[1, 28]`. fn vest_unlocked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `381 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `9286` - // Minimum execution time: 30_474_000 picoseconds. - Weight::from_parts(30_227_344, 9286) - // Standard Error: 1_005 - .saturating_add(Weight::from_parts(56_742, 0).saturating_mul(l.into())) - // Standard Error: 1_788 - .saturating_add(Weight::from_parts(33_890, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(2_u64)) + // Estimated: `4764` + // Minimum execution time: 39_344_000 picoseconds. + Weight::from_parts(38_921_936, 4764) + // Standard Error: 1_283 + .saturating_add(Weight::from_parts(61_531, 0).saturating_mul(l.into())) + // Standard Error: 2_283 + .saturating_add(Weight::from_parts(36_175, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `l` is `[0, 49]`. @@ -281,20 +300,22 @@ impl WeightInfo for () { fn vest_other_locked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `484 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 33_681_000 picoseconds. - Weight::from_parts(32_540_534, 12879) - // Standard Error: 2_642 - .saturating_add(Weight::from_parts(62_200, 0).saturating_mul(l.into())) - // Standard Error: 4_701 - .saturating_add(Weight::from_parts(69_703, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 39_461_000 picoseconds. + Weight::from_parts(38_206_465, 4764) + // Standard Error: 743 + .saturating_add(Weight::from_parts(56_973, 0).saturating_mul(l.into())) + // Standard Error: 1_322 + .saturating_add(Weight::from_parts(65_059, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `l` is `[0, 49]`. @@ -302,14 +323,14 @@ impl WeightInfo for () { fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `484 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 32_255_000 picoseconds. - Weight::from_parts(31_637_918, 12879) - // Standard Error: 3_135 - .saturating_add(Weight::from_parts(62_121, 0).saturating_mul(l.into())) - // Standard Error: 5_579 - .saturating_add(Weight::from_parts(61_055, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 42_029_000 picoseconds. + Weight::from_parts(42_153_438, 4764) + // Standard Error: 1_108 + .saturating_add(Weight::from_parts(50_058, 0).saturating_mul(l.into())) + // Standard Error: 1_971 + .saturating_add(Weight::from_parts(32_391, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) @@ -318,19 +339,21 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `l` is `[0, 49]`. /// The range of component `s` is `[0, 27]`. fn vested_transfer(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `555 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 51_697_000 picoseconds. - Weight::from_parts(52_048_055, 12879) - // Standard Error: 1_598 - .saturating_add(Weight::from_parts(60_508, 0).saturating_mul(l.into())) - // Standard Error: 2_843 - .saturating_add(Weight::from_parts(37_870, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 75_223_000 picoseconds. + Weight::from_parts(76_675_778, 4764) + // Standard Error: 2_534 + .saturating_add(Weight::from_parts(70_731, 0).saturating_mul(l.into())) + // Standard Error: 4_509 + .saturating_add(Weight::from_parts(108_866, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) @@ -339,25 +362,29 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `l` is `[0, 49]`. /// The range of component `s` is `[0, 27]`. fn force_vested_transfer(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `658 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `15482` - // Minimum execution time: 54_585_000 picoseconds. - Weight::from_parts(54_492_070, 15482) - // Standard Error: 1_694 - .saturating_add(Weight::from_parts(52_633, 0).saturating_mul(l.into())) - // Standard Error: 3_014 - .saturating_add(Weight::from_parts(45_485, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Estimated: `6196` + // Minimum execution time: 76_922_000 picoseconds. + Weight::from_parts(78_634_098, 6196) + // Standard Error: 2_099 + .saturating_add(Weight::from_parts(68_218, 0).saturating_mul(l.into())) + // Standard Error: 3_736 + .saturating_add(Weight::from_parts(95_990, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `l` is `[0, 49]`. @@ -365,20 +392,22 @@ impl WeightInfo for () { fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `482 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 34_312_000 picoseconds. - Weight::from_parts(33_740_101, 12879) - // Standard Error: 996 - .saturating_add(Weight::from_parts(62_123, 0).saturating_mul(l.into())) - // Standard Error: 1_841 - .saturating_add(Weight::from_parts(56_463, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 39_476_000 picoseconds. + Weight::from_parts(38_261_747, 4764) + // Standard Error: 1_794 + .saturating_add(Weight::from_parts(69_639, 0).saturating_mul(l.into())) + // Standard Error: 3_313 + .saturating_add(Weight::from_parts(73_202, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, 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 `l` is `[0, 49]`. @@ -386,14 +415,14 @@ impl WeightInfo for () { fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `482 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `12879` - // Minimum execution time: 34_965_000 picoseconds. - Weight::from_parts(33_831_484, 12879) - // Standard Error: 1_530 - .saturating_add(Weight::from_parts(59_136, 0).saturating_mul(l.into())) - // Standard Error: 2_827 - .saturating_add(Weight::from_parts(58_493, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) + // Estimated: `4764` + // Minimum execution time: 43_764_000 picoseconds. + Weight::from_parts(42_679_386, 4764) + // Standard Error: 1_224 + .saturating_add(Weight::from_parts(65_857, 0).saturating_mul(l.into())) + // Standard Error: 2_261 + .saturating_add(Weight::from_parts(70_861, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } } diff --git a/frame/whitelist/src/weights.rs b/frame/whitelist/src/weights.rs index 536cd188761b1..8636ea376e246 100644 --- a/frame/whitelist/src/weights.rs +++ b/frame/whitelist/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for pallet_whitelist //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -31,9 +31,6 @@ // --steps=50 // --repeat=20 // --pallet=pallet_whitelist -// --no-storage-info -// --no-median-slopes -// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled @@ -67,9 +64,9 @@ impl WeightInfo for SubstrateWeight { fn whitelist_call() -> Weight { // Proof Size summary in bytes: // Measured: `217` - // Estimated: `7061` - // Minimum execution time: 21_530_000 picoseconds. - Weight::from_parts(21_986_000, 7061) + // Estimated: `3556` + // Minimum execution time: 21_370_000 picoseconds. + Weight::from_parts(21_834_000, 3556) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -80,9 +77,9 @@ impl WeightInfo for SubstrateWeight { fn remove_whitelisted_call() -> Weight { // Proof Size summary in bytes: // Measured: `346` - // Estimated: `7061` - // Minimum execution time: 18_980_000 picoseconds. - Weight::from_parts(19_474_000, 7061) + // Estimated: `3556` + // Minimum execution time: 19_222_000 picoseconds. + Weight::from_parts(19_582_000, 3556) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -96,11 +93,11 @@ impl WeightInfo for SubstrateWeight { fn dispatch_whitelisted_call(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `422 + n * (1 ±0)` - // Estimated: `10947 + n * (1 ±0)` - // Minimum execution time: 32_377_000 picoseconds. - Weight::from_parts(32_643_000, 10947) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_147, 0).saturating_mul(n.into())) + // Estimated: `3886 + n * (1 ±0)` + // Minimum execution time: 31_417_000 picoseconds. + Weight::from_parts(31_620_000, 3886) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_145, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -113,11 +110,11 @@ impl WeightInfo for SubstrateWeight { fn dispatch_whitelisted_call_with_preimage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `346` - // Estimated: `7061` - // Minimum execution time: 23_421_000 picoseconds. - Weight::from_parts(24_488_523, 7061) + // Estimated: `3556` + // Minimum execution time: 23_092_000 picoseconds. + Weight::from_parts(24_043_432, 3556) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_217, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_227, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -132,9 +129,9 @@ impl WeightInfo for () { fn whitelist_call() -> Weight { // Proof Size summary in bytes: // Measured: `217` - // Estimated: `7061` - // Minimum execution time: 21_530_000 picoseconds. - Weight::from_parts(21_986_000, 7061) + // Estimated: `3556` + // Minimum execution time: 21_370_000 picoseconds. + Weight::from_parts(21_834_000, 3556) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -145,9 +142,9 @@ impl WeightInfo for () { fn remove_whitelisted_call() -> Weight { // Proof Size summary in bytes: // Measured: `346` - // Estimated: `7061` - // Minimum execution time: 18_980_000 picoseconds. - Weight::from_parts(19_474_000, 7061) + // Estimated: `3556` + // Minimum execution time: 19_222_000 picoseconds. + Weight::from_parts(19_582_000, 3556) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -161,11 +158,11 @@ impl WeightInfo for () { fn dispatch_whitelisted_call(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `422 + n * (1 ±0)` - // Estimated: `10947 + n * (1 ±0)` - // Minimum execution time: 32_377_000 picoseconds. - Weight::from_parts(32_643_000, 10947) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_147, 0).saturating_mul(n.into())) + // Estimated: `3886 + n * (1 ±0)` + // Minimum execution time: 31_417_000 picoseconds. + Weight::from_parts(31_620_000, 3886) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_145, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -178,11 +175,11 @@ impl WeightInfo for () { fn dispatch_whitelisted_call_with_preimage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `346` - // Estimated: `7061` - // Minimum execution time: 23_421_000 picoseconds. - Weight::from_parts(24_488_523, 7061) + // Estimated: `3556` + // Minimum execution time: 23_092_000 picoseconds. + Weight::from_parts(24_043_432, 3556) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_217, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_227, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/scripts/run_all_benchmarks.sh b/scripts/run_all_benchmarks.sh index b632cb5c12f04..727b49e26afe5 100755 --- a/scripts/run_all_benchmarks.sh +++ b/scripts/run_all_benchmarks.sh @@ -59,7 +59,7 @@ done if [ "$skip_build" != true ] then echo "[+] Compiling Substrate benchmarks..." - cargo build --profile=production --locked --features=runtime-benchmarks + cargo build --profile=production --locked --features=runtime-benchmarks --bin substrate fi # The executable to use. diff --git a/utils/frame/benchmarking-cli/src/pallet/command.rs b/utils/frame/benchmarking-cli/src/pallet/command.rs index 0c3b6b3e8f45c..08bcf3ee5a6b5 100644 --- a/utils/frame/benchmarking-cli/src/pallet/command.rs +++ b/utils/frame/benchmarking-cli/src/pallet/command.rs @@ -473,7 +473,7 @@ impl PalletCmd { log::info!( target: LOG_TARGET, - "Running Benchmark: {}.{}({} args) {}/{} {}/{}", + "Running benchmark: {}.{}({} args) {}/{} {}/{}", String::from_utf8(pallet.clone()) .expect("Encoded from String; qed"), String::from_utf8(extrinsic.clone()) diff --git a/utils/frame/benchmarking-cli/src/pallet/writer.rs b/utils/frame/benchmarking-cli/src/pallet/writer.rs index a609f9e38c0ce..89cce45627e68 100644 --- a/utils/frame/benchmarking-cli/src/pallet/writer.rs +++ b/utils/frame/benchmarking-cli/src/pallet/writer.rs @@ -278,6 +278,7 @@ fn get_benchmark_data( used_recorded_proof_size.push(ComponentSlope { name: name.clone(), slope, error }); } }); + used_recorded_proof_size.sort_by(|a, b| a.name.cmp(&b.name)); // We add additional comments showing which storage items were touched. // We find the worst case proof size, and use that as the final proof size result. @@ -315,12 +316,12 @@ fn get_benchmark_data( let mut base_calculated_proof_size = 0; // Sum up the proof sizes per component for (_, slope, base) in proof_size_per_components.iter() { - base_calculated_proof_size += base; + base_calculated_proof_size = base_calculated_proof_size.max(*base); for component in slope.iter() { let mut found = false; for used_component in used_calculated_proof_size.iter_mut() { if used_component.name == component.name { - used_component.slope += component.slope; + used_component.slope = used_component.slope.max(component.slope); found = true; break } @@ -337,6 +338,7 @@ fn get_benchmark_data( } } } + used_calculated_proof_size.sort_by(|a, b| a.name.cmp(&b.name)); // This puts a marker on any component which is entirely unused in the weight formula. let components = batch.time_results[0] @@ -626,7 +628,7 @@ pub(crate) fn process_storage_results( }, }; // Add the additional trie layer overhead for every new prefix. - if *reads > 0 { + if *reads > 0 && !is_all_ignored { prefix_result.proof_size += 15 * 33 * additional_trie_layers as u32; } storage_per_prefix.entry(prefix.clone()).or_default().push(prefix_result); From 7f930c23a8458f360625c9e5e0e1446edbcbb957 Mon Sep 17 00:00:00 2001 From: Sasha Gryaznov Date: Thu, 13 Apr 2023 16:57:28 +0300 Subject: [PATCH 23/93] stabilize call_runtime (#13901) --- frame/contracts/src/wasm/runtime.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 19eb0fb50739b..bfb991ae51dfa 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -2404,8 +2404,6 @@ pub mod env { /// - Provide functionality **exclusively** to contracts. /// - Provide custom weights. /// - Avoid the need to keep the `Call` data structure stable. - #[unstable] - #[prefixed_alias] fn call_runtime( ctx: _, memory: _, From 186db7a7785ab74e15457d57072660344f237c2b Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Thu, 13 Apr 2023 19:14:44 +0200 Subject: [PATCH 24/93] fix .test-refs-check-benches condition (#13906) This check is meant to catch pipelines triggered by the scripts ci-linux staging tests. The correct CI_PIPELINE_SOURCE for multi-project pipelines such as this is "pipeline"; "parent_pipeline" is only set for child pipelines triggered /within the same repo/. cf https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 470ce2ce3180e..30a584635f367 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -179,7 +179,7 @@ variables: # exclude cargo-check-benches from such runs .test-refs-check-benches: rules: - - if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "parent_pipeline" && $CI_IMAGE =~ /staging$/ + - if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "pipeline" && $CI_IMAGE =~ /staging$/ when: never - if: $CI_PIPELINE_SOURCE == "web" - if: $CI_PIPELINE_SOURCE == "schedule" From b5b57513f64193bbe43b5bee69c950e78af9a5f6 Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Thu, 13 Apr 2023 19:14:55 +0200 Subject: [PATCH 25/93] Disable timestamping for the crate publishing jobs (#13910) --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 30a584635f367..a8687216feba9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -259,6 +259,9 @@ variables: - artifacts/ variables: SPUB_TMP: artifacts + # disable timestamping for the crate publishing jobs, they leave stray child processes behind + # which don't interact well with the timestamping script + CI_DISABLE_TIMESTAMP: 1 #### stage: .pre From a49292aa6c1853ea70d22dbfda31e42159d1b43b Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Thu, 13 Apr 2023 20:17:12 +0200 Subject: [PATCH 26/93] Refactor the automatic-crate-publishing logic, make triggered pipelines uninterruptible as well (#13908) * Use a new approach to make automatic-crate-publishing uninterruptible It's not neccessary to dynamically change the `interruptible` setting for *all* jobs as the old approach does; gitlab already considers a pipeline uninterruptible as soon as a single uninterruptible job has started (cf https://docs.gitlab.com/ee/ci/yaml/#interruptible). IMO this approach is more readable, as it avoids dynamically loading the .defaults section from different files based on import conditions; the logic is now shorter and entirely contained in the main .gitlab-ci.yml. * Make triggered multi-project pipelines uninterruptible --- .gitlab-ci.yml | 42 +++++++++---------- .../ci/gitlab/crate-publishing-pipeline.yml | 1 - scripts/ci/gitlab/default-pipeline.yml | 1 - 3 files changed, 19 insertions(+), 25 deletions(-) delete mode 100644 scripts/ci/gitlab/crate-publishing-pipeline.yml delete mode 100644 scripts/ci/gitlab/default-pipeline.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a8687216feba9..e7b0093184cd3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,7 +58,7 @@ variables: NEXTEST_SUCCESS_OUTPUT: final ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.43" -.shared-default: &shared-default +default: retry: max: 2 when: @@ -66,21 +66,7 @@ variables: - unknown_failure - api_failure cache: {} - -.default-pipeline-definitions: - default: - <<: *shared-default - interruptible: true - -.crate-publishing-pipeline-definitions: - default: - <<: *shared-default - # The crate-publishing pipeline defaults to `interruptible: false` so that we'll be able to - # reach and run the publishing jobs despite the "Auto-cancel redundant pipelines" CI setting. - # The setting is relevant because the crate-publishing pipeline runs on `master`, thus future - # pipelines on `master` (e.g. created for new commits or other schedules) might unintendedly - # cancel the publishing jobs or its dependencies before we get to actually publish the crates. - interruptible: false + interruptible: true .collect-artifacts: artifacts: @@ -291,6 +277,23 @@ check-crates-publishing-pipeline: https://github.com/paritytech/releng-scripts.git - ONLY_CHECK_PIPELINE=true ./releng-scripts/publish-crates +# By default our pipelines are interruptible, but some special pipelines shouldn't be interrupted: +# * multi-project pipelines such as the ones triggered by the scripts repo +# * the scheduled automatic-crate-publishing pipeline +# +# In those cases, we add an uninterruptible .pre job; once that one has started, +# the entire pipeline becomes uninterruptible +uninterruptible-pipeline: + extends: .kubernetes-env + variables: + CI_IMAGE: "paritytech/tools:latest" + stage: .pre + interruptible: false + rules: + - if: $CI_PIPELINE_SOURCE == "pipeline" + - if: $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "automatic-crate-publishing" + script: "true" + include: # check jobs - scripts/ci/gitlab/pipeline/check.yml @@ -311,13 +314,6 @@ include: # pipeline is made uninterruptible to ensure that test jobs also get a chance to run to # completion, because the publishing jobs depends on them AS INTENDED: crates should not be # published before their source code is checked. - - local: scripts/ci/gitlab/crate-publishing-pipeline.yml - rules: - - if: $PIPELINE == "automatic-crate-publishing" - # For normal pipelines: run it with defaults + `interruptible: true` - - local: scripts/ci/gitlab/default-pipeline.yml - rules: - - if: $PIPELINE != "automatic-crate-publishing" - project: parity/infrastructure/ci_cd/shared ref: v0.2 file: /common/timestamp.yml diff --git a/scripts/ci/gitlab/crate-publishing-pipeline.yml b/scripts/ci/gitlab/crate-publishing-pipeline.yml deleted file mode 100644 index 9d5303952e6ef..0000000000000 --- a/scripts/ci/gitlab/crate-publishing-pipeline.yml +++ /dev/null @@ -1 +0,0 @@ -default: !reference [.crate-publishing-pipeline-definitions, default] diff --git a/scripts/ci/gitlab/default-pipeline.yml b/scripts/ci/gitlab/default-pipeline.yml deleted file mode 100644 index 19f6c320c3c24..0000000000000 --- a/scripts/ci/gitlab/default-pipeline.yml +++ /dev/null @@ -1 +0,0 @@ -default: !reference [.default-pipeline-definitions, default] From e155ab8aefbe5831cbd6100767bd111bbad32ee7 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 13 Apr 2023 22:44:46 +0200 Subject: [PATCH 27/93] Update proc-macro-warning (#13876) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update proc-macro-warning Closes https://github.com/paritytech/substrate/issues/13872 Signed-off-by: Oliver Tale-Yazdi * Update to v0.3.1 (including syn 2.0) Signed-off-by: Oliver Tale-Yazdi * Revert "Update to v0.3.1 (including syn 2.0)" CI is red since it Polkadot uses a different syn version… Going to update it lean. This reverts commit 3240d379b72f6f722eaf502ed49e9a1b0f79db4b. Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi --- Cargo.lock | 4 ++-- frame/support/procedural/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45542b8c269e5..d5eb703610be5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7552,9 +7552,9 @@ dependencies = [ [[package]] name = "proc-macro-warning" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4f284d87b9cedc2ff57223cbc4e3937cd6063c01e92c8e2a8c080df0013933" +checksum = "f0e25495609acefcaeb5052edad8ac91017c9bc98fc38ef321ed524e50b68bac" dependencies = [ "proc-macro2", "quote", diff --git a/frame/support/procedural/Cargo.toml b/frame/support/procedural/Cargo.toml index d57b81a3444fe..e508730f43f95 100644 --- a/frame/support/procedural/Cargo.toml +++ b/frame/support/procedural/Cargo.toml @@ -23,7 +23,7 @@ proc-macro2 = "1.0.56" quote = "1.0.26" syn = { version = "2.0.14", features = ["full"] } frame-support-procedural-tools = { version = "4.0.0-dev", path = "./tools" } -proc-macro-warning = { version = "0.2.0", default-features = false } +proc-macro-warning = { version = "0.3.0", default-features = false } [features] default = ["std"] From 4b212829fd62c180c23a90718a73c221f5b4f4ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Apr 2023 09:32:24 +0200 Subject: [PATCH 28/93] Bump h2 from 0.3.16 to 0.3.17 (#13915) Bumps [h2](https://github.com/hyperium/h2) from 0.3.16 to 0.3.17. - [Release notes](https://github.com/hyperium/h2/releases) - [Changelog](https://github.com/hyperium/h2/blob/master/CHANGELOG.md) - [Commits](https://github.com/hyperium/h2/compare/v0.3.16...v0.3.17) --- updated-dependencies: - dependency-name: h2 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d5eb703610be5..94fd66e0faf38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2941,9 +2941,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "66b91535aa35fea1523ad1b86cb6b53c28e0ae566ba4a460f4457e936cad7c6f" dependencies = [ "bytes", "fnv", From 6a560f85d24bb027a1909109b1f84a35b3348e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 14 Apr 2023 10:21:06 +0200 Subject: [PATCH 29/93] Unqueue invalid transactions when skipping (#13918) The check was intially added by: https://github.com/paritytech/substrate/pull/5121 But a later pr fixed it properly: https://github.com/paritytech/substrate/pull/9789 TLDR: We don't need to check for skipped anymore, as we already remove all transactions that are being unlocked by an invalid transactions and thus, we will not tag them as invalid directly because the nonce for example is incorrect. Fixes: https://github.com/paritytech/substrate/issues/13911 --- client/basic-authorship/src/basic_authorship.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs index 376278fa1b6db..795288d0a1da8 100644 --- a/client/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -474,14 +474,6 @@ where break EndProposingReason::HitBlockWeightLimit } }, - Err(e) if skipped > 0 => { - pending_iterator.report_invalid(&pending_tx); - trace!( - "[{:?}] Ignoring invalid transaction when skipping: {}", - pending_tx_hash, - e - ); - }, Err(e) => { pending_iterator.report_invalid(&pending_tx); debug!("[{:?}] Invalid transaction: {}", pending_tx_hash, e); @@ -740,8 +732,11 @@ mod tests { ); } + // This test ensures that if one transaction of a user was rejected, because for example + // the weight limit was hit, we don't mark the other transactions of the user as invalid because + // the nonce is not matching. #[test] - fn should_not_remove_invalid_transactions_when_skipping() { + fn should_not_remove_invalid_transactions_from_the_same_sender_after_one_was_invalid() { // given let mut client = Arc::new(substrate_test_runtime_client::new()); let spawner = sp_core::testing::TaskExecutor::new(); From b23e52d340f1d8c6405c631e5e836f45966df326 Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Fri, 14 Apr 2023 14:16:17 +0200 Subject: [PATCH 30/93] Fail dependant checks on cargo check warnings (#13922) * Fail dependant checks on cargo check warnings * Adjust feature flags for check-dependent-polkadot --- scripts/ci/gitlab/pipeline/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/ci/gitlab/pipeline/build.yml b/scripts/ci/gitlab/pipeline/build.yml index 806a4ef970960..0c04abfd5aa30 100644 --- a/scripts/ci/gitlab/pipeline/build.yml +++ b/scripts/ci/gitlab/pipeline/build.yml @@ -12,6 +12,8 @@ extends: - .docker-env - .test-refs-no-trigger-prs-only + variables: + RUSTFLAGS: "-D warnings" script: - git clone --depth=1 @@ -35,6 +37,10 @@ check-dependent-polkadot: COMPANION_OVERRIDES: | substrate: polkadot-v* polkadot: release-v* + # enable the same feature flags as polkadot's test-linux-stable + COMPANION_CHECK_COMMAND: > + cargo check --all-targets --workspace + --features=runtime-benchmarks,runtime-metrics,try-runtime rules: - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ #PRs From c2f664e1acff27dbc165d02ab1785829b23ac3f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Apr 2023 14:52:51 +0200 Subject: [PATCH 31/93] Bump cargo_metadata from 0.15.3 to 0.15.4 (#13899) Bumps [cargo_metadata](https://github.com/oli-obk/cargo_metadata) from 0.15.3 to 0.15.4. - [Release notes](https://github.com/oli-obk/cargo_metadata/releases) - [Changelog](https://github.com/oli-obk/cargo_metadata/blob/main/CHANGELOG.md) - [Commits](https://github.com/oli-obk/cargo_metadata/compare/0.15.3...0.15.4) --- updated-dependencies: - dependency-name: cargo_metadata dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- client/executor/wasmtime/Cargo.toml | 2 +- utils/wasm-builder/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 94fd66e0faf38..bb8081221f0e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -797,9 +797,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.15.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07" +checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index bffccd12badfb..fed284e916fd6 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -48,4 +48,4 @@ sp-io = { version = "7.0.0", path = "../../../primitives/io" } tempfile = "3.3.0" paste = "1.0" codec = { package = "parity-scale-codec", version = "3.2.2" } -cargo_metadata = "0.15.2" +cargo_metadata = "0.15.4" diff --git a/utils/wasm-builder/Cargo.toml b/utils/wasm-builder/Cargo.toml index e1444a24042d1..7f356294e6cf9 100644 --- a/utils/wasm-builder/Cargo.toml +++ b/utils/wasm-builder/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] ansi_term = "0.12.1" build-helper = "0.1.1" -cargo_metadata = "0.15.2" +cargo_metadata = "0.15.4" strum = { version = "0.24.1", features = ["derive"] } tempfile = "3.1.0" toml = "0.7.3" From a9f67d0e59fc388c97efe8b1e6b2f928fae85b19 Mon Sep 17 00:00:00 2001 From: NingLin-P Date: Fri, 14 Apr 2023 22:15:31 +0800 Subject: [PATCH 32/93] Drain all the pending messages in the channel when TracingUnboundedReceiver is dropped (#13917) Signed-off-by: linning --- client/utils/src/mpsc.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/client/utils/src/mpsc.rs b/client/utils/src/mpsc.rs index 3f783b10060bd..7e06bd203b010 100644 --- a/client/utils/src/mpsc.rs +++ b/client/utils/src/mpsc.rs @@ -141,6 +141,7 @@ impl TracingUnboundedReceiver { impl Drop for TracingUnboundedReceiver { fn drop(&mut self) { + // Close the channel to prevent any further messages to be sent into the channel self.close(); // the number of messages about to be dropped let count = self.inner.len(); @@ -150,6 +151,10 @@ impl Drop for TracingUnboundedReceiver { .with_label_values(&[self.name, "dropped"]) .inc_by(count.saturated_into()); } + // Drain all the pending messages in the channel since they can never be accessed, + // this can be removed once https://github.com/smol-rs/async-channel/issues/23 is + // resolved + while let Ok(_) = self.inner.try_recv() {} } } @@ -177,3 +182,22 @@ impl FusedStream for TracingUnboundedReceiver { self.inner.is_terminated() } } + +#[cfg(test)] +mod tests { + use super::tracing_unbounded; + use async_channel::{self, RecvError, TryRecvError}; + + #[test] + fn test_tracing_unbounded_receiver_drop() { + let (tracing_unbounded_sender, tracing_unbounded_receiver) = + tracing_unbounded("test-receiver-drop", 10); + let (tx, rx) = async_channel::unbounded::(); + + tracing_unbounded_sender.unbounded_send(tx).unwrap(); + drop(tracing_unbounded_receiver); + + assert_eq!(rx.try_recv(), Err(TryRecvError::Closed)); + assert_eq!(rx.recv_blocking(), Err(RecvError)); + } +} From 3f8dc9ed594fdba455d0bf6780768e7176188514 Mon Sep 17 00:00:00 2001 From: gupnik Date: Fri, 14 Apr 2023 22:54:26 +0530 Subject: [PATCH 33/93] Updates Benchmark macro parsing to use Generic Argument (#13919) * WIP Signed-off-by: Oliver Tale-Yazdi * Removes POC code * Adds assertion and UT * adds runtime error * removes const_assert * ".git/.scripts/commands/fmt/fmt.sh" --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: Oliver Tale-Yazdi Co-authored-by: command-bot <> --- frame/support/procedural/src/benchmark.rs | 32 ++++++++----------- .../tests/benchmark_ui/bad_param_range.rs | 16 ---------- .../tests/benchmark_ui/bad_param_range.stderr | 5 --- .../benchmark_ui/pass/valid_const_expr.rs | 28 ++++++++++++++++ 4 files changed, 41 insertions(+), 40 deletions(-) delete mode 100644 frame/support/test/tests/benchmark_ui/bad_param_range.rs delete mode 100644 frame/support/test/tests/benchmark_ui/bad_param_range.stderr create mode 100644 frame/support/test/tests/benchmark_ui/pass/valid_const_expr.rs diff --git a/frame/support/procedural/src/benchmark.rs b/frame/support/procedural/src/benchmark.rs index cf091e7cb0cf7..315a6000bc8bf 100644 --- a/frame/support/procedural/src/benchmark.rs +++ b/frame/support/procedural/src/benchmark.rs @@ -28,9 +28,9 @@ use syn::{ punctuated::Punctuated, spanned::Spanned, token::{Comma, Gt, Lt, PathSep}, - Attribute, Error, Expr, ExprBlock, ExprCall, ExprPath, FnArg, Item, ItemFn, ItemMod, LitInt, - Pat, Path, PathArguments, PathSegment, Result, ReturnType, Signature, Stmt, Token, Type, - TypePath, Visibility, WhereClause, + Attribute, Error, Expr, ExprBlock, ExprCall, ExprPath, FnArg, Item, ItemFn, ItemMod, Pat, Path, + PathArguments, PathSegment, Result, ReturnType, Signature, Stmt, Token, Type, TypePath, + Visibility, WhereClause, }; mod keywords { @@ -54,17 +54,17 @@ mod keywords { struct ParamDef { name: String, typ: Type, - start: u32, - end: u32, + start: syn::GenericArgument, + end: syn::GenericArgument, } /// Allows easy parsing of the `<10, 20>` component of `x: Linear<10, 20>`. #[derive(Parse)] struct RangeArgs { _lt_token: Lt, - start: LitInt, + start: syn::GenericArgument, _comma: Comma, - end: LitInt, + end: syn::GenericArgument, _gt_token: Gt, } @@ -228,17 +228,8 @@ fn parse_params(item_fn: &ItemFn) -> Result> { let Some(segment) = tpath.path.segments.last() else { return invalid_param(typ.span()) }; let args = segment.arguments.to_token_stream().into(); let Ok(args) = syn::parse::(args) else { return invalid_param(typ.span()) }; - let Ok(start) = args.start.base10_parse::() else { return invalid_param(args.start.span()) }; - let Ok(end) = args.end.base10_parse::() else { return invalid_param(args.end.span()) }; - if end < start { - return Err(Error::new( - args.start.span(), - "The start of a `ParamRange` must be less than or equal to the end", - )) - } - - params.push(ParamDef { name, typ: typ.clone(), start, end }); + params.push(ParamDef { name, typ: typ.clone(), start: args.start, end: args.end }); } Ok(params) } @@ -700,8 +691,8 @@ impl UnrolledParams { .iter() .map(|p| { let name = Ident::new(&p.name, Span::call_site()); - let start = p.start; - let end = p.end; + let start = &p.start; + let end = &p.end; quote!(#name, #start, #end) }) .collect(); @@ -987,6 +978,9 @@ fn expand_benchmark( // Test the lowest, highest (if its different from the lowest) // and up to num_values-2 more equidistant values in between. // For 0..10 and num_values=6 this would mean: [0, 2, 4, 6, 8, 10] + if high < low { + return Err("The start of a `ParamRange` must be less than or equal to the end".into()); + } let mut values = #krate::vec![low]; let diff = (high - low).min(num_values - 1); diff --git a/frame/support/test/tests/benchmark_ui/bad_param_range.rs b/frame/support/test/tests/benchmark_ui/bad_param_range.rs deleted file mode 100644 index 993f2a0004103..0000000000000 --- a/frame/support/test/tests/benchmark_ui/bad_param_range.rs +++ /dev/null @@ -1,16 +0,0 @@ -use frame_benchmarking::v2::*; -#[allow(unused_imports)] -use frame_support_test::Config; - -#[benchmarks] -mod benches { - use super::*; - - #[benchmark] - fn bench(x: Linear<3, 1>) { - #[block] - {} - } -} - -fn main() {} diff --git a/frame/support/test/tests/benchmark_ui/bad_param_range.stderr b/frame/support/test/tests/benchmark_ui/bad_param_range.stderr deleted file mode 100644 index 1347af0a07b8e..0000000000000 --- a/frame/support/test/tests/benchmark_ui/bad_param_range.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: The start of a `ParamRange` must be less than or equal to the end - --> tests/benchmark_ui/bad_param_range.rs:10:21 - | -10 | fn bench(x: Linear<3, 1>) { - | ^ diff --git a/frame/support/test/tests/benchmark_ui/pass/valid_const_expr.rs b/frame/support/test/tests/benchmark_ui/pass/valid_const_expr.rs new file mode 100644 index 0000000000000..bead3bf277be2 --- /dev/null +++ b/frame/support/test/tests/benchmark_ui/pass/valid_const_expr.rs @@ -0,0 +1,28 @@ +use frame_benchmarking::v2::*; +use frame_support_test::Config; +use frame_support::parameter_types; + +#[benchmarks] +mod benches { + use super::*; + + const MY_CONST: u32 = 100; + + const fn my_fn() -> u32 { + 200 + } + + parameter_types! { + const MyConst: u32 = MY_CONST; + } + + #[benchmark(skip_meta, extra)] + fn bench(a: Linear<{MY_CONST * 2}, {my_fn() + MyConst::get()}>) { + let a = 2 + 2; + #[block] + {} + assert_eq!(a, 4); + } +} + +fn main() {} From f1e2fa43ef10f0abc4fc0620ff08979ac6a6e097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 15 Apr 2023 23:27:51 +0200 Subject: [PATCH 34/93] sc-allocator: Do not panic on invalid header pointer (#13925) We should not panic on an invalid header pointer and instead return an error. It is possible that the application modifies the header pointer illegally, but then we should return an error instead of panicking. --- client/allocator/src/freeing_bump.rs | 31 +++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/client/allocator/src/freeing_bump.rs b/client/allocator/src/freeing_bump.rs index c3cb827afec08..144c0764540db 100644 --- a/client/allocator/src/freeing_bump.rs +++ b/client/allocator/src/freeing_bump.rs @@ -421,11 +421,11 @@ impl FreeingBumpHeapAllocator { let header_ptr: u32 = match self.free_lists[order] { Link::Ptr(header_ptr) => { - assert!( - u64::from(header_ptr + order.size() + HEADER_SIZE) <= mem.size(), - "Pointer is looked up in list of free entries, into which - only valid values are inserted; qed" - ); + if (u64::from(header_ptr) + u64::from(order.size()) + u64::from(HEADER_SIZE)) > + mem.size() + { + return Err(error("Invalid header pointer detected")) + } // Remove this header from the free list. let next_free = Header::read_from(mem, header_ptr)? @@ -1106,4 +1106,25 @@ mod tests { assert_eq!(3, mem.pages()); } + + #[test] + fn modifying_the_header_leads_to_an_error() { + let mut mem = MemoryInstance::with_pages(1); + let mut heap = FreeingBumpHeapAllocator::new(0); + + let ptr = heap.allocate(&mut mem, 5).unwrap(); + + heap.deallocate(&mut mem, ptr).unwrap(); + + Header::Free(Link::Ptr(u32::MAX - 1)) + .write_into(&mut mem, u32::from(ptr) - HEADER_SIZE) + .unwrap(); + + heap.allocate(&mut mem, 5).unwrap(); + assert!(heap + .allocate(&mut mem, 5) + .unwrap_err() + .to_string() + .contains("Invalid header pointer")); + } } From 35049b176e49ca23240d1ee3ec6c190804e3b4d1 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Sun, 16 Apr 2023 00:25:56 +0200 Subject: [PATCH 35/93] [Fix] Remove redundant stash from Stake (#13907) * [Fix] Remove redundant stash from Stake * fix tests --- frame/nomination-pools/src/mock.rs | 6 +++--- frame/staking/src/pallet/impls.rs | 2 +- primitives/staking/src/lib.rs | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frame/nomination-pools/src/mock.rs b/frame/nomination-pools/src/mock.rs index 6d83ef61de793..3565ff14e6c82 100644 --- a/frame/nomination-pools/src/mock.rs +++ b/frame/nomination-pools/src/mock.rs @@ -122,9 +122,9 @@ impl sp_staking::StakingInterface for StakingMock { BondedBalanceMap::get().get(who).copied(), ) { (None, None) => Err(DispatchError::Other("balance not found")), - (Some(v), None) => Ok(Stake { total: v, active: 0, stash: *who }), - (None, Some(v)) => Ok(Stake { total: v, active: v, stash: *who }), - (Some(a), Some(b)) => Ok(Stake { total: a + b, active: b, stash: *who }), + (Some(v), None) => Ok(Stake { total: v, active: 0 }), + (None, Some(v)) => Ok(Stake { total: v, active: v }), + (Some(a), Some(b)) => Ok(Stake { total: a + b, active: b }), } } diff --git a/frame/staking/src/pallet/impls.rs b/frame/staking/src/pallet/impls.rs index d5072476fb37e..5143538c2a513 100644 --- a/frame/staking/src/pallet/impls.rs +++ b/frame/staking/src/pallet/impls.rs @@ -1611,7 +1611,7 @@ impl StakingInterface for Pallet { fn stake(who: &Self::AccountId) -> Result, DispatchError> { Self::bonded(who) .and_then(|c| Self::ledger(c)) - .map(|l| Stake { stash: l.stash, total: l.total, active: l.active }) + .map(|l| Stake { total: l.total, active: l.active }) .ok_or(Error::::NotStash.into()) } diff --git a/primitives/staking/src/lib.rs b/primitives/staking/src/lib.rs index a8d8e6a602c94..f328696551eed 100644 --- a/primitives/staking/src/lib.rs +++ b/primitives/staking/src/lib.rs @@ -58,8 +58,6 @@ impl OnStakerSlash for () { /// A struct that reflects stake that an account has in the staking system. Provides a set of /// methods to operate on it's properties. Aimed at making `StakingInterface` more concise. pub struct Stake { - /// The stash account whose balance is actually locked and at stake. - pub stash: T::AccountId, /// The total stake that `stash` has in the staking system. This includes the /// `active` stake, and any funds currently in the process of unbonding via /// [`StakingInterface::unbond`]. From 4e93782c16f741cde18a8b98bd791838e03788fb Mon Sep 17 00:00:00 2001 From: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Date: Mon, 17 Apr 2023 07:43:13 +0200 Subject: [PATCH 36/93] Try-state for Collective pallet (#13645) * write the try_state_ function * update tests * update check * fix benchmarking * fix nonsense * Update frame/collective/src/lib.rs Co-authored-by: Oliver Tale-Yazdi * Update frame/collective/src/lib.rs Co-authored-by: Oliver Tale-Yazdi * unique proposal index * prime must be a member of the collective * oops * Add new checks * use ensure * fix --------- Co-authored-by: Oliver Tale-Yazdi --- frame/collective/src/benchmarking.rs | 2 +- frame/collective/src/lib.rs | 118 ++++++++++++++++++++++++++- frame/collective/src/tests.rs | 99 ++++++++++++---------- 3 files changed, 175 insertions(+), 44 deletions(-) diff --git a/frame/collective/src/benchmarking.rs b/frame/collective/src/benchmarking.rs index d4b5af1bc1937..bcd203c3894a3 100644 --- a/frame/collective/src/benchmarking.rs +++ b/frame/collective/src/benchmarking.rs @@ -646,5 +646,5 @@ benchmarks_instance_pallet! { assert_last_event::(Event::Disapproved { proposal_hash: last_hash }.into()); } - impl_benchmark_test_suite!(Collective, crate::tests::new_test_ext(), crate::tests::Test); + impl_benchmark_test_suite!(Collective, crate::tests::ExtBuilder::default().build(), crate::tests::Test); } diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index bde08f08c13b4..0cbf7e97261df 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -50,8 +50,8 @@ use sp_std::{marker::PhantomData, prelude::*, result}; use frame_support::{ codec::{Decode, Encode, MaxEncodedLen}, dispatch::{ - DispatchError, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo, Pays, - PostDispatchInfo, + DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo, + Pays, PostDispatchInfo, }, ensure, traits::{ @@ -341,6 +341,15 @@ pub mod pallet { WrongProposalLength, } + #[pallet::hooks] + impl, I: 'static> Hooks> for Pallet { + #[cfg(feature = "try-runtime")] + fn try_state(_n: BlockNumberFor) -> Result<(), &'static str> { + Self::do_try_state()?; + Ok(()) + } + } + // Note that councillor operations are assigned to the operational class. #[pallet::call] impl, I: 'static> Pallet { @@ -916,6 +925,111 @@ impl, I: 'static> Pallet { }); num_proposals as u32 } + + /// Ensure the correctness of the state of this pallet. + /// + /// The following expectation must always apply. + /// + /// ## Expectations: + /// + /// Looking at proposals: + /// + /// * Each hash of a proposal that is stored inside `Proposals` must have a + /// call mapped to it inside the `ProposalOf` storage map. + /// * `ProposalCount` must always be more or equal to the number of + /// proposals inside the `Proposals` storage value. The reason why + /// `ProposalCount` can be more is because when a proposal is removed the + /// count is not deducted. + /// * Count of `ProposalOf` should match the count of `Proposals` + /// + /// Looking at votes: + /// * The sum of aye and nay votes for a proposal can never exceed + /// `MaxMembers`. + /// * The proposal index inside the `Voting` storage map must be unique. + /// * All proposal hashes inside `Voting` must exist in `Proposals`. + /// + /// Looking at members: + /// * The members count must never exceed `MaxMembers`. + /// * All the members must be sorted by value. + /// + /// Looking at prime account: + /// * The prime account must be a member of the collective. + #[cfg(any(feature = "try-runtime", test))] + fn do_try_state() -> DispatchResult { + Self::proposals().into_iter().try_for_each(|proposal| -> DispatchResult { + ensure!( + Self::proposal_of(proposal).is_some(), + DispatchError::Other( + "Proposal hash from `Proposals` is not found inside the `ProposalOf` mapping." + ) + ); + Ok(()) + })?; + + ensure!( + Self::proposals().into_iter().count() <= Self::proposal_count() as usize, + DispatchError::Other("The actual number of proposals is greater than `ProposalCount`") + ); + ensure!( + Self::proposals().into_iter().count() == >::iter_keys().count(), + DispatchError::Other("Proposal count inside `Proposals` is not equal to the proposal count in `ProposalOf`") + ); + + Self::proposals().into_iter().try_for_each(|proposal| -> DispatchResult { + if let Some(votes) = Self::voting(proposal) { + let ayes = votes.ayes.len(); + let nays = votes.nays.len(); + + ensure!( + ayes.saturating_add(nays) <= T::MaxMembers::get() as usize, + DispatchError::Other("The sum of ayes and nays is greater than `MaxMembers`") + ); + } + Ok(()) + })?; + + let mut proposal_indices = vec![]; + Self::proposals().into_iter().try_for_each(|proposal| -> DispatchResult { + if let Some(votes) = Self::voting(proposal) { + let proposal_index = votes.index; + ensure!( + !proposal_indices.contains(&proposal_index), + DispatchError::Other("The proposal index is not unique.") + ); + proposal_indices.push(proposal_index); + } + Ok(()) + })?; + + >::iter_keys().try_for_each(|proposal_hash| -> DispatchResult { + ensure!( + Self::proposals().contains(&proposal_hash), + DispatchError::Other( + "`Proposals` doesn't contain the proposal hash from the `Voting` storage map." + ) + ); + Ok(()) + })?; + + ensure!( + Self::members().len() <= T::MaxMembers::get() as usize, + DispatchError::Other("The member count is greater than `MaxMembers`.") + ); + + ensure!( + Self::members().windows(2).all(|members| members[0] <= members[1]), + DispatchError::Other("The members are not sorted by value.") + ); + + if let Some(prime) = Self::prime() { + ensure!( + Self::members().contains(&prime), + DispatchError::Other("Prime account is not a member.") + ); + } + + Ok(()) + } } impl, I: 'static> ChangeMembers for Pallet { diff --git a/frame/collective/src/tests.rs b/frame/collective/src/tests.rs index 2550ab3ed2017..79dc3becfffc6 100644 --- a/frame/collective/src/tests.rs +++ b/frame/collective/src/tests.rs @@ -155,23 +155,40 @@ impl Config for Test { type SetMembersOrigin = EnsureRoot; } -pub fn new_test_ext() -> sp_io::TestExternalities { - let mut ext: sp_io::TestExternalities = GenesisConfig { - collective: pallet_collective::GenesisConfig { - members: vec![1, 2, 3], - phantom: Default::default(), - }, - collective_majority: pallet_collective::GenesisConfig { - members: vec![1, 2, 3, 4, 5], - phantom: Default::default(), - }, - default_collective: Default::default(), +pub struct ExtBuilder {} + +impl Default for ExtBuilder { + fn default() -> Self { + Self {} + } +} + +impl ExtBuilder { + pub fn build(self) -> sp_io::TestExternalities { + let mut ext: sp_io::TestExternalities = GenesisConfig { + collective: pallet_collective::GenesisConfig { + members: vec![1, 2, 3], + phantom: Default::default(), + }, + collective_majority: pallet_collective::GenesisConfig { + members: vec![1, 2, 3, 4, 5], + phantom: Default::default(), + }, + default_collective: Default::default(), + } + .build_storage() + .unwrap() + .into(); + ext.execute_with(|| System::set_block_number(1)); + ext + } + + pub fn build_and_execute(self, test: impl FnOnce() -> ()) { + self.build().execute_with(|| { + test(); + Collective::do_try_state().unwrap(); + }) } - .build_storage() - .unwrap() - .into(); - ext.execute_with(|| System::set_block_number(1)); - ext } fn make_proposal(value: u64) -> RuntimeCall { @@ -186,7 +203,7 @@ fn record(event: RuntimeEvent) -> EventRecord { #[test] fn motions_basic_environment_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { assert_eq!(Collective::members(), vec![1, 2, 3]); assert_eq!(*Collective::proposals(), Vec::::new()); }); @@ -194,7 +211,7 @@ fn motions_basic_environment_works() { #[test] fn close_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -262,7 +279,7 @@ fn close_works() { #[test] fn proposal_weight_limit_works_on_approve() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = RuntimeCall::Collective(crate::Call::set_members { new_members: vec![1, 2, 3], prime: None, @@ -304,7 +321,7 @@ fn proposal_weight_limit_works_on_approve() { #[test] fn proposal_weight_limit_ignored_on_disapprove() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = RuntimeCall::Collective(crate::Call::set_members { new_members: vec![1, 2, 3], prime: None, @@ -334,7 +351,7 @@ fn proposal_weight_limit_ignored_on_disapprove() { #[test] fn close_with_prime_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -402,7 +419,7 @@ fn close_with_prime_works() { #[test] fn close_with_voting_prime_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -472,7 +489,7 @@ fn close_with_voting_prime_works() { #[test] fn close_with_no_prime_but_majority_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -552,7 +569,7 @@ fn close_with_no_prime_but_majority_works() { #[test] fn removal_of_old_voters_votes_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash = BlakeTwo256::hash_of(&proposal); @@ -600,7 +617,7 @@ fn removal_of_old_voters_votes_works() { #[test] fn removal_of_old_voters_votes_works_with_set_members() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash = BlakeTwo256::hash_of(&proposal); @@ -658,7 +675,7 @@ fn removal_of_old_voters_votes_works_with_set_members() { #[test] fn propose_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash = proposal.blake2_256().into(); @@ -690,7 +707,7 @@ fn propose_works() { #[test] fn limit_active_proposals() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { for i in 0..MaxProposals::get() { let proposal = make_proposal(i as u64); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); @@ -717,7 +734,7 @@ fn limit_active_proposals() { #[test] fn correct_validate_and_get_proposal() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = RuntimeCall::Collective(crate::Call::set_members { new_members: vec![1, 2, 3], prime: None, @@ -763,7 +780,7 @@ fn correct_validate_and_get_proposal() { #[test] fn motions_ignoring_non_collective_proposals_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); assert_noop!( @@ -780,7 +797,7 @@ fn motions_ignoring_non_collective_proposals_works() { #[test] fn motions_ignoring_non_collective_votes_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash: H256 = proposal.blake2_256().into(); @@ -799,7 +816,7 @@ fn motions_ignoring_non_collective_votes_works() { #[test] fn motions_ignoring_bad_index_collective_vote_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { System::set_block_number(3); let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); @@ -819,7 +836,7 @@ fn motions_ignoring_bad_index_collective_vote_works() { #[test] fn motions_vote_after_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash: H256 = proposal.blake2_256().into(); @@ -888,7 +905,7 @@ fn motions_vote_after_works() { #[test] fn motions_all_first_vote_free_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash: H256 = proposal.blake2_256().into(); @@ -946,7 +963,7 @@ fn motions_all_first_vote_free_works() { #[test] fn motions_reproposing_disapproved_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -978,7 +995,7 @@ fn motions_reproposing_disapproved_works() { #[test] fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = RuntimeCall::Democracy(mock_democracy::Call::external_propose_majority {}); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -1108,7 +1125,7 @@ fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() { #[test] fn motions_disapproval_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -1167,7 +1184,7 @@ fn motions_disapproval_works() { #[test] fn motions_approval_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -1228,7 +1245,7 @@ fn motions_approval_works() { #[test] fn motion_with_no_votes_closes_with_disapproval() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let proposal_weight = proposal.get_dispatch_info().weight; @@ -1289,7 +1306,7 @@ fn close_disapprove_does_not_care_about_weight_or_len() { // This test confirms that if you close a proposal that would be disapproved, // we do not care about the proposal length or proposal weight since it will // not be read from storage or executed. - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash: H256 = proposal.blake2_256().into(); @@ -1321,7 +1338,7 @@ fn close_disapprove_does_not_care_about_weight_or_len() { #[test] fn disapprove_proposal_works() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { let proposal = make_proposal(42); let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); let hash: H256 = proposal.blake2_256().into(); @@ -1380,7 +1397,7 @@ fn genesis_build_panics_with_duplicate_members() { #[test] fn migration_v4() { - new_test_ext().execute_with(|| { + ExtBuilder::default().build_and_execute(|| { use frame_support::traits::PalletInfoAccess; let old_pallet = "OldCollective"; From 15bb9c61aecf73a3a7a1853151a27587edb34b97 Mon Sep 17 00:00:00 2001 From: Mike Ruje Date: Mon, 17 Apr 2023 11:07:14 +0200 Subject: [PATCH 37/93] imp function comparison (#13928) --- bin/node/bench/src/core.rs | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/bin/node/bench/src/core.rs b/bin/node/bench/src/core.rs index 29cda70990aa0..1f22d3db69261 100644 --- a/bin/node/bench/src/core.rs +++ b/bin/node/bench/src/core.rs @@ -72,24 +72,13 @@ pub struct NsFormatter(pub u64); impl fmt::Display for NsFormatter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let v = self.0; - - if v < 100 { - return write!(f, "{} ns", v) - } - - if self.0 < 100_000 { - return write!(f, "{:.1} µs", v as f64 / 1000.0) - } - - if self.0 < 1_000_000 { - return write!(f, "{:.4} ms", v as f64 / 1_000_000.0) - } - - if self.0 < 100_000_000 { - return write!(f, "{:.1} ms", v as f64 / 1_000_000.0) + match v { + v if v < 100 => write!(f, "{} ns", v), + v if v < 100_000 => write!(f, "{:.1} µs", v as f64 / 1000.0), + v if v < 1_000_000 => write!(f, "{:.4} ms", v as f64 / 1_000_000.0), + v if v < 100_000_000 => write!(f, "{:.1} ms", v as f64 / 1_000_000.0), + _ => write!(f, "{:.4} s", v as f64 / 1_000_000_000.0), } - - write!(f, "{:.4} s", v as f64 / 1_000_000_000.0) } } From 915d22ccaa45b2b93b1eb4194b4349c1db7930d8 Mon Sep 17 00:00:00 2001 From: Przemek Rzad Date: Mon, 17 Apr 2023 12:22:59 +0200 Subject: [PATCH 38/93] Update links in the Referenda Readme (#13929) * Update links in the Referenda Readme * Update frame/referenda/README.md --------- Co-authored-by: Oliver Tale-Yazdi --- frame/referenda/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frame/referenda/README.md b/frame/referenda/README.md index 85031a0113033..b9a8b022cbdb7 100644 --- a/frame/referenda/README.md +++ b/frame/referenda/README.md @@ -1,8 +1,8 @@ # Referenda Pallet -- [`assembly::Config`](https://docs.rs/pallet-assembly/latest/pallet_assembly/trait.Config.html) -- [`Call`](https://docs.rs/pallet-assembly/latest/pallet_assembly/enum.Call.html) +- [`Config`](https://docs.rs/pallet-referenda/latest/pallet_referenda/pallet/trait.Config.html) +- [`Call`](https://docs.rs/pallet-referenda/latest/pallet_referenda/pallet/enum.Call.html) ## Overview -The Assembly pallet handles the administration of general stakeholder voting. +The Referenda pallet handles the administration of general stakeholder voting. From 785115b3a13901b0c708af8166430bcc9c71f28f Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 17 Apr 2023 19:13:55 +0100 Subject: [PATCH 39/93] Balances: repatriate_reserved should respect freezes (#13885) * repatriate_reserved should respect freezes * Docs * Fix and clean * Formatting * Update frame/balances/src/types.rs Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> * Fix * Simplify * Fixes * Fixes --------- Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> --- frame/balances/src/impl_currency.rs | 9 +++- frame/balances/src/lib.rs | 70 +++++++++++++++-------------- frame/balances/src/types.rs | 6 +-- 3 files changed, 46 insertions(+), 39 deletions(-) diff --git a/frame/balances/src/impl_currency.rs b/frame/balances/src/impl_currency.rs index 790a29f004764..329ea289f966e 100644 --- a/frame/balances/src/impl_currency.rs +++ b/frame/balances/src/impl_currency.rs @@ -22,7 +22,7 @@ use frame_support::{ ensure, pallet_prelude::DispatchResult, traits::{ - tokens::{fungible, BalanceStatus as Status}, + tokens::{fungible, BalanceStatus as Status, Fortitude::Polite, Precision::BestEffort}, Currency, DefensiveSaturating, ExistenceRequirement, ExistenceRequirement::AllowDeath, Get, Imbalance, LockIdentifier, LockableCurrency, NamedReservableCurrency, @@ -590,13 +590,18 @@ where /// Is a no-op if: /// - the value to be moved is zero; or /// - the `slashed` id equal to `beneficiary` and the `status` is `Reserved`. + /// + /// This is `Polite` and thus will not repatriate any funds which would lead the total balance + /// to be less than the frozen amount. Returns `Ok` with the actual amount of funds moved, + /// which may be less than `value` since the operation is done an a `BestEffort` basis. fn repatriate_reserved( slashed: &T::AccountId, beneficiary: &T::AccountId, value: Self::Balance, status: Status, ) -> Result { - let actual = Self::do_transfer_reserved(slashed, beneficiary, value, true, status)?; + let actual = + Self::do_transfer_reserved(slashed, beneficiary, value, BestEffort, Polite, status)?; Ok(value.saturating_sub(actual)) } } diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index 029a170535a10..74aec1f2d259b 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -205,7 +205,10 @@ type AccountIdLookupOf = <::Lookup as StaticLookup #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::{pallet_prelude::*, traits::fungible::Credit}; + use frame_support::{ + pallet_prelude::*, + traits::{fungible::Credit, tokens::Precision}, + }; use frame_system::pallet_prelude::*; pub type CreditOf = Credit<::AccountId, Pallet>; @@ -1100,59 +1103,58 @@ pub mod pallet { } /// Move the reserved balance of one account into the balance of another, according to - /// `status`. + /// `status`. This will respect freezes/locks only if `fortitude` is `Polite`. /// - /// Is a no-op if: - /// - the value to be moved is zero; or - /// - the `slashed` id equal to `beneficiary` and the `status` is `Reserved`. + /// Is a no-op if the value to be moved is zero. /// /// NOTE: returns actual amount of transferred value in `Ok` case. pub(crate) fn do_transfer_reserved( slashed: &T::AccountId, beneficiary: &T::AccountId, value: T::Balance, - best_effort: bool, + precision: Precision, + fortitude: Fortitude, status: Status, ) -> Result { if value.is_zero() { return Ok(Zero::zero()) } + let max = >::reducible_total_balance_on_hold( + slashed, fortitude, + ); + let actual = match precision { + Precision::BestEffort => value.min(max), + Precision::Exact => value, + }; + ensure!(actual <= max, TokenError::FundsUnavailable); if slashed == beneficiary { return match status { - Status::Free => Ok(value.saturating_sub(Self::unreserve(slashed, value))), - Status::Reserved => Ok(value.saturating_sub(Self::reserved_balance(slashed))), + Status::Free => Ok(actual.saturating_sub(Self::unreserve(slashed, actual))), + Status::Reserved => Ok(actual), } } - let ((actual, maybe_dust_1), maybe_dust_2) = Self::try_mutate_account( + let ((_, maybe_dust_1), maybe_dust_2) = Self::try_mutate_account( beneficiary, - |to_account, is_new| -> Result<(T::Balance, Option), DispatchError> { + |to_account, is_new| -> Result<((), Option), DispatchError> { ensure!(!is_new, Error::::DeadAccount); - Self::try_mutate_account( - slashed, - |from_account, _| -> Result { - let actual = cmp::min(from_account.reserved, value); - ensure!( - best_effort || actual == value, - Error::::InsufficientBalance - ); - match status { - Status::Free => - to_account.free = to_account - .free - .checked_add(&actual) - .ok_or(ArithmeticError::Overflow)?, - Status::Reserved => - to_account.reserved = to_account - .reserved - .checked_add(&actual) - .ok_or(ArithmeticError::Overflow)?, - } - from_account.reserved -= actual; - Ok(actual) - }, - ) + Self::try_mutate_account(slashed, |from_account, _| -> DispatchResult { + match status { + Status::Free => + to_account.free = to_account + .free + .checked_add(&actual) + .ok_or(ArithmeticError::Overflow)?, + Status::Reserved => + to_account.reserved = to_account + .reserved + .checked_add(&actual) + .ok_or(ArithmeticError::Overflow)?, + } + from_account.reserved.saturating_reduce(actual); + Ok(()) + }) }, )?; diff --git a/frame/balances/src/types.rs b/frame/balances/src/types.rs index c96e1e44b4165..389124402a8f1 100644 --- a/frame/balances/src/types.rs +++ b/frame/balances/src/types.rs @@ -102,9 +102,9 @@ pub struct AccountData { /// This is the sum of all individual holds together with any sums still under the (deprecated) /// reserves API. pub reserved: Balance, - /// The amount that `free` may not drop below when reducing the balance, except for actions - /// where the account owner cannot reasonably benefit from thr balance reduction, such as - /// slashing. + /// The amount that `free + reserved` may not drop below when reducing the balance, except for + /// actions where the account owner cannot reasonably benefit from the balance reduction, such + /// as slashing. pub frozen: Balance, /// Extra information about this account. The MSB is a flag indicating whether the new ref- /// counting logic is in place for this account. From af29c6f10ee84c862f6ba7c14fc302b9824f9d4f Mon Sep 17 00:00:00 2001 From: Aaro Altonen <48052676+altonen@users.noreply.github.com> Date: Tue, 18 Apr 2023 10:47:36 +0300 Subject: [PATCH 40/93] Poll the substream validation before polling `Notifications` (#13934) * Poll the substream validation before polling `Notifications` In tests, it can happen that `Notifications` doesn't produce any events which causes `poll()` to return `Poll::Pending` and the substream validation futures won't get polled. Poll the futures before calling `Notifications` so results for substream validations are received even if `Notifications` is not producing any events. * Remove `pending_messages` * Remove unused import --- client/network/src/protocol.rs | 44 +++++++++++++--------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index a7e6f36ef6215..0075e856e7574 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -40,7 +40,7 @@ use sc_utils::mpsc::TracingUnboundedSender; use sp_runtime::traits::Block as BlockT; use std::{ - collections::{HashMap, HashSet, VecDeque}, + collections::{HashMap, HashSet}, future::Future, iter, pin::Pin, @@ -77,8 +77,6 @@ type PendingSyncSubstreamValidation = // Lock must always be taken in order declared here. pub struct Protocol { - /// Pending list of messages to return from `poll` as a priority. - pending_messages: VecDeque, /// Used to report reputation changes. peerset_handle: sc_peerset::PeersetHandle, /// Handles opening the unique substream and sending and receiving raw messages. @@ -181,7 +179,6 @@ impl Protocol { }; let protocol = Self { - pending_messages: VecDeque::new(), peerset_handle: peerset_handle.clone(), behaviour, notification_protocols: iter::once(block_announces_protocol.notifications_protocol) @@ -409,8 +406,21 @@ impl NetworkBehaviour for Protocol { cx: &mut std::task::Context, params: &mut impl PollParameters, ) -> Poll> { - if let Some(message) = self.pending_messages.pop_front() { - return Poll::Ready(NetworkBehaviourAction::GenerateEvent(message)) + while let Poll::Ready(Some(validation_result)) = + self.sync_substream_validations.poll_next_unpin(cx) + { + match validation_result { + Ok((peer, roles)) => { + self.peers.insert(peer, roles); + }, + Err(peer) => { + log::debug!( + target: "sub-libp2p", + "`SyncingEngine` rejected stream" + ); + self.behaviour.disconnect_peer(&peer, HARDCODED_PEERSETS_SYNC); + }, + } } let event = match self.behaviour.poll(cx, params) { @@ -430,23 +440,6 @@ impl NetworkBehaviour for Protocol { return Poll::Ready(NetworkBehaviourAction::CloseConnection { peer_id, connection }), }; - while let Poll::Ready(Some(validation_result)) = - self.sync_substream_validations.poll_next_unpin(cx) - { - match validation_result { - Ok((peer, roles)) => { - self.peers.insert(peer, roles); - }, - Err(peer) => { - log::debug!( - target: "sub-libp2p", - "`SyncingEngine` rejected stream" - ); - self.behaviour.disconnect_peer(&peer, HARDCODED_PEERSETS_SYNC); - }, - } - } - let outcome = match event { NotificationsOut::CustomProtocolOpen { peer_id, @@ -509,7 +502,6 @@ impl NetworkBehaviour for Protocol { ) { Ok(handshake) => { let roles = handshake.roles; - self.peers.insert(peer_id, roles); let (tx, rx) = oneshot::channel(); let _ = self.tx.unbounded_send( @@ -644,10 +636,6 @@ impl NetworkBehaviour for Protocol { return Poll::Ready(NetworkBehaviourAction::GenerateEvent(outcome)) } - if let Some(message) = self.pending_messages.pop_front() { - return Poll::Ready(NetworkBehaviourAction::GenerateEvent(message)) - } - // This block can only be reached if an event was pulled from the behaviour and that // resulted in `CustomMessageOutcome::None`. Since there might be another pending // message from the behaviour, the task is scheduled again. From cb954820a8d8d765ce75021e244223a3b4d5722d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Tue, 18 Apr 2023 10:38:04 +0100 Subject: [PATCH 41/93] babe: replace usage of SharedEpochChanges with internal RPC (#13883) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * babe: replace usage of SharedEpochChanges with internal RPC * babe-rpc: fix tests * babe: use SinkExt::send instead of Sender::try_send SinkExt::send provides backpressure in case the channel is full * Update client/consensus/babe/src/lib.rs Co-authored-by: Bastian Köcher * babe: fix spawn * babe: send handles backpressure * babe: use testing::TaskExecutor * babe-rpc: better error handling --------- Co-authored-by: Bastian Köcher --- Cargo.lock | 1 - bin/node/cli/src/service.rs | 10 +- bin/node/rpc/Cargo.toml | 1 - bin/node/rpc/src/lib.rs | 24 ++--- client/consensus/babe/rpc/src/lib.rs | 135 +++++++++++++------------- client/consensus/babe/src/lib.rs | 140 ++++++++++++++------------- client/sync-state-rpc/src/lib.rs | 35 ++++--- 7 files changed, 171 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bb8081221f0e2..b7d3bd5ee41e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5142,7 +5142,6 @@ dependencies = [ "sc-client-api", "sc-consensus-babe", "sc-consensus-babe-rpc", - "sc-consensus-epochs", "sc-consensus-grandpa", "sc-consensus-grandpa-rpc", "sc-rpc", diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index 7b0dfcda6ff0e..de640180574ce 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -203,7 +203,7 @@ pub fn new_partial( )?; let slot_duration = babe_link.config().slot_duration(); - let import_queue = sc_consensus_babe::import_queue( + let (import_queue, babe_worker_handle) = sc_consensus_babe::import_queue( babe_link.clone(), block_import.clone(), Some(Box::new(justification_import)), @@ -228,7 +228,7 @@ pub fn new_partial( let import_setup = (block_import, grandpa_link, babe_link); let (rpc_extensions_builder, rpc_setup) = { - let (_, grandpa_link, babe_link) = &import_setup; + let (_, grandpa_link, _) = &import_setup; let justification_stream = grandpa_link.justification_stream(); let shared_authority_set = grandpa_link.shared_authority_set().clone(); @@ -240,9 +240,6 @@ pub fn new_partial( Some(shared_authority_set.clone()), ); - let babe_config = babe_link.config().clone(); - let shared_epoch_changes = babe_link.epoch_changes().clone(); - let client = client.clone(); let pool = transaction_pool.clone(); let select_chain = select_chain.clone(); @@ -258,9 +255,8 @@ pub fn new_partial( chain_spec: chain_spec.cloned_box(), deny_unsafe, babe: node_rpc::BabeDeps { - babe_config: babe_config.clone(), - shared_epoch_changes: shared_epoch_changes.clone(), keystore: keystore.clone(), + babe_worker_handle: babe_worker_handle.clone(), }, grandpa: node_rpc::GrandpaDeps { shared_voter_state: shared_voter_state.clone(), diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 0ea6f49bd6094..724efbe9a5721 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -21,7 +21,6 @@ sc-chain-spec = { version = "4.0.0-dev", path = "../../../client/chain-spec" } sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" } sc-consensus-babe = { version = "0.10.0-dev", path = "../../../client/consensus/babe" } sc-consensus-babe-rpc = { version = "0.10.0-dev", path = "../../../client/consensus/babe/rpc" } -sc-consensus-epochs = { version = "0.10.0-dev", path = "../../../client/consensus/epochs" } sc-consensus-grandpa = { version = "0.10.0-dev", path = "../../../client/consensus/grandpa" } sc-consensus-grandpa-rpc = { version = "0.10.0-dev", path = "../../../client/consensus/grandpa/rpc" } sc-rpc = { version = "4.0.0-dev", path = "../../../client/rpc" } diff --git a/bin/node/rpc/src/lib.rs b/bin/node/rpc/src/lib.rs index 9dcdf0f218923..5f61fdcd55d97 100644 --- a/bin/node/rpc/src/lib.rs +++ b/bin/node/rpc/src/lib.rs @@ -36,8 +36,7 @@ use std::sync::Arc; use jsonrpsee::RpcModule; use node_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Index}; use sc_client_api::AuxStore; -use sc_consensus_babe::{BabeConfiguration, Epoch}; -use sc_consensus_epochs::SharedEpochChanges; +use sc_consensus_babe::BabeWorkerHandle; use sc_consensus_grandpa::{ FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState, }; @@ -53,10 +52,8 @@ use sp_keystore::KeystorePtr; /// Extra dependencies for BABE. pub struct BabeDeps { - /// BABE protocol config. - pub babe_config: BabeConfiguration, - /// BABE pending epoch changes. - pub shared_epoch_changes: SharedEpochChanges, + /// A handle to the BABE worker for issuing requests. + pub babe_worker_handle: BabeWorkerHandle, /// The keystore that manages the keys of the node. pub keystore: KeystorePtr, } @@ -130,7 +127,7 @@ where let mut io = RpcModule::new(()); let FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa } = deps; - let BabeDeps { keystore, babe_config, shared_epoch_changes } = babe; + let BabeDeps { keystore, babe_worker_handle } = babe; let GrandpaDeps { shared_voter_state, shared_authority_set, @@ -151,15 +148,8 @@ where io.merge(Mmr::new(client.clone()).into_rpc())?; io.merge(TransactionPayment::new(client.clone()).into_rpc())?; io.merge( - Babe::new( - client.clone(), - shared_epoch_changes.clone(), - keystore, - babe_config, - select_chain, - deny_unsafe, - ) - .into_rpc(), + Babe::new(client.clone(), babe_worker_handle.clone(), keystore, select_chain, deny_unsafe) + .into_rpc(), )?; io.merge( Grandpa::new( @@ -173,7 +163,7 @@ where )?; io.merge( - SyncState::new(chain_spec, client.clone(), shared_authority_set, shared_epoch_changes)? + SyncState::new(chain_spec, client.clone(), shared_authority_set, babe_worker_handle)? .into_rpc(), )?; diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index cdc8dbfd80a34..1ae15cc5453d7 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -18,28 +18,29 @@ //! RPC api for babe. +use std::{collections::HashMap, sync::Arc}; + use futures::TryFutureExt; use jsonrpsee::{ core::{async_trait, Error as JsonRpseeError, RpcResult}, proc_macros::rpc, types::{error::CallError, ErrorObject}, }; +use serde::{Deserialize, Serialize}; -use sc_consensus_babe::{authorship, Epoch}; -use sc_consensus_epochs::{descendent_query, Epoch as EpochT, SharedEpochChanges}; +use sc_consensus_babe::{authorship, BabeWorkerHandle}; +use sc_consensus_epochs::Epoch as EpochT; use sc_rpc_api::DenyUnsafe; -use serde::{Deserialize, Serialize}; use sp_api::ProvideRuntimeApi; use sp_application_crypto::AppCrypto; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; use sp_consensus::{Error as ConsensusError, SelectChain}; -use sp_consensus_babe::{ - digests::PreDigest, AuthorityId, BabeApi as BabeRuntimeApi, BabeConfiguration, -}; +use sp_consensus_babe::{digests::PreDigest, AuthorityId, BabeApi as BabeRuntimeApi}; use sp_core::crypto::ByteArray; use sp_keystore::KeystorePtr; use sp_runtime::traits::{Block as BlockT, Header as _}; -use std::{collections::HashMap, sync::Arc}; + +const BABE_ERROR: i32 = 9000; /// Provides rpc methods for interacting with Babe. #[rpc(client, server)] @@ -54,12 +55,10 @@ pub trait BabeApi { pub struct Babe { /// shared reference to the client. client: Arc, - /// shared reference to EpochChanges - shared_epoch_changes: SharedEpochChanges, + /// A handle to the BABE worker for issuing requests. + babe_worker_handle: BabeWorkerHandle, /// shared reference to the Keystore keystore: KeystorePtr, - /// config (actually holds the slot duration) - babe_config: BabeConfiguration, /// The SelectChain strategy select_chain: SC, /// Whether to deny unsafe calls @@ -70,13 +69,12 @@ impl Babe { /// Creates a new instance of the Babe Rpc handler. pub fn new( client: Arc, - shared_epoch_changes: SharedEpochChanges, + babe_worker_handle: BabeWorkerHandle, keystore: KeystorePtr, - babe_config: BabeConfiguration, select_chain: SC, deny_unsafe: DenyUnsafe, ) -> Self { - Self { client, shared_epoch_changes, keystore, babe_config, select_chain, deny_unsafe } + Self { client, babe_worker_handle, keystore, select_chain, deny_unsafe } } } @@ -93,21 +91,21 @@ where { async fn epoch_authorship(&self) -> RpcResult> { self.deny_unsafe.check_if_safe()?; - let header = self.select_chain.best_chain().map_err(Error::Consensus).await?; + + let best_header = self.select_chain.best_chain().map_err(Error::SelectChain).await?; + let epoch_start = self .client .runtime_api() - .current_epoch_start(header.hash()) - .map_err(|err| Error::StringError(format!("{:?}", err)))?; - - let epoch = epoch_data( - &self.shared_epoch_changes, - &self.client, - &self.babe_config, - *epoch_start, - &self.select_chain, - ) - .await?; + .current_epoch_start(best_header.hash()) + .map_err(|_| Error::FetchEpoch)?; + + let epoch = self + .babe_worker_handle + .epoch_data_for_child_of(best_header.hash(), *best_header.number(), epoch_start) + .await + .map_err(|_| Error::FetchEpoch)?; + let (epoch_start, epoch_end) = (epoch.start_slot(), epoch.end_slot()); let mut claims: HashMap = HashMap::new(); @@ -159,59 +157,37 @@ pub struct EpochAuthorship { secondary_vrf: Vec, } -/// Errors encountered by the RPC +/// Top-level error type for the RPC handler. #[derive(Debug, thiserror::Error)] pub enum Error { - /// Consensus error - #[error(transparent)] - Consensus(#[from] ConsensusError), - /// Errors that can be formatted as a String - #[error("{0}")] - StringError(String), + /// Failed to fetch the current best header. + #[error("Failed to fetch the current best header: {0}")] + SelectChain(ConsensusError), + /// Failed to fetch epoch data. + #[error("Failed to fetch epoch data")] + FetchEpoch, } impl From for JsonRpseeError { fn from(error: Error) -> Self { + let error_code = match error { + Error::SelectChain(_) => 1, + Error::FetchEpoch => 2, + }; + JsonRpseeError::Call(CallError::Custom(ErrorObject::owned( - 1234, + BABE_ERROR + error_code, error.to_string(), - None::<()>, + Some(format!("{:?}", error)), ))) } } -/// Fetches the epoch data for a given slot. -async fn epoch_data( - epoch_changes: &SharedEpochChanges, - client: &Arc, - babe_config: &BabeConfiguration, - slot: u64, - select_chain: &SC, -) -> Result -where - B: BlockT, - C: HeaderBackend + HeaderMetadata + 'static, - SC: SelectChain, -{ - let parent = select_chain.best_chain().await?; - epoch_changes - .shared_data() - .epoch_data_for_child_of( - descendent_query(&**client), - &parent.hash(), - *parent.number(), - slot.into(), - |slot| Epoch::genesis(babe_config, slot), - ) - .map_err(|e| Error::Consensus(ConsensusError::ChainLookup(e.to_string())))? - .ok_or(Error::Consensus(ConsensusError::InvalidAuthoritiesSet)) -} - #[cfg(test)] mod tests { use super::*; - use sc_consensus_babe::block_import; - use sp_core::crypto::key_types::BABE; + use sp_consensus_babe::inherents::InherentDataProvider; + use sp_core::{crypto::key_types::BABE, testing::TaskExecutor}; use sp_keyring::Sr25519Keyring; use sp_keystore::{testing::MemoryKeystore, Keystore}; use substrate_test_runtime_client::{ @@ -233,14 +209,35 @@ mod tests { let builder = TestClientBuilder::new(); let (client, longest_chain) = builder.build_with_longest_chain(); let client = Arc::new(client); + let task_executor = TaskExecutor::new(); + let keystore = create_keystore(Sr25519Keyring::Alice); + let config = sc_consensus_babe::configuration(&*client).expect("config available"); - let (_, link) = block_import(config.clone(), client.clone(), client.clone()) - .expect("can initialize block-import"); + let slot_duration = config.slot_duration(); - let epoch_changes = link.epoch_changes().clone(); - let keystore = create_keystore(Sr25519Keyring::Alice); + let (block_import, link) = + sc_consensus_babe::block_import(config.clone(), client.clone(), client.clone()) + .expect("can initialize block-import"); + + let (_, babe_worker_handle) = sc_consensus_babe::import_queue( + link.clone(), + block_import.clone(), + None, + client.clone(), + longest_chain.clone(), + move |_, _| async move { + Ok((InherentDataProvider::from_timestamp_and_slot_duration( + 0.into(), + slot_duration, + ),)) + }, + &task_executor, + None, + None, + ) + .unwrap(); - Babe::new(client.clone(), epoch_changes, keystore, config, longest_chain, deny_unsafe) + Babe::new(client.clone(), babe_worker_handle, keystore, longest_chain, deny_unsafe) } #[tokio::test] diff --git a/client/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs index e540cae1f7e76..6327c8c657bb6 100644 --- a/client/consensus/babe/src/lib.rs +++ b/client/consensus/babe/src/lib.rs @@ -89,8 +89,8 @@ use prometheus_endpoint::Registry; use schnorrkel::SignatureError; use sc_client_api::{ - backend::AuxStore, AuxDataOperations, Backend as BackendT, BlockchainEvents, - FinalityNotification, PreCommitActions, ProvideUncles, UsageProvider, + backend::AuxStore, AuxDataOperations, Backend as BackendT, FinalityNotification, + PreCommitActions, UsageProvider, }; use sc_consensus::{ block_import::{ @@ -338,6 +338,9 @@ pub enum Error { /// Create inherents error. #[error("Creating inherents failed: {0}")] CreateInherents(sp_inherents::Error), + /// Background worker is not running and therefore requests cannot be answered. + #[error("Background worker is not running")] + BackgroundWorkerTerminated, /// Client error #[error(transparent)] Client(sp_blockchain::Error), @@ -475,9 +478,6 @@ pub fn start_babe( where B: BlockT, C: ProvideRuntimeApi - + ProvideUncles - + BlockchainEvents - + PreCommitActions + HeaderBackend + HeaderMetadata + Send @@ -498,8 +498,6 @@ where BS: BackoffAuthoringBlocksStrategy> + Send + Sync + 'static, Error: std::error::Error + Send + From + From + 'static, { - const HANDLE_BUFFER_SIZE: usize = 1024; - let slot_notification_sinks = Arc::new(Mutex::new(Vec::new())); let worker = BabeSlotWorker { @@ -529,17 +527,7 @@ where create_inherent_data_providers, ); - let (worker_tx, worker_rx) = channel(HANDLE_BUFFER_SIZE); - - let answer_requests = - answer_requests(worker_rx, babe_link.config, client, babe_link.epoch_changes); - - let inner = future::select(Box::pin(slot_worker), Box::pin(answer_requests)); - Ok(BabeWorker { - inner: Box::pin(inner.map(|_| ())), - slot_notification_sinks, - handle: BabeWorkerHandle(worker_tx), - }) + Ok(BabeWorker { inner: Box::pin(slot_worker), slot_notification_sinks }) } // Remove obsolete block's weight data by leveraging finality notifications. @@ -593,42 +581,26 @@ async fn answer_requests( client: Arc, epoch_changes: SharedEpochChanges, ) where - C: ProvideRuntimeApi - + ProvideUncles - + BlockchainEvents - + HeaderBackend - + HeaderMetadata - + Send - + Sync - + 'static, + C: HeaderBackend + HeaderMetadata, { while let Some(request) = request_rx.next().await { match request { - BabeRequest::EpochForChild(parent_hash, parent_number, slot_number, response) => { + BabeRequest::EpochData(response) => { + let _ = response.send(epoch_changes.shared_data().clone()); + }, + BabeRequest::EpochDataForChildOf(parent_hash, parent_number, slot, response) => { let lookup = || { let epoch_changes = epoch_changes.shared_data(); - let epoch_descriptor = epoch_changes - .epoch_descriptor_for_child_of( + epoch_changes + .epoch_data_for_child_of( descendent_query(&*client), &parent_hash, parent_number, - slot_number, + slot, + |slot| Epoch::genesis(&config, slot), ) .map_err(|e| Error::::ForkTree(Box::new(e)))? - .ok_or(Error::::FetchEpoch(parent_hash))?; - - let viable_epoch = epoch_changes - .viable_epoch(&epoch_descriptor, |slot| Epoch::genesis(&config, slot)) - .ok_or(Error::::FetchEpoch(parent_hash))?; - - Ok(sp_consensus_babe::Epoch { - epoch_index: viable_epoch.as_ref().epoch_index, - start_slot: viable_epoch.as_ref().start_slot, - duration: viable_epoch.as_ref().duration, - authorities: viable_epoch.as_ref().authorities.clone(), - randomness: viable_epoch.as_ref().randomness, - config: viable_epoch.as_ref().config.clone(), - }) + .ok_or(Error::::FetchEpoch(parent_hash)) }; let _ = response.send(lookup()); @@ -638,17 +610,13 @@ async fn answer_requests( } /// Requests to the BABE service. -#[non_exhaustive] -pub enum BabeRequest { +enum BabeRequest { + /// Request all available epoch data. + EpochData(oneshot::Sender>), /// Request the epoch that a child of the given block, with the given slot number would have. /// /// The parent block is identified by its hash and number. - EpochForChild( - B::Hash, - NumberFor, - Slot, - oneshot::Sender>>, - ), + EpochDataForChildOf(B::Hash, NumberFor, Slot, oneshot::Sender>>), } /// A handle to the BABE worker for issuing requests. @@ -656,11 +624,41 @@ pub enum BabeRequest { pub struct BabeWorkerHandle(Sender>); impl BabeWorkerHandle { - /// Send a request to the BABE service. - pub async fn send(&mut self, request: BabeRequest) { - // Failure to send means that the service is down. - // This will manifest as the receiver of the request being dropped. - let _ = self.0.send(request).await; + async fn send_request(&self, request: BabeRequest) -> Result<(), Error> { + match self.0.clone().send(request).await { + Err(err) if err.is_disconnected() => return Err(Error::BackgroundWorkerTerminated), + Err(err) => warn!( + target: LOG_TARGET, + "Unhandled error when sending request to worker: {:?}", err + ), + _ => {}, + } + + Ok(()) + } + + /// Fetch all available epoch data. + pub async fn epoch_data(&self) -> Result, Error> { + let (tx, rx) = oneshot::channel(); + self.send_request(BabeRequest::EpochData(tx)).await?; + + rx.await.or(Err(Error::BackgroundWorkerTerminated)) + } + + /// Fetch the epoch that a child of the given block, with the given slot number would have. + /// + /// The parent block is identified by its hash and number. + pub async fn epoch_data_for_child_of( + &self, + parent_hash: B::Hash, + parent_number: NumberFor, + slot: Slot, + ) -> Result> { + let (tx, rx) = oneshot::channel(); + self.send_request(BabeRequest::EpochDataForChildOf(parent_hash, parent_number, slot, tx)) + .await?; + + rx.await.or(Err(Error::BackgroundWorkerTerminated))? } } @@ -669,7 +667,6 @@ impl BabeWorkerHandle { pub struct BabeWorker { inner: Pin + Send + 'static>>, slot_notification_sinks: SlotNotificationSinks, - handle: BabeWorkerHandle, } impl BabeWorker { @@ -684,11 +681,6 @@ impl BabeWorker { self.slot_notification_sinks.lock().push(sink); stream } - - /// Get a handle to the worker. - pub fn handle(&self) -> BabeWorkerHandle { - self.handle.clone() - } } impl Future for BabeWorker { @@ -1790,7 +1782,7 @@ pub fn import_queue( spawner: &impl sp_core::traits::SpawnEssentialNamed, registry: Option<&Registry>, telemetry: Option, -) -> ClientResult> +) -> ClientResult<(DefaultImportQueue, BabeWorkerHandle)> where Inner: BlockImport< Block, @@ -1811,16 +1803,28 @@ where CIDP: CreateInherentDataProviders + Send + Sync + 'static, CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync, { + const HANDLE_BUFFER_SIZE: usize = 1024; + let verifier = BabeVerifier { select_chain, create_inherent_data_providers, - config: babe_link.config, - epoch_changes: babe_link.epoch_changes, + config: babe_link.config.clone(), + epoch_changes: babe_link.epoch_changes.clone(), telemetry, - client, + client: client.clone(), }; - Ok(BasicQueue::new(verifier, Box::new(block_import), justification_import, spawner, registry)) + let (worker_tx, worker_rx) = channel(HANDLE_BUFFER_SIZE); + + let answer_requests = + answer_requests(worker_rx, babe_link.config, client, babe_link.epoch_changes); + + spawner.spawn_essential("babe-worker", Some("babe"), answer_requests.boxed()); + + Ok(( + BasicQueue::new(verifier, Box::new(block_import), justification_import, spawner, registry), + BabeWorkerHandle(worker_tx), + )) } /// Reverts protocol aux data to at most the last finalized block. diff --git a/client/sync-state-rpc/src/lib.rs b/client/sync-state-rpc/src/lib.rs index 78d5cafa31e26..dda8a7edfa9bb 100644 --- a/client/sync-state-rpc/src/lib.rs +++ b/client/sync-state-rpc/src/lib.rs @@ -41,20 +41,21 @@ #![deny(unused_crate_dependencies)] +use std::sync::Arc; + use jsonrpsee::{ - core::{Error as JsonRpseeError, RpcResult}, + core::{async_trait, Error as JsonRpseeError, RpcResult}, proc_macros::rpc, types::{error::CallError, ErrorObject}, }; + use sc_client_api::StorageData; +use sc_consensus_babe::{BabeWorkerHandle, Error as BabeError}; use sp_blockchain::HeaderBackend; use sp_runtime::traits::{Block as BlockT, NumberFor}; -use std::sync::Arc; type SharedAuthoritySet = sc_consensus_grandpa::SharedAuthoritySet<::Hash, NumberFor>; -type SharedEpochChanges = - sc_consensus_epochs::SharedEpochChanges; /// Error type used by this crate. #[derive(Debug, thiserror::Error)] @@ -66,6 +67,9 @@ pub enum Error { #[error("Failed to load the block weight for block {0:?}")] LoadingBlockWeightFailed(Block::Hash), + #[error("Failed to load the BABE epoch data: {0}")] + LoadingEpochDataFailed(BabeError), + #[error("JsonRpc error: {0}")] JsonRpc(String), @@ -125,7 +129,7 @@ pub struct LightSyncState { pub trait SyncStateApi { /// Returns the JSON serialized chainspec running the node, with a sync state. #[method(name = "sync_state_genSyncSpec")] - fn system_gen_sync_spec(&self, raw: bool) -> RpcResult; + async fn system_gen_sync_spec(&self, raw: bool) -> RpcResult; } /// An api for sync state RPC calls. @@ -133,7 +137,7 @@ pub struct SyncState { chain_spec: Box, client: Arc, shared_authority_set: SharedAuthoritySet, - shared_epoch_changes: SharedEpochChanges, + babe_worker_handle: BabeWorkerHandle, } impl SyncState @@ -146,18 +150,24 @@ where chain_spec: Box, client: Arc, shared_authority_set: SharedAuthoritySet, - shared_epoch_changes: SharedEpochChanges, + babe_worker_handle: BabeWorkerHandle, ) -> Result> { if sc_chain_spec::get_extension::(chain_spec.extensions()) .is_some() { - Ok(Self { chain_spec, client, shared_authority_set, shared_epoch_changes }) + Ok(Self { chain_spec, client, shared_authority_set, babe_worker_handle }) } else { Err(Error::::LightSyncStateExtensionNotFound) } } - fn build_sync_state(&self) -> Result, Error> { + async fn build_sync_state(&self) -> Result, Error> { + let epoch_changes = self + .babe_worker_handle + .epoch_data() + .await + .map_err(Error::LoadingEpochDataFailed)?; + let finalized_hash = self.client.info().finalized_hash; let finalized_header = self .client @@ -170,20 +180,21 @@ where Ok(LightSyncState { finalized_block_header: finalized_header, - babe_epoch_changes: self.shared_epoch_changes.shared_data().clone(), + babe_epoch_changes: epoch_changes, babe_finalized_block_weight: finalized_block_weight, grandpa_authority_set: self.shared_authority_set.clone_inner(), }) } } +#[async_trait] impl SyncStateApiServer for SyncState where Block: BlockT, Backend: HeaderBackend + sc_client_api::AuxStore + 'static, { - fn system_gen_sync_spec(&self, raw: bool) -> RpcResult { - let current_sync_state = self.build_sync_state()?; + async fn system_gen_sync_spec(&self, raw: bool) -> RpcResult { + let current_sync_state = self.build_sync_state().await?; let mut chain_spec = self.chain_spec.cloned_box(); let extension = sc_chain_spec::get_extension_mut::( From 88e2c9e3935c3951da3c6e3bdb8fb1ae74dc1258 Mon Sep 17 00:00:00 2001 From: yjh Date: Tue, 18 Apr 2023 23:46:46 +0800 Subject: [PATCH 42/93] chore(docs): improve some comments (#13937) * chore(docs): improve some comments * Update client/network/common/src/sync/message.rs Co-authored-by: Koute * Update client/rpc-api/src/chain/mod.rs Co-authored-by: Koute * Update client/rpc/src/chain/mod.rs Co-authored-by: Koute * Update client/rpc/src/chain/mod.rs Co-authored-by: Koute * Update frame/staking/src/pallet/impls.rs Co-authored-by: Koute --------- Co-authored-by: Koute --- client/network/common/src/sync/message.rs | 2 +- client/network/common/src/sync/warp.rs | 4 ++-- client/rpc-api/src/chain/mod.rs | 2 +- client/rpc/src/chain/mod.rs | 4 ++-- frame/staking/src/pallet/impls.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/network/common/src/sync/message.rs b/client/network/common/src/sync/message.rs index c651660c89c8d..7cdb14172885e 100644 --- a/client/network/common/src/sync/message.rs +++ b/client/network/common/src/sync/message.rs @@ -185,7 +185,7 @@ pub mod generic { pub blocks: Vec>, } - /// Announce a new complete relay chain block on the network. + /// Announce a new complete block on the network. #[derive(Debug, PartialEq, Eq, Clone)] pub struct BlockAnnounce { /// New block header. diff --git a/client/network/common/src/sync/warp.rs b/client/network/common/src/sync/warp.rs index 5f2cacd2eeae5..aef257af4d057 100644 --- a/client/network/common/src/sync/warp.rs +++ b/client/network/common/src/sync/warp.rs @@ -32,7 +32,7 @@ pub struct WarpProofRequest { /// The different types of warp syncing. pub enum WarpSyncParams { - /// Standard warp sync for the relay chain + /// Standard warp sync for the chain. WithProvider(Arc>), /// Skip downloading proofs and wait for a header of the state that should be downloaded. /// @@ -48,7 +48,7 @@ pub enum VerificationResult { Complete(SetId, AuthorityList, Block::Header), } -/// Warp sync backend. Handles retrieveing and verifying warp sync proofs. +/// Warp sync backend. Handles retrieving and verifying warp sync proofs. pub trait WarpSyncProvider: Send + Sync { /// Generate proof starting at given block hash. The proof is accumulated until maximum proof /// size is reached. diff --git a/client/rpc-api/src/chain/mod.rs b/client/rpc-api/src/chain/mod.rs index 2ed767c370a65..f215cd978f03a 100644 --- a/client/rpc-api/src/chain/mod.rs +++ b/client/rpc-api/src/chain/mod.rs @@ -29,7 +29,7 @@ pub trait ChainApi { #[method(name = "chain_getHeader", blocking)] fn header(&self, hash: Option) -> RpcResult>; - /// Get header and body of a relay chain block. + /// Get header and body of a block. #[method(name = "chain_getBlock", blocking)] fn block(&self, hash: Option) -> RpcResult>; diff --git a/client/rpc/src/chain/mod.rs b/client/rpc/src/chain/mod.rs index d54811320e749..2b5994f217df3 100644 --- a/client/rpc/src/chain/mod.rs +++ b/client/rpc/src/chain/mod.rs @@ -59,10 +59,10 @@ where } } - /// Get header of a relay chain block. + /// Get header of a block. fn header(&self, hash: Option) -> Result, Error>; - /// Get header and body of a relay chain block. + /// Get header and body of a block. fn block(&self, hash: Option) -> Result>, Error>; /// Get hash of the n-th block in the canon chain. diff --git a/frame/staking/src/pallet/impls.rs b/frame/staking/src/pallet/impls.rs index 5143538c2a513..3058d3edc6fd6 100644 --- a/frame/staking/src/pallet/impls.rs +++ b/frame/staking/src/pallet/impls.rs @@ -1230,7 +1230,7 @@ impl historical::SessionManager pallet_authorship::EventHandler for Pallet where T: Config + pallet_authorship::Config + pallet_session::Config, From 917f7e38c58cbf98ef2a2ed460bab530b160bc1e Mon Sep 17 00:00:00 2001 From: William Freudenberger Date: Wed, 19 Apr 2023 09:49:42 +0200 Subject: [PATCH 43/93] feat: pallet asset-rate (#13608) * poc * fix: remove AssetIdParameter * tests: add * docs: add pallet description * feat: add benches * refactor: UnknownAssetId * fix: normalize mock cfg * fix: benchmarks * chore: add weights * refactor: remove storage getter * chore: apply suggestions from code review * docs: add native balance to calls * chore: apply suggestions from code review * chore: apply ConversionFromAssetBalance * tests: update balance mock * chore: apply suggestions from code review * ci: set publish to false * docs: fix missing rustdoc --------- Co-authored-by: parity-processbot <> --- Cargo.lock | 17 ++ Cargo.toml | 1 + bin/node/runtime/Cargo.toml | 4 + bin/node/runtime/src/lib.rs | 13 ++ frame/asset-rate/Cargo.toml | 52 ++++++ frame/asset-rate/src/benchmarking.rs | 86 ++++++++++ frame/asset-rate/src/lib.rs | 239 +++++++++++++++++++++++++++ frame/asset-rate/src/mock.rs | 100 +++++++++++ frame/asset-rate/src/tests.rs | 121 ++++++++++++++ frame/asset-rate/src/weights.rs | 129 +++++++++++++++ 10 files changed, 762 insertions(+) create mode 100644 frame/asset-rate/Cargo.toml create mode 100644 frame/asset-rate/src/benchmarking.rs create mode 100644 frame/asset-rate/src/lib.rs create mode 100644 frame/asset-rate/src/mock.rs create mode 100644 frame/asset-rate/src/tests.rs create mode 100644 frame/asset-rate/src/weights.rs diff --git a/Cargo.lock b/Cargo.lock index b7d3bd5ee41e6..c0920e4dc6659 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3634,6 +3634,7 @@ dependencies = [ "log", "node-primitives", "pallet-alliance", + "pallet-asset-rate", "pallet-asset-tx-payment", "pallet-assets", "pallet-authority-discovery", @@ -5556,6 +5557,22 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-asset-rate" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" diff --git a/Cargo.toml b/Cargo.toml index cae8976cca4a9..ae89750dd8f26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -166,6 +166,7 @@ members = [ "frame/transaction-payment/rpc/runtime-api", "frame/transaction-storage", "frame/treasury", + "frame/asset-rate", "frame/tips", "frame/uniques", "frame/utility", diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 65a8d208d7f4c..0fa037c657cee 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -53,6 +53,7 @@ frame-election-provider-support = { version = "4.0.0-dev", default-features = fa frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, path = "../../../frame/system/rpc/runtime-api/" } frame-try-runtime = { version = "0.10.0-dev", default-features = false, path = "../../../frame/try-runtime", optional = true } pallet-alliance = { version = "4.0.0-dev", default-features = false, path = "../../../frame/alliance" } +pallet-asset-rate = { version = "4.0.0-dev", default-features = false, path = "../../../frame/asset-rate" } pallet-assets = { version = "4.0.0-dev", default-features = false, path = "../../../frame/assets" } pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, path = "../../../frame/authority-discovery" } pallet-authorship = { version = "4.0.0-dev", default-features = false, path = "../../../frame/authorship" } @@ -201,6 +202,7 @@ std = [ "pallet-transaction-payment/std", "pallet-transaction-storage/std", "pallet-treasury/std", + "pallet-asset-rate/std", "sp-transaction-pool/std", "pallet-utility/std", "sp-version/std", @@ -272,6 +274,7 @@ runtime-benchmarks = [ "pallet-tips/runtime-benchmarks", "pallet-transaction-storage/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", + "pallet-asset-rate/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-uniques/runtime-benchmarks", "pallet-nfts/runtime-benchmarks", @@ -333,6 +336,7 @@ try-runtime = [ "pallet-timestamp/try-runtime", "pallet-tips/try-runtime", "pallet-treasury/try-runtime", + "pallet-asset-rate/try-runtime", "pallet-utility/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-asset-tx-payment/try-runtime", diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 433ca8e8b839e..cdb05d1597629 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1131,6 +1131,17 @@ impl pallet_treasury::Config for Runtime { type SpendOrigin = EnsureWithSuccess, AccountId, MaxBalance>; } +impl pallet_asset_rate::Config for Runtime { + type CreateOrigin = EnsureRoot; + type RemoveOrigin = EnsureRoot; + type UpdateOrigin = EnsureRoot; + type Balance = Balance; + type Currency = Balances; + type AssetId = u32; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_asset_rate::weights::SubstrateWeight; +} + parameter_types! { pub const BountyCuratorDeposit: Permill = Permill::from_percent(50); pub const BountyValueMinimum: Balance = 5 * DOLLARS; @@ -1765,6 +1776,7 @@ construct_runtime!( TechnicalMembership: pallet_membership::, Grandpa: pallet_grandpa, Treasury: pallet_treasury, + AssetRate: pallet_asset_rate, Contracts: pallet_contracts, Sudo: pallet_sudo, ImOnline: pallet_im_online, @@ -1922,6 +1934,7 @@ mod benches { [pallet_tips, Tips] [pallet_transaction_storage, TransactionStorage] [pallet_treasury, Treasury] + [pallet_asset_rate, AssetRate] [pallet_uniques, Uniques] [pallet_nfts, Nfts] [pallet_utility, Utility] diff --git a/frame/asset-rate/Cargo.toml b/frame/asset-rate/Cargo.toml new file mode 100644 index 0000000000000..36aabb12bcbbd --- /dev/null +++ b/frame/asset-rate/Cargo.toml @@ -0,0 +1,52 @@ +[package] +name = "pallet-asset-rate" +version = "4.0.0-dev" +description = "Whitelist non-native assets for treasury spending and provide conversion to native balance" +authors = ["William Freudenberger "] +homepage = "https://substrate.io" +edition = "2021" +license = "Apache-2.0" +repository = "https://github.com/paritytech/substrate/" +publish = false + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [ + "derive", +] } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } +frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } +frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } +sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" } +sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" } + +[dev-dependencies] +pallet-balances = { version = "4.0.0-dev", path = "../balances" } +sp-core = { version = "7.0.0", path = "../../primitives/core" } +sp-io = { version = "7.0.0", path = "../../primitives/io" } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "scale-info/std", + "sp-runtime/std", + "sp-std/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime", +] diff --git a/frame/asset-rate/src/benchmarking.rs b/frame/asset-rate/src/benchmarking.rs new file mode 100644 index 0000000000000..dde0d764affb2 --- /dev/null +++ b/frame/asset-rate/src/benchmarking.rs @@ -0,0 +1,86 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The crate's benchmarks. + +use super::*; +use crate::{pallet as pallet_asset_rate, Pallet as AssetRate}; + +use frame_benchmarking::v2::*; +use frame_support::assert_ok; +use frame_system::RawOrigin; + +const ASSET_ID: u32 = 1; + +fn default_conversion_rate() -> FixedU128 { + FixedU128::from_u32(1u32) +} + +#[benchmarks(where ::AssetId: From)] +mod benchmarks { + use super::*; + + #[benchmark] + fn create() -> Result<(), BenchmarkError> { + let asset_id: T::AssetId = ASSET_ID.into(); + #[extrinsic_call] + _(RawOrigin::Root, asset_id, default_conversion_rate()); + + assert_eq!( + pallet_asset_rate::ConversionRateToNative::::get(asset_id), + Some(default_conversion_rate()) + ); + Ok(()) + } + + #[benchmark] + fn update() -> Result<(), BenchmarkError> { + let asset_id: T::AssetId = ASSET_ID.into(); + assert_ok!(AssetRate::::create( + RawOrigin::Root.into(), + asset_id, + default_conversion_rate() + )); + + #[extrinsic_call] + _(RawOrigin::Root, asset_id, FixedU128::from_u32(2)); + + assert_eq!( + pallet_asset_rate::ConversionRateToNative::::get(asset_id), + Some(FixedU128::from_u32(2)) + ); + Ok(()) + } + + #[benchmark] + fn remove() -> Result<(), BenchmarkError> { + let asset_id: T::AssetId = ASSET_ID.into(); + assert_ok!(AssetRate::::create( + RawOrigin::Root.into(), + ASSET_ID.into(), + default_conversion_rate() + )); + + #[extrinsic_call] + _(RawOrigin::Root, asset_id); + + assert!(pallet_asset_rate::ConversionRateToNative::::get(asset_id).is_none()); + Ok(()) + } + + impl_benchmark_test_suite! { AssetRate, crate::mock::new_test_ext(), crate::mock::Test } +} diff --git a/frame/asset-rate/src/lib.rs b/frame/asset-rate/src/lib.rs new file mode 100644 index 0000000000000..8c6597a389833 --- /dev/null +++ b/frame/asset-rate/src/lib.rs @@ -0,0 +1,239 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Asset Rate Pallet +//! +//! - [`Config`] +//! - [`Call`] +//! +//! ## Overview +//! +//! The AssetRate pallet provides means of setting conversion rates for some asset to native +//! balance. +//! +//! The supported dispatchable functions are documented in the [`Call`] enum. +//! +//! ### Terminology +//! +//! * **Asset balance**: The balance type of an arbitrary asset. The network might only know about +//! the identifier of the asset and nothing more. +//! * **Native balance**: The balance type of the network's native currency. +//! +//! ### Goals +//! +//! The asset-rate system in Substrate is designed to make the following possible: +//! +//! * Providing a soft conversion for the balance of supported assets to a default asset class. +//! * Updating existing conversion rates. +//! +//! ## Interface +//! +//! ### Permissioned Functions +//! +//! * `create`: Creates a new asset conversion rate. +//! * `remove`: Removes an existing asset conversion rate. +//! * `update`: Overwrites an existing assert conversion rate. +//! +//! Please refer to the [`Call`] enum and its associated variants for documentation on each +//! function. +//! +//! ### Assumptions +//! +//! * Conversion rates are only used as estimates, and are not designed to be precise or closely +//! tracking real world values. +//! * All conversion rates reflect the ration of some asset to native, e.g. native = asset * rate. + +#![cfg_attr(not(feature = "std"), no_std)] + +use frame_support::traits::{ + fungible::Inspect, + tokens::{Balance, ConversionFromAssetBalance}, +}; +use sp_runtime::{traits::Zero, FixedPointNumber, FixedPointOperand, FixedU128}; + +pub use pallet::*; +pub use weights::WeightInfo; + +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; +pub mod weights; + +// Type alias for `frame_system`'s account id. +type AccountIdOf = ::AccountId; +// This pallet's asset id and balance type. +type AssetIdOf = ::AssetId; +// Generic fungible balance type. +type BalanceOf = <::Currency as Inspect>>::Balance; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config { + /// The Weight information for extrinsics in this pallet. + type WeightInfo: WeightInfo; + + /// The runtime event type. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// The origin permissioned to create a conversion rate for an asset. + type CreateOrigin: EnsureOrigin; + + /// The origin permissioned to remove an existing conversion rate for an asset. + type RemoveOrigin: EnsureOrigin; + + /// The origin permissioned to update an existiing conversion rate for an asset. + type UpdateOrigin: EnsureOrigin; + + /// The units in which we record balances. + type Balance: Balance + FixedPointOperand; + + /// The currency mechanism for this pallet. + type Currency: Inspect; + + /// The identifier for the class of asset. + type AssetId: frame_support::traits::tokens::AssetId; + } + + /// Maps an asset to its fixed point representation in the native balance. + /// + /// E.g. `native_amount = asset_amount * ConversionRateToNative::::get(asset_id)` + #[pallet::storage] + pub type ConversionRateToNative = + StorageMap<_, Blake2_128Concat, T::AssetId, FixedU128, OptionQuery>; + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + // Some `asset_id` conversion rate was created. + AssetRateCreated { asset_id: T::AssetId, rate: FixedU128 }, + // Some `asset_id` conversion rate was removed. + AssetRateRemoved { asset_id: T::AssetId }, + // Some existing `asset_id` conversion rate was updated from `old` to `new`. + AssetRateUpdated { asset_id: T::AssetId, old: FixedU128, new: FixedU128 }, + } + + #[pallet::error] + pub enum Error { + /// The given asset ID is unknown. + UnknownAssetId, + /// The given asset ID already has an assigned conversion rate and cannot be re-created. + AlreadyExists, + } + + #[pallet::call] + impl Pallet { + /// Initialize a conversion rate to native balance for the given asset. + /// + /// ## Complexity + /// - O(1) + #[pallet::call_index(0)] + #[pallet::weight(T::WeightInfo::create())] + pub fn create( + origin: OriginFor, + asset_id: T::AssetId, + rate: FixedU128, + ) -> DispatchResult { + T::CreateOrigin::ensure_origin(origin)?; + + ensure!( + !ConversionRateToNative::::contains_key(asset_id), + Error::::AlreadyExists + ); + ConversionRateToNative::::set(asset_id, Some(rate)); + + Self::deposit_event(Event::AssetRateCreated { asset_id, rate }); + Ok(()) + } + + /// Update the conversion rate to native balance for the given asset. + /// + /// ## Complexity + /// - O(1) + #[pallet::call_index(1)] + #[pallet::weight(T::WeightInfo::update())] + pub fn update( + origin: OriginFor, + asset_id: T::AssetId, + rate: FixedU128, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin(origin)?; + + let mut old = FixedU128::zero(); + ConversionRateToNative::::mutate(asset_id, |maybe_rate| { + if let Some(r) = maybe_rate { + old = *r; + *r = rate; + + Ok(()) + } else { + Err(Error::::UnknownAssetId) + } + })?; + + Self::deposit_event(Event::AssetRateUpdated { asset_id, old, new: rate }); + Ok(()) + } + + /// Remove an existing conversion rate to native balance for the given asset. + /// + /// ## Complexity + /// - O(1) + #[pallet::call_index(2)] + #[pallet::weight(T::WeightInfo::remove())] + pub fn remove(origin: OriginFor, asset_id: T::AssetId) -> DispatchResult { + T::RemoveOrigin::ensure_origin(origin)?; + + ensure!( + ConversionRateToNative::::contains_key(asset_id), + Error::::UnknownAssetId + ); + ConversionRateToNative::::remove(asset_id); + + Self::deposit_event(Event::AssetRateRemoved { asset_id }); + Ok(()) + } + } +} + +/// Exposes conversion of an arbitrary balance of an asset to native balance. +impl ConversionFromAssetBalance, AssetIdOf, BalanceOf> for Pallet +where + T: Config, + BalanceOf: FixedPointOperand + Zero, +{ + type Error = pallet::Error; + + fn from_asset_balance( + balance: BalanceOf, + asset_id: AssetIdOf, + ) -> Result, pallet::Error> { + let rate = pallet::ConversionRateToNative::::get(asset_id) + .ok_or(pallet::Error::::UnknownAssetId.into())?; + Ok(rate.saturating_mul_int(balance)) + } +} diff --git a/frame/asset-rate/src/mock.rs b/frame/asset-rate/src/mock.rs new file mode 100644 index 0000000000000..9775b7a747926 --- /dev/null +++ b/frame/asset-rate/src/mock.rs @@ -0,0 +1,100 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The crate's mock. + +use crate as pallet_asset_rate; +use frame_support::traits::{ConstU16, ConstU64}; +use sp_core::H256; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, +}; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system, + AssetRate: pallet_asset_rate, + Balances: pallet_balances, + } +); + +impl frame_system::Config for Test { + type BaseCallFilter = frame_support::traits::Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = ConstU64<250>; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = ConstU16<42>; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +impl pallet_balances::Config for Test { + type Balance = u64; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ConstU64<1>; + type AccountStore = System; + type WeightInfo = (); + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type HoldIdentifier = (); + type FreezeIdentifier = (); + type MaxHolds = (); + type MaxFreezes = (); +} + +impl pallet_asset_rate::Config for Test { + type WeightInfo = (); + type RuntimeEvent = RuntimeEvent; + type CreateOrigin = frame_system::EnsureRoot; + type RemoveOrigin = frame_system::EnsureRoot; + type UpdateOrigin = frame_system::EnsureRoot; + type Balance = u64; + type Currency = Balances; + type AssetId = u32; +} + +// Build genesis storage according to the mock runtime. +pub fn new_test_ext() -> sp_io::TestExternalities { + frame_system::GenesisConfig::default().build_storage::().unwrap().into() +} diff --git a/frame/asset-rate/src/tests.rs b/frame/asset-rate/src/tests.rs new file mode 100644 index 0000000000000..4e5a3167bef21 --- /dev/null +++ b/frame/asset-rate/src/tests.rs @@ -0,0 +1,121 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The crate's tests. + +use super::*; +use crate::pallet as pallet_asset_rate; +use frame_support::{assert_noop, assert_ok}; +use mock::{new_test_ext, AssetRate, RuntimeOrigin, Test}; +use sp_runtime::FixedU128; + +const ASSET_ID: u32 = 42; + +#[test] +fn create_works() { + new_test_ext().execute_with(|| { + assert!(pallet_asset_rate::ConversionRateToNative::::get(ASSET_ID).is_none()); + assert_ok!(AssetRate::create(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(0.1))); + + assert_eq!( + pallet_asset_rate::ConversionRateToNative::::get(ASSET_ID), + Some(FixedU128::from_float(0.1)) + ); + }); +} + +#[test] +fn create_existing_throws() { + new_test_ext().execute_with(|| { + assert!(pallet_asset_rate::ConversionRateToNative::::get(ASSET_ID).is_none()); + assert_ok!(AssetRate::create(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(0.1))); + + assert_noop!( + AssetRate::create(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(0.1)), + Error::::AlreadyExists + ); + }); +} + +#[test] +fn remove_works() { + new_test_ext().execute_with(|| { + assert_ok!(AssetRate::create(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(0.1))); + + assert_ok!(AssetRate::remove(RuntimeOrigin::root(), ASSET_ID,)); + assert!(pallet_asset_rate::ConversionRateToNative::::get(ASSET_ID).is_none()); + }); +} + +#[test] +fn remove_unknown_throws() { + new_test_ext().execute_with(|| { + assert_noop!( + AssetRate::remove(RuntimeOrigin::root(), ASSET_ID,), + Error::::UnknownAssetId + ); + }); +} + +#[test] +fn update_works() { + new_test_ext().execute_with(|| { + assert_ok!(AssetRate::create(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(0.1))); + assert_ok!(AssetRate::update(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(0.5))); + + assert_eq!( + pallet_asset_rate::ConversionRateToNative::::get(ASSET_ID), + Some(FixedU128::from_float(0.5)) + ); + }); +} + +#[test] +fn update_unknown_throws() { + new_test_ext().execute_with(|| { + assert_noop!( + AssetRate::update(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(0.5)), + Error::::UnknownAssetId + ); + }); +} + +#[test] +fn convert_works() { + new_test_ext().execute_with(|| { + assert_ok!(AssetRate::create(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(2.51))); + + let conversion = , + ::AssetId, + BalanceOf, + >>::from_asset_balance(10, ASSET_ID); + assert_eq!(conversion.expect("Conversion rate exists for asset"), 25); + }); +} + +#[test] +fn convert_unknown_throws() { + new_test_ext().execute_with(|| { + let conversion = , + ::AssetId, + BalanceOf, + >>::from_asset_balance(10, ASSET_ID); + assert!(conversion.is_err()); + }); +} diff --git a/frame/asset-rate/src/weights.rs b/frame/asset-rate/src/weights.rs new file mode 100644 index 0000000000000..4fae62634ef13 --- /dev/null +++ b/frame/asset-rate/src/weights.rs @@ -0,0 +1,129 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_asset_rate +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `local`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/substrate +// benchmark +// pallet +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_asset_rate +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/asset-rate/src/weights.rs +// --header=./HEADER-APACHE2 +// --template=./.maintain/frame-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_asset_rate. +pub trait WeightInfo { + fn create() -> Weight; + fn update() -> Weight; + fn remove() -> Weight; +} + +/// Weights for pallet_asset_rate using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: AssetRate ConversionRateToNative (r:1 w:1) + /// Proof: AssetRate ConversionRateToNative (max_values: None, max_size: Some(36), added: 2511, mode: MaxEncodedLen) + fn create() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3501` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 3501) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: AssetRate ConversionRateToNative (r:1 w:1) + /// Proof: AssetRate ConversionRateToNative (max_values: None, max_size: Some(36), added: 2511, mode: MaxEncodedLen) + fn update() -> Weight { + // Proof Size summary in bytes: + // Measured: `137` + // Estimated: `3501` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 3501) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: AssetRate ConversionRateToNative (r:1 w:1) + /// Proof: AssetRate ConversionRateToNative (max_values: None, max_size: Some(36), added: 2511, mode: MaxEncodedLen) + fn remove() -> Weight { + // Proof Size summary in bytes: + // Measured: `137` + // Estimated: `3501` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 3501) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + /// Storage: AssetRate ConversionRateToNative (r:1 w:1) + /// Proof: AssetRate ConversionRateToNative (max_values: None, max_size: Some(36), added: 2511, mode: MaxEncodedLen) + fn create() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3501` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 3501) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: AssetRate ConversionRateToNative (r:1 w:1) + /// Proof: AssetRate ConversionRateToNative (max_values: None, max_size: Some(36), added: 2511, mode: MaxEncodedLen) + fn update() -> Weight { + // Proof Size summary in bytes: + // Measured: `137` + // Estimated: `3501` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 3501) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: AssetRate ConversionRateToNative (r:1 w:1) + /// Proof: AssetRate ConversionRateToNative (max_values: None, max_size: Some(36), added: 2511, mode: MaxEncodedLen) + fn remove() -> Weight { + // Proof Size summary in bytes: + // Measured: `137` + // Estimated: `3501` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 3501) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } +} From 1fbf283120446b229ba2cc0da9e175f184949891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 19 Apr 2023 10:15:57 +0200 Subject: [PATCH 44/93] call_executor: Remove code deduplication (#13948) --- client/service/src/client/call_executor.rs | 34 +++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/client/service/src/client/call_executor.rs b/client/service/src/client/call_executor.rs index 7979c139e2a6c..7f83d62874c8e 100644 --- a/client/service/src/client/call_executor.rs +++ b/client/service/src/client/call_executor.rs @@ -81,13 +81,14 @@ where fn check_override<'a>( &'a self, onchain_code: RuntimeCode<'a>, - hash: ::Hash, + state: &B::State, + hash: Block::Hash, ) -> sp_blockchain::Result<(RuntimeCode<'a>, RuntimeVersion)> where Block: BlockT, B: backend::Backend, { - let on_chain_version = self.on_chain_runtime_version(hash)?; + let on_chain_version = self.on_chain_runtime_version(&onchain_code, state)?; let code_and_version = if let Some(d) = self.wasm_override.as_ref().as_ref().and_then(|o| { o.get( &on_chain_version.spec_version, @@ -115,17 +116,18 @@ where } /// Returns the on chain runtime version. - fn on_chain_runtime_version(&self, hash: Block::Hash) -> sp_blockchain::Result { + fn on_chain_runtime_version( + &self, + code: &RuntimeCode, + state: &B::State, + ) -> sp_blockchain::Result { let mut overlay = OverlayedChanges::default(); - let state = self.backend.state_at(hash)?; let mut cache = StorageTransactionCache::::default(); - let mut ext = Ext::new(&mut overlay, &mut cache, &state, None); - let state_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(&state); - let runtime_code = - state_runtime_code.runtime_code().map_err(sp_blockchain::Error::RuntimeCode)?; + let mut ext = Ext::new(&mut overlay, &mut cache, state, None); + self.executor - .runtime_version(&mut ext, &runtime_code) + .runtime_version(&mut ext, code) .map_err(|e| sp_blockchain::Error::VersionInvalid(e.to_string())) } } @@ -176,7 +178,7 @@ where let runtime_code = state_runtime_code.runtime_code().map_err(sp_blockchain::Error::RuntimeCode)?; - let runtime_code = self.check_override(runtime_code, at_hash)?.0; + let runtime_code = self.check_override(runtime_code, &state, at_hash)?.0; let extensions = self.execution_extensions.extensions( at_hash, @@ -233,7 +235,7 @@ where let runtime_code = state_runtime_code.runtime_code().map_err(sp_blockchain::Error::RuntimeCode)?; - let runtime_code = self.check_override(runtime_code, at_hash)?.0; + let runtime_code = self.check_override(runtime_code, &state, at_hash)?.0; match recorder { Some(recorder) => { @@ -282,7 +284,7 @@ where let runtime_code = state_runtime_code.runtime_code().map_err(sp_blockchain::Error::RuntimeCode)?; - self.check_override(runtime_code, at_hash).map(|(_, v)| v) + self.check_override(runtime_code, &state, at_hash).map(|(_, v)| v) } fn prove_execution( @@ -300,7 +302,7 @@ where let state_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(trie_backend); let runtime_code = state_runtime_code.runtime_code().map_err(sp_blockchain::Error::RuntimeCode)?; - let runtime_code = self.check_override(runtime_code, at_hash)?.0; + let runtime_code = self.check_override(runtime_code, &state, at_hash)?.0; sp_state_machine::prove_execution_on_trie_backend( trie_backend, @@ -436,7 +438,11 @@ mod tests { }; let check = call_executor - .check_override(onchain_code, backend.blockchain().info().genesis_hash) + .check_override( + onchain_code, + &backend.state_at(backend.blockchain().info().genesis_hash).unwrap(), + backend.blockchain().info().genesis_hash, + ) .expect("RuntimeCode override") .0; From d4802eb1ac31e574a7bcfa5afe63b8ae92e34d81 Mon Sep 17 00:00:00 2001 From: Mike Ruje Date: Wed, 19 Apr 2023 11:03:56 +0200 Subject: [PATCH 45/93] Improve has good jugement (#13952) * improve run_benchmark * Revert "improve run_benchmark" This reverts commit 4d9cf7a63e37fedca376d692f1461486d3dca659. * improve has_good_judgement * Update bin/node/runtime/src/impls.rs * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: Oliver Tale-Yazdi Co-authored-by: command-bot <> --- bin/node/runtime/src/impls.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/node/runtime/src/impls.rs b/bin/node/runtime/src/impls.rs index 033549549a73f..05531f47c6e05 100644 --- a/bin/node/runtime/src/impls.rs +++ b/bin/node/runtime/src/impls.rs @@ -61,15 +61,13 @@ impl IdentityVerifier for AllianceIdentityVerifier { fn has_good_judgement(who: &AccountId) -> bool { use pallet_identity::Judgement; - if let Some(judgements) = - crate::Identity::identity(who).map(|registration| registration.judgements) - { - judgements - .iter() - .any(|(_, j)| matches!(j, Judgement::KnownGood | Judgement::Reasonable)) - } else { - false - } + crate::Identity::identity(who) + .map(|registration| registration.judgements) + .map_or(false, |judgements| { + judgements + .iter() + .any(|(_, j)| matches!(j, Judgement::KnownGood | Judgement::Reasonable)) + }) } fn super_account_id(who: &AccountId) -> Option { From 37f3d588423cbd295f69a24cae31f2a93936cc93 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Wed, 19 Apr 2023 11:11:47 +0200 Subject: [PATCH 46/93] VRF refactory (#13889) * First iteration to encapsulate schnorrkel and merlin usage * Remove schnorkel direct dependency from BABE pallet * Remove schnorrkel direct dependency from BABE client * Trivial renaming for VrfTranscript data and value * Better errors * Expose a function to get a schnorrkel friendly transcript * Keep the vrf signature stuff together (preventing some clones around) * Fix tests * Remove vrf agnostic transcript and define it as an associated type for VrfSigner and VrfVerifier * Fix babe pallet mock * Inner types are required to be public for polkadot * Update client/consensus/babe/src/verification.rs Co-authored-by: Koute * Nit * Remove Deref implementations * make_bytes as a method * Trigger CI --------- Co-authored-by: Koute --- Cargo.lock | 20 -- Cargo.toml | 1 - client/consensus/babe/Cargo.toml | 3 - client/consensus/babe/src/authorship.rs | 65 +++--- client/consensus/babe/src/lib.rs | 21 +- client/consensus/babe/src/migration.rs | 4 +- client/consensus/babe/src/tests.rs | 67 ++---- client/consensus/babe/src/verification.rs | 84 ++++---- client/keystore/src/local.rs | 32 +-- frame/babe/Cargo.toml | 4 +- frame/babe/src/lib.rs | 66 +++--- frame/babe/src/mock.rs | 41 ++-- frame/babe/src/randomness.rs | 8 +- frame/babe/src/tests.rs | 22 +- primitives/consensus/babe/Cargo.toml | 4 - primitives/consensus/babe/src/digests.rs | 28 ++- primitives/consensus/babe/src/lib.rs | 48 ++--- primitives/consensus/vrf/Cargo.toml | 32 --- primitives/consensus/vrf/README.md | 3 - primitives/consensus/vrf/src/lib.rs | 21 -- primitives/consensus/vrf/src/schnorrkel.rs | 188 ----------------- primitives/core/Cargo.toml | 8 +- primitives/core/src/crypto.rs | 26 ++- primitives/core/src/sr25519.rs | 231 ++++++++++++++++++--- primitives/keystore/Cargo.toml | 4 - primitives/keystore/src/lib.rs | 7 +- primitives/keystore/src/testing.rs | 48 +++-- primitives/keystore/src/vrf.rs | 94 --------- 28 files changed, 468 insertions(+), 712 deletions(-) delete mode 100644 primitives/consensus/vrf/Cargo.toml delete mode 100644 primitives/consensus/vrf/README.md delete mode 100644 primitives/consensus/vrf/src/lib.rs delete mode 100644 primitives/consensus/vrf/src/schnorrkel.rs delete mode 100644 primitives/keystore/src/vrf.rs diff --git a/Cargo.lock b/Cargo.lock index c0920e4dc6659..26fb7c4ae1950 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5695,7 +5695,6 @@ dependencies = [ "scale-info", "sp-application-crypto", "sp-consensus-babe", - "sp-consensus-vrf", "sp-core", "sp-io", "sp-runtime", @@ -8594,7 +8593,6 @@ dependencies = [ "fork-tree", "futures", "log", - "merlin", "num-bigint", "num-rational", "num-traits", @@ -8611,7 +8609,6 @@ dependencies = [ "sc-network-test", "sc-telemetry", "scale-info", - "schnorrkel", "sp-api", "sp-application-crypto", "sp-block-builder", @@ -8619,7 +8616,6 @@ dependencies = [ "sp-consensus", "sp-consensus-babe", "sp-consensus-slots", - "sp-consensus-vrf", "sp-core", "sp-inherents", "sp-keyring", @@ -10361,7 +10357,6 @@ name = "sp-consensus-babe" version = "0.10.0-dev" dependencies = [ "async-trait", - "merlin", "parity-scale-codec", "scale-info", "serde", @@ -10369,7 +10364,6 @@ dependencies = [ "sp-application-crypto", "sp-consensus", "sp-consensus-slots", - "sp-consensus-vrf", "sp-core", "sp-inherents", "sp-keystore", @@ -10437,18 +10431,6 @@ dependencies = [ "sp-timestamp", ] -[[package]] -name = "sp-consensus-vrf" -version = "0.10.0-dev" -dependencies = [ - "parity-scale-codec", - "scale-info", - "schnorrkel", - "sp-core", - "sp-runtime", - "sp-std", -] - [[package]] name = "sp-core" version = "7.0.0" @@ -10600,12 +10582,10 @@ name = "sp-keystore" version = "0.13.0" dependencies = [ "futures", - "merlin", "parity-scale-codec", "parking_lot 0.12.1", "rand 0.7.3", "rand_chacha 0.2.2", - "schnorrkel", "serde", "sp-core", "sp-externalities", diff --git a/Cargo.toml b/Cargo.toml index ae89750dd8f26..507d7621000b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -190,7 +190,6 @@ members = [ "primitives/consensus/grandpa", "primitives/consensus/pow", "primitives/consensus/slots", - "primitives/consensus/vrf", "primitives/core", "primitives/core/hashing", "primitives/core/hashing/proc-macro", diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index d10ef21c4dad4..2382d064d0219 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -19,12 +19,10 @@ scale-info = { version = "2.5.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2.2", features = ["derive"] } futures = "0.3.21" log = "0.4.17" -merlin = "2.0" num-bigint = "0.4.3" num-rational = "0.4.1" num-traits = "0.2.8" parking_lot = "0.12.1" -schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated"] } thiserror = "1.0" fork-tree = { version = "3.0.0", path = "../../../utils/fork-tree" } prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev", path = "../../../utils/prometheus" } @@ -41,7 +39,6 @@ sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" } sp-consensus-babe = { version = "0.10.0-dev", path = "../../../primitives/consensus/babe" } sp-consensus-slots = { version = "0.10.0-dev", path = "../../../primitives/consensus/slots" } -sp-consensus-vrf = { version = "0.10.0-dev", path = "../../../primitives/consensus/vrf" } sp-core = { version = "7.0.0", path = "../../../primitives/core" } sp-inherents = { version = "4.0.0-dev", path = "../../../primitives/inherents" } sp-keystore = { version = "0.13.0", path = "../../../primitives/keystore" } diff --git a/client/consensus/babe/src/authorship.rs b/client/consensus/babe/src/authorship.rs index 3ff4c393ffd67..dc7cd10867745 100644 --- a/client/consensus/babe/src/authorship.rs +++ b/client/consensus/babe/src/authorship.rs @@ -18,17 +18,19 @@ //! BABE authority selection and slot claiming. -use super::Epoch; +use super::{Epoch, AUTHORING_SCORE_LENGTH, AUTHORING_SCORE_VRF_CONTEXT}; use codec::Encode; use sc_consensus_epochs::Epoch as EpochT; -use schnorrkel::{keys::PublicKey, vrf::VRFInOut}; use sp_application_crypto::AppCrypto; use sp_consensus_babe::{ digests::{PreDigest, PrimaryPreDigest, SecondaryPlainPreDigest, SecondaryVRFPreDigest}, - make_transcript, make_transcript_data, AuthorityId, BabeAuthorityWeight, Slot, BABE_VRF_PREFIX, + make_transcript, AuthorityId, BabeAuthorityWeight, Randomness, Slot, +}; +use sp_core::{ + blake2_256, + crypto::{ByteArray, Wraps}, + U256, }; -use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof}; -use sp_core::{blake2_256, crypto::ByteArray, U256}; use sp_keystore::KeystorePtr; /// Calculates the primary selection threshold for a given authority, taking @@ -95,19 +97,13 @@ pub(super) fn calculate_primary_threshold( ) } -/// Returns true if the given VRF output is lower than the given threshold, -/// false otherwise. -pub(super) fn check_primary_threshold(inout: &VRFInOut, threshold: u128) -> bool { - u128::from_le_bytes(inout.make_bytes::<[u8; 16]>(BABE_VRF_PREFIX)) < threshold -} - /// Get the expected secondary author for the given slot and with given /// authorities. This should always assign the slot to some authority unless the /// authorities list is empty. pub(super) fn secondary_slot_author( slot: Slot, authorities: &[(AuthorityId, BabeAuthorityWeight)], - randomness: [u8; 32], + randomness: Randomness, ) -> Option<&AuthorityId> { if authorities.is_empty() { return None @@ -152,18 +148,14 @@ fn claim_secondary_slot( for (authority_id, authority_index) in keys { if authority_id == expected_author { let pre_digest = if author_secondary_vrf { - let transcript_data = make_transcript_data(randomness, slot, epoch_index); - let result = keystore.sr25519_vrf_sign( - AuthorityId::ID, - authority_id.as_ref(), - transcript_data, - ); - if let Ok(Some(signature)) = result { + let transcript = make_transcript(randomness, slot, epoch_index); + let result = + keystore.sr25519_vrf_sign(AuthorityId::ID, authority_id.as_ref(), &transcript); + if let Ok(Some(vrf_signature)) = result { Some(PreDigest::SecondaryVRF(SecondaryVRFPreDigest { slot, - vrf_output: VRFOutput(signature.output), - vrf_proof: VRFProof(signature.proof), authority_index: *authority_index as u32, + vrf_signature, })) } else { None @@ -247,25 +239,28 @@ fn claim_primary_slot( epoch_index = epoch.clone_for_slot(slot).epoch_index; } - for (authority_id, authority_index) in keys { - let transcript = make_transcript(randomness, slot, epoch_index); - let transcript_data = make_transcript_data(randomness, slot, epoch_index); - let result = - keystore.sr25519_vrf_sign(AuthorityId::ID, authority_id.as_ref(), transcript_data); - if let Ok(Some(signature)) = result { - let public = PublicKey::from_bytes(&authority_id.to_raw_vec()).ok()?; - let inout = match signature.output.attach_input_hash(&public, transcript) { - Ok(inout) => inout, - Err(_) => continue, - }; + let transcript = make_transcript(randomness, slot, epoch_index); + for (authority_id, authority_index) in keys { + let result = keystore.sr25519_vrf_sign(AuthorityId::ID, authority_id.as_ref(), &transcript); + if let Ok(Some(vrf_signature)) = result { let threshold = calculate_primary_threshold(c, authorities, *authority_index); - if check_primary_threshold(&inout, threshold) { + + let can_claim = authority_id + .as_inner_ref() + .make_bytes::<[u8; AUTHORING_SCORE_LENGTH]>( + AUTHORING_SCORE_VRF_CONTEXT, + &transcript, + &vrf_signature.output, + ) + .map(|bytes| u128::from_le_bytes(bytes) < threshold) + .unwrap_or_default(); + + if can_claim { let pre_digest = PreDigest::Primary(PrimaryPreDigest { slot, - vrf_output: VRFOutput(signature.output), - vrf_proof: VRFProof(signature.proof), authority_index: *authority_index as u32, + vrf_signature, }); return Some((pre_digest, authority_id.clone())) diff --git a/client/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs index 6327c8c657bb6..219b52294952a 100644 --- a/client/consensus/babe/src/lib.rs +++ b/client/consensus/babe/src/lib.rs @@ -86,7 +86,6 @@ use futures::{ use log::{debug, info, log, trace, warn}; use parking_lot::Mutex; use prometheus_endpoint::Registry; -use schnorrkel::SignatureError; use sc_client_api::{ backend::AuxStore, AuxDataOperations, Backend as BackendT, FinalityNotification, @@ -134,7 +133,7 @@ pub use sp_consensus_babe::{ PrimaryPreDigest, SecondaryPlainPreDigest, }, AuthorityId, AuthorityPair, AuthoritySignature, BabeApi, BabeAuthorityWeight, BabeBlockWeight, - BabeConfiguration, BabeEpochConfiguration, ConsensusLog, BABE_ENGINE_ID, VRF_OUTPUT_LENGTH, + BabeConfiguration, BabeEpochConfiguration, ConsensusLog, Randomness, BABE_ENGINE_ID, }; pub use aux_schema::load_block_weight as block_weight; @@ -149,6 +148,12 @@ mod tests; const LOG_TARGET: &str = "babe"; +/// VRF context used for slots claiming lottery. +const AUTHORING_SCORE_VRF_CONTEXT: &[u8] = b"substrate-babe-vrf"; + +/// VRF output length for slots claiming lottery. +const AUTHORING_SCORE_LENGTH: usize = 16; + /// BABE epoch information #[derive(Decode, Encode, PartialEq, Eq, Clone, Debug, scale_info::TypeInfo)] pub struct Epoch { @@ -161,7 +166,7 @@ pub struct Epoch { /// The authorities and their weights. pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, /// Randomness for this epoch. - pub randomness: [u8; VRF_OUTPUT_LENGTH], + pub randomness: Randomness, /// Configuration of the epoch. pub config: BabeEpochConfiguration, } @@ -308,12 +313,12 @@ pub enum Error { /// No secondary author expected. #[error("No secondary author expected.")] NoSecondaryAuthorExpected, - /// VRF verification of block by author failed - #[error("VRF verification of block by author {0:?} failed: threshold {1} exceeded")] - VRFVerificationOfBlockFailed(AuthorityId, u128), /// VRF verification failed - #[error("VRF verification failed: {0:?}")] - VRFVerificationFailed(SignatureError), + #[error("VRF verification failed")] + VrfVerificationFailed, + /// Primary slot threshold too low + #[error("VRF output rejected, threshold {0} exceeded")] + VrfThresholdExceeded(u128), /// Could not fetch parent header #[error("Could not fetch parent header: {0}")] FetchParentHeader(sp_blockchain::Error), diff --git a/client/consensus/babe/src/migration.rs b/client/consensus/babe/src/migration.rs index ec864b8e5510f..2b1396c41c268 100644 --- a/client/consensus/babe/src/migration.rs +++ b/client/consensus/babe/src/migration.rs @@ -18,7 +18,7 @@ use crate::{ AuthorityId, BabeAuthorityWeight, BabeConfiguration, BabeEpochConfiguration, Epoch, - NextEpochDescriptor, VRF_OUTPUT_LENGTH, + NextEpochDescriptor, Randomness, }; use codec::{Decode, Encode}; use sc_consensus_epochs::Epoch as EpochT; @@ -36,7 +36,7 @@ pub struct EpochV0 { /// The authorities and their weights. pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, /// Randomness for this epoch. - pub randomness: [u8; VRF_OUTPUT_LENGTH], + pub randomness: Randomness, } impl EpochT for EpochV0 { diff --git a/client/consensus/babe/src/tests.rs b/client/consensus/babe/src/tests.rs index 7f8448d91991c..740ce63676374 100644 --- a/client/consensus/babe/src/tests.rs +++ b/client/consensus/babe/src/tests.rs @@ -20,10 +20,6 @@ use super::*; use authorship::claim_slot; -use rand_chacha::{ - rand_core::{RngCore, SeedableRng}, - ChaChaRng, -}; use sc_block_builder::{BlockBuilder, BlockBuilderProvider}; use sc_client_api::{backend::TransactionFor, BlockchainEvents, Finalizer}; use sc_consensus::{BoxBlockImport, BoxJustificationImport}; @@ -33,16 +29,13 @@ use sc_network_test::{Block as TestBlock, *}; use sp_application_crypto::key_types::BABE; use sp_consensus::{DisableProofRecording, NoNetwork as DummyOracle, Proposal}; use sp_consensus_babe::{ - inherents::InherentDataProvider, make_transcript, make_transcript_data, AllowedSlots, - AuthorityId, AuthorityPair, Slot, + inherents::InherentDataProvider, make_transcript, AllowedSlots, AuthorityId, AuthorityPair, + Slot, }; use sp_consensus_slots::SlotDuration; -use sp_consensus_vrf::schnorrkel::VRFOutput; use sp_core::crypto::Pair; use sp_keyring::Sr25519Keyring; -use sp_keystore::{ - testing::MemoryKeystore, vrf::make_transcript as transcript_from_data, Keystore, -}; +use sp_keystore::{testing::MemoryKeystore, Keystore}; use sp_runtime::{ generic::{Digest, DigestItem}, traits::Block as BlockT, @@ -637,24 +630,24 @@ fn claim_vrf_check() { PreDigest::Primary(d) => d, v => panic!("Unexpected pre-digest variant {:?}", v), }; - let transcript = make_transcript_data(&epoch.randomness.clone(), 0.into(), epoch.epoch_index); + let transcript = make_transcript(&epoch.randomness.clone(), 0.into(), epoch.epoch_index); let sign = keystore - .sr25519_vrf_sign(AuthorityId::ID, &public, transcript) + .sr25519_vrf_sign(AuthorityId::ID, &public, &transcript) .unwrap() .unwrap(); - assert_eq!(pre_digest.vrf_output, VRFOutput(sign.output)); + assert_eq!(pre_digest.vrf_signature.output, sign.output); // We expect a SecondaryVRF claim for slot 1 let pre_digest = match claim_slot(1.into(), &epoch, &keystore).unwrap().0 { PreDigest::SecondaryVRF(d) => d, v => panic!("Unexpected pre-digest variant {:?}", v), }; - let transcript = make_transcript_data(&epoch.randomness.clone(), 1.into(), epoch.epoch_index); + let transcript = make_transcript(&epoch.randomness.clone(), 1.into(), epoch.epoch_index); let sign = keystore - .sr25519_vrf_sign(AuthorityId::ID, &public, transcript) + .sr25519_vrf_sign(AuthorityId::ID, &public, &transcript) .unwrap() .unwrap(); - assert_eq!(pre_digest.vrf_output, VRFOutput(sign.output)); + assert_eq!(pre_digest.vrf_signature.output, sign.output); // Check that correct epoch index has been used if epochs are skipped (primary VRF) let slot = Slot::from(103); @@ -663,13 +656,13 @@ fn claim_vrf_check() { v => panic!("Unexpected claim variant {:?}", v), }; let fixed_epoch = epoch.clone_for_slot(slot); - let transcript = make_transcript_data(&epoch.randomness.clone(), slot, fixed_epoch.epoch_index); + let transcript = make_transcript(&epoch.randomness.clone(), slot, fixed_epoch.epoch_index); let sign = keystore - .sr25519_vrf_sign(AuthorityId::ID, &public, transcript) + .sr25519_vrf_sign(AuthorityId::ID, &public, &transcript) .unwrap() .unwrap(); assert_eq!(fixed_epoch.epoch_index, 11); - assert_eq!(claim.vrf_output, VRFOutput(sign.output)); + assert_eq!(claim.vrf_signature.output, sign.output); // Check that correct epoch index has been used if epochs are skipped (secondary VRF) let slot = Slot::from(100); @@ -678,13 +671,13 @@ fn claim_vrf_check() { v => panic!("Unexpected claim variant {:?}", v), }; let fixed_epoch = epoch.clone_for_slot(slot); - let transcript = make_transcript_data(&epoch.randomness.clone(), slot, fixed_epoch.epoch_index); + let transcript = make_transcript(&epoch.randomness.clone(), slot, fixed_epoch.epoch_index); let sign = keystore - .sr25519_vrf_sign(AuthorityId::ID, &public, transcript) + .sr25519_vrf_sign(AuthorityId::ID, &public, &transcript) .unwrap() .unwrap(); assert_eq!(fixed_epoch.epoch_index, 11); - assert_eq!(pre_digest.vrf_output, VRFOutput(sign.output)); + assert_eq!(pre_digest.vrf_signature.output, sign.output); } // Propose and import a new BABE block on top of the given parent. @@ -1084,36 +1077,6 @@ async fn verify_slots_are_strictly_increasing() { propose_and_import_block(&b1, Some(999.into()), &mut proposer_factory, &mut block_import).await; } -#[test] -fn babe_transcript_generation_match() { - sp_tracing::try_init_simple(); - - let authority = Sr25519Keyring::Alice; - let _keystore = create_keystore(authority); - - let epoch = Epoch { - start_slot: 0.into(), - authorities: vec![(authority.public().into(), 1)], - randomness: [0; 32], - epoch_index: 1, - duration: 100, - config: BabeEpochConfiguration { - c: (3, 10), - allowed_slots: AllowedSlots::PrimaryAndSecondaryPlainSlots, - }, - }; - - let orig_transcript = make_transcript(&epoch.randomness.clone(), 1.into(), epoch.epoch_index); - let new_transcript = make_transcript_data(&epoch.randomness, 1.into(), epoch.epoch_index); - - let test = |t: merlin::Transcript| -> [u8; 16] { - let mut b = [0u8; 16]; - t.build_rng().finalize(&mut ChaChaRng::from_seed([0u8; 32])).fill_bytes(&mut b); - b - }; - debug_assert!(test(orig_transcript) == test(transcript_from_data(new_transcript))); -} - #[tokio::test] async fn obsolete_blocks_aux_data_cleanup() { let mut net = BabeTestNet::new(1); diff --git a/client/consensus/babe/src/verification.rs b/client/consensus/babe/src/verification.rs index 96d3961d44571..cadceb6a57510 100644 --- a/client/consensus/babe/src/verification.rs +++ b/client/consensus/babe/src/verification.rs @@ -18,8 +18,9 @@ //! Verification for BABE headers. use crate::{ - authorship::{calculate_primary_threshold, check_primary_threshold, secondary_slot_author}, - babe_err, find_pre_digest, BlockT, Epoch, Error, LOG_TARGET, + authorship::{calculate_primary_threshold, secondary_slot_author}, + babe_err, find_pre_digest, BlockT, Epoch, Error, AUTHORING_SCORE_LENGTH, + AUTHORING_SCORE_VRF_CONTEXT, LOG_TARGET, }; use log::{debug, trace}; use sc_consensus_epochs::Epoch as EpochT; @@ -32,7 +33,10 @@ use sp_consensus_babe::{ make_transcript, AuthorityId, AuthorityPair, AuthoritySignature, }; use sp_consensus_slots::Slot; -use sp_core::{ByteArray, Pair}; +use sp_core::{ + crypto::{VrfVerifier, Wraps}, + Pair, +}; use sp_runtime::{traits::Header, DigestItem}; /// BABE verification parameters @@ -155,7 +159,7 @@ fn check_primary_header( epoch: &Epoch, c: (u64, u64), ) -> Result<(), Error> { - let author = &epoch.authorities[pre_digest.authority_index as usize].0; + let authority_id = &epoch.authorities[pre_digest.authority_index as usize].0; let mut epoch_index = epoch.epoch_index; if epoch.end_slot() <= pre_digest.slot { @@ -163,28 +167,34 @@ fn check_primary_header( epoch_index = epoch.clone_for_slot(pre_digest.slot).epoch_index; } - if AuthorityPair::verify(&signature, pre_hash, author) { - let (inout, _) = { - let transcript = make_transcript(&epoch.randomness, pre_digest.slot, epoch_index); - - schnorrkel::PublicKey::from_bytes(author.as_slice()) - .and_then(|p| { - p.vrf_verify(transcript, &pre_digest.vrf_output, &pre_digest.vrf_proof) - }) - .map_err(|s| babe_err(Error::VRFVerificationFailed(s)))? - }; + if !AuthorityPair::verify(&signature, pre_hash, authority_id) { + return Err(babe_err(Error::BadSignature(pre_hash))) + } - let threshold = - calculate_primary_threshold(c, &epoch.authorities, pre_digest.authority_index as usize); + let transcript = make_transcript(&epoch.randomness, pre_digest.slot, epoch_index); - if !check_primary_threshold(&inout, threshold) { - return Err(babe_err(Error::VRFVerificationOfBlockFailed(author.clone(), threshold))) - } + if !authority_id.as_inner_ref().vrf_verify(&transcript, &pre_digest.vrf_signature) { + return Err(babe_err(Error::VrfVerificationFailed)) + } - Ok(()) - } else { - Err(babe_err(Error::BadSignature(pre_hash))) + let threshold = + calculate_primary_threshold(c, &epoch.authorities, pre_digest.authority_index as usize); + + let score = authority_id + .as_inner_ref() + .make_bytes::<[u8; AUTHORING_SCORE_LENGTH]>( + AUTHORING_SCORE_VRF_CONTEXT, + &transcript, + &pre_digest.vrf_signature.output, + ) + .map(u128::from_le_bytes) + .map_err(|_| babe_err(Error::VrfVerificationFailed))?; + + if score >= threshold { + return Err(babe_err(Error::VrfThresholdExceeded(threshold))) } + + Ok(()) } /// Check a secondary slot proposal header. We validate that the given header is @@ -197,8 +207,7 @@ fn check_secondary_plain_header( signature: AuthoritySignature, epoch: &Epoch, ) -> Result<(), Error> { - // check the signature is valid under the expected authority and - // chain state. + // check the signature is valid under the expected authority and chain state. let expected_author = secondary_slot_author(pre_digest.slot, &epoch.authorities, epoch.randomness) .ok_or(Error::NoSecondaryAuthorExpected)?; @@ -209,11 +218,11 @@ fn check_secondary_plain_header( return Err(Error::InvalidAuthor(expected_author.clone(), author.clone())) } - if AuthorityPair::verify(&signature, pre_hash.as_ref(), author) { - Ok(()) - } else { - Err(Error::BadSignature(pre_hash)) + if !AuthorityPair::verify(&signature, pre_hash.as_ref(), author) { + return Err(Error::BadSignature(pre_hash)) } + + Ok(()) } /// Check a secondary VRF slot proposal header. @@ -223,8 +232,7 @@ fn check_secondary_vrf_header( signature: AuthoritySignature, epoch: &Epoch, ) -> Result<(), Error> { - // check the signature is valid under the expected authority and - // chain state. + // check the signature is valid under the expected authority and chain state. let expected_author = secondary_slot_author(pre_digest.slot, &epoch.authorities, epoch.randomness) .ok_or(Error::NoSecondaryAuthorExpected)?; @@ -241,15 +249,15 @@ fn check_secondary_vrf_header( epoch_index = epoch.clone_for_slot(pre_digest.slot).epoch_index; } - if AuthorityPair::verify(&signature, pre_hash.as_ref(), author) { - let transcript = make_transcript(&epoch.randomness, pre_digest.slot, epoch_index); + if !AuthorityPair::verify(&signature, pre_hash.as_ref(), author) { + return Err(Error::BadSignature(pre_hash)) + } - schnorrkel::PublicKey::from_bytes(author.as_slice()) - .and_then(|p| p.vrf_verify(transcript, &pre_digest.vrf_output, &pre_digest.vrf_proof)) - .map_err(|s| babe_err(Error::VRFVerificationFailed(s)))?; + let transcript = make_transcript(&epoch.randomness, pre_digest.slot, epoch_index); - Ok(()) - } else { - Err(Error::BadSignature(pre_hash)) + if !author.as_inner_ref().vrf_verify(&transcript, &pre_digest.vrf_signature) { + return Err(Error::VrfVerificationFailed) } + + Ok(()) } diff --git a/client/keystore/src/local.rs b/client/keystore/src/local.rs index 2486b2fd045d5..3551623f332a2 100644 --- a/client/keystore/src/local.rs +++ b/client/keystore/src/local.rs @@ -20,13 +20,10 @@ use parking_lot::RwLock; use sp_application_crypto::{AppCrypto, AppPair, IsWrappedBy}; use sp_core::{ - crypto::{ByteArray, ExposeSecret, KeyTypeId, Pair as CorePair, SecretString}, + crypto::{ByteArray, ExposeSecret, KeyTypeId, Pair as CorePair, SecretString, VrfSigner}, ecdsa, ed25519, sr25519, }; -use sp_keystore::{ - vrf::{make_transcript, VRFSignature, VRFTranscriptData}, - Error as TraitError, Keystore, KeystorePtr, -}; +use sp_keystore::{Error as TraitError, Keystore, KeystorePtr}; use std::{ collections::HashMap, fs::{self, File}, @@ -100,6 +97,20 @@ impl LocalKeystore { .map(|pair| pair.sign(msg)); Ok(signature) } + + fn vrf_sign( + &self, + key_type: KeyTypeId, + public: &T::Public, + transcript: &T::VrfInput, + ) -> std::result::Result, TraitError> { + let sig = self + .0 + .read() + .key_pair_by_type::(public, key_type)? + .map(|pair| pair.vrf_sign(transcript)); + Ok(sig) + } } impl Keystore for LocalKeystore { @@ -131,14 +142,9 @@ impl Keystore for LocalKeystore { &self, key_type: KeyTypeId, public: &sr25519::Public, - transcript_data: VRFTranscriptData, - ) -> std::result::Result, TraitError> { - let sig = self.0.read().key_pair_by_type::(public, key_type)?.map(|pair| { - let transcript = make_transcript(transcript_data); - let (inout, proof, _) = pair.as_ref().vrf_sign(transcript); - VRFSignature { output: inout.to_output(), proof } - }); - Ok(sig) + transcript: &sr25519::vrf::VrfTranscript, + ) -> std::result::Result, TraitError> { + self.vrf_sign::(key_type, public, transcript) } fn ed25519_public_keys(&self, key_type: KeyTypeId) -> Vec { diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index c4f6592dba9e1..ff9e4b3aeac43 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -24,7 +24,7 @@ pallet-session = { version = "4.0.0-dev", default-features = false, path = "../s pallet-timestamp = { version = "4.0.0-dev", default-features = false, path = "../timestamp" } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../../primitives/application-crypto" } sp-consensus-babe = { version = "0.10.0-dev", default-features = false, path = "../../primitives/consensus/babe" } -sp-consensus-vrf = { version = "0.10.0-dev", default-features = false, path = "../../primitives/consensus/vrf" } +sp-core = { version = "7.0.0", default-features = false, path = "../../primitives/core" } sp-io = { version = "7.0.0", default-features = false, path = "../../primitives/io" } sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" } sp-session = { version = "4.0.0-dev", default-features = false, path = "../../primitives/session" } @@ -53,7 +53,7 @@ std = [ "scale-info/std", "sp-application-crypto/std", "sp-consensus-babe/std", - "sp-consensus-vrf/std", + "sp-core/std", "sp-io/std", "sp-runtime/std", "sp-session/std", diff --git a/frame/babe/src/lib.rs b/frame/babe/src/lib.rs index 61284267b07e7..e3ead424e7f6b 100644 --- a/frame/babe/src/lib.rs +++ b/frame/babe/src/lib.rs @@ -29,13 +29,13 @@ use frame_support::{ weights::Weight, BoundedVec, WeakBoundedVec, }; -use sp_application_crypto::ByteArray; use sp_consensus_babe::{ digests::{NextConfigDescriptor, NextEpochDescriptor, PreDigest}, AllowedSlots, BabeAuthorityWeight, BabeEpochConfiguration, ConsensusLog, Epoch, - EquivocationProof, Slot, BABE_ENGINE_ID, + EquivocationProof, Randomness as BabeRandomness, Slot, BABE_ENGINE_ID, RANDOMNESS_LENGTH, + RANDOMNESS_VRF_CONTEXT, }; -use sp_consensus_vrf::schnorrkel; +use sp_core::crypto::Wraps; use sp_runtime::{ generic::DigestItem, traits::{IsMember, One, SaturatedConversion, Saturating, Zero}, @@ -45,7 +45,7 @@ use sp_session::{GetSessionNumber, GetValidatorCount}; use sp_staking::{offence::OffenceReportSystem, SessionIndex}; use sp_std::prelude::*; -pub use sp_consensus_babe::{AuthorityId, PUBLIC_KEY_LENGTH, RANDOMNESS_LENGTH, VRF_OUTPUT_LENGTH}; +pub use sp_consensus_babe::AuthorityId; const LOG_TARGET: &str = "runtime::babe"; @@ -218,7 +218,7 @@ pub mod pallet { // variable to its underlying value. #[pallet::storage] #[pallet::getter(fn randomness)] - pub type Randomness = StorageValue<_, schnorrkel::Randomness, ValueQuery>; + pub type Randomness = StorageValue<_, BabeRandomness, ValueQuery>; /// Pending epoch configuration change that will be applied when the next epoch is enacted. #[pallet::storage] @@ -226,7 +226,7 @@ pub mod pallet { /// Next epoch randomness. #[pallet::storage] - pub(super) type NextRandomness = StorageValue<_, schnorrkel::Randomness, ValueQuery>; + pub(super) type NextRandomness = StorageValue<_, BabeRandomness, ValueQuery>; /// Next epoch authorities. #[pallet::storage] @@ -254,7 +254,7 @@ pub mod pallet { _, Twox64Concat, u32, - BoundedVec>, + BoundedVec>, ValueQuery, >; @@ -270,8 +270,7 @@ pub mod pallet { /// It is set in `on_finalize`, before it will contain the value from the last block. #[pallet::storage] #[pallet::getter(fn author_vrf_randomness)] - pub(super) type AuthorVrfRandomness = - StorageValue<_, Option, ValueQuery>; + pub(super) type AuthorVrfRandomness = StorageValue<_, Option, ValueQuery>; /// The block numbers when the last and current epoch have started, respectively `N-1` and /// `N`. @@ -358,31 +357,33 @@ pub mod pallet { ); } - if let Some((vrf_output, vrf_proof)) = pre_digest.vrf() { - let randomness: Option = Authorities::::get() + if let Some(vrf_signature) = pre_digest.vrf_signature() { + let randomness: Option = Authorities::::get() .get(authority_index as usize) .and_then(|(authority, _)| { - schnorrkel::PublicKey::from_bytes(authority.as_slice()).ok() - }) - .and_then(|pubkey| { - let current_slot = CurrentSlot::::get(); - + let public = authority.as_inner_ref(); let transcript = sp_consensus_babe::make_transcript( &Self::randomness(), - current_slot, + CurrentSlot::::get(), EpochIndex::::get(), ); // NOTE: this is verified by the client when importing the block, before - // execution. we don't run the verification again here to avoid slowing + // execution. We don't run the verification again here to avoid slowing // down the runtime. - debug_assert!(pubkey - .vrf_verify(transcript.clone(), vrf_output, vrf_proof) - .is_ok()); - - vrf_output.0.attach_input_hash(&pubkey, transcript).ok() - }) - .map(|inout| inout.make_bytes(sp_consensus_babe::BABE_VRF_INOUT_CONTEXT)); + debug_assert!({ + use sp_core::crypto::VrfVerifier; + public.vrf_verify(&transcript, &vrf_signature) + }); + + public + .make_bytes( + RANDOMNESS_VRF_CONTEXT, + &transcript, + &vrf_signature.output, + ) + .ok() + }); if let Some(randomness) = pre_digest.is_primary().then(|| randomness).flatten() { @@ -484,9 +485,6 @@ pub mod pallet { } } -/// A BABE public key -pub type BabeKey = [u8; PUBLIC_KEY_LENGTH]; - impl FindAuthor for Pallet { fn find_author<'a, I>(digests: I) -> Option where @@ -737,7 +735,7 @@ impl Pallet { >::deposit_log(log) } - fn deposit_randomness(randomness: &schnorrkel::Randomness) { + fn deposit_randomness(randomness: &BabeRandomness) { let segment_idx = SegmentIndex::::get(); let mut segment = UnderConstruction::::get(&segment_idx); if segment.try_push(*randomness).is_ok() { @@ -831,7 +829,7 @@ impl Pallet { /// Call this function exactly once when an epoch changes, to update the /// randomness. Returns the new randomness. - fn randomness_change_epoch(next_epoch_index: u64) -> schnorrkel::Randomness { + fn randomness_change_epoch(next_epoch_index: u64) -> BabeRandomness { let this_randomness = NextRandomness::::get(); let segment_idx: u32 = SegmentIndex::::mutate(|s| sp_std::mem::replace(s, 0)); @@ -990,12 +988,12 @@ where // // an optional size hint as to how many VRF outputs there were may be provided. fn compute_randomness( - last_epoch_randomness: schnorrkel::Randomness, + last_epoch_randomness: BabeRandomness, epoch_index: u64, - rho: impl Iterator, + rho: impl Iterator, rho_size_hint: Option, -) -> schnorrkel::Randomness { - let mut s = Vec::with_capacity(40 + rho_size_hint.unwrap_or(0) * VRF_OUTPUT_LENGTH); +) -> BabeRandomness { + let mut s = Vec::with_capacity(40 + rho_size_hint.unwrap_or(0) * RANDOMNESS_LENGTH); s.extend_from_slice(&last_epoch_randomness); s.extend_from_slice(&epoch_index.to_le_bytes()); diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index 94e748d0bca52..bccdb42c71ac3 100644 --- a/frame/babe/src/mock.rs +++ b/frame/babe/src/mock.rs @@ -25,10 +25,9 @@ use frame_support::{ traits::{ConstU128, ConstU32, ConstU64, GenesisBuild, KeyOwnerProofSystem, OnInitialize}, }; use pallet_session::historical as pallet_session_historical; -use sp_consensus_babe::{AuthorityId, AuthorityPair, Slot}; -use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof}; +use sp_consensus_babe::{AuthorityId, AuthorityPair, Randomness, Slot, VrfSignature}; use sp_core::{ - crypto::{IsWrappedBy, KeyTypeId, Pair}, + crypto::{KeyTypeId, Pair, VrfSigner}, H256, U256, }; use sp_io; @@ -283,16 +282,10 @@ pub fn start_era(era_index: EraIndex) { pub fn make_primary_pre_digest( authority_index: sp_consensus_babe::AuthorityIndex, slot: sp_consensus_babe::Slot, - vrf_output: VRFOutput, - vrf_proof: VRFProof, + vrf_signature: VrfSignature, ) -> Digest { let digest_data = sp_consensus_babe::digests::PreDigest::Primary( - sp_consensus_babe::digests::PrimaryPreDigest { - authority_index, - slot, - vrf_output, - vrf_proof, - }, + sp_consensus_babe::digests::PrimaryPreDigest { authority_index, slot, vrf_signature }, ); let log = DigestItem::PreRuntime(sp_consensus_babe::BABE_ENGINE_ID, digest_data.encode()); Digest { logs: vec![log] } @@ -312,16 +305,10 @@ pub fn make_secondary_plain_pre_digest( pub fn make_secondary_vrf_pre_digest( authority_index: sp_consensus_babe::AuthorityIndex, slot: sp_consensus_babe::Slot, - vrf_output: VRFOutput, - vrf_proof: VRFProof, + vrf_signature: VrfSignature, ) -> Digest { let digest_data = sp_consensus_babe::digests::PreDigest::SecondaryVRF( - sp_consensus_babe::digests::SecondaryVRFPreDigest { - authority_index, - slot, - vrf_output, - vrf_proof, - }, + sp_consensus_babe::digests::SecondaryVRFPreDigest { authority_index, slot, vrf_signature }, ); let log = DigestItem::PreRuntime(sp_consensus_babe::BABE_ENGINE_ID, digest_data.encode()); Digest { logs: vec![log] } @@ -330,16 +317,16 @@ pub fn make_secondary_vrf_pre_digest( pub fn make_vrf_output( slot: Slot, pair: &sp_consensus_babe::AuthorityPair, -) -> (VRFOutput, VRFProof, [u8; 32]) { - let pair = sp_core::sr25519::Pair::from_ref(pair).as_ref(); +) -> (VrfSignature, Randomness) { let transcript = sp_consensus_babe::make_transcript(&Babe::randomness(), slot, 0); - let vrf_inout = pair.vrf_sign(transcript); - let vrf_randomness: sp_consensus_vrf::schnorrkel::Randomness = - vrf_inout.0.make_bytes::<[u8; 32]>(&sp_consensus_babe::BABE_VRF_INOUT_CONTEXT); - let vrf_output = VRFOutput(vrf_inout.0.to_output()); - let vrf_proof = VRFProof(vrf_inout.1); - (vrf_output, vrf_proof, vrf_randomness) + let signature = pair.as_ref().vrf_sign(&transcript); + + let randomness = pair + .as_ref() + .make_bytes::(sp_consensus_babe::RANDOMNESS_VRF_CONTEXT, &transcript); + + (signature, randomness) } pub fn new_test_ext(authorities_len: usize) -> sp_io::TestExternalities { diff --git a/frame/babe/src/randomness.rs b/frame/babe/src/randomness.rs index b223df6804c0b..b9b24786b7a74 100644 --- a/frame/babe/src/randomness.rs +++ b/frame/babe/src/randomness.rs @@ -19,7 +19,7 @@ //! randomness collected from VRF outputs. use super::{ - AuthorVrfRandomness, Config, EpochStart, NextRandomness, Randomness, VRF_OUTPUT_LENGTH, + AuthorVrfRandomness, Config, EpochStart, NextRandomness, Randomness, RANDOMNESS_LENGTH, }; use frame_support::traits::Randomness as RandomnessT; use sp_runtime::traits::{Hash, One, Saturating}; @@ -132,7 +132,7 @@ pub struct CurrentBlockRandomness(sp_std::marker::PhantomData); impl RandomnessT for RandomnessFromTwoEpochsAgo { fn random(subject: &[u8]) -> (T::Hash, T::BlockNumber) { let mut subject = subject.to_vec(); - subject.reserve(VRF_OUTPUT_LENGTH); + subject.reserve(RANDOMNESS_LENGTH); subject.extend_from_slice(&Randomness::::get()[..]); (T::Hashing::hash(&subject[..]), EpochStart::::get().0) @@ -142,7 +142,7 @@ impl RandomnessT for RandomnessFromTwoEpochs impl RandomnessT for RandomnessFromOneEpochAgo { fn random(subject: &[u8]) -> (T::Hash, T::BlockNumber) { let mut subject = subject.to_vec(); - subject.reserve(VRF_OUTPUT_LENGTH); + subject.reserve(RANDOMNESS_LENGTH); subject.extend_from_slice(&NextRandomness::::get()[..]); (T::Hashing::hash(&subject[..]), EpochStart::::get().1) @@ -153,7 +153,7 @@ impl RandomnessT, T::BlockNumber> for ParentBlockRand fn random(subject: &[u8]) -> (Option, T::BlockNumber) { let random = AuthorVrfRandomness::::get().map(|random| { let mut subject = subject.to_vec(); - subject.reserve(VRF_OUTPUT_LENGTH); + subject.reserve(RANDOMNESS_LENGTH); subject.extend_from_slice(&random); T::Hashing::hash(&subject[..]) diff --git a/frame/babe/src/tests.rs b/frame/babe/src/tests.rs index 8b63f41b37b74..8a9aa6fcc03d2 100644 --- a/frame/babe/src/tests.rs +++ b/frame/babe/src/tests.rs @@ -25,11 +25,12 @@ use frame_support::{ }; use mock::*; use pallet_session::ShouldEndSession; -use sp_consensus_babe::{AllowedSlots, BabeEpochConfiguration, Slot}; -use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof}; +use sp_consensus_babe::{ + AllowedSlots, BabeEpochConfiguration, Slot, VrfSignature, RANDOMNESS_LENGTH, +}; use sp_core::crypto::Pair; -const EMPTY_RANDOMNESS: [u8; 32] = [ +const EMPTY_RANDOMNESS: [u8; RANDOMNESS_LENGTH] = [ 74, 25, 49, 128, 53, 97, 244, 49, 222, 202, 176, 2, 231, 66, 95, 10, 133, 49, 213, 228, 86, 161, 164, 127, 217, 153, 138, 37, 48, 192, 248, 0, ]; @@ -62,10 +63,9 @@ fn first_block_epoch_zero_start() { ext.execute_with(|| { let genesis_slot = Slot::from(100); - let (vrf_output, vrf_proof, vrf_randomness) = make_vrf_output(genesis_slot, &pairs[0]); + let (vrf_signature, vrf_randomness) = make_vrf_output(genesis_slot, &pairs[0]); - let first_vrf = vrf_output; - let pre_digest = make_primary_pre_digest(0, genesis_slot, first_vrf.clone(), vrf_proof); + let pre_digest = make_primary_pre_digest(0, genesis_slot, vrf_signature); assert_eq!(Babe::genesis_slot(), Slot::from(0)); System::reset_events(); @@ -111,8 +111,8 @@ fn current_slot_is_processed_on_initialization() { ext.execute_with(|| { let genesis_slot = Slot::from(10); - let (vrf_output, vrf_proof, vrf_randomness) = make_vrf_output(genesis_slot, &pairs[0]); - let pre_digest = make_primary_pre_digest(0, genesis_slot, vrf_output, vrf_proof); + let (vrf_signature, vrf_randomness) = make_vrf_output(genesis_slot, &pairs[0]); + let pre_digest = make_primary_pre_digest(0, genesis_slot, vrf_signature); System::reset_events(); System::initialize(&1, &Default::default(), &pre_digest); @@ -134,14 +134,14 @@ fn current_slot_is_processed_on_initialization() { fn test_author_vrf_output(make_pre_digest: F) where - F: Fn(sp_consensus_babe::AuthorityIndex, Slot, VRFOutput, VRFProof) -> sp_runtime::Digest, + F: Fn(sp_consensus_babe::AuthorityIndex, Slot, VrfSignature) -> sp_runtime::Digest, { let (pairs, mut ext) = new_test_ext_with_pairs(1); ext.execute_with(|| { let genesis_slot = Slot::from(10); - let (vrf_output, vrf_proof, vrf_randomness) = make_vrf_output(genesis_slot, &pairs[0]); - let pre_digest = make_pre_digest(0, genesis_slot, vrf_output, vrf_proof); + let (vrf_signature, vrf_randomness) = make_vrf_output(genesis_slot, &pairs[0]); + let pre_digest = make_pre_digest(0, genesis_slot, vrf_signature); System::reset_events(); System::initialize(&1, &Default::default(), &pre_digest); diff --git a/primitives/consensus/babe/Cargo.toml b/primitives/consensus/babe/Cargo.toml index d106cd0d0c875..7e171811a7fe2 100644 --- a/primitives/consensus/babe/Cargo.toml +++ b/primitives/consensus/babe/Cargo.toml @@ -15,14 +15,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] async-trait = { version = "0.1.57", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -merlin = { version = "2.0", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } serde = { version = "1.0.136", features = ["derive"], optional = true } sp-api = { version = "4.0.0-dev", default-features = false, path = "../../api" } sp-application-crypto = { version = "7.0.0", default-features = false, path = "../../application-crypto" } sp-consensus = { version = "0.10.0-dev", optional = true, path = "../common" } sp-consensus-slots = { version = "0.10.0-dev", default-features = false, path = "../slots" } -sp-consensus-vrf = { version = "0.10.0-dev", default-features = false, path = "../vrf" } sp-core = { version = "7.0.0", default-features = false, path = "../../core" } sp-inherents = { version = "4.0.0-dev", default-features = false, path = "../../inherents" } sp-keystore = { version = "0.13.0", default-features = false, optional = true, path = "../../keystore" } @@ -35,14 +33,12 @@ default = ["std"] std = [ "async-trait", "codec/std", - "merlin/std", "scale-info/std", "serde", "sp-api/std", "sp-application-crypto/std", "sp-consensus", "sp-consensus-slots/std", - "sp-consensus-vrf/std", "sp-core/std", "sp-inherents/std", "sp-keystore", diff --git a/primitives/consensus/babe/src/digests.rs b/primitives/consensus/babe/src/digests.rs index 4364057a4b478..afc967e3af391 100644 --- a/primitives/consensus/babe/src/digests.rs +++ b/primitives/consensus/babe/src/digests.rs @@ -19,14 +19,15 @@ use super::{ AllowedSlots, AuthorityId, AuthorityIndex, AuthoritySignature, BabeAuthorityWeight, - BabeEpochConfiguration, Slot, BABE_ENGINE_ID, + BabeEpochConfiguration, Randomness, Slot, BABE_ENGINE_ID, }; -use codec::{Decode, Encode, MaxEncodedLen}; -use scale_info::TypeInfo; + +use sp_core::sr25519::vrf::VrfSignature; use sp_runtime::{DigestItem, RuntimeDebug}; use sp_std::vec::Vec; -use sp_consensus_vrf::schnorrkel::{Randomness, VRFOutput, VRFProof}; +use codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; /// Raw BABE primary slot assignment pre-digest. #[derive(Clone, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] @@ -35,10 +36,8 @@ pub struct PrimaryPreDigest { pub authority_index: super::AuthorityIndex, /// Slot pub slot: Slot, - /// VRF output - pub vrf_output: VRFOutput, - /// VRF proof - pub vrf_proof: VRFProof, + /// VRF signature + pub vrf_signature: VrfSignature, } /// BABE secondary slot assignment pre-digest. @@ -62,10 +61,8 @@ pub struct SecondaryVRFPreDigest { pub authority_index: super::AuthorityIndex, /// Slot pub slot: Slot, - /// VRF output - pub vrf_output: VRFOutput, - /// VRF proof - pub vrf_proof: VRFProof, + /// VRF signature + pub vrf_signature: VrfSignature, } /// A BABE pre-runtime digest. This contains all data required to validate a @@ -118,11 +115,10 @@ impl PreDigest { } /// Returns the VRF output and proof, if they exist. - pub fn vrf(&self) -> Option<(&VRFOutput, &VRFProof)> { + pub fn vrf_signature(&self) -> Option<&VrfSignature> { match self { - PreDigest::Primary(primary) => Some((&primary.vrf_output, &primary.vrf_proof)), - PreDigest::SecondaryVRF(secondary) => - Some((&secondary.vrf_output, &secondary.vrf_proof)), + PreDigest::Primary(primary) => Some(&primary.vrf_signature), + PreDigest::SecondaryVRF(secondary) => Some(&secondary.vrf_signature), PreDigest::SecondaryPlain(_) => None, } } diff --git a/primitives/consensus/babe/src/lib.rs b/primitives/consensus/babe/src/lib.rs index e7747ac4c204a..37cf0c3f0b677 100644 --- a/primitives/consensus/babe/src/lib.rs +++ b/primitives/consensus/babe/src/lib.rs @@ -23,22 +23,17 @@ pub mod digests; pub mod inherents; -pub use merlin::Transcript; -pub use sp_consensus_vrf::schnorrkel::{ - Randomness, RANDOMNESS_LENGTH, VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH, -}; - use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; -#[cfg(feature = "std")] -use sp_keystore::vrf::{VRFTranscriptData, VRFTranscriptValue}; use sp_runtime::{traits::Header, ConsensusEngineId, RuntimeDebug}; use sp_std::vec::Vec; use crate::digests::{NextConfigDescriptor, NextEpochDescriptor}; +pub use sp_core::sr25519::vrf::{VrfOutput, VrfProof, VrfSignature, VrfTranscript}; + /// Key type for BABE module. pub const KEY_TYPE: sp_core::crypto::KeyTypeId = sp_application_crypto::key_types::BABE; @@ -47,11 +42,14 @@ mod app { app_crypto!(sr25519, BABE); } -/// The prefix used by BABE for its VRF keys. -pub const BABE_VRF_PREFIX: &[u8] = b"substrate-babe-vrf"; +/// VRF context used for per-slot randomness generation. +pub const RANDOMNESS_VRF_CONTEXT: &[u8] = b"BabeVRFInOutContext"; -/// BABE VRFInOut context. -pub static BABE_VRF_INOUT_CONTEXT: &[u8] = b"BabeVRFInOutContext"; +/// VRF output length for per-slot randomness. +pub const RANDOMNESS_LENGTH: usize = 32; + +/// Randomness type required by BABE operations. +pub type Randomness = [u8; RANDOMNESS_LENGTH]; /// A Babe authority keypair. Necessarily equivalent to the schnorrkel public key used in /// the main Babe module. If that ever changes, then this must, too. @@ -96,26 +94,16 @@ pub type BabeAuthorityWeight = u64; /// of 0 (regardless of whether they are plain or vrf secondary blocks). pub type BabeBlockWeight = u32; -/// Make a VRF transcript from given randomness, slot number and epoch. -pub fn make_transcript(randomness: &Randomness, slot: Slot, epoch: u64) -> Transcript { - let mut transcript = Transcript::new(&BABE_ENGINE_ID); - transcript.append_u64(b"slot number", *slot); - transcript.append_u64(b"current epoch", epoch); - transcript.append_message(b"chain randomness", &randomness[..]); - transcript -} - /// Make a VRF transcript data container -#[cfg(feature = "std")] -pub fn make_transcript_data(randomness: &Randomness, slot: Slot, epoch: u64) -> VRFTranscriptData { - VRFTranscriptData { - label: &BABE_ENGINE_ID, - items: vec![ - ("slot number", VRFTranscriptValue::U64(*slot)), - ("current epoch", VRFTranscriptValue::U64(epoch)), - ("chain randomness", VRFTranscriptValue::Bytes(randomness.to_vec())), +pub fn make_transcript(randomness: &Randomness, slot: Slot, epoch: u64) -> VrfTranscript { + VrfTranscript::new( + &BABE_ENGINE_ID, + &[ + (b"slot number", &slot.to_le_bytes()), + (b"current epoch", &epoch.to_le_bytes()), + (b"chain randomness", randomness), ], - } + ) } /// An consensus log item for BABE. @@ -355,7 +343,7 @@ pub struct Epoch { /// The authorities and their weights. pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, /// Randomness for this epoch. - pub randomness: [u8; VRF_OUTPUT_LENGTH], + pub randomness: Randomness, /// Configuration of the epoch. pub config: BabeEpochConfiguration, } diff --git a/primitives/consensus/vrf/Cargo.toml b/primitives/consensus/vrf/Cargo.toml deleted file mode 100644 index e7b4f0f0dec0e..0000000000000 --- a/primitives/consensus/vrf/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -[package] -name = "sp-consensus-vrf" -version = "0.10.0-dev" -authors = ["Parity Technologies "] -description = "Primitives for VRF based consensus" -edition = "2021" -license = "Apache-2.0" -repository = "https://github.com/paritytech/substrate/" -homepage = "https://substrate.io" -readme = "README.md" - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -scale-info = { version = "2.5.0", default-features = false } -schnorrkel = { version = "0.9.1", default-features = false, features = ["preaudit_deprecated", "u64_backend"] } -sp-core = { version = "7.0.0", default-features = false, path = "../../core" } -sp-runtime = { version = "7.0.0", default-features = false, path = "../../runtime" } -sp-std = { version = "5.0.0", default-features = false, path = "../../std" } - -[features] -default = ["std"] -std = [ - "codec/std", - "scale-info/std", - "schnorrkel/std", - "sp-core/std", - "sp-runtime/std", - "sp-std/std", -] diff --git a/primitives/consensus/vrf/README.md b/primitives/consensus/vrf/README.md deleted file mode 100644 index d66490e023b38..0000000000000 --- a/primitives/consensus/vrf/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Primitives for VRF-based consensus engines. - -License: Apache-2.0 \ No newline at end of file diff --git a/primitives/consensus/vrf/src/lib.rs b/primitives/consensus/vrf/src/lib.rs deleted file mode 100644 index 84040c18590e0..0000000000000 --- a/primitives/consensus/vrf/src/lib.rs +++ /dev/null @@ -1,21 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Primitives for VRF-based consensus engines. -#![cfg_attr(not(feature = "std"), no_std)] - -pub mod schnorrkel; diff --git a/primitives/consensus/vrf/src/schnorrkel.rs b/primitives/consensus/vrf/src/schnorrkel.rs deleted file mode 100644 index be145c5b12096..0000000000000 --- a/primitives/consensus/vrf/src/schnorrkel.rs +++ /dev/null @@ -1,188 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Schnorrkel-based VRF. - -use codec::{Decode, Encode, EncodeLike, MaxEncodedLen}; -use scale_info::TypeInfo; -use schnorrkel::errors::MultiSignatureStage; -use sp_core::U512; -use sp_std::{ - ops::{Deref, DerefMut}, - prelude::*, -}; - -pub use schnorrkel::{ - vrf::{VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH}, - PublicKey, SignatureError, -}; - -/// The length of the Randomness. -pub const RANDOMNESS_LENGTH: usize = VRF_OUTPUT_LENGTH; - -/// VRF output type available for `std` environment, suitable for schnorrkel operations. -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct VRFOutput(pub schnorrkel::vrf::VRFOutput); - -impl Deref for VRFOutput { - type Target = schnorrkel::vrf::VRFOutput; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for VRFOutput { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl Encode for VRFOutput { - fn encode(&self) -> Vec { - self.0.as_bytes().encode() - } -} - -impl EncodeLike for VRFOutput {} - -impl Decode for VRFOutput { - fn decode(i: &mut R) -> Result { - let decoded = <[u8; VRF_OUTPUT_LENGTH]>::decode(i)?; - Ok(Self(schnorrkel::vrf::VRFOutput::from_bytes(&decoded).map_err(convert_error)?)) - } -} - -impl MaxEncodedLen for VRFOutput { - fn max_encoded_len() -> usize { - <[u8; VRF_OUTPUT_LENGTH]>::max_encoded_len() - } -} - -impl TypeInfo for VRFOutput { - type Identity = [u8; VRF_OUTPUT_LENGTH]; - - fn type_info() -> scale_info::Type { - Self::Identity::type_info() - } -} - -impl TryFrom<[u8; VRF_OUTPUT_LENGTH]> for VRFOutput { - type Error = SignatureError; - - fn try_from(raw: [u8; VRF_OUTPUT_LENGTH]) -> Result { - schnorrkel::vrf::VRFOutput::from_bytes(&raw).map(VRFOutput) - } -} - -/// VRF proof type available for `std` environment, suitable for schnorrkel operations. -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct VRFProof(pub schnorrkel::vrf::VRFProof); - -impl PartialOrd for VRFProof { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl Ord for VRFProof { - fn cmp(&self, other: &Self) -> core::cmp::Ordering { - U512::from(self.0.to_bytes()).cmp(&U512::from(other.0.to_bytes())) - } -} - -impl Deref for VRFProof { - type Target = schnorrkel::vrf::VRFProof; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for VRFProof { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl Encode for VRFProof { - fn encode(&self) -> Vec { - self.0.to_bytes().encode() - } -} - -impl EncodeLike for VRFProof {} - -impl Decode for VRFProof { - fn decode(i: &mut R) -> Result { - let decoded = <[u8; VRF_PROOF_LENGTH]>::decode(i)?; - Ok(Self(schnorrkel::vrf::VRFProof::from_bytes(&decoded).map_err(convert_error)?)) - } -} - -impl MaxEncodedLen for VRFProof { - fn max_encoded_len() -> usize { - <[u8; VRF_PROOF_LENGTH]>::max_encoded_len() - } -} - -impl TypeInfo for VRFProof { - type Identity = [u8; VRF_PROOF_LENGTH]; - - fn type_info() -> scale_info::Type { - Self::Identity::type_info() - } -} - -impl TryFrom<[u8; VRF_PROOF_LENGTH]> for VRFProof { - type Error = SignatureError; - - fn try_from(raw: [u8; VRF_PROOF_LENGTH]) -> Result { - schnorrkel::vrf::VRFProof::from_bytes(&raw).map(VRFProof) - } -} - -fn convert_error(e: SignatureError) -> codec::Error { - use MultiSignatureStage::*; - use SignatureError::*; - match e { - EquationFalse => "Signature error: `EquationFalse`".into(), - PointDecompressionError => "Signature error: `PointDecompressionError`".into(), - ScalarFormatError => "Signature error: `ScalarFormatError`".into(), - NotMarkedSchnorrkel => "Signature error: `NotMarkedSchnorrkel`".into(), - BytesLengthError { .. } => "Signature error: `BytesLengthError`".into(), - MuSigAbsent { musig_stage: Commitment } => - "Signature error: `MuSigAbsent` at stage `Commitment`".into(), - MuSigAbsent { musig_stage: Reveal } => - "Signature error: `MuSigAbsent` at stage `Reveal`".into(), - MuSigAbsent { musig_stage: Cosignature } => - "Signature error: `MuSigAbsent` at stage `Commitment`".into(), - MuSigInconsistent { musig_stage: Commitment, duplicate: true } => - "Signature error: `MuSigInconsistent` at stage `Commitment` on duplicate".into(), - MuSigInconsistent { musig_stage: Commitment, duplicate: false } => - "Signature error: `MuSigInconsistent` at stage `Commitment` on not duplicate".into(), - MuSigInconsistent { musig_stage: Reveal, duplicate: true } => - "Signature error: `MuSigInconsistent` at stage `Reveal` on duplicate".into(), - MuSigInconsistent { musig_stage: Reveal, duplicate: false } => - "Signature error: `MuSigInconsistent` at stage `Reveal` on not duplicate".into(), - MuSigInconsistent { musig_stage: Cosignature, duplicate: true } => - "Signature error: `MuSigInconsistent` at stage `Cosignature` on duplicate".into(), - MuSigInconsistent { musig_stage: Cosignature, duplicate: false } => - "Signature error: `MuSigInconsistent` at stage `Cosignature` on not duplicate".into(), - } -} - -/// Schnorrkel randomness value. Same size as `VRFOutput`. -pub type Randomness = [u8; RANDOMNESS_LENGTH]; diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 1edd28b3fca7e..302d52f2f862b 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -44,9 +44,9 @@ bitflags = "1.3" array-bytes = { version = "4.1", optional = true } ed25519-zebra = { version = "3.1.0", default-features = false, optional = true } blake2 = { version = "0.10.4", default-features = false, optional = true } -schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false, optional = true } libsecp256k1 = { version = "0.7", default-features = false, features = ["static-context"], optional = true } -merlin = { version = "2.0", default-features = false, optional = true } +schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false } +merlin = { version = "2.0", default-features = false } secp256k1 = { version = "0.24.0", default-features = false, features = ["recovery", "alloc"], optional = true } ss58-registry = { version = "1.34.0", default-features = false } sp-core-hashing = { version = "5.0.0", path = "./hashing", default-features = false, optional = true } @@ -69,7 +69,7 @@ bench = false [features] default = ["std"] std = [ - "merlin?/std", + "merlin/std", "full_crypto", "log/std", "thiserror", @@ -119,10 +119,8 @@ full_crypto = [ "array-bytes", "ed25519-zebra", "blake2", - "schnorrkel", "libsecp256k1", "secp256k1", "sp-core-hashing", "sp-runtime-interface/disable_target_static_assertions", - "merlin", ] diff --git a/primitives/core/src/crypto.rs b/primitives/core/src/crypto.rs index f77e952d84546..4fec79fc6ea18 100644 --- a/primitives/core/src/crypto.rs +++ b/primitives/core/src/crypto.rs @@ -28,11 +28,8 @@ use rand::{rngs::OsRng, RngCore}; #[cfg(feature = "std")] use regex::Regex; use scale_info::TypeInfo; -/// Trait for accessing reference to `SecretString`. -pub use secrecy::ExposeSecret; -/// A store for sensitive data. #[cfg(feature = "std")] -pub use secrecy::SecretString; +pub use secrecy::{ExposeSecret, SecretString}; use sp_runtime_interface::pass_by::PassByInner; #[doc(hidden)] pub use sp_std::ops::Deref; @@ -1102,6 +1099,27 @@ impl<'a> TryFrom<&'a str> for KeyTypeId { } } +/// Trait grouping types shared by a VRF signer and verifiers. +pub trait VrfCrypto { + /// Associated signature type. + type VrfSignature; + + /// Vrf input data. Generally some form of transcript. + type VrfInput; +} + +/// VRF Signer. +pub trait VrfSigner: VrfCrypto { + /// Sign input data. + fn vrf_sign(&self, data: &Self::VrfInput) -> Self::VrfSignature; +} + +/// VRF Verifier. +pub trait VrfVerifier: VrfCrypto { + /// Verify input data signature. + fn vrf_verify(&self, data: &Self::VrfInput, signature: &Self::VrfSignature) -> bool; +} + /// An identifier for a specific cryptographic algorithm used by a key pair #[derive(Debug, Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Encode, Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] diff --git a/primitives/core/src/sr25519.rs b/primitives/core/src/sr25519.rs index d7c1c79c3f42b..fcd7f38a74f1f 100644 --- a/primitives/core/src/sr25519.rs +++ b/primitives/core/src/sr25519.rs @@ -15,12 +15,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// tag::description[] //! Simple sr25519 (Schnorr-Ristretto) API. //! //! Note: `CHAIN_CODE_LENGTH` must be equal to `crate::crypto::JUNCTION_ID_LEN` //! for this to work. -// end::description[] + #[cfg(feature = "std")] use crate::crypto::Ss58Codec; #[cfg(feature = "full_crypto")] @@ -30,7 +29,6 @@ use schnorrkel::{ derive::{ChainCode, Derivation, CHAIN_CODE_LENGTH}, signing_context, ExpansionMode, Keypair, MiniSecretKey, PublicKey, SecretKey, }; -#[cfg(feature = "full_crypto")] use sp_std::vec::Vec; use crate::{ @@ -200,8 +198,6 @@ impl<'de> Deserialize<'de> for Public { } /// An Schnorrkel/Ristretto x25519 ("sr25519") signature. -/// -/// Instead of importing it for the local module, alias it to be available as a public type #[cfg_attr(feature = "full_crypto", derive(Hash))] #[derive(Encode, Decode, MaxEncodedLen, PassByInner, TypeInfo, PartialEq, Eq)] pub struct Signature(pub [u8; 64]); @@ -545,43 +541,194 @@ impl CryptoType for Pair { type Pair = Pair; } -/// Batch verification. -/// -/// `messages`, `signatures` and `pub_keys` should all have equal length. -/// -/// Returns `true` if all signatures are correct, `false` otherwise. -#[cfg(feature = "std")] -pub fn verify_batch( - messages: Vec<&[u8]>, - signatures: Vec<&Signature>, - pub_keys: Vec<&Public>, -) -> bool { - let mut sr_pub_keys = Vec::with_capacity(pub_keys.len()); - for pub_key in pub_keys { - match schnorrkel::PublicKey::from_bytes(pub_key.as_ref()) { - Ok(pk) => sr_pub_keys.push(pk), - Err(_) => return false, - }; +/// Schnorrkel VRF related types and operations. +pub mod vrf { + use super::*; + #[cfg(feature = "full_crypto")] + use crate::crypto::VrfSigner; + use crate::crypto::{VrfCrypto, VrfVerifier}; + use schnorrkel::{ + errors::MultiSignatureStage, + vrf::{VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH}, + SignatureError, + }; + + /// VRF transcript ready to be used for VRF sign/verify operations. + pub struct VrfTranscript(pub merlin::Transcript); + + impl VrfTranscript { + /// Build a new transcript ready to be used by a VRF signer/verifier. + pub fn new(label: &'static [u8], data: &[(&'static [u8], &[u8])]) -> Self { + let mut transcript = merlin::Transcript::new(label); + data.iter().for_each(|(l, b)| transcript.append_message(l, b)); + VrfTranscript(transcript) + } } - let mut sr_signatures = Vec::with_capacity(signatures.len()); - for signature in signatures { - match schnorrkel::Signature::from_bytes(signature.as_ref()) { - Ok(s) => sr_signatures.push(s), - Err(_) => return false, - }; + /// VRF signature data + #[derive(Clone, Debug, PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo)] + pub struct VrfSignature { + /// The initial VRF configuration + pub output: VrfOutput, + /// The calculated VRF proof + pub proof: VrfProof, + } + + /// VRF output type suitable for schnorrkel operations. + #[derive(Clone, Debug, PartialEq, Eq)] + pub struct VrfOutput(pub schnorrkel::vrf::VRFOutput); + + impl Encode for VrfOutput { + fn encode(&self) -> Vec { + self.0.as_bytes().encode() + } + } + + impl Decode for VrfOutput { + fn decode(i: &mut R) -> Result { + let decoded = <[u8; VRF_OUTPUT_LENGTH]>::decode(i)?; + Ok(Self(schnorrkel::vrf::VRFOutput::from_bytes(&decoded).map_err(convert_error)?)) + } } - let mut messages: Vec = messages - .into_iter() - .map(|msg| signing_context(SIGNING_CTX).bytes(msg)) - .collect(); + impl MaxEncodedLen for VrfOutput { + fn max_encoded_len() -> usize { + <[u8; VRF_OUTPUT_LENGTH]>::max_encoded_len() + } + } + + impl TypeInfo for VrfOutput { + type Identity = [u8; VRF_OUTPUT_LENGTH]; + + fn type_info() -> scale_info::Type { + Self::Identity::type_info() + } + } + + /// VRF proof type suitable for schnorrkel operations. + #[derive(Clone, Debug, PartialEq, Eq)] + pub struct VrfProof(pub schnorrkel::vrf::VRFProof); + + impl Encode for VrfProof { + fn encode(&self) -> Vec { + self.0.to_bytes().encode() + } + } + + impl Decode for VrfProof { + fn decode(i: &mut R) -> Result { + let decoded = <[u8; VRF_PROOF_LENGTH]>::decode(i)?; + Ok(Self(schnorrkel::vrf::VRFProof::from_bytes(&decoded).map_err(convert_error)?)) + } + } + + impl MaxEncodedLen for VrfProof { + fn max_encoded_len() -> usize { + <[u8; VRF_PROOF_LENGTH]>::max_encoded_len() + } + } - schnorrkel::verify_batch(&mut messages, &sr_signatures, &sr_pub_keys, true).is_ok() + impl TypeInfo for VrfProof { + type Identity = [u8; VRF_PROOF_LENGTH]; + + fn type_info() -> scale_info::Type { + Self::Identity::type_info() + } + } + + #[cfg(feature = "full_crypto")] + impl VrfCrypto for Pair { + type VrfSignature = VrfSignature; + type VrfInput = VrfTranscript; + } + + #[cfg(feature = "full_crypto")] + impl VrfSigner for Pair { + fn vrf_sign(&self, transcript: &Self::VrfInput) -> Self::VrfSignature { + let (inout, proof, _) = self.0.vrf_sign(transcript.0.clone()); + VrfSignature { output: VrfOutput(inout.to_output()), proof: VrfProof(proof) } + } + } + + impl VrfCrypto for Public { + type VrfSignature = VrfSignature; + type VrfInput = VrfTranscript; + } + + impl VrfVerifier for Public { + fn vrf_verify(&self, transcript: &Self::VrfInput, signature: &Self::VrfSignature) -> bool { + schnorrkel::PublicKey::from_bytes(self) + .and_then(|public| { + public.vrf_verify(transcript.0.clone(), &signature.output.0, &signature.proof.0) + }) + .is_ok() + } + } + + fn convert_error(e: SignatureError) -> codec::Error { + use MultiSignatureStage::*; + use SignatureError::*; + match e { + EquationFalse => "Signature error: `EquationFalse`".into(), + PointDecompressionError => "Signature error: `PointDecompressionError`".into(), + ScalarFormatError => "Signature error: `ScalarFormatError`".into(), + NotMarkedSchnorrkel => "Signature error: `NotMarkedSchnorrkel`".into(), + BytesLengthError { .. } => "Signature error: `BytesLengthError`".into(), + MuSigAbsent { musig_stage: Commitment } => + "Signature error: `MuSigAbsent` at stage `Commitment`".into(), + MuSigAbsent { musig_stage: Reveal } => + "Signature error: `MuSigAbsent` at stage `Reveal`".into(), + MuSigAbsent { musig_stage: Cosignature } => + "Signature error: `MuSigAbsent` at stage `Commitment`".into(), + MuSigInconsistent { musig_stage: Commitment, duplicate: true } => + "Signature error: `MuSigInconsistent` at stage `Commitment` on duplicate".into(), + MuSigInconsistent { musig_stage: Commitment, duplicate: false } => + "Signature error: `MuSigInconsistent` at stage `Commitment` on not duplicate".into(), + MuSigInconsistent { musig_stage: Reveal, duplicate: true } => + "Signature error: `MuSigInconsistent` at stage `Reveal` on duplicate".into(), + MuSigInconsistent { musig_stage: Reveal, duplicate: false } => + "Signature error: `MuSigInconsistent` at stage `Reveal` on not duplicate".into(), + MuSigInconsistent { musig_stage: Cosignature, duplicate: true } => + "Signature error: `MuSigInconsistent` at stage `Cosignature` on duplicate".into(), + MuSigInconsistent { musig_stage: Cosignature, duplicate: false } => + "Signature error: `MuSigInconsistent` at stage `Cosignature` on not duplicate" + .into(), + } + } + + #[cfg(feature = "full_crypto")] + impl Pair { + /// Generate bytes from the given VRF configuration. + pub fn make_bytes>( + &self, + context: &[u8], + transcript: &VrfTranscript, + ) -> B { + let inout = self.0.vrf_create_hash(transcript.0.clone()); + inout.make_bytes::(context) + } + } + + impl Public { + /// Generate bytes from the given VRF configuration. + pub fn make_bytes>( + &self, + context: &[u8], + transcript: &VrfTranscript, + output: &VrfOutput, + ) -> Result { + let pubkey = schnorrkel::PublicKey::from_bytes(&self.0).map_err(convert_error)?; + let inout = output + .0 + .attach_input_hash(&pubkey, transcript.0.clone()) + .map_err(convert_error)?; + Ok(inout.make_bytes::(context)) + } + } } #[cfg(test)] -mod compatibility_test { +mod tests { use super::*; use crate::crypto::{Ss58Codec, DEV_ADDRESS, DEV_PHRASE}; use serde_json; @@ -811,4 +958,20 @@ mod compatibility_test { // Poorly-sized assert!(deserialize_signature("\"abc123\"").is_err()); } + + #[test] + fn vrf_make_bytes_matches() { + use super::vrf::*; + use crate::crypto::VrfSigner; + let pair = Pair::from_seed(b"12345678901234567890123456789012"); + let public = pair.public(); + let transcript = VrfTranscript::new(b"test", &[(b"foo", b"bar")]); + + let signature = pair.vrf_sign(&transcript); + + let ctx = b"randbytes"; + let b1 = pair.make_bytes::<[u8; 32]>(ctx, &transcript); + let b2 = public.make_bytes::<[u8; 32]>(ctx, &transcript, &signature.output).unwrap(); + assert_eq!(b1, b2); + } } diff --git a/primitives/keystore/Cargo.toml b/primitives/keystore/Cargo.toml index 543f01059412e..6b0194247219a 100644 --- a/primitives/keystore/Cargo.toml +++ b/primitives/keystore/Cargo.toml @@ -15,9 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } futures = "0.3.21" -merlin = { version = "2.0", default-features = false } parking_lot = { version = "0.12.1", default-features = false } -schnorrkel = { version = "0.9.1", default-features = false, features = ["preaudit_deprecated", "u64_backend"] } serde = { version = "1.0", optional = true } thiserror = "1.0" sp-core = { version = "7.0.0", default-features = false, path = "../core" } @@ -31,8 +29,6 @@ rand_chacha = "0.2.2" default = ["std"] std = [ "codec/std", - "merlin/std", - "schnorrkel/std", "serde", "sp-core/std", "sp-externalities/std", diff --git a/primitives/keystore/src/lib.rs b/primitives/keystore/src/lib.rs index 577969cdfecd8..5b41f3b80043d 100644 --- a/primitives/keystore/src/lib.rs +++ b/primitives/keystore/src/lib.rs @@ -16,10 +16,9 @@ // limitations under the License. //! Keystore traits + pub mod testing; -pub mod vrf; -use crate::vrf::{VRFSignature, VRFTranscriptData}; use sp_core::{ crypto::{ByteArray, CryptoTypeId, KeyTypeId}, ecdsa, ed25519, sr25519, @@ -87,8 +86,8 @@ pub trait Keystore: Send + Sync { &self, key_type: KeyTypeId, public: &sr25519::Public, - transcript_data: VRFTranscriptData, - ) -> Result, Error>; + transcript: &sr25519::vrf::VrfTranscript, + ) -> Result, Error>; /// Returns all ed25519 public keys for the given key type. fn ed25519_public_keys(&self, key_type: KeyTypeId) -> Vec; diff --git a/primitives/keystore/src/testing.rs b/primitives/keystore/src/testing.rs index e5107cba746f2..a6fcd6e26abe3 100644 --- a/primitives/keystore/src/testing.rs +++ b/primitives/keystore/src/testing.rs @@ -17,15 +17,13 @@ //! Types that should only be used for testing! +use crate::{Error, Keystore, KeystorePtr}; + use sp_core::{ - crypto::{ByteArray, KeyTypeId, Pair}, + crypto::{ByteArray, KeyTypeId, Pair, VrfSigner}, ecdsa, ed25519, sr25519, }; -use crate::{ - vrf::{make_transcript, VRFSignature, VRFTranscriptData}, - Error, Keystore, KeystorePtr, -}; use parking_lot::RwLock; use std::{collections::HashMap, sync::Arc}; @@ -100,6 +98,16 @@ impl MemoryKeystore { let sig = self.pair::(key_type, public).map(|pair| pair.sign(msg)); Ok(sig) } + + fn vrf_sign( + &self, + key_type: KeyTypeId, + public: &T::Public, + transcript: &T::VrfInput, + ) -> Result, Error> { + let sig = self.pair::(key_type, public).map(|pair| pair.vrf_sign(transcript)); + Ok(sig) + } } impl Keystore for MemoryKeystore { @@ -128,14 +136,9 @@ impl Keystore for MemoryKeystore { &self, key_type: KeyTypeId, public: &sr25519::Public, - transcript_data: VRFTranscriptData, - ) -> Result, Error> { - let sig = self.pair::(key_type, public).map(|pair| { - let transcript = make_transcript(transcript_data); - let (inout, proof, _) = pair.as_ref().vrf_sign(transcript); - VRFSignature { output: inout.to_output(), proof } - }); - Ok(sig) + transcript: &sr25519::vrf::VrfTranscript, + ) -> Result, Error> { + self.vrf_sign::(key_type, public, transcript) } fn ed25519_public_keys(&self, key_type: KeyTypeId) -> Vec { @@ -225,7 +228,6 @@ impl Into for MemoryKeystore { #[cfg(test)] mod tests { use super::*; - use crate::vrf::VRFTranscriptValue; use sp_core::{ sr25519, testing::{ECDSA, ED25519, SR25519}, @@ -265,23 +267,23 @@ mod tests { let secret_uri = "//Alice"; let key_pair = sr25519::Pair::from_string(secret_uri, None).expect("Generates key pair"); - let transcript_data = VRFTranscriptData { - label: b"Test", - items: vec![ - ("one", VRFTranscriptValue::U64(1)), - ("two", VRFTranscriptValue::U64(2)), - ("three", VRFTranscriptValue::Bytes("test".as_bytes().to_vec())), + let transcript = sr25519::vrf::VrfTranscript::new( + b"Test", + &[ + (b"one", &1_u64.to_le_bytes()), + (b"two", &2_u64.to_le_bytes()), + (b"three", "test".as_bytes()), ], - }; + ); - let result = store.sr25519_vrf_sign(SR25519, &key_pair.public(), transcript_data.clone()); + let result = store.sr25519_vrf_sign(SR25519, &key_pair.public(), &transcript); assert!(result.unwrap().is_none()); store .insert(SR25519, secret_uri, key_pair.public().as_ref()) .expect("Inserts unknown key"); - let result = store.sr25519_vrf_sign(SR25519, &key_pair.public(), transcript_data); + let result = store.sr25519_vrf_sign(SR25519, &key_pair.public(), &transcript); assert!(result.unwrap().is_some()); } diff --git a/primitives/keystore/src/vrf.rs b/primitives/keystore/src/vrf.rs deleted file mode 100644 index e089336c1485b..0000000000000 --- a/primitives/keystore/src/vrf.rs +++ /dev/null @@ -1,94 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! VRF-specifc data types and helpers - -use codec::Encode; -use merlin::Transcript; -use schnorrkel::vrf::{VRFOutput, VRFProof}; - -/// An enum whose variants represent possible -/// accepted values to construct the VRF transcript -#[derive(Clone, Encode)] -#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] -pub enum VRFTranscriptValue { - /// Value is an array of bytes - Bytes(Vec), - /// Value is a u64 integer - U64(u64), -} -/// VRF Transcript data -#[derive(Clone, Encode)] -pub struct VRFTranscriptData { - /// The transcript's label - pub label: &'static [u8], - /// Additional data to be registered into the transcript - pub items: Vec<(&'static str, VRFTranscriptValue)>, -} -/// VRF signature data -pub struct VRFSignature { - /// The VRFOutput serialized - pub output: VRFOutput, - /// The calculated VRFProof - pub proof: VRFProof, -} - -/// Construct a `Transcript` object from data. -/// -/// Returns `merlin::Transcript` -pub fn make_transcript(data: VRFTranscriptData) -> Transcript { - let mut transcript = Transcript::new(data.label); - for (label, value) in data.items.into_iter() { - match value { - VRFTranscriptValue::Bytes(bytes) => { - transcript.append_message(label.as_bytes(), &bytes); - }, - VRFTranscriptValue::U64(val) => { - transcript.append_u64(label.as_bytes(), val); - }, - } - } - transcript -} - -#[cfg(test)] -mod tests { - use super::*; - use rand::RngCore; - use rand_chacha::{rand_core::SeedableRng, ChaChaRng}; - - #[test] - fn transcript_creation_matches() { - let mut orig_transcript = Transcript::new(b"My label"); - orig_transcript.append_u64(b"one", 1); - orig_transcript.append_message(b"two", "test".as_bytes()); - - let new_transcript = make_transcript(VRFTranscriptData { - label: b"My label", - items: vec![ - ("one", VRFTranscriptValue::U64(1)), - ("two", VRFTranscriptValue::Bytes("test".as_bytes().to_vec())), - ], - }); - let test = |t: Transcript| -> [u8; 16] { - let mut b = [0u8; 16]; - t.build_rng().finalize(&mut ChaChaRng::from_seed([0u8; 32])).fill_bytes(&mut b); - b - }; - debug_assert!(test(orig_transcript) == test(new_transcript)); - } -} From 54ce95eb1f11f4d30277f1ec47a4398cdf8896d8 Mon Sep 17 00:00:00 2001 From: gupnik <17176722+gupnik@users.noreply.github.com> Date: Wed, 19 Apr 2023 16:24:19 +0530 Subject: [PATCH 47/93] Adds example for dev_mode and updates doc (#13944) * Adds example for dev_mode and updates doc * Addresses review comments * Update frame/examples/dev-mode/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Addresses review comment --------- Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- Cargo.lock | 16 ++++ Cargo.toml | 1 + frame/examples/dev-mode/Cargo.toml | 42 +++++++++ frame/examples/dev-mode/README.md | 11 +++ frame/examples/dev-mode/src/lib.rs | 118 ++++++++++++++++++++++++ frame/examples/dev-mode/src/tests.rs | 130 +++++++++++++++++++++++++++ frame/support/procedural/src/lib.rs | 2 + 7 files changed, 320 insertions(+) create mode 100644 frame/examples/dev-mode/Cargo.toml create mode 100644 frame/examples/dev-mode/README.md create mode 100644 frame/examples/dev-mode/src/lib.rs create mode 100644 frame/examples/dev-mode/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 26fb7c4ae1950..c7f74a495d2fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5986,6 +5986,22 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-dev-mode" +version = "4.0.0-dev" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" diff --git a/Cargo.toml b/Cargo.toml index 507d7621000b5..82e2264a3a2c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -106,6 +106,7 @@ members = [ "frame/election-provider-support/solution-type/fuzzer", "frame/examples/basic", "frame/examples/offchain-worker", + "frame/examples/dev-mode", "frame/executive", "frame/nis", "frame/grandpa", diff --git a/frame/examples/dev-mode/Cargo.toml b/frame/examples/dev-mode/Cargo.toml new file mode 100644 index 0000000000000..a1f8de4b09d74 --- /dev/null +++ b/frame/examples/dev-mode/Cargo.toml @@ -0,0 +1,42 @@ +[package] +name = "pallet-dev-mode" +version = "4.0.0-dev" +authors = ["Parity Technologies "] +edition = "2021" +license = "MIT-0" +homepage = "https://substrate.io" +repository = "https://github.com/paritytech/substrate/" +description = "FRAME example pallet" +readme = "README.md" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } +log = { version = "0.4.17", default-features = false } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" } +frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" } +pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../balances" } +sp-io = { version = "7.0.0", default-features = false, path = "../../../primitives/io" } +sp-runtime = { version = "7.0.0", default-features = false, path = "../../../primitives/runtime" } +sp-std = { version = "5.0.0", default-features = false, path = "../../../primitives/std" } + +[dev-dependencies] +sp-core = { version = "7.0.0", default-features = false, path = "../../../primitives/core" } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "log/std", + "pallet-balances/std", + "scale-info/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", +] +try-runtime = ["frame-support/try-runtime"] diff --git a/frame/examples/dev-mode/README.md b/frame/examples/dev-mode/README.md new file mode 100644 index 0000000000000..4c9ee88629c23 --- /dev/null +++ b/frame/examples/dev-mode/README.md @@ -0,0 +1,11 @@ + +# Dev Mode Example Pallet + +A simple example of a FRAME pallet demonstrating +the ease of requirements for a pallet in dev mode. + +Run `cargo doc --package pallet-dev-mode --open` to view this pallet's documentation. + +**Dev mode is not meant to be used in production.** + +License: MIT-0 diff --git a/frame/examples/dev-mode/src/lib.rs b/frame/examples/dev-mode/src/lib.rs new file mode 100644 index 0000000000000..dbc302f4997d4 --- /dev/null +++ b/frame/examples/dev-mode/src/lib.rs @@ -0,0 +1,118 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! +//! # Dev Mode Example Pallet +//! +//! A simple example of a FRAME pallet demonstrating +//! the ease of requirements for a pallet in dev mode. +//! +//! Run `cargo doc --package pallet-dev-mode --open` to view this pallet's documentation. +//! +//! **Dev mode is not meant to be used in production.** + +// Ensure we're `no_std` when compiling for Wasm. +#![cfg_attr(not(feature = "std"), no_std)] + +use frame_support::dispatch::DispatchResult; +use frame_system::ensure_signed; + +// Re-export pallet items so that they can be accessed from the crate namespace. +pub use pallet::*; + +#[cfg(test)] +mod tests; + +/// A type alias for the balance type from this pallet's point of view. +type BalanceOf = ::Balance; + +/// Enable `dev_mode` for this pallet. +#[frame_support::pallet(dev_mode)] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + #[pallet::config] + pub trait Config: pallet_balances::Config + frame_system::Config { + /// The overarching event type. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + } + + // Simple declaration of the `Pallet` type. It is placeholder we use to implement traits and + // method. + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::call] + impl Pallet { + #[pallet::call_index(0)] + /// No need to define a `weight` attribute here because of `dev_mode`. + pub fn add_dummy(origin: OriginFor, id: T::AccountId) -> DispatchResult { + ensure_root(origin)?; + + if let Some(mut dummies) = Dummy::::get() { + dummies.push(id.clone()); + Dummy::::set(Some(dummies)); + } else { + Dummy::::set(Some(vec![id.clone()])); + } + + // Let's deposit an event to let the outside world know this happened. + Self::deposit_event(Event::AddDummy { account: id }); + + Ok(()) + } + + #[pallet::call_index(1)] + /// No need to define a `weight` attribute here because of `dev_mode`. + pub fn set_bar( + origin: OriginFor, + #[pallet::compact] new_value: T::Balance, + ) -> DispatchResult { + let sender = ensure_signed(origin)?; + + // Put the new value into storage. + >::insert(&sender, new_value); + + Self::deposit_event(Event::SetBar { account: sender, balance: new_value }); + + Ok(()) + } + } + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + AddDummy { account: T::AccountId }, + SetBar { account: T::AccountId, balance: BalanceOf }, + } + + /// The MEL requirement for bounded pallets is skipped by `dev_mode`. + /// This means that all storages are marked as unbounded. + /// This is equivalent to specifying `#[pallet::unbounded]` on this type definitions. + /// When the dev_mode is removed, we would need to implement implement `MaxEncodedLen`. + #[pallet::storage] + pub type Dummy = StorageValue<_, Vec>; + + /// The Hasher requirement is skipped by `dev_mode`. So, second parameter can be `_` + /// and `Blake2_128Concat` is used as a default. + /// When the dev_mode is removed, we would need to specify the hasher like so: + /// `pub type Bar = StorageMap<_, Blake2_128Concat, T::AccountId, T::Balance>;`. + #[pallet::storage] + pub type Bar = StorageMap<_, _, T::AccountId, T::Balance>; +} diff --git a/frame/examples/dev-mode/src/tests.rs b/frame/examples/dev-mode/src/tests.rs new file mode 100644 index 0000000000000..e2f06ddda6cd7 --- /dev/null +++ b/frame/examples/dev-mode/src/tests.rs @@ -0,0 +1,130 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Tests for pallet-dev-mode. + +use crate::*; +use frame_support::{assert_ok, traits::ConstU64}; +use sp_core::H256; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, +}; +// Reexport crate as its pallet name for construct_runtime. +use crate as pallet_dev_mode; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +// For testing the pallet, we construct a mock runtime. +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + Example: pallet_dev_mode::{Pallet, Call, Storage, Event}, + } +); + +impl frame_system::Config for Test { + type BaseCallFilter = frame_support::traits::Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type RuntimeCall = RuntimeCall; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = ConstU64<250>; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +impl pallet_balances::Config for Test { + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type Balance = u64; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ConstU64<1>; + type AccountStore = System; + type WeightInfo = (); + type FreezeIdentifier = (); + type MaxFreezes = (); + type HoldIdentifier = (); + type MaxHolds = (); +} + +impl Config for Test { + type RuntimeEvent = RuntimeEvent; +} + +// This function basically just builds a genesis storage key/value store according to +// our desired mockup. +pub fn new_test_ext() -> sp_io::TestExternalities { + let t = GenesisConfig { + // We use default for brevity, but you can configure as desired if needed. + system: Default::default(), + balances: Default::default(), + } + .build_storage() + .unwrap(); + t.into() +} + +#[test] +fn it_works_for_optional_value() { + new_test_ext().execute_with(|| { + assert_eq!(Dummy::::get(), None); + + let val1 = 42; + assert_ok!(Example::add_dummy(RuntimeOrigin::root(), val1)); + assert_eq!(Dummy::::get(), Some(vec![val1])); + + // Check that accumulate works when we have Some value in Dummy already. + let val2 = 27; + assert_ok!(Example::add_dummy(RuntimeOrigin::root(), val2)); + assert_eq!(Dummy::::get(), Some(vec![val1, val2])); + }); +} + +#[test] +fn set_dummy_works() { + new_test_ext().execute_with(|| { + let test_val = 133; + assert_ok!(Example::set_bar(RuntimeOrigin::signed(1), test_val.into())); + assert_eq!(Bar::::get(1), Some(test_val)); + }); +} diff --git a/frame/support/procedural/src/lib.rs b/frame/support/procedural/src/lib.rs index ea997752c3a53..33d9ce9473e59 100644 --- a/frame/support/procedural/src/lib.rs +++ b/frame/support/procedural/src/lib.rs @@ -465,6 +465,8 @@ pub fn construct_runtime(input: TokenStream) -> TokenStream { /// * All storages are marked as unbounded, meaning you do not need to implement `MaxEncodedLen` on /// storage types. This is equivalent to specifying `#[pallet::unbounded]` on all storage type /// definitions. +/// * Storage hashers no longer need to be specified and can be replaced by `_`. In dev mode, these +/// will be replaced by `Blake2_128Concat`. /// /// Note that the `dev_mode` argument can only be supplied to the `#[pallet]` or /// `#[frame_support::pallet]` attribute macro that encloses your pallet module. This argument From 50de15d8740a129db9c18a6698fbd183b00326a2 Mon Sep 17 00:00:00 2001 From: Muharem Ismailov Date: Wed, 19 Apr 2023 13:00:27 +0200 Subject: [PATCH 48/93] Collective pallet: max proposal weight (#13771) * collective: max proposal weight * fix test --------- Co-authored-by: parity-processbot <> --- bin/node/runtime/src/lib.rs | 4 ++++ frame/alliance/src/mock.rs | 6 ++++- frame/collective/src/lib.rs | 14 ++++++++++++ frame/collective/src/tests.rs | 42 ++++++++++++++++++++++++++++++++++- frame/utility/src/tests.rs | 2 ++ 5 files changed, 66 insertions(+), 2 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index cdb05d1597629..5722603fe62a5 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -210,6 +210,7 @@ parameter_types! { }) .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) .build_or_panic(); + pub MaxCollectivesProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; } const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct()); @@ -1012,6 +1013,7 @@ impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; type WeightInfo = pallet_collective::weights::SubstrateWeight; type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxCollectivesProposalWeight; } parameter_types! { @@ -1072,6 +1074,7 @@ impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; type WeightInfo = pallet_collective::weights::SubstrateWeight; type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxCollectivesProposalWeight; } type EnsureRootOrHalfCouncil = EitherOfDiverse< @@ -1700,6 +1703,7 @@ impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; type WeightInfo = pallet_collective::weights::SubstrateWeight; type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxCollectivesProposalWeight; } parameter_types! { diff --git a/frame/alliance/src/mock.rs b/frame/alliance/src/mock.rs index 848f6b2a00557..c334a3943b025 100644 --- a/frame/alliance/src/mock.rs +++ b/frame/alliance/src/mock.rs @@ -43,10 +43,12 @@ type AccountId = u64; parameter_types! { pub const BlockHashCount: BlockNumber = 250; + pub BlockWeights: frame_system::limits::BlockWeights = + frame_system::limits::BlockWeights::simple_max(Weight::MAX); } impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; - type BlockWeights = (); + type BlockWeights = BlockWeights; type BlockLength = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; @@ -97,6 +99,7 @@ parameter_types! { pub const MotionDuration: BlockNumber = MOTION_DURATION_IN_BLOCKS; pub const MaxProposals: u32 = 100; pub const MaxMembers: u32 = 100; + pub MaxProposalWeight: Weight = sp_runtime::Perbill::from_percent(50) * BlockWeights::get().max_block; } type AllianceCollective = pallet_collective::Instance1; impl pallet_collective::Config for Test { @@ -109,6 +112,7 @@ impl pallet_collective::Config for Test { type DefaultVote = pallet_collective::PrimeDefaultVote; type WeightInfo = (); type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; } parameter_types! { diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index 0cbf7e97261df..0ecf008fee80e 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -217,6 +217,10 @@ pub mod pallet { /// Origin allowed to set collective members type SetMembersOrigin: EnsureOrigin<::RuntimeOrigin>; + + /// The maximum weight of a dispatch call that can be proposed and executed. + #[pallet::constant] + type MaxProposalWeight: Get; } #[pallet::genesis_config] @@ -667,6 +671,11 @@ impl, I: 'static> Pallet { ) -> Result<(u32, DispatchResultWithPostInfo), DispatchError> { let proposal_len = proposal.encoded_size(); ensure!(proposal_len <= length_bound as usize, Error::::WrongProposalLength); + let proposal_weight = proposal.get_dispatch_info().weight; + ensure!( + proposal_weight.all_lte(T::MaxProposalWeight::get()), + Error::::WrongProposalWeight + ); let proposal_hash = T::Hashing::hash_of(&proposal); ensure!(!>::contains_key(proposal_hash), Error::::DuplicateProposal); @@ -689,6 +698,11 @@ impl, I: 'static> Pallet { ) -> Result<(u32, u32), DispatchError> { let proposal_len = proposal.encoded_size(); ensure!(proposal_len <= length_bound as usize, Error::::WrongProposalLength); + let proposal_weight = proposal.get_dispatch_info().weight; + ensure!( + proposal_weight.all_lte(T::MaxProposalWeight::get()), + Error::::WrongProposalWeight + ); let proposal_hash = T::Hashing::hash_of(&proposal); ensure!(!>::contains_key(proposal_hash), Error::::DuplicateProposal); diff --git a/frame/collective/src/tests.rs b/frame/collective/src/tests.rs index 79dc3becfffc6..4775133ffa2f6 100644 --- a/frame/collective/src/tests.rs +++ b/frame/collective/src/tests.rs @@ -90,10 +90,13 @@ pub type MaxMembers = ConstU32<100>; parameter_types! { pub const MotionDuration: u64 = 3; pub const MaxProposals: u32 = 257; + pub BlockWeights: frame_system::limits::BlockWeights = + frame_system::limits::BlockWeights::simple_max(Weight::MAX); + pub static MaxProposalWeight: Weight = default_max_proposal_weight(); } impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; - type BlockWeights = (); + type BlockWeights = BlockWeights; type BlockLength = (); type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; @@ -127,6 +130,7 @@ impl Config for Test { type DefaultVote = PrimeDefaultVote; type WeightInfo = (); type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; } impl Config for Test { type RuntimeOrigin = RuntimeOrigin; @@ -138,6 +142,7 @@ impl Config for Test { type DefaultVote = MoreThanMajorityThenPrimeDefaultVote; type WeightInfo = (); type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; } impl mock_democracy::Config for Test { type RuntimeEvent = RuntimeEvent; @@ -153,6 +158,7 @@ impl Config for Test { type DefaultVote = PrimeDefaultVote; type WeightInfo = (); type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; } pub struct ExtBuilder {} @@ -201,6 +207,10 @@ fn record(event: RuntimeEvent) -> EventRecord { EventRecord { phase: Phase::Initialization, event, topics: vec![] } } +fn default_max_proposal_weight() -> Weight { + sp_runtime::Perbill::from_percent(80) * BlockWeights::get().max_block +} + #[test] fn motions_basic_environment_works() { ExtBuilder::default().build_and_execute(|| { @@ -209,6 +219,36 @@ fn motions_basic_environment_works() { }); } +#[test] +fn proposal_weight_limit_works() { + ExtBuilder::default().build_and_execute(|| { + let proposal = make_proposal(42); + let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32); + + assert_ok!(Collective::propose( + RuntimeOrigin::signed(1), + 2, + Box::new(proposal.clone()), + proposal_len + )); + + // set a small limit for max proposal weight. + MaxProposalWeight::set(Weight::from_parts(1, 1)); + assert_noop!( + Collective::propose( + RuntimeOrigin::signed(1), + 2, + Box::new(proposal.clone()), + proposal_len + ), + Error::::WrongProposalWeight + ); + + // reset the max weight to default. + MaxProposalWeight::set(default_max_proposal_weight()); + }); +} + #[test] fn close_works() { ExtBuilder::default().build_and_execute(|| { diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index d23c57e69bec5..6f156e318c8cf 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -209,6 +209,7 @@ parameter_types! { pub const MotionDuration: BlockNumber = MOTION_DURATION_IN_BLOCKS; pub const MaxProposals: u32 = 100; pub const MaxMembers: u32 = 100; + pub MaxProposalWeight: Weight = sp_runtime::Perbill::from_percent(50) * BlockWeights::get().max_block; } type CouncilCollective = pallet_collective::Instance1; @@ -222,6 +223,7 @@ impl pallet_collective::Config for Test { type DefaultVote = pallet_collective::PrimeDefaultVote; type WeightInfo = (); type SetMembersOrigin = frame_system::EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; } impl example::Config for Test {} From f9d10fabe04d598d68f8b097cc4905adbb1ad630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 20 Apr 2023 10:53:06 +0200 Subject: [PATCH 49/93] `build_network` doesn't require the `MaintainedTransactionPool` bound (#13959) --- client/service/src/builder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/service/src/builder.rs b/client/service/src/builder.rs index 415fa03a10020..2208c55cf4090 100644 --- a/client/service/src/builder.rs +++ b/client/service/src/builder.rs @@ -60,7 +60,7 @@ use sc_rpc::{ }; use sc_rpc_spec_v2::{chain_head::ChainHeadApiServer, transaction::TransactionApiServer}; use sc_telemetry::{telemetry, ConnectionMessage, Telemetry, TelemetryHandle, SUBSTRATE_INFO}; -use sc_transaction_pool_api::MaintainedTransactionPool; +use sc_transaction_pool_api::{MaintainedTransactionPool, TransactionPool}; use sc_utils::mpsc::{tracing_unbounded, TracingUnboundedSender}; use sp_api::{CallApiAt, ProvideRuntimeApi}; use sp_blockchain::{HeaderBackend, HeaderMetadata}; @@ -756,7 +756,7 @@ where + HeaderBackend + BlockchainEvents + 'static, - TExPool: MaintainedTransactionPool::Hash> + 'static, + TExPool: TransactionPool::Hash> + 'static, TImpQu: ImportQueue + 'static, { let BuildNetworkParams { From 87fd264d52ef8f23716e13b9abda34a63877ec63 Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Thu, 20 Apr 2023 14:02:40 +0200 Subject: [PATCH 50/93] ci: drop skip-if-draft job (#13961) It's been effectively disabled for half a year already, and according to internal discussion we don't want it back. --- .gitlab-ci.yml | 14 -------------- scripts/ci/gitlab/skip_if_draft.sh | 14 -------------- 2 files changed, 28 deletions(-) delete mode 100755 scripts/ci/gitlab/skip_if_draft.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7b0093184cd3..d585d688aa8b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -251,20 +251,6 @@ default: #### stage: .pre -skip-if-draft: - extends: .kubernetes-env - variables: - CI_IMAGE: "paritytech/tools:latest" - stage: .pre - rules: - - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs - script: - - echo "Commit message is ${CI_COMMIT_MESSAGE}" - - echo "Ref is ${CI_COMMIT_REF_NAME}" - - echo "pipeline source is ${CI_PIPELINE_SOURCE}" - - ./scripts/ci/gitlab/skip_if_draft.sh - allow_failure: true - check-crates-publishing-pipeline: stage: .pre extends: diff --git a/scripts/ci/gitlab/skip_if_draft.sh b/scripts/ci/gitlab/skip_if_draft.sh deleted file mode 100755 index cf6ea6a5b3115..0000000000000 --- a/scripts/ci/gitlab/skip_if_draft.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -url="https://api.github.com/repos/paritytech/substrate/pulls/${CI_COMMIT_REF_NAME}" -echo "[+] API URL: $url" - -draft_state=$(curl -H "Authorization: token ${GITHUB_PR_TOKEN}" "$url" | jq -r .draft) -echo "[+] Draft state: $draft_state" - -if [ "$draft_state" = 'true' ]; then - echo "[!] PR is currently a draft, stopping pipeline" - exit 1 -else - echo "[+] PR is not a draft. Proceeding with CI pipeline" - exit 0 -fi From 532edcf9ac691bebd2959ca3fa4cd90d8171ccb3 Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Thu, 20 Apr 2023 14:03:05 +0200 Subject: [PATCH 51/93] replace unused cargo-deny check with a new cargo-deny-licenses job (#13956) * ci: remove the cargo-deny job It's been broken and disabled for quite a while, and per internal discussion there doesn't seem to be any interest in fixing it and actually using the job output for anything. * ci: add new cargo-deny-licenses job It'll run on all PRs and fail if external dependencies with unsuitable licenses are detected. --- .gitlab-ci.yml | 5 - scripts/ci/deny.toml | 212 +++++++++------------------- scripts/ci/gitlab/pipeline/test.yml | 12 +- 3 files changed, 73 insertions(+), 156 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d585d688aa8b7..c6ce21c7e416f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -215,11 +215,6 @@ default: .zombienet-refs: extends: .build-refs -.nightly-pipeline: - rules: - # this job runs only on nightly pipeline with the mentioned variable, against `master` branch - - if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "nightly" - .crates-publishing-variables: variables: CRATESIO_CRATES_OWNER: parity-crate-owner diff --git a/scripts/ci/deny.toml b/scripts/ci/deny.toml index bc41f746cbb1e..f932875937606 100644 --- a/scripts/ci/deny.toml +++ b/scripts/ci/deny.toml @@ -1,87 +1,19 @@ -# This template contains all of the possible sections and their default values - -# Note that all fields that take a lint level have these possible values: -# * deny - An error will be produced and the check will fail -# * warn - A warning will be produced, but the check will not fail -# * allow - No warning or error will be produced, though in some cases a note -# will be - -# The values provided in this template are the default values that will be used -# when any section or field is not specified in your own configuration - -# If 1 or more target triples (and optionally, target_features) are specified, -# only the specified targets will be checked when running `cargo deny check`. -# This means, if a particular package is only ever used as a target specific -# dependency, such as, for example, the `nix` crate only being used via the -# `target_family = "unix"` configuration, that only having windows targets in -# this list would mean the nix crate, as well as any of its exclusive -# dependencies not shared by any other crates, would be ignored, as the target -# list here is effectively saying which targets you are building for. -targets = [ - # The triple can be any string, but only the target triples built in to - # rustc (as of 1.40) can be checked against actual config expressions - #{ triple = "x86_64-unknown-linux-musl" }, - # You can also specify which target_features you promise are enabled for a - # particular target. target_features are currently not validated against - # the actual valid features supported by the target architecture. - #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, -] - -# This section is considered when running `cargo deny check advisories` -# More documentation for the advisories section can be found here: -# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html -[advisories] -# The path where the advisory database is cloned/fetched into -db-path = "~/.cargo/advisory-db" -# The url of the advisory database to use -db-url = "https://github.com/rustsec/advisory-db" -# The lint level for security vulnerabilities -vulnerability = "deny" -# The lint level for unmaintained crates -unmaintained = "warn" -# The lint level for crates that have been yanked from their source registry -yanked = "warn" -# The lint level for crates with security notices. Note that as of -# 2019-12-17 there are no security notice advisories in -# https://github.com/rustsec/advisory-db -notice = "warn" -# A list of advisory IDs to ignore. Note that ignored advisories will still -# output a note when they are encountered. -ignore = [ - #"RUSTSEC-0000-0000", -] -# Threshold for security vulnerabilities, any vulnerability with a CVSS score -# lower than the range specified will be ignored. Note that ignored advisories -# will still output a note when they are encountered. -# * None - CVSS Score 0.0 -# * Low - CVSS Score 0.1 - 3.9 -# * Medium - CVSS Score 4.0 - 6.9 -# * High - CVSS Score 7.0 - 8.9 -# * Critical - CVSS Score 9.0 - 10.0 -#severity-threshold = - -# This section is considered when running `cargo deny check licenses` -# More documentation for the licenses section can be found here: -# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html [licenses] # The lint level for crates which do not have a detectable license unlicensed = "deny" -# List of explictly allowed licenses +# List of explicitly allowed licenses # See https://spdx.org/licenses/ for list of possible licenses -# [possible values: any SPDX 3.7 short identifier (+ optional exception)]. +# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. allow = [ - #"MIT", - #"Apache-2.0", - #"Apache-2.0 WITH LLVM-exception", + "MPL-2.0", ] -# List of explictly disallowed licenses +# List of explicitly disallowed licenses # See https://spdx.org/licenses/ for list of possible licenses -# [possible values: any SPDX 3.7 short identifier (+ optional exception)]. +# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. deny = [ - #"Nokia", ] # Lint level for licenses considered copyleft -copyleft = "allow" +copyleft = "deny" # Blanket approval or denial for OSI-approved or FSF Free/Libre licenses # * both - The license will be approved if it is both OSI-approved *AND* FSF # * either - The license will be approved if it is either OSI-approved *OR* FSF @@ -98,13 +30,69 @@ default = "deny" # The higher the value, the more closely the license text must be to the # canonical license text of a valid SPDX license file. # [possible values: any between 0.0 and 1.0]. -confidence-threshold = 0.9 +confidence-threshold = 0.8 # Allow 1 or more licenses on a per-crate basis, so that particular licenses # aren't accepted for every possible crate as with the normal allow list exceptions = [ - # Each entry is the crate and version constraint, and its specific allow - # list - #{ allow = ["Zlib"], name = "adler32", version = "*" }, + # Each entry is the crate and version constraint, and its specific allow list + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "chain-spec-builder" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "mmr-gadget" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "node-bench" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "node-cli" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "node-inspect" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "node-testing" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-authority-discovery" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-basic-authorship" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-block-builder" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-chain-spec" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-chain-spec-derive" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-cli" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-client-api" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-client-db" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-aura" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-babe" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-babe-rpc" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-beefy" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-beefy-rpc" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-epochs" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-grandpa" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-grandpa-rpc" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-manual-seal" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-pow" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-consensus-slots" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-executor" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-executor-common" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-executor-wasmi" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-executor-wasmtime" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-informant" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-keystore" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-network" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-network-bitswap" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-network-common" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-network-gossip" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-network-light" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-network-sync" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-network-test" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-network-transactions" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-offchain" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-peerset" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-proposer-metrics" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-rpc" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-rpc-api" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-rpc-server" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-rpc-spec-v2" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-runtime-test" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-service" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-service-test" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-state-db" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-storage-monitor" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-sysinfo" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-telemetry" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-tracing" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-transaction-pool" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "sc-transaction-pool-api" }, + { allow = ["GPL-3.0 WITH Classpath-exception-2.0"], name = "subkey" }, ] # Some crates don't have (easily) machine readable licensing information, @@ -113,10 +101,8 @@ exceptions = [ [[licenses.clarify]] # The name of the crate the clarification applies to name = "ring" -# THe optional version constraint for the crate -#version = "*" # The SPDX expression for the license requirements of the crate -expression = "OpenSSL" +expression = "MIT AND ISC AND OpenSSL" # One or more files in the crate's source used as the "source of truth" for # the license expression. If the contents match, the clarification will be used # when running the license check, otherwise the clarification will be ignored @@ -126,67 +112,3 @@ license-files = [ # Each entry is a crate relative path, and the (opaque) hash of its contents { path = "LICENSE", hash = 0xbd0eed23 } ] -[[licenses.clarify]] -name = "webpki" -expression = "ISC" -license-files = [{ path = "LICENSE", hash = 0x001c7e6c }] - -[licenses.private] -# If true, ignores workspace crates that aren't published, or are only -# published to private registries -ignore = false -# One or more private registries that you might publish crates to, if a crate -# is only published to private registries, and ignore is true, the crate will -# not have its license(s) checked -registries = [ - #"https://sekretz.com/registry -] - -# This section is considered when running `cargo deny check bans`. -# More documentation about the 'bans' section can be found here: -# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html -[bans] -# Lint level for when multiple versions of the same crate are detected -multiple-versions = "warn" -# The graph highlighting used when creating dotgraphs for crates -# with multiple versions -# * lowest-version - The path to the lowest versioned duplicate is highlighted -# * simplest-path - The path to the version with the fewest edges is highlighted -# * all - Both lowest-version and simplest-path are used -highlight = "lowest-version" -# List of crates that are allowed. Use with care! -allow = [ - #{ name = "ansi_term", version = "=0.11.0" }, -] -# List of crates to deny -deny = [ - # Each entry the name of a crate and a version range. If version is - # not specified, all versions will be matched. -] -# Certain crates/versions that will be skipped when doing duplicate detection. -skip = [ - #{ name = "ansi_term", version = "=0.11.0" }, -] -# Similarly to `skip` allows you to skip certain crates during duplicate -# detection. Unlike skip, it also includes the entire tree of transitive -# dependencies starting at the specified crate, up to a certain depth, which is -# by default infinite -skip-tree = [ - #{ name = "ansi_term", version = "=0.11.0", depth = 20 }, -] - -# This section is considered when running `cargo deny check sources`. -# More documentation about the 'sources' section can be found here: -# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html -[sources] -# Lint level for what to happen when a crate from a crate registry that is not -# in the allow list is encountered -unknown-registry = "deny" -# Lint level for what to happen when a crate from a git repository that is not -# in the allow list is encountered -unknown-git = "warn" -# List of URLs for allowed crate registries. Defaults to the crates.io index -# if not specified. If it is specified but empty, no registries are allowed. -allow-registry = ["https://github.com/rust-lang/crates.io-index"] -# List of URLs for allowed Git repositories -allow-git = [] diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index bf7803d56505c..7e84694c24775 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -21,27 +21,27 @@ find-fail-ci-phrase: exit 0; fi -cargo-deny: +cargo-deny-licenses: stage: test extends: - .docker-env - - .nightly-pipeline + - .test-refs + variables: + CARGO_DENY_CMD: "cargo deny --all-features check licenses -c ./scripts/ci/deny.toml" script: - rusty-cachier snapshot create - - cargo deny check --hide-inclusion-graph -c ./scripts/ci/deny.toml + - $CARGO_DENY_CMD --hide-inclusion-graph - rusty-cachier cache upload after_script: - !reference [.rusty-cachier, after_script] - echo "___The complete log is in the artifacts___" - - cargo deny check -c ./scripts/ci/deny.toml 2> deny.log + - $CARGO_DENY_CMD 2> deny.log artifacts: name: $CI_COMMIT_SHORT_SHA expire_in: 3 days when: always paths: - deny.log - # FIXME: Temporarily allow to fail. - allow_failure: true cargo-fmt: stage: test From d8c320941ad83bc8aa9b7136776553cd345e5c17 Mon Sep 17 00:00:00 2001 From: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> Date: Thu, 20 Apr 2023 15:38:45 +0300 Subject: [PATCH 52/93] [NFTs] Improve offchain signature validation (#13960) * Improve signature validation * Rework --- frame/nfts/src/common_functions.rs | 25 +++++++++++++++++++++++++ frame/nfts/src/lib.rs | 9 +++------ frame/nfts/src/tests.rs | 28 ++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/frame/nfts/src/common_functions.rs b/frame/nfts/src/common_functions.rs index 1ef6591db02b4..a3486edec23cb 100644 --- a/frame/nfts/src/common_functions.rs +++ b/frame/nfts/src/common_functions.rs @@ -18,6 +18,7 @@ //! Various pieces of common functionality. use crate::*; +use frame_support::pallet_prelude::*; impl, I: 'static> Pallet { /// Get the owner of the item, if the item exists. @@ -30,6 +31,30 @@ impl, I: 'static> Pallet { Collection::::get(collection).map(|i| i.owner) } + /// Validate the `data` was signed by `signer` and the `signature` is correct. + pub fn validate_signature( + data: &Vec, + signature: &T::OffchainSignature, + signer: &T::AccountId, + ) -> DispatchResult { + if signature.verify(&**data, &signer) { + return Ok(()) + } + + // NOTE: for security reasons modern UIs implicitly wrap the data requested to sign into + // , that's why we support both wrapped and raw versions. + let prefix = b""; + let suffix = b""; + let mut wrapped: Vec = Vec::with_capacity(data.len() + prefix.len() + suffix.len()); + wrapped.extend(prefix); + wrapped.extend(data); + wrapped.extend(suffix); + + ensure!(signature.verify(&*wrapped, &signer), Error::::WrongSignature); + + Ok(()) + } + #[cfg(any(test, feature = "runtime-benchmarks"))] pub fn set_next_id(id: T::CollectionId) { NextCollectionId::::set(Some(id)); diff --git a/frame/nfts/src/lib.rs b/frame/nfts/src/lib.rs index f4d0e41593476..4796819df6d2c 100644 --- a/frame/nfts/src/lib.rs +++ b/frame/nfts/src/lib.rs @@ -50,7 +50,7 @@ use frame_support::traits::{ }; use frame_system::Config as SystemConfig; use sp_runtime::{ - traits::{Saturating, StaticLookup, Zero}, + traits::{IdentifyAccount, Saturating, StaticLookup, Verify, Zero}, RuntimeDebug, }; use sp_std::prelude::*; @@ -69,7 +69,6 @@ pub mod pallet { use super::*; use frame_support::{pallet_prelude::*, traits::ExistenceRequirement}; use frame_system::pallet_prelude::*; - use sp_runtime::traits::{IdentifyAccount, Verify}; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); @@ -1841,8 +1840,7 @@ pub mod pallet { signer: T::AccountId, ) -> DispatchResult { let origin = ensure_signed(origin)?; - let msg = Encode::encode(&mint_data); - ensure!(signature.verify(&*msg, &signer), Error::::WrongSignature); + Self::validate_signature(&Encode::encode(&mint_data), &signature, &signer)?; Self::do_mint_pre_signed(origin, mint_data, signer) } @@ -1868,8 +1866,7 @@ pub mod pallet { signer: T::AccountId, ) -> DispatchResult { let origin = ensure_signed(origin)?; - let msg = Encode::encode(&data); - ensure!(signature.verify(&*msg, &signer), Error::::WrongSignature); + Self::validate_signature(&Encode::encode(&data), &signature, &signer)?; Self::do_set_attributes_pre_signed(origin, data, signer) } } diff --git a/frame/nfts/src/tests.rs b/frame/nfts/src/tests.rs index d36f8b54e2b91..4ab12f0506056 100644 --- a/frame/nfts/src/tests.rs +++ b/frame/nfts/src/tests.rs @@ -3140,6 +3140,34 @@ fn add_remove_item_attributes_approval_should_work() { }) } +#[test] +fn validate_signature() { + new_test_ext().execute_with(|| { + let user_1_pair = sp_core::sr25519::Pair::from_string("//Alice", None).unwrap(); + let user_1_signer = MultiSigner::Sr25519(user_1_pair.public()); + let user_1 = user_1_signer.clone().into_account(); + let mint_data: PreSignedMint = PreSignedMint { + collection: 0, + item: 0, + attributes: vec![], + metadata: vec![], + only_account: None, + deadline: 100000, + }; + let encoded_data = Encode::encode(&mint_data); + let signature = MultiSignature::Sr25519(user_1_pair.sign(&encoded_data)); + assert_ok!(Nfts::validate_signature(&encoded_data, &signature, &user_1)); + + let mut wrapped_data: Vec = Vec::new(); + wrapped_data.extend(b""); + wrapped_data.extend(&encoded_data); + wrapped_data.extend(b""); + + let signature = MultiSignature::Sr25519(user_1_pair.sign(&wrapped_data)); + assert_ok!(Nfts::validate_signature(&encoded_data, &signature, &user_1)); + }) +} + #[test] fn pre_signed_mints_should_work() { new_test_ext().execute_with(|| { From 9f0d54a10a055d9809aebc60a0db9890e3530ce0 Mon Sep 17 00:00:00 2001 From: Aaro Altonen <48052676+altonen@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:27:05 +0300 Subject: [PATCH 53/93] Keep track of the pending response for each peer individually (#13941) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Keep track of the pending response for each peer individually When peer disconnects or the syncing is restarted, remove the pending response so syncing won't start sending duplicate requests/receive stale responses from disconnected peers. Before this commit pending responses where stored in `FuturesUnordered` which made it hard to keep track of pending responses for each individual peer. * Update client/network/sync/src/lib.rs Co-authored-by: Bastian Köcher * ".git/.scripts/commands/fmt/fmt.sh" * Apply suggestions from code review Co-authored-by: Dmitry Markin Co-authored-by: Sebastian Kunert * Update client/network/sync/src/lib.rs --------- Co-authored-by: Bastian Köcher Co-authored-by: command-bot <> Co-authored-by: Dmitry Markin Co-authored-by: Sebastian Kunert --- client/network/sync/src/lib.rs | 116 ++++++++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 8 deletions(-) diff --git a/client/network/sync/src/lib.rs b/client/network/sync/src/lib.rs index e112a1715ced1..29c4bc840b2ae 100644 --- a/client/network/sync/src/lib.rs +++ b/client/network/sync/src/lib.rs @@ -344,7 +344,7 @@ pub struct ChainSync { /// Protocol name used to send out warp sync requests warp_sync_protocol_name: Option, /// Pending responses - pending_responses: FuturesUnordered>, + pending_responses: HashMap>, /// Handle to import queue. import_queue: Box>, /// Metrics. @@ -1238,6 +1238,7 @@ where gap_sync.blocks.clear_peer_download(who) } self.peers.remove(who); + self.pending_responses.remove(who); self.extra_justifications.peer_disconnected(who); self.allowed_requests.set_all(); self.fork_targets.retain(|_, target| { @@ -1360,7 +1361,7 @@ where if self.peers.contains_key(&who) { self.pending_responses - .push(Box::pin(async move { (who, PeerRequest::Block(request), rx.await) })); + .insert(who, Box::pin(async move { (who, PeerRequest::Block(request), rx.await) })); } match self.encode_block_request(&opaque_req) { @@ -1457,7 +1458,7 @@ where .notifications_protocol .clone() .into(), - pending_responses: Default::default(), + pending_responses: HashMap::new(), import_queue, metrics: if let Some(r) = &metrics_registry { match SyncingMetrics::register(r) { @@ -1810,6 +1811,9 @@ where return None } + // since the request is not a justification, remove it from pending responses + self.pending_responses.remove(&id); + // handle peers that were in other states. match self.new_peer(id, p.best_hash, p.best_number) { Ok(None) => None, @@ -2009,7 +2013,7 @@ where if self.peers.contains_key(&who) { self.pending_responses - .push(Box::pin(async move { (who, PeerRequest::State, rx.await) })); + .insert(who, Box::pin(async move { (who, PeerRequest::State, rx.await) })); } match self.encode_state_request(&request) { @@ -2037,7 +2041,7 @@ where if self.peers.contains_key(&who) { self.pending_responses - .push(Box::pin(async move { (who, PeerRequest::WarpProof, rx.await) })); + .insert(who, Box::pin(async move { (who, PeerRequest::WarpProof, rx.await) })); } match &self.warp_sync_protocol_name { @@ -2175,9 +2179,20 @@ where } fn poll_pending_responses(&mut self, cx: &mut std::task::Context) -> Poll> { - while let Poll::Ready(Some((id, request, response))) = - self.pending_responses.poll_next_unpin(cx) - { + let ready_responses = self + .pending_responses + .values_mut() + .filter_map(|future| match future.poll_unpin(cx) { + Poll::Pending => None, + Poll::Ready(result) => Some(result), + }) + .collect::>(); + + for (id, request, response) in ready_responses { + self.pending_responses + .remove(&id) + .expect("Logic error: peer id from pending response is missing in the map."); + match response { Ok(Ok(resp)) => match request { PeerRequest::Block(req) => { @@ -4116,4 +4131,89 @@ mod test { let state = AncestorSearchState::::BinarySearch(1, 3); assert!(handle_ancestor_search_state(&state, 2, true).is_none()); } + + #[test] + fn sync_restart_removes_block_but_not_justification_requests() { + let mut client = Arc::new(TestClientBuilder::new().build()); + let block_announce_validator = Box::new(DefaultBlockAnnounceValidator); + let import_queue = Box::new(sc_consensus::import_queue::mock::MockImportQueueHandle::new()); + let (_chain_sync_network_provider, chain_sync_network_handle) = + NetworkServiceProvider::new(); + let (mut sync, _) = ChainSync::new( + SyncMode::Full, + client.clone(), + ProtocolId::from("test-protocol-name"), + &Some(String::from("test-fork-id")), + Roles::from(&Role::Full), + block_announce_validator, + 1, + 64, + None, + None, + chain_sync_network_handle, + import_queue, + ProtocolName::from("block-request"), + ProtocolName::from("state-request"), + None, + ) + .unwrap(); + + let peers = vec![PeerId::random(), PeerId::random()]; + + let mut new_blocks = |n| { + for _ in 0..n { + let block = client.new_block(Default::default()).unwrap().build().unwrap().block; + block_on(client.import(BlockOrigin::Own, block.clone())).unwrap(); + } + + let info = client.info(); + (info.best_hash, info.best_number) + }; + + let (b1_hash, b1_number) = new_blocks(50); + + // add new peer and request blocks from them + sync.new_peer(peers[0], Hash::random(), 42).unwrap(); + + // we wil send block requests to these peers + // for these blocks we don't know about + for (peer, request) in sync.block_requests() { + sync.send_block_request(peer, request); + } + + // add a new peer at a known block + sync.new_peer(peers[1], b1_hash, b1_number).unwrap(); + + // we request a justification for a block we have locally + sync.request_justification(&b1_hash, b1_number); + + // the justification request should be scheduled to the + // new peer which is at the given block + let mut requests = sync.justification_requests().collect::>(); + assert_eq!(requests.len(), 1); + let (peer, request) = requests.remove(0); + sync.send_block_request(peer, request); + + assert!(!std::matches!( + sync.peers.get(&peers[0]).unwrap().state, + PeerSyncState::DownloadingJustification(_), + )); + assert_eq!( + sync.peers.get(&peers[1]).unwrap().state, + PeerSyncState::DownloadingJustification(b1_hash), + ); + assert_eq!(sync.pending_responses.len(), 2); + + let requests = sync.restart().collect::>(); + assert!(requests.iter().any(|res| res.as_ref().unwrap().0 == peers[0])); + + assert_eq!(sync.pending_responses.len(), 1); + assert!(sync.pending_responses.get(&peers[1]).is_some()); + assert_eq!( + sync.peers.get(&peers[1]).unwrap().state, + PeerSyncState::DownloadingJustification(b1_hash), + ); + sync.peer_disconnected(&peers[1]); + assert_eq!(sync.pending_responses.len(), 0); + } } From e44b43e155b795b69595b32b1cbc6b52e9d4c9ac Mon Sep 17 00:00:00 2001 From: Aaro Altonen <48052676+altonen@users.noreply.github.com> Date: Fri, 21 Apr 2023 11:22:26 +0300 Subject: [PATCH 54/93] Evict inactive peers from `SyncingEngine` (#13829) * Evict inactive peers from `SyncingEngine` If both halves of the block announce notification stream have been inactive for 2 minutes, report the peer and disconnect it, allowing `SyncingEngine` to free up a slot for some other peer that hopefully is more active. This needs to be done because the node may falsely believe it has open connections to peers because the inbound substream can be closed without any notification and closed outbound substream is noticed only when node attempts to write to it which may not happen if the node has nothing to send. * zzz * wip * Evict peers only when timeout expires * Use `debug!()` --------- Co-authored-by: parity-processbot <> --- client/network/sync/src/engine.rs | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/client/network/sync/src/engine.rs b/client/network/sync/src/engine.rs index 6fb618a571c25..eca0ebfe41a9f 100644 --- a/client/network/sync/src/engine.rs +++ b/client/network/sync/src/engine.rs @@ -67,6 +67,7 @@ use std::{ Arc, }, task::Poll, + time::{Duration, Instant}, }; /// Interval at which we perform time based maintenance @@ -75,12 +76,19 @@ const TICK_TIMEOUT: std::time::Duration = std::time::Duration::from_millis(1100) /// Maximum number of known block hashes to keep for a peer. const MAX_KNOWN_BLOCKS: usize = 1024; // ~32kb per peer + LruHashSet overhead +/// If the block announces stream to peer has been inactive for two minutes meaning local node +/// has not sent or received block announcements to/from the peer, report the node for inactivity, +/// disconnect it and attempt to establish connection to some other peer. +const INACTIVITY_EVICT_THRESHOLD: Duration = Duration::from_secs(30); + mod rep { use sc_peerset::ReputationChange as Rep; /// Peer has different genesis. pub const GENESIS_MISMATCH: Rep = Rep::new_fatal("Genesis mismatch"); /// Peer send us a block announcement that failed at validation. pub const BAD_BLOCK_ANNOUNCEMENT: Rep = Rep::new(-(1 << 12), "Bad block announcement"); + /// Block announce substream with the peer has been inactive too long + pub const INACTIVE_SUBSTREAM: Rep = Rep::new(-(1 << 10), "Inactive block announce substream"); } struct Metrics { @@ -160,6 +168,10 @@ pub struct Peer { pub known_blocks: LruHashSet, /// Notification sink. sink: NotificationsSink, + /// Instant when the last notification was sent to peer. + last_notification_sent: Instant, + /// Instant when the last notification was received from peer. + last_notification_received: Instant, } pub struct SyncingEngine { @@ -200,6 +212,9 @@ pub struct SyncingEngine { /// All connected peers. Contains both full and light node peers. peers: HashMap>, + /// Evicted peers + evicted: HashSet, + /// List of nodes for which we perform additional logging because they are important for the /// user. important_peers: HashSet, @@ -353,6 +368,7 @@ where chain_sync, network_service, peers: HashMap::new(), + evicted: HashSet::new(), block_announce_data_cache: LruCache::new(cache_capacity), block_announce_protocol_name, num_connected: num_connected.clone(), @@ -516,6 +532,7 @@ where }, }; peer.known_blocks.insert(hash); + peer.last_notification_received = Instant::now(); if peer.info.roles.is_full() { let is_best = match announce.state.unwrap_or(BlockState::Best) { @@ -566,6 +583,7 @@ where data: Some(data.clone()), }; + peer.last_notification_sent = Instant::now(); peer.sink.send_sync_notification(message.encode()); } } @@ -596,6 +614,35 @@ where while let Poll::Ready(()) = self.tick_timeout.poll_unpin(cx) { self.report_metrics(); + + // go over all connected peers and check if any of them have been idle for a while. Idle + // in this case means that we haven't sent or received block announcements to/from this + // peer. If that is the case, because of #5685, it could be that the block announces + // substream is not actually open and and this peer is just wasting a slot and is should + // be replaced with some other node that is willing to send us block announcements. + for (id, peer) in self.peers.iter() { + // because of a delay between disconnecting a peer in `SyncingEngine` and getting + // the response back from `Protocol`, a peer might be reported and disconnect + // multiple times. To prevent this from happening (until the underlying issue is + // fixed), keep track of evicted peers and report and disconnect them only once. + if self.evicted.contains(id) { + continue + } + + let last_received_late = + peer.last_notification_received.elapsed() > INACTIVITY_EVICT_THRESHOLD; + let last_sent_late = + peer.last_notification_sent.elapsed() > INACTIVITY_EVICT_THRESHOLD; + + if last_received_late && last_sent_late { + log::debug!(target: "sync", "evict peer {id} since it has been idling for too long"); + self.network_service.report_peer(*id, rep::INACTIVE_SUBSTREAM); + self.network_service + .disconnect_peer(*id, self.block_announce_protocol_name.clone()); + self.evicted.insert(*id); + } + } + self.tick_timeout.reset(TICK_TIMEOUT); } @@ -692,6 +739,7 @@ where }, }, sc_network::SyncEvent::NotificationStreamClosed { remote } => { + self.evicted.remove(&remote); if self.on_sync_peer_disconnected(remote).is_err() { log::trace!( target: "sync", @@ -844,6 +892,8 @@ where NonZeroUsize::new(MAX_KNOWN_BLOCKS).expect("Constant is nonzero"), ), sink, + last_notification_sent: Instant::now(), + last_notification_received: Instant::now(), }; let req = if peer.info.roles.is_full() { From dad40923604250c47d99f3801a61bde1dc36664e Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 21 Apr 2023 18:46:54 +1000 Subject: [PATCH 55/93] `balances` `impl_currency` WithdrawReasons note (#13964) * add withdrawreason note * improve comment * Update frame/balances/src/impl_currency.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * cargo fmt +nightly --------- Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- frame/balances/src/impl_currency.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frame/balances/src/impl_currency.rs b/frame/balances/src/impl_currency.rs index 329ea289f966e..ff8cc71d6224a 100644 --- a/frame/balances/src/impl_currency.rs +++ b/frame/balances/src/impl_currency.rs @@ -16,6 +16,9 @@ // limitations under the License. //! Implementations for the `Currency` family of traits. +//! +//! Note that `WithdrawReasons` are intentionally not used for anything in this implementation and +//! are expected to be removed in the near future, once migration to `fungible::*` traits is done. use super::*; use frame_support::{ From 2059dca9764f2f28c91011f6db2e74516142cb32 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 21 Apr 2023 19:16:40 +1000 Subject: [PATCH 56/93] try-runtime: dynamic storage query sizes (#13923) * improve batch rpc error message * wip aimd storage data fetch * complete aimd function refactor * make batch_request function async * improve function name * fix load_child_remote issue * slight efficiency improvement * improve logs and variable name * remove redundant comment * improve comment * address pr comments * Update utils/frame/remote-externalities/src/lib.rs Co-authored-by: Niklas Adolfsson * simplify client handling * fix type issue * fix clippy issue * try to trigger ci * try to trigger ci --------- Co-authored-by: Niklas Adolfsson --- Cargo.lock | 34 ++ utils/frame/remote-externalities/Cargo.toml | 2 + utils/frame/remote-externalities/src/lib.rs | 519 +++++++++++--------- utils/frame/try-runtime/cli/src/lib.rs | 12 - 4 files changed, 323 insertions(+), 244 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7f74a495d2fe..b316993185862 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -395,6 +395,17 @@ dependencies = [ "futures-lite", ] +[[package]] +name = "async-recursion" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.14", +] + [[package]] name = "async-stream" version = "0.3.4" @@ -2427,8 +2438,10 @@ dependencies = [ name = "frame-remote-externalities" version = "0.10.0-dev" dependencies = [ + "async-recursion", "frame-support", "futures", + "jsonrpsee", "log", "pallet-elections-phragmen", "parity-scale-codec", @@ -3202,6 +3215,7 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls", + "webpki-roots", ] [[package]] @@ -3468,6 +3482,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" dependencies = [ "jsonrpsee-core", + "jsonrpsee-http-client", "jsonrpsee-proc-macros", "jsonrpsee-server", "jsonrpsee-types", @@ -3524,6 +3539,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "jsonrpsee-proc-macros" version = "0.16.2" diff --git a/utils/frame/remote-externalities/Cargo.toml b/utils/frame/remote-externalities/Cargo.toml index 8611ae4980f12..d3909af34451b 100644 --- a/utils/frame/remote-externalities/Cargo.toml +++ b/utils/frame/remote-externalities/Cargo.toml @@ -12,6 +12,7 @@ description = "An externalities provided environment that can load itself from r targets = ["x86_64-unknown-linux-gnu"] [dependencies] +jsonrpsee = { version = "0.16.2", features = ["http-client"] } codec = { package = "parity-scale-codec", version = "3.2.2" } log = "0.4.17" serde = "1.0.136" @@ -22,6 +23,7 @@ sp-runtime = { version = "7.0.0", path = "../../../primitives/runtime" } tokio = { version = "1.22.0", features = ["macros", "rt-multi-thread"] } substrate-rpc-client = { path = "../rpc/client" } futures = "0.3" +async-recursion = "1.0.4" [dev-dependencies] frame-support = { version = "4.0.0-dev", path = "../../../frame/support" } diff --git a/utils/frame/remote-externalities/src/lib.rs b/utils/frame/remote-externalities/src/lib.rs index ee342408828de..b60e2bc75d0db 100644 --- a/utils/frame/remote-externalities/src/lib.rs +++ b/utils/frame/remote-externalities/src/lib.rs @@ -20,8 +20,13 @@ //! An equivalent of `sp_io::TestExternalities` that can load its state from a remote substrate //! based chain, or a local state snapshot file. +use async_recursion::async_recursion; use codec::{Decode, Encode}; use futures::{channel::mpsc, stream::StreamExt}; +use jsonrpsee::{ + core::params::ArrayParams, + http_client::{HttpClient, HttpClientBuilder}, +}; use log::*; use serde::de::DeserializeOwned; use sp_core::{ @@ -35,6 +40,7 @@ use sp_core::{ pub use sp_io::TestExternalities; use sp_runtime::{traits::Block as BlockT, StateVersion}; use std::{ + cmp::max, fs, num::NonZeroUsize, ops::{Deref, DerefMut}, @@ -42,19 +48,14 @@ use std::{ sync::Arc, thread, }; -use substrate_rpc_client::{ - rpc_params, ws_client, BatchRequestBuilder, ChainApi, ClientT, StateApi, WsClient, -}; +use substrate_rpc_client::{rpc_params, BatchRequestBuilder, ChainApi, ClientT, StateApi}; type KeyValue = (StorageKey, StorageData); type TopKeyValues = Vec; type ChildKeyValues = Vec<(ChildInfo, Vec)>; const LOG_TARGET: &str = "remote-ext"; -const DEFAULT_WS_ENDPOINT: &str = "wss://rpc.polkadot.io:443"; -const DEFAULT_VALUE_DOWNLOAD_BATCH: usize = 4096; -// NOTE: increasing this value does not seem to impact speed all that much. -const DEFAULT_KEY_DOWNLOAD_PAGE: u32 = 1000; +const DEFAULT_HTTP_ENDPOINT: &str = "https://rpc.polkadot.io:443"; /// The snapshot that we store on disk. #[derive(Decode, Encode)] struct Snapshot { @@ -117,36 +118,51 @@ pub struct OfflineConfig { pub enum Transport { /// Use the `URI` to open a new WebSocket connection. Uri(String), - /// Use existing WebSocket connection. - RemoteClient(Arc), + /// Use HTTP connection. + RemoteClient(Arc), } impl Transport { - fn as_client(&self) -> Option<&WsClient> { + fn as_client(&self) -> Option<&HttpClient> { match self { Self::RemoteClient(client) => Some(client), _ => None, } } - fn as_client_cloned(&self) -> Option> { + fn as_client_cloned(&self) -> Option> { match self { Self::RemoteClient(client) => Some(client.clone()), _ => None, } } - // Open a new WebSocket connection if it's not connected. - async fn map_uri(&mut self) -> Result<(), &'static str> { + // Build an HttpClient from a URI. + async fn init(&mut self) -> Result<(), &'static str> { if let Self::Uri(uri) = self { log::debug!(target: LOG_TARGET, "initializing remote client to {:?}", uri); - let ws_client = ws_client(uri).await.map_err(|e| { + // If we have a ws uri, try to convert it to an http uri. + // We use an HTTP client rather than WS because WS starts to choke with "accumulated + // message length exceeds maximum" errors after processing ~10k keys when fetching + // from a node running a default configuration. + let uri = if uri.starts_with("ws://") { + let uri = uri.replace("ws://", "http://"); + log::info!(target: LOG_TARGET, "replacing ws:// in uri with http://: {:?} (ws is currently unstable for fetching remote storage, for more see https://github.com/paritytech/jsonrpsee/issues/1086)", uri); + uri + } else if uri.starts_with("wss://") { + let uri = uri.replace("wss://", "https://"); + log::info!(target: LOG_TARGET, "replacing wss:// in uri with https://: {:?} (ws is currently unstable for fetching remote storage, for more see https://github.com/paritytech/jsonrpsee/issues/1086)", uri); + uri + } else { + uri.clone() + }; + let http_client = HttpClientBuilder::default().build(uri).map_err(|e| { log::error!(target: LOG_TARGET, "error: {:?}", e); - "failed to build ws client" + "failed to build http client" })?; - *self = Self::RemoteClient(Arc::new(ws_client)) + *self = Self::RemoteClient(Arc::new(http_client)) } Ok(()) @@ -159,8 +175,8 @@ impl From for Transport { } } -impl From> for Transport { - fn from(client: Arc) -> Self { +impl From> for Transport { + fn from(client: Arc) -> Self { Transport::RemoteClient(client) } } @@ -189,18 +205,18 @@ pub struct OnlineConfig { } impl OnlineConfig { - /// Return rpc (ws) client reference. - fn rpc_client(&self) -> &WsClient { + /// Return rpc (http) client reference. + fn rpc_client(&self) -> &HttpClient { self.transport .as_client() - .expect("ws client must have been initialized by now; qed.") + .expect("http client must have been initialized by now; qed.") } - /// Return a cloned rpc (ws) client, suitable for being moved to threads. - fn rpc_client_cloned(&self) -> Arc { + /// Return a cloned rpc (http) client, suitable for being moved to threads. + fn rpc_client_cloned(&self) -> Arc { self.transport .as_client_cloned() - .expect("ws client must have been initialized by now; qed.") + .expect("http client must have been initialized by now; qed.") } fn at_expected(&self) -> B::Hash { @@ -211,7 +227,7 @@ impl OnlineConfig { impl Default for OnlineConfig { fn default() -> Self { Self { - transport: Transport::from(DEFAULT_WS_ENDPOINT.to_owned()), + transport: Transport::from(DEFAULT_HTTP_ENDPOINT.to_owned()), child_trie: true, at: None, state_snapshot: None, @@ -307,10 +323,16 @@ where B::Hash: DeserializeOwned, B::Header: DeserializeOwned, { + const BATCH_SIZE_INCREASE_FACTOR: f32 = 1.10; + const BATCH_SIZE_DECREASE_FACTOR: f32 = 0.50; + const INITIAL_BATCH_SIZE: usize = 5000; + // NOTE: increasing this value does not seem to impact speed all that much. + const DEFAULT_KEY_DOWNLOAD_PAGE: u32 = 1000; + /// Get the number of threads to use. fn threads() -> NonZeroUsize { thread::available_parallelism() - .unwrap_or(NonZeroUsize::new(4usize).expect("4 is non-zero; qed")) + .unwrap_or(NonZeroUsize::new(1usize).expect("4 is non-zero; qed")) } async fn rpc_get_storage( @@ -352,7 +374,7 @@ where .rpc_client() .storage_keys_paged( Some(prefix.clone()), - DEFAULT_KEY_DOWNLOAD_PAGE, + Self::DEFAULT_KEY_DOWNLOAD_PAGE, last_key.clone(), Some(at), ) @@ -365,7 +387,7 @@ where all_keys.extend(page); - if page_len < DEFAULT_KEY_DOWNLOAD_PAGE as usize { + if page_len < Self::DEFAULT_KEY_DOWNLOAD_PAGE as usize { log::debug!(target: LOG_TARGET, "last page received: {}", page_len); break all_keys } else { @@ -384,6 +406,123 @@ where Ok(keys) } + /// Fetches storage data from a node using a dynamic batch size. + /// + /// This function adjusts the batch size on the fly to help prevent overwhelming the node with + /// large batch requests, and stay within request size limits enforced by the node. + /// + /// # Arguments + /// + /// * `client` - An `Arc` wrapped `HttpClient` used for making the requests. + /// * `payloads` - A vector of tuples containing a JSONRPC method name and `ArrayParams` + /// * `batch_size` - The initial batch size to use for the request. The batch size will be + /// adjusted dynamically in case of failure. + /// + /// # Returns + /// + /// Returns a `Result` with a vector of `Option`, where each element corresponds to + /// the storage data for the given method and parameters. The result will be an `Err` with a + /// `String` error message if the request fails. + /// + /// # Errors + /// + /// This function will return an error if: + /// * The batch request fails and the batch size is less than 2. + /// * There are invalid batch params. + /// * There is an error in the batch response. + /// + /// # Example + /// + /// ```ignore + /// use your_crate::{get_storage_data_dynamic_batch_size, HttpClient, ArrayParams}; + /// use std::sync::Arc; + /// + /// async fn example() { + /// let client = Arc::new(HttpClient::new()); + /// let payloads = vec![ + /// ("some_method".to_string(), ArrayParams::new(vec![])), + /// ("another_method".to_string(), ArrayParams::new(vec![])), + /// ]; + /// let initial_batch_size = 10; + /// + /// let storage_data = get_storage_data_dynamic_batch_size(client, payloads, batch_size).await; + /// match storage_data { + /// Ok(data) => println!("Storage data: {:?}", data), + /// Err(e) => eprintln!("Error fetching storage data: {}", e), + /// } + /// } + /// ``` + #[async_recursion] + async fn get_storage_data_dynamic_batch_size( + client: &Arc, + payloads: Vec<(String, ArrayParams)>, + batch_size: usize, + ) -> Result>, String> { + // All payloads have been processed + if payloads.is_empty() { + return Ok(vec![]) + }; + + log::debug!( + target: LOG_TARGET, + "Remaining payloads: {} Batch request size: {}", + payloads.len(), + batch_size, + ); + + // Payloads to attempt to process this batch + let page = payloads.iter().take(batch_size).cloned().collect::>(); + + // Build the batch request + let mut batch = BatchRequestBuilder::new(); + for (method, params) in page.iter() { + batch + .insert(method, params.clone()) + .map_err(|_| "Invalid batch method and/or params")? + } + let batch_response = match client.batch_request::>(batch).await { + Ok(batch_response) => batch_response, + Err(e) => { + if batch_size < 2 { + return Err(e.to_string()) + } + + log::debug!( + target: LOG_TARGET, + "Batch request failed, trying again with smaller batch size. {}", + e.to_string() + ); + + return Self::get_storage_data_dynamic_batch_size( + client, + payloads, + max(1, (batch_size as f32 * Self::BATCH_SIZE_DECREASE_FACTOR) as usize), + ) + .await + }, + }; + + // Collect the data from this batch + let mut data: Vec> = vec![]; + for item in batch_response.into_iter() { + match item { + Ok(x) => data.push(x), + Err(e) => return Err(e.message().to_string()), + } + } + + // Return this data joined with the remaining keys + let payloads = payloads.iter().skip(batch_size).cloned().collect::>(); + let mut rest = Self::get_storage_data_dynamic_batch_size( + client, + payloads, + max(batch_size + 1, (batch_size as f32 * Self::BATCH_SIZE_INCREASE_FACTOR) as usize), + ) + .await?; + data.append(&mut rest); + Ok(data) + } + /// Synonym of `getPairs` that uses paged queries to first get the keys, and then /// map them to values one by one. /// @@ -428,81 +567,61 @@ where let (tx, mut rx) = mpsc::unbounded::(); for thread_keys in keys_chunked { - let thread_client = client.clone(); let thread_sender = tx.clone(); + let thread_client = client.clone(); let handle = std::thread::spawn(move || { - let rt = tokio::runtime::Runtime::new().unwrap(); - let mut thread_key_values = Vec::with_capacity(thread_keys.len()); - - for chunk_keys in thread_keys.chunks(DEFAULT_VALUE_DOWNLOAD_BATCH) { - let mut batch = BatchRequestBuilder::new(); - - for key in chunk_keys.iter() { - batch - .insert("state_getStorage", rpc_params![key, at]) - .map_err(|_| "Invalid batch params") - .unwrap(); - } - - let batch_response = rt - .block_on(thread_client.batch_request::>(batch)) - .map_err(|e| { - log::error!( - target: LOG_TARGET, - "failed to execute batch: {:?}. Error: {:?}", - chunk_keys.iter().map(HexDisplay::from).collect::>(), - e - ); - "batch failed." - }) - .unwrap(); + // Process the payloads in chunks so each thread can pass kvs back to the main + // thread to start inserting before all of the data has been queried from the node. + // Inserting data takes a very long time, so the earlier it can start the better. + let mut thread_key_values = vec![]; + let chunk_size = thread_keys.len() / 1; + for thread_keys_chunk in thread_keys.chunks(chunk_size) { + let mut thread_key_chunk_values = Vec::with_capacity(thread_keys_chunk.len()); + + let payloads = thread_keys_chunk + .iter() + .map(|key| ("state_getStorage".to_string(), rpc_params!(key, at))) + .collect::>(); + + let rt = tokio::runtime::Runtime::new().unwrap(); + let storage_data = match rt.block_on(Self::get_storage_data_dynamic_batch_size( + &thread_client, + payloads, + Self::INITIAL_BATCH_SIZE, + )) { + Ok(storage_data) => storage_data, + Err(e) => { + thread_sender.unbounded_send(Message::BatchFailed(e)).unwrap(); + return Default::default() + }, + }; // Check if we got responses for all submitted requests. - assert_eq!(chunk_keys.len(), batch_response.len()); + assert_eq!(thread_keys_chunk.len(), storage_data.len()); - let mut batch_kv = Vec::with_capacity(chunk_keys.len()); - for (key, maybe_value) in chunk_keys.into_iter().zip(batch_response) { + let mut batch_kv = Vec::with_capacity(thread_keys_chunk.len()); + for (key, maybe_value) in thread_keys_chunk.iter().zip(storage_data) { match maybe_value { - Ok(Some(data)) => { - thread_key_values.push((key.clone(), data.clone())); + Some(data) => { + thread_key_chunk_values.push((key.clone(), data.clone())); batch_kv.push((key.clone().0, data.0)); }, - Ok(None) => { + None => { log::warn!( target: LOG_TARGET, "key {:?} had none corresponding value.", &key ); let data = StorageData(vec![]); - thread_key_values.push((key.clone(), data.clone())); + thread_key_chunk_values.push((key.clone(), data.clone())); batch_kv.push((key.clone().0, data.0)); }, - Err(e) => { - let reason = format!("key {:?} failed: {:?}", &key, e); - log::error!(target: LOG_TARGET, "Reason: {}", reason); - // Signal failures to the main thread, stop aggregating (key, value) - // pairs and return immediately an error. - thread_sender.unbounded_send(Message::BatchFailed(reason)).unwrap(); - return Default::default() - }, }; - - if thread_key_values.len() % (thread_keys.len() / 10).max(1) == 0 { - let ratio: f64 = - thread_key_values.len() as f64 / thread_keys.len() as f64; - log::debug!( - target: LOG_TARGET, - "[thread = {:?}] progress = {:.2} [{} / {}]", - std::thread::current().id(), - ratio, - thread_key_values.len(), - thread_keys.len(), - ); - } } - // Send this batch to the main thread to start inserting. + // Send this chunk to the main thread to start inserting. thread_sender.unbounded_send(Message::Batch(batch_kv)).unwrap(); + thread_key_values.extend(thread_key_chunk_values); } thread_sender.unbounded_send(Message::Terminated).unwrap(); @@ -516,10 +635,21 @@ where // `pending_ext`. let mut terminated = 0usize; let mut batch_failed = false; + let mut processed = 0usize; loop { match rx.next().await.unwrap() { Message::Batch(kv) => { for (k, v) in kv { + processed += 1; + if processed % 50_000 == 0 || processed == keys.len() || processed == 1 { + log::info!( + target: LOG_TARGET, + "inserting keys progress = {:.0}% [{} / {}]", + (processed as f32 / keys.len() as f32) * 100f32, + processed, + keys.len(), + ); + } // skip writing the child root data. if is_default_child_storage_key(k.as_ref()) { continue @@ -554,73 +684,58 @@ where /// Get the values corresponding to `child_keys` at the given `prefixed_top_key`. pub(crate) async fn rpc_child_get_storage_paged( - client: &WsClient, + client: &Arc, prefixed_top_key: &StorageKey, child_keys: Vec, at: B::Hash, ) -> Result, &'static str> { - let mut child_kv_inner = vec![]; - let mut batch_success = true; - - for batch_child_key in child_keys.chunks(DEFAULT_VALUE_DOWNLOAD_BATCH) { - let mut batch_request = BatchRequestBuilder::new(); - - for key in batch_child_key { - batch_request - .insert( - "childstate_getStorage", - rpc_params![ - PrefixedStorageKey::new(prefixed_top_key.as_ref().to_vec()), - key, - at - ], - ) - .map_err(|_| "Invalid batch params")?; - } + let child_keys_len = child_keys.len(); - let batch_response = - client.batch_request::>(batch_request).await.map_err(|e| { - log::error!( - target: LOG_TARGET, - "failed to execute batch: {:?}. Error: {:?}", - batch_child_key, - e - ); - "batch failed." - })?; + let payloads = child_keys + .iter() + .map(|key| { + ( + "childstate_getStorage".to_string(), + rpc_params![ + PrefixedStorageKey::new(prefixed_top_key.as_ref().to_vec()), + key, + at + ], + ) + }) + .collect::>(); - assert_eq!(batch_child_key.len(), batch_response.len()); - - for (key, maybe_value) in batch_child_key.iter().zip(batch_response) { - match maybe_value { - Ok(Some(v)) => { - child_kv_inner.push((key.clone(), v)); - }, - Ok(None) => { - log::warn!( - target: LOG_TARGET, - "key {:?} had none corresponding value.", - &key - ); - child_kv_inner.push((key.clone(), StorageData(vec![]))); - }, - Err(e) => { - log::error!(target: LOG_TARGET, "key {:?} failed: {:?}", &key, e); - batch_success = false; - }, - }; - } - } + let storage_data = match Self::get_storage_data_dynamic_batch_size( + client, + payloads, + Self::INITIAL_BATCH_SIZE, + ) + .await + { + Ok(storage_data) => storage_data, + Err(e) => { + log::error!(target: LOG_TARGET, "batch processing failed: {:?}", e); + return Err("batch processing failed") + }, + }; - if batch_success { - Ok(child_kv_inner) - } else { - Err("batch failed.") - } + assert_eq!(child_keys_len, storage_data.len()); + + Ok(child_keys + .iter() + .zip(storage_data) + .map(|(key, maybe_value)| match maybe_value { + Some(v) => (key.clone(), v), + None => { + log::warn!(target: LOG_TARGET, "key {:?} had no corresponding value.", &key); + (key.clone(), StorageData(vec![])) + }, + }) + .collect::>()) } pub(crate) async fn rpc_child_get_keys( - client: &WsClient, + client: &HttpClient, prefixed_top_key: &StorageKey, child_prefix: StorageKey, at: B::Hash, @@ -678,107 +793,47 @@ where return Ok(Default::default()) } - // div-ceil simulation. - let threads = Self::threads().get(); - let child_roots_per_thread = (child_roots.len() + threads - 1) / threads; - info!( target: LOG_TARGET, - "👩‍👦 scraping child-tree data from {} top keys, split among {} threads, {} top keys per thread", + "👩‍👦 scraping child-tree data from {} top keys", child_roots.len(), - threads, - child_roots_per_thread, ); - // NOTE: the threading done here is the simpler, yet slightly un-elegant because we are - // splitting child root among threads, and it is very common for these root to have vastly - // different child tries underneath them, causing some threads to finish way faster than - // others. Certainly still better than single thread though. - let mut handles = vec![]; - let client = self.as_online().rpc_client_cloned(); let at = self.as_online().at_expected(); - enum Message { - Terminated, - Batch((ChildInfo, Vec<(Vec, Vec)>)), - } - let (tx, mut rx) = mpsc::unbounded::(); - - for thread_child_roots in child_roots - .chunks(child_roots_per_thread) - .map(|x| x.into()) - .collect::>>() - { - let thread_client = client.clone(); - let thread_sender = tx.clone(); - let handle = thread::spawn(move || { - let rt = tokio::runtime::Runtime::new().unwrap(); - let mut thread_child_kv = vec![]; - for prefixed_top_key in thread_child_roots { - let child_keys = rt.block_on(Self::rpc_child_get_keys( - &thread_client, - &prefixed_top_key, - StorageKey(vec![]), - at, - ))?; - let child_kv_inner = rt.block_on(Self::rpc_child_get_storage_paged( - &thread_client, - &prefixed_top_key, - child_keys, - at, - ))?; - - let prefixed_top_key = PrefixedStorageKey::new(prefixed_top_key.clone().0); - let un_prefixed = match ChildType::from_prefixed_key(&prefixed_top_key) { - Some((ChildType::ParentKeyId, storage_key)) => storage_key, - None => { - log::error!(target: LOG_TARGET, "invalid key: {:?}", prefixed_top_key); - return Err("Invalid child key") - }, - }; - - thread_sender - .unbounded_send(Message::Batch(( - ChildInfo::new_default(un_prefixed), - child_kv_inner - .iter() - .cloned() - .map(|(k, v)| (k.0, v.0)) - .collect::>(), - ))) - .unwrap(); - thread_child_kv.push((ChildInfo::new_default(un_prefixed), child_kv_inner)); - } - - thread_sender.unbounded_send(Message::Terminated).unwrap(); - Ok(thread_child_kv) - }); - handles.push(handle); - } - - // first, wait until all threads send a `Terminated` message, in the meantime populate - // `pending_ext`. - let mut terminated = 0usize; - loop { - match rx.next().await.unwrap() { - Message::Batch((info, kvs)) => - for (k, v) in kvs { - pending_ext.insert_child(info.clone(), k, v); - }, - Message::Terminated => { - terminated += 1; - if terminated == handles.len() { - break - } + let arc_client = self.as_online().rpc_client_cloned(); + let mut child_kv = vec![]; + for prefixed_top_key in child_roots { + let child_keys = Self::rpc_child_get_keys( + arc_client.as_ref(), + &prefixed_top_key, + StorageKey(vec![]), + at, + ) + .await?; + + let child_kv_inner = + Self::rpc_child_get_storage_paged(&arc_client, &prefixed_top_key, child_keys, at) + .await?; + + let prefixed_top_key = PrefixedStorageKey::new(prefixed_top_key.clone().0); + let un_prefixed = match ChildType::from_prefixed_key(&prefixed_top_key) { + Some((ChildType::ParentKeyId, storage_key)) => storage_key, + None => { + log::error!(target: LOG_TARGET, "invalid key: {:?}", prefixed_top_key); + return Err("Invalid child key") }, + }; + + let info = ChildInfo::new_default(un_prefixed); + let key_values = + child_kv_inner.iter().cloned().map(|(k, v)| (k.0, v.0)).collect::>(); + child_kv.push((info.clone(), child_kv_inner)); + for (k, v) in key_values { + pending_ext.insert_child(info.clone(), k, v); } } - let child_kv = handles - .into_iter() - .flat_map(|h| h.join().unwrap()) - .flatten() - .collect::>(); Ok(child_kv) } @@ -841,8 +896,8 @@ where /// /// initializes the remote client in `transport`, and sets the `at` field, if not specified. async fn init_remote_client(&mut self) -> Result<(), &'static str> { - // First, initialize the ws client. - self.as_online_mut().transport.map_uri().await?; + // First, initialize the http client. + self.as_online_mut().transport.init().await?; // Then, if `at` is not set, set it. if self.as_online().at.is_none() { diff --git a/utils/frame/try-runtime/cli/src/lib.rs b/utils/frame/try-runtime/cli/src/lib.rs index cd6c48f52f45e..9268ef2edba8b 100644 --- a/utils/frame/try-runtime/cli/src/lib.rs +++ b/utils/frame/try-runtime/cli/src/lib.rs @@ -97,18 +97,6 @@ //! > If anything, in most cases, we expect spec-versions to NOT match, because try-runtime is all //! > about testing unreleased runtimes. //! -//! ## Note on nodes that respond to `try-runtime` requests. -//! -//! There are a number of flags that need to be preferably set on a running node in order to work -//! well with try-runtime's expensive RPC queries: -//! -//! - set `--rpc-max-response-size 1000` and -//! - `--rpc-max-request-size 1000` to ensure connections are not dropped in case the state is -//! large. -//! - set `--rpc-cors all` to ensure ws connections can come through. -//! -//! Note that *none* of the try-runtime operations need unsafe RPCs. -//! //! ## Note on signature and state-root checks //! //! All of the commands calling into `TryRuntime_execute_block` ([`Command::ExecuteBlock`] and From 471b49b09fd0d2a3057090ab0720f4e39faed5c5 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Fri, 21 Apr 2023 12:06:26 +0200 Subject: [PATCH 57/93] Add Freeze/Thaw events and tests (#13779) * Add Freeze/Thaw events and tests * Remove duplicate docstring * Correct spelling error * Cargo fmt * Use proper punctuation in docstring Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> --------- Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> Co-authored-by: parity-processbot <> --- frame/balances/src/lib.rs | 15 +++++++ frame/balances/src/tests/fungible_tests.rs | 46 ++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index 74aec1f2d259b..6835d3c8148bb 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -337,6 +337,10 @@ pub mod pallet { Locked { who: T::AccountId, amount: T::Balance }, /// Some balance was unlocked. Unlocked { who: T::AccountId, amount: T::Balance }, + /// Some balance was frozen. + Frozen { who: T::AccountId, amount: T::Balance }, + /// Some balance was thawed. + Thawed { who: T::AccountId, amount: T::Balance }, } #[pallet::error] @@ -1084,7 +1088,10 @@ pub mod pallet { who: &T::AccountId, freezes: BoundedSlice, T::MaxFreezes>, ) -> DispatchResult { + let mut prev_frozen = Zero::zero(); + let mut after_frozen = Zero::zero(); let (_, maybe_dust) = Self::mutate_account(who, |b| { + prev_frozen = b.frozen; b.frozen = Zero::zero(); for l in Locks::::get(who).iter() { b.frozen = b.frozen.max(l.amount); @@ -1092,6 +1099,7 @@ pub mod pallet { for l in freezes.iter() { b.frozen = b.frozen.max(l.amount); } + after_frozen = b.frozen; })?; debug_assert!(maybe_dust.is_none(), "Not altering main balance; qed"); if freezes.is_empty() { @@ -1099,6 +1107,13 @@ pub mod pallet { } else { Freezes::::insert(who, freezes); } + if prev_frozen > after_frozen { + let amount = prev_frozen.saturating_sub(after_frozen); + Self::deposit_event(Event::Thawed { who: who.clone(), amount }); + } else if after_frozen > prev_frozen { + let amount = after_frozen.saturating_sub(prev_frozen); + Self::deposit_event(Event::Frozen { who: who.clone(), amount }); + } Ok(()) } diff --git a/frame/balances/src/tests/fungible_tests.rs b/frame/balances/src/tests/fungible_tests.rs index 128086885391f..185396019b13d 100644 --- a/frame/balances/src/tests/fungible_tests.rs +++ b/frame/balances/src/tests/fungible_tests.rs @@ -397,3 +397,49 @@ fn unholding_frees_hold_slot() { assert_ok!(Balances::hold(&TestId::Baz, &1, 10)); }); } + +#[test] +fn emit_events_with_changing_freezes() { + ExtBuilder::default().build_and_execute_with(|| { + let _ = Balances::set_balance(&1, 100); + System::reset_events(); + + // Freeze = [] --> [10] + assert_ok!(Balances::set_freeze(&TestId::Foo, &1, 10)); + assert_eq!(events(), [RuntimeEvent::Balances(crate::Event::Frozen { who: 1, amount: 10 })]); + + // Freeze = [10] --> [15] + assert_ok!(Balances::set_freeze(&TestId::Foo, &1, 15)); + assert_eq!(events(), [RuntimeEvent::Balances(crate::Event::Frozen { who: 1, amount: 5 })]); + + // Freeze = [15] --> [15, 20] + assert_ok!(Balances::set_freeze(&TestId::Bar, &1, 20)); + assert_eq!(events(), [RuntimeEvent::Balances(crate::Event::Frozen { who: 1, amount: 5 })]); + + // Freeze = [15, 20] --> [17, 20] + assert_ok!(Balances::set_freeze(&TestId::Foo, &1, 17)); + for event in events() { + match event { + RuntimeEvent::Balances(crate::Event::Frozen { .. }) => { + assert!(false, "unexpected freeze event") + }, + RuntimeEvent::Balances(crate::Event::Thawed { .. }) => { + assert!(false, "unexpected thaw event") + }, + _ => continue, + } + } + + // Freeze = [17, 20] --> [17, 15] + assert_ok!(Balances::set_freeze(&TestId::Bar, &1, 15)); + assert_eq!(events(), [RuntimeEvent::Balances(crate::Event::Thawed { who: 1, amount: 3 })]); + + // Freeze = [17, 15] --> [15] + assert_ok!(Balances::thaw(&TestId::Foo, &1)); + assert_eq!(events(), [RuntimeEvent::Balances(crate::Event::Thawed { who: 1, amount: 2 })]); + + // Freeze = [15] --> [] + assert_ok!(Balances::thaw(&TestId::Bar, &1)); + assert_eq!(events(), [RuntimeEvent::Balances(crate::Event::Thawed { who: 1, amount: 15 })]); + }); +} From 35d04fb506b00128739b5bead363f0ca651a4ff3 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Fri, 21 Apr 2023 17:24:12 +0200 Subject: [PATCH 58/93] Update macro use and optimize storage collection (#13970) --- frame/contracts/src/lib.rs | 3 +-- frame/contracts/src/storage/meter.rs | 2 +- frame/contracts/src/tests.rs | 26 +++++++++++++------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 26b16b3291a2f..fa230a8cade14 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -83,11 +83,10 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "runtime-benchmarks", recursion_limit = "1024")] -#[macro_use] -mod gas; mod address; mod benchmarking; mod exec; +mod gas; mod migration; mod schedule; mod storage; diff --git a/frame/contracts/src/storage/meter.rs b/frame/contracts/src/storage/meter.rs index ef3e01f6d6c4f..497ee03ac319a 100644 --- a/frame/contracts/src/storage/meter.rs +++ b/frame/contracts/src/storage/meter.rs @@ -293,8 +293,8 @@ where .total_deposit .saturating_add(&absorbed.total_deposit) .saturating_add(&own_deposit); + self.charges.extend_from_slice(&absorbed.charges); if !own_deposit.is_zero() { - self.charges.extend_from_slice(&absorbed.charges); self.charges.push(Charge { deposit_account, amount: own_deposit, diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index ac1fb07bf5ce0..4e6c468f19c81 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -73,7 +73,19 @@ frame_support::construct_runtime!( } ); -#[macro_use] +macro_rules! assert_return_code { + ( $x:expr , $y:expr $(,)? ) => {{ + assert_eq!(u32::from_le_bytes($x.data[..].try_into().unwrap()), $y as u32); + }}; +} + +macro_rules! assert_refcount { + ( $code_hash:expr , $should:expr $(,)? ) => {{ + let is = crate::OwnerInfoOf::::get($code_hash).map(|m| m.refcount()).unwrap(); + assert_eq!(is, $should); + }}; +} + pub mod test_utils { use super::{Balances, Hash, SysConfig, Test}; use crate::{exec::AccountIdOf, CodeHash, Config, ContractInfo, ContractInfoOf, Nonce}; @@ -105,18 +117,6 @@ pub mod test_utils { pub fn hash(s: &S) -> <::Hashing as Hash>::Output { <::Hashing as Hash>::hash_of(s) } - macro_rules! assert_return_code { - ( $x:expr , $y:expr $(,)? ) => {{ - assert_eq!(u32::from_le_bytes($x.data[..].try_into().unwrap()), $y as u32); - }}; - } - - macro_rules! assert_refcount { - ( $code_hash:expr , $should:expr $(,)? ) => {{ - let is = crate::OwnerInfoOf::::get($code_hash).map(|m| m.refcount()).unwrap(); - assert_eq!(is, $should); - }}; - } } impl Test { From 2fde3802da6256b5846ce33760685ca40008d00d Mon Sep 17 00:00:00 2001 From: ordian Date: Fri, 21 Apr 2023 21:58:05 +0200 Subject: [PATCH 59/93] cargo upgrade --workspace kvdb-rocksdb (#13973) --- Cargo.lock | 12 ++++++------ bin/node/bench/Cargo.toml | 2 +- client/db/Cargo.toml | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b316993185862..aa7d22daccb80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3776,9 +3776,9 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2182b8219fee6bd83aacaab7344e840179ae079d5216aa4e249b4d704646a844" +checksum = "fe7a749456510c45f795e8b04a6a3e0976d0139213ecbf465843830ad55e2217" dependencies = [ "kvdb", "num_cpus", @@ -4311,9 +4311,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "0.8.3+7.4.4" +version = "0.10.0+7.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "557b255ff04123fcc176162f56ed0c9cd42d8f357cf55b3fabeb60f7413741b3" +checksum = "0fe4d5874f5ff2bc616e55e8c6086d478fcda13faf9495768a4aa1c22042d30b" dependencies = [ "bindgen", "bzip2-sys", @@ -8097,9 +8097,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9562ea1d70c0cc63a34a22d977753b50cca91cc6b6527750463bd5dd8697bc" +checksum = "015439787fce1e75d55f279078d33ff14b4af5d93d995e8838ee4631301c8a99" dependencies = [ "libc", "librocksdb-sys", diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml index 153a721da41f8..30266ab0d24e7 100644 --- a/bin/node/bench/Cargo.toml +++ b/bin/node/bench/Cargo.toml @@ -25,7 +25,7 @@ serde = "1.0.136" serde_json = "1.0.85" derive_more = { version = "0.99.17", default-features = false, features = ["display"] } kvdb = "0.13.0" -kvdb-rocksdb = "0.17.0" +kvdb-rocksdb = "0.18.0" sp-trie = { version = "7.0.0", path = "../../../primitives/trie" } sp-core = { version = "7.0.0", path = "../../../primitives/core" } sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" } diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index 8e4bcf18a2d04..cd3a73dd4dab4 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -19,7 +19,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", features = [ hash-db = "0.16.0" kvdb = "0.13.0" kvdb-memorydb = "0.13.0" -kvdb-rocksdb = { version = "0.17.0", optional = true } +kvdb-rocksdb = { version = "0.18.0", optional = true } linked-hash-map = "0.5.4" log = "0.4.17" parity-db = "0.4.6" @@ -37,7 +37,7 @@ sp-trie = { version = "7.0.0", path = "../../primitives/trie" } [dev-dependencies] criterion = "0.4.0" -kvdb-rocksdb = "0.17.0" +kvdb-rocksdb = "0.18.0" rand = "0.8.5" tempfile = "3.1.0" quickcheck = { version = "1.0.3", default-features = false } From c7d26dcf3d6c19fa7dcbd1f2633e337e5a5cbc40 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 21 Apr 2023 22:32:32 +0200 Subject: [PATCH 60/93] Remove superflous Pair::verify_weak (#13972) --- primitives/application-crypto/src/lib.rs | 7 ------- primitives/core/src/crypto.rs | 15 -------------- primitives/core/src/ecdsa.rs | 18 ++-------------- primitives/core/src/ed25519.rs | 26 ++++++++---------------- primitives/core/src/sr25519.rs | 18 +++++----------- 5 files changed, 15 insertions(+), 69 deletions(-) diff --git a/primitives/application-crypto/src/lib.rs b/primitives/application-crypto/src/lib.rs index 3f12e06e11ec3..5e77795199dd9 100644 --- a/primitives/application-crypto/src/lib.rs +++ b/primitives/application-crypto/src/lib.rs @@ -154,13 +154,6 @@ macro_rules! app_crypto_pair { ) -> bool { <$pair>::verify(&sig.0, message, pubkey.as_ref()) } - fn verify_weak, M: AsRef<[u8]>>( - sig: &[u8], - message: M, - pubkey: P, - ) -> bool { - <$pair>::verify_weak(sig, message, pubkey) - } fn public(&self) -> Self::Public { Public(self.0.public()) } diff --git a/primitives/core/src/crypto.rs b/primitives/core/src/crypto.rs index 4fec79fc6ea18..dd0d9e60529f2 100644 --- a/primitives/core/src/crypto.rs +++ b/primitives/core/src/crypto.rs @@ -716,10 +716,6 @@ mod dummy { true } - fn verify_weak, M: AsRef<[u8]>>(_: &[u8], _: M, _: P) -> bool { - true - } - fn public(&self) -> Self::Public { Self } @@ -917,9 +913,6 @@ pub trait Pair: CryptoType + Sized + Clone + Send + Sync + 'static { /// Verify a signature on a message. Returns true if the signature is good. fn verify>(sig: &Self::Signature, message: M, pubkey: &Self::Public) -> bool; - /// Verify a signature on a message. Returns true if the signature is good. - fn verify_weak, M: AsRef<[u8]>>(sig: &[u8], message: M, pubkey: P) -> bool; - /// Get the public key. fn public(&self) -> Self::Public; @@ -1272,14 +1265,6 @@ mod tests { true } - fn verify_weak, M: AsRef<[u8]>>( - _sig: &[u8], - _message: M, - _pubkey: P, - ) -> bool { - true - } - fn public(&self) -> Self::Public { TestPublic } diff --git a/primitives/core/src/ecdsa.rs b/primitives/core/src/ecdsa.rs index 8dc4a55130fd6..2474fa7736b78 100644 --- a/primitives/core/src/ecdsa.rs +++ b/primitives/core/src/ecdsa.rs @@ -407,22 +407,8 @@ impl TraitPair for Pair { } /// Verify a signature on a message. Returns true if the signature is good. - fn verify>(sig: &Self::Signature, message: M, pubkey: &Self::Public) -> bool { - match sig.recover(message) { - Some(actual) => actual == *pubkey, - None => false, - } - } - - /// Verify a signature on a message. Returns true if the signature is good. - /// - /// This doesn't use the type system to ensure that `sig` and `pubkey` are the correct - /// size. Use it only if you're coming from byte buffers and need the speed. - fn verify_weak, M: AsRef<[u8]>>(sig: &[u8], message: M, pubkey: P) -> bool { - match Signature::from_slice(sig).and_then(|sig| sig.recover(message)) { - Some(actual) => actual.as_ref() == pubkey.as_ref(), - None => false, - } + fn verify>(sig: &Self::Signature, message: M, public: &Self::Public) -> bool { + sig.recover(message).map(|actual| actual == *public).unwrap_or_default() } /// Return a vec filled with raw data. diff --git a/primitives/core/src/ed25519.rs b/primitives/core/src/ed25519.rs index 884d29dc122e9..d0e6bef97a7d9 100644 --- a/primitives/core/src/ed25519.rs +++ b/primitives/core/src/ed25519.rs @@ -406,27 +406,17 @@ impl TraitPair for Pair { Signature::from_raw(self.secret.sign(message).into()) } - /// Verify a signature on a message. Returns true if the signature is good. - fn verify>(sig: &Self::Signature, message: M, pubkey: &Self::Public) -> bool { - Self::verify_weak(&sig.0[..], message.as_ref(), pubkey) - } - - /// Verify a signature on a message. Returns true if the signature is good. + /// Verify a signature on a message. /// - /// This doesn't use the type system to ensure that `sig` and `pubkey` are the correct - /// size. Use it only if you're coming from byte buffers and need the speed. - fn verify_weak, M: AsRef<[u8]>>(sig: &[u8], message: M, pubkey: P) -> bool { - let public_key = match VerificationKey::try_from(pubkey.as_ref()) { - Ok(pk) => pk, - Err(_) => return false, + /// Returns true if the signature is good. + fn verify>(sig: &Self::Signature, message: M, public: &Self::Public) -> bool { + let Ok(public) = VerificationKey::try_from(public.as_slice()) else { + return false }; - - let sig = match ed25519_zebra::Signature::try_from(sig) { - Ok(s) => s, - Err(_) => return false, + let Ok(signature) = ed25519_zebra::Signature::try_from(sig.as_ref()) else { + return false }; - - public_key.verify(&sig, message.as_ref()).is_ok() + public.verify(&signature, message.as_ref()).is_ok() } /// Return a vec filled with raw data. diff --git a/primitives/core/src/sr25519.rs b/primitives/core/src/sr25519.rs index fcd7f38a74f1f..9b1c82205de10 100644 --- a/primitives/core/src/sr25519.rs +++ b/primitives/core/src/sr25519.rs @@ -487,21 +487,13 @@ impl TraitPair for Pair { } fn verify>(sig: &Self::Signature, message: M, pubkey: &Self::Public) -> bool { - Self::verify_weak(&sig.0[..], message, pubkey) - } - - fn verify_weak, M: AsRef<[u8]>>(sig: &[u8], message: M, pubkey: P) -> bool { - let signature = match schnorrkel::Signature::from_bytes(sig) { - Ok(signature) => signature, - Err(_) => return false, + let Ok(signature) = schnorrkel::Signature::from_bytes(sig.as_ref()) else { + return false }; - - let pub_key = match PublicKey::from_bytes(pubkey.as_ref()) { - Ok(pub_key) => pub_key, - Err(_) => return false, + let Ok(public) = PublicKey::from_bytes(pubkey.as_ref()) else { + return false }; - - pub_key.verify_simple(SIGNING_CTX, message.as_ref(), &signature).is_ok() + public.verify_simple(SIGNING_CTX, message.as_ref(), &signature).is_ok() } fn to_raw_vec(&self) -> Vec { From 9370f42ab35f7013f70b703884c9884888a3b153 Mon Sep 17 00:00:00 2001 From: gupnik <17176722+gupnik@users.noreply.github.com> Date: Mon, 24 Apr 2023 17:34:15 +0530 Subject: [PATCH 61/93] Adds force_origin support (#13845) * Adds force_origin support * Moves a couple of tests to showcase v2 with force_origin * Adds remaining tests * adds documentation * minor * adds test for invalid origin * ".git/.scripts/commands/fmt/fmt.sh" * updates param to use MaxCalls * Fixes compilation error * Updates doc comment * Fixes test outputs * Fixes test output * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: command-bot <> --- frame/benchmarking/src/lib.rs | 7 + frame/lottery/src/benchmarking.rs | 127 ++++++++++++------ frame/support/procedural/src/benchmark.rs | 35 +++-- .../test/tests/benchmark_ui/invalid_origin.rs | 17 +++ .../tests/benchmark_ui/invalid_origin.stderr | 16 +++ 5 files changed, 141 insertions(+), 61 deletions(-) create mode 100644 frame/support/test/tests/benchmark_ui/invalid_origin.rs create mode 100644 frame/support/test/tests/benchmark_ui/invalid_origin.stderr diff --git a/frame/benchmarking/src/lib.rs b/frame/benchmarking/src/lib.rs index 7110c378d581e..b11e164fe8e44 100644 --- a/frame/benchmarking/src/lib.rs +++ b/frame/benchmarking/src/lib.rs @@ -160,6 +160,13 @@ pub use v1::*; /// The underscore will be substituted with the name of the benchmark (i.e. the name of the /// function in the benchmark function definition). /// +/// In case of a `force_origin` where you want to elevate the privileges of the provided origin, +/// this is the general syntax: +/// ```ignore +/// #[extrinsic_call] +/// _(force_origin as T::RuntimeOrigin, 0u32.into(), 0); +/// ``` +/// /// Regardless of whether `#[extrinsic_call]` or `#[block]` is used, this attribute also serves /// the purpose of designating the boundary between the setup code portion of the benchmark /// (everything before the `#[extrinsic_call]` or `#[block]` attribute) and the verification diff --git a/frame/lottery/src/benchmarking.rs b/frame/lottery/src/benchmarking.rs index 9216464b07d35..1510d250dbeaf 100644 --- a/frame/lottery/src/benchmarking.rs +++ b/frame/lottery/src/benchmarking.rs @@ -21,7 +21,12 @@ use super::*; -use frame_benchmarking::v1::{account, benchmarks, whitelisted_caller, BenchmarkError}; +use crate::Pallet as Lottery; +use frame_benchmarking::{ + impl_benchmark_test_suite, + v1::{account, whitelisted_caller, BenchmarkError}, + v2::*, +}; use frame_support::{ storage::bounded_vec::BoundedVec, traits::{EnsureOrigin, OnInitialize}, @@ -29,8 +34,6 @@ use frame_support::{ use frame_system::RawOrigin; use sp_runtime::traits::{Bounded, Zero}; -use crate::Pallet as Lottery; - // Set up and start a lottery fn setup_lottery(repeat: bool) -> Result<(), &'static str> { let price = T::Currency::minimum_balance(); @@ -50,72 +53,100 @@ fn setup_lottery(repeat: bool) -> Result<(), &'static str> { Ok(()) } -benchmarks! { - buy_ticket { +#[benchmarks] +mod benchmarks { + use super::*; + + #[benchmark] + fn buy_ticket() -> Result<(), BenchmarkError> { let caller = whitelisted_caller(); T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); setup_lottery::(false)?; // force user to have a long vec of calls participating let set_code_index: CallIndex = Lottery::::call_to_index( - &frame_system::Call::::set_code{ code: vec![] }.into() + &frame_system::Call::::set_code { code: vec![] }.into(), )?; let already_called: (u32, BoundedVec) = ( LotteryIndex::::get(), BoundedVec::::try_from(vec![ set_code_index; - T::MaxCalls::get().saturating_sub(1) as usize - ]).unwrap(), + T::MaxCalls::get().saturating_sub(1) + as usize + ]) + .unwrap(), ); Participants::::insert(&caller, already_called); let call = frame_system::Call::::remark { remark: vec![] }; - }: _(RawOrigin::Signed(caller), Box::new(call.into())) - verify { + + #[extrinsic_call] + _(RawOrigin::Signed(caller), Box::new(call.into())); + assert_eq!(TicketsCount::::get(), 1); + + Ok(()) } - set_calls { - let n in 0 .. T::MaxCalls::get() as u32; + #[benchmark] + fn set_calls(n: Linear<0, { T::MaxCalls::get() }>) -> Result<(), BenchmarkError> { let calls = vec![frame_system::Call::::remark { remark: vec![] }.into(); n as usize]; let origin = T::ManagerOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; assert!(CallIndices::::get().is_empty()); - }: _(origin, calls) - verify { + + #[extrinsic_call] + _(origin as T::RuntimeOrigin, calls); + if !n.is_zero() { assert!(!CallIndices::::get().is_empty()); } + + Ok(()) } - start_lottery { + #[benchmark] + fn start_lottery() -> Result<(), BenchmarkError> { let price = BalanceOf::::max_value(); let end = 10u32.into(); let payout = 5u32.into(); let origin = T::ManagerOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; - }: _(origin, price, end, payout, true) - verify { + + #[extrinsic_call] + _(origin as T::RuntimeOrigin, price, end, payout, true); + assert!(crate::Lottery::::get().is_some()); + + Ok(()) } - stop_repeat { + #[benchmark] + fn stop_repeat() -> Result<(), BenchmarkError> { setup_lottery::(true)?; assert_eq!(crate::Lottery::::get().unwrap().repeat, true); let origin = T::ManagerOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; - }: _(origin) - verify { + + #[extrinsic_call] + _(origin as T::RuntimeOrigin); + assert_eq!(crate::Lottery::::get().unwrap().repeat, false); + + Ok(()) } - on_initialize_end { + #[benchmark] + fn on_initialize_end() -> Result<(), BenchmarkError> { setup_lottery::(false)?; let winner = account("winner", 0, 0); // User needs more than min balance to get ticket T::Currency::make_free_balance_be(&winner, T::Currency::minimum_balance() * 10u32.into()); // Make sure lottery account has at least min balance too let lottery_account = Lottery::::account_id(); - T::Currency::make_free_balance_be(&lottery_account, T::Currency::minimum_balance() * 10u32.into()); + T::Currency::make_free_balance_be( + &lottery_account, + T::Currency::minimum_balance() * 10u32.into(), + ); // Buy a ticket let call = frame_system::Call::::remark { remark: vec![] }; Lottery::::buy_ticket(RawOrigin::Signed(winner.clone()).into(), Box::new(call.into()))?; @@ -124,29 +155,37 @@ benchmarks! { // Assert that lotto is set up for winner assert_eq!(TicketsCount::::get(), 1); assert!(!Lottery::::pot().1.is_zero()); - }: { - // Generate `MaxGenerateRandom` numbers for worst case scenario - for i in 0 .. T::MaxGenerateRandom::get() { - Lottery::::generate_random_number(i); + + #[block] + { + // Generate `MaxGenerateRandom` numbers for worst case scenario + for i in 0..T::MaxGenerateRandom::get() { + Lottery::::generate_random_number(i); + } + // Start lottery has block 15 configured for payout + Lottery::::on_initialize(15u32.into()); } - // Start lottery has block 15 configured for payout - Lottery::::on_initialize(15u32.into()); - } - verify { + assert!(crate::Lottery::::get().is_none()); assert_eq!(TicketsCount::::get(), 0); assert_eq!(Lottery::::pot().1, 0u32.into()); - assert!(!T::Currency::free_balance(&winner).is_zero()) + assert!(!T::Currency::free_balance(&winner).is_zero()); + + Ok(()) } - on_initialize_repeat { + #[benchmark] + fn on_initialize_repeat() -> Result<(), BenchmarkError> { setup_lottery::(true)?; let winner = account("winner", 0, 0); // User needs more than min balance to get ticket T::Currency::make_free_balance_be(&winner, T::Currency::minimum_balance() * 10u32.into()); // Make sure lottery account has at least min balance too let lottery_account = Lottery::::account_id(); - T::Currency::make_free_balance_be(&lottery_account, T::Currency::minimum_balance() * 10u32.into()); + T::Currency::make_free_balance_be( + &lottery_account, + T::Currency::minimum_balance() * 10u32.into(), + ); // Buy a ticket let call = frame_system::Call::::remark { remark: vec![] }; Lottery::::buy_ticket(RawOrigin::Signed(winner.clone()).into(), Box::new(call.into()))?; @@ -155,20 +194,24 @@ benchmarks! { // Assert that lotto is set up for winner assert_eq!(TicketsCount::::get(), 1); assert!(!Lottery::::pot().1.is_zero()); - }: { - // Generate `MaxGenerateRandom` numbers for worst case scenario - for i in 0 .. T::MaxGenerateRandom::get() { - Lottery::::generate_random_number(i); + + #[block] + { + // Generate `MaxGenerateRandom` numbers for worst case scenario + for i in 0..T::MaxGenerateRandom::get() { + Lottery::::generate_random_number(i); + } + // Start lottery has block 15 configured for payout + Lottery::::on_initialize(15u32.into()); } - // Start lottery has block 15 configured for payout - Lottery::::on_initialize(15u32.into()); - } - verify { + assert!(crate::Lottery::::get().is_some()); assert_eq!(LotteryIndex::::get(), 2); assert_eq!(TicketsCount::::get(), 0); assert_eq!(Lottery::::pot().1, 0u32.into()); - assert!(!T::Currency::free_balance(&winner).is_zero()) + assert!(!T::Currency::free_balance(&winner).is_zero()); + + Ok(()) } impl_benchmark_test_suite!(Lottery, crate::mock::new_test_ext(), crate::mock::Test); diff --git a/frame/support/procedural/src/benchmark.rs b/frame/support/procedural/src/benchmark.rs index 315a6000bc8bf..28b5aa1b983b7 100644 --- a/frame/support/procedural/src/benchmark.rs +++ b/frame/support/procedural/src/benchmark.rs @@ -53,7 +53,7 @@ mod keywords { #[derive(Clone)] struct ParamDef { name: String, - typ: Type, + _typ: Type, start: syn::GenericArgument, end: syn::GenericArgument, } @@ -229,7 +229,7 @@ fn parse_params(item_fn: &ItemFn) -> Result> { let args = segment.arguments.to_token_stream().into(); let Ok(args) = syn::parse::(args) else { return invalid_param(typ.span()) }; - params.push(ParamDef { name, typ: typ.clone(), start: args.start, end: args.end }); + params.push(ParamDef { name, _typ: typ.clone(), start: args.start, end: args.end }); } Ok(params) } @@ -681,7 +681,6 @@ pub fn benchmarks( struct UnrolledParams { param_ranges: Vec, param_names: Vec, - param_types: Vec, } impl UnrolledParams { @@ -703,14 +702,7 @@ impl UnrolledParams { quote!(#name) }) .collect(); - let param_types: Vec = params - .iter() - .map(|p| { - let typ = &p.typ; - quote!(#typ) - }) - .collect(); - UnrolledParams { param_ranges, param_names, param_types } + UnrolledParams { param_ranges, param_names } } } @@ -726,7 +718,6 @@ fn expand_benchmark( Ok(ident) => ident, Err(err) => return err.to_compile_error().into(), }; - let home = quote!(#krate::v2); let codec = quote!(#krate::frame_support::codec); let traits = quote!(#krate::frame_support::traits); let setup_stmts = benchmark_def.setup_stmts; @@ -738,7 +729,6 @@ fn expand_benchmark( let unrolled = UnrolledParams::from(&benchmark_def.params); let param_names = unrolled.param_names; let param_ranges = unrolled.param_ranges; - let param_types = unrolled.param_types; let type_use_generics = match is_instance { false => quote!(T), @@ -763,6 +753,18 @@ fn expand_benchmark( } expr_call.args = final_args; + let origin = match origin { + Expr::Cast(t) => { + let ty = t.ty.clone(); + quote! { + <::RuntimeOrigin as From<#ty>>::from(#origin); + } + }, + _ => quote! { + #origin.into(); + }, + }; + // determine call name (handles `_` and normal call syntax) let expr_span = expr_call.span(); let call_err = || { @@ -803,7 +805,7 @@ fn expand_benchmark( let __call_decoded = as #codec::Decode> ::decode(&mut &__benchmarked_call_encoded[..]) .expect("call is encoded above, encoding must be correct"); - let __origin = #origin.into(); + let __origin = #origin; as #traits::UnfilteredDispatchable>::dispatch_bypass_filter( __call_decoded, __origin, @@ -877,11 +879,6 @@ fn expand_benchmark( // benchmark function definition #fn_def - // compile-time assertions that each referenced param type implements ParamRange - #( - #home::assert_impl_all!(#param_types: #home::ParamRange); - )* - #[allow(non_camel_case_types)] #( #fn_attrs diff --git a/frame/support/test/tests/benchmark_ui/invalid_origin.rs b/frame/support/test/tests/benchmark_ui/invalid_origin.rs new file mode 100644 index 0000000000000..81cfc39790969 --- /dev/null +++ b/frame/support/test/tests/benchmark_ui/invalid_origin.rs @@ -0,0 +1,17 @@ +use frame_benchmarking::v2::*; +#[allow(unused_imports)] +use frame_support_test::Config; +use frame_support_test::Call; + +#[benchmarks] +mod benches { + use super::*; + + #[benchmark] + fn bench() { + #[extrinsic_call] + thing(1); + } +} + +fn main() {} diff --git a/frame/support/test/tests/benchmark_ui/invalid_origin.stderr b/frame/support/test/tests/benchmark_ui/invalid_origin.stderr new file mode 100644 index 0000000000000..ab8499d995d47 --- /dev/null +++ b/frame/support/test/tests/benchmark_ui/invalid_origin.stderr @@ -0,0 +1,16 @@ +error[E0599]: no variant or associated item named `new_call_variant_thing` found for enum `Call` in the current scope + --> tests/benchmark_ui/invalid_origin.rs:6:1 + | +6 | #[benchmarks] + | ^^^^^^^^^^^^^ variant or associated item not found in `Call` + | + = note: this error originates in the attribute macro `benchmarks` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `::RuntimeOrigin: From<{integer}>` is not satisfied + --> tests/benchmark_ui/invalid_origin.rs:6:1 + | +6 | #[benchmarks] + | ^^^^^^^^^^^^^ the trait `From<{integer}>` is not implemented for `::RuntimeOrigin` + | + = note: required for `{integer}` to implement `Into<::RuntimeOrigin>` + = note: this error originates in the attribute macro `benchmarks` (in Nightly builds, run with -Z macro-backtrace for more info) From 910bafbf6a43f16424188a52337715e881b4414e Mon Sep 17 00:00:00 2001 From: Muharem Ismailov Date: Mon, 24 Apr 2023 16:57:45 +0200 Subject: [PATCH 62/93] Vote locks for all reasons except RESERVE (#13914) * Vote locks tip * except reserve * reason for delegate * fix tests --------- Co-authored-by: parity-processbot <> --- frame/conviction-voting/src/lib.rs | 9 +++++++-- frame/democracy/src/lib.rs | 21 ++++++++++++++++++--- frame/democracy/src/tests/lock_voting.rs | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/frame/conviction-voting/src/lib.rs b/frame/conviction-voting/src/lib.rs index 072e57035484d..3ad81486ed26d 100644 --- a/frame/conviction-voting/src/lib.rs +++ b/frame/conviction-voting/src/lib.rs @@ -639,7 +639,12 @@ impl, I: 'static> Pallet { }, } }); - T::Currency::extend_lock(CONVICTION_VOTING_ID, who, amount, WithdrawReasons::TRANSFER); + T::Currency::extend_lock( + CONVICTION_VOTING_ID, + who, + amount, + WithdrawReasons::except(WithdrawReasons::RESERVE), + ); } /// Rejig the lock on an account. It will never get more stringent (since that would indicate @@ -669,7 +674,7 @@ impl, I: 'static> Pallet { CONVICTION_VOTING_ID, who, lock_needed, - WithdrawReasons::TRANSFER, + WithdrawReasons::except(WithdrawReasons::RESERVE), ); } } diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index a3d7f103a98f3..4cfd4958400c9 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -1308,7 +1308,12 @@ impl Pallet { })?; // Extend the lock to `balance` (rather than setting it) since we don't know what other // votes are in place. - T::Currency::extend_lock(DEMOCRACY_ID, who, vote.balance(), WithdrawReasons::TRANSFER); + T::Currency::extend_lock( + DEMOCRACY_ID, + who, + vote.balance(), + WithdrawReasons::except(WithdrawReasons::RESERVE), + ); ReferendumInfoOf::::insert(ref_index, ReferendumInfo::Ongoing(status)); Ok(()) } @@ -1454,7 +1459,12 @@ impl Pallet { let votes = Self::increase_upstream_delegation(&target, conviction.votes(balance)); // Extend the lock to `balance` (rather than setting it) since we don't know what other // votes are in place. - T::Currency::extend_lock(DEMOCRACY_ID, &who, balance, WithdrawReasons::TRANSFER); + T::Currency::extend_lock( + DEMOCRACY_ID, + &who, + balance, + WithdrawReasons::except(WithdrawReasons::RESERVE), + ); Ok(votes) })?; Self::deposit_event(Event::::Delegated { who, target }); @@ -1499,7 +1509,12 @@ impl Pallet { if lock_needed.is_zero() { T::Currency::remove_lock(DEMOCRACY_ID, who); } else { - T::Currency::set_lock(DEMOCRACY_ID, who, lock_needed, WithdrawReasons::TRANSFER); + T::Currency::set_lock( + DEMOCRACY_ID, + who, + lock_needed, + WithdrawReasons::except(WithdrawReasons::RESERVE), + ); } } diff --git a/frame/democracy/src/tests/lock_voting.rs b/frame/democracy/src/tests/lock_voting.rs index 9b9172ff02b45..31f2e3f3dcc26 100644 --- a/frame/democracy/src/tests/lock_voting.rs +++ b/frame/democracy/src/tests/lock_voting.rs @@ -34,7 +34,7 @@ fn nay(x: u8, balance: u64) -> AccountVote { } fn the_lock(amount: u64) -> BalanceLock { - BalanceLock { id: DEMOCRACY_ID, amount, reasons: pallet_balances::Reasons::Misc } + BalanceLock { id: DEMOCRACY_ID, amount, reasons: pallet_balances::Reasons::All } } #[test] From fff96aca38aa97d0c07a34fe0bba0b3c67513d22 Mon Sep 17 00:00:00 2001 From: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Date: Mon, 24 Apr 2023 17:33:21 +0200 Subject: [PATCH 63/93] [ci] Update buildah command and version (#13989) --- .gitlab-ci.yml | 3 ++- scripts/ci/gitlab/pipeline/publish.yml | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6ce21c7e416f..59d42936e1769 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,7 +49,8 @@ variables: DOCKER_OS: "debian:stretch" ARCH: "x86_64" CI_IMAGE: "paritytech/ci-linux:production" - BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27" + BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29" + BUILDAH_COMMAND: "buildah --storage-driver overlay2" RELENG_SCRIPTS_BRANCH: "master" RUSTY_CACHIER_SINGLE_BRANCH: master RUSTY_CACHIER_DONT_OPERATE_ON_MAIN_BRANCH: "true" diff --git a/scripts/ci/gitlab/pipeline/publish.yml b/scripts/ci/gitlab/pipeline/publish.yml index a772096447663..5a69e876ac9ff 100644 --- a/scripts/ci/gitlab/pipeline/publish.yml +++ b/scripts/ci/gitlab/pipeline/publish.yml @@ -19,7 +19,7 @@ script: - test "$DOCKER_USER" -a "$DOCKER_PASS" || ( echo "no docker credentials provided"; exit 1 ) - - buildah bud + - $BUILDAH_COMMAND build --format=docker --build-arg VCS_REF="${CI_COMMIT_SHA}" --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" @@ -29,9 +29,9 @@ --file "$DOCKERFILE" . - echo "$DOCKER_PASS" | buildah login --username "$DOCKER_USER" --password-stdin docker.io - - buildah info - - buildah push --format=v2s2 "$IMAGE_NAME:$VERSION" - - buildah push --format=v2s2 "$IMAGE_NAME:latest" + - $BUILDAH_COMMAND info + - $BUILDAH_COMMAND push --format=v2s2 "$IMAGE_NAME:$VERSION" + - $BUILDAH_COMMAND push --format=v2s2 "$IMAGE_NAME:latest" after_script: - buildah logout --all - echo "SUBSTRATE_IMAGE_NAME=${IMAGE_NAME}" | tee -a ./artifacts/$PRODUCT/build.env From 42448c2339daf43d88ec37dc7b4383928f66750f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:31:13 +0200 Subject: [PATCH 64/93] Bump enumflags2 from 0.7.5 to 0.7.7 (#13995) Bumps [enumflags2](https://github.com/meithecatte/enumflags2) from 0.7.5 to 0.7.7. - [Release notes](https://github.com/meithecatte/enumflags2/releases) - [Commits](https://github.com/meithecatte/enumflags2/compare/v0.7.5...v0.7.7) --- updated-dependencies: - dependency-name: enumflags2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 10 +++++----- frame/identity/Cargo.toml | 2 +- frame/nfts/Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa7d22daccb80..79b79e2b2ef45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1982,22 +1982,22 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" +checksum = "c041f5090df68b32bcd905365fd51769c8b9d553fe87fde0b683534f10c01bd2" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" +checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.14", ] [[package]] diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index 23c690889e19c..2479b0609a0ab 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] } -enumflags2 = { version = "0.7.4" } +enumflags2 = { version = "0.7.7" } scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } diff --git a/frame/nfts/Cargo.toml b/frame/nfts/Cargo.toml index 96d46dacbbd0c..73df7518e96c0 100644 --- a/frame/nfts/Cargo.toml +++ b/frame/nfts/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false } -enumflags2 = { version = "0.7.5" } +enumflags2 = { version = "0.7.7" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } From 2b91202014e718525f90c17eb0545e2f2a3261ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 24 Apr 2023 22:23:26 +0200 Subject: [PATCH 65/93] frame-support-procedural: Fix detection of the tuples feature (#13996) We didn't had the tuples features declared for the `frame-support-procedural` crate and thus, it could not properly detect that the feature was already enabled. --- frame/support/Cargo.toml | 4 ++-- frame/support/procedural/Cargo.toml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index f62609585818a..fe068d9360d4e 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -80,5 +80,5 @@ no-metadata-docs = ["frame-support-procedural/no-metadata-docs", "sp-api/no-meta full-metadata-docs = ["scale-info/docs"] # Generate impl-trait for tuples with the given number of tuples. Will be needed as the number of # pallets in a runtime grows. Does increase the compile time! -tuples-96 = [] -tuples-128 = [] +tuples-96 = ["frame-support-procedural/tuples-96"] +tuples-128 = ["frame-support-procedural/tuples-128"] diff --git a/frame/support/procedural/Cargo.toml b/frame/support/procedural/Cargo.toml index e508730f43f95..1a17924b40e2e 100644 --- a/frame/support/procedural/Cargo.toml +++ b/frame/support/procedural/Cargo.toml @@ -29,3 +29,7 @@ proc-macro-warning = { version = "0.3.0", default-features = false } default = ["std"] std = [] no-metadata-docs = [] +# Generate impl-trait for tuples with the given number of tuples. Will be needed as the number of +# pallets in a runtime grows. Does increase the compile time! +tuples-96 = [] +tuples-128 = [] From 222d1189267db873be9466e5658d7e2b033e44ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 25 Apr 2023 09:21:54 +0200 Subject: [PATCH 66/93] pallet-democracy: Do not request the proposal when scheduling (#13827) The requesting of the proposal is actually done now in `pallet-scheduler`. Fixes: https://github.com/paritytech/substrate/issues/13534 --- frame/democracy/src/lib.rs | 5 ----- frame/democracy/src/tests/metadata.rs | 22 +++++++++++----------- frame/support/src/traits/schedule.rs | 2 ++ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index 4cfd4958400c9..69438eba91d8e 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -1606,11 +1606,6 @@ impl Pallet { if approved { Self::deposit_event(Event::::Passed { ref_index: index }); - // Actually `hold` the proposal now since we didn't hold it when it came in via the - // submit extrinsic and we now know that it will be needed. This will be reversed by - // Scheduler pallet once it is executed which assumes that we will already have placed - // a `hold` on it. - T::Preimages::hold(&status.proposal); // Earliest it can be scheduled for is next block. let when = now.saturating_add(status.delay.max(One::one())); diff --git a/frame/democracy/src/tests/metadata.rs b/frame/democracy/src/tests/metadata.rs index 59229abfe4aab..5a36d80b72637 100644 --- a/frame/democracy/src/tests/metadata.rs +++ b/frame/democracy/src/tests/metadata.rs @@ -33,7 +33,7 @@ fn set_external_metadata_works() { Error::::NoProposal, ); // create an external proposal. - assert_ok!(Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal(2),)); + assert_ok!(Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal(2))); assert!(>::exists()); // fails to set metadata with non external origin. assert_noop!( @@ -47,7 +47,7 @@ fn set_external_metadata_works() { ); // set metadata successful. let hash = note_preimage(1); - assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), Some(hash),),); + assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), Some(hash))); System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataSet { owner, hash, @@ -61,11 +61,11 @@ fn clear_metadata_works() { // metadata owner is an external proposal. let owner = MetadataOwner::External; // create an external proposal. - assert_ok!(Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal(2),)); + assert_ok!(Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal(2))); assert!(>::exists()); // set metadata. let hash = note_preimage(1); - assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), Some(hash),)); + assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(2), owner.clone(), Some(hash))); // fails to clear metadata with a wrong origin. assert_noop!( Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), None), @@ -92,18 +92,18 @@ fn set_proposal_metadata_works() { let owner = MetadataOwner::Proposal(Democracy::public_prop_count() - 1); // fails to set non-existing preimage. assert_noop!( - Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(invalid_hash),), + Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(invalid_hash)), Error::::PreimageNotExist, ); // note preimage. let hash = note_preimage(1); // fails to set a preimage if an origin is not a proposer. assert_noop!( - Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), Some(hash),), + Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), Some(hash)), Error::::NoPermission, ); // set metadata successful. - assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(hash),),); + assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(hash))); System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataSet { owner, hash, @@ -120,7 +120,7 @@ fn clear_proposal_metadata_works() { let owner = MetadataOwner::Proposal(Democracy::public_prop_count() - 1); // set metadata. let hash = note_preimage(1); - assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(hash),)); + assert_ok!(Democracy::set_metadata(RuntimeOrigin::signed(1), owner.clone(), Some(hash))); // fails to clear metadata with a wrong origin. assert_noop!( Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), None), @@ -150,16 +150,16 @@ fn set_referendum_metadata_by_root() { let hash = note_preimage(1); // fails to set if not a root. assert_noop!( - Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), Some(hash),), + Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), Some(hash)), Error::::NoPermission, ); // fails to clear if not a root. assert_noop!( - Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), None,), + Democracy::set_metadata(RuntimeOrigin::signed(3), owner.clone(), None), Error::::NoPermission, ); // succeed to set metadata by a root for an ongoing referendum. - assert_ok!(Democracy::set_metadata(RuntimeOrigin::root(), owner.clone(), Some(hash),)); + assert_ok!(Democracy::set_metadata(RuntimeOrigin::root(), owner.clone(), Some(hash))); System::assert_last_event(RuntimeEvent::Democracy(crate::Event::MetadataSet { owner: owner.clone(), hash, diff --git a/frame/support/src/traits/schedule.rs b/frame/support/src/traits/schedule.rs index 4e17092ae329b..74a5951142d52 100644 --- a/frame/support/src/traits/schedule.rs +++ b/frame/support/src/traits/schedule.rs @@ -438,6 +438,8 @@ pub mod v3 { /// Schedule a dispatch to happen at the beginning of some block in the future. /// /// - `id`: The identity of the task. This must be unique and will return an error if not. + /// + /// NOTE: This will request `call` to be made available. fn schedule_named( id: TaskName, when: DispatchTime, From c92eb70d160b33861dc754831ca66d9920a58dad Mon Sep 17 00:00:00 2001 From: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Date: Tue, 25 Apr 2023 10:15:57 +0200 Subject: [PATCH 67/93] [ci] Add message to cargo-deny (#14001) * [ci] Add message to cargo-deny * fix cargo-deny-licenses --- scripts/ci/gitlab/pipeline/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index 7e84694c24775..c73268caa79af 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -36,6 +36,9 @@ cargo-deny-licenses: - !reference [.rusty-cachier, after_script] - echo "___The complete log is in the artifacts___" - $CARGO_DENY_CMD 2> deny.log + - if [ $CI_JOB_STATUS != 'success' ]; then + echo 'Please check license of your crate or add an exception to scripts/ci/deny.toml'; + fi artifacts: name: $CI_COMMIT_SHORT_SHA expire_in: 3 days From b5846ccc8480806aa6035ae4d2e89d61930f697e Mon Sep 17 00:00:00 2001 From: yjh Date: Tue, 25 Apr 2023 16:18:35 +0800 Subject: [PATCH 68/93] refactor(cli): Make some run params reusable (#13870) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: extract TelemetryParams and PrometheusParams * improve run_cmd docs * extract `RuntimeParams` * use `normalize` * keep params types same style * improve `max_runtime_instances` * fmt * add license and improve code * Update client/cli/src/params/runtime_params.rs Co-authored-by: Bastian Köcher --------- Co-authored-by: Bastian Köcher --- client/cli/src/commands/run_cmd.rs | 121 +++++---------------- client/cli/src/params/keystore_params.rs | 2 +- client/cli/src/params/message_params.rs | 5 +- client/cli/src/params/mod.rs | 7 +- client/cli/src/params/prometheus_params.rs | 63 +++++++++++ client/cli/src/params/pruning_params.rs | 2 +- client/cli/src/params/runtime_params.rs | 43 ++++++++ client/cli/src/params/shared_params.rs | 2 +- client/cli/src/params/telemetry_params.rs | 68 ++++++++++++ 9 files changed, 210 insertions(+), 103 deletions(-) create mode 100644 client/cli/src/params/prometheus_params.rs create mode 100644 client/cli/src/params/runtime_params.rs create mode 100644 client/cli/src/params/telemetry_params.rs diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index 9441acecc4dfc..a38ba6f49e3dd 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -23,7 +23,7 @@ use crate::{ ImportParams, KeystoreParams, NetworkParams, OffchainWorkerParams, SharedParams, TransactionPoolParams, }, - CliConfiguration, + CliConfiguration, PrometheusParams, RuntimeParams, TelemetryParams, }; use clap::Parser; use regex::Regex; @@ -116,12 +116,6 @@ pub struct RunCmd { #[arg(long)] pub rpc_max_subscriptions_per_connection: Option, - /// Expose Prometheus exporter on all interfaces. - /// - /// Default is local. - #[arg(long)] - pub prometheus_external: bool, - /// DEPRECATED, IPC support has been removed. #[arg(long, value_name = "PATH")] pub ipc_path: Option, @@ -151,36 +145,23 @@ pub struct RunCmd { #[arg(long, value_name = "ORIGINS", value_parser = parse_cors)] pub rpc_cors: Option, - /// Specify Prometheus exporter TCP Port. - #[arg(long, value_name = "PORT")] - pub prometheus_port: Option, - - /// Do not expose a Prometheus exporter endpoint. - /// - /// Prometheus metric endpoint is enabled by default. - #[arg(long)] - pub no_prometheus: bool, - /// The human-readable name for this node. /// - /// The node name will be reported to the telemetry server, if enabled. + /// It's used as network node name. #[arg(long, value_name = "NAME")] pub name: Option, - /// Disable connecting to the Substrate telemetry server. - /// - /// Telemetry is on by default on global chains. - #[arg(long)] - pub no_telemetry: bool, + #[allow(missing_docs)] + #[clap(flatten)] + pub telemetry_params: TelemetryParams, - /// The URL of the telemetry server to connect to. - /// - /// This flag can be passed multiple times as a means to specify multiple - /// telemetry endpoints. Verbosity levels range from 0-9, with 0 denoting - /// the least verbosity. - /// Expected format is 'URL VERBOSITY', e.g. `--telemetry-url 'wss://foo/bar 0'`. - #[arg(long = "telemetry-url", value_name = "URL VERBOSITY", value_parser = parse_telemetry_endpoints)] - pub telemetry_endpoints: Vec<(String, u8)>, + #[allow(missing_docs)] + #[clap(flatten)] + pub prometheus_params: PrometheusParams, + + #[allow(missing_docs)] + #[clap(flatten)] + pub runtime_params: RuntimeParams, #[allow(missing_docs)] #[clap(flatten)] @@ -202,6 +183,10 @@ pub struct RunCmd { #[clap(flatten)] pub pool_config: TransactionPoolParams, + #[allow(missing_docs)] + #[clap(flatten)] + pub keystore_params: KeystoreParams, + /// Shortcut for `--name Alice --validator` with session keys for `Alice` added to keystore. #[arg(long, conflicts_with_all = &["bob", "charlie", "dave", "eve", "ferdie", "one", "two"])] pub alice: bool, @@ -239,20 +224,6 @@ pub struct RunCmd { #[arg(long)] pub force_authoring: bool, - #[allow(missing_docs)] - #[clap(flatten)] - pub keystore_params: KeystoreParams, - - /// The size of the instances cache for each runtime. - /// - /// The default value is 8 and the values higher than 256 are ignored. - #[arg(long)] - pub max_runtime_instances: Option, - - /// Maximum number of different runtimes that can be cached. - #[arg(long, default_value_t = 2)] - pub runtime_cache_size: u8, - /// Run a temporary node. /// /// A temporary directory will be created to store the configuration and will be deleted @@ -345,11 +316,12 @@ impl CliConfiguration for RunCmd { &self, chain_spec: &Box, ) -> Result> { - Ok(if self.no_telemetry { + let params = &self.telemetry_params; + Ok(if params.no_telemetry { None - } else if !self.telemetry_endpoints.is_empty() { + } else if !params.telemetry_endpoints.is_empty() { Some( - TelemetryEndpoints::new(self.telemetry_endpoints.clone()) + TelemetryEndpoints::new(params.telemetry_endpoints.clone()) .map_err(|e| e.to_string())?, ) } else { @@ -361,7 +333,7 @@ impl CliConfiguration for RunCmd { let keyring = self.get_keyring(); let is_authority = self.validator || is_dev || keyring.is_some(); - Ok(if is_authority { sc_service::Role::Authority } else { sc_service::Role::Full }) + Ok(if is_authority { Role::Authority } else { Role::Full }) } fn force_authoring(&self) -> Result { @@ -374,20 +346,9 @@ impl CliConfiguration for RunCmd { default_listen_port: u16, chain_spec: &Box, ) -> Result> { - Ok(if self.no_prometheus { - None - } else { - let interface = - if self.prometheus_external { Ipv4Addr::UNSPECIFIED } else { Ipv4Addr::LOCALHOST }; - - Some(PrometheusConfig::new_with_default_registry( - SocketAddr::new( - interface.into(), - self.prometheus_port.unwrap_or(default_listen_port), - ), - chain_spec.id().into(), - )) - }) + Ok(self + .prometheus_params + .prometheus_config(default_listen_port, chain_spec.id().to_string())) } fn disable_grandpa(&self) -> Result { @@ -474,11 +435,11 @@ impl CliConfiguration for RunCmd { } fn max_runtime_instances(&self) -> Result> { - Ok(self.max_runtime_instances.map(|x| x.min(256))) + Ok(Some(self.runtime_params.max_runtime_instances)) } fn runtime_cache_size(&self) -> Result { - Ok(self.runtime_cache_size) + Ok(self.runtime_params.runtime_cache_size) } fn base_path(&self) -> Result> { @@ -546,36 +507,6 @@ fn rpc_interface( } } -#[derive(Debug)] -enum TelemetryParsingError { - MissingVerbosity, - VerbosityParsingError(std::num::ParseIntError), -} - -impl std::error::Error for TelemetryParsingError {} - -impl std::fmt::Display for TelemetryParsingError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - TelemetryParsingError::MissingVerbosity => write!(f, "Verbosity level missing"), - TelemetryParsingError::VerbosityParsingError(e) => write!(f, "{}", e), - } - } -} - -fn parse_telemetry_endpoints(s: &str) -> std::result::Result<(String, u8), TelemetryParsingError> { - let pos = s.find(' '); - match pos { - None => Err(TelemetryParsingError::MissingVerbosity), - Some(pos_) => { - let url = s[..pos_].to_string(); - let verbosity = - s[pos_ + 1..].parse().map_err(TelemetryParsingError::VerbosityParsingError)?; - Ok((url, verbosity)) - }, - } -} - /// CORS setting /// /// The type is introduced to overcome `Option>` handling of `clap`. diff --git a/client/cli/src/params/keystore_params.rs b/client/cli/src/params/keystore_params.rs index 8933110c400b7..a2fdd6b2218c4 100644 --- a/client/cli/src/params/keystore_params.rs +++ b/client/cli/src/params/keystore_params.rs @@ -61,7 +61,7 @@ pub struct KeystoreParams { pub password_filename: Option, } -/// Parse a sercret string, returning a displayable error. +/// Parse a secret string, returning a displayable error. pub fn secret_string_from_str(s: &str) -> std::result::Result { std::str::FromStr::from_str(s).map_err(|_| "Could not get SecretString".to_string()) } diff --git a/client/cli/src/params/message_params.rs b/client/cli/src/params/message_params.rs index a935bbb25bddd..3fcb6f2c6e8cc 100644 --- a/client/cli/src/params/message_params.rs +++ b/client/cli/src/params/message_params.rs @@ -20,14 +20,13 @@ use crate::error::Error; use array_bytes::{hex2bytes, hex_bytes2hex_str}; -use clap::Parser; +use clap::Args; use std::io::BufRead; /// Params to configure how a message should be passed into a command. -#[derive(Parser, Debug, Clone)] +#[derive(Debug, Clone, Args)] pub struct MessageParams { /// Message to process. Will be read from STDIN otherwise. - /// /// The message is assumed to be raw bytes per default. Use `--hex` for hex input. Can /// optionally be prefixed with `0x` in the hex case. #[arg(long)] diff --git a/client/cli/src/params/mod.rs b/client/cli/src/params/mod.rs index f9c840d2d4865..247ffc0e04ba5 100644 --- a/client/cli/src/params/mod.rs +++ b/client/cli/src/params/mod.rs @@ -22,8 +22,11 @@ mod message_params; mod network_params; mod node_key_params; mod offchain_worker_params; +mod prometheus_params; mod pruning_params; +mod runtime_params; mod shared_params; +mod telemetry_params; mod transaction_pool_params; use crate::arg_enums::{CryptoScheme, OutputType}; @@ -37,8 +40,8 @@ use std::{fmt::Debug, str::FromStr}; pub use crate::params::{ database_params::*, import_params::*, keystore_params::*, message_params::*, network_params::*, - node_key_params::*, offchain_worker_params::*, pruning_params::*, shared_params::*, - transaction_pool_params::*, + node_key_params::*, offchain_worker_params::*, prometheus_params::*, pruning_params::*, + runtime_params::*, shared_params::*, telemetry_params::*, transaction_pool_params::*, }; /// Parse Ss58AddressFormat diff --git a/client/cli/src/params/prometheus_params.rs b/client/cli/src/params/prometheus_params.rs new file mode 100644 index 0000000000000..69199ad5b2603 --- /dev/null +++ b/client/cli/src/params/prometheus_params.rs @@ -0,0 +1,63 @@ +// 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 . + +use clap::Args; +use sc_service::config::PrometheusConfig; +use std::net::{Ipv4Addr, SocketAddr}; + +/// Parameters used to config prometheus. +#[derive(Debug, Clone, Args)] +pub struct PrometheusParams { + /// Specify Prometheus exporter TCP Port. + #[arg(long, value_name = "PORT")] + pub prometheus_port: Option, + /// Expose Prometheus exporter on all interfaces. + /// + /// Default is local. + #[arg(long)] + pub prometheus_external: bool, + /// Do not expose a Prometheus exporter endpoint. + /// + /// Prometheus metric endpoint is enabled by default. + #[arg(long)] + pub no_prometheus: bool, +} + +impl PrometheusParams { + /// Creates [`PrometheusConfig`]. + pub fn prometheus_config( + &self, + default_listen_port: u16, + chain_id: String, + ) -> Option { + if self.no_prometheus { + None + } else { + let interface = + if self.prometheus_external { Ipv4Addr::UNSPECIFIED } else { Ipv4Addr::LOCALHOST }; + + Some(PrometheusConfig::new_with_default_registry( + SocketAddr::new( + interface.into(), + self.prometheus_port.unwrap_or(default_listen_port), + ), + chain_id, + )) + } + } +} diff --git a/client/cli/src/params/pruning_params.rs b/client/cli/src/params/pruning_params.rs index 59eeb13cd0379..757da2dd9cbb5 100644 --- a/client/cli/src/params/pruning_params.rs +++ b/client/cli/src/params/pruning_params.rs @@ -21,7 +21,7 @@ use clap::Args; use sc_service::{BlocksPruning, PruningMode}; /// Parameters to define the pruning mode -#[derive(Debug, Clone, PartialEq, Args)] +#[derive(Debug, Clone, Args)] pub struct PruningParams { /// Specify the state pruning mode. /// diff --git a/client/cli/src/params/runtime_params.rs b/client/cli/src/params/runtime_params.rs new file mode 100644 index 0000000000000..79035fc7d4c5d --- /dev/null +++ b/client/cli/src/params/runtime_params.rs @@ -0,0 +1,43 @@ +// 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 . + +use clap::Args; +use std::str::FromStr; + +/// Parameters used to config runtime. +#[derive(Debug, Clone, Args)] +pub struct RuntimeParams { + /// The size of the instances cache for each runtime. The values higher than 256 are illegal. + #[arg(long, default_value_t = 8, value_parser = parse_max_runtime_instances)] + pub max_runtime_instances: usize, + + /// Maximum number of different runtimes that can be cached. + #[arg(long, default_value_t = 2)] + pub runtime_cache_size: u8, +} + +fn parse_max_runtime_instances(s: &str) -> Result { + let max_runtime_instances = usize::from_str(s) + .map_err(|_err| format!("Illegal `--max-runtime-instances` value: {s}"))?; + + if max_runtime_instances > 256 { + Err(format!("Illegal `--max-runtime-instances` value: {max_runtime_instances} is more than the allowed maximum of `256` ")) + } else { + Ok(max_runtime_instances) + } +} diff --git a/client/cli/src/params/shared_params.rs b/client/cli/src/params/shared_params.rs index 46f5390039d46..913a6c436185c 100644 --- a/client/cli/src/params/shared_params.rs +++ b/client/cli/src/params/shared_params.rs @@ -22,7 +22,7 @@ use sc_service::config::BasePath; use std::path::PathBuf; /// Shared parameters used by all `CoreParams`. -#[derive(Debug, Clone, PartialEq, Args)] +#[derive(Debug, Clone, Args)] pub struct SharedParams { /// Specify the chain specification. /// diff --git a/client/cli/src/params/telemetry_params.rs b/client/cli/src/params/telemetry_params.rs new file mode 100644 index 0000000000000..ca096419869af --- /dev/null +++ b/client/cli/src/params/telemetry_params.rs @@ -0,0 +1,68 @@ +// 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 . + +use clap::Args; + +/// Parameters used to config telemetry. +#[derive(Debug, Clone, Args)] +pub struct TelemetryParams { + /// Disable connecting to the Substrate telemetry server. + /// + /// Telemetry is on by default on global chains. + #[arg(long)] + pub no_telemetry: bool, + + /// The URL of the telemetry server to connect to. + /// + /// This flag can be passed multiple times as a means to specify multiple + /// telemetry endpoints. Verbosity levels range from 0-9, with 0 denoting + /// the least verbosity. + /// Expected format is 'URL VERBOSITY', e.g. `--telemetry-url 'wss://foo/bar 0'`. + #[arg(long = "telemetry-url", value_name = "URL VERBOSITY", value_parser = parse_telemetry_endpoints)] + pub telemetry_endpoints: Vec<(String, u8)>, +} + +#[derive(Debug)] +enum TelemetryParsingError { + MissingVerbosity, + VerbosityParsingError(std::num::ParseIntError), +} + +impl std::error::Error for TelemetryParsingError {} + +impl std::fmt::Display for TelemetryParsingError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + TelemetryParsingError::MissingVerbosity => write!(f, "Verbosity level missing"), + TelemetryParsingError::VerbosityParsingError(e) => write!(f, "{}", e), + } + } +} + +fn parse_telemetry_endpoints(s: &str) -> Result<(String, u8), TelemetryParsingError> { + let pos = s.find(' '); + match pos { + None => Err(TelemetryParsingError::MissingVerbosity), + Some(pos_) => { + let url = s[..pos_].to_string(); + let verbosity = + s[pos_ + 1..].parse().map_err(TelemetryParsingError::VerbosityParsingError)?; + Ok((url, verbosity)) + }, + } +} From 8cb72571798a0d2d9ad089ba977c310ddb2b5c11 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Tue, 25 Apr 2023 13:46:20 +0200 Subject: [PATCH 69/93] contracts Add LOG_TARGET constant (#14002) * contracts Add LOG_TARGET constant * Update frame/contracts/src/lib.rs Co-authored-by: Sasha Gryaznov --------- Co-authored-by: Sasha Gryaznov --- frame/contracts/src/exec.rs | 6 +++--- frame/contracts/src/lib.rs | 7 +++++++ frame/contracts/src/storage/meter.rs | 6 +++--- frame/contracts/src/wasm/mod.rs | 6 +++--- frame/contracts/src/wasm/prepare.rs | 10 +++++----- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 574f4495e479f..46a611dbfd09b 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -19,7 +19,7 @@ use crate::{ gas::GasMeter, storage::{self, DepositAccount, WriteOutcome}, BalanceOf, CodeHash, Config, ContractInfo, ContractInfoOf, DebugBufferVec, Determinism, Error, - Event, Nonce, Pallet as Contracts, Schedule, System, + Event, Nonce, Pallet as Contracts, Schedule, System, LOG_TARGET, }; use frame_support::{ crypto::ecdsa::ECDSAExt, @@ -1002,7 +1002,7 @@ where } else { if let Some((msg, false)) = self.debug_message.as_ref().map(|m| (m, m.is_empty())) { log::debug!( - target: "runtime::contracts", + target: LOG_TARGET, "Execution finished with debug buffer: {}", core::str::from_utf8(msg).unwrap_or(""), ); @@ -1331,7 +1331,7 @@ where .try_extend(&mut msg.bytes()) .map_err(|_| { log::debug!( - target: "runtime::contracts", + target: LOG_TARGET, "Debug buffer (of {} bytes) exhausted!", DebugBufferVec::::bound(), ) diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index fa230a8cade14..118da36ae88a1 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -163,6 +163,13 @@ type OldWeight = u64; /// that this value makes sense for a memory location or length. const SENTINEL: u32 = u32::MAX; +/// The target that is used for the log output emitted by this crate. +/// +/// Hence you can use this target to selectively increase the log level for this crate. +/// +/// Example: `RUST_LOG=runtime::contracts=debug my_code --dev` +const LOG_TARGET: &str = "runtime::contracts"; + #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/frame/contracts/src/storage/meter.rs b/frame/contracts/src/storage/meter.rs index 497ee03ac319a..51a0af574bcd5 100644 --- a/frame/contracts/src/storage/meter.rs +++ b/frame/contracts/src/storage/meter.rs @@ -19,7 +19,7 @@ use crate::{ storage::{ContractInfo, DepositAccount}, - BalanceOf, Config, Error, Inspect, Pallet, System, + BalanceOf, Config, Error, Inspect, Pallet, System, LOG_TARGET, }; use codec::Encode; use frame_support::{ @@ -502,7 +502,7 @@ impl Ext for ReservingExt { ); if let Err(err) = result { log::error!( - target: "runtime::contracts", + target: LOG_TARGET, "Failed to transfer storage deposit {:?} from origin {:?} to deposit account {:?}: {:?}", amount, origin, deposit_account, err, ); @@ -531,7 +531,7 @@ impl Ext for ReservingExt { ); if matches!(result, Err(_)) { log::error!( - target: "runtime::contracts", + target: LOG_TARGET, "Failed to refund storage deposit {:?} from deposit account {:?} to origin {:?}: {:?}", amount, deposit_account, origin, result, ); diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index c8f1be6dd9db1..4723f0c833654 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -43,7 +43,7 @@ use crate::{ exec::{ExecResult, Executable, ExportedFunction, Ext}, gas::GasMeter, AccountIdOf, BalanceOf, CodeHash, CodeVec, Config, Error, OwnerInfoOf, RelaxedCodeVec, - Schedule, + Schedule, LOG_TARGET, }; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::dispatch::{DispatchError, DispatchResult}; @@ -326,7 +326,7 @@ impl Executable for PrefabWasmModule { }, ) .map_err(|msg| { - log::debug!(target: "runtime::contracts", "failed to instantiate code: {}", msg); + log::debug!(target: LOG_TARGET, "failed to instantiate code: {}", msg); Error::::CodeRejected })?; store.data_mut().set_memory(memory); @@ -335,7 +335,7 @@ impl Executable for PrefabWasmModule { .get_export(&store, function.identifier()) .and_then(|export| export.into_func()) .ok_or_else(|| { - log::error!(target: "runtime::contracts", "failed to find entry point"); + log::error!(target: LOG_TARGET, "failed to find entry point"); Error::::CodeRejected })?; diff --git a/frame/contracts/src/wasm/prepare.rs b/frame/contracts/src/wasm/prepare.rs index f0065d77a1c9a..14fec834733eb 100644 --- a/frame/contracts/src/wasm/prepare.rs +++ b/frame/contracts/src/wasm/prepare.rs @@ -25,7 +25,7 @@ use crate::{ wasm::{ runtime::AllowDeprecatedInterface, Determinism, Environment, OwnerInfo, PrefabWasmModule, }, - AccountIdOf, CodeVec, Config, Error, Schedule, + AccountIdOf, CodeVec, Config, Error, Schedule, LOG_TARGET, }; use codec::{Encode, MaxEncodedLen}; use sp_runtime::{traits::Hash, DispatchError}; @@ -379,7 +379,7 @@ where }) .validate_all(original_code) .map_err(|err| { - log::debug!(target: "runtime::contracts", "{}", err); + log::debug!(target: LOG_TARGET, "{}", err); (Error::::CodeRejected.into(), "validation of new code failed") })?; @@ -403,7 +403,7 @@ where Ok((code, memory_limits)) })() .map_err(|msg: &str| { - log::debug!(target: "runtime::contracts", "new code rejected: {}", msg); + log::debug!(target: LOG_TARGET, "new code rejected: {}", msg); (Error::::CodeRejected.into(), msg) })?; @@ -426,7 +426,7 @@ where }, ) .map_err(|err| { - log::debug!(target: "runtime::contracts", "{}", err); + log::debug!(target: LOG_TARGET, "{}", err); (Error::::CodeRejected.into(), "new code rejected after instrumentation") })?; } @@ -518,7 +518,7 @@ where InstrumentReason::Reinstrument, ) .map_err(|(err, msg)| { - log::error!(target: "runtime::contracts", "CodeRejected during reinstrument: {}", msg); + log::error!(target: LOG_TARGET, "CodeRejected during reinstrument: {}", msg); err }) .map(|(code, _)| code) From 6f0f5a92739b92199b3345fc4a716211c8a8b46f Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Tue, 25 Apr 2023 19:58:21 +0800 Subject: [PATCH 70/93] frame-support: migrate some tests from `decl_*` macros to the new `pallet` macros (#12401) * frame-support: migrate some tests from decl macros to new pallet attribute macros * Remove useless type alias * Remove useless type alias * Work around for rust issue 52234 Signed-off-by: Oliver Tale-Yazdi * Fix tests Signed-off-by: Oliver Tale-Yazdi * Use polkadot-compatible paste version Signed-off-by: Oliver Tale-Yazdi * Fix crate access and add tests Signed-off-by: Oliver Tale-Yazdi * Typo Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: Oliver Tale-Yazdi Co-authored-by: parity-processbot <> --- Cargo.lock | 5 +- frame/support/src/dispatch.rs | 183 +++++++++----- frame/support/src/lib.rs | 237 ++++++++++++------ .../src/storage/generator/double_map.rs | 43 +--- frame/support/src/storage/generator/map.rs | 43 +--- frame/support/src/storage/generator/mod.rs | 128 ++++++++-- frame/support/src/storage/generator/nmap.rs | 61 ++--- primitives/core/Cargo.toml | 1 + primitives/core/src/lib.rs | 85 ++++--- primitives/runtime/src/lib.rs | 20 ++ 10 files changed, 490 insertions(+), 316 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 79b79e2b2ef45..8d8d2d59a3c88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7239,9 +7239,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pbkdf2" @@ -10503,6 +10503,7 @@ dependencies = [ "merlin", "parity-scale-codec", "parking_lot 0.12.1", + "paste", "primitive-types", "rand 0.8.5", "regex", diff --git a/frame/support/src/dispatch.rs b/frame/support/src/dispatch.rs index 9e949ef6d4a21..c75d75b41a292 100644 --- a/frame/support/src/dispatch.rs +++ b/frame/support/src/dispatch.rs @@ -3532,112 +3532,177 @@ mod tests { #[allow(dead_code)] mod weight_tests { use super::{tests::*, *}; - use sp_core::{parameter_types, Get}; + use sp_core::parameter_types; + use sp_runtime::{generic, traits::BlakeTwo256}; use sp_weights::RuntimeDbWeight; - pub trait Config: 'static { - type RuntimeOrigin; - type Balance; - type BlockNumber; - type DbWeight: Get; - type PalletInfo: crate::traits::PalletInfo; - } + pub use self::frame_system::{Call, Config, Pallet}; - pub struct TraitImpl {} + #[crate::pallet(dev_mode)] + pub mod frame_system { + use super::{frame_system, frame_system::pallet_prelude::*}; + pub use crate::dispatch::RawOrigin; + use crate::pallet_prelude::*; - parameter_types! { - pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 100, - write: 1000, - }; - } + #[pallet::pallet] + pub struct Pallet(PhantomData); - impl Config for TraitImpl { - type RuntimeOrigin = u32; - type BlockNumber = u32; - type Balance = u32; - type DbWeight = DbWeight; - type PalletInfo = crate::tests::PanicPalletInfo; - } + #[pallet::config] + #[pallet::disable_frame_system_supertrait_check] + pub trait Config: 'static { + type BlockNumber: Parameter + Default + MaxEncodedLen; + type AccountId; + type Balance; + type BaseCallFilter: crate::traits::Contains; + type RuntimeOrigin; + type RuntimeCall; + type PalletInfo: crate::traits::PalletInfo; + type DbWeight: Get; + } - decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin, system=self { + #[pallet::error] + pub enum Error { + /// Required by construct_runtime + CallFiltered, + } + + #[pallet::origin] + pub type Origin = RawOrigin<::AccountId>; + + #[pallet::call] + impl Pallet { // no arguments, fixed weight - #[weight = 1000] - fn f00(_origin) { unimplemented!(); } + #[pallet::weight(1000)] + pub fn f00(_origin: OriginFor) -> DispatchResult { + unimplemented!(); + } - #[weight = (1000, DispatchClass::Mandatory)] - fn f01(_origin) { unimplemented!(); } + #[pallet::weight((1000, DispatchClass::Mandatory))] + pub fn f01(_origin: OriginFor) -> DispatchResult { + unimplemented!(); + } - #[weight = (1000, Pays::No)] - fn f02(_origin) { unimplemented!(); } + #[pallet::weight((1000, Pays::No))] + pub fn f02(_origin: OriginFor) -> DispatchResult { + unimplemented!(); + } - #[weight = (1000, DispatchClass::Operational, Pays::No)] - fn f03(_origin) { unimplemented!(); } + #[pallet::weight((1000, DispatchClass::Operational, Pays::No))] + pub fn f03(_origin: OriginFor) -> DispatchResult { + unimplemented!(); + } // weight = a x 10 + b - #[weight = ((_a * 10 + _eb * 1) as u64, DispatchClass::Normal, Pays::Yes)] - fn f11(_origin, _a: u32, _eb: u32) { unimplemented!(); } + #[pallet::weight(((_a * 10 + _eb * 1) as u64, DispatchClass::Normal, Pays::Yes))] + pub fn f11(_origin: OriginFor, _a: u32, _eb: u32) -> DispatchResult { + unimplemented!(); + } - #[weight = (0, DispatchClass::Operational, Pays::Yes)] - fn f12(_origin, _a: u32, _eb: u32) { unimplemented!(); } + #[pallet::weight((0, DispatchClass::Operational, Pays::Yes))] + pub fn f12(_origin: OriginFor, _a: u32, _eb: u32) -> DispatchResult { + unimplemented!(); + } - #[weight = T::DbWeight::get().reads(3) + T::DbWeight::get().writes(2) + Weight::from_parts(10_000, 0)] - fn f20(_origin) { unimplemented!(); } + #[pallet::weight(T::DbWeight::get().reads(3) + T::DbWeight::get().writes(2) + Weight::from_all(10_000))] + pub fn f20(_origin: OriginFor) -> DispatchResult { + unimplemented!(); + } + + #[pallet::weight(T::DbWeight::get().reads_writes(6, 5) + Weight::from_all(40_000))] + pub fn f21(_origin: OriginFor) -> DispatchResult { + unimplemented!(); + } + } + + pub mod pallet_prelude { + pub type OriginFor = ::RuntimeOrigin; + } + } - #[weight = T::DbWeight::get().reads_writes(6, 5) + Weight::from_parts(40_000, 0)] - fn f21(_origin) { unimplemented!(); } + type BlockNumber = u32; + type AccountId = u32; + type Balance = u32; + type Header = generic::Header; + type UncheckedExtrinsic = generic::UncheckedExtrinsic; + type Block = generic::Block; + crate::construct_runtime!( + pub enum Runtime + where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: self::frame_system, } + ); + + parameter_types! { + pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 100, + write: 1000, + }; + } + + impl Config for Runtime { + type BlockNumber = BlockNumber; + type AccountId = AccountId; + type Balance = Balance; + type BaseCallFilter = crate::traits::Everything; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type DbWeight = DbWeight; + type PalletInfo = PalletInfo; } #[test] fn weights_are_correct() { - // #[weight = 1000] - let info = Call::::f00 {}.get_dispatch_info(); + // #[pallet::weight(1000)] + let info = Call::::f00 {}.get_dispatch_info(); assert_eq!(info.weight, Weight::from_parts(1000, 0)); assert_eq!(info.class, DispatchClass::Normal); assert_eq!(info.pays_fee, Pays::Yes); - // #[weight = (1000, DispatchClass::Mandatory)] - let info = Call::::f01 {}.get_dispatch_info(); + // #[pallet::weight((1000, DispatchClass::Mandatory))] + let info = Call::::f01 {}.get_dispatch_info(); assert_eq!(info.weight, Weight::from_parts(1000, 0)); assert_eq!(info.class, DispatchClass::Mandatory); assert_eq!(info.pays_fee, Pays::Yes); - // #[weight = (1000, Pays::No)] - let info = Call::::f02 {}.get_dispatch_info(); + // #[pallet::weight((1000, Pays::No))] + let info = Call::::f02 {}.get_dispatch_info(); assert_eq!(info.weight, Weight::from_parts(1000, 0)); assert_eq!(info.class, DispatchClass::Normal); assert_eq!(info.pays_fee, Pays::No); - // #[weight = (1000, DispatchClass::Operational, Pays::No)] - let info = Call::::f03 {}.get_dispatch_info(); + // #[pallet::weight((1000, DispatchClass::Operational, Pays::No))] + let info = Call::::f03 {}.get_dispatch_info(); assert_eq!(info.weight, Weight::from_parts(1000, 0)); assert_eq!(info.class, DispatchClass::Operational); assert_eq!(info.pays_fee, Pays::No); - // #[weight = ((_a * 10 + _eb * 1) as Weight, DispatchClass::Normal, Pays::Yes)] - let info = Call::::f11 { _a: 13, _eb: 20 }.get_dispatch_info(); + // #[pallet::weight(((_a * 10 + _eb * 1) as u64, DispatchClass::Normal, Pays::Yes))] + let info = Call::::f11 { a: 13, eb: 20 }.get_dispatch_info(); assert_eq!(info.weight, Weight::from_parts(150, 0)); // 13*10 + 20 assert_eq!(info.class, DispatchClass::Normal); assert_eq!(info.pays_fee, Pays::Yes); - // #[weight = (0, DispatchClass::Operational, Pays::Yes)] - let info = Call::::f12 { _a: 10, _eb: 20 }.get_dispatch_info(); - assert_eq!(info.weight, Weight::from_parts(0, 0)); + // #[pallet::weight((0, DispatchClass::Operational, Pays::Yes))] + let info = Call::::f12 { a: 10, eb: 20 }.get_dispatch_info(); + assert_eq!(info.weight, Weight::zero()); assert_eq!(info.class, DispatchClass::Operational); assert_eq!(info.pays_fee, Pays::Yes); - // #[weight = T::DbWeight::get().reads(3) + T::DbWeight::get().writes(2) + 10_000] - let info = Call::::f20 {}.get_dispatch_info(); - assert_eq!(info.weight, Weight::from_parts(12300, 0)); // 100*3 + 1000*2 + 10_1000 + // #[pallet::weight(T::DbWeight::get().reads(3) + T::DbWeight::get().writes(2) + + // Weight::from_all(10_000))] + let info = Call::::f20 {}.get_dispatch_info(); + assert_eq!(info.weight, Weight::from_parts(12300, 10000)); // 100*3 + 1000*2 + 10_1000 assert_eq!(info.class, DispatchClass::Normal); assert_eq!(info.pays_fee, Pays::Yes); - // #[weight = T::DbWeight::get().reads_writes(6, 5) + 40_000] - let info = Call::::f21 {}.get_dispatch_info(); - assert_eq!(info.weight, Weight::from_parts(45600, 0)); // 100*6 + 1000*5 + 40_1000 + // #[pallet::weight(T::DbWeight::get().reads_writes(6, 5) + Weight::from_all(40_000))] + let info = Call::::f21 {}.get_dispatch_info(); + assert_eq!(info.weight, Weight::from_parts(45600, 40000)); // 100*6 + 1000*5 + 40_1000 assert_eq!(info.class, DispatchClass::Normal); assert_eq!(info.pays_fee, Pays::Yes); } diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 036bd93464b9f..0ee82b9f16a8f 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -829,77 +829,153 @@ pub mod tests { PalletStorageMetadataIR, StorageEntryMetadataIR, StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR, }; - use codec::{Codec, EncodeLike}; - use frame_support::traits::CrateVersion; use sp_io::{MultiRemovalResults, TestExternalities}; + use sp_runtime::{generic, traits::BlakeTwo256, BuildStorage}; use sp_std::result; - /// A PalletInfo implementation which just panics. - pub struct PanicPalletInfo; + pub use self::frame_system::{Config, Pallet}; - impl crate::traits::PalletInfo for PanicPalletInfo { - fn index() -> Option { - unimplemented!("PanicPalletInfo mustn't be triggered by tests"); - } - fn name() -> Option<&'static str> { - unimplemented!("PanicPalletInfo mustn't be triggered by tests"); - } - fn module_name() -> Option<&'static str> { - unimplemented!("PanicPalletInfo mustn't be triggered by tests"); - } - fn crate_version() -> Option { - unimplemented!("PanicPalletInfo mustn't be triggered by tests"); + #[pallet] + pub mod frame_system { + #[allow(unused)] + use super::{frame_system, frame_system::pallet_prelude::*}; + pub use crate::dispatch::RawOrigin; + use crate::pallet_prelude::*; + + #[pallet::pallet] + pub struct Pallet(PhantomData); + + #[pallet::config] + #[pallet::disable_frame_system_supertrait_check] + pub trait Config: 'static { + type BlockNumber: Parameter + Default + MaxEncodedLen; + type AccountId; + type BaseCallFilter: crate::traits::Contains; + type RuntimeOrigin; + type RuntimeCall; + type PalletInfo: crate::traits::PalletInfo; + type DbWeight: Get; } - } - pub trait Config: 'static { - type BlockNumber: Codec + EncodeLike + Default + TypeInfo; - type RuntimeOrigin; - type PalletInfo: crate::traits::PalletInfo; - type DbWeight: crate::traits::Get; - } + #[pallet::error] + pub enum Error { + /// Required by construct_runtime + CallFiltered, + } - mod module { - #![allow(dead_code)] + #[pallet::origin] + pub type Origin = RawOrigin<::AccountId>; + + #[pallet::call] + impl Pallet {} + + #[pallet::storage] + pub type Data = StorageMap<_, Twox64Concat, u32, u64, ValueQuery>; + + #[pallet::storage] + pub type OptionLinkedMap = StorageMap<_, Blake2_128Concat, u32, u32, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn generic_data)] + pub type GenericData = + StorageMap<_, Identity, T::BlockNumber, T::BlockNumber, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn generic_data2)] + pub type GenericData2 = + StorageMap<_, Blake2_128Concat, T::BlockNumber, T::BlockNumber, OptionQuery>; + + #[pallet::storage] + pub type DataDM = + StorageDoubleMap<_, Twox64Concat, u32, Blake2_128Concat, u32, u64, ValueQuery>; + + #[pallet::storage] + pub type GenericDataDM = StorageDoubleMap< + _, + Blake2_128Concat, + T::BlockNumber, + Identity, + T::BlockNumber, + T::BlockNumber, + ValueQuery, + >; + + #[pallet::storage] + pub type GenericData2DM = StorageDoubleMap< + _, + Blake2_128Concat, + T::BlockNumber, + Twox64Concat, + T::BlockNumber, + T::BlockNumber, + OptionQuery, + >; + + #[pallet::storage] + #[pallet::unbounded] + pub type AppendableDM = StorageDoubleMap< + _, + Blake2_128Concat, + u32, + Blake2_128Concat, + T::BlockNumber, + Vec, + ValueQuery, + >; + + #[pallet::genesis_config] + pub struct GenesisConfig { + pub data: Vec<(u32, u64)>, + pub test_config: Vec<(u32, u32, u64)>, + } - use super::Config; + impl Default for GenesisConfig { + fn default() -> Self { + Self { data: vec![(15u32, 42u64)], test_config: vec![(15u32, 16u32, 42u64)] } + } + } - decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin, system=self {} + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + for (k, v) in &self.data { + >::insert(k, v); + } + for (k1, k2, v) in &self.test_config { + >::insert(k1, k2, v); + } + } } - } - use self::module::Module; - - decl_storage! { - trait Store for Module as Test { - pub Value get(fn value): u64; - pub Data get(fn data) build(|_| vec![(15u32, 42u64)]): - map hasher(twox_64_concat) u32 => u64; - pub OptionLinkedMap: map hasher(blake2_128_concat) u32 => Option; - pub GenericData get(fn generic_data): - map hasher(identity) T::BlockNumber => T::BlockNumber; - pub GenericData2 get(fn generic_data2): - map hasher(blake2_128_concat) T::BlockNumber => Option; - pub DataDM config(test_config) build(|_| vec![(15u32, 16u32, 42u64)]): - double_map hasher(twox_64_concat) u32, hasher(blake2_128_concat) u32 => u64; - pub GenericDataDM: - double_map hasher(blake2_128_concat) T::BlockNumber, hasher(identity) T::BlockNumber - => T::BlockNumber; - pub GenericData2DM: - double_map hasher(blake2_128_concat) T::BlockNumber, hasher(twox_64_concat) T::BlockNumber - => Option; - pub AppendableDM: - double_map hasher(blake2_128_concat) u32, hasher(blake2_128_concat) T::BlockNumber => Vec; + pub mod pallet_prelude { + pub type OriginFor = ::RuntimeOrigin; } } - struct Test; + type BlockNumber = u32; + type AccountId = u32; + type Header = generic::Header; + type UncheckedExtrinsic = generic::UncheckedExtrinsic; + type Block = generic::Block; + + crate::construct_runtime!( + pub enum Runtime + where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: self::frame_system, + } + ); - impl Config for Test { - type BlockNumber = u32; - type RuntimeOrigin = u32; - type PalletInfo = PanicPalletInfo; + impl Config for Runtime { + type BlockNumber = BlockNumber; + type AccountId = AccountId; + type BaseCallFilter = crate::traits::Everything; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type PalletInfo = PalletInfo; type DbWeight = (); } @@ -907,8 +983,6 @@ pub mod tests { GenesisConfig::default().build_storage().unwrap().into() } - type Map = Data; - trait Sorted { fn sorted(self) -> Self; } @@ -925,15 +999,15 @@ pub mod tests { new_test_ext().execute_with(|| { #[crate::storage_alias] type GenericData2 = StorageMap< - Test, + System, Blake2_128Concat, ::BlockNumber, ::BlockNumber, >; - assert_eq!(Module::::generic_data2(5), None); - GenericData2::::insert(5, 5); - assert_eq!(Module::::generic_data2(5), Some(5)); + assert_eq!(Pallet::::generic_data2(5), None); + GenericData2::::insert(5, 5); + assert_eq!(Pallet::::generic_data2(5), Some(5)); /// Some random docs that ensure that docs are accepted #[crate::storage_alias] @@ -1004,6 +1078,8 @@ pub mod tests { #[test] fn map_issue_3318() { new_test_ext().execute_with(|| { + type OptionLinkedMap = self::frame_system::OptionLinkedMap; + OptionLinkedMap::insert(1, 1); assert_eq!(OptionLinkedMap::get(1), Some(1)); OptionLinkedMap::insert(1, 2); @@ -1014,6 +1090,8 @@ pub mod tests { #[test] fn map_swap_works() { new_test_ext().execute_with(|| { + type OptionLinkedMap = self::frame_system::OptionLinkedMap; + OptionLinkedMap::insert(0, 0); OptionLinkedMap::insert(1, 1); OptionLinkedMap::insert(2, 2); @@ -1043,6 +1121,8 @@ pub mod tests { #[test] fn double_map_swap_works() { new_test_ext().execute_with(|| { + type DataDM = self::frame_system::DataDM; + DataDM::insert(0, 1, 1); DataDM::insert(1, 0, 2); DataDM::insert(1, 1, 3); @@ -1075,6 +1155,8 @@ pub mod tests { #[test] fn map_basic_insert_remove_should_work() { new_test_ext().execute_with(|| { + type Map = self::frame_system::Data; + // initialized during genesis assert_eq!(Map::get(&15u32), 42u64); @@ -1101,6 +1183,8 @@ pub mod tests { #[test] fn map_iteration_should_work() { new_test_ext().execute_with(|| { + type Map = self::frame_system::Data; + assert_eq!(Map::iter().collect::>().sorted(), vec![(15, 42)]); // insert / remove let key = 17u32; @@ -1154,7 +1238,7 @@ pub mod tests { fn double_map_basic_insert_remove_remove_prefix_with_commit_should_work() { let key1 = 17u32; let key2 = 18u32; - type DoubleMap = DataDM; + type DoubleMap = self::frame_system::DataDM; let mut e = new_test_ext(); e.execute_with(|| { // initialized during genesis @@ -1199,7 +1283,7 @@ pub mod tests { new_test_ext().execute_with(|| { let key1 = 17u32; let key2 = 18u32; - type DoubleMap = DataDM; + type DoubleMap = self::frame_system::DataDM; // initialized during genesis assert_eq!(DoubleMap::get(&15u32, &16u32), 42u64); @@ -1247,7 +1331,7 @@ pub mod tests { #[test] fn double_map_append_should_work() { new_test_ext().execute_with(|| { - type DoubleMap = AppendableDM; + type DoubleMap = self::frame_system::AppendableDM; let key1 = 17u32; let key2 = 18u32; @@ -1261,7 +1345,7 @@ pub mod tests { #[test] fn double_map_mutate_exists_should_work() { new_test_ext().execute_with(|| { - type DoubleMap = DataDM; + type DoubleMap = self::frame_system::DataDM; let (key1, key2) = (11, 13); @@ -1278,8 +1362,8 @@ pub mod tests { #[test] fn double_map_try_mutate_exists_should_work() { new_test_ext().execute_with(|| { - type DoubleMap = DataDM; - type TestResult = result::Result<(), &'static str>; + type DoubleMap = self::frame_system::DataDM; + type TestResult = Result<(), &'static str>; let (key1, key2) = (11, 13); @@ -1310,15 +1394,8 @@ pub mod tests { fn expected_metadata() -> PalletStorageMetadataIR { PalletStorageMetadataIR { - prefix: "Test", + prefix: "System", entries: vec![ - StorageEntryMetadataIR { - name: "Value", - modifier: StorageEntryModifierIR::Default, - ty: StorageEntryTypeIR::Plain(scale_info::meta_type::()), - default: vec![0, 0, 0, 0, 0, 0, 0, 0], - docs: vec![], - }, StorageEntryMetadataIR { name: "Data", modifier: StorageEntryModifierIR::Default, @@ -1422,7 +1499,7 @@ pub mod tests { #[test] fn store_metadata() { - let metadata = Module::::storage_metadata(); + let metadata = Pallet::::storage_metadata(); pretty_assertions::assert_eq!(expected_metadata(), metadata); } @@ -1441,12 +1518,6 @@ pub mod tests { assert_eq!(300, StorageParameter::get()); }) } - - parameter_types! { - pub const BlockHashCount: u64 = 250; - pub static Members: Vec = vec![]; - pub const Foo: Option = None; - } } /// Prelude to be used alongside pallet macro, for ease of use. diff --git a/frame/support/src/storage/generator/double_map.rs b/frame/support/src/storage/generator/double_map.rs index 5763a472cd570..5da68873b10e6 100644 --- a/frame/support/src/storage/generator/double_map.rs +++ b/frame/support/src/storage/generator/double_map.rs @@ -514,43 +514,12 @@ where mod test_iterators { use crate::{ hash::StorageHasher, - storage::{generator::StorageDoubleMap, unhashed, IterableStorageDoubleMap}, + storage::{ + generator::{tests::*, StorageDoubleMap}, + unhashed, + }, }; - use codec::{Decode, Encode}; - - pub trait Config: 'static { - type RuntimeOrigin; - type BlockNumber; - type PalletInfo: crate::traits::PalletInfo; - type DbWeight: crate::traits::Get; - } - - crate::decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin, system=self {} - } - - #[derive(PartialEq, Eq, Clone, Encode, Decode)] - struct NoDef(u32); - - crate::decl_storage! { - trait Store for Module as Test { - DoubleMap: double_map hasher(blake2_128_concat) u16, hasher(twox_64_concat) u32 => u64; - } - } - - fn key_before_prefix(mut prefix: Vec) -> Vec { - let last = prefix.iter_mut().last().unwrap(); - assert!(*last != 0, "mock function not implemented for this prefix"); - *last -= 1; - prefix - } - - fn key_after_prefix(mut prefix: Vec) -> Vec { - let last = prefix.iter_mut().last().unwrap(); - assert!(*last != 255, "mock function not implemented for this prefix"); - *last += 1; - prefix - } + use codec::Encode; #[test] fn double_map_iter_from() { @@ -589,6 +558,8 @@ mod test_iterators { #[test] fn double_map_reversible_reversible_iteration() { sp_io::TestExternalities::default().execute_with(|| { + type DoubleMap = self::frame_system::DoubleMap; + // All map iterator let prefix = DoubleMap::prefix_hash(); diff --git a/frame/support/src/storage/generator/map.rs b/frame/support/src/storage/generator/map.rs index fb499384f1506..3b36b9bddb704 100644 --- a/frame/support/src/storage/generator/map.rs +++ b/frame/support/src/storage/generator/map.rs @@ -349,43 +349,12 @@ impl> storage::StorageMap mod test_iterators { use crate::{ hash::StorageHasher, - storage::{generator::StorageMap, unhashed, IterableStorageMap}, + storage::{ + generator::{tests::*, StorageMap}, + unhashed, + }, }; - use codec::{Decode, Encode}; - - pub trait Config: 'static { - type RuntimeOrigin; - type BlockNumber; - type PalletInfo: crate::traits::PalletInfo; - type DbWeight: crate::traits::Get; - } - - crate::decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin, system=self {} - } - - #[derive(PartialEq, Eq, Clone, Encode, Decode)] - struct NoDef(u32); - - crate::decl_storage! { - trait Store for Module as Test { - Map: map hasher(blake2_128_concat) u16 => u64; - } - } - - fn key_before_prefix(mut prefix: Vec) -> Vec { - let last = prefix.iter_mut().last().unwrap(); - assert!(*last != 0, "mock function not implemented for this prefix"); - *last -= 1; - prefix - } - - fn key_after_prefix(mut prefix: Vec) -> Vec { - let last = prefix.iter_mut().last().unwrap(); - assert!(*last != 255, "mock function not implemented for this prefix"); - *last += 1; - prefix - } + use codec::Encode; #[test] fn map_iter_from() { @@ -413,6 +382,8 @@ mod test_iterators { #[test] fn map_reversible_reversible_iteration() { sp_io::TestExternalities::default().execute_with(|| { + type Map = self::frame_system::Map; + // All map iterator let prefix = Map::prefix_hash(); diff --git a/frame/support/src/storage/generator/mod.rs b/frame/support/src/storage/generator/mod.rs index 2da612b24de8f..568d400129689 100644 --- a/frame/support/src/storage/generator/mod.rs +++ b/frame/support/src/storage/generator/mod.rs @@ -35,47 +35,123 @@ pub use nmap::StorageNMap; pub use value::StorageValue; #[cfg(test)] -#[allow(dead_code)] mod tests { + use codec::Encode; + use sp_io::TestExternalities; + use sp_runtime::{generic, traits::BlakeTwo256, BuildStorage}; + use crate::{ assert_noop, assert_ok, - storage::{generator::StorageValue, unhashed, IterableStorageMap}, + storage::{generator::StorageValue, unhashed}, }; - use codec::Encode; - use sp_io::TestExternalities; - struct Runtime; + #[crate::pallet] + pub mod frame_system { + #[allow(unused)] + use super::{frame_system, frame_system::pallet_prelude::*}; + pub use crate::dispatch::RawOrigin; + use crate::pallet_prelude::*; + + #[pallet::pallet] + pub struct Pallet(PhantomData); + + #[pallet::config] + #[pallet::disable_frame_system_supertrait_check] + pub trait Config: 'static { + type BlockNumber; + type AccountId; + type BaseCallFilter: crate::traits::Contains; + type RuntimeOrigin; + type RuntimeCall; + type PalletInfo: crate::traits::PalletInfo; + type DbWeight: Get; + } + + #[pallet::origin] + pub type Origin = RawOrigin<::AccountId>; + + #[pallet::error] + pub enum Error { + /// Required by construct_runtime + CallFiltered, + } + + #[pallet::call] + impl Pallet {} + + #[pallet::storage] + pub type Value = StorageValue<_, (u64, u64), ValueQuery>; - pub trait Config: 'static { - type RuntimeOrigin; - type BlockNumber; - type PalletInfo: crate::traits::PalletInfo; - type DbWeight: crate::traits::Get; + #[pallet::storage] + pub type Map = StorageMap<_, Blake2_128Concat, u16, u64, ValueQuery>; + + #[pallet::storage] + pub type NumberMap = StorageMap<_, Identity, u32, u64, ValueQuery>; + + #[pallet::storage] + pub type DoubleMap = + StorageDoubleMap<_, Blake2_128Concat, u16, Twox64Concat, u32, u64, ValueQuery>; + + #[pallet::storage] + pub type NMap = StorageNMap< + _, + (storage::Key, storage::Key), + u64, + ValueQuery, + >; + + pub mod pallet_prelude { + pub type OriginFor = ::RuntimeOrigin; + } } - impl Config for Runtime { - type RuntimeOrigin = u32; - type BlockNumber = u32; - type PalletInfo = crate::tests::PanicPalletInfo; + type BlockNumber = u32; + type AccountId = u32; + type Header = generic::Header; + type UncheckedExtrinsic = generic::UncheckedExtrinsic; + type Block = generic::Block; + + crate::construct_runtime!( + pub enum Runtime + where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: self::frame_system, + } + ); + + impl self::frame_system::Config for Runtime { + type BlockNumber = BlockNumber; + type AccountId = AccountId; + type BaseCallFilter = crate::traits::Everything; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type PalletInfo = PalletInfo; type DbWeight = (); } - decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin, system=self {} + pub fn key_before_prefix(mut prefix: Vec) -> Vec { + let last = prefix.iter_mut().last().unwrap(); + assert_ne!(*last, 0, "mock function not implemented for this prefix"); + *last -= 1; + prefix } - crate::decl_storage! { - trait Store for Module as Runtime { - Value get(fn value) config(): (u64, u64); - NumberMap: map hasher(identity) u32 => u64; - DoubleMap: double_map hasher(identity) u32, hasher(identity) u32 => u64; - } + pub fn key_after_prefix(mut prefix: Vec) -> Vec { + let last = prefix.iter_mut().last().unwrap(); + assert_ne!(*last, 255, "mock function not implemented for this prefix"); + *last += 1; + prefix } #[test] fn value_translate_works() { let t = GenesisConfig::default().build_storage().unwrap(); TestExternalities::new(t).execute_with(|| { + type Value = self::frame_system::Value; + // put the old value `1111u32` in the storage. let key = Value::storage_value_final_key(); unhashed::put_raw(&key, &1111u32.encode()); @@ -96,7 +172,9 @@ mod tests { fn map_translate_works() { let t = GenesisConfig::default().build_storage().unwrap(); TestExternalities::new(t).execute_with(|| { - // start with a map of u32 -> u32. + type NumberMap = self::frame_system::NumberMap; + + // start with a map of u32 -> u64. for i in 0u32..100u32 { unhashed::put(&NumberMap::hashed_key_for(&i), &(i as u64)); } @@ -125,6 +203,10 @@ mod tests { fn try_mutate_works() { let t = GenesisConfig::default().build_storage().unwrap(); TestExternalities::new(t).execute_with(|| { + type Value = self::frame_system::Value; + type NumberMap = self::frame_system::NumberMap; + type DoubleMap = self::frame_system::DoubleMap; + assert_eq!(Value::get(), (0, 0)); assert_eq!(NumberMap::get(0), 0); assert_eq!(DoubleMap::get(0, 0), 0); diff --git a/frame/support/src/storage/generator/nmap.rs b/frame/support/src/storage/generator/nmap.rs index 21fe7b41eda99..5d3d689aa98a6 100755 --- a/frame/support/src/storage/generator/nmap.rs +++ b/frame/support/src/storage/generator/nmap.rs @@ -462,43 +462,12 @@ impl> mod test_iterators { use crate::{ hash::StorageHasher, - storage::{generator::StorageNMap, unhashed, IterableStorageNMap}, + storage::{ + generator::{tests::*, StorageNMap}, + unhashed, + }, }; - use codec::{Decode, Encode}; - - pub trait Config: 'static { - type RuntimeOrigin; - type BlockNumber; - type PalletInfo: crate::traits::PalletInfo; - type DbWeight: crate::traits::Get; - } - - crate::decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin, system=self {} - } - - #[derive(PartialEq, Eq, Clone, Encode, Decode)] - struct NoDef(u32); - - crate::decl_storage! { - trait Store for Module as Test { - NMap: nmap hasher(blake2_128_concat) u16, hasher(twox_64_concat) u32 => u64; - } - } - - fn key_before_prefix(mut prefix: Vec) -> Vec { - let last = prefix.iter_mut().last().unwrap(); - assert!(*last != 0, "mock function not implemented for this prefix"); - *last -= 1; - prefix - } - - fn key_after_prefix(mut prefix: Vec) -> Vec { - let last = prefix.iter_mut().last().unwrap(); - assert!(*last != 255, "mock function not implemented for this prefix"); - *last += 1; - prefix - } + use codec::Encode; #[test] fn n_map_iter_from() { @@ -545,22 +514,18 @@ mod test_iterators { #[test] fn n_map_double_map_identical_key() { sp_io::TestExternalities::default().execute_with(|| { + use crate::hash::{Blake2_128Concat, Twox64Concat}; + + type NMap = self::frame_system::NMap; + NMap::insert((1, 2), 50); let key_hash = NMap::hashed_key_for((1, 2)); { #[crate::storage_alias] - type NMap = StorageDoubleMap< - Test, - crate::Blake2_128Concat, - u16, - crate::Twox64Concat, - u32, - u64, - >; - - let value = NMap::get(1, 2).unwrap(); - assert_eq!(value, 50); + type NMap = StorageDoubleMap; + + assert_eq!(NMap::get(1, 2), Some(50)); assert_eq!(NMap::hashed_key_for(1, 2), key_hash); } }); @@ -569,6 +534,8 @@ mod test_iterators { #[test] fn n_map_reversible_reversible_iteration() { sp_io::TestExternalities::default().execute_with(|| { + type NMap = self::frame_system::NMap; + // All map iterator let prefix = NMap::prefix_hash(); diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 302d52f2f862b..8eac0996760e3 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -39,6 +39,7 @@ futures = { version = "0.3.21", optional = true } dyn-clonable = { version = "0.9.0", optional = true } thiserror = { version = "1.0.30", optional = true } bitflags = "1.3" +paste = "1.0.7" # full crypto array-bytes = { version = "4.1", optional = true } diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index efccd0378e95a..04f44631cb21c 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -53,6 +53,7 @@ pub mod hashing; pub use hashing::{blake2_128, blake2_256, keccak_256, twox_128, twox_256, twox_64}; pub mod crypto; pub mod hexdisplay; +pub use paste; pub mod defer; pub mod ecdsa; @@ -403,38 +404,62 @@ pub const MAX_POSSIBLE_ALLOCATION: u32 = 33554432; // 2^25 bytes, 32 MiB #[rustfmt::skip] macro_rules! generate_feature_enabled_macro { ( $macro_name:ident, $feature_name:meta, $d:tt ) => { - /// Enable/disable the given code depending on - #[doc = concat!("`", stringify!($feature_name), "`")] - /// being enabled for the crate or not. - /// - /// # Example - /// - /// ```nocompile - /// // Will add the code depending on the feature being enabled or not. - #[doc = concat!(stringify!($macro_name), "!( println!(\"Hello\") )")] - /// ``` - #[cfg($feature_name)] - #[macro_export] - macro_rules! $macro_name { - ( $d ( $d input:tt )* ) => { - $d ( $d input )* + $crate::paste::paste!{ + /// Enable/disable the given code depending on + #[doc = concat!("`", stringify!($feature_name), "`")] + /// being enabled for the crate or not. + /// + /// # Example + /// + /// ```nocompile + /// // Will add the code depending on the feature being enabled or not. + #[doc = concat!(stringify!($macro_name), "!( println!(\"Hello\") )")] + /// ``` + #[cfg($feature_name)] + #[macro_export] + macro_rules! [<_ $macro_name>] { + ( $d ( $d input:tt )* ) => { + $d ( $d input )* + } + } + + /// Enable/disable the given code depending on + #[doc = concat!("`", stringify!($feature_name), "`")] + /// being enabled for the crate or not. + /// + /// # Example + /// + /// ```nocompile + /// // Will add the code depending on the feature being enabled or not. + #[doc = concat!(stringify!($macro_name), "!( println!(\"Hello\") )")] + /// ``` + #[cfg(not($feature_name))] + #[macro_export] + macro_rules! [<_ $macro_name>] { + ( $d ( $d input:tt )* ) => {}; } - } - /// Enable/disable the given code depending on - #[doc = concat!("`", stringify!($feature_name), "`")] - /// being enabled for the crate or not. - /// - /// # Example - /// - /// ```nocompile - /// // Will add the code depending on the feature being enabled or not. - #[doc = concat!(stringify!($macro_name), "!( println!(\"Hello\") )")] - /// ``` - #[cfg(not($feature_name))] - #[macro_export] - macro_rules! $macro_name { - ( $d ( $d input:tt )* ) => {}; + // Work around for: + #[doc(hidden)] + pub use [<_ $macro_name>] as $macro_name; } }; } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + #[should_panic] + fn generate_feature_enabled_macro_panics() { + generate_feature_enabled_macro!(if_test, test, $); + if_test!(panic!("This should panic")); + } + + #[test] + fn generate_feature_enabled_macro_works() { + generate_feature_enabled_macro!(if_not_test, not(test), $); + if_not_test!(panic!("This should not panic")); + } +} diff --git a/primitives/runtime/src/lib.rs b/primitives/runtime/src/lib.rs index 2d959425e0f8e..0994dc21b31dd 100644 --- a/primitives/runtime/src/lib.rs +++ b/primitives/runtime/src/lib.rs @@ -1054,3 +1054,23 @@ mod tests { }); } } + +// NOTE: we have to test the sp_core stuff also from a different crate to check that the macro +// can access the sp_core crate. +#[cfg(test)] +mod sp_core_tests { + use super::*; + + #[test] + #[should_panic] + fn generate_feature_enabled_macro_panics() { + sp_core::generate_feature_enabled_macro!(if_test, test, $); + if_test!(panic!("This should panic")); + } + + #[test] + fn generate_feature_enabled_macro_works() { + sp_core::generate_feature_enabled_macro!(if_not_test, not(test), $); + if_not_test!(panic!("This should not panic")); + } +} From db6ebf564bcdfdfaf5fd026bb321de6f7d7e6fc0 Mon Sep 17 00:00:00 2001 From: gupnik <17176722+gupnik@users.noreply.github.com> Date: Tue, 25 Apr 2023 20:50:58 +0530 Subject: [PATCH 71/93] Removes ReportsByKindIndex (#13936) * Removes ReportsByKind * Minor build fixes * adds migration * Addresses review comment * Uses clear but weight check fails * Uses unique * Updates test to commit the change before migration * Uses reads_writes * ".git/.scripts/commands/fmt/fmt.sh" * Fixes build * Addresses review comments * ".git/.scripts/commands/fmt/fmt.sh" * fixes typo --------- Co-authored-by: command-bot <> --- frame/offences/src/lib.rs | 43 ++++--------- frame/offences/src/migration.rs | 103 ++++++++++++++++++++++++++++++-- frame/offences/src/mock.rs | 5 -- frame/offences/src/tests.rs | 49 +-------------- 4 files changed, 113 insertions(+), 87 deletions(-) diff --git a/frame/offences/src/lib.rs b/frame/offences/src/lib.rs index 96c7c119c2038..1c7ffeca71983 100644 --- a/frame/offences/src/lib.rs +++ b/frame/offences/src/lib.rs @@ -26,7 +26,9 @@ pub mod migration; mod mock; mod tests; -use codec::{Decode, Encode}; +use core::marker::PhantomData; + +use codec::Encode; use frame_support::weights::Weight; use sp_runtime::{traits::Hash, Perbill}; use sp_staking::{ @@ -43,12 +45,17 @@ type OpaqueTimeSlot = Vec; /// A type alias for a report identifier. type ReportIdOf = ::Hash; +const LOG_TARGET: &str = "runtime::offences"; + #[frame_support::pallet] pub mod pallet { use super::*; use frame_support::pallet_prelude::*; + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] #[pallet::without_storage_info] pub struct Pallet(_); @@ -85,21 +92,6 @@ pub mod pallet { ValueQuery, >; - /// Enumerates all reports of a kind along with the time they happened. - /// - /// All reports are sorted by the time of offence. - /// - /// Note that the actual type of this mapping is `Vec`, this is because values of - /// different types are not supported at the moment so we are doing the manual serialization. - #[pallet::storage] - pub type ReportsByKindIndex = StorageMap< - _, - Twox64Concat, - Kind, - Vec, // (O::TimeSlot, ReportIdOf) - ValueQuery, - >; - /// Events type. #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] @@ -190,7 +182,7 @@ impl Pallet { OffenceDetails { offender, reporters: reporters.clone() }, ); - storage.insert(time_slot, report_id); + storage.insert(report_id); } } @@ -225,7 +217,7 @@ struct TriageOutcome { struct ReportIndexStorage> { opaque_time_slot: OpaqueTimeSlot, concurrent_reports: Vec>, - same_kind_reports: Vec<(O::TimeSlot, ReportIdOf)>, + _phantom: PhantomData, } impl> ReportIndexStorage { @@ -233,30 +225,19 @@ impl> ReportIndexStorage { fn load(time_slot: &O::TimeSlot) -> Self { let opaque_time_slot = time_slot.encode(); - let same_kind_reports = ReportsByKindIndex::::get(&O::ID); - let same_kind_reports = - Vec::<(O::TimeSlot, ReportIdOf)>::decode(&mut &same_kind_reports[..]) - .unwrap_or_default(); - let concurrent_reports = >::get(&O::ID, &opaque_time_slot); - Self { opaque_time_slot, concurrent_reports, same_kind_reports } + Self { opaque_time_slot, concurrent_reports, _phantom: Default::default() } } /// Insert a new report to the index. - fn insert(&mut self, time_slot: &O::TimeSlot, report_id: ReportIdOf) { - // Insert the report id into the list while maintaining the ordering by the time - // slot. - let pos = self.same_kind_reports.partition_point(|(when, _)| when <= time_slot); - self.same_kind_reports.insert(pos, (time_slot.clone(), report_id)); - + fn insert(&mut self, report_id: ReportIdOf) { // Update the list of concurrent reports. self.concurrent_reports.push(report_id); } /// Dump the indexes to the storage. fn save(self) { - ReportsByKindIndex::::insert(&O::ID, self.same_kind_reports.encode()); >::insert( &O::ID, &self.opaque_time_slot, diff --git a/frame/offences/src/migration.rs b/frame/offences/src/migration.rs index 95b94ba87cc9c..07bd68407d378 100644 --- a/frame/offences/src/migration.rs +++ b/frame/offences/src/migration.rs @@ -15,11 +15,84 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::{Config, OffenceDetails, Perbill, SessionIndex}; -use frame_support::{pallet_prelude::ValueQuery, storage_alias, traits::Get, weights::Weight}; +use super::{Config, Kind, OffenceDetails, Pallet, Perbill, SessionIndex, LOG_TARGET}; +use frame_support::{ + dispatch::GetStorageVersion, + pallet_prelude::ValueQuery, + storage_alias, + traits::{Get, OnRuntimeUpgrade}, + weights::Weight, + Twox64Concat, +}; use sp_staking::offence::{DisableStrategy, OnOffenceHandler}; use sp_std::vec::Vec; +#[cfg(feature = "try-runtime")] +use frame_support::ensure; + +mod v0 { + use super::*; + + #[storage_alias] + pub type ReportsByKindIndex = StorageMap< + Pallet, + Twox64Concat, + Kind, + Vec, // (O::TimeSlot, ReportIdOf) + ValueQuery, + >; +} + +pub mod v1 { + use frame_support::traits::StorageVersion; + + use super::*; + + pub struct MigrateToV1(sp_std::marker::PhantomData); + impl OnRuntimeUpgrade for MigrateToV1 { + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + let onchain = Pallet::::on_chain_storage_version(); + ensure!(onchain < 1, "pallet_offences::MigrateToV1 migration can be deleted"); + + log::info!( + target: LOG_TARGET, + "Number of reports to refund and delete: {}", + v0::ReportsByKindIndex::::iter_keys().count() + ); + + Ok(Vec::new()) + } + + fn on_runtime_upgrade() -> Weight { + let onchain = Pallet::::on_chain_storage_version(); + + if onchain > 0 { + log::info!(target: LOG_TARGET, "pallet_offences::MigrateToV1 should be removed"); + return T::DbWeight::get().reads(1) + } + + let keys_removed = v0::ReportsByKindIndex::::clear(u32::MAX, None).unique as u64; + let weight = T::DbWeight::get().reads_writes(keys_removed, keys_removed); + + StorageVersion::new(1).put::>(); + + weight + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_state: Vec) -> Result<(), &'static str> { + let onchain = Pallet::::on_chain_storage_version(); + ensure!(onchain == 1, "pallet_offences::MigrateToV1 needs to be run"); + ensure!( + v0::ReportsByKindIndex::::iter_keys().count() == 0, + "there are some dangling reports that need to be destroyed and refunded" + ); + Ok(()) + } + } +} + /// Type of data stored as a deferred offence type DeferredOffenceOf = ( Vec::AccountId, ::IdentificationTuple>>, @@ -36,7 +109,7 @@ type DeferredOffences = pub fn remove_deferred_storage() -> Weight { let mut weight = T::DbWeight::get().reads_writes(1, 1); let deferred = >::take(); - log::info!(target: "runtime::offences", "have {} deferred offences, applying.", deferred.len()); + log::info!(target: LOG_TARGET, "have {} deferred offences, applying.", deferred.len()); for (offences, perbill, session) in deferred.iter() { let consumed = T::OnOffenceHandler::on_offence( offences, @@ -53,10 +126,32 @@ pub fn remove_deferred_storage() -> Weight { #[cfg(test)] mod test { use super::*; - use crate::mock::{new_test_ext, with_on_offence_fractions, Runtime as T}; + use crate::mock::{new_test_ext, with_on_offence_fractions, Runtime as T, KIND}; + use codec::Encode; use sp_runtime::Perbill; use sp_staking::offence::OffenceDetails; + #[test] + fn migration_to_v1_works() { + let mut ext = new_test_ext(); + + ext.execute_with(|| { + >::insert(KIND, 2u32.encode()); + assert!(>::iter_values().count() > 0); + }); + + ext.commit_all().unwrap(); + + ext.execute_with(|| { + assert_eq!( + v1::MigrateToV1::::on_runtime_upgrade(), + ::DbWeight::get().reads_writes(1, 1), + ); + + assert!(>::iter_values().count() == 0); + }) + } + #[test] fn should_resubmit_deferred_offences() { new_test_ext().execute_with(|| { diff --git a/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index 27e1da8c4e636..17480be76c1d8 100644 --- a/frame/offences/src/mock.rs +++ b/frame/offences/src/mock.rs @@ -164,8 +164,3 @@ impl offence::Offence for Offence { Perbill::from_percent(5 + offenders_count * 100 / self.validator_set_count) } } - -/// Create the report id for the given `offender` and `time_slot` combination. -pub fn report_id(time_slot: u128, offender: u64) -> H256 { - Offences::report_id::(&time_slot, &offender) -} diff --git a/frame/offences/src/tests.rs b/frame/offences/src/tests.rs index 81f0f44f1b939..d525c7c3ab1d9 100644 --- a/frame/offences/src/tests.rs +++ b/frame/offences/src/tests.rs @@ -21,8 +21,8 @@ use super::*; use crate::mock::{ - new_test_ext, offence_reports, report_id, with_on_offence_fractions, Offence, Offences, - RuntimeEvent, System, KIND, + new_test_ext, offence_reports, with_on_offence_fractions, Offence, Offences, RuntimeEvent, + System, KIND, }; use frame_system::{EventRecord, Phase}; use sp_runtime::Perbill; @@ -245,48 +245,3 @@ fn should_properly_count_offences() { ); }); } - -/// We insert offences in sorted order using the time slot in the `same_kind_reports`. -/// This test ensures that it works as expected. -#[test] -fn should_properly_sort_offences() { - new_test_ext().execute_with(|| { - // given - let time_slot = 42; - assert_eq!(offence_reports(KIND, time_slot), vec![]); - - let offence1 = Offence { validator_set_count: 5, time_slot, offenders: vec![5] }; - let offence2 = Offence { validator_set_count: 5, time_slot, offenders: vec![4] }; - let offence3 = - Offence { validator_set_count: 5, time_slot: time_slot + 1, offenders: vec![6, 7] }; - let offence4 = - Offence { validator_set_count: 5, time_slot: time_slot - 1, offenders: vec![3] }; - Offences::report_offence(vec![], offence1).unwrap(); - with_on_offence_fractions(|f| { - assert_eq!(f.clone(), vec![Perbill::from_percent(25)]); - f.clear(); - }); - - // when - // report for the second time - Offences::report_offence(vec![], offence2).unwrap(); - Offences::report_offence(vec![], offence3).unwrap(); - Offences::report_offence(vec![], offence4).unwrap(); - - // then - let same_kind_reports = Vec::<(u128, sp_core::H256)>::decode( - &mut &crate::ReportsByKindIndex::::get(KIND)[..], - ) - .unwrap(); - assert_eq!( - same_kind_reports, - vec![ - (time_slot - 1, report_id(time_slot - 1, 3)), - (time_slot, report_id(time_slot, 5)), - (time_slot, report_id(time_slot, 4)), - (time_slot + 1, report_id(time_slot + 1, 6)), - (time_slot + 1, report_id(time_slot + 1, 7)), - ] - ); - }); -} From c4f425b062a749010b724a3b74e8d93b6f9b01d8 Mon Sep 17 00:00:00 2001 From: Squirrel Date: Tue, 25 Apr 2023 21:48:37 +0100 Subject: [PATCH 72/93] Allow missing docs for autogen weights. (#14011) --- .maintain/frame-weight-template.hbs | 1 + utils/frame/benchmarking-cli/src/pallet/template.hbs | 1 + 2 files changed, 2 insertions(+) diff --git a/.maintain/frame-weight-template.hbs b/.maintain/frame-weight-template.hbs index 0df6bef5d3bee..38bb4de26362f 100644 --- a/.maintain/frame-weight-template.hbs +++ b/.maintain/frame-weight-template.hbs @@ -15,6 +15,7 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; diff --git a/utils/frame/benchmarking-cli/src/pallet/template.hbs b/utils/frame/benchmarking-cli/src/pallet/template.hbs index f852e773ce7d7..85b0e86caad96 100644 --- a/utils/frame/benchmarking-cli/src/pallet/template.hbs +++ b/utils/frame/benchmarking-cli/src/pallet/template.hbs @@ -15,6 +15,7 @@ #![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; From af504bc374db82e0d764f1393f4faee42929e4ad Mon Sep 17 00:00:00 2001 From: Sasha Gryaznov Date: Wed, 26 Apr 2023 14:27:13 +0300 Subject: [PATCH 73/93] [contracts] Port host functions to Weight V2 and storage deposit limit (#13565) * added [unstable][seal2] call() * updated test to cover new seal_call proof_limit * docs updated * add [seal2][unstable] instantiate() and test * add [seal2][unstable] weight_to_fee() + docs and test * add [seal2][unstable] gas_left() + docs and test * update benchmarks * add DefaultDepositLimit to pallet Config * specify deposit limit for nested call add test for nested call deposit limit save: separate deposit limit for nested calls * specify deposit limit for nested instantiate save: works with test cleaned up debugging outputs * update benchmarks * added missing fixtures * fix benches * pass explicit deposit limit to storage bench * explicit deposit limit for another set_storage bench * add more deposit limit for storage benches * moving to simplified benchmarks * moved to simplified benchmarks * fix seal_weight_to_fee bench * fix seal_instantiate benchmark * doc typo fix * default dl for benchmarking more dl for tests dl for tests to max deposit_limit fix in instantiate bench fix instantiate bench fix instantiate benchmark fix instantiate bench again remove dbg fix seal bench again fixing it still seal_instantiate zero deposit less runs to check if deposit enough try try 2 try 3 try 4 * max_runtime_mem to Schedule limits * add default deposit limit fallback check to test * weight params renaming * fmt * Update frame/contracts/src/benchmarking/mod.rs Co-authored-by: PG Herveou * prettify inputs in tests * typestate param refactored --------- Co-authored-by: PG Herveou --- bin/node/runtime/src/lib.rs | 2 + frame/contracts/README.md | 8 +- frame/contracts/fixtures/call_with_limit.wat | 21 +- frame/contracts/fixtures/caller_contract.wat | 137 +++++--- .../fixtures/create_storage_and_call.wat | 13 +- .../create_storage_and_instantiate.wat | 66 ++++ .../fixtures/{store.wat => store_call.wat} | 0 frame/contracts/fixtures/store_deploy.wat | 45 +++ frame/contracts/src/benchmarking/mod.rs | 79 +++-- frame/contracts/src/exec.rs | 124 +++++-- frame/contracts/src/lib.rs | 18 +- frame/contracts/src/schedule.rs | 5 + frame/contracts/src/storage/meter.rs | 80 +++-- frame/contracts/src/tests.rs | 327 ++++++++++++++---- frame/contracts/src/wasm/mod.rs | 48 +-- frame/contracts/src/wasm/runtime.rs | 249 ++++++++++--- 16 files changed, 948 insertions(+), 274 deletions(-) create mode 100644 frame/contracts/fixtures/create_storage_and_instantiate.wat rename frame/contracts/fixtures/{store.wat => store_call.wat} (100%) create mode 100644 frame/contracts/fixtures/store_deploy.wat diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 5722603fe62a5..766bc9515b8ab 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1215,6 +1215,7 @@ impl pallet_tips::Config for Runtime { parameter_types! { pub const DepositPerItem: Balance = deposit(1, 0); pub const DepositPerByte: Balance = deposit(0, 1); + pub const DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024); pub Schedule: pallet_contracts::Schedule = Default::default(); } @@ -1233,6 +1234,7 @@ impl pallet_contracts::Config for Runtime { type CallFilter = Nothing; type DepositPerItem = DepositPerItem; type DepositPerByte = DepositPerByte; + type DefaultDepositLimit = DefaultDepositLimit; type CallStack = [pallet_contracts::Frame; 5]; type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_contracts::weights::SubstrateWeight; diff --git a/frame/contracts/README.md b/frame/contracts/README.md index cf89c9514142d..13c5e7253c1d8 100644 --- a/frame/contracts/README.md +++ b/frame/contracts/README.md @@ -1,6 +1,6 @@ -# Contract Module +# Contracts Module -The Contract module provides functionality for the runtime to deploy and execute WebAssembly smart-contracts. +The Contracts module provides functionality for the runtime to deploy and execute WebAssembly smart-contracts. - [`Call`](https://paritytech.github.io/substrate/master/pallet_contracts/pallet/enum.Call.html) - [`Config`](https://paritytech.github.io/substrate/master/pallet_contracts/pallet/trait.Config.html) @@ -63,9 +63,9 @@ directly. This makes sure that by default `pallet-contracts` does not expose any When setting up the `Schedule` for your runtime make sure to set `InstructionWeights::fallback` to a non zero value. The default is `0` and prevents the upload of any non deterministic code. -An indeterministic code can be deployed on-chain by passing `Determinism::AllowIndeterministic` +An indeterministic code can be deployed on-chain by passing `Determinism::Relaxed` to `upload_code`. A deterministic contract can then delegate call into it if and only if it -is ran by using `bare_call` and passing `Determinism::AllowIndeterministic` to it. **Never use +is ran by using `bare_call` and passing `Determinism::Relaxed` to it. **Never use this argument when the contract is called from an on-chain transaction.** ## Interface diff --git a/frame/contracts/fixtures/call_with_limit.wat b/frame/contracts/fixtures/call_with_limit.wat index abb8708267271..04da59551a8ce 100644 --- a/frame/contracts/fixtures/call_with_limit.wat +++ b/frame/contracts/fixtures/call_with_limit.wat @@ -1,8 +1,8 @@ -;; This expects [account_id, gas_limit] as input and calls the account_id with the supplied gas_limit. +;; This expects [account_id, ref_time, proof_size] as input and calls the account_id with the supplied 2D Weight limit. ;; It returns the result of the call as output data. (module (import "seal0" "seal_input" (func $seal_input (param i32 i32))) - (import "seal0" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32 i32) (result i32))) + (import "seal2" "call" (func $seal_call (param i32 i32 i64 i64 i32 i32 i32 i32 i32 i32) (result i32))) (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) (import "env" "memory" (memory 1 1)) @@ -13,24 +13,25 @@ (func (export "deploy")) (func (export "call") - ;; Receive the encoded call + gas_limit + ;; Receive the encoded account_id, ref_time, proof_size (call $seal_input (i32.const 4) ;; Pointer to the input buffer - (i32.const 0) ;; Size of the length buffer + (i32.const 0) ;; Pointer to the length of the input buffer ) (i32.store (i32.const 0) (call $seal_call + (i32.const 0) ;; Set no flag. (i32.const 4) ;; Pointer to "callee" address. - (i32.const 32) ;; Length of "callee" address. - (i64.load (i32.const 36)) ;; How much gas to devote for the execution. + (i64.load (i32.const 36)) ;; How much ref_time to devote for the execution. + (i64.load (i32.const 44)) ;; How much proof_size to devote for the execution. + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. (i32.const 0) ;; Pointer to the buffer with value to transfer - (i32.const 0) ;; Length of the buffer with value to transfer. (i32.const 0) ;; Pointer to input data buffer address - (i32.const 0) ;; Length of input data buffer + (i32.const 0) ;; Length of input data buffer (i32.const 0xffffffff) ;; u32 max sentinel value: do not copy output - (i32.const 0) ;; Ptr to output buffer len - ) + (i32.const 0) ;; Length is ignored in this case + ) ) (call $seal_return (i32.const 0) (i32.const 0) (i32.const 4)) ) diff --git a/frame/contracts/fixtures/caller_contract.wat b/frame/contracts/fixtures/caller_contract.wat index f9caf49f29ca8..929171b9a26f6 100644 --- a/frame/contracts/fixtures/caller_contract.wat +++ b/frame/contracts/fixtures/caller_contract.wat @@ -1,9 +1,9 @@ (module (import "seal0" "seal_input" (func $seal_input (param i32 i32))) (import "seal0" "seal_balance" (func $seal_balance (param i32 i32))) - (import "seal0" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32 i32) (result i32))) - (import "seal0" "seal_instantiate" (func $seal_instantiate - (param i32 i32 i64 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32) + (import "seal2" "call" (func $seal_call (param i32 i32 i64 i64 i32 i32 i32 i32 i32 i32) (result i32))) + (import "seal2" "instantiate" (func $seal_instantiate + (param i32 i64 i64 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32) )) (import "env" "memory" (memory 1 1)) @@ -43,18 +43,18 @@ (set_local $exit_code (call $seal_instantiate (i32.const 24) ;; Pointer to the code hash. - (i32.const 32) ;; Length of the code hash. - (i64.const 0) ;; How much gas to devote for the execution. 0 = all. + (i64.const 0) ;; How much ref_time weight to devote for the execution. 0 = all. + (i64.const 0) ;; How much proof_size weight to devote for the execution. 0 = all. + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. (i32.const 0) ;; Pointer to the buffer with value to transfer - (i32.const 8) ;; Length of the buffer with value to transfer. (i32.const 9) ;; Pointer to input data buffer address (i32.const 7) ;; Length of input data buffer - (i32.const 4294967295) ;; u32 max sentinel value: do not copy address - (i32.const 0) ;; Length is ignored in this case + (i32.const 4294967295) ;; u32 max sentinel value: do not copy address + (i32.const 0) ;; Length is ignored in this case (i32.const 4294967295) ;; u32 max sentinel value: do not copy output - (i32.const 0) ;; Length is ignored in this case - (i32.const 0) ;; salt_ptr - (i32.const 0) ;; salt_le + (i32.const 0) ;; Length is ignored in this case + (i32.const 0) ;; salt_ptr + (i32.const 0) ;; salt_le ) ) @@ -63,22 +63,47 @@ (i32.eq (get_local $exit_code) (i32.const 2)) ;; ReturnCode::CalleeReverted ) - ;; Fail to deploy the contract due to insufficient gas. + ;; Fail to deploy the contract due to insufficient ref_time weight. (set_local $exit_code (call $seal_instantiate (i32.const 24) ;; Pointer to the code hash. - (i32.const 32) ;; Length of the code hash. - (i64.const 1) ;; Supply too little gas + (i64.const 1) ;; Supply too little ref_time weight + (i64.const 0) ;; How much proof_size weight to devote for the execution. 0 = all. + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. (i32.const 0) ;; Pointer to the buffer with value to transfer - (i32.const 8) ;; Length of the buffer with value to transfer. (i32.const 8) ;; Pointer to input data buffer address (i32.const 8) ;; Length of input data buffer (i32.const 4294967295) ;; u32 max sentinel value: do not copy address - (i32.const 0) ;; Length is ignored in this case + (i32.const 0) ;; Length is ignored in this case (i32.const 4294967295) ;; u32 max sentinel value: do not copy output - (i32.const 0) ;; Length is ignored in this case - (i32.const 0) ;; salt_ptr - (i32.const 0) ;; salt_le + (i32.const 0) ;; Length is ignored in this case + (i32.const 0) ;; salt_ptr + (i32.const 0) ;; salt_le + + ) + ) + + ;; Check for special trap exit status. + (call $assert + (i32.eq (get_local $exit_code) (i32.const 1)) ;; ReturnCode::CalleeTrapped + ) + + ;; Fail to deploy the contract due to insufficient ref_time weight. + (set_local $exit_code + (call $seal_instantiate + (i32.const 24) ;; Pointer to the code hash. + (i64.const 0) ;; How much ref_time weight to devote for the execution. 0 = all. + (i64.const 1) ;; Supply too little proof_size weight + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. + (i32.const 0) ;; Pointer to the buffer with value to transfer + (i32.const 8) ;; Pointer to input data buffer address + (i32.const 8) ;; Length of input data buffer + (i32.const 4294967295) ;; u32 max sentinel value: do not copy address + (i32.const 0) ;; Length is ignored in this case + (i32.const 4294967295) ;; u32 max sentinel value: do not copy output + (i32.const 0) ;; Length is ignored in this case + (i32.const 0) ;; salt_ptr + (i32.const 0) ;; salt_le ) ) @@ -98,18 +123,18 @@ (set_local $exit_code (call $seal_instantiate (i32.const 24) ;; Pointer to the code hash. - (i32.const 32) ;; Length of the code hash. - (i64.const 0) ;; How much gas to devote for the execution. 0 = all. + (i64.const 0) ;; How much ref_time weight to devote for the execution. 0 = all. + (i64.const 0) ;; How much proof_size weight to devote for the execution. 0 = all. + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. (i32.const 0) ;; Pointer to the buffer with value to transfer - (i32.const 8) ;; Length of the buffer with value to transfer. (i32.const 8) ;; Pointer to input data buffer address (i32.const 8) ;; Length of input data buffer - (i32.const 16) ;; Pointer to the address output buffer - (i32.sub (get_local $sp) (i32.const 4)) ;; Pointer to the address buffer length - (i32.const 4294967295) ;; u32 max sentinel value: do not copy output - (i32.const 0) ;; Length is ignored in this case - (i32.const 0) ;; salt_ptr - (i32.const 0) ;; salt_le + (i32.const 16) ;; Pointer to the address output buffer + (i32.sub (get_local $sp) (i32.const 4)) ;; Pointer to the address buffer length + (i32.const 4294967295) ;; u32 max sentinel value: do not copy output + (i32.const 0) ;; Length is ignored in this case + (i32.const 0) ;; salt_ptr + (i32.const 0) ;; salt_le ) ) @@ -139,15 +164,16 @@ ;; Call the new contract and expect it to return failing exit code. (set_local $exit_code (call $seal_call + (i32.const 0) ;; Set no flag (i32.const 16) ;; Pointer to "callee" address. - (i32.const 32) ;; Length of "callee" address. - (i64.const 0) ;; How much gas to devote for the execution. 0 = all. + (i64.const 0) ;; How much ref_time weight to devote for the execution. 0 = all. + (i64.const 0) ;; How much proof_size weight to devote for the execution. 0 = all. + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. (i32.const 0) ;; Pointer to the buffer with value to transfer - (i32.const 8) ;; Length of the buffer with value to transfer. (i32.const 9) ;; Pointer to input data buffer address (i32.const 7) ;; Length of input data buffer - (i32.sub (get_local $sp) (i32.const 4)) ;; Ptr to output buffer - (i32.sub (get_local $sp) (i32.const 8)) ;; Ptr to output buffer len + (i32.sub (get_local $sp) (i32.const 4)) ;; Ptr to output buffer + (i32.sub (get_local $sp) (i32.const 8)) ;; Ptr to output buffer len ) ) @@ -167,18 +193,40 @@ ) ) - ;; Fail to call the contract due to insufficient gas. + ;; Fail to call the contract due to insufficient ref_time weight. (set_local $exit_code (call $seal_call + (i32.const 0) ;; Set no flag (i32.const 16) ;; Pointer to "callee" address. - (i32.const 32) ;; Length of "callee" address. - (i64.const 1) ;; Supply too little gas + (i64.const 1) ;; Supply too little ref_time weight + (i64.const 0) ;; How much proof_size weight to devote for the execution. 0 = all. + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. (i32.const 0) ;; Pointer to the buffer with value to transfer - (i32.const 8) ;; Length of the buffer with value to transfer. (i32.const 8) ;; Pointer to input data buffer address (i32.const 8) ;; Length of input data buffer - (i32.const 4294967295) ;; u32 max sentinel value: do not copy output - (i32.const 0) ;; Length is ignored in this cas + (i32.const 4294967295) ;; u32 max sentinel value: do not copy output + (i32.const 0) ;; Length is ignored in this cas + ) + ) + + ;; Check for special trap exit status. + (call $assert + (i32.eq (get_local $exit_code) (i32.const 1)) ;; ReturnCode::CalleeTrapped + ) + + ;; Fail to call the contract due to insufficient proof_size weight. + (set_local $exit_code + (call $seal_call + (i32.const 0) ;; Set no flag + (i32.const 16) ;; Pointer to "callee" address. + (i64.const 0) ;; How much ref_time weight to devote for the execution. 0 = all. + (i64.const 1) ;; Supply too little proof_size weight + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. + (i32.const 0) ;; Pointer to the buffer with value to transfer + (i32.const 8) ;; Pointer to input data buffer address + (i32.const 8) ;; Length of input data buffer + (i32.const 4294967295) ;; u32 max sentinel value: do not copy output + (i32.const 0) ;; Length is ignored in this cas ) ) @@ -202,15 +250,16 @@ ;; Call the contract successfully. (set_local $exit_code (call $seal_call + (i32.const 0) ;; Set no flag (i32.const 16) ;; Pointer to "callee" address. - (i32.const 32) ;; Length of "callee" address. - (i64.const 0) ;; How much gas to devote for the execution. 0 = all. + (i64.const 0) ;; How much ref_time weight to devote for the execution. 0 = all. + (i64.const 0) ;; How much proof_size weight to devote for the execution. 0 = all. + (i32.const 0xffffffff) ;; u32 max sentinel value: pass no deposit limit. (i32.const 0) ;; Pointer to the buffer with value to transfer - (i32.const 8) ;; Length of the buffer with value to transfer. (i32.const 8) ;; Pointer to input data buffer address (i32.const 8) ;; Length of input data buffer - (i32.sub (get_local $sp) (i32.const 4)) ;; Ptr to output buffer - (i32.sub (get_local $sp) (i32.const 8)) ;; Ptr to output buffer len + (i32.sub (get_local $sp) (i32.const 4)) ;; Ptr to output buffer + (i32.sub (get_local $sp) (i32.const 8)) ;; Ptr to output buffer len ) ) diff --git a/frame/contracts/fixtures/create_storage_and_call.wat b/frame/contracts/fixtures/create_storage_and_call.wat index 2a1e53f7ce08a..5592e7e96a980 100644 --- a/frame/contracts/fixtures/create_storage_and_call.wat +++ b/frame/contracts/fixtures/create_storage_and_call.wat @@ -2,7 +2,7 @@ (module (import "seal0" "seal_input" (func $seal_input (param i32 i32))) (import "seal0" "seal_set_storage" (func $seal_set_storage (param i32 i32 i32))) - (import "seal1" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32) (result i32))) + (import "seal2" "call" (func $seal_call (param i32 i32 i64 i64 i32 i32 i32 i32 i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) (func $assert (param i32) @@ -20,7 +20,10 @@ ;; store length of input buffer (i32.store (i32.const 0) (i32.const 512)) - ;; copy input at address 4 + ;; copy input at address 4: + ;; first 4 bytes for the size of the storage to be created in callee + ;; next 32 bytes are for the callee address + ;; next bytes for the encoded deposit limit (call $seal_input (i32.const 4) (i32.const 0)) ;; create 4 byte of storage before calling @@ -34,8 +37,10 @@ (call $assert (i32.eqz (call $seal_call (i32.const 0) ;; No flags - (i32.const 8) ;; Pointer to "callee" address. - (i64.const 0) ;; How much gas to devote for the execution. 0 = all. + (i32.const 8) ;; Pointer to "callee" address + (i64.const 0) ;; How much ref_time to devote for the execution. 0 = all + (i64.const 0) ;; How much proof_limit to devote for the execution. 0 = all + (i32.const 40) ;; Pointer to the storage deposit limit (i32.const 512) ;; Pointer to the buffer with value to transfer (i32.const 4) ;; Pointer to input data buffer address (i32.const 4) ;; Length of input data buffer diff --git a/frame/contracts/fixtures/create_storage_and_instantiate.wat b/frame/contracts/fixtures/create_storage_and_instantiate.wat new file mode 100644 index 0000000000000..cd7202478437b --- /dev/null +++ b/frame/contracts/fixtures/create_storage_and_instantiate.wat @@ -0,0 +1,66 @@ +;; This instantiates another contract and passes some input to its constructor. +(module + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "seal0" "seal_set_storage" (func $seal_set_storage (param i32 i32 i32))) + (import "seal2" "instantiate" (func $seal_instantiate + (param i32 i64 i64 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32) + )) + (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) + (import "env" "memory" (memory 1 1)) + + ;; [0, 8) send 10_000 balance + (data (i32.const 48) "\10\27\00\00\00\00\00\00") + + (func $assert (param i32) + (block $ok + (br_if $ok + (get_local 0) + ) + (unreachable) + ) + ) + + (func (export "deploy")) + + (func (export "call") + ;; store length of input buffer + (i32.store (i32.const 0) (i32.const 512)) + ;; store length of contract address + (i32.store (i32.const 84) (i32.const 32)) + + ;; copy input at address 4 + (call $seal_input (i32.const 4) (i32.const 0)) + + ;; memory layout is: + ;; [0,4): size of input buffer + ;; [4,8): size of the storage to be created in callee + ;; [8,40): the code hash of the contract to instantiate + ;; [40,48): for the encoded deposit limit + ;; [48,52): value to transfer + ;; [52,84): address of the deployed contract + ;; [84,88): len of the address + + ;; instantiate a contract + (call $assert (i32.eqz +;; (i32.store +;; (i32.const 64) + (call $seal_instantiate + (i32.const 8) ;; Pointer to the code hash. + (i64.const 0) ;; How much ref_time weight to devote for the execution. 0 = all. + (i64.const 0) ;; How much proof_size weight to devote for the execution. 0 = all. + (i32.const 40) ;; Pointer to the storage deposit limit + (i32.const 48) ;; Pointer to the buffer with value to transfer + (i32.const 4) ;; Pointer to input data buffer address + (i32.const 4) ;; Length of input data buffer + (i32.const 52) ;; Pointer to where to copy address + (i32.const 84) ;; Pointer to address len ptr + (i32.const 0xffffffff) ;; u32 max sentinel value: do not copy output + (i32.const 0) ;; Length is ignored in this case + (i32.const 0) ;; salt_ptr + (i32.const 0) ;; salt_len + ) + )) + ;; return the deployed contract address + (call $seal_return (i32.const 0) (i32.const 52) (i32.const 32)) + ) +) diff --git a/frame/contracts/fixtures/store.wat b/frame/contracts/fixtures/store_call.wat similarity index 100% rename from frame/contracts/fixtures/store.wat rename to frame/contracts/fixtures/store_call.wat diff --git a/frame/contracts/fixtures/store_deploy.wat b/frame/contracts/fixtures/store_deploy.wat new file mode 100644 index 0000000000000..cc428e9623bfb --- /dev/null +++ b/frame/contracts/fixtures/store_deploy.wat @@ -0,0 +1,45 @@ +;; Stores a value of the passed size in constructor. +(module + (import "seal0" "seal_set_storage" (func $seal_set_storage (param i32 i32 i32))) + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "env" "memory" (memory 16 16)) + + ;; [0, 32) storage key + (data (i32.const 0) "\01") + + ;; [32, 36) buffer where input is copied (expected size of storage item) + + ;; [36, 40) size of the input buffer + (data (i32.const 36) "\04") + + (func $assert (param i32) + (block $ok + (br_if $ok + (get_local 0) + ) + (unreachable) + ) + ) + + (func (export "deploy") + (call $seal_input (i32.const 32) (i32.const 36)) + + ;; assert input size == 4 + (call $assert + (i32.eq + (i32.load (i32.const 36)) + (i32.const 4) + ) + ) + + ;; place a value in storage, the size of which is specified by the call input. + ;; we don't care about the contents of the storage item + (call $seal_set_storage + (i32.const 0) ;; Pointer to storage key + (i32.const 0) ;; Pointer to value + (i32.load (i32.const 32)) ;; Size of value + ) + ) + + (func (export "call")) +) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 98a3dc36b7b68..6ebfb18509b1c 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -547,7 +547,7 @@ benchmarks! { seal_gas_left { let r in 0 .. API_BENCHMARK_RUNS; let instance = Contract::::new(WasmModule::getter( - "seal0", "seal_gas_left", r + "seal1", "gas_left", r ), vec![])?; let origin = RawOrigin::Signed(instance.caller.clone()); }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) @@ -604,9 +604,9 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", - name: "seal_weight_to_fee", - params: vec![ValueType::I64, ValueType::I32, ValueType::I32], + module: "seal1", + name: "weight_to_fee", + params: vec![ValueType::I64, ValueType::I64, ValueType::I32, ValueType::I32], return_type: None, }], data_segments: vec![DataSegment { @@ -615,6 +615,7 @@ benchmarks! { }], call_body: Some(body::repeated(r, &[ Instruction::I64Const(500_000), + Instruction::I64Const(300_000), Instruction::I32Const(4), Instruction::I32Const(0), Instruction::Call(0), @@ -1584,16 +1585,26 @@ benchmarks! { let callee_bytes = callees.iter().flat_map(|x| x.account_id.encode()).collect(); let value: BalanceOf = 0u32.into(); let value_bytes = value.encode(); - let value_len = value_bytes.len(); + let value_len = BalanceOf::::max_encoded_len() as u32; + // Set an own limit every 2nd call + let own_limit = (u32::MAX - 100).into(); + let deposits = (0..r) + .map(|i| if i % 2 == 0 { 0u32.into() } else { own_limit } ) + .collect::>>(); + let deposits_bytes: Vec = deposits.iter().flat_map(|i| i.encode()).collect(); + let deposits_len = deposits_bytes.len() as u32; + let deposit_len = value_len.clone(); + let callee_offset = value_len + deposits_len; let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", - name: "seal_call", + module: "seal2", + name: "call", params: vec![ ValueType::I32, ValueType::I32, ValueType::I64, + ValueType::I64, ValueType::I32, ValueType::I32, ValueType::I32, @@ -1609,16 +1620,21 @@ benchmarks! { value: value_bytes, }, DataSegment { - offset: value_len as u32, + offset: value_len, + value: deposits_bytes, + }, + DataSegment { + offset: callee_offset, value: callee_bytes, }, ], call_body: Some(body::repeated_dyn(r, vec![ - Counter(value_len as u32, callee_len as u32), // callee_ptr - Regular(Instruction::I32Const(callee_len as i32)), // callee_len - Regular(Instruction::I64Const(0)), // gas + Regular(Instruction::I32Const(0)), // flags + Counter(callee_offset, callee_len as u32), // callee_ptr + Regular(Instruction::I64Const(0)), // ref_time weight + Regular(Instruction::I64Const(0)), // proof_size weight + Counter(value_len, deposit_len as u32), // deposit_limit_ptr Regular(Instruction::I32Const(0)), // value_ptr - Regular(Instruction::I32Const(value_len as i32)), // value_len Regular(Instruction::I32Const(0)), // input_data_ptr Regular(Instruction::I32Const(0)), // input_data_len Regular(Instruction::I32Const(SENTINEL as i32)), // output_ptr @@ -1630,7 +1646,7 @@ benchmarks! { }); let instance = Contract::::new(code, vec![])?; let origin = RawOrigin::Signed(instance.caller.clone()); - }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) + }: call(origin, instance.addr, 0u32.into(), Weight::MAX, Some(BalanceOf::::from(u32::MAX).into()), vec![]) // This is a slow call: We redeuce the number of runs. #[pov_mode = Measured] @@ -1742,17 +1758,17 @@ benchmarks! { }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, bytes) // We assume that every instantiate sends at least the minimum balance. - // This is a slow call: We redeuce the number of runs. + // This is a slow call: we reduce the number of runs. #[pov_mode = Measured] seal_instantiate { - let r in 0 .. API_BENCHMARK_RUNS / 2; + let r in 1 .. API_BENCHMARK_RUNS / 2; let hashes = (0..r) .map(|i| { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), call_body: Some(body::plain(vec![ - // we need to add this in order to make contracts unique - // so that they can be deployed from the same sender + // We need to add this in order to make contracts unique, + // so that they can be deployed from the same sender. Instruction::I32Const(i as i32), Instruction::Drop, Instruction::End, @@ -1765,27 +1781,24 @@ benchmarks! { .collect::, &'static str>>()?; let hash_len = hashes.get(0).map(|x| x.encode().len()).unwrap_or(0); let hashes_bytes = hashes.iter().flat_map(|x| x.encode()).collect::>(); - let hashes_len = hashes_bytes.len(); + let hashes_len = &hashes_bytes.len(); let value = Pallet::::min_balance(); assert!(value > 0u32.into()); let value_bytes = value.encode(); - let value_len = value_bytes.len(); + let value_len = BalanceOf::::max_encoded_len(); let addr_len = T::AccountId::max_encoded_len(); - - // offsets where to place static data in contract memory - let value_offset = 0; - let hashes_offset = value_offset + value_len; + // Offsets where to place static data in contract memory. + let hashes_offset = value_len; let addr_len_offset = hashes_offset + hashes_len; let addr_offset = addr_len_offset + addr_len; - let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", - name: "seal_instantiate", + module: "seal2", + name: "instantiate", params: vec![ ValueType::I32, - ValueType::I32, + ValueType::I64, ValueType::I64, ValueType::I32, ValueType::I32, @@ -1802,7 +1815,7 @@ benchmarks! { }], data_segments: vec![ DataSegment { - offset: value_offset as u32, + offset: 0, value: value_bytes, }, DataSegment { @@ -1816,10 +1829,10 @@ benchmarks! { ], call_body: Some(body::repeated_dyn(r, vec![ Counter(hashes_offset as u32, hash_len as u32), // code_hash_ptr - Regular(Instruction::I32Const(hash_len as i32)), // code_hash_len - Regular(Instruction::I64Const(0)), // gas - Regular(Instruction::I32Const(value_offset as i32)), // value_ptr - Regular(Instruction::I32Const(value_len as i32)), // value_len + Regular(Instruction::I64Const(0)), // ref_time weight + Regular(Instruction::I64Const(0)), // proof_size weight + Regular(Instruction::I32Const(SENTINEL as i32)), // deposit limit ptr: use parent's limit + Regular(Instruction::I32Const(0)), // value_ptr Regular(Instruction::I32Const(0)), // input_data_ptr Regular(Instruction::I32Const(0)), // input_data_len Regular(Instruction::I32Const(addr_offset as i32)), // address_ptr @@ -1827,7 +1840,7 @@ benchmarks! { Regular(Instruction::I32Const(SENTINEL as i32)), // output_ptr Regular(Instruction::I32Const(0)), // output_len_ptr Regular(Instruction::I32Const(0)), // salt_ptr - Regular(Instruction::I32Const(0)), // salt_ptr_len + Regular(Instruction::I32Const(0)), // salt_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 46a611dbfd09b..d0a650e0a0ef6 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -23,7 +23,9 @@ use crate::{ }; use frame_support::{ crypto::ecdsa::ECDSAExt, - dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable}, + dispatch::{ + fmt::Debug, DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, + }, storage::{with_transaction, TransactionOutcome}, traits::{ tokens::{Fortitude::Polite, Preservation::Expendable}, @@ -40,7 +42,7 @@ use sp_core::{ sr25519::{Public as SR25519Public, Signature as SR25519Signature}, }; use sp_io::{crypto::secp256k1_ecdsa_recover_compressed, hashing::blake2_256}; -use sp_runtime::traits::{Convert, Hash}; +use sp_runtime::traits::{Convert, Hash, Zero}; use sp_std::{marker::PhantomData, mem, prelude::*, vec::Vec}; pub type AccountIdOf = ::AccountId; @@ -137,6 +139,7 @@ pub trait Ext: sealing::Sealed { fn call( &mut self, gas_limit: Weight, + deposit_limit: BalanceOf, to: AccountIdOf, value: BalanceOf, input_data: Vec, @@ -160,6 +163,7 @@ pub trait Ext: sealing::Sealed { fn instantiate( &mut self, gas_limit: Weight, + deposit_limit: BalanceOf, code: CodeHash, value: BalanceOf, input_data: Vec, @@ -692,8 +696,9 @@ where args, value, gas_meter, - storage_meter, Weight::zero(), + storage_meter, + BalanceOf::::zero(), schedule, determinism, )?; @@ -719,12 +724,13 @@ where /// /// This does not take `self` because when constructing the first frame `self` is /// not initialized, yet. - fn new_frame( + fn new_frame( frame_args: FrameArgs, value_transferred: BalanceOf, gas_meter: &mut GasMeter, - storage_meter: &mut storage::meter::GenericMeter, gas_limit: Weight, + storage_meter: &mut storage::meter::GenericMeter, + deposit_limit: BalanceOf, schedule: &Schedule, determinism: Determinism, ) -> Result<(Frame, E, Option), ExecError> { @@ -781,7 +787,7 @@ where account_id, entry_point, nested_gas: gas_meter.nested(gas_limit)?, - nested_storage: storage_meter.nested(), + nested_storage: storage_meter.nested(deposit_limit), allows_reentry: true, }; @@ -794,6 +800,7 @@ where frame_args: FrameArgs, value_transferred: BalanceOf, gas_limit: Weight, + deposit_limit: BalanceOf, ) -> Result { if self.frames.len() == T::CallStack::size() { return Err(Error::::MaxCallDepthReached.into()) @@ -817,8 +824,9 @@ where frame_args, value_transferred, nested_gas, - nested_storage, gas_limit, + nested_storage, + deposit_limit, self.schedule, self.determinism, )?; @@ -859,8 +867,10 @@ where return Ok(output) } - // Storage limit is enforced as late as possible (when the last frame returns) so that - // the ordering of storage accesses does not matter. + // Storage limit is normally enforced as late as possible (when the last frame returns) + // so that the ordering of storage accesses does not matter. + // (However, if a special limit was set for a sub-call, it should be enforced right + // after the sub-call returned. See below for this case of enforcement). if self.frames.is_empty() { let frame = &mut self.first_frame; frame.contract_info.load(&frame.account_id); @@ -869,7 +879,7 @@ where } let frame = self.top_frame(); - let account_id = &frame.account_id; + let account_id = &frame.account_id.clone(); match (entry_point, delegated_code_hash) { (ExportedFunction::Constructor, _) => { // It is not allowed to terminate a contract inside its constructor. @@ -877,6 +887,13 @@ where return Err(Error::::TerminatedInConstructor.into()) } + // If a special limit was set for the sub-call, we enforce it here. + // This is needed because contract constructor might write to storage. + // The sub-call will be rolled back in case the limit is exhausted. + let frame = self.top_frame_mut(); + let contract = frame.contract_info.as_contract(); + frame.nested_storage.enforce_subcall_limit(contract)?; + // Deposit an instantiation event. Contracts::::deposit_event( vec![T::Hashing::hash_of(self.caller()), T::Hashing::hash_of(account_id)], @@ -893,9 +910,15 @@ where ); }, (ExportedFunction::Call, None) => { + // If a special limit was set for the sub-call, we enforce it here. + // The sub-call will be rolled back in case the limit is exhausted. + let frame = self.top_frame_mut(); + let contract = frame.contract_info.as_contract(); + frame.nested_storage.enforce_subcall_limit(contract)?; + let caller = self.caller(); Contracts::::deposit_event( - vec![T::Hashing::hash_of(caller), T::Hashing::hash_of(account_id)], + vec![T::Hashing::hash_of(caller), T::Hashing::hash_of(&account_id)], Event::Called { caller: caller.clone(), contract: account_id.clone() }, ); }, @@ -1107,6 +1130,7 @@ where fn call( &mut self, gas_limit: Weight, + deposit_limit: BalanceOf, to: T::AccountId, value: BalanceOf, input_data: Vec, @@ -1135,6 +1159,7 @@ where FrameArgs::Call { dest: to, cached_info, delegated_call: None }, value, gas_limit, + deposit_limit, )?; self.run(executable, input_data) }; @@ -1166,6 +1191,7 @@ where }, value, Weight::zero(), + BalanceOf::::zero(), )?; self.run(executable, input_data) } @@ -1173,6 +1199,7 @@ where fn instantiate( &mut self, gas_limit: Weight, + deposit_limit: BalanceOf, code_hash: CodeHash, value: BalanceOf, input_data: Vec, @@ -1190,6 +1217,7 @@ where }, value, gas_limit, + deposit_limit, )?; let account_id = self.top_frame().account_id.clone(); self.run(executable, input_data).map(|ret| (account_id, ret)) @@ -1917,7 +1945,7 @@ mod tests { let value = Default::default(); let recurse_ch = MockLoader::insert(Call, |ctx, _| { // Try to call into yourself. - let r = ctx.ext.call(Weight::zero(), BOB, 0, vec![], true); + let r = ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![], true); ReachedBottom::mutate(|reached_bottom| { if !*reached_bottom { @@ -1971,7 +1999,11 @@ mod tests { WitnessedCallerBob::mutate(|caller| *caller = Some(ctx.ext.caller().clone())); // Call into CHARLIE contract. - assert_matches!(ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], true), Ok(_)); + assert_matches!( + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true), + Ok(_) + ); exec_success() }); let charlie_ch = MockLoader::insert(Call, |ctx, _| { @@ -2105,7 +2137,8 @@ mod tests { // ALICE is the origin of the call stack assert!(ctx.ext.caller_is_origin()); // BOB calls CHARLIE - ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], true) + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true) }); ExtBuilder::default().build().execute_with(|| { @@ -2136,7 +2169,11 @@ mod tests { assert_eq!(*ctx.ext.address(), BOB); // Call into charlie contract. - assert_matches!(ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], true), Ok(_)); + assert_matches!( + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true), + Ok(_) + ); exec_success() }); let charlie_ch = MockLoader::insert(Call, |ctx, _| { @@ -2287,6 +2324,7 @@ mod tests { .ext .instantiate( Weight::zero(), + BalanceOf::::zero(), dummy_ch, ::Currency::minimum_balance(), vec![], @@ -2351,6 +2389,7 @@ mod tests { assert_matches!( ctx.ext.instantiate( Weight::zero(), + BalanceOf::::zero(), dummy_ch, ::Currency::minimum_balance(), vec![], @@ -2443,13 +2482,26 @@ mod tests { let info = ctx.ext.contract_info(); assert_eq!(info.storage_byte_deposit, 0); info.storage_byte_deposit = 42; - assert_eq!(ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], true), exec_trapped()); + assert_eq!( + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + true + ), + exec_trapped() + ); assert_eq!(ctx.ext.contract_info().storage_byte_deposit, 42); } exec_success() }); let code_charlie = MockLoader::insert(Call, |ctx, _| { - assert!(ctx.ext.call(Weight::zero(), BOB, 0, vec![99], true).is_ok()); + assert!(ctx + .ext + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true) + .is_ok()); exec_trapped() }); @@ -2479,7 +2531,7 @@ mod tests { fn recursive_call_during_constructor_fails() { let code = MockLoader::insert(Constructor, |ctx, _| { assert_matches!( - ctx.ext.call(Weight::zero(), ctx.ext.address().clone(), 0, vec![], true), + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), ctx.ext.address().clone(), 0, vec![], true), Err(ExecError{error, ..}) if error == >::ContractNotFound.into() ); exec_success() @@ -2618,7 +2670,7 @@ mod tests { // call the contract passed as input with disabled reentry let code_bob = MockLoader::insert(Call, |ctx, _| { let dest = Decode::decode(&mut ctx.input_data.as_ref()).unwrap(); - ctx.ext.call(Weight::zero(), dest, 0, vec![], false) + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), dest, 0, vec![], false) }); let code_charlie = MockLoader::insert(Call, |_, _| exec_success()); @@ -2665,15 +2717,17 @@ mod tests { fn call_deny_reentry() { let code_bob = MockLoader::insert(Call, |ctx, _| { if ctx.input_data[0] == 0 { - ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], false) + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], false) } else { exec_success() } }); // call BOB with input set to '1' - let code_charlie = - MockLoader::insert(Call, |ctx, _| ctx.ext.call(Weight::zero(), BOB, 0, vec![1], true)); + let code_charlie = MockLoader::insert(Call, |ctx, _| { + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true) + }); ExtBuilder::default().build().execute_with(|| { let schedule = ::Schedule::get(); @@ -2862,6 +2916,7 @@ mod tests { ctx.ext .instantiate( Weight::zero(), + BalanceOf::::zero(), fail_code, ctx.ext.minimum_balance() * 100, vec![], @@ -2875,6 +2930,7 @@ mod tests { .ext .instantiate( Weight::zero(), + BalanceOf::::zero(), success_code, ctx.ext.minimum_balance() * 100, vec![], @@ -2883,7 +2939,9 @@ mod tests { .unwrap(); // a plain call should not influence the account counter - ctx.ext.call(Weight::zero(), account_id, 0, vec![], false).unwrap(); + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), account_id, 0, vec![], false) + .unwrap(); exec_success() }); @@ -3387,7 +3445,14 @@ mod tests { assert_eq!(ctx.ext.nonce(), 1); // Should not change with a failed instantiation assert_err!( - ctx.ext.instantiate(Weight::zero(), fail_code, 0, vec![], &[],), + ctx.ext.instantiate( + Weight::zero(), + BalanceOf::::zero(), + fail_code, + 0, + vec![], + &[], + ), ExecError { error: >::ContractTrapped.into(), origin: ErrorOrigin::Callee @@ -3395,7 +3460,16 @@ mod tests { ); assert_eq!(ctx.ext.nonce(), 1); // Successful instantiation increments - ctx.ext.instantiate(Weight::zero(), success_code, 0, vec![], &[]).unwrap(); + ctx.ext + .instantiate( + Weight::zero(), + BalanceOf::::zero(), + success_code, + 0, + vec![], + &[], + ) + .unwrap(); assert_eq!(ctx.ext.nonce(), 2); exec_success() }); diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 118da36ae88a1..5a82a4a42b4a9 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -15,9 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # Contract Pallet +//! # Contracts Pallet //! -//! The Contract module provides functionality for the runtime to deploy and execute WebAssembly +//! The Contracts module provides functionality for the runtime to deploy and execute WebAssembly //! smart-contracts. //! //! - [`Config`] @@ -73,7 +73,7 @@ //! //! ## Usage //! -//! The Contract module is a work in progress. The following examples show how this Contract module +//! The Contracts module is a work in progress. The following examples show how this module //! can be used to instantiate and call contracts. //! //! * [`ink!`](https://use.ink) is @@ -265,6 +265,10 @@ pub mod pallet { #[pallet::constant] type DepositPerByte: Get>; + /// Fallback value to limit the storage deposit if it's not being set by the caller. + #[pallet::constant] + type DefaultDepositLimit: Get>; + /// The amount of balance a caller has to pay for each storage item. /// /// # Note @@ -315,8 +319,8 @@ pub mod pallet { } fn integrity_test() { - // Total runtime memory is expected to have 128Mb upper limit - const MAX_RUNTIME_MEM: u32 = 1024 * 1024 * 128; + // Total runtime memory limit + let max_runtime_mem: u32 = T::Schedule::get().limits.runtime_memory; // Memory limits for a single contract: // Value stack size: 1Mb per contract, default defined in wasmi const MAX_STACK_SIZE: u32 = 1024 * 1024; @@ -350,10 +354,10 @@ pub mod pallet { // This gives us the following formula: // // `(MaxCodeLen * 18 * 4 + MAX_STACK_SIZE + max_heap_size) * max_call_depth < - // MAX_RUNTIME_MEM/2` + // max_runtime_mem/2` // // Hence the upper limit for the `MaxCodeLen` can be defined as follows: - let code_len_limit = MAX_RUNTIME_MEM + let code_len_limit = max_runtime_mem .saturating_div(2) .saturating_div(max_call_depth) .saturating_sub(max_heap_size) diff --git a/frame/contracts/src/schedule.rs b/frame/contracts/src/schedule.rs index 747540bce6359..aef2fa1ca7dc1 100644 --- a/frame/contracts/src/schedule.rs +++ b/frame/contracts/src/schedule.rs @@ -127,6 +127,10 @@ pub struct Limits { /// The maximum size of a storage value and event payload in bytes. pub payload_len: u32, + + /// The maximum node runtime memory. This is for integrity checks only and does not affect the + /// real setting. + pub runtime_memory: u32, } impl Limits { @@ -479,6 +483,7 @@ impl Default for Limits { br_table_size: 256, subject_len: 32, payload_len: 16 * 1024, + runtime_memory: 1024 * 1024 * 128, } } } diff --git a/frame/contracts/src/storage/meter.rs b/frame/contracts/src/storage/meter.rs index 51a0af574bcd5..b8bbd6dc4178b 100644 --- a/frame/contracts/src/storage/meter.rs +++ b/frame/contracts/src/storage/meter.rs @@ -23,7 +23,7 @@ use crate::{ }; use codec::Encode; use frame_support::{ - dispatch::DispatchError, + dispatch::{fmt::Debug, DispatchError}, ensure, traits::{ tokens::{Fortitude::Polite, Preservation::Protect, WithdrawConsequence}, @@ -32,7 +32,10 @@ use frame_support::{ DefaultNoBound, RuntimeDebugNoBound, }; use pallet_contracts_primitives::StorageDeposit as Deposit; -use sp_runtime::{traits::Saturating, FixedPointNumber, FixedU128}; +use sp_runtime::{ + traits::{Saturating, Zero}, + FixedPointNumber, FixedU128, +}; use sp_std::{marker::PhantomData, vec::Vec}; /// Deposit that uses the native currency's balance type. @@ -96,17 +99,24 @@ pub enum ReservingExt {} pub trait State: private::Sealed {} /// State parameter that constitutes a meter that is in its root state. -pub enum Root {} +#[derive(Default, Debug)] +pub struct Root; /// State parameter that constitutes a meter that is in its nested state. -pub enum Nested {} +/// Its value indicates whether the nested meter has its own limit. +#[derive(DefaultNoBound, RuntimeDebugNoBound)] +pub enum Nested { + #[default] + DerivedLimit, + OwnLimit, +} impl State for Root {} impl State for Nested {} /// A type that allows the metering of consumed or freed storage of a single contract call stack. #[derive(DefaultNoBound, RuntimeDebugNoBound)] -pub struct RawMeter { +pub struct RawMeter { /// The limit of how much balance this meter is allowed to consume. limit: BalanceOf, /// The amount of balance that was used in this meter and all of its already absorbed children. @@ -118,8 +128,10 @@ pub struct RawMeter { /// We only have one charge per contract hence the size of this vector is /// limited by the maximum call depth. charges: Vec>, - /// Type parameters are only used in impls. - _phantom: PhantomData<(E, S)>, + /// We store the nested state to determine if it has a special limit for sub-call. + nested: S, + /// Type parameter only used in impls. + _phantom: PhantomData, } /// This type is used to describe a storage change when charging from the meter. @@ -214,6 +226,9 @@ impl Diff { /// this we can do all the refunds before doing any charge. This way a plain account can use /// more deposit than it has balance as along as it is covered by a refund. This /// essentially makes the order of storage changes irrelevant with regard to the deposit system. +/// The only exception is when a special (tougher) deposit limit is specified for a cross-contract +/// call. In that case the limit is enforced once the call is returned, rolling it back if +/// exhausted. #[derive(RuntimeDebugNoBound, Clone)] struct Charge { deposit_account: DepositAccount, @@ -255,16 +270,24 @@ impl RawMeter where T: Config, E: Ext, - S: State, + S: State + Default + Debug, { - /// Create a new child that has its `limit` set to whatever is remaining of it. + /// Create a new child that has its `limit`. + /// Passing `0` as the limit is interpreted as to take whatever is remaining from its parent. /// /// This is called whenever a new subcall is initiated in order to track the storage /// usage for this sub call separately. This is necessary because we want to exchange balance /// with the current contract we are interacting with. - pub fn nested(&self) -> RawMeter { + pub fn nested(&self, limit: BalanceOf) -> RawMeter { debug_assert!(self.is_alive()); - RawMeter { limit: self.available(), ..Default::default() } + // If a special limit is specified higher than it is available, + // we want to enforce the lesser limit to the nested meter, to fail in the sub-call. + let limit = self.available().min(limit); + if limit.is_zero() { + RawMeter { limit: self.available(), ..Default::default() } + } else { + RawMeter { limit, nested: Nested::OwnLimit, ..Default::default() } + } } /// Absorb a child that was spawned to handle a sub call. @@ -397,7 +420,7 @@ where self.total_deposit = deposit.clone(); info.storage_base_deposit = deposit.charge_or_zero(); - // Usually, deposit charges are deferred to be able to coalesce them with refunds. + // Normally, deposit charges are deferred to be able to coalesce them with refunds. // However, we need to charge immediately so that the account is created before // charges possibly below the ed are collected and fail. E::charge( @@ -429,8 +452,10 @@ where /// /// # Note /// - /// We only need to call this **once** for every call stack and not for every cross contract - /// call. Hence this is only called when the last call frame returns. + /// We normally need to call this **once** for every call stack and not for every cross contract + /// call. However, if a dedicated limit is specified for a sub-call, this needs to be called + /// once the sub-call has returned. For this, the [`Self::enforce_subcall_limit`] wrapper is + /// used. pub fn enforce_limit( &mut self, info: Option<&mut ContractInfo>, @@ -448,6 +473,18 @@ where } Ok(()) } + + /// This is a wrapper around [`Self::enforce_limit`] to use on the exit from a sub-call to + /// enforce its special limit if needed. + pub fn enforce_subcall_limit( + &mut self, + info: Option<&mut ContractInfo>, + ) -> Result<(), DispatchError> { + match self.nested { + Nested::OwnLimit => self.enforce_limit(info), + Nested::DerivedLimit => Ok(()), + } + } } impl Ext for ReservingExt { @@ -462,7 +499,8 @@ impl Ext for ReservingExt { let max = T::Currency::reducible_balance(origin, Protect, Polite) .saturating_sub(min_leftover) .saturating_sub(Pallet::::min_balance()); - let limit = limit.unwrap_or(max); + let default = max.min(T::DefaultDepositLimit::get()); + let limit = limit.unwrap_or(default); ensure!( limit <= max && matches!(T::Currency::can_withdraw(origin, limit), WithdrawConsequence::Success), @@ -673,7 +711,7 @@ mod tests { assert_eq!(meter.available(), 1_000); // an empty charge does not create a `Charge` entry - let mut nested0 = meter.nested(); + let mut nested0 = meter.nested(BalanceOf::::zero()); nested0.charge(&Default::default()); meter.absorb(nested0, DepositAccount(BOB), None); @@ -695,7 +733,7 @@ mod tests { let mut nested0_info = new_info(StorageInfo { bytes: 100, items: 5, bytes_deposit: 100, items_deposit: 10 }); - let mut nested0 = meter.nested(); + let mut nested0 = meter.nested(BalanceOf::::zero()); nested0.charge(&Diff { bytes_added: 108, bytes_removed: 5, @@ -706,13 +744,13 @@ mod tests { let mut nested1_info = new_info(StorageInfo { bytes: 100, items: 10, bytes_deposit: 100, items_deposit: 20 }); - let mut nested1 = nested0.nested(); + let mut nested1 = nested0.nested(BalanceOf::::zero()); nested1.charge(&Diff { items_removed: 5, ..Default::default() }); nested0.absorb(nested1, DepositAccount(CHARLIE), Some(&mut nested1_info)); let mut nested2_info = new_info(StorageInfo { bytes: 100, items: 7, bytes_deposit: 100, items_deposit: 20 }); - let mut nested2 = nested0.nested(); + let mut nested2 = nested0.nested(BalanceOf::::zero()); nested2.charge(&Diff { items_removed: 7, ..Default::default() }); nested0.absorb(nested2, DepositAccount(CHARLIE), Some(&mut nested2_info)); @@ -760,7 +798,7 @@ mod tests { let mut meter = TestMeter::new(&ALICE, Some(1_000), 0).unwrap(); assert_eq!(meter.available(), 1_000); - let mut nested0 = meter.nested(); + let mut nested0 = meter.nested(BalanceOf::::zero()); nested0.charge(&Diff { bytes_added: 5, bytes_removed: 1, @@ -771,7 +809,7 @@ mod tests { let mut nested1_info = new_info(StorageInfo { bytes: 100, items: 10, bytes_deposit: 100, items_deposit: 20 }); - let mut nested1 = nested0.nested(); + let mut nested1 = nested0.nested(BalanceOf::::zero()); nested1.charge(&Diff { items_removed: 5, ..Default::default() }); nested1.charge(&Diff { bytes_added: 20, ..Default::default() }); nested1.terminate(&nested1_info); diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 4e6c468f19c81..7b2bb04428a6f 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -16,6 +16,7 @@ // limitations under the License. use self::test_utils::hash; +use crate as pallet_contracts; use crate::{ chain_extension::{ ChainExtension, Environment, Ext, InitState, RegisteredChainExtension, @@ -44,6 +45,7 @@ use frame_support::{ }; use frame_system::{EventRecord, Phase}; use pretty_assertions::{assert_eq, assert_ne}; +use sp_core::ByteArray; use sp_io::hashing::blake2_256; use sp_keystore::{testing::MemoryKeystore, KeystoreExt}; use sp_runtime::{ @@ -53,8 +55,6 @@ use sp_runtime::{ }; use std::ops::Deref; -use crate as pallet_contracts; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; @@ -345,6 +345,8 @@ parameter_types! { }; pub static DepositPerByte: BalanceOf = 1; pub const DepositPerItem: BalanceOf = 2; + // We need this one set high enough for running benchmarks. + pub static DefaultDepositLimit: BalanceOf = 10_000_000; } impl Convert> for Test { @@ -402,6 +404,7 @@ impl Config for Test { type Schedule = MySchedule; type DepositPerByte = DepositPerByte; type DepositPerItem = DepositPerItem; + type DefaultDepositLimit = DefaultDepositLimit; type AddressGenerator = DefaultAddressGenerator; type MaxCodeLen = ConstU32<{ 123 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; @@ -1110,7 +1113,7 @@ fn cannot_self_destruct_through_draning() { #[test] fn cannot_self_destruct_through_storage_refund_after_price_change() { - let (wasm, _code_hash) = compile_module::("store").unwrap(); + let (wasm, _code_hash) = compile_module::("store_call").unwrap(); ExtBuilder::default().existential_deposit(200).build().execute_with(|| { let _ = Balances::deposit_creating(&ALICE, 1_000_000); let min_balance = ::Currency::minimum_balance(); @@ -2628,7 +2631,6 @@ fn gas_estimation_nested_call_fixed_limit() { ExtBuilder::default().existential_deposit(50).build().execute_with(|| { let min_balance = ::Currency::minimum_balance(); let _ = Balances::deposit_creating(&ALICE, 1000 * min_balance); - let _ = Balances::deposit_creating(&CHARLIE, 1000 * min_balance); let addr_caller = Contracts::bare_instantiate( ALICE, @@ -2662,6 +2664,7 @@ fn gas_estimation_nested_call_fixed_limit() { .iter() .cloned() .chain((GAS_LIMIT / 5).ref_time().to_le_bytes()) + .chain((GAS_LIMIT / 5).proof_size().to_le_bytes()) .collect(); // Call in order to determine the gas that is required for this call @@ -2678,22 +2681,36 @@ fn gas_estimation_nested_call_fixed_limit() { assert_ok!(&result.result); // We have a subcall with a fixed gas limit. This constitutes precharging. - assert!(result.gas_required.ref_time() > result.gas_consumed.ref_time()); + assert!(result.gas_required.all_gt(result.gas_consumed)); // Make the same call using the estimated gas. Should succeed. assert_ok!( Contracts::bare_call( ALICE, - addr_caller, + addr_caller.clone(), 0, result.gas_required, Some(result.storage_deposit.charge_or_zero()), - input, + input.clone(), false, Determinism::Enforced, ) .result ); + + // Make the same call using proof_size a but less than estimated. Should fail with OutOfGas. + let result = Contracts::bare_call( + ALICE, + addr_caller, + 0, + result.gas_required.sub_proof_size(1), + Some(result.storage_deposit.charge_or_zero()), + input, + false, + Determinism::Enforced, + ) + .result; + assert_err!(result, >::OutOfGas); }); } @@ -2774,7 +2791,7 @@ fn gas_estimation_call_runtime() { } #[test] -fn gas_call_runtime_reentrancy_guarded() { +fn call_runtime_reentrancy_guarded() { let (caller_code, _caller_hash) = compile_module::("call_runtime").unwrap(); let (callee_code, _callee_hash) = compile_module::("dummy").unwrap(); ExtBuilder::default().existential_deposit(50).build().execute_with(|| { @@ -3968,7 +3985,7 @@ fn set_code_hash() { #[test] fn storage_deposit_limit_is_enforced() { - let (wasm, _code_hash) = compile_module::("store").unwrap(); + let (wasm, _code_hash) = compile_module::("store_call").unwrap(); ExtBuilder::default().existential_deposit(200).build().execute_with(|| { let _ = Balances::deposit_creating(&ALICE, 1_000_000); let min_balance = ::Currency::minimum_balance(); @@ -3992,15 +4009,47 @@ fn storage_deposit_limit_is_enforced() { assert_eq!(get_contract(&addr).total_deposit(), min_balance); assert_eq!(::Currency::total_balance(&addr), min_balance); - // Create 100 bytes of storage with a price of per byte + // Create 1 byte of storage with a price of per byte, + // setting insufficient deposit limit, as it requires 3 Balance: + // 2 for the item added + 1 for the new storage item. assert_err_ignore_postinfo!( Contracts::call( RuntimeOrigin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, - Some(codec::Compact(1)), - 100u32.to_le_bytes().to_vec() + Some(codec::Compact(2)), + 1u32.to_le_bytes().to_vec() + ), + >::StorageDepositLimitExhausted, + ); + + // To check that deposit limit fallbacks to DefaultDepositLimit, + // we customize it here. + DEFAULT_DEPOSIT_LIMIT.with(|c| *c.borrow_mut() = 3); + + // Create 1 byte of storage, should cost 3 Balance: + // 2 for the item added + 1 for the new storage item. + // Should pass as it fallbacks to DefaultDepositLimit. + assert_ok!(Contracts::call( + RuntimeOrigin::signed(ALICE), + addr.clone(), + 0, + GAS_LIMIT, + None, + 1u32.to_le_bytes().to_vec() + )); + + // Use 4 more bytes of the storage for the same item, which requires 4 Balance. + // Should fail as DefaultDepositLimit is 3 and hence isn't enough. + assert_err_ignore_postinfo!( + Contracts::call( + RuntimeOrigin::signed(ALICE), + addr.clone(), + 0, + GAS_LIMIT, + None, + 5u32.to_le_bytes().to_vec() ), >::StorageDepositLimitExhausted, ); @@ -4008,10 +4057,10 @@ fn storage_deposit_limit_is_enforced() { } #[test] -fn storage_deposit_limit_is_enforced_late() { +fn deposit_limit_in_nested_calls() { let (wasm_caller, _code_hash_caller) = compile_module::("create_storage_and_call").unwrap(); - let (wasm_callee, _code_hash_callee) = compile_module::("store").unwrap(); + let (wasm_callee, _code_hash_callee) = compile_module::("store_call").unwrap(); ExtBuilder::default().existential_deposit(200).build().execute_with(|| { let _ = Balances::deposit_creating(&ALICE, 1_000_000); @@ -4054,27 +4103,28 @@ fn storage_deposit_limit_is_enforced_late() { 100u32.to_le_bytes().to_vec() )); - // We do not remove any storage but require 14 bytes of storage for the new - // storage created in the immediate contract. + // We do not remove any storage but add a storage item of 12 bytes in the caller + // contract. This would cost 12 + 2 = 14 Balance. + // The nested call doesn't get a special limit, which is set by passing 0 to it. + // This should fail as the specified parent's limit is less than the cost: 13 < + // 14. assert_err_ignore_postinfo!( Contracts::call( RuntimeOrigin::signed(ALICE), addr_caller.clone(), 0, GAS_LIMIT, - Some(codec::Compact(5)), - 100u32 - .to_le_bytes() - .as_ref() - .iter() - .chain(<_ as AsRef<[u8]>>::as_ref(&addr_callee)) - .cloned() - .collect(), + Some(codec::Compact(13)), + (100u32, &addr_callee, 0u64).encode(), ), >::StorageDepositLimitExhausted, ); - - // Allow for the additional 14 bytes but demand an additional byte in the callee contract. + // Now we specify the parent's limit high enough to cover the caller's storage additions. + // However, we use a single byte more in the callee, hence the storage deposit should be 15 + // Balance. + // The nested call doesn't get a special limit, which is set by passing 0 to it. + // This should fail as the specified parent's limit is less than the cost: 14 + // < 15. assert_err_ignore_postinfo!( Contracts::call( RuntimeOrigin::signed(ALICE), @@ -4082,19 +4132,31 @@ fn storage_deposit_limit_is_enforced_late() { 0, GAS_LIMIT, Some(codec::Compact(14)), - 101u32 - .to_le_bytes() - .as_ref() - .iter() - .chain(<_ as AsRef<[u8]>>::as_ref(&addr_callee)) - .cloned() - .collect(), + (101u32, &addr_callee, 0u64).encode(), ), >::StorageDepositLimitExhausted, ); - // Refund in the callee contract but not enough to cover the 14 balance required by the - // caller. + // Now we specify the parent's limit high enough to cover both the caller's and callee's + // storage additions. However, we set a special deposit limit of 1 Balance for the nested + // call. This should fail as callee adds up 2 bytes to the storage, meaning that the nested + // call should have a deposit limit of at least 2 Balance. The sub-call should be rolled + // back, which is covered by the next test case. + assert_err_ignore_postinfo!( + Contracts::call( + RuntimeOrigin::signed(ALICE), + addr_caller.clone(), + 0, + GAS_LIMIT, + Some(codec::Compact(16)), + (102u32, &addr_callee, 1u64).encode(), + ), + >::StorageDepositLimitExhausted, + ); + + // Refund in the callee contract but not enough to cover the 14 Balance required by the + // caller. Note that if previous sub-call wouldn't roll back, this call would pass making + // the test case fail. We don't set a special limit for the nested call here. assert_err_ignore_postinfo!( Contracts::call( RuntimeOrigin::signed(ALICE), @@ -4102,59 +4164,198 @@ fn storage_deposit_limit_is_enforced_late() { 0, GAS_LIMIT, Some(codec::Compact(0)), - 87u32 - .to_le_bytes() - .as_ref() - .iter() - .chain(<_ as AsRef<[u8]>>::as_ref(&addr_callee)) - .cloned() - .collect(), + (87u32, &addr_callee, 0u64).encode(), ), >::StorageDepositLimitExhausted, ); let _ = Balances::make_free_balance_be(&ALICE, 1_000); - // Send more than the sender has balance. + // Require more than the sender's balance. + // We don't set a special limit for the nested call. assert_err_ignore_postinfo!( Contracts::call( RuntimeOrigin::signed(ALICE), addr_caller.clone(), 0, GAS_LIMIT, - Some(codec::Compact(50)), - 1_200u32 - .to_le_bytes() - .as_ref() - .iter() - .chain(<_ as AsRef<[u8]>>::as_ref(&addr_callee)) - .cloned() - .collect(), + None, + (1200u32, &addr_callee, 1u64).encode(), ), >::StorageDepositLimitExhausted, ); - // Same as above but allow for the additional balance. + // Same as above but allow for the additional deposit of 1 Balance in parent. + // We set the special deposit limit of 1 Balance for the nested call, which isn't + // enforced as callee frees up storage. This should pass. assert_ok!(Contracts::call( RuntimeOrigin::signed(ALICE), addr_caller.clone(), 0, GAS_LIMIT, Some(codec::Compact(1)), - 87u32 - .to_le_bytes() - .as_ref() - .iter() - .chain(<_ as AsRef<[u8]>>::as_ref(&addr_callee)) - .cloned() - .collect(), + (87u32, &addr_callee, 1u64).encode(), )); }); } +#[test] +fn deposit_limit_in_nested_instantiate() { + let (wasm_caller, _code_hash_caller) = + compile_module::("create_storage_and_instantiate").unwrap(); + let (wasm_callee, code_hash_callee) = compile_module::("store_deploy").unwrap(); + const ED: u64 = 5; + ExtBuilder::default().existential_deposit(ED).build().execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + let _ = Balances::deposit_creating(&BOB, 1_000_000); + // Create caller contract + let addr_caller = Contracts::bare_instantiate( + ALICE, + 10_000u64, // this balance is later passed to the deployed contract + GAS_LIMIT, + None, + Code::Upload(wasm_caller), + vec![], + vec![], + false, + ) + .result + .unwrap() + .account_id; + // Deploy a contract to get its occupied storage size + let addr = Contracts::bare_instantiate( + ALICE, + 0, + GAS_LIMIT, + None, + Code::Upload(wasm_callee), + vec![0, 0, 0, 0], + vec![], + false, + ) + .result + .unwrap() + .account_id; + + let callee_info_len = ContractInfoOf::::get(&addr).unwrap().encoded_size() as u64; + + // We don't set a special deposit limit for the nested instantiation. + // + // The deposit limit set for the parent is insufficient for the instantiation, which + // requires: + // - callee_info_len + 2 for storing the new contract info, + // - ED for deployed contract account, + // - 2 for the storage item of 0 bytes being created in the callee constructor + // or (callee_info_len + 2 + ED + 2) Balance in total. + // + // Provided the limit is set to be 1 Balance less, + // this call should fail on the return from the caller contract. + assert_err_ignore_postinfo!( + Contracts::call( + RuntimeOrigin::signed(BOB), + addr_caller.clone(), + 0, + GAS_LIMIT, + Some(codec::Compact(callee_info_len + 2 + ED + 1)), + (0u32, &code_hash_callee, 0u64).encode(), + ), + >::StorageDepositLimitExhausted, + ); + // The charges made on instantiation should be rolled back. + assert_eq!(::Currency::free_balance(&BOB), 1_000_000); + + // Now we give enough limit for the instantiation itself, but require for 1 more storage + // byte in the constructor. Hence +1 Balance to the limit is needed. This should fail on the + // return from constructor. + assert_err_ignore_postinfo!( + Contracts::call( + RuntimeOrigin::signed(BOB), + addr_caller.clone(), + 0, + GAS_LIMIT, + Some(codec::Compact(callee_info_len + 2 + ED + 2)), + (1u32, &code_hash_callee, 0u64).encode(), + ), + >::StorageDepositLimitExhausted, + ); + // The charges made on the instantiation should be rolled back. + assert_eq!(::Currency::free_balance(&BOB), 1_000_000); + + // Now we set enough limit in parent call, but an insufficient limit for child instantiate. + // This should fail during the charging for the instantiation in + // `RawMeter::charge_instantiate()` + assert_err_ignore_postinfo!( + Contracts::call( + RuntimeOrigin::signed(BOB), + addr_caller.clone(), + 0, + GAS_LIMIT, + Some(codec::Compact(callee_info_len + 2 + ED + 2)), + (0u32, &code_hash_callee, callee_info_len + 2 + ED + 1).encode(), + ), + >::StorageDepositLimitExhausted, + ); + // The charges made on the instantiation should be rolled back. + assert_eq!(::Currency::free_balance(&BOB), 1_000_000); + + // Same as above but requires for single added storage + // item of 1 byte to be covered by the limit, which implies 3 more Balance. + // Now we set enough limit for the parent call, but insufficient limit for child + // instantiate. This should fail right after the constructor execution. + assert_err_ignore_postinfo!( + Contracts::call( + RuntimeOrigin::signed(BOB), + addr_caller.clone(), + 0, + GAS_LIMIT, + Some(codec::Compact(callee_info_len + 2 + ED + 3)), // enough parent limit + (1u32, &code_hash_callee, callee_info_len + 2 + ED + 2).encode(), + ), + >::StorageDepositLimitExhausted, + ); + // The charges made on the instantiation should be rolled back. + assert_eq!(::Currency::free_balance(&BOB), 1_000_000); + + // Set enough deposit limit for the child instantiate. This should succeed. + let result = Contracts::bare_call( + BOB, + addr_caller.clone(), + 0, + GAS_LIMIT, + Some(codec::Compact(callee_info_len + 2 + ED + 4).into()), + (1u32, &code_hash_callee, callee_info_len + 2 + ED + 3).encode(), + false, + Determinism::Enforced, + ); + + let returned = result.result.unwrap(); + // All balance of the caller except ED has been transferred to the callee. + // No deposit has been taken from it. + assert_eq!(::Currency::free_balance(&addr_caller), ED); + // Get address of the deployed contract. + let addr_callee = AccountId32::from_slice(&returned.data[0..32]).unwrap(); + // 10_000 should be sent to callee from the caller contract, plus ED to be sent from the + // origin. + assert_eq!(::Currency::free_balance(&addr_callee), 10_000 + ED); + // The origin should be charged with: + // - callee instantiation deposit = (callee_info_len + 2) + // - callee account ED + // - for writing an item of 1 byte to storage = 3 Balance + // + // Still, the latter is to be charged at the end of the call stack, hence + // only (callee_info_len + 2 + ED) is charged so far + assert_eq!( + ::Currency::free_balance(&BOB), + 1_000_000 - (callee_info_len + 2 + ED) + ); + // Check that deposit due to be charged still includes these 3 Balance + assert_eq!(result.storage_deposit.charge_or_zero(), (callee_info_len + 2 + ED + 3),) + }); +} + #[test] fn deposit_limit_honors_liquidity_restrictions() { - let (wasm, _code_hash) = compile_module::("store").unwrap(); + let (wasm, _code_hash) = compile_module::("store_call").unwrap(); ExtBuilder::default().existential_deposit(200).build().execute_with(|| { let _ = Balances::deposit_creating(&ALICE, 1_000_000); let _ = Balances::deposit_creating(&BOB, 1_000); @@ -4198,7 +4399,7 @@ fn deposit_limit_honors_liquidity_restrictions() { #[test] fn deposit_limit_honors_existential_deposit() { - let (wasm, _code_hash) = compile_module::("store").unwrap(); + let (wasm, _code_hash) = compile_module::("store_call").unwrap(); ExtBuilder::default().existential_deposit(200).build().execute_with(|| { let _ = Balances::deposit_creating(&ALICE, 1_000_000); let _ = Balances::deposit_creating(&BOB, 1_000); @@ -4241,7 +4442,7 @@ fn deposit_limit_honors_existential_deposit() { #[test] fn deposit_limit_honors_min_leftover() { - let (wasm, _code_hash) = compile_module::("store").unwrap(); + let (wasm, _code_hash) = compile_module::("store_call").unwrap(); ExtBuilder::default().existential_deposit(200).build().execute_with(|| { let _ = Balances::deposit_creating(&ALICE, 1_000_000); let _ = Balances::deposit_creating(&BOB, 1_000); @@ -4266,7 +4467,7 @@ fn deposit_limit_honors_min_leftover() { assert_eq!(get_contract(&addr).total_deposit(), min_balance); assert_eq!(::Currency::total_balance(&addr), min_balance); - // check that the minumum leftover (value send) is considered + // check that the minimum leftover (value send) is considered assert_err_ignore_postinfo!( Contracts::call( RuntimeOrigin::signed(BOB), diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 4723f0c833654..5be28a301d8f4 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -370,7 +370,7 @@ mod tests { gas::GasMeter, storage::WriteOutcome, tests::{RuntimeCall, Test, ALICE, BOB}, - BalanceOf, CodeHash, Error, OldWeight, Pallet as Contracts, + BalanceOf, CodeHash, Error, Pallet as Contracts, }; use assert_matches::assert_matches; use frame_support::{ @@ -470,6 +470,7 @@ mod tests { fn call( &mut self, _gas_limit: Weight, + _deposit_limit: BalanceOf, to: AccountIdOf, value: u64, data: Vec, @@ -489,6 +490,7 @@ mod tests { fn instantiate( &mut self, gas_limit: Weight, + _deposit_limit: BalanceOf, code_hash: CodeHash, value: u64, data: Vec, @@ -587,7 +589,11 @@ mod tests { 16_384 } fn get_weight_price(&self, weight: Weight) -> BalanceOf { - BalanceOf::::from(1312_u32).saturating_mul(weight.ref_time().into()) + BalanceOf::::from(1312_u32) + .saturating_mul(weight.ref_time().into()) + .saturating_add( + BalanceOf::::from(103_u32).saturating_mul(weight.proof_size()), + ) } fn schedule(&self) -> &Schedule { &self.schedule @@ -1589,7 +1595,7 @@ mod tests { const CODE_GAS_PRICE: &str = r#" (module - (import "seal0" "seal_weight_to_fee" (func $seal_weight_to_fee (param i64 i32 i32))) + (import "seal1" "weight_to_fee" (func $seal_weight_to_fee (param i64 i64 i32 i32))) (import "env" "memory" (memory 1 1)) ;; size of our buffer is 32 bytes @@ -1606,7 +1612,7 @@ mod tests { (func (export "call") ;; This stores the gas price in the buffer - (call $seal_weight_to_fee (i64.const 2) (i32.const 0) (i32.const 32)) + (call $seal_weight_to_fee (i64.const 2) (i64.const 1) (i32.const 0) (i32.const 32)) ;; assert len == 8 (call $assert @@ -1616,11 +1622,11 @@ mod tests { ) ) - ;; assert that contents of the buffer is equal to the i64 value of 2 * 1312. + ;; assert that contents of the buffer is equal to the i64 value of 2 * 1312 + 103 = 2727. (call $assert (i64.eq (i64.load (i32.const 0)) - (i64.const 2624) + (i64.const 2727) ) ) ) @@ -1635,12 +1641,12 @@ mod tests { const CODE_GAS_LEFT: &str = r#" (module - (import "seal0" "seal_gas_left" (func $seal_gas_left (param i32 i32))) + (import "seal1" "gas_left" (func $seal_gas_left (param i32 i32))) (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) (import "env" "memory" (memory 1 1)) - ;; size of our buffer is 32 bytes - (data (i32.const 32) "\20") + ;; Make output buffer size 20 bytes + (data (i32.const 20) "\14") (func $assert (param i32) (block $ok @@ -1652,19 +1658,19 @@ mod tests { ) (func (export "call") - ;; This stores the gas left in the buffer - (call $seal_gas_left (i32.const 0) (i32.const 32)) + ;; This stores the weight left to the buffer + (call $seal_gas_left (i32.const 0) (i32.const 20)) - ;; assert len == 8 + ;; Assert len <= 16 (max encoded Weight len) (call $assert - (i32.eq - (i32.load (i32.const 32)) - (i32.const 8) + (i32.le_u + (i32.load (i32.const 20)) + (i32.const 16) ) ) - ;; return gas left - (call $seal_return (i32.const 0) (i32.const 0) (i32.const 8)) + ;; Return weight left and its encoded value len + (call $seal_return (i32.const 0) (i32.const 0) (i32.load (i32.const 20))) (unreachable) ) @@ -1679,11 +1685,11 @@ mod tests { let output = execute(CODE_GAS_LEFT, vec![], &mut ext).unwrap(); - let gas_left = OldWeight::decode(&mut &*output.data).unwrap(); + let weight_left = Weight::decode(&mut &*output.data).unwrap(); let actual_left = ext.gas_meter.gas_left(); - // TODO: account for proof size weight - assert!(gas_left < gas_limit.ref_time(), "gas_left must be less than initial"); - assert!(gas_left > actual_left.ref_time(), "gas_left must be greater than final"); + + assert!(weight_left.all_lt(gas_limit), "gas_left must be less than initial"); + assert!(weight_left.all_gt(actual_left), "gas_left must be greater than final"); } /// Test that [`frame_support::weights::OldWeight`] en/decodes the same as our diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index bfb991ae51dfa..92ae2e3e6ea57 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -433,7 +433,7 @@ bitflags! { /// The kind of call that should be performed. enum CallType { /// Execute another instantiated contract - Call { callee_ptr: u32, value_ptr: u32, gas: u64 }, + Call { callee_ptr: u32, value_ptr: u32, deposit_ptr: u32, weight: Weight }, /// Execute deployed code in the context (storage, account ID, value) of the caller contract DelegateCall { code_hash_ptr: u32 }, } @@ -873,16 +873,22 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { }; let call_outcome = match call_type { - CallType::Call { callee_ptr, value_ptr, gas } => { + CallType::Call { callee_ptr, value_ptr, deposit_ptr, weight } => { let callee: <::T as frame_system::Config>::AccountId = self.read_sandbox_memory_as(memory, callee_ptr)?; + let deposit_limit: BalanceOf<::T> = if deposit_ptr == SENTINEL { + BalanceOf::<::T>::zero() + } else { + self.read_sandbox_memory_as(memory, deposit_ptr)? + }; let value: BalanceOf<::T> = self.read_sandbox_memory_as(memory, value_ptr)?; if value > 0u32.into() { self.charge_gas(RuntimeCosts::CallSurchargeTransfer)?; } self.ext.call( - Weight::from_parts(gas, 0), + weight, + deposit_limit, callee, value, input_data, @@ -926,7 +932,8 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { &mut self, memory: &mut [u8], code_hash_ptr: u32, - gas: u64, + weight: Weight, + deposit_ptr: u32, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, @@ -937,8 +944,12 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { salt_ptr: u32, salt_len: u32, ) -> Result { - let gas = Weight::from_parts(gas, 0); self.charge_gas(RuntimeCosts::InstantiateBase { input_data_len, salt_len })?; + let deposit_limit: BalanceOf<::T> = if deposit_ptr == SENTINEL { + BalanceOf::<::T>::zero() + } else { + self.read_sandbox_memory_as(memory, deposit_ptr)? + }; let value: BalanceOf<::T> = self.read_sandbox_memory_as(memory, value_ptr)?; if value > 0u32.into() { self.charge_gas(RuntimeCosts::InstantiateSurchargeTransfer)?; @@ -947,7 +958,8 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { self.read_sandbox_memory_as(memory, code_hash_ptr)?; let input_data = self.read_sandbox_memory(memory, input_data_ptr, input_data_len)?; let salt = self.read_sandbox_memory(memory, salt_ptr, salt_len)?; - let instantiate_outcome = self.ext.instantiate(gas, code_hash, value, input_data, &salt); + let instantiate_outcome = + self.ext.instantiate(weight, deposit_limit, code_hash, value, input_data, &salt); if let Ok((address, output)) = &instantiate_outcome { if !output.flags.contains(ReturnFlags::REVERT) { self.write_sandbox_output( @@ -993,6 +1005,7 @@ pub mod env { /// /// NOTE: This is a implementation defined call and is NOT a part of the public API. /// This call is supposed to be called only by instrumentation injected code. + /// It deals only with the *ref_time* Weight. /// /// - `amount`: How much gas is used. fn gas(ctx: _, _memory: _, amount: u64) -> Result<(), TrapReason> { @@ -1002,8 +1015,9 @@ pub mod env { /// Set the value at the given key in the contract storage. /// - /// Equivalent to the newer version [`super::seal1::Api::set_storage`] with the exception of the - /// return type. Still a valid thing to call when not interested in the return value. + /// Equivalent to the newer [`seal1`][`super::api_doc::Version1::set_storage`] version with the + /// exception of the return type. Still a valid thing to call when not interested in the return + /// value. #[prefixed_alias] fn set_storage( ctx: _, @@ -1076,8 +1090,9 @@ pub mod env { /// Clear the value at the given key in the contract storage. /// - /// Equivalent to the newer version [`super::seal1::Api::clear_storage`] with the exception of - /// the return type. Still a valid thing to call when not interested in the return value. + /// Equivalent to the newer [`seal1`][`super::api_doc::Version1::clear_storage`] version with + /// the exception of the return type. Still a valid thing to call when not interested in the + /// return value. #[prefixed_alias] fn clear_storage(ctx: _, memory: _, key_ptr: u32) -> Result<(), TrapReason> { ctx.clear_storage(memory, KeyType::Fix, key_ptr).map(|_| ()) @@ -1299,7 +1314,47 @@ pub mod env { ctx.call( memory, CallFlags::ALLOW_REENTRY, - CallType::Call { callee_ptr, value_ptr, gas }, + CallType::Call { + callee_ptr, + value_ptr, + deposit_ptr: SENTINEL, + weight: Weight::from_parts(gas, 0), + }, + input_data_ptr, + input_data_len, + output_ptr, + output_len_ptr, + ) + } + + /// Make a call to another contract. + /// + /// Equivalent to the newer [`seal2`][`super::api_doc::Version2::call`] version but works with + /// *ref_time* Weight only. It is recommended to switch to the latest version, once it's + /// stabilized. + #[version(1)] + #[prefixed_alias] + fn call( + ctx: _, + memory: _, + flags: u32, + callee_ptr: u32, + gas: u64, + value_ptr: u32, + input_data_ptr: u32, + input_data_len: u32, + output_ptr: u32, + output_len_ptr: u32, + ) -> Result { + ctx.call( + memory, + CallFlags::from_bits(flags).ok_or(Error::::InvalidCallFlags)?, + CallType::Call { + callee_ptr, + value_ptr, + deposit_ptr: SENTINEL, + weight: Weight::from_parts(gas, 0), + }, input_data_ptr, input_data_len, output_ptr, @@ -1318,7 +1373,12 @@ pub mod env { /// - `flags`: See `crate::wasm::runtime::CallFlags` for a documentation of the supported flags. /// - `callee_ptr`: a pointer to the address of the callee contract. Should be decodable as an /// `T::AccountId`. Traps otherwise. - /// - `gas`: how much gas to devote to the execution. + /// - `ref_time_limit`: how much *ref_time* Weight to devote to the execution. + /// - `proof_size_limit`: how much *proof_size* Weight to devote to the execution. + /// - `deposit_ptr`: a pointer to the buffer with value of the storage deposit limit for the + /// call. Should be decodable as a `T::Balance`. Traps otherwise. Passing `SENTINEL` means + /// setting no specific limit for the call, which implies storage usage up to the limit of the + /// parent call. /// - `value_ptr`: a pointer to the buffer with value, how much value to send. Should be /// decodable as a `T::Balance`. Traps otherwise. /// - `input_data_ptr`: a pointer to a buffer to be used as input data to the callee. @@ -1336,14 +1396,16 @@ pub mod env { /// - `ReturnCode::CalleeTrapped` /// - `ReturnCode::TransferFailed` /// - `ReturnCode::NotCallable` - #[version(1)] - #[prefixed_alias] + #[version(2)] + #[unstable] fn call( ctx: _, memory: _, flags: u32, callee_ptr: u32, - gas: u64, + ref_time_limit: u64, + proof_size_limit: u64, + deposit_ptr: u32, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, @@ -1353,7 +1415,12 @@ pub mod env { ctx.call( memory, CallFlags::from_bits(flags).ok_or(Error::::InvalidCallFlags)?, - CallType::Call { callee_ptr, value_ptr, gas }, + CallType::Call { + callee_ptr, + value_ptr, + deposit_ptr, + weight: Weight::from_parts(ref_time_limit, proof_size_limit), + }, input_data_ptr, input_data_len, output_ptr, @@ -1417,8 +1484,7 @@ pub mod env { /// # Note /// /// The values `_code_hash_len` and `_value_len` are ignored because the encoded sizes - /// of those types are fixed through - /// [`codec::MaxEncodedLen`]. The fields exist + /// of those types are fixed through [`codec::MaxEncodedLen`]. The fields exist /// for backwards compatibility. Consider switching to the newest version of this function. #[prefixed_alias] fn instantiate( @@ -1441,7 +1507,47 @@ pub mod env { ctx.instantiate( memory, code_hash_ptr, - gas, + Weight::from_parts(gas, 0), + SENTINEL, + value_ptr, + input_data_ptr, + input_data_len, + address_ptr, + address_len_ptr, + output_ptr, + output_len_ptr, + salt_ptr, + salt_len, + ) + } + + /// Instantiate a contract with the specified code hash. + /// + /// Equivalent to the newer [`seal2`][`super::api_doc::Version2::instantiate`] version but works + /// with *ref_time* Weight only. It is recommended to switch to the latest version, once it's + /// stabilized. + #[version(1)] + #[prefixed_alias] + fn instantiate( + ctx: _, + memory: _, + code_hash_ptr: u32, + gas: u64, + value_ptr: u32, + input_data_ptr: u32, + input_data_len: u32, + address_ptr: u32, + address_len_ptr: u32, + output_ptr: u32, + output_len_ptr: u32, + salt_ptr: u32, + salt_len: u32, + ) -> Result { + ctx.instantiate( + memory, + code_hash_ptr, + Weight::from_parts(gas, 0), + SENTINEL, value_ptr, input_data_ptr, input_data_len, @@ -1468,15 +1574,21 @@ pub mod env { /// # Parameters /// /// - `code_hash_ptr`: a pointer to the buffer that contains the initializer code. - /// - `gas`: how much gas to devote to the execution of the initializer code. + /// - `ref_time_limit`: how much *ref_time* Weight to devote to the execution. + /// - `proof_size_limit`: how much *proof_size* Weight to devote to the execution. + /// - `deposit_ptr`: a pointer to the buffer with value of the storage deposit limit for + /// instantiation. Should be decodable as a `T::Balance`. Traps otherwise. Passing `SENTINEL` + /// means setting no specific limit for the call, which implies storage usage up to the limit + /// of the parent call. /// - `value_ptr`: a pointer to the buffer with value, how much value to send. Should be /// decodable as a `T::Balance`. Traps otherwise. /// - `input_data_ptr`: a pointer to a buffer to be used as input data to the initializer code. /// - `input_data_len`: length of the input data buffer. - /// - `address_ptr`: a pointer where the new account's address is copied to. - /// - `address_len_ptr`: in-out pointer to where the length of the buffer is read from and the - /// actual length is written to. - /// - `output_ptr`: a pointer where the output buffer is copied to. + /// - `address_ptr`: a pointer where the new account's address is copied to. `SENTINEL` means + /// not to copy. + /// - `address_len_ptr`: pointer to where put the length of the address. + /// - `output_ptr`: a pointer where the output buffer is copied to. `SENTINEL` means not to + /// copy. /// - `output_len_ptr`: in-out pointer to where the length of the buffer is read from and the /// actual length is written to. /// - `salt_ptr`: Pointer to raw bytes used for address derivation. See `fn contract_address`. @@ -1494,13 +1606,15 @@ pub mod env { /// - `ReturnCode::CalleeTrapped` /// - `ReturnCode::TransferFailed` /// - `ReturnCode::CodeNotFound` - #[version(1)] - #[prefixed_alias] + #[version(2)] + #[unstable] fn instantiate( ctx: _, memory: _, code_hash_ptr: u32, - gas: u64, + ref_time_limit: u64, + proof_size_limit: u64, + deposit_ptr: u32, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, @@ -1514,7 +1628,8 @@ pub mod env { ctx.instantiate( memory, code_hash_ptr, - gas, + Weight::from_parts(ref_time_limit, proof_size_limit), + deposit_ptr, value_ptr, input_data_ptr, input_data_len, @@ -1762,49 +1877,99 @@ pub mod env { /// Stores the price for the specified amount of gas into the supplied buffer. /// - /// The value is stored to linear memory at the address pointed to by `out_ptr`. - /// `out_len_ptr` must point to a u32 value that describes the available space at - /// `out_ptr`. This call overwrites it with the size of the value. If the available - /// space at `out_ptr` is less than the size of the value a trap is triggered. + /// Equivalent to the newer [`seal1`][`super::api_doc::Version2::weight_to_fee`] version but + /// works with *ref_time* Weight only. It is recommended to switch to the latest version, once + /// it's stabilized. + #[prefixed_alias] + fn weight_to_fee( + ctx: _, + memory: _, + gas: u64, + out_ptr: u32, + out_len_ptr: u32, + ) -> Result<(), TrapReason> { + let gas = Weight::from_parts(gas, 0); + ctx.charge_gas(RuntimeCosts::WeightToFee)?; + Ok(ctx.write_sandbox_output( + memory, + out_ptr, + out_len_ptr, + &ctx.ext.get_weight_price(gas).encode(), + false, + already_charged, + )?) + } + + /// Stores the price for the specified amount of weight into the supplied buffer. + /// + /// # Parameters + /// + /// - `out_ptr`: pointer to the linear memory where the returning value is written to. If the + /// available space at `out_ptr` is less than the size of the value a trap is triggered. + /// - `out_len_ptr`: in-out pointer into linear memory where the buffer length is read from and + /// the value length is written to. /// /// The data is encoded as `T::Balance`. /// /// # Note /// - /// It is recommended to avoid specifying very small values for `gas` as the prices for a single - /// gas can be smaller than one. - #[prefixed_alias] + /// It is recommended to avoid specifying very small values for `ref_time_limit` and + /// `proof_size_limit` as the prices for a single gas can be smaller than the basic balance + /// unit. + #[version(1)] + #[unstable] fn weight_to_fee( ctx: _, memory: _, - gas: u64, + ref_time_limit: u64, + proof_size_limit: u64, out_ptr: u32, out_len_ptr: u32, ) -> Result<(), TrapReason> { - let gas = Weight::from_parts(gas, 0); + let weight = Weight::from_parts(ref_time_limit, proof_size_limit); ctx.charge_gas(RuntimeCosts::WeightToFee)?; Ok(ctx.write_sandbox_output( memory, out_ptr, out_len_ptr, - &ctx.ext.get_weight_price(gas).encode(), + &ctx.ext.get_weight_price(weight).encode(), false, already_charged, )?) } - /// Stores the amount of gas left into the supplied buffer. + /// Stores the weight left into the supplied buffer. + /// + /// Equivalent to the newer [`seal1`][`super::api_doc::Version2::gas_left`] version but + /// works with *ref_time* Weight only. It is recommended to switch to the latest version, once + /// it's stabilized. + #[prefixed_alias] + fn gas_left(ctx: _, memory: _, out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason> { + ctx.charge_gas(RuntimeCosts::GasLeft)?; + let gas_left = &ctx.ext.gas_meter().gas_left().ref_time().encode(); + Ok(ctx.write_sandbox_output( + memory, + out_ptr, + out_len_ptr, + gas_left, + false, + already_charged, + )?) + } + + /// Stores the amount of weight left into the supplied buffer. /// /// The value is stored to linear memory at the address pointed to by `out_ptr`. /// `out_len_ptr` must point to a u32 value that describes the available space at /// `out_ptr`. This call overwrites it with the size of the value. If the available /// space at `out_ptr` is less than the size of the value a trap is triggered. /// - /// The data is encoded as Gas. - #[prefixed_alias] + /// The data is encoded as Weight. + #[version(1)] + #[unstable] fn gas_left(ctx: _, memory: _, out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason> { ctx.charge_gas(RuntimeCosts::GasLeft)?; - let gas_left = &ctx.ext.gas_meter().gas_left().ref_time().encode(); + let gas_left = &ctx.ext.gas_meter().gas_left().encode(); Ok(ctx.write_sandbox_output( memory, out_ptr, From 7ddfdfbdfab482866a9909ad4927dc2c9b77f8e2 Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Wed, 26 Apr 2023 19:37:44 +0800 Subject: [PATCH 74/93] sp-core: remove useless bounded module (#13865) --- primitives/core/src/bounded.rs | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 primitives/core/src/bounded.rs diff --git a/primitives/core/src/bounded.rs b/primitives/core/src/bounded.rs deleted file mode 100644 index c78f1f85a4c23..0000000000000 --- a/primitives/core/src/bounded.rs +++ /dev/null @@ -1,28 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Bounded collection types. - -pub mod bounded_btree_map; -pub mod bounded_btree_set; -pub mod bounded_vec; -pub mod weak_bounded_vec; - -pub use bounded_btree_map::BoundedBTreeMap; -pub use bounded_btree_set::BoundedBTreeSet; -pub use bounded_vec::{BoundedSlice, BoundedVec}; -pub use weak_bounded_vec::WeakBoundedVec; From 154448b77413de5eaed7479f847191df20c46a96 Mon Sep 17 00:00:00 2001 From: Sasha Gryaznov Date: Wed, 26 Apr 2023 16:46:44 +0300 Subject: [PATCH 75/93] fix a test (#14021) --- frame/contracts/src/tests.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 7b2bb04428a6f..3c1015bc9ec60 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -4341,12 +4341,9 @@ fn deposit_limit_in_nested_instantiate() { // - callee instantiation deposit = (callee_info_len + 2) // - callee account ED // - for writing an item of 1 byte to storage = 3 Balance - // - // Still, the latter is to be charged at the end of the call stack, hence - // only (callee_info_len + 2 + ED) is charged so far assert_eq!( ::Currency::free_balance(&BOB), - 1_000_000 - (callee_info_len + 2 + ED) + 1_000_000 - (callee_info_len + 2 + ED + 3) ); // Check that deposit due to be charged still includes these 3 Balance assert_eq!(result.storage_deposit.charge_or_zero(), (callee_info_len + 2 + ED + 3),) From 943c520aa78fcfaf3509790009ad062e8d4c6990 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Wed, 26 Apr 2023 15:26:07 +0100 Subject: [PATCH 76/93] Various minor fixes (#13945) * Fix: Incorrect implementation of can_reserve check * Fix: Incorrect migration of consumer counting for existing accounts with frozen amounts * Fix: Inconsistent implementation between assets can_deposit and new_account * Fixes * Fixes * Another fix * Update tests.rs * Update fungible_tests.rs * Use `can_accrue_consumers` in the body of `can_inc_consumer` --------- Co-authored-by: Keith Yeung Co-authored-by: Oliver Tale-Yazdi Co-authored-by: parity-processbot <> --- frame/assets/src/functions.rs | 2 +- frame/assets/src/tests.rs | 51 ++++++++++++++++++---- frame/balances/src/impl_currency.rs | 4 +- frame/balances/src/lib.rs | 2 +- frame/balances/src/tests/currency_tests.rs | 10 +++++ frame/balances/src/tests/fungible_tests.rs | 25 +++++++++++ frame/system/src/lib.rs | 20 +++++++-- 7 files changed, 98 insertions(+), 16 deletions(-) diff --git a/frame/assets/src/functions.rs b/frame/assets/src/functions.rs index af9e269acf8bc..1e10e0066e851 100644 --- a/frame/assets/src/functions.rs +++ b/frame/assets/src/functions.rs @@ -138,7 +138,7 @@ impl, I: 'static> Pallet { if amount < details.min_balance { return DepositConsequence::BelowMinimum } - if !details.is_sufficient && !frame_system::Pallet::::can_inc_consumer(who) { + if !details.is_sufficient && !frame_system::Pallet::::can_accrue_consumers(who, 2) { return DepositConsequence::CannotCreate } if details.is_sufficient && details.sufficients.checked_add(1).is_none() { diff --git a/frame/assets/src/tests.rs b/frame/assets/src/tests.rs index afd224ad66642..b47fb6486cb27 100644 --- a/frame/assets/src/tests.rs +++ b/frame/assets/src/tests.rs @@ -21,7 +21,7 @@ use super::*; use crate::{mock::*, Error}; use frame_support::{ assert_noop, assert_ok, - traits::{fungibles::InspectEnumerable, Currency}, + traits::{fungibles::InspectEnumerable, tokens::Preservation::Protect, Currency}, }; use pallet_balances::Error as BalancesError; use sp_io::storage; @@ -33,6 +33,25 @@ fn asset_ids() -> Vec { s } +#[test] +fn transfer_should_never_burn() { + new_test_ext().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); + Balances::make_free_balance_be(&1, 100); + Balances::make_free_balance_be(&2, 100); + + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(Assets::balance(0, 1), 100); + + while System::inc_consumers(&2).is_ok() {} + let _ = System::dec_consumers(&2); + // Exactly one consumer ref remaining. + + let _ = >::transfer(0, &1, &2, 50, Protect); + assert_eq!(Assets::balance(0, 1) + Assets::balance(0, 2), 100); + }); +} + #[test] fn basic_minting_should_work() { new_test_ext().execute_with(|| { @@ -57,10 +76,7 @@ fn minting_too_many_insufficient_assets_fails() { Balances::make_free_balance_be(&1, 100); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 1, 1, 100)); - assert_noop!( - Assets::mint(RuntimeOrigin::signed(1), 2, 1, 100), - Error::::UnavailableConsumer - ); + assert_noop!(Assets::mint(RuntimeOrigin::signed(1), 2, 1, 100), TokenError::CannotCreate); Balances::make_free_balance_be(&2, 1); assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 100)); @@ -78,10 +94,7 @@ fn minting_insufficient_asset_with_deposit_should_work_when_consumers_exhausted( Balances::make_free_balance_be(&1, 100); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 1, 1, 100)); - assert_noop!( - Assets::mint(RuntimeOrigin::signed(1), 2, 1, 100), - Error::::UnavailableConsumer - ); + assert_noop!(Assets::mint(RuntimeOrigin::signed(1), 2, 1, 100), TokenError::CannotCreate); assert_ok!(Assets::touch(RuntimeOrigin::signed(1), 2)); assert_eq!(Balances::reserved_balance(&1), 10); @@ -1322,3 +1335,23 @@ fn asset_create_and_destroy_is_reverted_if_callback_fails() { ); }); } + +#[test] +fn multiple_transfer_alls_work_ok() { + new_test_ext().execute_with(|| { + // Only run PoC when the system pallet is enabled, since the underlying bug is in the + // system pallet it won't work with BalancesAccountStore + // Start with a balance of 100 + Balances::force_set_balance(RuntimeOrigin::root(), 1, 100).unwrap(); + // Emulate a sufficient, in reality this could be reached by transferring a sufficient + // asset to the account + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + // Spend the same balance multiple times + assert_ok!(Balances::transfer_all(RuntimeOrigin::signed(1), 1337, false)); + assert_ok!(Balances::transfer_all(RuntimeOrigin::signed(1), 1337, false)); + + assert_eq!(Balances::free_balance(&1), 0); + assert_eq!(Balances::free_balance(&1337), 100); + }); +} diff --git a/frame/balances/src/impl_currency.rs b/frame/balances/src/impl_currency.rs index ff8cc71d6224a..9f764a37b8b89 100644 --- a/frame/balances/src/impl_currency.rs +++ b/frame/balances/src/impl_currency.rs @@ -490,7 +490,9 @@ where return true } Self::account(who).free.checked_sub(&value).map_or(false, |new_balance| { - Self::ensure_can_withdraw(who, value, WithdrawReasons::RESERVE, new_balance).is_ok() + new_balance >= T::ExistentialDeposit::get() && + Self::ensure_can_withdraw(who, value, WithdrawReasons::RESERVE, new_balance) + .is_ok() }) } diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index 6835d3c8148bb..c87b01d77bae5 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -788,7 +788,7 @@ pub mod pallet { return false } a.flags.set_new_logic(); - if !a.reserved.is_zero() || !a.frozen.is_zero() { + if !a.reserved.is_zero() && a.frozen.is_zero() { if system::Pallet::::providers(who) == 0 { // Gah!! We have no provider refs :( // This shouldn't practically happen, but we need a failsafe anyway: let's give diff --git a/frame/balances/src/tests/currency_tests.rs b/frame/balances/src/tests/currency_tests.rs index 034c92f65689b..e25b122c1fcf0 100644 --- a/frame/balances/src/tests/currency_tests.rs +++ b/frame/balances/src/tests/currency_tests.rs @@ -1180,6 +1180,16 @@ fn named_reserve_should_work() { }); } +#[test] +fn reserve_must_succeed_if_can_reserve_does() { + ExtBuilder::default().build_and_execute_with(|| { + let _ = Balances::deposit_creating(&1, 1); + let _ = Balances::deposit_creating(&2, 2); + assert!(Balances::can_reserve(&1, 1) == Balances::reserve(&1, 1).is_ok()); + assert!(Balances::can_reserve(&2, 1) == Balances::reserve(&2, 1).is_ok()); + }); +} + #[test] fn reserved_named_to_yourself_should_work() { ExtBuilder::default().build_and_execute_with(|| { diff --git a/frame/balances/src/tests/fungible_tests.rs b/frame/balances/src/tests/fungible_tests.rs index 185396019b13d..ab2606c53ff71 100644 --- a/frame/balances/src/tests/fungible_tests.rs +++ b/frame/balances/src/tests/fungible_tests.rs @@ -398,6 +398,31 @@ fn unholding_frees_hold_slot() { }); } +#[test] +fn sufficients_work_properly_with_reference_counting() { + ExtBuilder::default() + .existential_deposit(1) + .monied(true) + .build_and_execute_with(|| { + // Only run PoC when the system pallet is enabled, since the underlying bug is in the + // system pallet it won't work with BalancesAccountStore + if UseSystem::get() { + // Start with a balance of 100 + >::set_balance(&1, 100); + // Emulate a sufficient, in reality this could be reached by transferring a + // sufficient asset to the account + System::inc_sufficients(&1); + // Spend the same balance multiple times + assert_ok!(>::transfer(&1, &1337, 100, Expendable)); + assert_eq!(Balances::free_balance(&1), 0); + assert_noop!( + >::transfer(&1, &1337, 100, Expendable), + TokenError::FundsUnavailable + ); + } + }); +} + #[test] fn emit_events_with_changing_freezes() { ExtBuilder::default().build_and_execute_with(|| { diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 88291c326edba..6bbebb870594c 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -1222,10 +1222,20 @@ impl Pallet { a.consumers == 0 || a.providers > 1 } - /// True if the account has at least one provider reference. - pub fn can_inc_consumer(who: &T::AccountId) -> bool { + /// True if the account has at least one provider reference and adding `amount` consumer + /// references would not take it above the the maximum. + pub fn can_accrue_consumers(who: &T::AccountId, amount: u32) -> bool { let a = Account::::get(who); - a.providers > 0 && a.consumers < T::MaxConsumers::max_consumers() + match a.consumers.checked_add(amount) { + Some(c) => a.providers > 0 && c <= T::MaxConsumers::max_consumers(), + None => false, + } + } + + /// True if the account has at least one provider reference and fewer consumer references than + /// the maximum. + pub fn can_inc_consumer(who: &T::AccountId) -> bool { + Self::can_accrue_consumers(who, 1) } /// Deposits an event into this block's event record. @@ -1679,8 +1689,10 @@ impl StoredMap for Pallet { let is_default = account.data == T::AccountData::default(); let mut some_data = if is_default { None } else { Some(account.data) }; let result = f(&mut some_data)?; - if Self::providers(k) > 0 { + if Self::providers(k) > 0 || Self::sufficients(k) > 0 { Account::::mutate(k, |a| a.data = some_data.unwrap_or_default()); + } else { + Account::::remove(k) } Ok(result) } From 2e7e628ecdf96d279c4c3d5d1aea0dd55a02012e Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Thu, 27 Apr 2023 08:23:01 +0200 Subject: [PATCH 77/93] contracts Add storage_deposit test (#14003) * contracts Add storage_deposit test * fix comments * PR comments --- frame/contracts/fixtures/call.wat | 39 +++++++++++++++++++++++ frame/contracts/src/tests.rs | 53 +++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 frame/contracts/fixtures/call.wat diff --git a/frame/contracts/fixtures/call.wat b/frame/contracts/fixtures/call.wat new file mode 100644 index 0000000000000..4558b2c6409b9 --- /dev/null +++ b/frame/contracts/fixtures/call.wat @@ -0,0 +1,39 @@ +;; This calls another contract as passed as its account id. +(module + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "seal1" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32) (result i32))) + (import "env" "memory" (memory 1 1)) + + (func $assert (param i32) + (block $ok + (br_if $ok + (get_local 0) + ) + (unreachable) + ) + ) + + (func (export "deploy")) + + (func (export "call") + ;; Store length of input buffer. + (i32.store (i32.const 0) (i32.const 512)) + + ;; Copy input at address 4. + (call $seal_input (i32.const 4) (i32.const 0)) + + ;; Call passed contract. + (call $assert (i32.eqz + (call $seal_call + (i32.const 0) ;; No flags + (i32.const 8) ;; Pointer to "callee" address. + (i64.const 0) ;; How much gas to devote for the execution. 0 = all. + (i32.const 512) ;; Pointer to the buffer with value to transfer + (i32.const 4) ;; Pointer to input data buffer address + (i32.const 4) ;; Length of input data buffer + (i32.const 4294967295) ;; u32 max value is the sentinel value: do not copy output + (i32.const 0) ;; Length is ignored in this case + ) + )) + ) +) diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 3c1015bc9ec60..dbe61cf33da56 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -3582,6 +3582,59 @@ fn storage_deposit_works() { }); } +#[test] +fn storage_deposit_callee_works() { + let (wasm_caller, _code_hash_caller) = compile_module::("call").unwrap(); + let (wasm_callee, _code_hash_callee) = compile_module::("store").unwrap(); + const ED: u64 = 200; + ExtBuilder::default().existential_deposit(ED).build().execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + + // Create both contracts: Constructors do nothing. + let addr_caller = Contracts::bare_instantiate( + ALICE, + 0, + GAS_LIMIT, + None, + Code::Upload(wasm_caller), + vec![], + vec![], + false, + ) + .result + .unwrap() + .account_id; + let addr_callee = Contracts::bare_instantiate( + ALICE, + 0, + GAS_LIMIT, + None, + Code::Upload(wasm_callee), + vec![], + vec![], + false, + ) + .result + .unwrap() + .account_id; + + assert_ok!(Contracts::call( + RuntimeOrigin::signed(ALICE), + addr_caller, + 0, + GAS_LIMIT, + None, + (100u32, &addr_callee).encode() + )); + + let callee = get_contract(&addr_callee); + let deposit = ED + DepositPerByte::get() * 100 + DepositPerItem::get() * 1; + + assert_eq!(test_utils::get_balance(callee.deposit_account()), deposit); + assert_eq!(callee.total_deposit(), deposit); + }); +} + #[test] fn set_code_extrinsic() { let (wasm, code_hash) = compile_module::("dummy").unwrap(); From dce73feadc8e33983a055e06f56066665c218544 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 27 Apr 2023 18:12:29 +1000 Subject: [PATCH 78/93] remote-externalities: batch insert key/values (#14004) * add batch inserting into remote externalities * use into_iter * remove redundant comment * redundant batch insert * avoid extra vec allocations --- primitives/state-machine/src/testing.rs | 11 +++++ utils/frame/remote-externalities/src/lib.rs | 49 +++++++++------------ 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/primitives/state-machine/src/testing.rs b/primitives/state-machine/src/testing.rs index 3a0165fe4588d..1921287a64745 100644 --- a/primitives/state-machine/src/testing.rs +++ b/primitives/state-machine/src/testing.rs @@ -132,6 +132,17 @@ where self.offchain_db.clone() } + /// Batch insert key/values into backend + pub fn batch_insert(&mut self, kvs: I) + where + I: IntoIterator, + { + self.backend.insert( + Some((None, kvs.into_iter().map(|(k, v)| (k, Some(v))).collect())), + self.state_version, + ); + } + /// Insert key/value into backend pub fn insert(&mut self, k: StorageKey, v: StorageValue) { self.backend.insert(vec![(None, vec![(k, Some(v))])], self.state_version); diff --git a/utils/frame/remote-externalities/src/lib.rs b/utils/frame/remote-externalities/src/lib.rs index b60e2bc75d0db..ea9b68ce2f6ae 100644 --- a/utils/frame/remote-externalities/src/lib.rs +++ b/utils/frame/remote-externalities/src/lib.rs @@ -638,24 +638,20 @@ where let mut processed = 0usize; loop { match rx.next().await.unwrap() { - Message::Batch(kv) => { - for (k, v) in kv { - processed += 1; - if processed % 50_000 == 0 || processed == keys.len() || processed == 1 { - log::info!( - target: LOG_TARGET, - "inserting keys progress = {:.0}% [{} / {}]", - (processed as f32 / keys.len() as f32) * 100f32, - processed, - keys.len(), - ); - } - // skip writing the child root data. - if is_default_child_storage_key(k.as_ref()) { - continue - } - pending_ext.insert(k, v); - } + Message::Batch(kvs) => { + let kvs = kvs + .into_iter() + .filter(|(k, _)| !is_default_child_storage_key(k)) + .collect::>(); + processed += kvs.len(); + pending_ext.batch_insert(kvs); + log::info!( + target: LOG_TARGET, + "inserting keys progress = {:.0}% [{} / {}]", + (processed as f32 / keys.len() as f32) * 100f32, + processed, + keys.len(), + ); }, Message::BatchFailed(error) => { log::error!(target: LOG_TARGET, "Batch processing failed: {:?}", error); @@ -1010,13 +1006,12 @@ where ); info!(target: LOG_TARGET, "injecting a total of {} top keys", top.len()); - for (k, v) in top { - // skip writing the child root data. - if is_default_child_storage_key(k.as_ref()) { - continue - } - inner_ext.insert(k.0, v.0); - } + let top = top + .into_iter() + .filter(|(k, _)| !is_default_child_storage_key(k.as_ref())) + .map(|(k, v)| (k.0, v.0)) + .collect::>(); + inner_ext.batch_insert(top); info!( target: LOG_TARGET, @@ -1052,9 +1047,7 @@ where "extending externalities with {} manually injected key-values", self.hashed_key_values.len() ); - for (k, v) in self.hashed_key_values { - ext.insert(k.0, v.0); - } + ext.batch_insert(self.hashed_key_values.into_iter().map(|(k, v)| (k.0, v.0))); } // exclude manual key values. From 587959e2287360bfe64b84fd983031d0bed9b892 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 27 Apr 2023 18:55:01 +1000 Subject: [PATCH 79/93] collective pallet: sort genesis members and enforce max len constraint (#13988) * insert members in sorted order * improve variable name * enforce genesis members length constraint --- frame/collective/src/lib.rs | 6 ++++++ frame/collective/src/tests.rs | 40 +++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index 0ecf008fee80e..fd89a998ad97e 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -246,6 +246,10 @@ pub mod pallet { self.members.len(), "Members cannot contain duplicate accounts." ); + assert!( + self.members.len() <= T::MaxMembers::get() as usize, + "Members length cannot exceed MaxMembers.", + ); Pallet::::initialize_members(&self.members) } @@ -1107,6 +1111,8 @@ impl, I: 'static> InitializeMembers for Pallet fn initialize_members(members: &[T::AccountId]) { if !members.is_empty() { assert!(>::get().is_empty(), "Members are already initialized!"); + let mut members = members.to_vec(); + members.sort(); >::put(members); } } diff --git a/frame/collective/src/tests.rs b/frame/collective/src/tests.rs index 4775133ffa2f6..1165ebcec2287 100644 --- a/frame/collective/src/tests.rs +++ b/frame/collective/src/tests.rs @@ -86,6 +86,7 @@ mod mock_democracy { } pub type MaxMembers = ConstU32<100>; +type AccountId = u64; parameter_types! { pub const MotionDuration: u64 = 3; @@ -105,7 +106,7 @@ impl frame_system::Config for Test { type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = u64; + type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; type RuntimeEvent = RuntimeEvent; @@ -161,19 +162,26 @@ impl Config for Test { type MaxProposalWeight = MaxProposalWeight; } -pub struct ExtBuilder {} +pub struct ExtBuilder { + collective_members: Vec, +} impl Default for ExtBuilder { fn default() -> Self { - Self {} + Self { collective_members: vec![1, 2, 3] } } } impl ExtBuilder { + fn set_collective_members(mut self, collective_members: Vec) -> Self { + self.collective_members = collective_members; + self + } + pub fn build(self) -> sp_io::TestExternalities { let mut ext: sp_io::TestExternalities = GenesisConfig { collective: pallet_collective::GenesisConfig { - members: vec![1, 2, 3], + members: self.collective_members, phantom: Default::default(), }, collective_majority: pallet_collective::GenesisConfig { @@ -219,6 +227,17 @@ fn motions_basic_environment_works() { }); } +#[test] +fn initialize_members_sorts_members() { + let unsorted_members = vec![3, 2, 4, 1]; + let expected_members = vec![1, 2, 3, 4]; + ExtBuilder::default() + .set_collective_members(unsorted_members) + .build_and_execute(|| { + assert_eq!(Collective::members(), expected_members); + }); +} + #[test] fn proposal_weight_limit_works() { ExtBuilder::default().build_and_execute(|| { @@ -1424,6 +1443,19 @@ fn disapprove_proposal_works() { }) } +#[should_panic(expected = "Members length cannot exceed MaxMembers.")] +#[test] +fn genesis_build_panics_with_too_many_members() { + let max_members: u32 = MaxMembers::get(); + let too_many_members = (1..=max_members as u64 + 1).collect::>(); + pallet_collective::GenesisConfig:: { + members: too_many_members, + phantom: Default::default(), + } + .build_storage() + .unwrap(); +} + #[test] #[should_panic(expected = "Members cannot contain duplicate accounts.")] fn genesis_build_panics_with_duplicate_members() { From 1e4c01125c326e2cef0c3318b70eea5093b744bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 27 Apr 2023 11:28:03 +0200 Subject: [PATCH 80/93] sc-network-sync: Improve error reporting (#14025) Before this wasn't printing a warning for `VerificationFailed` when there wasn't a peer assigned to the error message. However, if there happens an error on importing the state there wouldn't be any error. This pr improves the situation to also print an error in this case. Besides that there are some other cleanups. --- client/network/sync/src/lib.rs | 43 +++++++++++++++------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/client/network/sync/src/lib.rs b/client/network/sync/src/lib.rs index 29c4bc840b2ae..3f1cbebd57255 100644 --- a/client/network/sync/src/lib.rs +++ b/client/network/sync/src/lib.rs @@ -2708,9 +2708,7 @@ where break } - if result.is_err() { - has_error = true; - } + has_error |= result.is_err(); match result { Ok(BlockImportStatus::ImportedKnown(number, who)) => @@ -2721,9 +2719,7 @@ where if aux.clear_justification_requests { trace!( target: "sync", - "Block imported clears all pending justification requests {}: {:?}", - number, - hash, + "Block imported clears all pending justification requests {number}: {hash:?}", ); self.clear_justification_requests(); } @@ -2731,9 +2727,7 @@ where if aux.needs_justification { trace!( target: "sync", - "Block imported but requires justification {}: {:?}", - number, - hash, + "Block imported but requires justification {number}: {hash:?}", ); self.request_justification(&hash, number); } @@ -2793,25 +2787,26 @@ where output.push(Err(BadPeer(peer, rep::INCOMPLETE_HEADER))); output.extend(self.restart()); }, - Err(BlockImportError::VerificationFailed(who, e)) => + Err(BlockImportError::VerificationFailed(who, e)) => { + let extra_message = + who.map_or_else(|| "".into(), |peer| format!(" received from ({peer})")); + + warn!( + target: "sync", + "💔 Verification failed for block {hash:?}{extra_message}: {e:?}", + ); + if let Some(peer) = who { - warn!( - target: "sync", - "💔 Verification failed for block {:?} received from peer: {}, {:?}", - hash, - peer, - e, - ); output.push(Err(BadPeer(peer, rep::VERIFICATION_FAIL))); - output.extend(self.restart()); - }, + } + + output.extend(self.restart()); + }, Err(BlockImportError::BadBlock(who)) => if let Some(peer) = who { warn!( target: "sync", - "💔 Block {:?} received from peer {} has been blacklisted", - hash, - peer, + "💔 Block {hash:?} received from peer {peer} has been blacklisted", ); output.push(Err(BadPeer(peer, rep::BAD_BLOCK))); }, @@ -2819,10 +2814,10 @@ where // This may happen if the chain we were requesting upon has been discarded // in the meantime because other chain has been finalized. // Don't mark it as bad as it still may be synced if explicitly requested. - trace!(target: "sync", "Obsolete block {:?}", hash); + trace!(target: "sync", "Obsolete block {hash:?}"); }, e @ Err(BlockImportError::UnknownParent) | e @ Err(BlockImportError::Other(_)) => { - warn!(target: "sync", "💔 Error importing block {:?}: {}", hash, e.unwrap_err()); + warn!(target: "sync", "💔 Error importing block {hash:?}: {}", e.unwrap_err()); self.state_sync = None; self.warp_sync = None; output.extend(self.restart()); From d5d63e9b7f624de321032a033675387a73a66646 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Thu, 27 Apr 2023 12:01:12 +0200 Subject: [PATCH 81/93] contracts Fix store-call test path (#14028) --- frame/contracts/src/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index dbe61cf33da56..697b58f15c609 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -3585,7 +3585,7 @@ fn storage_deposit_works() { #[test] fn storage_deposit_callee_works() { let (wasm_caller, _code_hash_caller) = compile_module::("call").unwrap(); - let (wasm_callee, _code_hash_callee) = compile_module::("store").unwrap(); + let (wasm_callee, _code_hash_callee) = compile_module::("store_call").unwrap(); const ED: u64 = 200; ExtBuilder::default().existential_deposit(ED).build().execute_with(|| { let _ = Balances::deposit_creating(&ALICE, 1_000_000); From 04248e293e5156a5468ed162a8565f192de325d7 Mon Sep 17 00:00:00 2001 From: yjh Date: Thu, 27 Apr 2023 18:34:15 +0800 Subject: [PATCH 82/93] chore(cli): make cli display docs correctly (#14017) * chore(cli): make cli display docs correctly * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: command-bot <> --- client/cli/src/commands/build_spec_cmd.rs | 1 - client/cli/src/commands/check_block_cmd.rs | 3 +- client/cli/src/commands/export_blocks_cmd.rs | 2 -- client/cli/src/commands/generate_node_key.rs | 2 -- client/cli/src/commands/import_blocks_cmd.rs | 1 - client/cli/src/commands/insert_key.rs | 2 +- client/cli/src/commands/inspect_key.rs | 5 --- client/cli/src/commands/inspect_node_key.rs | 2 -- client/cli/src/commands/run_cmd.rs | 11 ------- client/cli/src/params/import_params.rs | 7 ---- client/cli/src/params/network_params.rs | 6 ---- client/cli/src/params/node_key_params.rs | 12 ------- .../cli/src/params/offchain_worker_params.rs | 5 +-- client/cli/src/params/prometheus_params.rs | 2 -- client/cli/src/params/pruning_params.rs | 32 +++---------------- client/cli/src/params/shared_params.rs | 7 ---- client/cli/src/params/telemetry_params.rs | 2 -- 17 files changed, 8 insertions(+), 94 deletions(-) diff --git a/client/cli/src/commands/build_spec_cmd.rs b/client/cli/src/commands/build_spec_cmd.rs index a2cbfedb764fc..aa5314f9cf5a4 100644 --- a/client/cli/src/commands/build_spec_cmd.rs +++ b/client/cli/src/commands/build_spec_cmd.rs @@ -38,7 +38,6 @@ pub struct BuildSpecCmd { pub raw: bool, /// Disable adding the default bootnode to the specification. - /// /// By default the `/ip4/127.0.0.1/tcp/30333/p2p/NODE_PEER_ID` bootnode is added to the /// specification when no bootnode exists. #[arg(long)] diff --git a/client/cli/src/commands/check_block_cmd.rs b/client/cli/src/commands/check_block_cmd.rs index 897b61c8e0386..ba20376d998a9 100644 --- a/client/cli/src/commands/check_block_cmd.rs +++ b/client/cli/src/commands/check_block_cmd.rs @@ -29,12 +29,11 @@ use std::{fmt::Debug, str::FromStr, sync::Arc}; /// The `check-block` command used to validate blocks. #[derive(Debug, Clone, Parser)] pub struct CheckBlockCmd { - /// Block hash or number + /// Block hash or number. #[arg(value_name = "HASH or NUMBER")] pub input: BlockNumberOrHash, /// The default number of 64KB pages to ever allocate for Wasm execution. - /// /// Don't alter this unless you know what you're doing. #[arg(long, value_name = "COUNT")] pub default_heap_pages: Option, diff --git a/client/cli/src/commands/export_blocks_cmd.rs b/client/cli/src/commands/export_blocks_cmd.rs index 7e8a295f99618..120d7889878e5 100644 --- a/client/cli/src/commands/export_blocks_cmd.rs +++ b/client/cli/src/commands/export_blocks_cmd.rs @@ -36,13 +36,11 @@ pub struct ExportBlocksCmd { pub output: Option, /// Specify starting block number. - /// /// Default is 1. #[arg(long, value_name = "BLOCK")] pub from: Option, /// Specify last block number. - /// /// Default is best block. #[arg(long, value_name = "BLOCK")] pub to: Option, diff --git a/client/cli/src/commands/generate_node_key.rs b/client/cli/src/commands/generate_node_key.rs index 2288cd4037773..a16ba499082c5 100644 --- a/client/cli/src/commands/generate_node_key.rs +++ b/client/cli/src/commands/generate_node_key.rs @@ -35,13 +35,11 @@ use std::{ )] pub struct GenerateNodeKeyCmd { /// Name of file to save secret key to. - /// /// If not given, the secret key is printed to stdout. #[arg(long)] file: Option, /// The output is in raw binary format. - /// /// If not given, the output is written as an hex encoded string. #[arg(long)] bin: bool, diff --git a/client/cli/src/commands/import_blocks_cmd.rs b/client/cli/src/commands/import_blocks_cmd.rs index f76c72924ddb6..815c6ab18aa6c 100644 --- a/client/cli/src/commands/import_blocks_cmd.rs +++ b/client/cli/src/commands/import_blocks_cmd.rs @@ -41,7 +41,6 @@ pub struct ImportBlocksCmd { pub input: Option, /// The default number of 64KB pages to ever allocate for Wasm execution. - /// /// Don't alter this unless you know what you're doing. #[arg(long, value_name = "COUNT")] pub default_heap_pages: Option, diff --git a/client/cli/src/commands/insert_key.rs b/client/cli/src/commands/insert_key.rs index e80058d44a5af..fa9d125d33108 100644 --- a/client/cli/src/commands/insert_key.rs +++ b/client/cli/src/commands/insert_key.rs @@ -36,7 +36,7 @@ pub struct InsertKeyCmd { #[arg(long)] suri: Option, - /// Key type, examples: "gran", or "imon" + /// Key type, examples: "gran", or "imon". #[arg(long)] key_type: String, diff --git a/client/cli/src/commands/inspect_key.rs b/client/cli/src/commands/inspect_key.rs index de82fe71e2445..5aa8b0bdcaa60 100644 --- a/client/cli/src/commands/inspect_key.rs +++ b/client/cli/src/commands/inspect_key.rs @@ -34,12 +34,9 @@ use std::str::FromStr; pub struct InspectKeyCmd { /// A Key URI to be inspected. May be a secret seed, secret URI /// (with derivation paths and password), SS58, public URI or a hex encoded public key. - /// /// If it is a hex encoded public key, `--public` needs to be given as argument. - /// /// If the given value is a file, the file content will be used /// as URI. - /// /// If omitted, you will be prompted for the URI. uri: Option, @@ -64,12 +61,10 @@ pub struct InspectKeyCmd { pub crypto_scheme: CryptoSchemeFlag, /// Expect that `--uri` has the given public key/account-id. - /// /// If `--uri` has any derivations, the public key is checked against the base `uri`, i.e. the /// `uri` without any derivation applied. However, if `uri` has a password or there is one /// given by `--password`, it will be used to decrypt `uri` before comparing the public /// key/account-id. - /// /// If there is no derivation in `--uri`, the public key will be checked against the public key /// of `--uri` directly. #[arg(long, conflicts_with = "public")] diff --git a/client/cli/src/commands/inspect_node_key.rs b/client/cli/src/commands/inspect_node_key.rs index 2370f4a0989ba..733a1343a4333 100644 --- a/client/cli/src/commands/inspect_node_key.rs +++ b/client/cli/src/commands/inspect_node_key.rs @@ -34,13 +34,11 @@ use std::{ )] pub struct InspectNodeKeyCmd { /// Name of file to read the secret key from. - /// /// If not given, the secret key is read from stdin (up to EOF). #[arg(long)] file: Option, /// The input is in raw binary format. - /// /// If not given, the input is read as an hex encoded string. #[arg(long)] bin: bool, diff --git a/client/cli/src/commands/run_cmd.rs b/client/cli/src/commands/run_cmd.rs index a38ba6f49e3dd..7cc1e6c730cc9 100644 --- a/client/cli/src/commands/run_cmd.rs +++ b/client/cli/src/commands/run_cmd.rs @@ -38,7 +38,6 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; #[derive(Debug, Clone, Parser)] pub struct RunCmd { /// Enable validator mode. - /// /// The node will be started with the authority role and actively /// participate in any consensus task that it can (e.g. depending on /// availability of local keys). @@ -51,7 +50,6 @@ pub struct RunCmd { pub no_grandpa: bool, /// Listen to all RPC interfaces. - /// /// Default is local. Note: not all RPC methods are safe to be exposed publicly. Use an RPC /// proxy server to filter out dangerous methods. More details: /// . @@ -60,13 +58,11 @@ pub struct RunCmd { pub rpc_external: bool, /// Listen to all RPC interfaces. - /// /// Same as `--rpc-external`. #[arg(long)] pub unsafe_rpc_external: bool, /// RPC methods to expose. - /// /// - `unsafe`: Exposes every RPC method. /// - `safe`: Exposes only a safe subset of RPC methods, denying unsafe RPC methods. /// - `auto`: Acts as `safe` if RPC is served externally, e.g. when `--{rpc,ws}-external` is @@ -82,7 +78,6 @@ pub struct RunCmd { pub rpc_methods: RpcMethods, /// Listen to all Websocket interfaces. - /// /// Default is local. Note: not all RPC methods are safe to be exposed publicly. Use an RPC /// proxy server to filter out dangerous methods. More details: /// . @@ -91,7 +86,6 @@ pub struct RunCmd { pub ws_external: bool, /// Listen to all Websocket interfaces. - /// /// Same as `--ws-external` but doesn't warn you about it. #[arg(long)] pub unsafe_ws_external: bool, @@ -137,7 +131,6 @@ pub struct RunCmd { pub ws_max_out_buffer_capacity: Option, /// Specify browser Origins allowed to access the HTTP & WS RPC servers. - /// /// A comma-separated list of origins (protocol://domain or special `null` /// value). Value of `all` will disable origin validation. Default is to /// allow localhost and origins. When running in @@ -146,7 +139,6 @@ pub struct RunCmd { pub rpc_cors: Option, /// The human-readable name for this node. - /// /// It's used as network node name. #[arg(long, value_name = "NAME")] pub name: Option, @@ -225,13 +217,10 @@ pub struct RunCmd { pub force_authoring: bool, /// Run a temporary node. - /// /// A temporary directory will be created to store the configuration and will be deleted /// at the end of the process. - /// /// Note: the directory is random per process execution. This directory is used as base path /// which includes: database, node key and keystore. - /// /// When `--dev` is given and no explicit `--base-path`, this option is implied. #[arg(long, conflicts_with = "base_path")] pub tmp: bool, diff --git a/client/cli/src/params/import_params.rs b/client/cli/src/params/import_params.rs index e36fbb5ffd91c..9e57a017e51ca 100644 --- a/client/cli/src/params/import_params.rs +++ b/client/cli/src/params/import_params.rs @@ -52,15 +52,11 @@ pub struct ImportParams { pub wasm_method: WasmExecutionMethod, /// The WASM instantiation method to use. - /// /// Only has an effect when `wasm-execution` is set to `compiled`. - /// /// The copy-on-write strategies are only supported on Linux. /// If the copy-on-write variant of a strategy is unsupported /// the executor will fall back to the non-CoW equivalent. - /// /// The fastest (and the default) strategy available is `pooling-copy-on-write`. - /// /// The `legacy-instance-reuse` strategy is deprecated and will /// be removed in the future. It should only be used in case of /// issues with the default instantiation strategy. @@ -73,7 +69,6 @@ pub struct ImportParams { pub wasmtime_instantiation_strategy: WasmtimeInstantiationStrategy, /// Specify the path where local WASM runtimes are stored. - /// /// These runtimes will override on-chain runtimes when the version matches. #[arg(long, value_name = "PATH")] pub wasm_runtime_overrides: Option, @@ -83,13 +78,11 @@ pub struct ImportParams { pub execution_strategies: ExecutionStrategiesParams, /// Specify the state cache size. - /// /// Providing `0` will disable the cache. #[arg(long, value_name = "Bytes", default_value_t = 67108864)] pub trie_cache_size: usize, /// DEPRECATED - /// /// Switch to `--trie-cache-size`. #[arg(long)] state_cache_size: Option, diff --git a/client/cli/src/params/network_params.rs b/client/cli/src/params/network_params.rs index 9d61e7204295d..13e4338257691 100644 --- a/client/cli/src/params/network_params.rs +++ b/client/cli/src/params/network_params.rs @@ -42,9 +42,7 @@ pub struct NetworkParams { pub reserved_nodes: Vec, /// Whether to only synchronize the chain with reserved nodes. - /// /// Also disables automatic peer discovery. - /// /// TCP connections might still be established with non-reserved nodes. /// In particular, if you are a validator your node might still connect to other /// validator nodes and collator nodes regardless of whether they are defined as @@ -95,14 +93,12 @@ pub struct NetworkParams { pub in_peers_light: u32, /// Disable mDNS discovery. - /// /// By default, the network will use mDNS to discover other nodes on the /// local network. This disables it. Automatically implied when using --dev. #[arg(long)] pub no_mdns: bool, /// Maximum number of peers from which to ask for the same blocks in parallel. - /// /// This allows downloading announced blocks from multiple peers. Decrease to save /// traffic and risk increased latency. #[arg(long, value_name = "COUNT", default_value_t = 5)] @@ -113,7 +109,6 @@ pub struct NetworkParams { pub node_key_params: NodeKeyParams, /// Enable peer discovery on local networks. - /// /// By default this option is `true` for `--dev` or when the chain type is /// `Local`/`Development` and false otherwise. #[arg(long)] @@ -121,7 +116,6 @@ pub struct NetworkParams { /// Require iterative Kademlia DHT queries to use disjoint paths for increased resiliency in /// the presence of potentially adversarial nodes. - /// /// See the S/Kademlia paper for more information on the high level design as well as its /// security improvements. #[arg(long)] diff --git a/client/cli/src/params/node_key_params.rs b/client/cli/src/params/node_key_params.rs index 074b95bea0f3a..e31963d2f8b9d 100644 --- a/client/cli/src/params/node_key_params.rs +++ b/client/cli/src/params/node_key_params.rs @@ -33,16 +33,12 @@ const NODE_KEY_ED25519_FILE: &str = "secret_ed25519"; #[derive(Debug, Clone, Args)] pub struct NodeKeyParams { /// The secret key to use for libp2p networking. - /// /// The value is a string that is parsed according to the choice of /// `--node-key-type` as follows: - /// /// `ed25519`: /// The value is parsed as a hex-encoded Ed25519 32 byte secret key, /// i.e. 64 hex characters. - /// /// The value of this option takes precedence over `--node-key-file`. - /// /// WARNING: Secrets provided as command-line arguments are easily exposed. /// Use of this option should be limited to development and testing. To use /// an externally managed secret key, use `--node-key-file` instead. @@ -50,33 +46,25 @@ pub struct NodeKeyParams { pub node_key: Option, /// The type of secret key to use for libp2p networking. - /// /// The secret key of the node is obtained as follows: - /// /// * If the `--node-key` option is given, the value is parsed as a secret key according to /// the type. See the documentation for `--node-key`. - /// /// * If the `--node-key-file` option is given, the secret key is read from the specified /// file. See the documentation for `--node-key-file`. - /// /// * Otherwise, the secret key is read from a file with a predetermined, type-specific name /// from the chain-specific network config directory inside the base directory specified by /// `--base-dir`. If this file does not exist, it is created with a newly generated secret /// key of the chosen type. - /// /// The node's secret key determines the corresponding public key and hence the /// node's peer ID in the context of libp2p. #[arg(long, value_name = "TYPE", value_enum, ignore_case = true, default_value_t = NodeKeyType::Ed25519)] pub node_key_type: NodeKeyType, /// The file from which to read the node's secret key to use for libp2p networking. - /// /// The contents of the file are parsed according to the choice of `--node-key-type` /// as follows: - /// /// `ed25519`: /// The file must contain an unencoded 32 byte or hex encoded Ed25519 secret key. - /// /// If the file does not exist, it is created with a newly generated secret key of /// the chosen type. #[arg(long, value_name = "FILE")] diff --git a/client/cli/src/params/offchain_worker_params.rs b/client/cli/src/params/offchain_worker_params.rs index 33fd8d609b605..d1fedab4cb2eb 100644 --- a/client/cli/src/params/offchain_worker_params.rs +++ b/client/cli/src/params/offchain_worker_params.rs @@ -33,7 +33,6 @@ use crate::{error, OffchainWorkerEnabled}; #[derive(Debug, Clone, Args)] pub struct OffchainWorkerParams { /// Should execute offchain workers on every block. - /// /// By default it's only enabled for nodes that are authoring new blocks. #[arg( long = "offchain-worker", @@ -45,9 +44,7 @@ pub struct OffchainWorkerParams { pub enabled: OffchainWorkerEnabled, /// Enable Offchain Indexing API, which allows block import to write to Offchain DB. - /// - /// Enables a runtime to write directly to a offchain workers - /// DB during block import. + /// Enables a runtime to write directly to a offchain workers DB during block import. #[arg(long = "enable-offchain-indexing", value_name = "ENABLE_OFFCHAIN_INDEXING", default_value_t = false, action = ArgAction::Set)] pub indexing_enabled: bool, } diff --git a/client/cli/src/params/prometheus_params.rs b/client/cli/src/params/prometheus_params.rs index 69199ad5b2603..4d234ea33c20d 100644 --- a/client/cli/src/params/prometheus_params.rs +++ b/client/cli/src/params/prometheus_params.rs @@ -27,12 +27,10 @@ pub struct PrometheusParams { #[arg(long, value_name = "PORT")] pub prometheus_port: Option, /// Expose Prometheus exporter on all interfaces. - /// /// Default is local. #[arg(long)] pub prometheus_external: bool, /// Do not expose a Prometheus exporter endpoint. - /// /// Prometheus metric endpoint is enabled by default. #[arg(long)] pub no_prometheus: bool, diff --git a/client/cli/src/params/pruning_params.rs b/client/cli/src/params/pruning_params.rs index 757da2dd9cbb5..1b5bf247d942e 100644 --- a/client/cli/src/params/pruning_params.rs +++ b/client/cli/src/params/pruning_params.rs @@ -24,48 +24,26 @@ use sc_service::{BlocksPruning, PruningMode}; #[derive(Debug, Clone, Args)] pub struct PruningParams { /// Specify the state pruning mode. - /// /// This mode specifies when the block's state (ie, storage) /// should be pruned (ie, removed) from the database. - /// /// This setting can only be set on the first creation of the database. Every subsequent run /// will load the pruning mode from the database and will error if the stored mode doesn't /// match this CLI value. It is fine to drop this CLI flag for subsequent runs. - /// /// Possible values: - /// - /// - archive: - /// - /// Keep the state of all blocks. - /// - /// - 'archive-canonical' - /// - /// Keep only the state of finalized blocks. - /// - /// - number - /// - /// Keep the state of the last number of finalized blocks. - /// + /// - archive: Keep the state of all blocks. + /// - 'archive-canonical' Keep only the state of finalized blocks. + /// - number Keep the state of the last number of finalized blocks. /// [default: 256] #[arg(alias = "pruning", long, value_name = "PRUNING_MODE")] pub state_pruning: Option, /// Specify the blocks pruning mode. - /// /// This mode specifies when the block's body (including justifications) /// should be pruned (ie, removed) from the database. - /// /// Possible values: - /// - 'archive' - /// - /// Keep all blocks. - /// - /// - 'archive-canonical' - /// - /// Keep only finalized blocks. - /// + /// - 'archive' Keep all blocks. + /// - 'archive-canonical' Keep only finalized blocks. /// - number - /// /// Keep the last `number` of finalized blocks. #[arg( alias = "keep-blocks", diff --git a/client/cli/src/params/shared_params.rs b/client/cli/src/params/shared_params.rs index 913a6c436185c..3d20ca504a691 100644 --- a/client/cli/src/params/shared_params.rs +++ b/client/cli/src/params/shared_params.rs @@ -25,14 +25,12 @@ use std::path::PathBuf; #[derive(Debug, Clone, Args)] pub struct SharedParams { /// Specify the chain specification. - /// /// It can be one of the predefined ones (dev, local, or staging) or it can be a path to a file /// with the chainspec (such as one exported by the `build-spec` subcommand). #[arg(long, value_name = "CHAIN_SPEC")] pub chain: Option, /// Specify the development chain. - /// /// This flag sets `--chain=dev`, `--force-authoring`, `--rpc-cors=all`, /// `--alice`, and `--tmp` flags, unless explicitly overridden. #[arg(long, conflicts_with_all = &["chain"])] @@ -43,16 +41,13 @@ pub struct SharedParams { pub base_path: Option, /// Sets a custom logging filter. Syntax is `=`, e.g. -lsync=debug. - /// /// Log levels (least to most verbose) are error, warn, info, debug, and trace. /// By default, all targets log `info`. The global log level can be set with `-l`. #[arg(short = 'l', long, value_name = "LOG_PATTERN", num_args = 1..)] pub log: Vec, /// Enable detailed log output. - /// /// This includes displaying the log target, log level and thread name. - /// /// This is automatically enabled when something is logged with any higher level than `info`. #[arg(long)] pub detailed_log_output: bool, @@ -62,10 +57,8 @@ pub struct SharedParams { pub disable_log_color: bool, /// Enable feature to dynamically update and reload the log filter. - /// /// Be aware that enabling this feature can lead to a performance decrease up to factor six or /// more. Depending on the global logging level the performance decrease changes. - /// /// The `system_addLogFilter` and `system_resetLogFilter` RPCs will have no effect with this /// option not being set. #[arg(long)] diff --git a/client/cli/src/params/telemetry_params.rs b/client/cli/src/params/telemetry_params.rs index ca096419869af..67f441071410c 100644 --- a/client/cli/src/params/telemetry_params.rs +++ b/client/cli/src/params/telemetry_params.rs @@ -22,13 +22,11 @@ use clap::Args; #[derive(Debug, Clone, Args)] pub struct TelemetryParams { /// Disable connecting to the Substrate telemetry server. - /// /// Telemetry is on by default on global chains. #[arg(long)] pub no_telemetry: bool, /// The URL of the telemetry server to connect to. - /// /// This flag can be passed multiple times as a means to specify multiple /// telemetry endpoints. Verbosity levels range from 0-9, with 0 denoting /// the least verbosity. From 58be496f61f98b8e04fbf11a46e56bb9c2b3d9c7 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Thu, 27 Apr 2023 13:27:12 +0200 Subject: [PATCH 83/93] improve staking interface methods (#14023) * improve staking interface methods * fix * fix * fix build * restart * fix --------- Co-authored-by: parity-processbot <> --- Cargo.lock | 1 + .../nomination-pools/benchmarking/src/lib.rs | 4 +- frame/nomination-pools/src/mock.rs | 12 +++++- frame/staking/src/lib.rs | 13 +------ frame/staking/src/pallet/impls.rs | 30 ++++++++++++++- frame/staking/src/tests.rs | 23 +++++++++++ primitives/staking/Cargo.toml | 2 + primitives/staking/src/lib.rs | 38 ++++++++++++++++--- 8 files changed, 99 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d8d2d59a3c88..c06bf41c24b4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10862,6 +10862,7 @@ version = "4.0.0-dev" dependencies = [ "parity-scale-codec", "scale-info", + "serde", "sp-core", "sp-runtime", "sp-std", diff --git a/frame/nomination-pools/benchmarking/src/lib.rs b/frame/nomination-pools/benchmarking/src/lib.rs index d58bbaf3d117c..137b9e9af63e3 100644 --- a/frame/nomination-pools/benchmarking/src/lib.rs +++ b/frame/nomination-pools/benchmarking/src/lib.rs @@ -684,12 +684,12 @@ frame_benchmarking::benchmarks! { .collect(); assert_ok!(T::Staking::nominate(&pool_account, validators)); - assert!(T::Staking::nominations(Pools::::create_bonded_account(1)).is_some()); + assert!(T::Staking::nominations(&Pools::::create_bonded_account(1)).is_some()); whitelist_account!(depositor); }:_(RuntimeOrigin::Signed(depositor.clone()), 1) verify { - assert!(T::Staking::nominations(Pools::::create_bonded_account(1)).is_none()); + assert!(T::Staking::nominations(&Pools::::create_bonded_account(1)).is_none()); } set_commission { diff --git a/frame/nomination-pools/src/mock.rs b/frame/nomination-pools/src/mock.rs index 3565ff14e6c82..3ab9be516fdb9 100644 --- a/frame/nomination-pools/src/mock.rs +++ b/frame/nomination-pools/src/mock.rs @@ -67,6 +67,14 @@ impl sp_staking::StakingInterface for StakingMock { BondingDuration::get() } + fn status( + _: &Self::AccountId, + ) -> Result, DispatchError> { + Nominations::get() + .map(|noms| sp_staking::StakerStatus::Nominator(noms)) + .ok_or(DispatchError::Other("NotStash")) + } + fn bond_extra(who: &Self::AccountId, extra: Self::Balance) -> DispatchResult { let mut x = BondedBalanceMap::get(); x.get_mut(who).map(|v| *v += extra); @@ -108,7 +116,7 @@ impl sp_staking::StakingInterface for StakingMock { } #[cfg(feature = "runtime-benchmarks")] - fn nominations(_: Self::AccountId) -> Option> { + fn nominations(_: &Self::AccountId) -> Option> { Nominations::get() } @@ -116,7 +124,7 @@ impl sp_staking::StakingInterface for StakingMock { unimplemented!("method currently not used in testing") } - fn stake(who: &Self::AccountId) -> Result, DispatchError> { + fn stake(who: &Self::AccountId) -> Result, DispatchError> { match ( UnbondingBalanceMap::get().get(who).copied(), BondedBalanceMap::get().get(who).copied(), diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index d6345c2161f73..28d970b9121e7 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -311,6 +311,7 @@ use sp_runtime::{ traits::{AtLeast32BitUnsigned, Convert, Saturating, StaticLookup, Zero}, Perbill, Perquintill, Rounding, RuntimeDebug, }; +pub use sp_staking::StakerStatus; use sp_staking::{ offence::{Offence, OffenceError, ReportOffence}, EraIndex, SessionIndex, @@ -381,18 +382,6 @@ impl Default for EraRewardPoints { } } -/// Indicates the initial status of the staker. -#[derive(RuntimeDebug, TypeInfo)] -#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize, Clone))] -pub enum StakerStatus { - /// Chilling. - Idle, - /// Declared desire in validating or already participating in it. - Validator, - /// Nominating for a group of other stakers. - Nominator(Vec), -} - /// A destination account for payment. #[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)] pub enum RewardDestination { diff --git a/frame/staking/src/pallet/impls.rs b/frame/staking/src/pallet/impls.rs index 3058d3edc6fd6..984871f7f9813 100644 --- a/frame/staking/src/pallet/impls.rs +++ b/frame/staking/src/pallet/impls.rs @@ -22,6 +22,7 @@ use frame_election_provider_support::{ SortedListProvider, VoteWeight, VoterOf, }; use frame_support::{ + defensive, dispatch::WithPostDispatchInfo, pallet_prelude::*, traits::{ @@ -1608,7 +1609,7 @@ impl StakingInterface for Pallet { Self::current_era().unwrap_or(Zero::zero()) } - fn stake(who: &Self::AccountId) -> Result, DispatchError> { + fn stake(who: &Self::AccountId) -> Result>, DispatchError> { Self::bonded(who) .and_then(|c| Self::ledger(c)) .map(|l| Stake { total: l.total, active: l.active }) @@ -1662,8 +1663,33 @@ impl StakingInterface for Pallet { Self::nominate(RawOrigin::Signed(ctrl).into(), targets) } + fn status( + who: &Self::AccountId, + ) -> Result, DispatchError> { + let is_bonded = Self::bonded(who).is_some(); + if !is_bonded { + return Err(Error::::NotStash.into()) + } + + let is_validator = Validators::::contains_key(&who); + let is_nominator = Nominators::::get(&who); + + use sp_staking::StakerStatus; + match (is_validator, is_nominator.is_some()) { + (false, false) => Ok(StakerStatus::Idle), + (true, false) => Ok(StakerStatus::Validator), + (false, true) => Ok(StakerStatus::Nominator( + is_nominator.expect("is checked above; qed").targets.into_inner(), + )), + (true, true) => { + defensive!("cannot be both validators and nominator"); + Err(Error::::BadState.into()) + }, + } + } + sp_staking::runtime_benchmarks_enabled! { - fn nominations(who: Self::AccountId) -> Option> { + fn nominations(who: &Self::AccountId) -> Option> { Nominators::::get(who).map(|n| n.targets.into_inner()) } diff --git a/frame/staking/src/tests.rs b/frame/staking/src/tests.rs index d97eb3ef89cab..affee60026500 100644 --- a/frame/staking/src/tests.rs +++ b/frame/staking/src/tests.rs @@ -5824,4 +5824,27 @@ mod staking_interface { )); }); } + + #[test] + fn status() { + ExtBuilder::default().build_and_execute(|| { + // stash of a validator is identified as a validator + assert_eq!(Staking::status(&11).unwrap(), StakerStatus::Validator); + // .. but not the controller. + assert!(Staking::status(&10).is_err()); + + // stash of nominator is identified as a nominator + assert_eq!(Staking::status(&101).unwrap(), StakerStatus::Nominator(vec![11, 21])); + // .. but not the controller. + assert!(Staking::status(&100).is_err()); + + // stash of chilled is identified as a chilled + assert_eq!(Staking::status(&41).unwrap(), StakerStatus::Idle); + // .. but not the controller. + assert!(Staking::status(&40).is_err()); + + // random other account. + assert!(Staking::status(&42).is_err()); + }) + } } diff --git a/primitives/staking/Cargo.toml b/primitives/staking/Cargo.toml index f92bca2788c41..f383a5e88759f 100644 --- a/primitives/staking/Cargo.toml +++ b/primitives/staking/Cargo.toml @@ -13,6 +13,7 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } sp-core = { version = "7.0.0", default-features = false, path = "../core" } @@ -22,6 +23,7 @@ sp-std = { version = "5.0.0", default-features = false, path = "../std" } [features] default = ["std"] std = [ + "serde", "codec/std", "scale-info/std", "sp-core/std", diff --git a/primitives/staking/src/lib.rs b/primitives/staking/src/lib.rs index f328696551eed..57128bd327d9e 100644 --- a/primitives/staking/src/lib.rs +++ b/primitives/staking/src/lib.rs @@ -20,6 +20,8 @@ //! A crate which contains primitives that are useful for implementation that uses staking //! approaches in general. Definitions related to sessions, slashing, etc go here. +use scale_info::TypeInfo; +use sp_core::RuntimeDebug; use sp_runtime::{DispatchError, DispatchResult}; use sp_std::{collections::btree_map::BTreeMap, vec::Vec}; @@ -31,6 +33,18 @@ pub type SessionIndex = u32; /// Counter for the number of eras that have passed. pub type EraIndex = u32; +/// Representation of the status of a staker. +#[derive(RuntimeDebug, TypeInfo)] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone))] +pub enum StakerStatus { + /// Chilling. + Idle, + /// Declaring desire in validate, i.e author blocks. + Validator, + /// Declaring desire to nominate, delegate, or generally approve of the given set of others. + Nominator(Vec), +} + /// Trait describing something that implements a hook for any operations to perform when a staker is /// slashed. pub trait OnStakerSlash { @@ -57,7 +71,7 @@ impl OnStakerSlash for () { /// A struct that reflects stake that an account has in the staking system. Provides a set of /// methods to operate on it's properties. Aimed at making `StakingInterface` more concise. -pub struct Stake { +pub struct Stake { /// The total stake that `stash` has in the staking system. This includes the /// `active` stake, and any funds currently in the process of unbonding via /// [`StakingInterface::unbond`]. @@ -67,10 +81,10 @@ pub struct Stake { /// This is only guaranteed to reflect the amount locked by the staking system. If there are /// non-staking locks on the bonded pair's balance this amount is going to be larger in /// reality. - pub total: T::Balance, + pub total: Balance, /// The total amount of the stash's balance that will be at stake in any forthcoming /// rounds. - pub active: T::Balance, + pub active: Balance, } /// A generic representation of a staking implementation. @@ -109,21 +123,25 @@ pub trait StakingInterface { /// This should be the latest planned era that the staking system knows about. fn current_era() -> EraIndex; - /// Returns the stake of `who`. - fn stake(who: &Self::AccountId) -> Result, DispatchError>; + /// Returns the [`Stake`] of `who`. + fn stake(who: &Self::AccountId) -> Result, DispatchError>; + /// Total stake of a staker, `Err` if not a staker. fn total_stake(who: &Self::AccountId) -> Result { Self::stake(who).map(|s| s.total) } + /// Total active portion of a staker's [`Stake`], `Err` if not a staker. fn active_stake(who: &Self::AccountId) -> Result { Self::stake(who).map(|s| s.active) } + /// Returns whether a staker is unbonding, `Err` if not a staker at all. fn is_unbonding(who: &Self::AccountId) -> Result { Self::stake(who).map(|s| s.active != s.total) } + /// Returns whether a staker is FULLY unbonding, `Err` if not a staker at all. fn fully_unbond(who: &Self::AccountId) -> DispatchResult { Self::unbond(who, Self::stake(who)?.active) } @@ -174,9 +192,17 @@ pub trait StakingInterface { /// Checks whether an account `staker` has been exposed in an era. fn is_exposed_in_era(who: &Self::AccountId, era: &EraIndex) -> bool; + /// Return the status of the given staker, `None` if not staked at all. + fn status(who: &Self::AccountId) -> Result, DispatchError>; + /// Get the nominations of a stash, if they are a nominator, `None` otherwise. #[cfg(feature = "runtime-benchmarks")] - fn nominations(who: Self::AccountId) -> Option>; + fn nominations(who: &Self::AccountId) -> Option> { + match Self::status(who) { + Ok(StakerStatus::Nominator(t)) => Some(t), + _ => None, + } + } #[cfg(feature = "runtime-benchmarks")] fn add_era_stakers( From 5d1b74c29b51d5e18e525347c3ee57e86a20140a Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 28 Apr 2023 00:03:47 +1000 Subject: [PATCH 84/93] try-runtime-cli: improve ci stability (#14030) * hardcode 1 thread * ci stability * fix comment * improve comment * kick ci * kick ci * update expect message * improve comment * kick ci * kick ci * configure threads with env var * fix threads env var * fix threads env var --- utils/frame/remote-externalities/src/lib.rs | 31 ++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/utils/frame/remote-externalities/src/lib.rs b/utils/frame/remote-externalities/src/lib.rs index ea9b68ce2f6ae..283d2c280b15e 100644 --- a/utils/frame/remote-externalities/src/lib.rs +++ b/utils/frame/remote-externalities/src/lib.rs @@ -40,7 +40,7 @@ use sp_core::{ pub use sp_io::TestExternalities; use sp_runtime::{traits::Block as BlockT, StateVersion}; use std::{ - cmp::max, + cmp::{max, min}, fs, num::NonZeroUsize, ops::{Deref, DerefMut}, @@ -157,10 +157,14 @@ impl Transport { } else { uri.clone() }; - let http_client = HttpClientBuilder::default().build(uri).map_err(|e| { - log::error!(target: LOG_TARGET, "error: {:?}", e); - "failed to build http client" - })?; + let http_client = HttpClientBuilder::default() + .max_request_body_size(u32::MAX) + .request_timeout(std::time::Duration::from_secs(60 * 5)) + .build(uri) + .map_err(|e| { + log::error!(target: LOG_TARGET, "error: {:?}", e); + "failed to build http client" + })?; *self = Self::RemoteClient(Arc::new(http_client)) } @@ -323,6 +327,7 @@ where B::Hash: DeserializeOwned, B::Header: DeserializeOwned, { + const DEFAULT_PARALLELISM: usize = 4; const BATCH_SIZE_INCREASE_FACTOR: f32 = 1.10; const BATCH_SIZE_DECREASE_FACTOR: f32 = 0.50; const INITIAL_BATCH_SIZE: usize = 5000; @@ -330,9 +335,21 @@ where const DEFAULT_KEY_DOWNLOAD_PAGE: u32 = 1000; /// Get the number of threads to use. + /// Cap the number of threads. Performance improvement beyond a small number of threads is + /// negligible, and too many threads can create issues with the HttpClient. fn threads() -> NonZeroUsize { - thread::available_parallelism() - .unwrap_or(NonZeroUsize::new(1usize).expect("4 is non-zero; qed")) + let avaliable = thread::available_parallelism() + .unwrap_or(NonZeroUsize::new(1usize).expect("1 is non-zero; qed")) + .get(); + assert!(avaliable > 0, "avaliable parallelism must be greater than 0"); + + let requested: usize = match std::env::var("TRY_RUNTIME_MAX_THREADS") { + Ok(n) => n.parse::().expect("TRY_RUNTIME_MAX_THREADS must be a number"), + Err(_) => Self::DEFAULT_PARALLELISM, + }; + assert!(requested > 0, "TRY_RUNTIME_MAX_THREADS must be greater than 0"); + return NonZeroUsize::new(min(requested, avaliable)) + .expect("requested and avaliable are non-zero; qed") } async fn rpc_get_storage( From f2b668074331d975a9ab06540d01713dc7c67086 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 27 Apr 2023 16:08:08 +0200 Subject: [PATCH 85/93] FRAME: inherited call weight syntax (#13932) * First approach on pallet::call_weight Signed-off-by: Oliver Tale-Yazdi * Use attr on pallet::call instead Signed-off-by: Oliver Tale-Yazdi * Ui tests Signed-off-by: Oliver Tale-Yazdi * Rename to weight(prefix = ...)) Signed-off-by: Oliver Tale-Yazdi * Simplify to #[pallet::call(weight(T))] Signed-off-by: Oliver Tale-Yazdi * Add stray token error Signed-off-by: Oliver Tale-Yazdi * Cleanup Signed-off-by: Oliver Tale-Yazdi * Migrate remaining pallets Using script from https://github.com/ggwpez/substrate-scripts/blob/e1b5ea5b5b4018867f3e869fce6f448b4ba9d71f/frame-code-migration/src/call_weight.rs Signed-off-by: Oliver Tale-Yazdi * Try to add some docs Signed-off-by: Oliver Tale-Yazdi * Revert "Migrate remaining pallets" Lets do this as a follow-up, I dont want to bloat this small MR. This reverts commit 331d4b42d72de1dacaed714d69166fa1bc9c92dd. Signed-off-by: Oliver Tale-Yazdi * Renames Signed-off-by: Oliver Tale-Yazdi * Review fixes Co-authored-by: Sam Johnson Signed-off-by: Oliver Tale-Yazdi * Test weights Signed-off-by: Oliver Tale-Yazdi * Update UI tests Signed-off-by: Oliver Tale-Yazdi * Update frame/support/procedural/src/pallet/parse/mod.rs Co-authored-by: Muharem Ismailov * Remove old code Signed-off-by: Oliver Tale-Yazdi * Update docs Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: parity-processbot <> Co-authored-by: Muharem Ismailov --- frame/alliance/src/lib.rs | 12 +-- frame/alliance/src/tests.rs | 9 ++ frame/assets/src/lib.rs | 25 +----- frame/assets/src/tests.rs | 10 +++ frame/balances/src/lib.rs | 7 +- frame/balances/src/tests/mod.rs | 11 ++- frame/examples/basic/src/lib.rs | 5 +- frame/examples/basic/src/tests.rs | 1 + .../procedural/src/pallet/expand/call.rs | 39 ++++++--- .../procedural/src/pallet/parse/call.rs | 53 ++++++++---- .../procedural/src/pallet/parse/mod.rs | 83 +++++++++++++++++-- .../src/pallet/parse/pallet_struct.rs | 4 +- frame/support/src/lib.rs | 2 +- .../pallet_ui/call_missing_weight.stderr | 6 +- .../call_weight_inherited_invalid.rs | 50 +++++++++++ .../call_weight_inherited_invalid.stderr | 11 +++ .../call_weight_inherited_invalid2.rs | 53 ++++++++++++ .../call_weight_inherited_invalid2.stderr | 11 +++ .../call_weight_inherited_invalid3.rs | 53 ++++++++++++ .../call_weight_inherited_invalid3.stderr | 19 +++++ .../call_weight_inherited_invalid4.rs | 52 ++++++++++++ .../call_weight_inherited_invalid4.stderr | 11 +++ .../call_weight_inherited_invalid5.rs | 44 ++++++++++ .../call_weight_inherited_invalid5.stderr | 11 +++ .../tests/pallet_ui/dev_mode_without_arg.rs | 2 - .../pallet_ui/dev_mode_without_arg.stderr | 14 ++-- .../pallet_ui/pass/inherited_call_weight.rs | 51 ++++++++++++ .../pallet_ui/pass/inherited_call_weight2.rs | 57 +++++++++++++ .../pallet_ui/pass/inherited_call_weight3.rs | 54 ++++++++++++ .../pass/inherited_call_weight_dev_mode.rs | 30 +++++++ 30 files changed, 698 insertions(+), 92 deletions(-) create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid.rs create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid.stderr create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid2.rs create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid2.stderr create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.rs create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid4.rs create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid4.stderr create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid5.rs create mode 100644 frame/support/test/tests/pallet_ui/call_weight_inherited_invalid5.stderr create mode 100644 frame/support/test/tests/pallet_ui/pass/inherited_call_weight.rs create mode 100644 frame/support/test/tests/pallet_ui/pass/inherited_call_weight2.rs create mode 100644 frame/support/test/tests/pallet_ui/pass/inherited_call_weight3.rs create mode 100644 frame/support/test/tests/pallet_ui/pass/inherited_call_weight_dev_mode.rs diff --git a/frame/alliance/src/lib.rs b/frame/alliance/src/lib.rs index d50e20ba00c07..86a64caaf8e75 100644 --- a/frame/alliance/src/lib.rs +++ b/frame/alliance/src/lib.rs @@ -497,7 +497,7 @@ pub mod pallet { pub type UnscrupulousWebsites, I: 'static = ()> = StorageValue<_, BoundedVec, T::MaxUnscrupulousItems>, ValueQuery>; - #[pallet::call] + #[pallet::call(weight(>::WeightInfo))] impl, I: 'static> Pallet { /// Add a new proposal to be voted on. /// @@ -649,7 +649,6 @@ pub mod pallet { /// Set a new IPFS CID to the alliance rule. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::set_rule())] pub fn set_rule(origin: OriginFor, rule: Cid) -> DispatchResult { T::AdminOrigin::ensure_origin(origin)?; @@ -661,7 +660,6 @@ pub mod pallet { /// Make an announcement of a new IPFS CID about alliance issues. #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::announce())] pub fn announce(origin: OriginFor, announcement: Cid) -> DispatchResult { T::AnnouncementOrigin::ensure_origin(origin)?; @@ -677,7 +675,6 @@ pub mod pallet { /// Remove an announcement. #[pallet::call_index(7)] - #[pallet::weight(T::WeightInfo::remove_announcement())] pub fn remove_announcement(origin: OriginFor, announcement: Cid) -> DispatchResult { T::AnnouncementOrigin::ensure_origin(origin)?; @@ -695,7 +692,6 @@ pub mod pallet { /// Submit oneself for candidacy. A fixed deposit is reserved. #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::join_alliance())] pub fn join_alliance(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; @@ -732,7 +728,6 @@ pub mod pallet { /// A Fellow can nominate someone to join the alliance as an Ally. There is no deposit /// required from the nominator or nominee. #[pallet::call_index(9)] - #[pallet::weight(T::WeightInfo::nominate_ally())] pub fn nominate_ally(origin: OriginFor, who: AccountIdLookupOf) -> DispatchResult { let nominator = ensure_signed(origin)?; ensure!(Self::has_voting_rights(&nominator), Error::::NoVotingRights); @@ -757,7 +752,6 @@ pub mod pallet { /// Elevate an Ally to Fellow. #[pallet::call_index(10)] - #[pallet::weight(T::WeightInfo::elevate_ally())] pub fn elevate_ally(origin: OriginFor, ally: AccountIdLookupOf) -> DispatchResult { T::MembershipManager::ensure_origin(origin)?; let ally = T::Lookup::lookup(ally)?; @@ -774,7 +768,6 @@ pub mod pallet { /// As a member, give a retirement notice and start a retirement period required to pass in /// order to retire. #[pallet::call_index(11)] - #[pallet::weight(T::WeightInfo::give_retirement_notice())] pub fn give_retirement_notice(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; let role = Self::member_role_of(&who).ok_or(Error::::NotMember)?; @@ -797,7 +790,6 @@ pub mod pallet { /// This can only be done once you have called `give_retirement_notice` and the /// `RetirementPeriod` has passed. #[pallet::call_index(12)] - #[pallet::weight(T::WeightInfo::retire())] pub fn retire(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; let retirement_period_end = RetiringMembers::::get(&who) @@ -820,7 +812,6 @@ pub mod pallet { /// Kick a member from the Alliance and slash its deposit. #[pallet::call_index(13)] - #[pallet::weight(T::WeightInfo::kick_member())] pub fn kick_member(origin: OriginFor, who: AccountIdLookupOf) -> DispatchResult { T::MembershipManager::ensure_origin(origin)?; let member = T::Lookup::lookup(who)?; @@ -922,7 +913,6 @@ pub mod pallet { /// who do not want to leave the Alliance but do not have the capacity to participate /// operationally for some time. #[pallet::call_index(17)] - #[pallet::weight(T::WeightInfo::abdicate_fellow_status())] pub fn abdicate_fellow_status(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; let role = Self::member_role_of(&who).ok_or(Error::::NotMember)?; diff --git a/frame/alliance/src/tests.rs b/frame/alliance/src/tests.rs index 5942595469d5f..de7cda4710fc7 100644 --- a/frame/alliance/src/tests.rs +++ b/frame/alliance/src/tests.rs @@ -629,3 +629,12 @@ fn remove_unscrupulous_items_works() { assert_eq!(Alliance::unscrupulous_accounts(), Vec::::new()); }); } + +#[test] +fn weights_sane() { + let info = crate::Call::::join_alliance {}.get_dispatch_info(); + assert_eq!(<() as crate::WeightInfo>::join_alliance(), info.weight); + + let info = crate::Call::::nominate_ally { who: 10 }.get_dispatch_info(); + assert_eq!(<() as crate::WeightInfo>::nominate_ally(), info.weight); +} diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index 859a13243d509..d32b407e67f6e 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -568,7 +568,7 @@ pub mod pallet { CallbackFailed, } - #[pallet::call] + #[pallet::call(weight(>::WeightInfo))] impl, I: 'static> Pallet { /// Issue a new class of fungible assets from a public origin. /// @@ -590,7 +590,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::create())] pub fn create( origin: OriginFor, id: T::AssetIdParameter, @@ -654,7 +653,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::force_create())] pub fn force_create( origin: OriginFor, id: T::AssetIdParameter, @@ -680,7 +678,6 @@ pub mod pallet { /// /// The asset class must be frozen before calling `start_destroy`. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::start_destroy())] pub fn start_destroy(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let maybe_check_owner = match T::ForceOrigin::try_origin(origin) { Ok(_) => None, @@ -749,7 +746,6 @@ pub mod pallet { /// /// Each successful call emits the `Event::Destroyed` event. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::finish_destroy())] pub fn finish_destroy(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let _ = ensure_signed(origin)?; let id: T::AssetId = id.into(); @@ -769,7 +765,6 @@ pub mod pallet { /// Weight: `O(1)` /// Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`. #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::mint())] pub fn mint( origin: OriginFor, id: T::AssetIdParameter, @@ -799,7 +794,6 @@ pub mod pallet { /// Weight: `O(1)` /// Modes: Post-existence of `who`; Pre & post Zombie-status of `who`. #[pallet::call_index(7)] - #[pallet::weight(T::WeightInfo::burn())] pub fn burn( origin: OriginFor, id: T::AssetIdParameter, @@ -834,7 +828,6 @@ pub mod pallet { /// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of /// `target`. #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::transfer())] pub fn transfer( origin: OriginFor, id: T::AssetIdParameter, @@ -868,7 +861,6 @@ pub mod pallet { /// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of /// `target`. #[pallet::call_index(9)] - #[pallet::weight(T::WeightInfo::transfer_keep_alive())] pub fn transfer_keep_alive( origin: OriginFor, id: T::AssetIdParameter, @@ -903,7 +895,6 @@ pub mod pallet { /// Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of /// `dest`. #[pallet::call_index(10)] - #[pallet::weight(T::WeightInfo::force_transfer())] pub fn force_transfer( origin: OriginFor, id: T::AssetIdParameter, @@ -931,7 +922,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(11)] - #[pallet::weight(T::WeightInfo::freeze())] pub fn freeze( origin: OriginFor, id: T::AssetIdParameter, @@ -968,7 +958,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(12)] - #[pallet::weight(T::WeightInfo::thaw())] pub fn thaw( origin: OriginFor, id: T::AssetIdParameter, @@ -1004,7 +993,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(13)] - #[pallet::weight(T::WeightInfo::freeze_asset())] pub fn freeze_asset(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let origin = ensure_signed(origin)?; let id: T::AssetId = id.into(); @@ -1031,7 +1019,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(14)] - #[pallet::weight(T::WeightInfo::thaw_asset())] pub fn thaw_asset(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let origin = ensure_signed(origin)?; let id: T::AssetId = id.into(); @@ -1059,7 +1046,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(15)] - #[pallet::weight(T::WeightInfo::transfer_ownership())] pub fn transfer_ownership( origin: OriginFor, id: T::AssetIdParameter, @@ -1103,7 +1089,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(16)] - #[pallet::weight(T::WeightInfo::set_team())] pub fn set_team( origin: OriginFor, id: T::AssetIdParameter, @@ -1173,7 +1158,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(18)] - #[pallet::weight(T::WeightInfo::clear_metadata())] pub fn clear_metadata(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let origin = ensure_signed(origin)?; let id: T::AssetId = id.into(); @@ -1257,7 +1241,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(20)] - #[pallet::weight(T::WeightInfo::force_clear_metadata())] pub fn force_clear_metadata( origin: OriginFor, id: T::AssetIdParameter, @@ -1297,7 +1280,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(21)] - #[pallet::weight(T::WeightInfo::force_asset_status())] pub fn force_asset_status( origin: OriginFor, id: T::AssetIdParameter, @@ -1354,7 +1336,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(22)] - #[pallet::weight(T::WeightInfo::approve_transfer())] pub fn approve_transfer( origin: OriginFor, id: T::AssetIdParameter, @@ -1381,7 +1362,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(23)] - #[pallet::weight(T::WeightInfo::cancel_approval())] pub fn cancel_approval( origin: OriginFor, id: T::AssetIdParameter, @@ -1418,7 +1398,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(24)] - #[pallet::weight(T::WeightInfo::force_cancel_approval())] pub fn force_cancel_approval( origin: OriginFor, id: T::AssetIdParameter, @@ -1468,7 +1447,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(25)] - #[pallet::weight(T::WeightInfo::transfer_approved())] pub fn transfer_approved( origin: OriginFor, id: T::AssetIdParameter, @@ -1531,7 +1509,6 @@ pub mod pallet { /// /// Emits `AssetMinBalanceChanged` event when successful. #[pallet::call_index(28)] - #[pallet::weight(T::WeightInfo::set_min_balance())] pub fn set_min_balance( origin: OriginFor, id: T::AssetIdParameter, diff --git a/frame/assets/src/tests.rs b/frame/assets/src/tests.rs index b47fb6486cb27..88ba92d0685a9 100644 --- a/frame/assets/src/tests.rs +++ b/frame/assets/src/tests.rs @@ -21,6 +21,7 @@ use super::*; use crate::{mock::*, Error}; use frame_support::{ assert_noop, assert_ok, + dispatch::GetDispatchInfo, traits::{fungibles::InspectEnumerable, tokens::Preservation::Protect, Currency}, }; use pallet_balances::Error as BalancesError; @@ -1355,3 +1356,12 @@ fn multiple_transfer_alls_work_ok() { assert_eq!(Balances::free_balance(&1337), 100); }); } + +#[test] +fn weights_sane() { + let info = crate::Call::::create { id: 10, admin: 4, min_balance: 3 }.get_dispatch_info(); + assert_eq!(<() as crate::WeightInfo>::create(), info.weight); + + let info = crate::Call::::finish_destroy { id: 10 }.get_dispatch_info(); + assert_eq!(<() as crate::WeightInfo>::finish_destroy(), info.weight); +} diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index c87b01d77bae5..b3dc77a9b879d 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -526,7 +526,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight(>::WeightInfo))] impl, I: 'static> Pallet { /// Transfer some liquid free balance to another account. /// @@ -536,7 +536,6 @@ pub mod pallet { /// /// The dispatch origin for this call must be `Signed` by the transactor. #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::transfer_allow_death())] pub fn transfer_allow_death( origin: OriginFor, dest: AccountIdLookupOf, @@ -598,7 +597,6 @@ pub mod pallet { /// Exactly as `transfer_allow_death`, except the origin must be root and the source account /// may be specified. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::force_transfer())] pub fn force_transfer( origin: OriginFor, source: AccountIdLookupOf, @@ -619,7 +617,6 @@ pub mod pallet { /// /// [`transfer_allow_death`]: struct.Pallet.html#method.transfer #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::transfer_keep_alive())] pub fn transfer_keep_alive( origin: OriginFor, dest: AccountIdLookupOf, @@ -647,7 +644,6 @@ pub mod pallet { /// transfer everything except at least the existential deposit, which will guarantee to /// keep the sender account alive (true). #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::transfer_all())] pub fn transfer_all( origin: OriginFor, dest: AccountIdLookupOf, @@ -674,7 +670,6 @@ pub mod pallet { /// /// Can only be called by ROOT. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::force_unreserve())] pub fn force_unreserve( origin: OriginFor, who: AccountIdLookupOf, diff --git a/frame/balances/src/tests/mod.rs b/frame/balances/src/tests/mod.rs index 68e7e82035b0e..9b451f36d1d94 100644 --- a/frame/balances/src/tests/mod.rs +++ b/frame/balances/src/tests/mod.rs @@ -23,7 +23,7 @@ use crate::{self as pallet_balances, AccountData, Config, CreditOf, Error, Palle use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ assert_err, assert_noop, assert_ok, assert_storage_noop, - dispatch::DispatchInfo, + dispatch::{DispatchInfo, GetDispatchInfo}, parameter_types, traits::{ tokens::fungible, ConstU32, ConstU64, ConstU8, Imbalance as ImbalanceT, OnUnbalanced, @@ -294,3 +294,12 @@ pub fn events() -> Vec { pub fn info_from_weight(w: Weight) -> DispatchInfo { DispatchInfo { weight: w, ..Default::default() } } + +#[test] +fn weights_sane() { + let info = crate::Call::::transfer_allow_death { dest: 10, value: 4 }.get_dispatch_info(); + assert_eq!(<() as crate::WeightInfo>::transfer_allow_death(), info.weight); + + let info = crate::Call::::force_unreserve { who: 10, amount: 4 }.get_dispatch_info(); + assert_eq!(<() as crate::WeightInfo>::force_unreserve(), info.weight); +} diff --git a/frame/examples/basic/src/lib.rs b/frame/examples/basic/src/lib.rs index 6665c3b78b024..bbeaac19f809c 100644 --- a/frame/examples/basic/src/lib.rs +++ b/frame/examples/basic/src/lib.rs @@ -441,7 +441,7 @@ pub mod pallet { // against them as the first thing you do in your function. There are three convenience calls // in system that do the matching for you and return a convenient result: `ensure_signed`, // `ensure_root` and `ensure_none`. - #[pallet::call] + #[pallet::call(weight(::WeightInfo))] impl Pallet { /// This is your public interface. Be extremely careful. /// This is just a simple example of how to interact with the pallet from the external @@ -497,9 +497,6 @@ pub mod pallet { // The weight for this extrinsic we rely on the auto-generated `WeightInfo` from the // benchmark toolchain. #[pallet::call_index(0)] - #[pallet::weight( - ::WeightInfo::accumulate_dummy() - )] pub fn accumulate_dummy(origin: OriginFor, increase_by: T::Balance) -> DispatchResult { // This is a public call, so we ensure that the origin is some signed account. let _sender = ensure_signed(origin)?; diff --git a/frame/examples/basic/src/tests.rs b/frame/examples/basic/src/tests.rs index d9a8a4e8e1cdc..1d9cf81a5074c 100644 --- a/frame/examples/basic/src/tests.rs +++ b/frame/examples/basic/src/tests.rs @@ -192,6 +192,7 @@ fn weights_work() { // aka. `let info = as GetDispatchInfo>::get_dispatch_info(&default_call);` // TODO: account for proof size weight assert!(info1.weight.ref_time() > 0); + assert_eq!(info1.weight, ::WeightInfo::accumulate_dummy()); // `set_dummy` is simpler than `accumulate_dummy`, and the weight // should be less. diff --git a/frame/support/procedural/src/pallet/expand/call.rs b/frame/support/procedural/src/pallet/expand/call.rs index aa5af9d54882f..f17fdc81a647c 100644 --- a/frame/support/procedural/src/pallet/expand/call.rs +++ b/frame/support/procedural/src/pallet/expand/call.rs @@ -15,8 +15,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::{pallet::Def, COUNTER}; -use quote::ToTokens; +use crate::{ + pallet::{parse::call::CallWeightDef, Def}, + COUNTER, +}; +use proc_macro2::TokenStream as TokenStream2; +use quote::{quote, ToTokens}; use syn::spanned::Spanned; /// @@ -74,15 +78,12 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream { call_index_warnings.push(warning); } - let fn_weight = methods.iter().map(|method| &method.weight); + let mut fn_weight = Vec::::new(); let mut weight_warnings = Vec::new(); - for weight in fn_weight.clone() { - if def.dev_mode { - continue - } - - match weight { - syn::Expr::Lit(lit) => { + for method in &methods { + match &method.weight { + CallWeightDef::DevModeDefault => fn_weight.push(syn::parse_quote!(0)), + CallWeightDef::Immediate(e @ syn::Expr::Lit(lit)) if !def.dev_mode => { let warning = proc_macro_warning::Warning::new_deprecated("ConstantWeight") .index(weight_warnings.len()) .old("use hard-coded constant as call weight") @@ -91,10 +92,26 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream { .span(lit.span()) .build(); weight_warnings.push(warning); + fn_weight.push(e.into_token_stream()); + }, + CallWeightDef::Immediate(e) => fn_weight.push(e.into_token_stream()), + CallWeightDef::Inherited => { + let pallet_weight = def + .call + .as_ref() + .expect("we have methods; we have calls; qed") + .inherited_call_weight + .as_ref() + .expect("the parser prevents this"); + + // Expand `<::WeightInfo>::call_name()`. + let t = &pallet_weight.typename; + let n = &method.name; + fn_weight.push(quote!({ < #t > :: #n () })); }, - _ => {}, } } + debug_assert_eq!(fn_weight.len(), methods.len()); let fn_doc = methods.iter().map(|method| &method.docs).collect::>(); diff --git a/frame/support/procedural/src/pallet/parse/call.rs b/frame/support/procedural/src/pallet/parse/call.rs index ae1c039c9ddde..90631f264b92a 100644 --- a/frame/support/procedural/src/pallet/parse/call.rs +++ b/frame/support/procedural/src/pallet/parse/call.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::helper; +use super::{helper, InheritedCallWeightAttr}; use frame_support_procedural_tools::get_doc_literals; use quote::ToTokens; use std::collections::HashMap; @@ -46,6 +46,23 @@ pub struct CallDef { pub attr_span: proc_macro2::Span, /// Docs, specified on the impl Block. pub docs: Vec, + /// The optional `weight` attribute on the `pallet::call`. + pub inherited_call_weight: Option, +} + +/// The weight of a call. +#[derive(Clone)] +pub enum CallWeightDef { + /// Explicitly set on the call itself with `#[pallet::weight(…)]`. This value is used. + Immediate(syn::Expr), + + /// The default value that should be set for dev-mode pallets. Usually zero. + DevModeDefault, + + /// Inherits whatever value is configured on the pallet level. + /// + /// The concrete value is not known at this point. + Inherited, } /// Definition of dispatchable typically: `#[weight...] fn foo(origin .., param1: ...) -> ..` @@ -55,8 +72,8 @@ pub struct CallVariantDef { pub name: syn::Ident, /// Information on args: `(is_compact, name, type)` pub args: Vec<(bool, syn::Ident, Box)>, - /// Weight formula. - pub weight: syn::Expr, + /// Weight for the call. + pub weight: CallWeightDef, /// Call index of the dispatchable. pub call_index: u8, /// Whether an explicit call index was specified. @@ -151,6 +168,7 @@ impl CallDef { index: usize, item: &mut syn::Item, dev_mode: bool, + inherited_call_weight: Option, ) -> syn::Result { let item_impl = if let syn::Item::Impl(item) = item { item @@ -228,17 +246,23 @@ impl CallDef { weight_attrs.push(FunctionAttr::Weight(empty_weight)); } - if weight_attrs.len() != 1 { - let msg = if weight_attrs.is_empty() { - "Invalid pallet::call, requires weight attribute i.e. `#[pallet::weight($expr)]`" - } else { - "Invalid pallet::call, too many weight attributes given" - }; - return Err(syn::Error::new(method.sig.span(), msg)) - } - let weight = match weight_attrs.pop().unwrap() { - FunctionAttr::Weight(w) => w, - _ => unreachable!("checked during creation of the let binding"), + let weight = match weight_attrs.len() { + 0 if inherited_call_weight.is_some() => CallWeightDef::Inherited, + 0 if dev_mode => CallWeightDef::DevModeDefault, + 0 => return Err(syn::Error::new( + method.sig.span(), + "A pallet::call requires either a concrete `#[pallet::weight($expr)]` or an + inherited weight from the `#[pallet:call(weight($type))]` attribute, but + none were given.", + )), + 1 => match weight_attrs.pop().unwrap() { + FunctionAttr::Weight(w) => CallWeightDef::Immediate(w), + _ => unreachable!("checked during creation of the let binding"), + }, + _ => { + let msg = "Invalid pallet::call, too many weight attributes given"; + return Err(syn::Error::new(method.sig.span(), msg)) + }, }; if call_idx_attrs.len() > 1 { @@ -321,6 +345,7 @@ impl CallDef { methods, where_clause: item_impl.generics.where_clause.clone(), docs: get_doc_literals(&item_impl.attrs), + inherited_call_weight, }) } } diff --git a/frame/support/procedural/src/pallet/parse/mod.rs b/frame/support/procedural/src/pallet/parse/mod.rs index 06b9899d03b97..770cba68c1aad 100644 --- a/frame/support/procedural/src/pallet/parse/mod.rs +++ b/frame/support/procedural/src/pallet/parse/mod.rs @@ -110,8 +110,8 @@ impl Def { let m = hooks::HooksDef::try_from(span, index, item)?; hooks = Some(m); }, - Some(PalletAttr::RuntimeCall(span)) if call.is_none() => - call = Some(call::CallDef::try_from(span, index, item, dev_mode)?), + Some(PalletAttr::RuntimeCall(cw, span)) if call.is_none() => + call = Some(call::CallDef::try_from(span, index, item, dev_mode, cw)?), Some(PalletAttr::Error(span)) if error.is_none() => error = Some(error::ErrorDef::try_from(span, index, item)?), Some(PalletAttr::RuntimeEvent(span)) if event.is_none() => @@ -402,6 +402,7 @@ impl GenericKind { mod keyword { syn::custom_keyword!(origin); syn::custom_keyword!(call); + syn::custom_keyword!(weight); syn::custom_keyword!(event); syn::custom_keyword!(config); syn::custom_keyword!(hooks); @@ -425,7 +426,44 @@ enum PalletAttr { Config(proc_macro2::Span), Pallet(proc_macro2::Span), Hooks(proc_macro2::Span), - RuntimeCall(proc_macro2::Span), + /// A `#[pallet::call]` with optional attributes to specialize the behaviour. + /// + /// # Attributes + /// + /// Each attribute `attr` can take the form of `#[pallet::call(attr = …)]` or + /// `#[pallet::call(attr(…))]`. The possible attributes are: + /// + /// ## `weight` + /// + /// Can be used to reduce the repetitive weight annotation in the trivial case. It accepts one + /// argument that is expected to be an implementation of the `WeightInfo` or something that + /// behaves syntactically equivalent. This allows to annotate a `WeightInfo` for all the calls. + /// Now each call does not need to specify its own `#[pallet::weight]` but can instead use the + /// one from the `#[pallet::call]` definition. So instead of having to write it on each call: + /// + /// ```ignore + /// #[pallet::call] + /// impl Pallet { + /// #[pallet::weight(T::WeightInfo::create())] + /// pub fn create( + /// ``` + /// you can now omit it on the call itself, if the name of the weigh function matches the call: + /// + /// ```ignore + /// #[pallet::call(weight = ::WeightInfo)] + /// impl Pallet { + /// pub fn create( + /// ``` + /// + /// It is possible to use this syntax together with instantiated pallets by using `Config` + /// instead. + /// + /// ### Dev Mode + /// + /// Normally the `dev_mode` sets all weights of calls without a `#[pallet::weight]` annotation + /// to zero. Now when there is a `weight` attribute on the `#[pallet::call]`, then that is used + /// instead of the zero weight. So to say: it works together with `dev_mode`. + RuntimeCall(Option, proc_macro2::Span), Error(proc_macro2::Span), RuntimeEvent(proc_macro2::Span), RuntimeOrigin(proc_macro2::Span), @@ -445,7 +483,7 @@ impl PalletAttr { Self::Config(span) => *span, Self::Pallet(span) => *span, Self::Hooks(span) => *span, - Self::RuntimeCall(span) => *span, + Self::RuntimeCall(_, span) => *span, Self::Error(span) => *span, Self::RuntimeEvent(span) => *span, Self::RuntimeOrigin(span) => *span, @@ -477,7 +515,12 @@ impl syn::parse::Parse for PalletAttr { } else if lookahead.peek(keyword::hooks) { Ok(PalletAttr::Hooks(content.parse::()?.span())) } else if lookahead.peek(keyword::call) { - Ok(PalletAttr::RuntimeCall(content.parse::()?.span())) + let span = content.parse::().expect("peeked").span(); + let attr = match content.is_empty() { + true => None, + false => Some(InheritedCallWeightAttr::parse(&content)?), + }; + Ok(PalletAttr::RuntimeCall(attr, span)) } else if lookahead.peek(keyword::error) { Ok(PalletAttr::Error(content.parse::()?.span())) } else if lookahead.peek(keyword::event) { @@ -505,3 +548,33 @@ impl syn::parse::Parse for PalletAttr { } } } + +/// The optional weight annotation on a `#[pallet::call]` like `#[pallet::call(weight($type))]`. +#[derive(Clone)] +pub struct InheritedCallWeightAttr { + pub typename: syn::Type, + pub span: proc_macro2::Span, +} + +impl syn::parse::Parse for InheritedCallWeightAttr { + // Parses `(weight($type))` or `(weight = $type)`. + fn parse(input: syn::parse::ParseStream) -> syn::Result { + let content; + syn::parenthesized!(content in input); + content.parse::()?; + let lookahead = content.lookahead1(); + + let buffer = if lookahead.peek(syn::token::Paren) { + let inner; + syn::parenthesized!(inner in content); + inner + } else if lookahead.peek(syn::Token![=]) { + content.parse::().expect("peeked"); + content + } else { + return Err(lookahead.error()) + }; + + Ok(Self { typename: buffer.parse()?, span: input.span() }) + } +} diff --git a/frame/support/procedural/src/pallet/parse/pallet_struct.rs b/frame/support/procedural/src/pallet/parse/pallet_struct.rs index 98312d0652d8e..f4af86aa3e993 100644 --- a/frame/support/procedural/src/pallet/parse/pallet_struct.rs +++ b/frame/support/procedural/src/pallet/parse/pallet_struct.rs @@ -61,8 +61,8 @@ pub enum PalletStructAttr { impl PalletStructAttr { fn span(&self) -> proc_macro2::Span { match self { - Self::GenerateStore { span, .. } => *span, - Self::WithoutStorageInfoTrait(span) => *span, + Self::GenerateStore { span, .. } | + Self::WithoutStorageInfoTrait(span) | Self::StorageVersion { span, .. } => *span, } } diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 0ee82b9f16a8f..138b7b55bf0eb 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -2600,7 +2600,7 @@ pub mod pallet_prelude { /// #[pallet::extra_constants] /// impl, I: 'static> Pallet { /// /// Some description -/// fn exra_constant_name() -> u128 { 4u128 } +/// fn extra_constant_name() -> u128 { 4u128 } /// } /// /// #[pallet::pallet] diff --git a/frame/support/test/tests/pallet_ui/call_missing_weight.stderr b/frame/support/test/tests/pallet_ui/call_missing_weight.stderr index ec45d478870c1..0a6cf16571f95 100644 --- a/frame/support/test/tests/pallet_ui/call_missing_weight.stderr +++ b/frame/support/test/tests/pallet_ui/call_missing_weight.stderr @@ -1,5 +1,7 @@ -error: Invalid pallet::call, requires weight attribute i.e. `#[pallet::weight($expr)]` - --> $DIR/call_missing_weight.rs:17:7 +error: A pallet::call requires either a concrete `#[pallet::weight($expr)]` or an + inherited weight from the `#[pallet:call(weight($type))]` attribute, but + none were given. + --> tests/pallet_ui/call_missing_weight.rs:17:7 | 17 | pub fn foo(origin: OriginFor) -> DispatchResultWithPostInfo {} | ^^ diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid.rs b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid.rs new file mode 100644 index 0000000000000..ff235e986099f --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid.rs @@ -0,0 +1,50 @@ +use frame_support::pallet_prelude::*; + +pub trait WeightInfo { + fn foo() -> Weight; +} + +#[frame_support::pallet] +mod pallet { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(invalid)] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +#[frame_support::pallet] +mod assign { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call = invalid] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid.stderr b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid.stderr new file mode 100644 index 0000000000000..7eed646e7b190 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid.stderr @@ -0,0 +1,11 @@ +error: expected `weight` + --> tests/pallet_ui/call_weight_inherited_invalid.rs:19:17 + | +19 | #[pallet::call(invalid)] + | ^^^^^^^ + +error: expected parentheses + --> tests/pallet_ui/call_weight_inherited_invalid.rs:40:17 + | +40 | #[pallet::call = invalid] + | ^ diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid2.rs b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid2.rs new file mode 100644 index 0000000000000..76ccf5db22019 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid2.rs @@ -0,0 +1,53 @@ +// Weight is an ident instead of a type. + +use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; + +pub trait WeightInfo { + fn foo() -> Weight; +} + +#[frame_support::pallet] +mod parentheses { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight(prefix))] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +#[frame_support::pallet] +mod assign { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight = prefix)] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid2.stderr b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid2.stderr new file mode 100644 index 0000000000000..29f3b6bfd2b0d --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid2.stderr @@ -0,0 +1,11 @@ +error[E0412]: cannot find type `prefix` in this scope + --> tests/pallet_ui/call_weight_inherited_invalid2.rs:22:24 + | +22 | #[pallet::call(weight(prefix))] + | ^^^^^^ not found in this scope + +error[E0412]: cannot find type `prefix` in this scope + --> tests/pallet_ui/call_weight_inherited_invalid2.rs:43:26 + | +43 | #[pallet::call(weight = prefix)] + | ^^^^^^ not found in this scope diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.rs b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.rs new file mode 100644 index 0000000000000..b31bc0ae234b2 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.rs @@ -0,0 +1,53 @@ +// Call weight is an LitInt instead of a type. + +use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; + +pub trait WeightInfo { + fn foo() -> Weight; +} + +#[frame_support::pallet] +mod parentheses { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight(123))] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +#[frame_support::pallet] +mod assign { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight = 123)] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr new file mode 100644 index 0000000000000..fab7acb90deaf --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr @@ -0,0 +1,19 @@ +error: expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, `dyn`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime + --> tests/pallet_ui/call_weight_inherited_invalid3.rs:22:24 + | +22 | #[pallet::call(weight(123))] + | ^^^ + +error: expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, `dyn`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime + --> tests/pallet_ui/call_weight_inherited_invalid3.rs:43:26 + | +43 | #[pallet::call(weight = 123)] + | ^^^ + +error: unused import: `frame_system::pallet_prelude::*` + --> tests/pallet_ui/call_weight_inherited_invalid3.rs:4:5 + | +4 | use frame_system::pallet_prelude::*; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D unused-imports` implied by `-D warnings` diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid4.rs b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid4.rs new file mode 100644 index 0000000000000..39c0929d603ad --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid4.rs @@ -0,0 +1,52 @@ +// Function does not exist in the trait. + +use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; + +pub trait WeightInfo { +} + +#[frame_support::pallet] +mod parentheses { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight(::WeightInfo))] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +#[frame_support::pallet] +mod assign { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight = ::WeightInfo)] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid4.stderr b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid4.stderr new file mode 100644 index 0000000000000..46872fc7c3691 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid4.stderr @@ -0,0 +1,11 @@ +error[E0599]: no function or associated item named `foo` found for associated type `::WeightInfo` in the current scope + --> tests/pallet_ui/call_weight_inherited_invalid4.rs:24:10 + | +24 | pub fn foo(_: OriginFor) -> DispatchResult { + | ^^^ function or associated item not found in `::WeightInfo` + +error[E0599]: no function or associated item named `foo` found for associated type `::WeightInfo` in the current scope + --> tests/pallet_ui/call_weight_inherited_invalid4.rs:45:10 + | +45 | pub fn foo(_: OriginFor) -> DispatchResult { + | ^^^ function or associated item not found in `::WeightInfo` diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid5.rs b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid5.rs new file mode 100644 index 0000000000000..a5b2f5c7f6aa6 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid5.rs @@ -0,0 +1,44 @@ +// Stray tokens after good input. + +#[frame_support::pallet] +mod parentheses { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight(::WeightInfo straycat))] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +#[frame_support::pallet] +mod assign { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight = ::WeightInfo straycat)] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid5.stderr b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid5.stderr new file mode 100644 index 0000000000000..c0e9ef2d9e9d8 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid5.stderr @@ -0,0 +1,11 @@ +error: unexpected token + --> tests/pallet_ui/call_weight_inherited_invalid5.rs:14:50 + | +14 | #[pallet::call(weight(::WeightInfo straycat))] + | ^^^^^^^^ + +error: unexpected token + --> tests/pallet_ui/call_weight_inherited_invalid5.rs:34:52 + | +34 | #[pallet::call(weight = ::WeightInfo straycat)] + | ^^^^^^^^ diff --git a/frame/support/test/tests/pallet_ui/dev_mode_without_arg.rs b/frame/support/test/tests/pallet_ui/dev_mode_without_arg.rs index f044ae6d7878f..2a413eea9b4aa 100644 --- a/frame/support/test/tests/pallet_ui/dev_mode_without_arg.rs +++ b/frame/support/test/tests/pallet_ui/dev_mode_without_arg.rs @@ -1,7 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub use pallet::*; - #[frame_support::pallet] pub mod pallet { use frame_support::pallet_prelude::*; diff --git a/frame/support/test/tests/pallet_ui/dev_mode_without_arg.stderr b/frame/support/test/tests/pallet_ui/dev_mode_without_arg.stderr index fac7fd77df9ae..1e2011b2a30cf 100644 --- a/frame/support/test/tests/pallet_ui/dev_mode_without_arg.stderr +++ b/frame/support/test/tests/pallet_ui/dev_mode_without_arg.stderr @@ -1,11 +1,7 @@ -error: Invalid pallet::call, requires weight attribute i.e. `#[pallet::weight($expr)]` - --> tests/pallet_ui/dev_mode_without_arg.rs:24:7 +error: A pallet::call requires either a concrete `#[pallet::weight($expr)]` or an + inherited weight from the `#[pallet:call(weight($type))]` attribute, but + none were given. + --> tests/pallet_ui/dev_mode_without_arg.rs:22:7 | -24 | pub fn my_call(_origin: OriginFor) -> DispatchResult { +22 | pub fn my_call(_origin: OriginFor) -> DispatchResult { | ^^ - -error[E0432]: unresolved import `pallet` - --> tests/pallet_ui/dev_mode_without_arg.rs:3:9 - | -3 | pub use pallet::*; - | ^^^^^^ help: a similar path exists: `test_pallet::pallet` diff --git a/frame/support/test/tests/pallet_ui/pass/inherited_call_weight.rs b/frame/support/test/tests/pallet_ui/pass/inherited_call_weight.rs new file mode 100644 index 0000000000000..355a1c978df06 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/pass/inherited_call_weight.rs @@ -0,0 +1,51 @@ +use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; + +pub trait WeightInfo { + fn foo() -> Weight; +} + +#[frame_support::pallet] +mod parentheses { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight(::WeightInfo))] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +#[frame_support::pallet] +mod assign { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: crate::WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight = ::WeightInfo)] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/pass/inherited_call_weight2.rs b/frame/support/test/tests/pallet_ui/pass/inherited_call_weight2.rs new file mode 100644 index 0000000000000..ae70c295d8db2 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/pass/inherited_call_weight2.rs @@ -0,0 +1,57 @@ +use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; + +pub trait WeightInfo { + fn foo() -> Weight; +} + +impl WeightInfo for () { + fn foo() -> Weight { + Weight::zero() + } +} + +#[frame_support::pallet] +mod parentheses { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + // Crazy man just uses `()`, but it still works ;) + #[pallet::call(weight(()))] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +#[frame_support::pallet] +mod assign { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + // Crazy man just uses `()`, but it still works ;) + #[pallet::call(weight = ())] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/pass/inherited_call_weight3.rs b/frame/support/test/tests/pallet_ui/pass/inherited_call_weight3.rs new file mode 100644 index 0000000000000..567fd2e5fa032 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/pass/inherited_call_weight3.rs @@ -0,0 +1,54 @@ +use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; + +// If, for whatever reason, you dont to not use a `WeightInfo` trait - it will still work. +struct Impl; + +impl Impl { + fn foo() -> Weight { + Weight::zero() + } +} + +#[frame_support::pallet] +mod parentheses { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight(crate::Impl))] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +#[frame_support::pallet] +mod assign { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight = crate::Impl)] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/pass/inherited_call_weight_dev_mode.rs b/frame/support/test/tests/pallet_ui/pass/inherited_call_weight_dev_mode.rs new file mode 100644 index 0000000000000..04ce49ee71e99 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/pass/inherited_call_weight_dev_mode.rs @@ -0,0 +1,30 @@ +use frame_support::pallet_prelude::*; +use frame_system::pallet_prelude::*; + +pub trait WeightInfo { + fn foo() -> Weight; +} + +#[frame_support::pallet(dev_mode)] +mod pallet { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type WeightInfo: WeightInfo; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::call(weight(::WeightInfo))] + impl Pallet { + #[pallet::call_index(0)] + pub fn foo(_: OriginFor) -> DispatchResult { + Ok(()) + } + } +} + +fn main() { +} From de917e9090af2f1f75d5b25d669a806030c780a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Pestana?= Date: Thu, 27 Apr 2023 19:45:43 +0100 Subject: [PATCH 86/93] Implements `try_state` hook in elections and EPM pallets (#13979) * Adds try_state hook to elections pallets * Addresses PR review comments Co-authored-by: Liam Aharon * remove unecessary println * ensures try-runtime does not mutate storage * Addresses PR comments * Fixes snapshot invariant checks; simplifies test infra --------- Co-authored-by: Liam Aharon Co-authored-by: parity-processbot <> --- .../election-provider-multi-phase/src/lib.rs | 95 +++++++++++ .../election-provider-multi-phase/src/mock.rs | 12 +- .../src/signed.rs | 5 + frame/elections-phragmen/src/lib.rs | 156 +++++++++++++----- 4 files changed, 223 insertions(+), 45 deletions(-) diff --git a/frame/election-provider-multi-phase/src/lib.rs b/frame/election-provider-multi-phase/src/lib.rs index 3599037104d18..c5247e3c21c23 100644 --- a/frame/election-provider-multi-phase/src/lib.rs +++ b/frame/election-provider-multi-phase/src/lib.rs @@ -881,6 +881,11 @@ pub mod pallet { // configure this pallet. assert!(T::SignedMaxSubmissions::get() >= T::SignedMaxRefunds::get()); } + + #[cfg(feature = "try-runtime")] + fn try_state(_n: T::BlockNumber) -> Result<(), &'static str> { + Self::do_try_state() + } } #[pallet::call] @@ -1252,6 +1257,8 @@ pub mod pallet { pub type CurrentPhase = StorageValue<_, Phase, ValueQuery>; /// Current best solution, signed or unsigned, queued to be returned upon `elect`. + /// + /// Always sorted by score. #[pallet::storage] #[pallet::getter(fn queued_solution)] pub type QueuedSolution = @@ -1570,6 +1577,89 @@ impl Pallet { } } +#[cfg(feature = "try-runtime")] +impl Pallet { + fn do_try_state() -> Result<(), &'static str> { + Self::try_state_snapshot()?; + Self::try_state_signed_submissions_map()?; + Self::try_state_phase_off() + } + + // [`Snapshot`] state check. Invariants: + // - [`DesiredTargets`] exists if and only if [`Snapshot`] is present. + // - [`SnapshotMetadata`] exist if and only if [`Snapshot`] is present. + fn try_state_snapshot() -> Result<(), &'static str> { + if >::exists() && + >::exists() && + >::exists() + { + Ok(()) + } else if !>::exists() && + !>::exists() && + !>::exists() + { + Ok(()) + } else { + Err("If snapshot exists, metadata and desired targets should be set too. Otherwise, none should be set.") + } + } + + // [`SignedSubmissionsMap`] state check. Invariants: + // - All [`SignedSubmissionIndices`] are present in [`SignedSubmissionsMap`], and no more; + // - [`SignedSubmissionNextIndex`] is not present in [`SignedSubmissionsMap`]; + // - [`SignedSubmissionIndices`] is sorted by election score. + fn try_state_signed_submissions_map() -> Result<(), &'static str> { + let mut last_score: ElectionScore = Default::default(); + let indices = >::get(); + + for (i, indice) in indices.iter().enumerate() { + let submission = >::get(indice.2); + if submission.is_none() { + return Err("All signed submissions indices must be part of the submissions map") + } + + if i == 0 { + last_score = indice.0 + } else { + if last_score.strict_threshold_better(indice.0, Perbill::zero()) { + return Err("Signed submission indices vector must be ordered by election score") + } + last_score = indice.0; + } + } + + if >::iter().nth(indices.len()).is_some() { + return Err("Signed submissions map length should be the same as the indices vec length") + } + + match >::get() { + 0 => Ok(()), + next => + if >::get(next).is_some() { + return Err( + "The next submissions index should not be in the submissions maps already", + ) + } else { + Ok(()) + }, + } + } + + // [`Phase::Off`] state check. Invariants: + // - If phase is `Phase::Off`, [`Snapshot`] must be none. + fn try_state_phase_off() -> Result<(), &'static str> { + match Self::current_phase().is_off() { + false => Ok(()), + true => + if >::get().is_some() { + Err("Snapshot must be none when in Phase::Off") + } else { + Ok(()) + }, + } + } +} + impl ElectionProviderBase for Pallet { type AccountId = T::AccountId; type BlockNumber = T::BlockNumber; @@ -1642,6 +1732,11 @@ mod feasibility_check { MultiPhase::feasibility_check(solution, COMPUTE), FeasibilityError::SnapshotUnavailable ); + + // kill also `SnapshotMetadata` and `DesiredTargets` for the storage state to be + // consistent for the try_state checks to pass. + >::kill(); + >::kill(); }) } diff --git a/frame/election-provider-multi-phase/src/mock.rs b/frame/election-provider-multi-phase/src/mock.rs index 8c18777606048..732a650ce6db1 100644 --- a/frame/election-provider-multi-phase/src/mock.rs +++ b/frame/election-provider-multi-phase/src/mock.rs @@ -615,7 +615,17 @@ impl ExtBuilder { } pub fn build_and_execute(self, test: impl FnOnce() -> ()) { - self.build().execute_with(test) + sp_tracing::try_init_simple(); + + let mut ext = self.build(); + ext.execute_with(test); + + #[cfg(feature = "try-runtime")] + ext.execute_with(|| { + assert_ok!(>::try_state( + System::block_number() + )); + }); } } diff --git a/frame/election-provider-multi-phase/src/signed.rs b/frame/election-provider-multi-phase/src/signed.rs index b8a27fdfafde5..bde985518d53e 100644 --- a/frame/election-provider-multi-phase/src/signed.rs +++ b/frame/election-provider-multi-phase/src/signed.rs @@ -554,6 +554,11 @@ mod tests { MultiPhase::submit(RuntimeOrigin::signed(10), Box::new(solution)), Error::::PreDispatchEarlySubmission, ); + + // make sure invariants hold true and post-test try state checks to pass. + >::kill(); + >::kill(); + >::kill(); }) } diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index d83c94db139a4..9c40e542e1c2a 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -325,6 +325,11 @@ pub mod pallet { T::MaxVotesPerVoter::get(), ); } + + #[cfg(feature = "try-runtime")] + fn try_state(_n: T::BlockNumber) -> Result<(), &'static str> { + Self::do_try_state() + } } #[pallet::call] @@ -893,7 +898,7 @@ impl Pallet { } /// Get the members' account ids. - fn members_ids() -> Vec { + pub(crate) fn members_ids() -> Vec { Self::members().into_iter().map(|m| m.who).collect::>() } @@ -1192,6 +1197,104 @@ impl ContainsLengthBound for Pallet { } } +#[cfg(any(feature = "try-runtime", test))] +impl Pallet { + fn do_try_state() -> Result<(), &'static str> { + Self::try_state_members()?; + Self::try_state_runners_up()?; + Self::try_state_candidates()?; + Self::try_state_candidates_runners_up_disjoint()?; + Self::try_state_members_disjoint()?; + Self::try_state_members_approval_stake() + } + + /// [`Members`] state checks. Invariants: + /// - Members are always sorted based on account ID. + fn try_state_members() -> Result<(), &'static str> { + let mut members = Members::::get().clone(); + members.sort_by_key(|m| m.who.clone()); + + if Members::::get() == members { + Ok(()) + } else { + Err("try_state checks: Members must be always sorted by account ID") + } + } + + // [`RunnersUp`] state checks. Invariants: + // - Elements are sorted based on weight (worst to best). + fn try_state_runners_up() -> Result<(), &'static str> { + let mut sorted = RunnersUp::::get(); + // worst stake first + sorted.sort_by(|a, b| a.stake.cmp(&b.stake)); + + if RunnersUp::::get() == sorted { + Ok(()) + } else { + Err("try_state checks: Runners Up must always be sorted by stake (worst to best)") + } + } + + // [`Candidates`] state checks. Invariants: + // - Always sorted based on account ID. + fn try_state_candidates() -> Result<(), &'static str> { + let mut candidates = Candidates::::get().clone(); + candidates.sort_by_key(|(c, _)| c.clone()); + + if Candidates::::get() == candidates { + Ok(()) + } else { + Err("try_state checks: Candidates must be always sorted by account ID") + } + } + // [`Candidates`] and [`RunnersUp`] state checks. Invariants: + // - Candidates and runners-ups sets are disjoint. + fn try_state_candidates_runners_up_disjoint() -> Result<(), &'static str> { + match Self::intersects(&Self::candidates_ids(), &Self::runners_up_ids()) { + true => Err("Candidates and runners up sets should always be disjoint"), + false => Ok(()), + } + } + + // [`Members`], [`Candidates`] and [`RunnersUp`] state checks. Invariants: + // - Members and candidates sets are disjoint; + // - Members and runners-ups sets are disjoint. + fn try_state_members_disjoint() -> Result<(), &'static str> { + match Self::intersects(&Pallet::::members_ids(), &Self::candidates_ids()) && + Self::intersects(&Pallet::::members_ids(), &Self::runners_up_ids()) + { + true => Err("Members set should be disjoint from candidates and runners-up sets"), + false => Ok(()), + } + } + + // [`Members`], [`RunnersUp`] and approval stake state checks. Invariants: + // - Selected members should have approval stake; + // - Selected RunnersUp should have approval stake. + fn try_state_members_approval_stake() -> Result<(), &'static str> { + match Members::::get() + .iter() + .chain(RunnersUp::::get().iter()) + .all(|s| s.stake != BalanceOf::::zero()) + { + true => Ok(()), + false => Err("Members and RunnersUp must have approval stake"), + } + } + + fn intersects(a: &[P], b: &[P]) -> bool { + a.iter().any(|e| b.contains(e)) + } + + fn candidates_ids() -> Vec { + Pallet::::candidates().iter().map(|(x, _)| x).cloned().collect::>() + } + + fn runners_up_ids() -> Vec { + Pallet::::runners_up().into_iter().map(|r| r.who).collect::>() + } +} + #[cfg(test)] mod tests { use super::*; @@ -1418,7 +1521,13 @@ mod tests { .into(); ext.execute_with(pre_conditions); ext.execute_with(test); - ext.execute_with(post_conditions) + + #[cfg(feature = "try-runtime")] + ext.execute_with(|| { + assert_ok!(>::try_state( + System::block_number() + )); + }); } } @@ -1475,54 +1584,13 @@ mod tests { .unwrap_or_default() } - fn intersects(a: &[T], b: &[T]) -> bool { - a.iter().any(|e| b.contains(e)) - } - - fn ensure_members_sorted() { - let mut members = Elections::members().clone(); - members.sort_by_key(|m| m.who); - assert_eq!(Elections::members(), members); - } - - fn ensure_candidates_sorted() { - let mut candidates = Elections::candidates().clone(); - candidates.sort_by_key(|(c, _)| *c); - assert_eq!(Elections::candidates(), candidates); - } - fn locked_stake_of(who: &u64) -> u64 { Voting::::get(who).stake } - fn ensure_members_has_approval_stake() { - // we filter members that have no approval state. This means that even we have more seats - // than candidates, we will never ever chose a member with no votes. - assert!(Elections::members() - .iter() - .chain(Elections::runners_up().iter()) - .all(|s| s.stake != u64::zero())); - } - - fn ensure_member_candidates_runners_up_disjoint() { - // members, candidates and runners-up must always be disjoint sets. - assert!(!intersects(&members_ids(), &candidate_ids())); - assert!(!intersects(&members_ids(), &runners_up_ids())); - assert!(!intersects(&candidate_ids(), &runners_up_ids())); - } - fn pre_conditions() { System::set_block_number(1); - ensure_members_sorted(); - ensure_candidates_sorted(); - ensure_member_candidates_runners_up_disjoint(); - } - - fn post_conditions() { - ensure_members_sorted(); - ensure_candidates_sorted(); - ensure_member_candidates_runners_up_disjoint(); - ensure_members_has_approval_stake(); + Elections::do_try_state().unwrap(); } fn submit_candidacy(origin: RuntimeOrigin) -> sp_runtime::DispatchResult { From 16b2e644487f7f767eeefd4debf11a7948bfa4db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Apr 2023 20:08:42 +0000 Subject: [PATCH 87/93] Bump wasmtime from 6.0.1 to 6.0.2 (#14037) Bumps [wasmtime](https://github.com/bytecodealliance/wasmtime) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/bytecodealliance/wasmtime/releases) - [Changelog](https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-some-possible-changes.md) - [Commits](https://github.com/bytecodealliance/wasmtime/compare/v6.0.1...v6.0.2) --- updated-dependencies: - dependency-name: wasmtime dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 76 ++++++++++++++-------------- client/executor/wasmtime/Cargo.toml | 2 +- primitives/wasm-interface/Cargo.toml | 2 +- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c06bf41c24b4d..420c9040897b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1172,18 +1172,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7379abaacee0f14abf3204a7606118f0465785252169d186337bcb75030815a" +checksum = "2bc42ba2e232e5b20ff7dc299a812d53337dadce9a7e39a238e6a5cb82d2e57b" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9489fa336927df749631f1008007ced2871068544f40a202ce6d93fbf2366a7b" +checksum = "253531aca9b6f56103c9420369db3263e784df39aa1c90685a1f69cfbba0623e" dependencies = [ "arrayvec 0.7.2", "bumpalo", @@ -1202,33 +1202,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bbb67da91ec721ed57cef2f7c5ef7728e1cd9bde9ffd3ef8601022e73e3239" +checksum = "72f2154365e2bff1b1b8537a7181591fdff50d8e27fa6e40d5c69c3bad0ca7c8" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418ecb2f36032f6665dc1a5e2060a143dbab41d83b784882e97710e890a7a16d" +checksum = "687e14e3f5775248930e0d5a84195abef8b829958e9794bf8d525104993612b4" [[package]] name = "cranelift-entity" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cf583f7b093f291005f9fb1323e2c37f6ee4c7909e39ce016b2e8360d461705" +checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b66bf9e916f57fbbd0f7703ec6286f4624866bf45000111627c70d272c8dda1" +checksum = "8483c2db6f45fe9ace984e5adc5d058102227e4c62e5aa2054e16b0275fd3a6e" dependencies = [ "cranelift-codegen", "log", @@ -1238,15 +1238,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649782a39ce99798dd6b4029e2bb318a2fbeaade1b4fa25330763c10c65bc358" +checksum = "e9793158837678902446c411741d87b43f57dadfb944f2440db4287cda8cbd59" [[package]] name = "cranelift-native" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937e021e089c51f9749d09e7ad1c4f255c2f8686cb8c3df63a34b3ec9921bc41" +checksum = "72668c7755f2b880665cb422c8ad2d56db58a88b9bebfef0b73edc2277c13c49" dependencies = [ "cranelift-codegen", "libc", @@ -1255,9 +1255,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d850cf6775477747c9dfda9ae23355dd70512ffebc70cf82b85a5b111ae668b5" +checksum = "3852ce4b088b44ac4e29459573943009a70d1b192c8d77ef949b4e814f656fc1" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -12635,9 +12635,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e89f9819523447330ffd70367ef4a18d8c832e24e8150fe054d1d912841632" +checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" dependencies = [ "anyhow", "bincode", @@ -12663,18 +12663,18 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd3a5e46c198032da934469f3a6e48649d1f9142438e4fd4617b68a35644b8a" +checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b389ae9b678b9c3851091a4804f4182d688d27aff7abc9aa37fa7be37d8ecffa" +checksum = "5ceb3adf61d654be0be67fffdce42447b0880481348785be5fe40b5dd7663a4c" dependencies = [ "anyhow", "base64 0.13.1", @@ -12692,9 +12692,9 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b2c92a08c0db6efffd88fdc97d7aa9c7c63b03edb0971dbca745469f820e8c" +checksum = "3c366bb8647e01fd08cb5589976284b00abfded5529b33d7e7f3f086c68304a4" dependencies = [ "anyhow", "cranelift-codegen", @@ -12713,9 +12713,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a6db9fc52985ba06ca601f2ff0ff1f526c5d724c7ac267b47326304b0c97883" +checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" dependencies = [ "anyhow", "cranelift-entity", @@ -12732,9 +12732,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b77e3a52cd84d0f7f18554afa8060cfe564ccac61e3b0802d3fd4084772fa5f6" +checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" dependencies = [ "addr2line 0.17.0", "anyhow", @@ -12756,9 +12756,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0245e8a9347017c7185a72e215218a802ff561545c242953c11ba00fccc930f" +checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" dependencies = [ "object 0.29.0", "once_cell", @@ -12767,9 +12767,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67d412e9340ab1c83867051d8d1d7c90aa8c9afc91da086088068e2734e25064" +checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" dependencies = [ "cfg-if", "libc", @@ -12778,9 +12778,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d594e791b5fdd4dbaf8cf7ae62f2e4ff85018ce90f483ca6f42947688e48827d" +checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" dependencies = [ "anyhow", "cc", @@ -12802,9 +12802,9 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6688d6f96d4dbc1f89fab626c56c1778936d122b5f4ae7a57c2eb42b8d982e2" +checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" dependencies = [ "cranelift-entity", "serde", diff --git a/client/executor/wasmtime/Cargo.toml b/client/executor/wasmtime/Cargo.toml index fed284e916fd6..58a1ffde07898 100644 --- a/client/executor/wasmtime/Cargo.toml +++ b/client/executor/wasmtime/Cargo.toml @@ -19,7 +19,7 @@ libc = "0.2.121" # When bumping wasmtime do not forget to also bump rustix # to exactly the same version as used by wasmtime! -wasmtime = { version = "6.0.1", default-features = false, features = [ +wasmtime = { version = "6.0.2", default-features = false, features = [ "cache", "cranelift", "jitdump", diff --git a/primitives/wasm-interface/Cargo.toml b/primitives/wasm-interface/Cargo.toml index 441d66f0fb064..c45ea75830ef7 100644 --- a/primitives/wasm-interface/Cargo.toml +++ b/primitives/wasm-interface/Cargo.toml @@ -18,7 +18,7 @@ codec = { package = "parity-scale-codec", version = "3.2.2", default-features = impl-trait-for-tuples = "0.2.2" log = { version = "0.4.17", optional = true } wasmi = { version = "0.13.2", optional = true } -wasmtime = { version = "6.0.1", default-features = false, optional = true } +wasmtime = { version = "6.0.2", default-features = false, optional = true } anyhow = { version = "1.0.68", optional = true } sp-std = { version = "5.0.0", default-features = false, path = "../std" } From e94cb0dafd4f30ff29512c1c00ec513ada7d2b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 28 Apr 2023 14:12:26 +0200 Subject: [PATCH 88/93] Improve contribution guidelines (#13902) --- docs/CONTRIBUTING.adoc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/CONTRIBUTING.adoc b/docs/CONTRIBUTING.adoc index 05a9434ac81ab..759141a62dfc7 100644 --- a/docs/CONTRIBUTING.adoc +++ b/docs/CONTRIBUTING.adoc @@ -36,10 +36,11 @@ A Pull Request (PR) needs to be reviewed and approved by project maintainers unl *Process:* . Please tag each PR with exactly one `A`, `B`, `C` and `D` label at the minimum. +. When tagging a PR, it should be done while keeping all downstream users in mind. Downstream users are not just Polkadot or system parachains, but also all the other parachains and solo chains that are using Substrate. The labels are used by downstream users to track changes and to include these changes properly into their own releases. . Once a PR is ready for review please add the https://github.com/paritytech/substrate/pulls?q=is%3Apr+is%3Aopen+label%3AA0-please_review+[`A0-please_review`] label. Generally PRs should sit with this label for 48 hours in order to garner feedback. It may be merged before if all relevant parties had a look at it. . If the first review is not an approval, swap `A0-please_review` to any label `[A3, A5]` to indicate that the PR has received some feedback, but needs further work. For example. https://github.com/paritytech/substrate/labels/A3-in_progress[`A3-in_progress`] is a general indicator that the PR is work in progress. -. PRs must be tagged with their release notes requirements via the `B*` labels. If a PR should be mentioned in the release notes, use `B1` and add either: `T0-node`, `T1-runtime`or `T2-API` - this defines in which section of the release notes the PR will be shown. -. PRs must be tagged with their release importance via the `C1-C7` labels. +. PRs must be tagged with `B*` labels to signal if a change is note worthy for downstream users. The respective `T*` labels should be added to signal the component that was changed. `B0-silent` must only be used for changes that don't require any attention by downstream users. +. PRs must be tagged with their release importance via the `C1-C7` labels. The release importance is only informing about how important it is to apply a release that contains the change. . PRs must be tagged with their audit requirements via the `D1-D9` labels. . PRs that introduce runtime migrations must be tagged with https://github.com/paritytech/substrate/labels/E0-runtime_migration[`E0-runtime_migration`]. See the https://github.com/paritytech/substrate/blob/master/utils/frame/try-runtime/cli/src/lib.rs#L18[Migration Best Practices here] for more info about how to test runtime migrations. . PRs that introduce irreversible database migrations must be tagged with https://github.com/paritytech/substrate/labels/E1-database_migration[`E1-database_migration`]. @@ -50,7 +51,13 @@ A Pull Request (PR) needs to be reviewed and approved by project maintainers unl . PRs should be categorized into projects. . No PR should be merged until all reviews' comments are addressed and CI is successful. -*Reviewing pull requests*: +*Noting relevant changes:* + +When breaking APIs, it should be mentioned on what was changed in the PR description alongside some examples on how to change the code to make it work/compile. + +The PR description should also mention potential storage migrations and if they require some special setup aside adding it to the list of migrations in the runtime. + +*Reviewing pull requests:* When reviewing a pull request, the end-goal is to suggest useful changes to the author. Reviews should finish with approval unless there are issues that would result in: From de80d0107336a9c7a2efdc0199015e4d67fcbdb5 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Sat, 29 Apr 2023 01:34:05 +0200 Subject: [PATCH 89/93] CI: Remove crate publish check (#14044) * Fix frame-support feature Signed-off-by: Oliver Tale-Yazdi * Remove publishing script Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi --- .gitlab-ci.yml | 12 ------------ frame/support/Cargo.toml | 6 +++++- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 59d42936e1769..100dd0d3d3ed9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -247,18 +247,6 @@ default: #### stage: .pre -check-crates-publishing-pipeline: - stage: .pre - extends: - - .kubernetes-env - - .crates-publishing-pipeline - script: - - git clone - --depth 1 - --branch "$RELENG_SCRIPTS_BRANCH" - https://github.com/paritytech/releng-scripts.git - - ONLY_CHECK_PIPELINE=true ./releng-scripts/publish-crates - # By default our pipelines are interruptible, but some special pipelines shouldn't be interrupted: # * multi-project pipelines such as the ones triggered by the scripts repo # * the scheduled automatic-crate-publishing pipeline diff --git a/frame/support/Cargo.toml b/frame/support/Cargo.toml index fe068d9360d4e..d8b1b9c248720 100644 --- a/frame/support/Cargo.toml +++ b/frame/support/Cargo.toml @@ -70,7 +70,11 @@ std = [ "log/std", "environmental/std", ] -runtime-benchmarks = [] +runtime-benchmarks = [ + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "sp-staking/runtime-benchmarks" +] try-runtime = [] # By default some types have documentation, `no-metadata-docs` allows to reduce the documentation # in the metadata. From 74b2c92066ec3abcb612faa9272f246ae339fab3 Mon Sep 17 00:00:00 2001 From: yjh Date: Sat, 29 Apr 2023 18:06:42 +0800 Subject: [PATCH 90/93] fix(in_mem): fix the clone logic (#14038) --- client/api/src/in_mem.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/client/api/src/in_mem.rs b/client/api/src/in_mem.rs index 27a74ddd79ed6..0a29a4dbaae5c 100644 --- a/client/api/src/in_mem.rs +++ b/client/api/src/in_mem.rs @@ -114,6 +114,7 @@ struct BlockchainStorage { } /// In-memory blockchain. Supports concurrent reads. +#[derive(Clone)] pub struct Blockchain { storage: Arc>>, } @@ -124,13 +125,6 @@ impl Default for Blockchain { } } -impl Clone for Blockchain { - fn clone(&self) -> Self { - let storage = Arc::new(RwLock::new(self.storage.read().clone())); - Blockchain { storage } - } -} - impl Blockchain { /// Get header hash of given block. pub fn id(&self, id: BlockId) -> Option { From bc8f2db2cca2bac2d780569050c9ba4d751be45c Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Sat, 29 Apr 2023 18:07:55 +0200 Subject: [PATCH 91/93] Contracts: runtime_call and storage_deposit (#13990) * wip * add comments * fix comment * comments * comments * PR comment * field orders * Update frame/contracts/src/tests.rs * Update frame/contracts/fixtures/call_runtime_and_call.wat Co-authored-by: Sasha Gryaznov * Apply suggestions from code review Co-authored-by: Sasha Gryaznov * Apply suggestions from code review Co-authored-by: Sasha Gryaznov * Update frame/contracts/src/tests.rs Co-authored-by: Sasha Gryaznov * Validate fees of failed call * Update frame/contracts/src/tests.rs * Update frame/contracts/src/tests.rs * Update frame/contracts/src/tests.rs * bubble up refund error * rename fixture file --------- Co-authored-by: Sasha Gryaznov Co-authored-by: parity-processbot <> --- Cargo.lock | 1 + frame/contracts/Cargo.toml | 1 + .../fixtures/call_runtime_and_call.wat | 56 +++++++++++ frame/contracts/src/lib.rs | 13 ++- frame/contracts/src/storage/meter.rs | 86 +++++----------- frame/contracts/src/tests.rs | 99 ++++++++++++++++++- 6 files changed, 189 insertions(+), 67 deletions(-) create mode 100644 frame/contracts/fixtures/call_runtime_and_call.wat diff --git a/Cargo.lock b/Cargo.lock index 420c9040897b5..a1244f2711beb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5922,6 +5922,7 @@ dependencies = [ "pallet-contracts-primitives", "pallet-contracts-proc-macro", "pallet-insecure-randomness-collective-flip", + "pallet-proxy", "pallet-timestamp", "pallet-utility", "parity-scale-codec", diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index 6ab60846fd412..edb6d294cfcd5 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -59,6 +59,7 @@ pallet-balances = { version = "4.0.0-dev", path = "../balances" } pallet-timestamp = { version = "4.0.0-dev", path = "../timestamp" } pallet-insecure-randomness-collective-flip = { version = "4.0.0-dev", path = "../insecure-randomness-collective-flip" } pallet-utility = { version = "4.0.0-dev", path = "../utility" } +pallet-proxy = { version = "4.0.0-dev", path = "../proxy" } sp-keystore = { version = "0.13.0", path = "../../primitives/keystore" } [features] diff --git a/frame/contracts/fixtures/call_runtime_and_call.wat b/frame/contracts/fixtures/call_runtime_and_call.wat new file mode 100644 index 0000000000000..3320922d9e2cb --- /dev/null +++ b/frame/contracts/fixtures/call_runtime_and_call.wat @@ -0,0 +1,56 @@ +(module + (import "seal0" "call_runtime" (func $call_runtime (param i32 i32) (result i32))) + (import "seal1" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32) (result i32))) + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) + (import "env" "memory" (memory 1 1)) + + (func $assert (param i32) + (block $ok + (br_if $ok (get_local 0)) + (unreachable) + ) + ) + + (func (export "call") + ;; Store available input size at offset 0. + (i32.store (i32.const 0) (i32.const 512)) + + ;; read input data + (call $seal_input (i32.const 4) (i32.const 0)) + + ;; Input data layout. + ;; [0..4) - size of the call + ;; [4..8) - how many bytes to add to storage + ;; [8..40) - address of the callee + ;; [40..n) - encoded runtime call + + ;; Invoke call_runtime with the encoded call passed to this contract. + (call $assert (i32.eqz + (call $call_runtime + (i32.const 40) ;; Pointer where the call is stored + (i32.sub + (i32.load (i32.const 0)) ;; Size of the call + (i32.const 36) ;; Subtract size of the subcall-related part: 4 bytes for storage length to add + 32 bytes of the callee address + ) + ) + )) + + ;; call passed contract + (call $assert (i32.eqz + (call $seal_call + (i32.const 0) ;; No flags + (i32.const 8) ;; Pointer to "callee" address. + (i64.const 0) ;; How much gas to devote for the execution. 0 = all. + (i32.const 512) ;; Pointer to the buffer with value to transfer + (i32.const 4) ;; Pointer to input data buffer address + (i32.const 4) ;; Length of input data buffer + (i32.const 4294967295) ;; u32 max value is the sentinel value: do not copy output + (i32.const 0) ;; Length is ignored in this case + ) + )) + ) + + (func (export "deploy")) +) + diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 5a82a4a42b4a9..24653423b4f67 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -1044,7 +1044,15 @@ impl Invokable for CallInput { debug_message, *determinism, ); - InternalOutput { gas_meter, storage_deposit: storage_meter.into_deposit(&origin), result } + + match storage_meter.try_into_deposit(&origin) { + Ok(storage_deposit) => InternalOutput { gas_meter, storage_deposit, result }, + Err(err) => InternalOutput { + gas_meter, + storage_deposit: Default::default(), + result: Err(err.into()), + }, + } } } @@ -1105,8 +1113,9 @@ impl Invokable for InstantiateInput { &salt, debug_message, ); + storage_deposit = storage_meter - .into_deposit(&origin) + .try_into_deposit(&origin)? .saturating_add(&StorageDeposit::Charge(extra_deposit)); result }; diff --git a/frame/contracts/src/storage/meter.rs b/frame/contracts/src/storage/meter.rs index b8bbd6dc4178b..73794b59774d4 100644 --- a/frame/contracts/src/storage/meter.rs +++ b/frame/contracts/src/storage/meter.rs @@ -19,7 +19,7 @@ use crate::{ storage::{ContractInfo, DepositAccount}, - BalanceOf, Config, Error, Inspect, Pallet, System, LOG_TARGET, + BalanceOf, Config, Error, Inspect, Pallet, System, }; use codec::Encode; use frame_support::{ @@ -85,7 +85,7 @@ pub trait Ext { deposit_account: &DepositAccount, amount: &DepositOf, terminated: bool, - ); + ) -> Result<(), DispatchError>; } /// This [`Ext`] is used for actual on-chain execution when balance needs to be charged. @@ -366,14 +366,14 @@ where /// /// This drops the root meter in order to make sure it is only called when the whole /// execution did finish. - pub fn into_deposit(self, origin: &T::AccountId) -> DepositOf { + pub fn try_into_deposit(self, origin: &T::AccountId) -> Result, DispatchError> { for charge in self.charges.iter().filter(|c| matches!(c.amount, Deposit::Refund(_))) { - E::charge(origin, &charge.deposit_account, &charge.amount, charge.terminated); + E::charge(origin, &charge.deposit_account, &charge.amount, charge.terminated)?; } for charge in self.charges.iter().filter(|c| matches!(c.amount, Deposit::Charge(_))) { - E::charge(origin, &charge.deposit_account, &charge.amount, charge.terminated); + E::charge(origin, &charge.deposit_account, &charge.amount, charge.terminated)?; } - self.total_deposit + Ok(self.total_deposit) } } @@ -428,7 +428,8 @@ where info.deposit_account(), &deposit.saturating_sub(&Deposit::Charge(ed)), false, - ); + )?; + System::::inc_consumers(info.deposit_account())?; // We also need to make sure that the contract's account itself exists. @@ -514,71 +515,27 @@ impl Ext for ReservingExt { deposit_account: &DepositAccount, amount: &DepositOf, terminated: bool, - ) { - // There is nothing we can do when this fails as this constitutes a bug in the runtime. - // We need to settle for emitting an error log in this case. - // - // # Note - // - // This is infallible because it is called in a part of the execution where we cannot - // simply roll back. It might make sense to do some refactoring to move the deposit - // collection to the fallible part of execution. + ) -> Result<(), DispatchError> { match amount { - Deposit::Charge(amount) => { - // This will never fail because a deposit account is required to exist - // at all times. The pallet enforces this invariant by holding a consumer reference - // on the deposit account as long as the contract exists. - // - // The sender always has enough balance because we checked that it had enough - // balance when instantiating the storage meter. There is no way for the sender - // which is a plain account to send away this balance in the meantime. - let result = T::Currency::transfer( - origin, - deposit_account, - *amount, - ExistenceRequirement::KeepAlive, - ); - if let Err(err) = result { - log::error!( - target: LOG_TARGET, - "Failed to transfer storage deposit {:?} from origin {:?} to deposit account {:?}: {:?}", - amount, origin, deposit_account, err, - ); - if cfg!(debug_assertions) { - panic!("Unable to collect storage deposit. This is a bug."); - } - } - }, - // The receiver always exists because the initial value transfer from the - // origin to the contract has a keep alive existence requirement. When taking a deposit - // we make sure to leave at least the ed in the free balance. - // - // The sender always has enough balance because we track it in the `ContractInfo` and - // never send more back than we have. No one has access to the deposit account. Hence no - // other interaction with this account takes place. + Deposit::Charge(amount) => T::Currency::transfer( + origin, + deposit_account, + *amount, + ExistenceRequirement::KeepAlive, + ), Deposit::Refund(amount) => { if terminated { System::::dec_consumers(&deposit_account); } - let result = T::Currency::transfer( + T::Currency::transfer( deposit_account, origin, *amount, // We can safely use `AllowDeath` because our own consumer prevents an removal. ExistenceRequirement::AllowDeath, - ); - if matches!(result, Err(_)) { - log::error!( - target: LOG_TARGET, - "Failed to refund storage deposit {:?} from deposit account {:?} to origin {:?}: {:?}", - amount, deposit_account, origin, result, - ); - if cfg!(debug_assertions) { - panic!("Unable to refund storage deposit. This is a bug."); - } - } + ) }, - }; + } } } @@ -651,7 +608,7 @@ mod tests { contract: &DepositAccount, amount: &DepositOf, terminated: bool, - ) { + ) -> Result<(), DispatchError> { TestExtTestValue::mutate(|ext| { ext.charges.push(Charge { origin: origin.clone(), @@ -660,6 +617,7 @@ mod tests { terminated, }) }); + Ok(()) } } @@ -757,7 +715,7 @@ mod tests { nested0.enforce_limit(Some(&mut nested0_info)).unwrap(); meter.absorb(nested0, DepositAccount(BOB), Some(&mut nested0_info)); - meter.into_deposit(&ALICE); + meter.try_into_deposit(&ALICE).unwrap(); assert_eq!(nested0_info.extra_deposit(), 112); assert_eq!(nested1_info.extra_deposit(), 110); @@ -817,7 +775,7 @@ mod tests { nested0.absorb(nested1, DepositAccount(CHARLIE), None); meter.absorb(nested0, DepositAccount(BOB), None); - meter.into_deposit(&ALICE); + meter.try_into_deposit(&ALICE).unwrap(); assert_eq!( TestExtTestValue::get(), diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 697b58f15c609..c202d3796e3ed 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -33,7 +33,7 @@ use crate::{ use assert_matches::assert_matches; use codec::Encode; use frame_support::{ - assert_err, assert_err_ignore_postinfo, assert_noop, assert_ok, + assert_err, assert_err_ignore_postinfo, assert_err_with_weight, assert_noop, assert_ok, dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo}, parameter_types, storage::child, @@ -70,6 +70,7 @@ frame_support::construct_runtime!( Randomness: pallet_insecure_randomness_collective_flip::{Pallet, Storage}, Utility: pallet_utility::{Pallet, Call, Storage, Event}, Contracts: pallet_contracts::{Pallet, Call, Storage, Event}, + Proxy: pallet_proxy::{Pallet, Call, Storage, Event}, } ); @@ -337,6 +338,22 @@ impl pallet_utility::Config for Test { type PalletsOrigin = OriginCaller; type WeightInfo = (); } + +impl pallet_proxy::Config for Test { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type ProxyType = (); + type ProxyDepositBase = ConstU64<1>; + type ProxyDepositFactor = ConstU64<1>; + type MaxProxies = ConstU32<32>; + type WeightInfo = (); + type MaxPending = ConstU32<32>; + type CallHasher = BlakeTwo256; + type AnnouncementDepositBase = ConstU64<1>; + type AnnouncementDepositFactor = ConstU64<1>; +} + parameter_types! { pub MySchedule: Schedule = { let mut schedule = >::default(); @@ -2983,6 +3000,86 @@ fn sr25519_verify() { }) } +#[test] +fn failed_deposit_charge_should_roll_back_call() { + let (wasm_caller, _) = compile_module::("call_runtime_and_call").unwrap(); + let (wasm_callee, _) = compile_module::("store_call").unwrap(); + const ED: u64 = 200; + + let execute = || { + ExtBuilder::default().existential_deposit(ED).build().execute_with(|| { + let _ = Balances::deposit_creating(&ALICE, 1_000_000); + + // Instantiate both contracts. + let addr_caller = Contracts::bare_instantiate( + ALICE, + 0, + GAS_LIMIT, + None, + Code::Upload(wasm_caller.clone()), + vec![], + vec![], + false, + ) + .result + .unwrap() + .account_id; + let addr_callee = Contracts::bare_instantiate( + ALICE, + 0, + GAS_LIMIT, + None, + Code::Upload(wasm_callee.clone()), + vec![], + vec![], + false, + ) + .result + .unwrap() + .account_id; + + // Give caller proxy access to Alice. + assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(ALICE), addr_caller.clone(), (), 0)); + + // Create a Proxy call that will attempt to transfer away Alice's balance. + let transfer_call = + Box::new(RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { + dest: CHARLIE, + value: pallet_balances::Pallet::::free_balance(&ALICE) - 2 * ED, + })); + + // Wrap the transfer call in a proxy call. + let transfer_proxy_call = RuntimeCall::Proxy(pallet_proxy::Call::proxy { + real: ALICE, + force_proxy_type: Some(()), + call: transfer_call, + }); + + let data = ( + (ED - DepositPerItem::get()) as u32, // storage length + addr_callee, + transfer_proxy_call, + ); + + >::call( + RuntimeOrigin::signed(ALICE), + addr_caller.clone(), + 0, + GAS_LIMIT, + None, + data.encode(), + ) + }) + }; + + // With a low enough deposit per byte, the call should succeed. + let result = execute().unwrap(); + + // Bump the deposit per byte to a high value to trigger a FundsUnavailable error. + DEPOSIT_PER_BYTE.with(|c| *c.borrow_mut() = ED); + assert_err_with_weight!(execute(), TokenError::FundsUnavailable, result.actual_weight); +} + #[test] fn upload_code_works() { let (wasm, code_hash) = compile_module::("dummy").unwrap(); From e699560d2037d155e6054c05b6334a6e9fa64926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 1 May 2023 09:47:43 +0200 Subject: [PATCH 92/93] Fix bags-list tests execution (#14047) The `test` feature isn't propagated to dependencies in Rust, so we should just enable the method as well for `std`. --- frame/bags-list/src/lib.rs | 2 +- frame/bags-list/src/mock.rs | 7 ++++--- frame/election-provider-support/src/lib.rs | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/frame/bags-list/src/lib.rs b/frame/bags-list/src/lib.rs index 87eb2d1b341aa..d4d54b9a134bb 100644 --- a/frame/bags-list/src/lib.rs +++ b/frame/bags-list/src/lib.rs @@ -397,7 +397,7 @@ impl, I: 'static> ScoreProvider for Pallet { Node::::get(id).map(|node| node.score()).unwrap_or_default() } - frame_election_provider_support::runtime_benchmarks_or_fuzz_enabled! { + frame_election_provider_support::runtime_benchmarks_fuzz_or_std_enabled! { fn set_score_of(id: &T::AccountId, new_score: T::Score) { ListNodes::::mutate(id, |maybe_node| { if let Some(node) = maybe_node.as_mut() { diff --git a/frame/bags-list/src/mock.rs b/frame/bags-list/src/mock.rs index a48b66b200e8e..efbb2ed94c49f 100644 --- a/frame/bags-list/src/mock.rs +++ b/frame/bags-list/src/mock.rs @@ -40,9 +40,10 @@ impl frame_election_provider_support::ScoreProvider for StakingMock { *NextVoteWeightMap::get().get(id).unwrap_or(&NextVoteWeight::get()) } - #[cfg(any(feature = "runtime-benchmarks", feature = "fuzz", test))] - fn set_score_of(id: &AccountId, weight: Self::Score) { - NEXT_VOTE_WEIGHT_MAP.with(|m| m.borrow_mut().insert(*id, weight)); + frame_election_provider_support::runtime_benchmarks_fuzz_or_std_enabled! { + fn set_score_of(id: &AccountId, weight: Self::Score) { + NEXT_VOTE_WEIGHT_MAP.with(|m| m.borrow_mut().insert(*id, weight)); + } } } diff --git a/frame/election-provider-support/src/lib.rs b/frame/election-provider-support/src/lib.rs index 750ccca46213f..ee0e41a90cd60 100644 --- a/frame/election-provider-support/src/lib.rs +++ b/frame/election-provider-support/src/lib.rs @@ -582,7 +582,7 @@ pub trait ScoreProvider { fn score(who: &AccountId) -> Self::Score; /// For tests, benchmarks and fuzzing, set the `score`. - #[cfg(any(feature = "runtime-benchmarks", feature = "fuzz", test))] + #[cfg(any(feature = "runtime-benchmarks", feature = "fuzz", feature = "std"))] fn set_score_of(_: &AccountId, _: Self::Score) {} } @@ -673,5 +673,14 @@ pub type BoundedSupportsOf = BoundedSupports< ::MaxWinners, >; -sp_core::generate_feature_enabled_macro!(runtime_benchmarks_enabled, feature = "runtime-benchmarks", $); -sp_core::generate_feature_enabled_macro!(runtime_benchmarks_or_fuzz_enabled, any(feature = "runtime-benchmarks", feature = "fuzzing"), $); +sp_core::generate_feature_enabled_macro!( + runtime_benchmarks_enabled, + feature = "runtime-benchmarks", + $ +); + +sp_core::generate_feature_enabled_macro!( + runtime_benchmarks_fuzz_or_std_enabled, + any(feature = "runtime-benchmarks", feature = "fuzzing", feature = "std"), + $ +); From 890451221db37176e13cb1a306246f02de80590a Mon Sep 17 00:00:00 2001 From: Vladimir Istyufeev Date: Tue, 2 May 2023 13:34:14 +0400 Subject: [PATCH 93/93] CI: migrate to Google Cloud (#13994) --- .gitlab-ci.yml | 10 +++++++--- scripts/ci/gitlab/pipeline/test.yml | 2 -- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 100dd0d3d3ed9..f9b4763c12f3c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,9 +33,9 @@ stages: - test - build - publish + - notify - zombienet - deploy - - notify workflow: rules: @@ -46,15 +46,19 @@ variables: GIT_STRATEGY: fetch GIT_DEPTH: 100 CARGO_INCREMENTAL: 0 - DOCKER_OS: "debian:stretch" + DOCKER_OS: "debian:bullseye" ARCH: "x86_64" CI_IMAGE: "paritytech/ci-linux:production" BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29" BUILDAH_COMMAND: "buildah --storage-driver overlay2" RELENG_SCRIPTS_BRANCH: "master" + RUSTY_CACHIER_SINGLE_BRANCH: master RUSTY_CACHIER_DONT_OPERATE_ON_MAIN_BRANCH: "true" + RUSTY_CACHIER_MINIO_ALIAS: rustycachier_gcs + RUSTY_CACHIER_MINIO_BUCKET: parity-build-rusty-cachier RUSTY_CACHIER_COMPRESSION_METHOD: zstd + NEXTEST_FAILURE_OUTPUT: immediate-final NEXTEST_SUCCESS_OUTPUT: final ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.43" @@ -141,7 +145,7 @@ default: after_script: - !reference [.rusty-cachier, after_script] tags: - - linux-docker + - linux-docker-vm-c2 # rusty-cachier's hidden job. Parts of this job are used to instrument the pipeline's other real jobs with rusty-cachier # Description of the commands is available here - https://gitlab.parity.io/parity/infrastructure/ci_cd/rusty-cachier/client#description diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index c73268caa79af..82f024d35e695 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -115,8 +115,6 @@ cargo-check-benches: | tee ./artifacts/benches/$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA/::node::import::native::sr25519::transfer_keep_alive::paritydb::small.json ;; esac - tags: - - linux-docker-benches node-bench-regression-guard: # it's not belong to `build` semantically, but dag jobs can't depend on each other