From 1732628b3ae8aec4736ecc1a1d1de26d6c47a09d Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 23 May 2024 11:59:08 +0200 Subject: [PATCH 01/58] Add transient storage --- substrate/frame/contracts/src/exec.rs | 52 +++++++ substrate/frame/contracts/src/lib.rs | 1 + .../frame/contracts/src/transient_storage.rs | 139 ++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 substrate/frame/contracts/src/transient_storage.rs diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 21ebb1e8c5f3..2fbd0e0f964d 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -20,6 +20,7 @@ use crate::{ gas::GasMeter, primitives::{ExecReturnValue, StorageDeposit}, storage::{self, meter::Diff, WriteOutcome}, + transient_storage::TransientStorage, BalanceOf, CodeHash, CodeInfo, CodeInfoOf, Config, ContractInfo, ContractInfoOf, DebugBufferVec, Determinism, Error, Event, Nonce, Origin, Pallet as Contracts, Schedule, LOG_TARGET, @@ -208,6 +209,27 @@ pub trait Ext: sealing::Sealed { take_old: bool, ) -> Result; + /// Returns the storage entry of the executing account by the given `key`. + /// + /// Returns `None` if the `key` wasn't previously set by `set_storage` or + /// was deleted. + fn get_transient_storage(&self, key: &Key) -> Option>; + + /// Returns `Some(len)` (in bytes) if a storage item exists at `key`. + /// + /// Returns `None` if the `key` wasn't previously set by `set_storage` or + /// was deleted. + fn get_transient_storage_size(&self, key: &Key) -> Option; + + /// Sets the storage entry by the given key to the specified value. If `value` is `None` then + /// the storage entry is deleted. + fn set_transient_storage( + &mut self, + key: &Key, + value: Option>, + take_old: bool, + ) -> Result; + /// Returns the caller. fn caller(&self) -> Origin; @@ -470,6 +492,8 @@ pub struct Stack<'a, T: Config, E> { debug_message: Option<&'a mut DebugBufferVec>, /// The determinism requirement of this call stack. determinism: Determinism, + /// Transient storage + transient_storage: TransientStorage, /// No executable is held by the struct but influences its behaviour. _phantom: PhantomData, } @@ -790,6 +814,7 @@ where frames: Default::default(), debug_message, determinism, + transient_storage: TransientStorage::new(738 * 1024), _phantom: Default::default(), }; @@ -916,6 +941,9 @@ where let entry_point = frame.entry_point; let delegated_code_hash = if frame.delegate_caller.is_some() { Some(*executable.code_hash()) } else { None }; + + self.transient_storage.start_transaction(); + let do_transaction = || { // We need to charge the storage deposit before the initial transfer so that // it can create the account in case the initial transfer is < ed. @@ -1036,6 +1064,12 @@ where Err(error) => (false, Err(error.into())), }; + if success { + self.transient_storage.commit_transaction(); + } else { + self.transient_storage.rollback_transaction(); + } + self.pop_frame(success); output } @@ -1358,6 +1392,24 @@ where ) } + fn get_transient_storage(&self, key: &Key) -> Option> { + self.transient_storage.read(self.address(), key) + } + + fn get_transient_storage_size(&self, key: &Key) -> Option { + self.transient_storage.read(self.address(), key).map(|value| value.len() as _) + } + + fn set_transient_storage( + &mut self, + key: &Key, + value: Option>, + take_old: bool, + ) -> Result { + let account_id = self.address().clone(); + self.transient_storage.write(&account_id, key, value, take_old) + } + fn address(&self) -> &T::AccountId { &self.top_frame().account_id } diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index d20f3c15fb56..db32261c0e7a 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -96,6 +96,7 @@ pub use primitives::*; mod schedule; mod storage; +mod transient_storage; mod wasm; pub mod chain_extension; diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs new file mode 100644 index 000000000000..5b7e9a0e99c1 --- /dev/null +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -0,0 +1,139 @@ +// 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. + +//! This module contains routines for accessing and altering a contract transient storage. + +use crate::{ + exec::{AccountIdOf, Key}, + storage::WriteOutcome, + Config, +}; +use sp_runtime::DispatchError; +use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec}; + +type Value = Vec; +type StorageKey = Vec; + +#[derive(Clone)] +struct JournalEntry { + account: AccountIdOf, + key: StorageKey, + prev_value: Option, +} + +type Journal = Vec>; +type Checkpoints = Vec; + +pub struct TransientStorage { + current: BTreeMap, BTreeMap>, + journal: Journal, + checkpoints: Checkpoints, + max_capacity: usize, // maximum capacity in bytes + current_size: usize, // current used size in bytes +} + +impl TransientStorage { + pub fn new(max_capacity: usize) -> Self { + TransientStorage { + current: BTreeMap::new(), + journal: vec![], + checkpoints: vec![0], + max_capacity, + current_size: 0, + } + } + + pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option { + self.current.get(account).and_then(|map| map.get(&key.hash())).cloned() + } + + pub fn write( + &mut self, + account: &AccountIdOf, + key: &Key, + value: Option, + take: bool, + ) -> Result { + let old_value = self.read(&account, &key); + let key = key.hash(); + + // Calculate new size and check if it exceeds capacity + let old_size = old_value.as_ref().map(|e| e.len()).unwrap_or_default(); + let new_size = value.as_ref().map(|e| e.len()).unwrap_or_default(); + if self.current_size + new_size - old_size > self.max_capacity { + // TODO: some error + } + + // Update current size + self.current_size = self.current_size + new_size - old_size; + + // Update the journal + self.journal.push(JournalEntry { + account: account.clone(), + key: key.clone(), + prev_value: old_value.clone(), + }); + + // Update the current state + if let Some(value) = value { + self.current + .entry(account.clone()) + .or_insert_with(BTreeMap::new) + .insert(key, value); + } else { + self.current.entry(account.clone()).and_modify(|e| { + e.remove(&key); + }); + } + + Ok(match (take, old_value) { + (_, None) => WriteOutcome::New, + (false, Some(_)) => WriteOutcome::Overwritten(old_size as _), + (true, Some(old_value)) => WriteOutcome::Taken(old_value), + }) + } + + pub fn commit_transaction(&mut self) { + self.checkpoints + .pop() + .expect("No open transient storage transaction that can be committed."); + } + + pub fn start_transaction(&mut self) { + self.checkpoints.push(self.journal.len()); + } + + pub fn rollback_transaction(&mut self) { + let last_checkpoint = self + .checkpoints + .pop() + .expect("No open transient storage transaction that can be rolled back."); + + for i in (last_checkpoint..self.journal.len()).rev() { + let JournalEntry { account, key, prev_value } = &self.journal[i]; + if let Some(map) = self.current.get_mut(account) { + if let Some(prev_value) = prev_value { + map.insert(key.clone(), prev_value.clone()); + } else { + map.remove(key); + } + } + } + + self.journal.truncate(last_checkpoint); + } +} From 6cda150770398bfb44a3a205bfe9ab1882223e50 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 23 May 2024 15:02:42 +0200 Subject: [PATCH 02/58] Add unit tests --- substrate/frame/contracts/src/exec.rs | 134 ++++++++++++++++++++++ substrate/frame/contracts/src/wasm/mod.rs | 27 +++++ 2 files changed, 161 insertions(+) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 2fbd0e0f964d..6cfdbe335f22 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -3820,6 +3820,140 @@ mod tests { }); } + #[test] + fn transient_storage_works() { + // Call stack: BOB -> CHARLIE(success) -> BOB' (success) + let storage_key_1 = &Key::Fix([1; 32]); + let storage_key_2 = &Key::Fix([2; 32]); + let code_bob = MockLoader::insert(Call, |ctx, _| { + if ctx.input_data[0] == 0 { + assert_eq!( + ctx.ext.set_transient_storage(storage_key_1, Some(vec![1, 2]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + true + ), + exec_success() + ); + assert_eq!(ctx.ext.get_transient_storage(storage_key_1), Some(vec![3])); + assert_eq!(ctx.ext.get_transient_storage(storage_key_2), Some(vec![4])); + } else { + assert_eq!( + ctx.ext.set_transient_storage(storage_key_1, Some(vec![3]), true), + Ok(WriteOutcome::Taken(vec![1, 2])) + ); + assert_eq!( + ctx.ext.set_transient_storage(storage_key_2, Some(vec![4]), false), + Ok(WriteOutcome::New) + ); + } + exec_success() + }); + let code_charlie = MockLoader::insert(Call, |ctx, _| { + assert!(ctx + .ext + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true) + .is_ok()); + // CHARLIE can not read BOB`s storage. + assert_eq!(ctx.ext.get_transient_storage(storage_key_1), None); + exec_success() + }); + + // This one tests passing the input data into a contract via call. + ExtBuilder::default().build().execute_with(|| { + let schedule = ::Schedule::get(); + place_contract(&BOB, code_bob); + place_contract(&CHARLIE, code_charlie); + let contract_origin = Origin::from_account_id(ALICE); + let mut storage_meter = + storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); + + let result = MockStack::run_call( + contract_origin, + BOB, + &mut GasMeter::::new(GAS_LIMIT), + &mut storage_meter, + &schedule, + 0, + vec![0], + None, + Determinism::Enforced, + ); + assert_matches!(result, Ok(_)); + }); + } + + #[test] + fn transient_storage_rollback_works() { + // Call stack: BOB -> CHARLIE (trap) -> BOB' (success) + let storage_key = &Key::Fix([1; 32]); + let code_bob = MockLoader::insert(Call, |ctx, _| { + if ctx.input_data[0] == 0 { + assert_eq!( + ctx.ext.set_transient_storage(storage_key, Some(vec![1, 2]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + true + ), + exec_trapped() + ); + assert_eq!(ctx.ext.get_transient_storage(storage_key), Some(vec![1, 2])); + } else { + let overwritten_length = ctx.ext.get_transient_storage_size(storage_key).unwrap(); + assert_eq!( + ctx.ext.set_transient_storage(storage_key, Some(vec![3]), false), + Ok(WriteOutcome::Overwritten(overwritten_length)) + ); + assert_eq!(ctx.ext.get_transient_storage(storage_key), Some(vec![3])); + } + exec_success() + }); + let code_charlie = MockLoader::insert(Call, |ctx, _| { + assert!(ctx + .ext + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true) + .is_ok()); + exec_trapped() + }); + + // This one tests passing the input data into a contract via call. + ExtBuilder::default().build().execute_with(|| { + let schedule = ::Schedule::get(); + place_contract(&BOB, code_bob); + place_contract(&CHARLIE, code_charlie); + let contract_origin = Origin::from_account_id(ALICE); + let mut storage_meter = + storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); + + let result = MockStack::run_call( + contract_origin, + BOB, + &mut GasMeter::::new(GAS_LIMIT), + &mut storage_meter, + &schedule, + 0, + vec![0], + None, + Determinism::Enforced, + ); + assert_matches!(result, Ok(_)); + }); + } + #[test] fn ecdsa_to_eth_address_returns_proper_value() { let bob_ch = MockLoader::insert(Call, |ctx, _| { diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index b40eb699db9e..70b2535b2f8f 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -552,6 +552,7 @@ mod tests { pub struct MockExt { storage: HashMap, Vec>, + transient_storage: HashMap, Vec>, instantiates: Vec, terminations: Vec, calls: Vec, @@ -580,6 +581,7 @@ mod tests { Self { code_hashes: Default::default(), storage: Default::default(), + transient_storage: Default::default(), instantiates: Default::default(), terminations: Default::default(), calls: Default::default(), @@ -679,6 +681,31 @@ mod tests { } Ok(result) } + fn get_transient_storage(&self, key: &Key) -> Option> { + self.transient_storage.get(&key.to_vec()).cloned() + } + fn get_transient_storage_size(&self, key: &Key) -> Option { + self.transient_storage.get(&key.to_vec()).map(|val| val.len() as u32) + } + fn set_transient_storage( + &mut self, + key: &Key, + value: Option>, + take_old: bool, + ) -> Result { + let key = key.to_vec(); + let entry = self.storage.entry(key.clone()); + let result = match (entry, take_old) { + (Entry::Vacant(_), _) => WriteOutcome::New, + (Entry::Occupied(entry), false) => + WriteOutcome::Overwritten(entry.remove().len() as u32), + (Entry::Occupied(entry), true) => WriteOutcome::Taken(entry.remove()), + }; + if let Some(value) = value { + self.transient_storage.insert(key, value); + } + Ok(result) + } fn caller(&self) -> Origin { self.caller.clone() } From 826e0738f2646783c32f6ab109c51f4dd7208b46 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 23 May 2024 22:52:56 +0200 Subject: [PATCH 03/58] Add storage limit --- substrate/frame/contracts/src/exec.rs | 2 +- substrate/frame/contracts/src/lib.rs | 7 +- substrate/frame/contracts/src/schedule.rs | 4 + .../frame/contracts/src/transient_storage.rs | 27 +++--- substrate/frame/contracts/src/wasm/runtime.rs | 83 +++++++++++++++++++ 5 files changed, 107 insertions(+), 16 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 48c3a8975224..c40cb3dd4c90 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -819,7 +819,7 @@ where frames: Default::default(), debug_message, determinism, - transient_storage: TransientStorage::new(738 * 1024), + transient_storage: TransientStorage::new(T::Schedule::get().limits.transient_storage), _phantom: Default::default(), }; diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 7a748ad6edbd..9486db0f4197 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -606,7 +606,7 @@ pub mod pallet { // Max call depth is CallStack::size() + 1 let max_call_depth = u32::try_from(T::CallStack::size().saturating_add(1)) .expect("CallStack size is too big"); - + let max_transient_storage_size = T::Schedule::get().limits.transient_storage; // Check that given configured `MaxCodeLen`, runtime heap memory limit can't be broken. // // In worst case, the decoded Wasm contract code would be `x16` times larger than the @@ -630,7 +630,7 @@ pub mod pallet { // // This gives us the following formula: // - // `(MaxCodeLen * 17 * 4 + MAX_STACK_SIZE + max_heap_size) * max_call_depth < + // `(MaxCodeLen * 17 * 4 + MAX_STACK_SIZE + max_heap_size + max_transient_storage_size) * max_call_depth < // max_runtime_mem/2` // // Hence the upper limit for the `MaxCodeLen` can be defined as follows: @@ -639,6 +639,7 @@ pub mod pallet { .saturating_div(max_call_depth) .saturating_sub(max_heap_size) .saturating_sub(MAX_STACK_SIZE) + .saturating_sub(max_transient_storage_size) .saturating_div(17 * 4); assert!( @@ -1234,6 +1235,8 @@ pub mod pallet { DelegateDependencyAlreadyExists, /// Can not add a delegate dependency to the code hash of the contract itself. CannotAddSelfAsDelegateDependency, + /// Can not add more data to transient storage. + OutOfStorage, } /// A reason for the pallet contracts placing a hold on funds. diff --git a/substrate/frame/contracts/src/schedule.rs b/substrate/frame/contracts/src/schedule.rs index a1fbdea4228b..a8ce7fae0cde 100644 --- a/substrate/frame/contracts/src/schedule.rs +++ b/substrate/frame/contracts/src/schedule.rs @@ -82,6 +82,9 @@ pub struct Limits { /// The maximum node runtime memory. This is for integrity checks only and does not affect the /// real setting. pub runtime_memory: u32, + + // The maximum size of data that can be kept in transient storage. + pub transient_storage: u32, } impl Limits { @@ -114,6 +117,7 @@ impl Default for Limits { subject_len: 32, payload_len: 16 * 1024, runtime_memory: 1024 * 1024 * 128, + transient_storage: 448 * 1024, } } } diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 5b7e9a0e99c1..ad8e7cd3d098 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -20,7 +20,7 @@ use crate::{ exec::{AccountIdOf, Key}, storage::WriteOutcome, - Config, + Config, Error, }; use sp_runtime::DispatchError; use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec}; @@ -47,12 +47,12 @@ pub struct TransientStorage { } impl TransientStorage { - pub fn new(max_capacity: usize) -> Self { + pub fn new(max_capacity: u32) -> Self { TransientStorage { current: BTreeMap::new(), journal: vec![], checkpoints: vec![0], - max_capacity, + max_capacity: max_capacity as _, current_size: 0, } } @@ -71,24 +71,25 @@ impl TransientStorage { let old_value = self.read(&account, &key); let key = key.hash(); - // Calculate new size and check if it exceeds capacity - let old_size = old_value.as_ref().map(|e| e.len()).unwrap_or_default(); - let new_size = value.as_ref().map(|e| e.len()).unwrap_or_default(); - if self.current_size + new_size - old_size > self.max_capacity { - // TODO: some error + // Calculate new size and check if it exceeds capacity. + let old_value_size = old_value.as_ref().map(|e| e.len()).unwrap_or_default(); + let new_value_size = value.as_ref().map(|e| e.len()).unwrap_or_default(); + let size = self.current_size.saturating_sub(old_value_size).saturating_add(new_value_size); + if size > self.max_capacity { + return Err(Error::::OutOfStorage.into()); } - // Update current size - self.current_size = self.current_size + new_size - old_size; + // Update current size. + self.current_size = size; - // Update the journal + // Update the journal. self.journal.push(JournalEntry { account: account.clone(), key: key.clone(), prev_value: old_value.clone(), }); - // Update the current state + // Update the current state. if let Some(value) = value { self.current .entry(account.clone()) @@ -102,7 +103,7 @@ impl TransientStorage { Ok(match (take, old_value) { (_, None) => WriteOutcome::New, - (false, Some(_)) => WriteOutcome::Overwritten(old_size as _), + (false, Some(_)) => WriteOutcome::Overwritten(old_value_size as _), (true, Some(old_value)) => WriteOutcome::Taken(old_value), }) } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 39b15c867c6a..e16e574eff19 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -792,6 +792,89 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { Ok(outcome.unwrap_or(SENTINEL)) } + // TODO: Implement weights + fn set_transient_storage( + &mut self, + memory: &[u8], + key_type: KeyType, + key_ptr: u32, + value_ptr: u32, + value_len: u32, + ) -> Result { + let max_size = self.ext.max_value_size(); + let charged = self + .charge_gas(RuntimeCosts::SetStorage { new_bytes: value_len, old_bytes: max_size })?; + if value_len > max_size { + return Err(Error::::ValueTooLarge.into()) + } + let key = self.decode_key(memory, key_type, key_ptr)?; + let value = Some(self.read_sandbox_memory(memory, value_ptr, value_len)?); + let write_outcome = self.ext.set_transient_storage(&key, value, false)?; + + self.adjust_gas( + charged, + RuntimeCosts::SetStorage { new_bytes: value_len, old_bytes: write_outcome.old_len() }, + ); + Ok(write_outcome.old_len_with_sentinel()) + } + + fn clear_transient_storage( + &mut self, + memory: &[u8], + key_type: KeyType, + key_ptr: u32, + ) -> Result { + let charged = self.charge_gas(RuntimeCosts::ClearStorage(self.ext.max_value_size()))?; + let key = self.decode_key(memory, key_type, key_ptr)?; + let outcome = self.ext.set_transient_storage(&key, None, false)?; + + self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.old_len())); + Ok(outcome.old_len_with_sentinel()) + } + + fn get_transient_storage( + &mut self, + memory: &mut [u8], + key_type: KeyType, + key_ptr: u32, + out_ptr: u32, + out_len_ptr: u32, + ) -> Result { + let charged = self.charge_gas(RuntimeCosts::GetStorage(self.ext.max_value_size()))?; + let key = self.decode_key(memory, key_type, key_ptr)?; + let outcome = self.ext.get_transient_storage(&key); + + if let Some(value) = outcome { + self.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); + self.write_sandbox_output( + memory, + out_ptr, + out_len_ptr, + &value, + false, + already_charged, + )?; + Ok(ReturnErrorCode::Success) + } else { + self.adjust_gas(charged, RuntimeCosts::GetStorage(0)); + Ok(ReturnErrorCode::KeyNotFound) + } + } + + fn contains_transient_storage( + &mut self, + memory: &[u8], + key_type: KeyType, + key_ptr: u32, + ) -> Result { + let charged = self.charge_gas(RuntimeCosts::ContainsStorage(self.ext.max_value_size()))?; + let key = self.decode_key(memory, key_type, key_ptr)?; + let outcome = self.ext.get_storage_size(&key); + + self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.unwrap_or(0))); + Ok(outcome.unwrap_or(SENTINEL)) + } + fn call( &mut self, memory: &mut [u8], From daf9ad1e4f237ab5538341bf03d231855804f2bf Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 24 May 2024 12:12:51 +0200 Subject: [PATCH 04/58] Limit storage per contract --- substrate/frame/contracts/src/lib.rs | 6 +- substrate/frame/contracts/src/schedule.rs | 2 +- .../frame/contracts/src/transient_storage.rs | 113 ++++++++++++++---- 3 files changed, 97 insertions(+), 24 deletions(-) diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 9486db0f4197..398c37d8a323 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -630,16 +630,16 @@ pub mod pallet { // // This gives us the following formula: // - // `(MaxCodeLen * 17 * 4 + MAX_STACK_SIZE + max_heap_size + max_transient_storage_size) * max_call_depth < - // max_runtime_mem/2` + // `(MaxCodeLen * 17 * 4 + MAX_STACK_SIZE + max_heap_size) * max_call_depth + + // max_transient_storage_size < max_runtime_mem/2` // // Hence the upper limit for the `MaxCodeLen` can be defined as follows: let code_len_limit = max_runtime_mem .saturating_div(2) + .saturating_sub(max_transient_storage_size) .saturating_div(max_call_depth) .saturating_sub(max_heap_size) .saturating_sub(MAX_STACK_SIZE) - .saturating_sub(max_transient_storage_size) .saturating_div(17 * 4); assert!( diff --git a/substrate/frame/contracts/src/schedule.rs b/substrate/frame/contracts/src/schedule.rs index a8ce7fae0cde..bbe16387060a 100644 --- a/substrate/frame/contracts/src/schedule.rs +++ b/substrate/frame/contracts/src/schedule.rs @@ -117,7 +117,7 @@ impl Default for Limits { subject_len: 32, payload_len: 16 * 1024, runtime_memory: 1024 * 1024 * 128, - transient_storage: 448 * 1024, + transient_storage: 736 * 1024, } } } diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index ad8e7cd3d098..c4a61d8f0450 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -37,28 +37,35 @@ struct JournalEntry { type Journal = Vec>; type Checkpoints = Vec; +type Storage = (BTreeMap, usize); pub struct TransientStorage { - current: BTreeMap, BTreeMap>, + current: BTreeMap, Storage>, journal: Journal, checkpoints: Checkpoints, - max_capacity: usize, // maximum capacity in bytes - current_size: usize, // current used size in bytes + // Maximum size in bytes per contract. + max_size: usize, } impl TransientStorage { - pub fn new(max_capacity: u32) -> Self { + pub fn new(max_size: u32) -> Self { TransientStorage { - current: BTreeMap::new(), + current: Default::default(), journal: vec![], - checkpoints: vec![0], - max_capacity: max_capacity as _, - current_size: 0, + checkpoints: vec![], + max_size: max_size as _, } } pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option { - self.current.get(account).and_then(|map| map.get(&key.hash())).cloned() + self.current + .get(account) + .and_then(|contract| contract.0.get(&key.hash())) + .cloned() + } + + fn current_size(&self, account: &AccountIdOf) -> usize { + self.current.get(account).map(|contract| contract.1).unwrap_or_default() } pub fn write( @@ -71,17 +78,16 @@ impl TransientStorage { let old_value = self.read(&account, &key); let key = key.hash(); - // Calculate new size and check if it exceeds capacity. + // Calculate new size and check if it exceeds max_size. let old_value_size = old_value.as_ref().map(|e| e.len()).unwrap_or_default(); let new_value_size = value.as_ref().map(|e| e.len()).unwrap_or_default(); - let size = self.current_size.saturating_sub(old_value_size).saturating_add(new_value_size); - if size > self.max_capacity { + + let current_size = self.current_size(account); + let size = current_size.saturating_sub(old_value_size).saturating_add(new_value_size); + if size > self.max_size { return Err(Error::::OutOfStorage.into()); } - // Update current size. - self.current_size = size; - // Update the journal. self.journal.push(JournalEntry { account: account.clone(), @@ -93,11 +99,15 @@ impl TransientStorage { if let Some(value) = value { self.current .entry(account.clone()) - .or_insert_with(BTreeMap::new) + .or_insert_with(|| (BTreeMap::new(), size)) + .0 .insert(key, value); } else { self.current.entry(account.clone()).and_modify(|e| { - e.remove(&key); + { + e.0.remove(&key); + e.1 = size; + }; }); } @@ -126,11 +136,19 @@ impl TransientStorage { for i in (last_checkpoint..self.journal.len()).rev() { let JournalEntry { account, key, prev_value } = &self.journal[i]; - if let Some(map) = self.current.get_mut(account) { + + if let Some(contract) = self.current.get_mut(account) { + // Calculate new size. + let current_value_size = contract.0.len(); + let prev_value_size = prev_value.as_ref().map(|e| e.len()).unwrap_or_default(); + + contract.1 = + contract.1.saturating_sub(current_value_size).saturating_add(prev_value_size); + if let Some(prev_value) = prev_value { - map.insert(key.clone(), prev_value.clone()); + contract.0.insert(key.clone(), prev_value.clone()); } else { - map.remove(key); + contract.0.remove(key); } } } @@ -138,3 +156,58 @@ impl TransientStorage { self.journal.truncate(last_checkpoint); } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::tests::{Test, ALICE, BOB, CHARLIE}; + + #[test] + fn rollback_transaction_works() { + let mut storage = TransientStorage::::new(256); + storage.start_transaction(); + storage.rollback_transaction(); + + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.rollback_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None) + } + + #[test] + fn commit_transaction_works() { + let mut storage = TransientStorage::::new(256); + storage.start_transaction(); + storage.commit_transaction(); + + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])) + } + + #[test] + fn rollback_in_nested_transaction_works() { + let mut storage = TransientStorage::::new(256); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.start_transaction(); + assert_eq!( + storage.write(&BOB, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.rollback_transaction(); + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); + assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), None) + } +} From d4a29be6c8a1c57da0dce4221dbf1eaabce6dd5a Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 28 May 2024 12:30:37 +0200 Subject: [PATCH 05/58] Refactored --- .../frame/contracts/src/transient_storage.rs | 327 ++++++++++++++---- 1 file changed, 260 insertions(+), 67 deletions(-) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index c4a61d8f0450..8b85959f26e0 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -17,57 +17,222 @@ //! This module contains routines for accessing and altering a contract transient storage. +use core::marker::PhantomData; + use crate::{ exec::{AccountIdOf, Key}, storage::WriteOutcome, Config, Error, }; -use sp_runtime::DispatchError; +use sp_runtime::{DispatchError, DispatchResult}; use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec}; type Value = Vec; type StorageKey = Vec; +type State = BTreeMap, Storage>; +type MeterEntries = Vec; + +#[derive(Default)] +struct MeterEntry { + // Allocation commited by subsequent frames. + nested: Diff, + // Current allocation made by frame. + current: Diff, +} + +// impl MeterEntry { +// fn saturating_add(&self, rhs: &Self) -> Self { +// Self { +// bytes_added: self.bytes_added.saturating_add(rhs.bytes_added), +// bytes_removed: self.bytes_removed.saturating_add(rhs.bytes_removed), +// } +// } +// } + + +/// This type is used to describe a storage change when charging from the meter. +#[derive(Default)] +pub struct Diff { + /// How many bytes were added to storage. + pub bytes_added: u32, + /// How many bytes were removed from storage. + pub bytes_removed: u32, +} + +impl Diff { + fn saturating_add(&self, rhs: &Self) -> Self { + Self { + bytes_added: self.bytes_added.saturating_add(rhs.bytes_added), + bytes_removed: self.bytes_removed.saturating_add(rhs.bytes_removed), + } + } +} + +/// Storage meter enforces the limit for each frame and total limit for transaction. +/// It tracks journal and storage allocation. +struct StorageMeter { + limit: u32, + frame_limit: u32, + nested: MeterEntries, + _phantom: PhantomData +} + +impl StorageMeter { + + pub fn new(limit: u32) -> Self { + Self { + limit, + frame_limit: 256, + nested: vec![Default::default()], + _phantom: Default::default() + } + } + + fn charge(&mut self, amount: Diff) -> DispatchResult { + let total: usize = self.nested.iter().sum(); + if let Some(nested_meter) = self.nested.last_mut() { + let current = nested_meter.saturating_add(amount); + if current > self.frame_limit as _ || total > self.limit as _ { + return Err(Error::::OutOfStorage.into()); + } + *nested_meter = current; + } + Ok(()) + } + + fn revert(&mut self) { + self.nested.pop(); + } + + fn start(&mut self) { + self.nested.push(Default::default()); + } + + fn commit(&mut self) { + if let Some(amount) = self.nested.pop() + { + if let Some(nested_meter) = self.nested.last_mut() { + + let total: usize = self.nested.iter().sum(); + } + } + } +} -#[derive(Clone)] struct JournalEntry { account: AccountIdOf, key: StorageKey, prev_value: Option, } -type Journal = Vec>; +impl JournalEntry { + pub fn new(account: AccountIdOf, key: StorageKey, prev_value: Option) -> Self { + Self{ + account, + key, + prev_value, + } + } + + pub fn revert(self, storage: &mut State) { + if let Some(contract) = storage.get_mut(&self.account) { + if let Some(prev_value) = self.prev_value { + contract.insert(self.key, prev_value); + } else { + contract.remove(&self.key); + } + } + } +} + +struct Journal (Vec>); + +impl Journal { + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn push(&mut self, entry: JournalEntry) { + self.0.push(entry); + } + + pub fn len(&self) -> usize { + self.0.len() + } + + pub fn rollback(&mut self, storage: &mut State, checkpoint: usize) { + self.0 + .drain(checkpoint..) + .rev() + .for_each(|entry| entry.revert(storage)); + } +} + type Checkpoints = Vec; -type Storage = (BTreeMap, usize); +struct Storage { + data: BTreeMap, + _phantom: PhantomData, +} + +impl Storage { + pub fn new(max_size: usize) -> Self { + Self { data: Default::default(), _phantom: Default::default() } + } + + pub fn get(&self, key: &StorageKey) -> Option<&Value> { + self.data.get(key) + } + + pub fn try_insert( + &mut self, + key: StorageKey, + value: Value, + meter: &mut StorageMeter, + ) -> DispatchResult { + let new_value_size = value.len(); + meter.charge(new_value_size)?; + self.data.insert(key, value); + Ok(()) + } + + pub fn insert( + &mut self, + key: StorageKey, + value: Value, + ) { + self.data.insert(key, value); + } + + pub fn remove(&mut self, key: &StorageKey) { + self.data.remove(key); + } +} pub struct TransientStorage { - current: BTreeMap, Storage>, + current: State, journal: Journal, + meter: StorageMeter, + // The size of the checkpoints is limited by the stack depth. checkpoints: Checkpoints, - // Maximum size in bytes per contract. - max_size: usize, } impl TransientStorage { pub fn new(max_size: u32) -> Self { TransientStorage { current: Default::default(), - journal: vec![], + journal: Journal::new(), checkpoints: vec![], - max_size: max_size as _, + meter: StorageMeter::new(max_size) } } pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option { self.current .get(account) - .and_then(|contract| contract.0.get(&key.hash())) + .and_then(|contract| contract.data.get(&key.hash())) .cloned() } - fn current_size(&self, account: &AccountIdOf) -> usize { - self.current.get(account).map(|contract| contract.1).unwrap_or_default() - } - pub fn write( &mut self, account: &AccountIdOf, @@ -75,45 +240,37 @@ impl TransientStorage { value: Option, take: bool, ) -> Result { - let old_value = self.read(&account, &key); - let key = key.hash(); - - // Calculate new size and check if it exceeds max_size. - let old_value_size = old_value.as_ref().map(|e| e.len()).unwrap_or_default(); - let new_value_size = value.as_ref().map(|e| e.len()).unwrap_or_default(); - - let current_size = self.current_size(account); - let size = current_size.saturating_sub(old_value_size).saturating_add(new_value_size); - if size > self.max_size { - return Err(Error::::OutOfStorage.into()); - } + let old_value = self.read(account, key); + // Skip if the same value is being set. + if old_value != value { + let key: Vec = key.hash(); + // Update the current state. + if let Some(value) = value { + // Insert storage value. + self.current + .entry(account.clone()) + .or_insert_with(|| Storage::new(256)) + .try_insert(key.clone(), value, &mut self.meter)?; + } else { + // Remove storage entry. + self.current.entry(account.clone()).and_modify(|contract| { + { + contract.remove(&key); + }; + }); + } - // Update the journal. - self.journal.push(JournalEntry { - account: account.clone(), - key: key.clone(), - prev_value: old_value.clone(), - }); - - // Update the current state. - if let Some(value) = value { - self.current - .entry(account.clone()) - .or_insert_with(|| (BTreeMap::new(), size)) - .0 - .insert(key, value); - } else { - self.current.entry(account.clone()).and_modify(|e| { - { - e.0.remove(&key); - e.1 = size; - }; - }); + // Update the journal. + self.journal.push(JournalEntry::new( + account.clone(), + key, + old_value.clone() + )); } Ok(match (take, old_value) { (_, None) => WriteOutcome::New, - (false, Some(_)) => WriteOutcome::Overwritten(old_value_size as _), + (false, Some(old_value)) => WriteOutcome::Overwritten(old_value.len() as _), (true, Some(old_value)) => WriteOutcome::Taken(old_value), }) } @@ -122,38 +279,26 @@ impl TransientStorage { self.checkpoints .pop() .expect("No open transient storage transaction that can be committed."); + self.meter.commit(); } pub fn start_transaction(&mut self) { self.checkpoints.push(self.journal.len()); + self.meter.start() } pub fn rollback_transaction(&mut self) { - let last_checkpoint = self + let checkpoint = self .checkpoints .pop() .expect("No open transient storage transaction that can be rolled back."); + self.meter.revert(); + self.journal.rollback(&mut self.current, checkpoint); - for i in (last_checkpoint..self.journal.len()).rev() { - let JournalEntry { account, key, prev_value } = &self.journal[i]; - - if let Some(contract) = self.current.get_mut(account) { - // Calculate new size. - let current_value_size = contract.0.len(); - let prev_value_size = prev_value.as_ref().map(|e| e.len()).unwrap_or_default(); - - contract.1 = - contract.1.saturating_sub(current_value_size).saturating_add(prev_value_size); + } - if let Some(prev_value) = prev_value { - contract.0.insert(key.clone(), prev_value.clone()); - } else { - contract.0.remove(key); - } - } - } + pub fn terminate(&mut self, account: &AccountIdOf) { - self.journal.truncate(last_checkpoint); } } @@ -192,6 +337,27 @@ mod tests { assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])) } + #[test] + fn overwrite_and_commmit_transaction_works() { + let mut storage = TransientStorage::::new(256); + storage.start_transaction(); + storage.commit_transaction(); + + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1, 2]), false), + Ok(WriteOutcome::Overwritten(1)) + ); + + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1, 2])) + } + #[test] fn rollback_in_nested_transaction_works() { let mut storage = TransientStorage::::new(256); @@ -210,4 +376,31 @@ mod tests { assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), None) } + + #[test] + fn commit_in_nested_transaction_works() { + let mut storage = TransientStorage::::new(2); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.start_transaction(); + assert_eq!( + storage.write(&BOB, &Key::Fix([1; 32]), Some(vec![2]), false), + Ok(WriteOutcome::New) + ); + storage.start_transaction(); + assert_eq!( + storage.write(&CHARLIE, &Key::Fix([1; 32]), Some(vec![3]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); + storage.commit_transaction(); + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); + assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), Some(vec![2])); + assert_eq!(storage.read(&CHARLIE, &Key::Fix([1; 32])), Some(vec![3])); + + } } From 53ec270c1f3ecf850498b457273eafcea147b433 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 31 May 2024 00:34:41 +0200 Subject: [PATCH 06/58] Add terminate function to transient storage --- substrate/frame/contracts/src/exec.rs | 14 +- .../frame/contracts/src/transient_storage.rs | 243 +++++++----------- substrate/frame/contracts/src/wasm/runtime.rs | 74 +++++- 3 files changed, 182 insertions(+), 149 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index c40cb3dd4c90..a456f11f87ed 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -819,7 +819,10 @@ where frames: Default::default(), debug_message, determinism, - transient_storage: TransientStorage::new(T::Schedule::get().limits.transient_storage), + //transient_storage: TransientStorage::new(T::Schedule::get().limits.transient_storage, + // 256), + transient_storage: TransientStorage::new(728, 256), + _phantom: Default::default(), }; @@ -1349,24 +1352,27 @@ where return Err(Error::::TerminatedWhileReentrant.into()) } let frame = self.top_frame_mut(); + let account_id = frame.account_id.clone(); let info = frame.terminate(); frame.nested_storage.terminate(&info, beneficiary.clone()); info.queue_trie_for_deletion(); - ContractInfoOf::::remove(&frame.account_id); + ContractInfoOf::::remove(&account_id); Self::decrement_refcount(info.code_hash); for (code_hash, deposit) in info.delegate_dependencies() { Self::decrement_refcount(*code_hash); frame .nested_storage - .charge_deposit(frame.account_id.clone(), StorageDeposit::Refund(*deposit)); + .charge_deposit(account_id.clone(), StorageDeposit::Refund(*deposit)); } + self.transient_storage.terminate(&account_id)?; Contracts::::deposit_event(Event::Terminated { - contract: frame.account_id.clone(), + contract: account_id, beneficiary: beneficiary.clone(), }); + Ok(()) } diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 8b85959f26e0..777a547d6b8e 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -27,76 +27,58 @@ use crate::{ use sp_runtime::{DispatchError, DispatchResult}; use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec}; +type MeterEntries = Vec; type Value = Vec; type StorageKey = Vec; -type State = BTreeMap, Storage>; -type MeterEntries = Vec; +type State = BTreeMap, Storage>; +type Checkpoints = Vec; +type Storage = BTreeMap; -#[derive(Default)] +#[derive(Default, Debug)] struct MeterEntry { - // Allocation commited by subsequent frames. - nested: Diff, - // Current allocation made by frame. - current: Diff, + // Allocation commited from subsequent frames. + pub nested: u32, + // Allocation made in current frame. + pub current: u32, } -// impl MeterEntry { -// fn saturating_add(&self, rhs: &Self) -> Self { -// Self { -// bytes_added: self.bytes_added.saturating_add(rhs.bytes_added), -// bytes_removed: self.bytes_removed.saturating_add(rhs.bytes_removed), -// } -// } -// } - - -/// This type is used to describe a storage change when charging from the meter. -#[derive(Default)] -pub struct Diff { - /// How many bytes were added to storage. - pub bytes_added: u32, - /// How many bytes were removed from storage. - pub bytes_removed: u32, -} +impl MeterEntry { + pub fn sum(&self) -> u32 { + self.current.saturating_add(self.nested) + } -impl Diff { - fn saturating_add(&self, rhs: &Self) -> Self { - Self { - bytes_added: self.bytes_added.saturating_add(rhs.bytes_added), - bytes_removed: self.bytes_removed.saturating_add(rhs.bytes_removed), - } + pub fn absorb(&mut self, rhs: Self) { + self.nested = self.nested.saturating_add(rhs.sum()) } } -/// Storage meter enforces the limit for each frame and total limit for transaction. +/// Storage meter enforces the limit for each transaction and total limit for transaction. /// It tracks journal and storage allocation. struct StorageMeter { limit: u32, frame_limit: u32, nested: MeterEntries, - _phantom: PhantomData + _phantom: PhantomData, } -impl StorageMeter { - - pub fn new(limit: u32) -> Self { - Self { - limit, - frame_limit: 256, - nested: vec![Default::default()], - _phantom: Default::default() - } +impl StorageMeter { + pub fn new(limit: u32, frame_limit: u32) -> Self { + Self { limit, frame_limit, nested: Default::default(), _phantom: Default::default() } } - fn charge(&mut self, amount: Diff) -> DispatchResult { - let total: usize = self.nested.iter().sum(); - if let Some(nested_meter) = self.nested.last_mut() { - let current = nested_meter.saturating_add(amount); - if current > self.frame_limit as _ || total > self.limit as _ { - return Err(Error::::OutOfStorage.into()); - } - *nested_meter = current; + pub fn charge(&mut self, amount: u32) -> DispatchResult { + let total: u32 = self + .nested + .iter() + .map(|e: &MeterEntry| e.sum()) + .fold(0, |acc, e| acc.saturating_add(e)); + let nested_meter = self.nested.last_mut().expect("Metering is not started."); + let current = nested_meter.current.saturating_add(amount); + if current > self.frame_limit || total.saturating_add(amount) > self.limit { + return Err(Error::::OutOfStorage.into()); } + nested_meter.current = current; + Ok(()) } @@ -104,17 +86,14 @@ impl StorageMeter { self.nested.pop(); } - fn start(&mut self) { + pub fn start(&mut self) { self.nested.push(Default::default()); } - fn commit(&mut self) { - if let Some(amount) = self.nested.pop() - { - if let Some(nested_meter) = self.nested.last_mut() { - - let total: usize = self.nested.iter().sum(); - } + pub fn commit(&mut self) { + let last_meter = self.nested.pop().expect("There is no meter that can be committed."); + if let Some(prev_meter) = self.nested.last_mut() { + prev_meter.absorb(last_meter); } } } @@ -125,13 +104,9 @@ struct JournalEntry { prev_value: Option, } -impl JournalEntry { +impl JournalEntry { pub fn new(account: AccountIdOf, key: StorageKey, prev_value: Option) -> Self { - Self{ - account, - key, - prev_value, - } + Self { account, key, prev_value } } pub fn revert(self, storage: &mut State) { @@ -145,9 +120,9 @@ impl JournalEntry { } } -struct Journal (Vec>); +struct Journal(Vec>); -impl Journal { +impl Journal { pub fn new() -> Self { Self(Default::default()) } @@ -161,50 +136,7 @@ impl Journal { } pub fn rollback(&mut self, storage: &mut State, checkpoint: usize) { - self.0 - .drain(checkpoint..) - .rev() - .for_each(|entry| entry.revert(storage)); - } -} - -type Checkpoints = Vec; -struct Storage { - data: BTreeMap, - _phantom: PhantomData, -} - -impl Storage { - pub fn new(max_size: usize) -> Self { - Self { data: Default::default(), _phantom: Default::default() } - } - - pub fn get(&self, key: &StorageKey) -> Option<&Value> { - self.data.get(key) - } - - pub fn try_insert( - &mut self, - key: StorageKey, - value: Value, - meter: &mut StorageMeter, - ) -> DispatchResult { - let new_value_size = value.len(); - meter.charge(new_value_size)?; - self.data.insert(key, value); - Ok(()) - } - - pub fn insert( - &mut self, - key: StorageKey, - value: Value, - ) { - self.data.insert(key, value); - } - - pub fn remove(&mut self, key: &StorageKey) { - self.data.remove(key); + self.0.drain(checkpoint..).rev().for_each(|entry| entry.revert(storage)); } } @@ -217,19 +149,19 @@ pub struct TransientStorage { } impl TransientStorage { - pub fn new(max_size: u32) -> Self { + pub fn new(limit: u32, frame_limit: u32) -> Self { TransientStorage { current: Default::default(), journal: Journal::new(), checkpoints: vec![], - meter: StorageMeter::new(max_size) + meter: StorageMeter::new(limit, frame_limit), } } pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option { self.current .get(account) - .and_then(|contract| contract.data.get(&key.hash())) + .and_then(|contract| contract.get(&key.hash())) .cloned() } @@ -244,28 +176,7 @@ impl TransientStorage { // Skip if the same value is being set. if old_value != value { let key: Vec = key.hash(); - // Update the current state. - if let Some(value) = value { - // Insert storage value. - self.current - .entry(account.clone()) - .or_insert_with(|| Storage::new(256)) - .try_insert(key.clone(), value, &mut self.meter)?; - } else { - // Remove storage entry. - self.current.entry(account.clone()).and_modify(|contract| { - { - contract.remove(&key); - }; - }); - } - - // Update the journal. - self.journal.push(JournalEntry::new( - account.clone(), - key, - old_value.clone() - )); + self.write_internal(account, key, value)?; } Ok(match (take, old_value) { @@ -275,6 +186,18 @@ impl TransientStorage { }) } + pub fn terminate(&mut self, account: &AccountIdOf)-> DispatchResult { + // Remove all account entries. + if let Some(contract) = self.current.get(account) { + let keys: Vec<_> = contract.keys().cloned().collect(); + // Delete each key using the write function + for key in keys { + self.write_internal(account, key, None)?; + } + } + Ok(()) + } + pub fn commit_transaction(&mut self) { self.checkpoints .pop() @@ -283,8 +206,8 @@ impl TransientStorage { } pub fn start_transaction(&mut self) { + self.meter.start(); self.checkpoints.push(self.journal.len()); - self.meter.start() } pub fn rollback_transaction(&mut self) { @@ -294,11 +217,44 @@ impl TransientStorage { .expect("No open transient storage transaction that can be rolled back."); self.meter.revert(); self.journal.rollback(&mut self.current, checkpoint); - } - pub fn terminate(&mut self, account: &AccountIdOf) { + fn write_internal( + &mut self, + account: &AccountIdOf, + key: StorageKey, + value: Option, + ) -> DispatchResult { + // Update the current state. + let mut old_value = None; + if let Some(value) = value { + // Insert storage entry. + self.meter.charge(value.len() as _)?; + old_value = self.current + .entry(account.clone()) + .or_default() + .insert(key.clone(), value); + } else { + // Remove storage entry. + let mut remove_account = false; + self.current.entry(account.clone()).and_modify(|contract| { + { + old_value = contract.remove(&key); + if contract.is_empty() { + // If the contract is empty, remove the account entry from the current state + remove_account = true; + } + }; + }); + // All entries for the account have been removed, so remove the account + if remove_account { + self.current.remove(&account); + } + } + // Update the journal. + self.journal.push(JournalEntry::new(account.clone(), key, old_value.clone())); + Ok(()) } } @@ -309,7 +265,7 @@ mod tests { #[test] fn rollback_transaction_works() { - let mut storage = TransientStorage::::new(256); + let mut storage = TransientStorage::::new(256, 256); storage.start_transaction(); storage.rollback_transaction(); @@ -324,7 +280,7 @@ mod tests { #[test] fn commit_transaction_works() { - let mut storage = TransientStorage::::new(256); + let mut storage = TransientStorage::::new(256, 256); storage.start_transaction(); storage.commit_transaction(); @@ -339,7 +295,7 @@ mod tests { #[test] fn overwrite_and_commmit_transaction_works() { - let mut storage = TransientStorage::::new(256); + let mut storage = TransientStorage::::new(256, 256); storage.start_transaction(); storage.commit_transaction(); @@ -360,7 +316,7 @@ mod tests { #[test] fn rollback_in_nested_transaction_works() { - let mut storage = TransientStorage::::new(256); + let mut storage = TransientStorage::::new(256, 256); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -379,7 +335,7 @@ mod tests { #[test] fn commit_in_nested_transaction_works() { - let mut storage = TransientStorage::::new(2); + let mut storage = TransientStorage::::new(256, 256); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -401,6 +357,5 @@ mod tests { assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), Some(vec![2])); assert_eq!(storage.read(&CHARLIE, &Key::Fix([1; 32])), Some(vec![3])); - } } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index e16e574eff19..3191d335cfa5 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -869,7 +869,7 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { ) -> Result { let charged = self.charge_gas(RuntimeCosts::ContainsStorage(self.ext.max_value_size()))?; let key = self.decode_key(memory, key_type, key_ptr)?; - let outcome = self.ext.get_storage_size(&key); + let outcome = self.ext.get_transient_storage_size(&key); self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.unwrap_or(0))); Ok(outcome.unwrap_or(SENTINEL)) @@ -1168,6 +1168,78 @@ pub mod env { } } + /// Set the value at the given key in the contract transient storage. + #[prefixed_alias] + #[unstable] + fn set_transient_storage( + ctx: _, + memory: _, + key_ptr: u32, + key_len: u32, + value_ptr: u32, + value_len: u32, + ) -> Result { + ctx.set_transient_storage(memory, KeyType::Var(key_len), key_ptr, value_ptr, value_len) + } + + /// Clear the value at the given key in the contract storage. + #[prefixed_alias] + #[unstable] + fn clear_transient_storage(ctx: _, memory: _, key_ptr: u32, key_len: u32) -> Result { + ctx.clear_transient_storage(memory, KeyType::Var(key_len), key_ptr) + } + + /// Retrieve the value under the given key from transient storage. + #[prefixed_alias] + #[unstable] + fn get_transient_storage( + ctx: _, + memory: _, + key_ptr: u32, + out_ptr: u32, + out_len_ptr: u32, + ) -> Result { + ctx.get_transient_storage(memory, KeyType::Fix, key_ptr, out_ptr, out_len_ptr) + } + + /// Checks whether there is a value stored under the given key in transient storage. + #[prefixed_alias] + #[unstable] + fn contains_transient_storage(ctx: _, memory: _, key_ptr: u32, key_len: u32) -> Result { + ctx.contains_transient_storage(memory, KeyType::Var(key_len), key_ptr) + } + + /// Retrieve and remove the value under the given key from transient storage. + #[prefixed_alias] + #[unstable] + fn take_transient_storage( + ctx: _, + memory: _, + key_ptr: u32, + key_len: u32, + out_ptr: u32, + out_len_ptr: u32, + ) -> Result { + let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; + ensure!( + key_len <= <::T as Config>::MaxStorageKeyLen::get(), + Error::::DecodingFailed + ); + let key = ctx.read_sandbox_memory(memory, key_ptr, key_len)?; + if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_transient_storage( + &Key::::try_from_var(key).map_err(|_| Error::::DecodingFailed)?, + None, + true, + )? { + ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); + ctx.write_sandbox_output(memory, out_ptr, out_len_ptr, &value, false, already_charged)?; + Ok(ReturnErrorCode::Success) + } else { + ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(0)); + Ok(ReturnErrorCode::KeyNotFound) + } + } + /// Transfer some value to another account. /// See [`pallet_contracts_uapi::HostFn::transfer`]. #[prefixed_alias] From 33f6c2d219178a17335a7debf37fb19a25d1ae54 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 31 May 2024 21:52:39 +0200 Subject: [PATCH 07/58] Add unit tests --- substrate/frame/contracts/src/exec.rs | 2 +- .../frame/contracts/src/transient_storage.rs | 354 +++++++++++++----- substrate/frame/contracts/src/wasm/runtime.rs | 16 +- 3 files changed, 270 insertions(+), 102 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index a456f11f87ed..8f9bb3009e78 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -1367,7 +1367,7 @@ where .charge_deposit(account_id.clone(), StorageDeposit::Refund(*deposit)); } - self.transient_storage.terminate(&account_id)?; + self.transient_storage.remove(&account_id); Contracts::::deposit_event(Event::Terminated { contract: account_id, beneficiary: beneficiary.clone(), diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 777a547d6b8e..0ac3afdd7e24 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -24,21 +24,22 @@ use crate::{ storage::WriteOutcome, Config, Error, }; +use frame_support::DefaultNoBound; use sp_runtime::{DispatchError, DispatchResult}; -use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec}; +use sp_std::{collections::btree_map::{BTreeMap, Keys}, vec::Vec}; type MeterEntries = Vec; type Value = Vec; type StorageKey = Vec; -type State = BTreeMap, Storage>; type Checkpoints = Vec; -type Storage = BTreeMap; +type ContractStorage = BTreeMap; +/// Meter entry tracks transaction allocations. #[derive(Default, Debug)] struct MeterEntry { - // Allocation commited from subsequent frames. + /// Allocation commited from subsequent transactions. pub nested: u32, - // Allocation made in current frame. + /// Allocation made in current transaction. pub current: u32, } @@ -52,52 +53,71 @@ impl MeterEntry { } } -/// Storage meter enforces the limit for each transaction and total limit for transaction. -/// It tracks journal and storage allocation. +/// Storage meter enforces the limit for each nested transaction and total limit for transaction. +#[derive(DefaultNoBound)] struct StorageMeter { limit: u32, frame_limit: u32, nested: MeterEntries, + root: MeterEntry, _phantom: PhantomData, } impl StorageMeter { pub fn new(limit: u32, frame_limit: u32) -> Self { - Self { limit, frame_limit, nested: Default::default(), _phantom: Default::default() } + Self { limit, frame_limit, ..Default::default() } } + /// Charge the allocated amount of transaction storage from the meter. pub fn charge(&mut self, amount: u32) -> DispatchResult { - let total: u32 = self - .nested - .iter() - .map(|e: &MeterEntry| e.sum()) - .fold(0, |acc, e| acc.saturating_add(e)); - let nested_meter = self.nested.last_mut().expect("Metering is not started."); - let current = nested_meter.current.saturating_add(amount); - if current > self.frame_limit || total.saturating_add(amount) > self.limit { + let current = self.top_meter().current.saturating_add(amount); + if amount.saturating_add(self.current_amount()) > self.frame_limit || amount.saturating_add(self.total_amount()) > self.limit { return Err(Error::::OutOfStorage.into()); } - nested_meter.current = current; - + self.top_meter_mut().current = current; Ok(()) } - fn revert(&mut self) { - self.nested.pop(); + pub fn current_amount(&self) -> u32 { + self.top_meter().current + } + + pub fn total_amount(&self) -> u32{ + self + .nested + .iter() + .map(|e: &MeterEntry| e.sum()) + .fold(self.root.sum(), |acc, e| acc.saturating_add(e)) } + /// Revert a transaction meter. + pub fn revert(&mut self) { + self.nested.pop().expect("There is no nested meter that can be reverted."); + } + + /// Start a nested transaction meter. pub fn start(&mut self) { self.nested.push(Default::default()); } + /// Commit a transaction meter. pub fn commit(&mut self) { - let last_meter = self.nested.pop().expect("There is no meter that can be committed."); - if let Some(prev_meter) = self.nested.last_mut() { - prev_meter.absorb(last_meter); - } + let nested_meter = + self.nested.pop().expect("There is no nested meter that can be committed."); + self.top_meter_mut().absorb(nested_meter); + } + + fn top_meter_mut(&mut self) -> &mut MeterEntry { + self.nested.last_mut().unwrap_or(&mut self.root) + } + + fn top_meter(&mut self) -> &MeterEntry { + self.nested.last().unwrap_or(&self.root) } } + +/// Journal change entry. struct JournalEntry { account: AccountIdOf, key: StorageKey, @@ -109,17 +129,13 @@ impl JournalEntry { Self { account, key, prev_value } } - pub fn revert(self, storage: &mut State) { - if let Some(contract) = storage.get_mut(&self.account) { - if let Some(prev_value) = self.prev_value { - contract.insert(self.key, prev_value); - } else { - contract.remove(&self.key); - } - } + /// Revert the storage to previous state. + pub fn revert(self, storage: &mut Storage) { + storage.write(&self.account, &self.key, self.prev_value); } } +/// Journal of transient storage modifications. struct Journal(Vec>); impl Journal { @@ -135,13 +151,58 @@ impl Journal { self.0.len() } - pub fn rollback(&mut self, storage: &mut State, checkpoint: usize) { + pub fn rollback(&mut self, storage: &mut Storage, checkpoint: usize) { self.0.drain(checkpoint..).rev().for_each(|entry| entry.revert(storage)); } } +#[derive(DefaultNoBound)] +struct Storage(BTreeMap, ContractStorage>); + +impl Storage { + pub fn read(&self, account: &AccountIdOf, key: &StorageKey) -> Option { + self.0.get(account) + .and_then(|contract| contract.get(key)) + .cloned() + } + + pub fn write(&mut self, account: &AccountIdOf, key: &StorageKey, + value: Option, + ) -> Option { + let mut old_value = None; + if let Some(value) = value { + // Insert storage entry. + old_value = self.0.entry(account.clone()).or_default().insert(key.clone(), value); + } else { + // Remove storage entry. + let mut remove_account = false; + self.0.entry(account.clone()).and_modify(|contract| { + { + old_value = contract.remove(key); + if contract.is_empty() { + // If the contract is empty, remove the account entry from the current state + remove_account = true; + } + }; + }); + // All entries for the account have been removed, so remove the account + if remove_account { + self.0.remove(account); + } + } + + old_value + } + + pub fn keys(&self, account: &AccountIdOf) -> Option> { + self.0.get(account).map(|c| c.keys()) + } +} + + +/// Transient storage behaves almost identically to storage but is discarded after every transaction. pub struct TransientStorage { - current: State, + current: Storage, journal: Journal, meter: StorageMeter, // The size of the checkpoints is limited by the stack depth. @@ -153,18 +214,17 @@ impl TransientStorage { TransientStorage { current: Default::default(), journal: Journal::new(), - checkpoints: vec![], + checkpoints: Default::default(), meter: StorageMeter::new(limit, frame_limit), } } + /// Read the storage entry. pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option { - self.current - .get(account) - .and_then(|contract| contract.get(&key.hash())) - .cloned() + self.current.read(account, &key.hash()) } + /// Write a value to storage. pub fn write( &mut self, account: &AccountIdOf, @@ -176,7 +236,13 @@ impl TransientStorage { // Skip if the same value is being set. if old_value != value { let key: Vec = key.hash(); - self.write_internal(account, key, value)?; + let len = value.clone().map(|v| v.len()).unwrap_or_default(); + if len > 0 { + self.meter.charge(len as _)?; + } + self.current.write(account, &key, value); + // Update the journal. + self.journal.push(JournalEntry::new(account.clone(), key, old_value.clone())); } Ok(match (take, old_value) { @@ -186,30 +252,36 @@ impl TransientStorage { }) } - pub fn terminate(&mut self, account: &AccountIdOf)-> DispatchResult { + /// Remove a contract, clearing all its storage entries. + pub fn remove(&mut self, account: &AccountIdOf) { // Remove all account entries. - if let Some(contract) = self.current.get(account) { - let keys: Vec<_> = contract.keys().cloned().collect(); - // Delete each key using the write function + if let Some(keys) = self.current.keys(account) { + let keys: Vec<_> = keys.cloned().collect(); for key in keys { - self.write_internal(account, key, None)?; + let old_value = self.current.write(account, &key, None); + // Update the journal. + self.journal.push(JournalEntry::new(account.clone(), key, old_value)); } } - Ok(()) - } - - pub fn commit_transaction(&mut self) { - self.checkpoints - .pop() - .expect("No open transient storage transaction that can be committed."); - self.meter.commit(); } + /// Start a new nested transaction. + /// + /// This allows to either commit or roll back all changes that are made after this call. + /// For every transaction there must be a matching call to either `rollback_transaction` + /// or `commit_transaction`. pub fn start_transaction(&mut self) { self.meter.start(); self.checkpoints.push(self.journal.len()); } + /// Rollback the last transaction started by `start_transaction`. + /// + /// Any changes made during that transaction are discarded. + /// + /// # Panics + /// + /// Will panic if there is no open transaction. pub fn rollback_transaction(&mut self) { let checkpoint = self .checkpoints @@ -219,42 +291,18 @@ impl TransientStorage { self.journal.rollback(&mut self.current, checkpoint); } - fn write_internal( - &mut self, - account: &AccountIdOf, - key: StorageKey, - value: Option, - ) -> DispatchResult { - // Update the current state. - let mut old_value = None; - if let Some(value) = value { - // Insert storage entry. - self.meter.charge(value.len() as _)?; - old_value = self.current - .entry(account.clone()) - .or_default() - .insert(key.clone(), value); - } else { - // Remove storage entry. - let mut remove_account = false; - self.current.entry(account.clone()).and_modify(|contract| { - { - old_value = contract.remove(&key); - if contract.is_empty() { - // If the contract is empty, remove the account entry from the current state - remove_account = true; - } - }; - }); - // All entries for the account have been removed, so remove the account - if remove_account { - self.current.remove(&account); - } - } - - // Update the journal. - self.journal.push(JournalEntry::new(account.clone(), key, old_value.clone())); - Ok(()) + /// Commit the last transaction started by `start_transaction`. + /// + /// Any changes made during that transaction are committed. + /// + /// # Panics + /// + /// Will panic if there is no open transaction. + pub fn commit_transaction(&mut self) { + self.checkpoints + .pop() + .expect("No open transient storage transaction that can be committed."); + self.meter.commit(); } } @@ -264,10 +312,101 @@ mod tests { use crate::tests::{Test, ALICE, BOB, CHARLIE}; #[test] - fn rollback_transaction_works() { + fn read_write_works() { let mut storage = TransientStorage::::new(256, 256); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![2]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + storage.write(&BOB, &Key::Fix([3; 32]), Some(vec![3]), false), + Ok(WriteOutcome::New) + ); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); + assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), Some(vec![2])); + assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), Some(vec![3])); + // Overwrite values. + assert_eq!( + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![4, 5]), false), + Ok(WriteOutcome::Overwritten(1)) + ); + assert_eq!( + storage.write(&BOB, &Key::Fix([3; 32]), Some(vec![6, 7]), true), + Ok(WriteOutcome::Taken(vec![3])) + ); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); + assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), Some(vec![4,5])); + assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), Some(vec![6, 7])); + } + + #[test] + fn remove_transaction_works() { + let mut storage = TransientStorage::::new(256, 256); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![2]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + storage.write(&BOB, &Key::Fix([3; 32]), Some(vec![3]), false), + Ok(WriteOutcome::New) + ); + storage.remove(&ALICE); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); + assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), None); + assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), Some(vec![3])); + } + + #[test] + fn commit_remove_transaction_works() { + let mut storage = TransientStorage::::new(256, 256); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.remove(&ALICE); + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); + + storage.start_transaction(); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); + storage.remove(&ALICE); + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); + } + + #[test] + fn rollback_remove_transaction_works() { + let mut storage = TransientStorage::::new(256, 256); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); storage.start_transaction(); + storage.remove(&ALICE); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); storage.rollback_transaction(); + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); + } + + #[test] + fn rollback_transaction_works() { + let mut storage = TransientStorage::::new(256, 256); storage.start_transaction(); assert_eq!( @@ -281,8 +420,6 @@ mod tests { #[test] fn commit_transaction_works() { let mut storage = TransientStorage::::new(256, 256); - storage.start_transaction(); - storage.commit_transaction(); storage.start_transaction(); assert_eq!( @@ -296,20 +433,15 @@ mod tests { #[test] fn overwrite_and_commmit_transaction_works() { let mut storage = TransientStorage::::new(256, 256); - storage.start_transaction(); - storage.commit_transaction(); - storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), Ok(WriteOutcome::New) ); - assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1, 2]), false), Ok(WriteOutcome::Overwritten(1)) ); - storage.commit_transaction(); assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1, 2])) } @@ -358,4 +490,30 @@ mod tests { assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), Some(vec![2])); assert_eq!(storage.read(&CHARLIE, &Key::Fix([1; 32])), Some(vec![3])); } -} + + #[test] + fn commit_rollback_in_nested_transaction_works() { + let mut storage = TransientStorage::::new(256, 256); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.start_transaction(); + assert_eq!( + storage.write(&BOB, &Key::Fix([1; 32]), Some(vec![2]), false), + Ok(WriteOutcome::New) + ); + storage.start_transaction(); + assert_eq!( + storage.write(&CHARLIE, &Key::Fix([1; 32]), Some(vec![3]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); + storage.rollback_transaction(); + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); + assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), None); + assert_eq!(storage.read(&CHARLIE, &Key::Fix([1; 32])), None); + } +} \ No newline at end of file diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 3191d335cfa5..6b81be3d542a 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -1168,7 +1168,7 @@ pub mod env { } } - /// Set the value at the given key in the contract transient storage. + /// Set the value at the given key in the contract transient storage. #[prefixed_alias] #[unstable] fn set_transient_storage( @@ -1185,7 +1185,12 @@ pub mod env { /// Clear the value at the given key in the contract storage. #[prefixed_alias] #[unstable] - fn clear_transient_storage(ctx: _, memory: _, key_ptr: u32, key_len: u32) -> Result { + fn clear_transient_storage( + ctx: _, + memory: _, + key_ptr: u32, + key_len: u32, + ) -> Result { ctx.clear_transient_storage(memory, KeyType::Var(key_len), key_ptr) } @@ -1205,7 +1210,12 @@ pub mod env { /// Checks whether there is a value stored under the given key in transient storage. #[prefixed_alias] #[unstable] - fn contains_transient_storage(ctx: _, memory: _, key_ptr: u32, key_len: u32) -> Result { + fn contains_transient_storage( + ctx: _, + memory: _, + key_ptr: u32, + key_len: u32, + ) -> Result { ctx.contains_transient_storage(memory, KeyType::Var(key_len), key_ptr) } From 199edaa88a8a3421ada797b7666b7eb68694d462 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 3 Jun 2024 17:08:38 +0200 Subject: [PATCH 08/58] Refactored to single BtreeMap --- substrate/bin/node/runtime/src/lib.rs | 1 + substrate/frame/contracts/src/exec.rs | 10 +- substrate/frame/contracts/src/lib.rs | 17 +- substrate/frame/contracts/src/schedule.rs | 4 - .../frame/contracts/src/transient_storage.rs | 274 +++++++++++------- 5 files changed, 194 insertions(+), 112 deletions(-) diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 617088ffe1ff..32cc8fce5ed1 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1376,6 +1376,7 @@ impl pallet_contracts::Config for Runtime { type UploadOrigin = EnsureSigned; type InstantiateOrigin = EnsureSigned; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; + type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; type RuntimeHoldReason = RuntimeHoldReason; #[cfg(not(feature = "runtime-benchmarks"))] type Migrations = (); diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 8f9bb3009e78..6659dad4c0a9 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -807,6 +807,7 @@ where determinism, )?; + let transient_storage_limit = T::MaxTransientStorageLen::get(); let stack = Self { origin, schedule, @@ -819,10 +820,11 @@ where frames: Default::default(), debug_message, determinism, - //transient_storage: TransientStorage::new(T::Schedule::get().limits.transient_storage, - // 256), - transient_storage: TransientStorage::new(728, 256), - + transient_storage: TransientStorage::new( + transient_storage_limit, + transient_storage_limit + .saturating_div((T::CallStack::size() as u32).saturating_add(1)), + ), _phantom: Default::default(), }; diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 398c37d8a323..179bed0344bd 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -410,6 +410,10 @@ pub mod pallet { #[pallet::constant] type MaxDebugBufferLen: Get; + /// The maximum length of the transient storage in bytes. + #[pallet::constant] + type MaxTransientStorageLen: Get; + /// Origin allowed to upload code. /// /// By default, it is safe to set this to `EnsureSigned`, allowing anyone to upload contract @@ -555,6 +559,7 @@ pub mod pallet { type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxDelegateDependencies = MaxDelegateDependencies; type MaxStorageKeyLen = ConstU32<128>; + type MaxTransientStorageLen = ConstU32<256>; type Migrations = (); type Time = Self; type Randomness = Self; @@ -606,7 +611,11 @@ pub mod pallet { // Max call depth is CallStack::size() + 1 let max_call_depth = u32::try_from(T::CallStack::size().saturating_add(1)) .expect("CallStack size is too big"); - let max_transient_storage_size = T::Schedule::get().limits.transient_storage; + // Transient storage uses a BTreeMap, which has overhead compared to the raw size of + // key-value data. To ensure safety, a margin of 2x the raw key-value size is used. + let max_transient_storage_len = T::MaxTransientStorageLen::get() + .checked_mul(2) + .unwrap_or_else(|| panic!("MaxTransientStorageLen to big")); // Check that given configured `MaxCodeLen`, runtime heap memory limit can't be broken. // // In worst case, the decoded Wasm contract code would be `x16` times larger than the @@ -616,7 +625,7 @@ pub mod pallet { // Next, the pallet keeps the Wasm blob for each // contract, hence we add up `MaxCodeLen` to the safety margin. // - // Finally, the inefficiencies of the freeing-bump allocator + // The inefficiencies of the freeing-bump allocator // being used in the client for the runtime memory allocations, could lead to possible // memory allocations for contract code grow up to `x4` times in some extreme cases, // which gives us total multiplier of `17*4` for `MaxCodeLen`. @@ -625,6 +634,8 @@ pub mod pallet { // memory should be available. Note that maximum allowed heap memory and stack size per // each contract (stack frame) should also be counted. // + // The pallet holds transient storage with a size up to `max_transient_storage_size`. + // // Finally, we allow 50% of the runtime memory to be utilized by the contracts call // stack, keeping the rest for other facilities, such as PoV, etc. // @@ -636,7 +647,7 @@ pub mod pallet { // Hence the upper limit for the `MaxCodeLen` can be defined as follows: let code_len_limit = max_runtime_mem .saturating_div(2) - .saturating_sub(max_transient_storage_size) + .saturating_sub(max_transient_storage_len) .saturating_div(max_call_depth) .saturating_sub(max_heap_size) .saturating_sub(MAX_STACK_SIZE) diff --git a/substrate/frame/contracts/src/schedule.rs b/substrate/frame/contracts/src/schedule.rs index bbe16387060a..a1fbdea4228b 100644 --- a/substrate/frame/contracts/src/schedule.rs +++ b/substrate/frame/contracts/src/schedule.rs @@ -82,9 +82,6 @@ pub struct Limits { /// The maximum node runtime memory. This is for integrity checks only and does not affect the /// real setting. pub runtime_memory: u32, - - // The maximum size of data that can be kept in transient storage. - pub transient_storage: u32, } impl Limits { @@ -117,7 +114,6 @@ impl Default for Limits { subject_len: 32, payload_len: 16 * 1024, runtime_memory: 1024 * 1024 * 128, - transient_storage: 736 * 1024, } } } diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 0ac3afdd7e24..70c2df2bc718 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -24,22 +24,24 @@ use crate::{ storage::WriteOutcome, Config, Error, }; +use codec::Encode; use frame_support::DefaultNoBound; use sp_runtime::{DispatchError, DispatchResult}; -use sp_std::{collections::btree_map::{BTreeMap, Keys}, vec::Vec}; - +use sp_std::{ + collections::btree_map::BTreeMap, + mem, + ops::Bound::{Included, Unbounded}, + vec::Vec, +}; type MeterEntries = Vec; -type Value = Vec; -type StorageKey = Vec; type Checkpoints = Vec; -type ContractStorage = BTreeMap; /// Meter entry tracks transaction allocations. #[derive(Default, Debug)] struct MeterEntry { /// Allocation commited from subsequent transactions. pub nested: u32, - /// Allocation made in current transaction. + /// Allocation made in the current transaction. pub current: u32, } @@ -53,38 +55,41 @@ impl MeterEntry { } } -/// Storage meter enforces the limit for each nested transaction and total limit for transaction. +/// The storage meter enforces a limit for each nested transaction and the total allocation limit. #[derive(DefaultNoBound)] struct StorageMeter { - limit: u32, - frame_limit: u32, + total_limit: u32, + transaction_limit: u32, nested: MeterEntries, root: MeterEntry, _phantom: PhantomData, } impl StorageMeter { - pub fn new(limit: u32, frame_limit: u32) -> Self { - Self { limit, frame_limit, ..Default::default() } + pub fn new(total_limit: u32, transaction_limit: u32) -> Self { + Self { total_limit, transaction_limit, ..Default::default() } } /// Charge the allocated amount of transaction storage from the meter. pub fn charge(&mut self, amount: u32) -> DispatchResult { let current = self.top_meter().current.saturating_add(amount); - if amount.saturating_add(self.current_amount()) > self.frame_limit || amount.saturating_add(self.total_amount()) > self.limit { + if amount.saturating_add(self.current_amount()) > self.transaction_limit || + amount.saturating_add(self.total_amount()) > self.total_limit + { return Err(Error::::OutOfStorage.into()); } self.top_meter_mut().current = current; Ok(()) } + /// The allocated amount of memory inside the current transaction. pub fn current_amount(&self) -> u32 { self.top_meter().current } - pub fn total_amount(&self) -> u32{ - self - .nested + /// The total allocated amount of memory. + pub fn total_amount(&self) -> u32 { + self.nested .iter() .map(|e: &MeterEntry| e.sum()) .fold(self.root.sum(), |acc, e| acc.saturating_add(e)) @@ -111,117 +116,121 @@ impl StorageMeter { self.nested.last_mut().unwrap_or(&mut self.root) } - fn top_meter(&mut self) -> &MeterEntry { + fn top_meter(&self) -> &MeterEntry { self.nested.last().unwrap_or(&self.root) } } - -/// Journal change entry. -struct JournalEntry { - account: AccountIdOf, - key: StorageKey, - prev_value: Option, +/// An entry representing a journal change. +struct JournalEntry { + account: Vec, + key: Vec, + prev_value: Option>, } -impl JournalEntry { - pub fn new(account: AccountIdOf, key: StorageKey, prev_value: Option) -> Self { - Self { account, key, prev_value } +impl JournalEntry { + /// Create a new change. + pub fn new(account: &[u8], key: &[u8], prev_value: Option>) -> Self { + Self { account: account.to_vec(), key: key.to_vec(), prev_value } } - /// Revert the storage to previous state. - pub fn revert(self, storage: &mut Storage) { + /// Revert the change. + pub fn revert(self, storage: &mut Storage) { storage.write(&self.account, &self.key, self.prev_value); } } -/// Journal of transient storage modifications. -struct Journal(Vec>); +/// A journal containing transient storage modifications. +struct Journal(Vec); -impl Journal { +impl Journal { + /// Create a new journal. pub fn new() -> Self { Self(Default::default()) } - pub fn push(&mut self, entry: JournalEntry) { + /// Add a chenge to the journal. + pub fn push(&mut self, entry: JournalEntry) { self.0.push(entry); } + /// Length of the journal. pub fn len(&self) -> usize { self.0.len() } - pub fn rollback(&mut self, storage: &mut Storage, checkpoint: usize) { + /// Roll back all journal changes until the chackpoint + pub fn rollback(&mut self, storage: &mut Storage, checkpoint: usize) { self.0.drain(checkpoint..).rev().for_each(|entry| entry.revert(storage)); } } -#[derive(DefaultNoBound)] -struct Storage(BTreeMap, ContractStorage>); +/// Storage for maintaining the current transaction state. +#[derive(Default)] +struct Storage(BTreeMap, Vec>); -impl Storage { - pub fn read(&self, account: &AccountIdOf, key: &StorageKey) -> Option { - self.0.get(account) - .and_then(|contract| contract.get(key)) - .cloned() +impl Storage { + /// Read the storage entry. + pub fn read(&self, account: &[u8], key: &[u8]) -> Option> { + self.0.get(&Self::storage_key(account, key)).cloned() } - pub fn write(&mut self, account: &AccountIdOf, key: &StorageKey, - value: Option, - ) -> Option { - let mut old_value = None; + /// Write the storage entry. + pub fn write(&mut self, account: &[u8], key: &[u8], value: Option>) -> Option> { if let Some(value) = value { // Insert storage entry. - old_value = self.0.entry(account.clone()).or_default().insert(key.clone(), value); + self.0.insert(Self::storage_key(account, key), value) } else { // Remove storage entry. - let mut remove_account = false; - self.0.entry(account.clone()).and_modify(|contract| { - { - old_value = contract.remove(key); - if contract.is_empty() { - // If the contract is empty, remove the account entry from the current state - remove_account = true; - } - }; - }); - // All entries for the account have been removed, so remove the account - if remove_account { - self.0.remove(account); - } + self.0.remove(&Self::storage_key(account, key)) } + } - old_value + /// Get the storage keys for the account. + pub fn keys<'a>(&'a self, account: &'a [u8]) -> impl DoubleEndedIterator> + 'a { + self.0 + .range((Included(account.to_vec()), Unbounded)) + .map(move |(key, _)| key[account.len()..].to_vec()) } - pub fn keys(&self, account: &AccountIdOf) -> Option> { - self.0.get(account).map(|c| c.keys()) + fn storage_key(account: &[u8], key: &[u8]) -> Vec { + let mut storage_key = Vec::with_capacity(account.len() + key.len()); + storage_key.extend_from_slice(&account); + storage_key.extend_from_slice(&key); + storage_key } } - -/// Transient storage behaves almost identically to storage but is discarded after every transaction. +/// Transient storage behaves almost identically to regular storage but is discarded after each +/// transaction. It consists of a `BTreeMap` for the current state, a journal of all changes, and a +/// list of checkpoints. On entry to the `start_transaction` function, a marker (checkpoint) is +/// added to the list. New values are written to the current state, and the previous value is +/// recorded in the journal (`write`). When the `commit_transaction` function is called, the marker +/// to the journal index (checkpoint) of when that call was entered is discarded. +/// On `rollback_transaction`, all entries are reverted up to the last checkpoint. pub struct TransientStorage { - current: Storage, - journal: Journal, + // The storage and journal size is limited by the storage meter. + current: Storage, + journal: Journal, + // The size of the StorageMeter is limited by the stack depth. meter: StorageMeter, // The size of the checkpoints is limited by the stack depth. checkpoints: Checkpoints, } impl TransientStorage { - pub fn new(limit: u32, frame_limit: u32) -> Self { + pub fn new(total_limit: u32, transaction_limit: u32) -> Self { TransientStorage { current: Default::default(), journal: Journal::new(), checkpoints: Default::default(), - meter: StorageMeter::new(limit, frame_limit), + meter: StorageMeter::new(total_limit, transaction_limit), } } /// Read the storage entry. - pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option { - self.current.read(account, &key.hash()) + pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option> { + self.current.read(&account.encode(), &key.hash()) } /// Write a value to storage. @@ -229,39 +238,50 @@ impl TransientStorage { &mut self, account: &AccountIdOf, key: &Key, - value: Option, + value: Option>, take: bool, ) -> Result { - let old_value = self.read(account, key); + let prev_value = self.read(account, key); // Skip if the same value is being set. - if old_value != value { - let key: Vec = key.hash(); - let len = value.clone().map(|v| v.len()).unwrap_or_default(); - if len > 0 { - self.meter.charge(len as _)?; + if prev_value != value { + let key = key.hash(); + let account = account.encode(); + let value_len = value.clone().map(|v| v.len()).unwrap_or_default(); + let key_len = account.len().saturating_add(key.len()); + if value_len > 0 { + // Charge the key, value and journal entry. + let mut amount = value_len + .saturating_add(key_len) + .saturating_add(mem::size_of::()); + if prev_value.is_none() { + // Charge a new storage entry. + amount = amount + .saturating_add(key_len) + .saturating_add(mem::size_of::>().saturating_mul(2)); + } + self.meter.charge(amount as _)?; } - self.current.write(account, &key, value); + self.current.write(&account, &key, value); // Update the journal. - self.journal.push(JournalEntry::new(account.clone(), key, old_value.clone())); + self.journal.push(JournalEntry::new(&account, &key, prev_value.clone())); } - Ok(match (take, old_value) { + Ok(match (take, prev_value) { (_, None) => WriteOutcome::New, - (false, Some(old_value)) => WriteOutcome::Overwritten(old_value.len() as _), - (true, Some(old_value)) => WriteOutcome::Taken(old_value), + (false, Some(prev_value)) => WriteOutcome::Overwritten(prev_value.len() as _), + (true, Some(prev_value)) => WriteOutcome::Taken(prev_value), }) } /// Remove a contract, clearing all its storage entries. pub fn remove(&mut self, account: &AccountIdOf) { + let account = account.encode(); // Remove all account entries. - if let Some(keys) = self.current.keys(account) { - let keys: Vec<_> = keys.cloned().collect(); - for key in keys { - let old_value = self.current.write(account, &key, None); - // Update the journal. - self.journal.push(JournalEntry::new(account.clone(), key, old_value)); - } + let keys = self.current.keys(&account).collect::>(); + for key in keys { + let prev_value = self.current.write(&account, &key, None); + // Update the journal. + self.journal.push(JournalEntry::new(&account, &key, prev_value)); } } @@ -309,11 +329,14 @@ impl TransientStorage { #[cfg(test)] mod tests { use super::*; - use crate::tests::{Test, ALICE, BOB, CHARLIE}; + use crate::{ + tests::{Test, ALICE, BOB, CHARLIE}, + Error, + }; #[test] fn read_write_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(2048, 2048); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), Ok(WriteOutcome::New) @@ -339,13 +362,13 @@ mod tests { Ok(WriteOutcome::Taken(vec![3])) ); assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); - assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), Some(vec![4,5])); + assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), Some(vec![4, 5])); assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), Some(vec![6, 7])); } #[test] fn remove_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 1024); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), Ok(WriteOutcome::New) @@ -366,7 +389,7 @@ mod tests { #[test] fn commit_remove_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 256); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -390,7 +413,7 @@ mod tests { #[test] fn rollback_remove_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 256); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -406,7 +429,7 @@ mod tests { #[test] fn rollback_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 256); storage.start_transaction(); assert_eq!( @@ -419,7 +442,7 @@ mod tests { #[test] fn commit_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 256); storage.start_transaction(); assert_eq!( @@ -432,7 +455,7 @@ mod tests { #[test] fn overwrite_and_commmit_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 512); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -448,7 +471,7 @@ mod tests { #[test] fn rollback_in_nested_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 256); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -467,7 +490,7 @@ mod tests { #[test] fn commit_in_nested_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 256); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -493,7 +516,7 @@ mod tests { #[test] fn commit_rollback_in_nested_transaction_works() { - let mut storage = TransientStorage::::new(256, 256); + let mut storage = TransientStorage::::new(1024, 256); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -516,4 +539,53 @@ mod tests { assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), None); assert_eq!(storage.read(&CHARLIE, &Key::Fix([1; 32])), None); } -} \ No newline at end of file + + #[test] + fn metering_nested_limit_works() { + let mut storage = TransientStorage::::new(1024, 128); + + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Err(Error::::OutOfStorage.into()) + ); + storage.commit_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); + } + + #[test] + fn metering_total_limit_works() { + let mut storage = TransientStorage::::new(256, 256); + + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1]), false), + Err(Error::::OutOfStorage.into()) + ); + storage.commit_transaction(); + storage.commit_transaction(); + } + + #[test] + fn metering_total_limit_with_rollback_works() { + let mut storage = TransientStorage::::new(256, 256); + + storage.start_transaction(); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.rollback_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); + } +} From e683b72bc5831a45ef13fe8cae5e8f7cd18f789c Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 4 Jun 2024 00:26:28 +0200 Subject: [PATCH 09/58] Add comments --- .../frame/contracts/src/transient_storage.rs | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 70c2df2bc718..8c2cc5c06aee 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -187,10 +187,11 @@ impl Storage { } /// Get the storage keys for the account. - pub fn keys<'a>(&'a self, account: &'a [u8]) -> impl DoubleEndedIterator> + 'a { + pub fn keys<'a>(&'a self, account: &'a [u8]) -> impl Iterator> + 'a { self.0 .range((Included(account.to_vec()), Unbounded)) - .map(move |(key, _)| key[account.len()..].to_vec()) + .take_while(|(key, _)| key.starts_with(account)) + .map(|(key, _)| key[account.len()..].to_vec()) } fn storage_key(account: &[u8], key: &[u8]) -> Vec { @@ -246,17 +247,25 @@ impl TransientStorage { if prev_value != value { let key = key.hash(); let account = account.encode(); - let value_len = value.clone().map(|v| v.len()).unwrap_or_default(); - let key_len = account.len().saturating_add(key.len()); - if value_len > 0 { - // Charge the key, value and journal entry. - let mut amount = value_len - .saturating_add(key_len) + + // Calculate the allocation size. + if let Some(value) = &value { + // Charge the keys, value and journal entry. + // If a new value is written, a new journal entry is created. The previous value is + // moved to the journal along with its keys, and the new value is written to + // storage. + let keys_len = account.len().saturating_add(key.len()); + let mut amount = value + .len() + .saturating_add(keys_len) .saturating_add(mem::size_of::()); if prev_value.is_none() { // Charge a new storage entry. + // If there was no previous value, a new entry is added to storage (BTreeMap) + // containing a Vec for the key and a Vec for the value. The value was already + // included in the amount. amount = amount - .saturating_add(key_len) + .saturating_add(keys_len) .saturating_add(mem::size_of::>().saturating_mul(2)); } self.meter.charge(amount as _)?; @@ -378,13 +387,13 @@ mod tests { Ok(WriteOutcome::New) ); assert_eq!( - storage.write(&BOB, &Key::Fix([3; 32]), Some(vec![3]), false), + storage.write(&BOB, &Key::Fix([1; 32]), Some(vec![3]), false), Ok(WriteOutcome::New) ); storage.remove(&ALICE); assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), None); - assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), Some(vec![3])); + assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), Some(vec![3])); } #[test] From 1c3c844000c7edb02bcc7644478c5ec25b7a0504 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 4 Jun 2024 10:05:58 +0200 Subject: [PATCH 10/58] Cleanup --- substrate/frame/contracts/src/exec.rs | 1 - substrate/frame/contracts/src/lib.rs | 3 +-- substrate/frame/contracts/src/transient_storage.rs | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 6659dad4c0a9..a592bab063f1 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -1374,7 +1374,6 @@ where contract: account_id, beneficiary: beneficiary.clone(), }); - Ok(()) } diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 179bed0344bd..c3c54187f3de 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -614,8 +614,7 @@ pub mod pallet { // Transient storage uses a BTreeMap, which has overhead compared to the raw size of // key-value data. To ensure safety, a margin of 2x the raw key-value size is used. let max_transient_storage_len = T::MaxTransientStorageLen::get() - .checked_mul(2) - .unwrap_or_else(|| panic!("MaxTransientStorageLen to big")); + .checked_mul(2).expect("MaxTransientStorageLen to big"); // Check that given configured `MaxCodeLen`, runtime heap memory limit can't be broken. // // In worst case, the decoded Wasm contract code would be `x16` times larger than the diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 8c2cc5c06aee..882091028fbe 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -72,13 +72,13 @@ impl StorageMeter { /// Charge the allocated amount of transaction storage from the meter. pub fn charge(&mut self, amount: u32) -> DispatchResult { - let current = self.top_meter().current.saturating_add(amount); - if amount.saturating_add(self.current_amount()) > self.transaction_limit || + let current_amount = self.current_amount().saturating_add(amount); + if current_amount > self.transaction_limit || amount.saturating_add(self.total_amount()) > self.total_limit { return Err(Error::::OutOfStorage.into()); } - self.top_meter_mut().current = current; + self.top_meter_mut().current = current_amount; Ok(()) } From 18cd9ad8167becaca04bb5829941a53f9dba0fe2 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 4 Jun 2024 10:35:57 +0200 Subject: [PATCH 11/58] Fix unit tests --- substrate/frame/contracts/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index c3c54187f3de..904c2cb933de 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -559,7 +559,7 @@ pub mod pallet { type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxDelegateDependencies = MaxDelegateDependencies; type MaxStorageKeyLen = ConstU32<128>; - type MaxTransientStorageLen = ConstU32<256>; + type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; type Migrations = (); type Time = Self; type Randomness = Self; From 58d87dc12b1a3b801be3779aad9ef81e670edd97 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 4 Jun 2024 11:52:47 +0200 Subject: [PATCH 12/58] Fix tests after master merge --- substrate/frame/contracts/src/exec.rs | 10 ++++--- substrate/frame/contracts/src/lib.rs | 3 ++- .../frame/contracts/src/transient_storage.rs | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 45481932c181..b368b5dd75a8 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -3903,7 +3903,8 @@ mod tests { CHARLIE, 0, vec![], - true + true, + false, ), exec_success() ); @@ -3924,7 +3925,7 @@ mod tests { let code_charlie = MockLoader::insert(Call, |ctx, _| { assert!(ctx .ext - .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true) + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true, false) .is_ok()); // CHARLIE can not read BOB`s storage. assert_eq!(ctx.ext.get_transient_storage(storage_key_1), None); @@ -3972,7 +3973,8 @@ mod tests { CHARLIE, 0, vec![], - true + true, + false ), exec_trapped() ); @@ -3990,7 +3992,7 @@ mod tests { let code_charlie = MockLoader::insert(Call, |ctx, _| { assert!(ctx .ext - .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true) + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true, false) .is_ok()); exec_trapped() }); diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 3264b3565a0c..a0e080414566 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -614,7 +614,8 @@ pub mod pallet { // Transient storage uses a BTreeMap, which has overhead compared to the raw size of // key-value data. To ensure safety, a margin of 2x the raw key-value size is used. let max_transient_storage_len = T::MaxTransientStorageLen::get() - .checked_mul(2).expect("MaxTransientStorageLen to big"); + .checked_mul(2) + .expect("MaxTransientStorageLen to big"); // Check that given configured `MaxCodeLen`, runtime heap memory limit can't be broken. // // In worst case, the decoded Wasm contract code would be `x16` times larger than the diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 882091028fbe..a6eb2b3baf39 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -597,4 +597,30 @@ mod tests { ); storage.commit_transaction(); } + + #[test] + fn metering_with_rollback_works() { + let mut storage = TransientStorage::::new(1024, 256); + + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + Ok(WriteOutcome::New) + ); + let amount = storage.meter.total_amount(); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![2]), false), + Ok(WriteOutcome::New) + ); + storage.start_transaction(); + assert_eq!( + storage.write(&BOB, &Key::Fix([1; 32]), Some(vec![3]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); + storage.rollback_transaction(); + storage.commit_transaction(); + assert_eq!(amount, storage.meter.total_amount()); + } } From 29f1305c289e061db60b36971827b39e5d66e5de Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 5 Jun 2024 09:45:18 +0200 Subject: [PATCH 13/58] Rename storage err --- substrate/frame/contracts/src/lib.rs | 2 +- substrate/frame/contracts/src/transient_storage.rs | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index a0e080414566..07f7530bb399 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -1249,7 +1249,7 @@ pub mod pallet { /// Can not add a delegate dependency to the code hash of the contract itself. CannotAddSelfAsDelegateDependency, /// Can not add more data to transient storage. - OutOfStorage, + OutOfTransientStorage, } /// A reason for the pallet contracts placing a hold on funds. diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index a6eb2b3baf39..69ea8ea2a035 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -33,8 +33,6 @@ use sp_std::{ ops::Bound::{Included, Unbounded}, vec::Vec, }; -type MeterEntries = Vec; -type Checkpoints = Vec; /// Meter entry tracks transaction allocations. #[derive(Default, Debug)] @@ -60,7 +58,7 @@ impl MeterEntry { struct StorageMeter { total_limit: u32, transaction_limit: u32, - nested: MeterEntries, + nested: Vec, root: MeterEntry, _phantom: PhantomData, } @@ -76,7 +74,7 @@ impl StorageMeter { if current_amount > self.transaction_limit || amount.saturating_add(self.total_amount()) > self.total_limit { - return Err(Error::::OutOfStorage.into()); + return Err(Error::::OutOfTransientStorage.into()); } self.top_meter_mut().current = current_amount; Ok(()) @@ -216,7 +214,7 @@ pub struct TransientStorage { // The size of the StorageMeter is limited by the stack depth. meter: StorageMeter, // The size of the checkpoints is limited by the stack depth. - checkpoints: Checkpoints, + checkpoints: Vec, } impl TransientStorage { @@ -556,7 +554,7 @@ mod tests { storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), - Err(Error::::OutOfStorage.into()) + Err(Error::::OutOfTransientStorage.into()) ); storage.commit_transaction(); assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); @@ -574,7 +572,7 @@ mod tests { storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1]), false), - Err(Error::::OutOfStorage.into()) + Err(Error::::OutOfTransientStorage.into()) ); storage.commit_transaction(); storage.commit_transaction(); From 63aaaafd93b5830d65686176ebb36376059d7595 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 18 Jun 2024 08:31:08 +0200 Subject: [PATCH 14/58] Benchmarking test --- .../src/benchmarking/call_builder.rs | 2 +- .../frame/contracts/src/benchmarking/mod.rs | 87 +++++++++++++++++++ substrate/frame/contracts/src/exec.rs | 8 ++ .../frame/contracts/src/transient_storage.rs | 6 +- substrate/frame/contracts/src/wasm/mod.rs | 5 ++ substrate/frame/contracts/src/wasm/runtime.rs | 8 +- substrate/frame/contracts/uapi/src/host.rs | 4 + .../frame/contracts/uapi/src/host/wasm32.rs | 43 +++++++++ 8 files changed, 153 insertions(+), 10 deletions(-) diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index 5d73d825fca9..fee09166933f 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -29,7 +29,7 @@ use frame_benchmarking::benchmarking; use sp_core::Get; use sp_std::prelude::*; -type StackExt<'a, T> = Stack<'a, T, WasmBlob>; +pub type StackExt<'a, T> = Stack<'a, T, WasmBlob>; /// A prepared contract call ready to be executed. pub struct PreparedCall<'a, T: Config> { diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 7c993bc9a771..89e85f88c694 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -23,6 +23,7 @@ mod code; mod sandbox; use self::{ call_builder::CallSetup, + call_builder::StackExt, code::{body, ImportedMemory, Location, ModuleDefinition, WasmModule}, sandbox::Sandbox, }; @@ -184,6 +185,27 @@ fn caller_funding() -> BalanceOf { BalanceOf::::max_value() / 10_000u32.into() } +fn dummy_transient_storage( + ext: &mut StackExt, + stor_num: u32, + stor_size: u32, +) -> Result<(), BenchmarkError> { + let storage_items = (0..stor_num) + .map(|i| { + let hash = T::Hashing::hash_of(&i) + .as_ref() + .try_into() + .map_err(|_| "Hash too big for storage key")?; + Ok((hash, vec![42u8; stor_size as usize])) + }) + .collect::, &'static str>>()?; + for item in storage_items { + ext.set_transient_storage(&Key::Fix(item.0), Some(item.1.clone()), false) + .map_err(|_| "Failed to write storage to restoration dest")?; + } + Ok(()) +} + #[benchmarks( where as codec::HasCompact>::Type: Clone + Eq + PartialEq + sp_std::fmt::Debug + scale_info::TypeInfo + codec::Encode, @@ -1162,6 +1184,71 @@ mod benchmarks { Ok(()) } + // The weight of journal rollbacks should be taken into account when setting storage. + #[benchmark] + fn rollback_journal(//n: Linear<0, { T::Schedule::get().limits.payload_len }>, + ) -> Result<(), BenchmarkError> { + let n = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + + let mut setup = CallSetup::::default(); + let (mut ext, _) = setup.ext(); + let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + let max_storage_items = T::MaxTransientStorageLen::get() + .saturating_div(max_key_len.saturating_add(128).saturating_add(n)); + dummy_transient_storage::(runtime.ext(), max_storage_items, n)?; + runtime.ext().transient_storage().start_transaction(); + runtime + .ext() + .set_transient_storage(&key, Some(vec![0u8; n as _]), false) + .map_err(|_| "Failed to write to storage during setup.")?; + #[block] + { + runtime.ext().transient_storage().rollback_transaction(); + } + + assert_eq!(runtime.ext().get_transient_storage(&key), None); + Ok(()) + } + + #[benchmark] + fn seal_set_transient_storage() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let max_storage_items = T::MaxTransientStorageLen::get() + .saturating_div(max_key_len.saturating_add(128).saturating_add(max_value_len)); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + let value = vec![1u8; max_value_len as usize]; + + build_runtime!(runtime, memory: [ key.to_vec(), value.clone(), ]); + + dummy_transient_storage::(runtime.ext(), max_storage_items, 16000)?; + runtime + .ext() + .set_transient_storage(&key, Some(vec![16u8; max_value_len as usize]), false) + .map_err(|_| "Failed to write to storage during setup.")?; + + let result; + #[block] + { + result = BenchEnv::seal0_set_transient_storage( + &mut runtime, + &mut memory, + 0, // key_ptr + max_key_len, // key_len + max_key_len, // value_ptr + max_value_len, // value_len + ); + } + + assert_ok!(result); + assert_eq!(runtime.ext().get_transient_storage(&key).unwrap(), value); + Ok(()) + } + // We transfer to unique accounts. #[benchmark(pov_mode = Measured)] fn seal_transfer() { diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index b368b5dd75a8..cefc75803198 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -329,6 +329,9 @@ pub trait Ext: sealing::Sealed { #[cfg(any(test, feature = "runtime-benchmarks"))] fn contract_info(&mut self) -> &mut ContractInfo; + #[cfg(any(test, feature = "runtime-benchmarks"))] + fn transient_storage(&mut self) -> &mut TransientStorage; + /// Sets new code hash for existing contract. fn set_code_hash(&mut self, hash: CodeHash) -> DispatchResult; @@ -1577,6 +1580,11 @@ where self.top_frame_mut().contract_info() } + #[cfg(any(test, feature = "runtime-benchmarks"))] + fn transient_storage(&mut self) -> &mut TransientStorage { + &mut self.transient_storage + } + fn set_code_hash(&mut self, hash: CodeHash) -> DispatchResult { let frame = top_frame_mut!(self); if !E::from_storage(hash, &mut frame.nested_gas)?.is_deterministic() { diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 69ea8ea2a035..188c4b3a4a4c 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -22,7 +22,7 @@ use core::marker::PhantomData; use crate::{ exec::{AccountIdOf, Key}, storage::WriteOutcome, - Config, Error, + Config, }; use codec::Encode; use frame_support::DefaultNoBound; @@ -74,7 +74,7 @@ impl StorageMeter { if current_amount > self.transaction_limit || amount.saturating_add(self.total_amount()) > self.total_limit { - return Err(Error::::OutOfTransientStorage.into()); + // return Err(Error::::OutOfTransientStorage.into()); } self.top_meter_mut().current = current_amount; Ok(()) @@ -214,7 +214,7 @@ pub struct TransientStorage { // The size of the StorageMeter is limited by the stack depth. meter: StorageMeter, // The size of the checkpoints is limited by the stack depth. - checkpoints: Vec, + checkpoints: Vec, } impl TransientStorage { diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index b304f5cf9824..c93e812b4a0e 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -804,6 +804,11 @@ mod tests { fn contract_info(&mut self) -> &mut crate::ContractInfo { unimplemented!() } + fn transient_storage( + &mut self, + ) -> &mut crate::transient_storage::TransientStorage { + unimplemented!() + } fn ecdsa_to_eth_address(&self, _pk: &[u8; 33]) -> Result<[u8; 20], ()> { Ok([2u8; 20]) } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 926d0c98ff4b..f294c487d931 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -1182,7 +1182,6 @@ pub mod env { } /// Set the value at the given key in the contract transient storage. - #[prefixed_alias] #[unstable] fn set_transient_storage( ctx: _, @@ -1196,7 +1195,6 @@ pub mod env { } /// Clear the value at the given key in the contract storage. - #[prefixed_alias] #[unstable] fn clear_transient_storage( ctx: _, @@ -1208,20 +1206,19 @@ pub mod env { } /// Retrieve the value under the given key from transient storage. - #[prefixed_alias] #[unstable] fn get_transient_storage( ctx: _, memory: _, key_ptr: u32, + key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> Result { - ctx.get_transient_storage(memory, KeyType::Fix, key_ptr, out_ptr, out_len_ptr) + ctx.get_transient_storage(memory, KeyType::Var(key_len), key_ptr, out_ptr, out_len_ptr) } /// Checks whether there is a value stored under the given key in transient storage. - #[prefixed_alias] #[unstable] fn contains_transient_storage( ctx: _, @@ -1233,7 +1230,6 @@ pub mod env { } /// Retrieve and remove the value under the given key from transient storage. - #[prefixed_alias] #[unstable] fn take_transient_storage( ctx: _, diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index 92065eda5d63..df47094609eb 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -453,6 +453,9 @@ pub trait HostFn { /// [KeyNotFound][`crate::ReturnErrorCode::KeyNotFound] fn get_storage_v1(key: &[u8], output: &mut &mut [u8]) -> Result; + fn get_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result; + + hash_fn!(sha2_256, 32); hash_fn!(keccak_256, 32); hash_fn!(blake2_256, 32); @@ -672,6 +675,7 @@ pub trait HostFn { /// /// Returns the size of the pre-existing value at the specified key if any. fn set_storage_v2(key: &[u8], value: &[u8]) -> Option; + fn set_transient_storage(key: &[u8], value: &[u8]) -> Option; /// Verify a sr25519 signature /// diff --git a/substrate/frame/contracts/uapi/src/host/wasm32.rs b/substrate/frame/contracts/uapi/src/host/wasm32.rs index cb5435bfc014..e1c6a6faa3b3 100644 --- a/substrate/frame/contracts/uapi/src/host/wasm32.rs +++ b/substrate/frame/contracts/uapi/src/host/wasm32.rs @@ -103,6 +103,13 @@ mod sys { out_len_ptr: *mut u32, ) -> ReturnCode; + pub fn get_transient_storage( + key_ptr: *const u8, + key_len: u32, + out_ptr: *mut u8, + out_len_ptr: *mut u32, + ) -> ReturnCode; + pub fn hash_blake2_128(input_ptr: *const u8, input_len: u32, output_ptr: *mut u8); pub fn hash_blake2_256(input_ptr: *const u8, input_len: u32, output_ptr: *mut u8); @@ -133,6 +140,13 @@ mod sys { pub fn set_storage(key_ptr: *const u8, value_ptr: *const u8, value_len: u32); + pub fn set_transient_storage( + key_ptr: *const u8, + key_len: u32, + value_ptr: *const u8, + value_len: u32, + ) -> ReturnCode; + pub fn sr25519_verify( signature_ptr: *const u8, public_key_ptr: *const u8, @@ -598,6 +612,18 @@ impl HostFn for HostFnImpl { ret_code.into() } + fn set_transient_storage(key: &[u8], encoded_value: &[u8]) -> Option { + let ret_code = unsafe { + sys::set_transient_storage( + key.as_ptr(), + key.len() as u32, + encoded_value.as_ptr(), + encoded_value.len() as u32, + ) + }; + ret_code.into() + } + fn clear_storage(key: &[u8]) { unsafe { sys::clear_storage(key.as_ptr()) }; } @@ -633,6 +659,23 @@ impl HostFn for HostFnImpl { ret_code.into() } + #[inline(always)] + fn get_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result { + let mut output_len = output.len() as u32; + let ret_code = { + unsafe { + sys::get_transient_storage( + key.as_ptr(), + key.len() as u32, + output.as_mut_ptr(), + &mut output_len, + ) + } + }; + extract_from_slice(output, output_len as usize); + ret_code.into() + } + #[inline(always)] fn take_storage(key: &[u8], output: &mut &mut [u8]) -> Result { let mut output_len = output.len() as u32; From 78960e07521fa493c0c493f0195e90eb499d2290 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 18 Jun 2024 15:05:26 +0200 Subject: [PATCH 15/58] Fix unit tests --- substrate/bin/node/runtime/src/lib.rs | 1 + .../frame/contracts/src/benchmarking/mod.rs | 16 +++++++--------- substrate/frame/contracts/src/exec.rs | 3 +-- substrate/frame/contracts/src/lib.rs | 5 +++++ .../frame/contracts/src/transient_storage.rs | 4 ++-- .../frame/contracts/uapi/src/host/riscv32.rs | 8 ++++++++ 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 36141bec93a8..8af2a9794cce 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1379,6 +1379,7 @@ impl pallet_contracts::Config for Runtime { type InstantiateOrigin = EnsureSigned; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; + type MaxTransientStorageItems = ConstU32<50>; type RuntimeHoldReason = RuntimeHoldReason; #[cfg(not(feature = "runtime-benchmarks"))] type Migrations = (); diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 89e85f88c694..f3b0ecd938f5 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -22,8 +22,7 @@ mod call_builder; mod code; mod sandbox; use self::{ - call_builder::CallSetup, - call_builder::StackExt, + call_builder::{CallSetup, StackExt}, code::{body, ImportedMemory, Location, ModuleDefinition, WasmModule}, sandbox::Sandbox, }; @@ -1186,8 +1185,7 @@ mod benchmarks { // The weight of journal rollbacks should be taken into account when setting storage. #[benchmark] - fn rollback_journal(//n: Linear<0, { T::Schedule::get().limits.payload_len }>, - ) -> Result<(), BenchmarkError> { + fn rollback_journal() -> Result<(), BenchmarkError> { let n = T::Schedule::get().limits.payload_len; let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) @@ -1196,8 +1194,8 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); - let max_storage_items = T::MaxTransientStorageLen::get() - .saturating_div(max_key_len.saturating_add(128).saturating_add(n)); + let max_storage_items = T::MaxTransientStorageItems::get(); + dummy_transient_storage::(runtime.ext(), max_storage_items, n)?; runtime.ext().transient_storage().start_transaction(); runtime @@ -1217,15 +1215,15 @@ mod benchmarks { fn seal_set_transient_storage() -> Result<(), BenchmarkError> { let max_value_len = T::Schedule::get().limits.payload_len; let max_key_len = T::MaxStorageKeyLen::get(); - let max_storage_items = T::MaxTransientStorageLen::get() - .saturating_div(max_key_len.saturating_add(128).saturating_add(max_value_len)); + let max_storage_items = T::MaxTransientStorageItems::get(); + sp_runtime::print("{max_storage_items}"); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; let value = vec![1u8; max_value_len as usize]; build_runtime!(runtime, memory: [ key.to_vec(), value.clone(), ]); - dummy_transient_storage::(runtime.ext(), max_storage_items, 16000)?; + dummy_transient_storage::(runtime.ext(), max_storage_items, max_value_len)?; runtime .ext() .set_transient_storage(&key, Some(vec![16u8; max_value_len as usize]), false) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index cefc75803198..0d33c58ccf71 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -826,8 +826,7 @@ where determinism, transient_storage: TransientStorage::new( transient_storage_limit, - transient_storage_limit - .saturating_div((T::CallStack::size() as u32).saturating_add(1)), + transient_storage_limit, ), _phantom: Default::default(), }; diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 07f7530bb399..708aed1cfc84 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -414,6 +414,10 @@ pub mod pallet { #[pallet::constant] type MaxTransientStorageLen: Get; + /// The maximum length of the transient storage in bytes. + #[pallet::constant] + type MaxTransientStorageItems: Get; + /// Origin allowed to upload code. /// /// By default, it is safe to set this to `EnsureSigned`, allowing anyone to upload contract @@ -560,6 +564,7 @@ pub mod pallet { type MaxDelegateDependencies = MaxDelegateDependencies; type MaxStorageKeyLen = ConstU32<128>; type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; + type MaxTransientStorageItems = ConstU32<{ 50 }>; type Migrations = (); type Time = Self; type Randomness = Self; diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 188c4b3a4a4c..3d690a3f1f45 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -22,7 +22,7 @@ use core::marker::PhantomData; use crate::{ exec::{AccountIdOf, Key}, storage::WriteOutcome, - Config, + Config, Error, }; use codec::Encode; use frame_support::DefaultNoBound; @@ -74,7 +74,7 @@ impl StorageMeter { if current_amount > self.transaction_limit || amount.saturating_add(self.total_amount()) > self.total_limit { - // return Err(Error::::OutOfTransientStorage.into()); + return Err(Error::::OutOfTransientStorage.into()); } self.top_meter_mut().current = current_amount; Ok(()) diff --git a/substrate/frame/contracts/uapi/src/host/riscv32.rs b/substrate/frame/contracts/uapi/src/host/riscv32.rs index 561ab28747df..0896eaedc1f6 100644 --- a/substrate/frame/contracts/uapi/src/host/riscv32.rs +++ b/substrate/frame/contracts/uapi/src/host/riscv32.rs @@ -183,6 +183,14 @@ impl HostFn for HostFnImpl { impl_get_storage!(get_storage, sys::get_storage); impl_get_storage!(get_storage_v1, sys::v1::get_storage); + fn set_transient_storage(key: &[u8], encoded_value: &[u8]) -> Option { + todo!() + } + + fn get_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result { + todo!() + } + fn take_storage(key: &[u8], output: &mut &mut [u8]) -> Result { todo!() } From 6d63e58cb02a5dd18f11513b2bbf886a9bb81223 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Tue, 18 Jun 2024 14:10:52 +0000 Subject: [PATCH 16/58] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 796 ++++++++++++----------- 1 file changed, 413 insertions(+), 383 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index 0404a9d3d8e5..4817edc8f514 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/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 32.0.0 -//! DATE: 2024-06-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-06-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `runner-1pho9goo-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` @@ -98,6 +98,8 @@ pub trait WeightInfo { fn seal_get_storage(n: u32, ) -> Weight; fn seal_contains_storage(n: u32, ) -> Weight; fn seal_take_storage(n: u32, ) -> Weight; + fn rollback_journal() -> Weight; + fn seal_set_transient_storage() -> Weight; fn seal_transfer() -> Weight; fn seal_call(t: u32, i: u32, ) -> Weight; fn seal_delegate_call() -> Weight; @@ -127,8 +129,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_896_000 picoseconds. - Weight::from_parts(1_990_000, 1627) + // Minimum execution time: 1_933_000 picoseconds. + Weight::from_parts(2_026_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -138,10 +140,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_142_000 picoseconds. - Weight::from_parts(11_578_000, 442) - // Standard Error: 1_557 - .saturating_add(Weight::from_parts(1_165_198, 0).saturating_mul(k.into())) + // Minimum execution time: 10_870_000 picoseconds. + Weight::from_parts(11_176_000, 442) + // Standard Error: 2_048 + .saturating_add(Weight::from_parts(1_251_637, 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)) @@ -155,10 +157,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_649_000 picoseconds. - Weight::from_parts(4_827_445, 6149) + // Minimum execution time: 7_525_000 picoseconds. + Weight::from_parts(4_905_215, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_630, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_682, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -171,8 +173,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_096_000 picoseconds. - Weight::from_parts(16_937_000, 6450) + // Minimum execution time: 15_910_000 picoseconds. + Weight::from_parts(16_415_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -185,10 +187,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_131_000 picoseconds. - Weight::from_parts(3_209_000, 3635) - // Standard Error: 481 - .saturating_add(Weight::from_parts(1_087_506, 0).saturating_mul(k.into())) + // Minimum execution time: 3_164_000 picoseconds. + Weight::from_parts(3_198_000, 3635) + // Standard Error: 691 + .saturating_add(Weight::from_parts(1_094_227, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -207,10 +209,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_289_000 picoseconds. - Weight::from_parts(16_157_168, 6263) + // Minimum execution time: 14_928_000 picoseconds. + Weight::from_parts(15_740_628, 6263) // Standard Error: 1 - .saturating_add(Weight::from_parts(395, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(492, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -221,8 +223,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_312_000 picoseconds. - Weight::from_parts(12_650_000, 6380) + // Minimum execution time: 11_896_000 picoseconds. + Weight::from_parts(12_288_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -236,8 +238,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 47_239_000 picoseconds. - Weight::from_parts(48_617_000, 6292) + // Minimum execution time: 46_408_000 picoseconds. + Weight::from_parts(47_498_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -249,8 +251,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_084_000 picoseconds. - Weight::from_parts(53_838_000, 6534) + // Minimum execution time: 52_300_000 picoseconds. + Weight::from_parts(53_474_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -260,8 +262,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_785_000 picoseconds. - Weight::from_parts(12_284_000, 6349) + // Minimum execution time: 11_661_000 picoseconds. + Weight::from_parts(11_930_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -271,8 +273,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_136_000 picoseconds. - Weight::from_parts(2_233_000, 1627) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_219_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -284,8 +286,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_957_000 picoseconds. - Weight::from_parts(11_314_000, 3631) + // Minimum execution time: 10_661_000 picoseconds. + Weight::from_parts(11_056_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -295,8 +297,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_354_000 picoseconds. - Weight::from_parts(4_613_000, 3607) + // Minimum execution time: 4_347_000 picoseconds. + Weight::from_parts(4_640_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -307,8 +309,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_541_000 picoseconds. - Weight::from_parts(5_790_000, 3632) + // Minimum execution time: 5_483_000 picoseconds. + Weight::from_parts(5_743_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -319,8 +321,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_502_000 picoseconds. - Weight::from_parts(5_701_000, 3607) + // Minimum execution time: 5_393_000 picoseconds. + Weight::from_parts(5_558_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -341,10 +343,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 247_884_000 picoseconds. - Weight::from_parts(265_795_781, 4264) - // Standard Error: 4 - .saturating_add(Weight::from_parts(724, 0).saturating_mul(c.into())) + // Minimum execution time: 321_985_000 picoseconds. + Weight::from_parts(327_518_509, 4264) + // Standard Error: 10 + .saturating_add(Weight::from_parts(885, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -372,14 +374,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_500_184_000 picoseconds. - Weight::from_parts(160_729_258, 6262) - // Standard Error: 143 - .saturating_add(Weight::from_parts(52_809, 0).saturating_mul(c.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(2_173, 0).saturating_mul(i.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(2_165, 0).saturating_mul(s.into())) + // Minimum execution time: 4_997_437_000 picoseconds. + Weight::from_parts(5_149_156_000, 6262) + // Standard Error: 324 + .saturating_add(Weight::from_parts(39_435, 0).saturating_mul(c.into())) + // Standard Error: 38 + .saturating_add(Weight::from_parts(575, 0).saturating_mul(i.into())) + // Standard Error: 38 + .saturating_add(Weight::from_parts(586, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -405,12 +407,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_219_163_000 picoseconds. - Weight::from_parts(2_236_918_000, 4029) - // Standard Error: 32 - .saturating_add(Weight::from_parts(937, 0).saturating_mul(i.into())) - // Standard Error: 32 - .saturating_add(Weight::from_parts(938, 0).saturating_mul(s.into())) + // Minimum execution time: 2_364_282_000 picoseconds. + Weight::from_parts(2_389_446_000, 4029) + // Standard Error: 36 + .saturating_add(Weight::from_parts(1_113, 0).saturating_mul(i.into())) + // Standard Error: 36 + .saturating_add(Weight::from_parts(980, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -430,8 +432,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 164_801_000 picoseconds. - Weight::from_parts(167_250_000, 4291) + // Minimum execution time: 167_526_000 picoseconds. + Weight::from_parts(174_544_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -448,10 +450,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 225_207_000 picoseconds. - Weight::from_parts(263_665_658, 3607) - // Standard Error: 47 - .saturating_add(Weight::from_parts(50_732, 0).saturating_mul(c.into())) + // Minimum execution time: 305_053_000 picoseconds. + Weight::from_parts(311_408_314, 3607) + // Standard Error: 56 + .saturating_add(Weight::from_parts(53_656, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -468,10 +470,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 230_718_000 picoseconds. - Weight::from_parts(258_359_271, 3607) - // Standard Error: 47 - .saturating_add(Weight::from_parts(51_014, 0).saturating_mul(c.into())) + // Minimum execution time: 314_292_000 picoseconds. + Weight::from_parts(326_137_586, 3607) + // Standard Error: 52 + .saturating_add(Weight::from_parts(53_388, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -487,8 +489,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_668_000 picoseconds. - Weight::from_parts(41_031_000, 3780) + // Minimum execution time: 38_404_000 picoseconds. + Weight::from_parts(39_373_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -502,8 +504,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_890_000 picoseconds. - Weight::from_parts(26_603_000, 6492) + // Minimum execution time: 24_870_000 picoseconds. + Weight::from_parts(26_097_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -512,17 +514,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_269_000 picoseconds. - Weight::from_parts(9_227_069, 0) - // Standard Error: 74 - .saturating_add(Weight::from_parts(51_396, 0).saturating_mul(r.into())) + // Minimum execution time: 8_548_000 picoseconds. + Weight::from_parts(9_354_564, 0) + // Standard Error: 76 + .saturating_add(Weight::from_parts(50_779, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 602_000 picoseconds. - Weight::from_parts(664_000, 0) + // Minimum execution time: 595_000 picoseconds. + Weight::from_parts(629_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -530,8 +532,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_131_000 picoseconds. - Weight::from_parts(6_468_000, 3819) + // Minimum execution time: 5_971_000 picoseconds. + Weight::from_parts(6_418_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -540,79 +542,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_557_000 picoseconds. - Weight::from_parts(7_704_000, 3912) + // Minimum execution time: 7_118_000 picoseconds. + Weight::from_parts(7_406_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 783_000 picoseconds. - Weight::from_parts(848_000, 0) + // Minimum execution time: 767_000 picoseconds. + Weight::from_parts(846_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 397_000 picoseconds. - Weight::from_parts(435_000, 0) + // Minimum execution time: 422_000 picoseconds. + Weight::from_parts(461_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 351_000 picoseconds. - Weight::from_parts(372_000, 0) + // Minimum execution time: 329_000 picoseconds. + Weight::from_parts(373_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 608_000 picoseconds. - Weight::from_parts(645_000, 0) + // Minimum execution time: 537_000 picoseconds. + Weight::from_parts(606_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 661_000 picoseconds. - Weight::from_parts(729_000, 0) + // Minimum execution time: 674_000 picoseconds. + Weight::from_parts(706_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_545_000 picoseconds. - Weight::from_parts(4_663_000, 0) + // Minimum execution time: 4_600_000 picoseconds. + Weight::from_parts(4_712_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 614_000 picoseconds. - Weight::from_parts(641_000, 0) + // Minimum execution time: 580_000 picoseconds. + Weight::from_parts(625_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 583_000 picoseconds. - Weight::from_parts(618_000, 0) + // Minimum execution time: 573_000 picoseconds. + Weight::from_parts(614_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 583_000 picoseconds. - Weight::from_parts(617_000, 0) + // Minimum execution time: 531_000 picoseconds. + Weight::from_parts(603_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 607_000 picoseconds. - Weight::from_parts(638_000, 0) + // Minimum execution time: 564_000 picoseconds. + Weight::from_parts(610_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -620,8 +622,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_172_000 picoseconds. - Weight::from_parts(4_408_000, 1552) + // Minimum execution time: 4_059_000 picoseconds. + Weight::from_parts(4_269_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -629,20 +631,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 475_000 picoseconds. - Weight::from_parts(515_000, 0) + // Minimum execution time: 480_000 picoseconds. + Weight::from_parts(511_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(298, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(310, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 289_000 picoseconds. - Weight::from_parts(357_000, 0) - // Standard Error: 10 - .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) + // Minimum execution time: 303_000 picoseconds. + Weight::from_parts(327_000, 0) + // Standard Error: 9 + .saturating_add(Weight::from_parts(488, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -655,10 +657,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_316_000 picoseconds. - Weight::from_parts(15_855_821, 3784) - // Standard Error: 7_274 - .saturating_add(Weight::from_parts(3_447_246, 0).saturating_mul(n.into())) + // Minimum execution time: 13_335_000 picoseconds. + Weight::from_parts(15_687_784, 3784) + // Standard Error: 7_246 + .saturating_add(Weight::from_parts(3_411_317, 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(3_u64)) @@ -671,8 +673,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_468_000 picoseconds. - Weight::from_parts(3_608_000, 1561) + // Minimum execution time: 3_347_000 picoseconds. + Weight::from_parts(3_535_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -683,12 +685,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_777_000 picoseconds. - Weight::from_parts(4_028_191, 990) - // Standard Error: 5_907 - .saturating_add(Weight::from_parts(2_183_733, 0).saturating_mul(t.into())) + // Minimum execution time: 3_619_000 picoseconds. + Weight::from_parts(3_670_641, 990) + // Standard Error: 5_009 + .saturating_add(Weight::from_parts(2_062_438, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(18, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(23, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -698,10 +700,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 400_000 picoseconds. - Weight::from_parts(423_000, 0) + // Minimum execution time: 438_000 picoseconds. + Weight::from_parts(468_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_209, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_280, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -711,12 +713,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_033_000 picoseconds. - Weight::from_parts(8_797_934, 249) - // Standard Error: 1 - .saturating_add(Weight::from_parts(257, 0).saturating_mul(n.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(51, 0).saturating_mul(o.into())) + // Minimum execution time: 8_832_000 picoseconds. + Weight::from_parts(8_846_472, 249) + // Standard Error: 2 + .saturating_add(Weight::from_parts(363, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(35, 0).saturating_mul(o.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(o.into())) @@ -728,10 +730,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_167_000 picoseconds. - Weight::from_parts(8_012_194, 248) + // Minimum execution time: 7_147_000 picoseconds. + Weight::from_parts(7_926_890, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(90, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(80, 0).saturating_mul(n.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(n.into())) @@ -743,10 +745,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_868_000 picoseconds. - Weight::from_parts(7_801_811, 248) + // Minimum execution time: 6_671_000 picoseconds. + Weight::from_parts(7_560_048, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(605, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(708, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -757,10 +759,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_322_000 picoseconds. - Weight::from_parts(7_103_552, 248) + // Minimum execution time: 6_290_000 picoseconds. + Weight::from_parts(6_847_458, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(79, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(89, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -771,20 +773,34 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_702_000 picoseconds. - Weight::from_parts(8_746_305, 248) + // Minimum execution time: 7_557_000 picoseconds. + Weight::from_parts(8_519_922, 248) // Standard Error: 2 - .saturating_add(Weight::from_parts(604, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(703, 0).saturating_mul(n.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(n.into())) } + fn rollback_journal() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_302_000 picoseconds. + Weight::from_parts(1_377_000, 0) + } + fn seal_set_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 13_451_000 picoseconds. + Weight::from_parts(13_684_000, 0) + } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_851_000 picoseconds. - Weight::from_parts(9_083_000, 0) + // Minimum execution time: 8_516_000 picoseconds. + Weight::from_parts(8_934_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -800,12 +816,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 121_148_000 picoseconds. - Weight::from_parts(119_605_377, 4085) - // Standard Error: 208_337 - .saturating_add(Weight::from_parts(43_153_338, 0).saturating_mul(t.into())) + // Minimum execution time: 127_185_000 picoseconds. + Weight::from_parts(124_262_133, 4085) + // Standard Error: 169_873 + .saturating_add(Weight::from_parts(42_039_124, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(6, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -820,8 +836,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 108_159_000 picoseconds. - Weight::from_parts(110_027_000, 3895) + // Minimum execution time: 115_539_000 picoseconds. + Weight::from_parts(118_062_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -840,12 +856,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4127` - // Minimum execution time: 1_861_874_000 picoseconds. - Weight::from_parts(1_872_926_000, 4127) - // Standard Error: 23 - .saturating_add(Weight::from_parts(557, 0).saturating_mul(i.into())) - // Standard Error: 23 - .saturating_add(Weight::from_parts(920, 0).saturating_mul(s.into())) + // Minimum execution time: 2_042_664_000 picoseconds. + Weight::from_parts(2_044_771_000, 4127) + // Standard Error: 29 + .saturating_add(Weight::from_parts(691, 0).saturating_mul(i.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(979, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -854,64 +870,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 878_000 picoseconds. - Weight::from_parts(10_993_950, 0) + // Minimum execution time: 815_000 picoseconds. + Weight::from_parts(7_043_292, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_325, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_423, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_261_000 picoseconds. - Weight::from_parts(9_759_497, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(3_594, 0).saturating_mul(n.into())) + // Minimum execution time: 1_370_000 picoseconds. + Weight::from_parts(6_938_342, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_700, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 726_000 picoseconds. - Weight::from_parts(9_795_728, 0) + // Minimum execution time: 739_000 picoseconds. + Weight::from_parts(11_628_442, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_455, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_550, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 739_000 picoseconds. - Weight::from_parts(9_701_202, 0) + // Minimum execution time: 700_000 picoseconds. + Weight::from_parts(7_414_600, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_557, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_309_000 picoseconds. - Weight::from_parts(41_405_949, 0) - // Standard Error: 8 - .saturating_add(Weight::from_parts(5_336, 0).saturating_mul(n.into())) + // Minimum execution time: 42_852_000 picoseconds. + Weight::from_parts(41_490_939, 0) + // Standard Error: 9 + .saturating_add(Weight::from_parts(5_198, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_880_000 picoseconds. - Weight::from_parts(49_025_000, 0) + // Minimum execution time: 48_300_000 picoseconds. + Weight::from_parts(50_110_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_462_000 picoseconds. - Weight::from_parts(13_631_000, 0) + // Minimum execution time: 13_021_000 picoseconds. + Weight::from_parts(13_158_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -921,8 +937,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_978_000 picoseconds. - Weight::from_parts(18_578_000, 3895) + // Minimum execution time: 17_509_000 picoseconds. + Weight::from_parts(18_138_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -932,8 +948,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_384_000 picoseconds. - Weight::from_parts(8_687_000, 3820) + // Minimum execution time: 8_269_000 picoseconds. + Weight::from_parts(8_537_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -943,8 +959,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_547_000 picoseconds. - Weight::from_parts(7_935_000, 3558) + // Minimum execution time: 7_277_000 picoseconds. + Weight::from_parts(7_513_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -952,15 +968,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 331_000 picoseconds. - Weight::from_parts(363_000, 0) + // Minimum execution time: 310_000 picoseconds. + Weight::from_parts(336_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 349_000 picoseconds. - Weight::from_parts(365_000, 0) + // Minimum execution time: 372_000 picoseconds. + Weight::from_parts(398_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -968,8 +984,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_814_000 picoseconds. - Weight::from_parts(3_038_000, 1704) + // Minimum execution time: 2_808_000 picoseconds. + Weight::from_parts(3_003_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -977,10 +993,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 693_000 picoseconds. - Weight::from_parts(665_431, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(7_030, 0).saturating_mul(r.into())) + // Minimum execution time: 690_000 picoseconds. + Weight::from_parts(831_877, 0) + // Standard Error: 20 + .saturating_add(Weight::from_parts(7_123, 0).saturating_mul(r.into())) } } @@ -992,8 +1008,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_896_000 picoseconds. - Weight::from_parts(1_990_000, 1627) + // Minimum execution time: 1_933_000 picoseconds. + Weight::from_parts(2_026_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1003,10 +1019,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_142_000 picoseconds. - Weight::from_parts(11_578_000, 442) - // Standard Error: 1_557 - .saturating_add(Weight::from_parts(1_165_198, 0).saturating_mul(k.into())) + // Minimum execution time: 10_870_000 picoseconds. + Weight::from_parts(11_176_000, 442) + // Standard Error: 2_048 + .saturating_add(Weight::from_parts(1_251_637, 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)) @@ -1020,10 +1036,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_649_000 picoseconds. - Weight::from_parts(4_827_445, 6149) + // Minimum execution time: 7_525_000 picoseconds. + Weight::from_parts(4_905_215, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_630, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_682, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1036,8 +1052,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_096_000 picoseconds. - Weight::from_parts(16_937_000, 6450) + // Minimum execution time: 15_910_000 picoseconds. + Weight::from_parts(16_415_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1050,10 +1066,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_131_000 picoseconds. - Weight::from_parts(3_209_000, 3635) - // Standard Error: 481 - .saturating_add(Weight::from_parts(1_087_506, 0).saturating_mul(k.into())) + // Minimum execution time: 3_164_000 picoseconds. + Weight::from_parts(3_198_000, 3635) + // Standard Error: 691 + .saturating_add(Weight::from_parts(1_094_227, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1072,10 +1088,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_289_000 picoseconds. - Weight::from_parts(16_157_168, 6263) + // Minimum execution time: 14_928_000 picoseconds. + Weight::from_parts(15_740_628, 6263) // Standard Error: 1 - .saturating_add(Weight::from_parts(395, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(492, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1086,8 +1102,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_312_000 picoseconds. - Weight::from_parts(12_650_000, 6380) + // Minimum execution time: 11_896_000 picoseconds. + Weight::from_parts(12_288_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1101,8 +1117,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 47_239_000 picoseconds. - Weight::from_parts(48_617_000, 6292) + // Minimum execution time: 46_408_000 picoseconds. + Weight::from_parts(47_498_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1114,8 +1130,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_084_000 picoseconds. - Weight::from_parts(53_838_000, 6534) + // Minimum execution time: 52_300_000 picoseconds. + Weight::from_parts(53_474_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1125,8 +1141,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_785_000 picoseconds. - Weight::from_parts(12_284_000, 6349) + // Minimum execution time: 11_661_000 picoseconds. + Weight::from_parts(11_930_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1136,8 +1152,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_136_000 picoseconds. - Weight::from_parts(2_233_000, 1627) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_219_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1149,8 +1165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_957_000 picoseconds. - Weight::from_parts(11_314_000, 3631) + // Minimum execution time: 10_661_000 picoseconds. + Weight::from_parts(11_056_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1160,8 +1176,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_354_000 picoseconds. - Weight::from_parts(4_613_000, 3607) + // Minimum execution time: 4_347_000 picoseconds. + Weight::from_parts(4_640_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1172,8 +1188,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_541_000 picoseconds. - Weight::from_parts(5_790_000, 3632) + // Minimum execution time: 5_483_000 picoseconds. + Weight::from_parts(5_743_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1184,8 +1200,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_502_000 picoseconds. - Weight::from_parts(5_701_000, 3607) + // Minimum execution time: 5_393_000 picoseconds. + Weight::from_parts(5_558_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1206,10 +1222,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 247_884_000 picoseconds. - Weight::from_parts(265_795_781, 4264) - // Standard Error: 4 - .saturating_add(Weight::from_parts(724, 0).saturating_mul(c.into())) + // Minimum execution time: 321_985_000 picoseconds. + Weight::from_parts(327_518_509, 4264) + // Standard Error: 10 + .saturating_add(Weight::from_parts(885, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1237,14 +1253,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_500_184_000 picoseconds. - Weight::from_parts(160_729_258, 6262) - // Standard Error: 143 - .saturating_add(Weight::from_parts(52_809, 0).saturating_mul(c.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(2_173, 0).saturating_mul(i.into())) - // Standard Error: 17 - .saturating_add(Weight::from_parts(2_165, 0).saturating_mul(s.into())) + // Minimum execution time: 4_997_437_000 picoseconds. + Weight::from_parts(5_149_156_000, 6262) + // Standard Error: 324 + .saturating_add(Weight::from_parts(39_435, 0).saturating_mul(c.into())) + // Standard Error: 38 + .saturating_add(Weight::from_parts(575, 0).saturating_mul(i.into())) + // Standard Error: 38 + .saturating_add(Weight::from_parts(586, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1270,12 +1286,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_219_163_000 picoseconds. - Weight::from_parts(2_236_918_000, 4029) - // Standard Error: 32 - .saturating_add(Weight::from_parts(937, 0).saturating_mul(i.into())) - // Standard Error: 32 - .saturating_add(Weight::from_parts(938, 0).saturating_mul(s.into())) + // Minimum execution time: 2_364_282_000 picoseconds. + Weight::from_parts(2_389_446_000, 4029) + // Standard Error: 36 + .saturating_add(Weight::from_parts(1_113, 0).saturating_mul(i.into())) + // Standard Error: 36 + .saturating_add(Weight::from_parts(980, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1295,8 +1311,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 164_801_000 picoseconds. - Weight::from_parts(167_250_000, 4291) + // Minimum execution time: 167_526_000 picoseconds. + Weight::from_parts(174_544_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1313,10 +1329,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 225_207_000 picoseconds. - Weight::from_parts(263_665_658, 3607) - // Standard Error: 47 - .saturating_add(Weight::from_parts(50_732, 0).saturating_mul(c.into())) + // Minimum execution time: 305_053_000 picoseconds. + Weight::from_parts(311_408_314, 3607) + // Standard Error: 56 + .saturating_add(Weight::from_parts(53_656, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1333,10 +1349,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 230_718_000 picoseconds. - Weight::from_parts(258_359_271, 3607) - // Standard Error: 47 - .saturating_add(Weight::from_parts(51_014, 0).saturating_mul(c.into())) + // Minimum execution time: 314_292_000 picoseconds. + Weight::from_parts(326_137_586, 3607) + // Standard Error: 52 + .saturating_add(Weight::from_parts(53_388, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1352,8 +1368,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_668_000 picoseconds. - Weight::from_parts(41_031_000, 3780) + // Minimum execution time: 38_404_000 picoseconds. + Weight::from_parts(39_373_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1367,8 +1383,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_890_000 picoseconds. - Weight::from_parts(26_603_000, 6492) + // Minimum execution time: 24_870_000 picoseconds. + Weight::from_parts(26_097_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1377,17 +1393,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_269_000 picoseconds. - Weight::from_parts(9_227_069, 0) - // Standard Error: 74 - .saturating_add(Weight::from_parts(51_396, 0).saturating_mul(r.into())) + // Minimum execution time: 8_548_000 picoseconds. + Weight::from_parts(9_354_564, 0) + // Standard Error: 76 + .saturating_add(Weight::from_parts(50_779, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 602_000 picoseconds. - Weight::from_parts(664_000, 0) + // Minimum execution time: 595_000 picoseconds. + Weight::from_parts(629_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1395,8 +1411,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_131_000 picoseconds. - Weight::from_parts(6_468_000, 3819) + // Minimum execution time: 5_971_000 picoseconds. + Weight::from_parts(6_418_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1405,79 +1421,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_557_000 picoseconds. - Weight::from_parts(7_704_000, 3912) + // Minimum execution time: 7_118_000 picoseconds. + Weight::from_parts(7_406_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 783_000 picoseconds. - Weight::from_parts(848_000, 0) + // Minimum execution time: 767_000 picoseconds. + Weight::from_parts(846_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 397_000 picoseconds. - Weight::from_parts(435_000, 0) + // Minimum execution time: 422_000 picoseconds. + Weight::from_parts(461_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 351_000 picoseconds. - Weight::from_parts(372_000, 0) + // Minimum execution time: 329_000 picoseconds. + Weight::from_parts(373_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 608_000 picoseconds. - Weight::from_parts(645_000, 0) + // Minimum execution time: 537_000 picoseconds. + Weight::from_parts(606_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 661_000 picoseconds. - Weight::from_parts(729_000, 0) + // Minimum execution time: 674_000 picoseconds. + Weight::from_parts(706_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_545_000 picoseconds. - Weight::from_parts(4_663_000, 0) + // Minimum execution time: 4_600_000 picoseconds. + Weight::from_parts(4_712_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 614_000 picoseconds. - Weight::from_parts(641_000, 0) + // Minimum execution time: 580_000 picoseconds. + Weight::from_parts(625_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 583_000 picoseconds. - Weight::from_parts(618_000, 0) + // Minimum execution time: 573_000 picoseconds. + Weight::from_parts(614_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 583_000 picoseconds. - Weight::from_parts(617_000, 0) + // Minimum execution time: 531_000 picoseconds. + Weight::from_parts(603_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 607_000 picoseconds. - Weight::from_parts(638_000, 0) + // Minimum execution time: 564_000 picoseconds. + Weight::from_parts(610_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1485,8 +1501,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_172_000 picoseconds. - Weight::from_parts(4_408_000, 1552) + // Minimum execution time: 4_059_000 picoseconds. + Weight::from_parts(4_269_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1494,20 +1510,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 475_000 picoseconds. - Weight::from_parts(515_000, 0) + // Minimum execution time: 480_000 picoseconds. + Weight::from_parts(511_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(298, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(310, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 289_000 picoseconds. - Weight::from_parts(357_000, 0) - // Standard Error: 10 - .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) + // Minimum execution time: 303_000 picoseconds. + Weight::from_parts(327_000, 0) + // Standard Error: 9 + .saturating_add(Weight::from_parts(488, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1520,10 +1536,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_316_000 picoseconds. - Weight::from_parts(15_855_821, 3784) - // Standard Error: 7_274 - .saturating_add(Weight::from_parts(3_447_246, 0).saturating_mul(n.into())) + // Minimum execution time: 13_335_000 picoseconds. + Weight::from_parts(15_687_784, 3784) + // Standard Error: 7_246 + .saturating_add(Weight::from_parts(3_411_317, 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(3_u64)) @@ -1536,8 +1552,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_468_000 picoseconds. - Weight::from_parts(3_608_000, 1561) + // Minimum execution time: 3_347_000 picoseconds. + Weight::from_parts(3_535_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1548,12 +1564,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_777_000 picoseconds. - Weight::from_parts(4_028_191, 990) - // Standard Error: 5_907 - .saturating_add(Weight::from_parts(2_183_733, 0).saturating_mul(t.into())) + // Minimum execution time: 3_619_000 picoseconds. + Weight::from_parts(3_670_641, 990) + // Standard Error: 5_009 + .saturating_add(Weight::from_parts(2_062_438, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(18, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(23, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1563,10 +1579,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 400_000 picoseconds. - Weight::from_parts(423_000, 0) + // Minimum execution time: 438_000 picoseconds. + Weight::from_parts(468_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_209, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_280, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1576,12 +1592,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_033_000 picoseconds. - Weight::from_parts(8_797_934, 249) - // Standard Error: 1 - .saturating_add(Weight::from_parts(257, 0).saturating_mul(n.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(51, 0).saturating_mul(o.into())) + // Minimum execution time: 8_832_000 picoseconds. + Weight::from_parts(8_846_472, 249) + // Standard Error: 2 + .saturating_add(Weight::from_parts(363, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(35, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1593,10 +1609,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_167_000 picoseconds. - Weight::from_parts(8_012_194, 248) + // Minimum execution time: 7_147_000 picoseconds. + Weight::from_parts(7_926_890, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(90, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(80, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1608,10 +1624,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_868_000 picoseconds. - Weight::from_parts(7_801_811, 248) + // Minimum execution time: 6_671_000 picoseconds. + Weight::from_parts(7_560_048, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(605, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(708, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1622,10 +1638,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_322_000 picoseconds. - Weight::from_parts(7_103_552, 248) + // Minimum execution time: 6_290_000 picoseconds. + Weight::from_parts(6_847_458, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(79, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(89, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1636,20 +1652,34 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_702_000 picoseconds. - Weight::from_parts(8_746_305, 248) + // Minimum execution time: 7_557_000 picoseconds. + Weight::from_parts(8_519_922, 248) // Standard Error: 2 - .saturating_add(Weight::from_parts(604, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(703, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } + fn rollback_journal() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_302_000 picoseconds. + Weight::from_parts(1_377_000, 0) + } + fn seal_set_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 13_451_000 picoseconds. + Weight::from_parts(13_684_000, 0) + } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_851_000 picoseconds. - Weight::from_parts(9_083_000, 0) + // Minimum execution time: 8_516_000 picoseconds. + Weight::from_parts(8_934_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1665,12 +1695,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 121_148_000 picoseconds. - Weight::from_parts(119_605_377, 4085) - // Standard Error: 208_337 - .saturating_add(Weight::from_parts(43_153_338, 0).saturating_mul(t.into())) + // Minimum execution time: 127_185_000 picoseconds. + Weight::from_parts(124_262_133, 4085) + // Standard Error: 169_873 + .saturating_add(Weight::from_parts(42_039_124, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(6, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1685,8 +1715,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 108_159_000 picoseconds. - Weight::from_parts(110_027_000, 3895) + // Minimum execution time: 115_539_000 picoseconds. + Weight::from_parts(118_062_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1705,12 +1735,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4127` - // Minimum execution time: 1_861_874_000 picoseconds. - Weight::from_parts(1_872_926_000, 4127) - // Standard Error: 23 - .saturating_add(Weight::from_parts(557, 0).saturating_mul(i.into())) - // Standard Error: 23 - .saturating_add(Weight::from_parts(920, 0).saturating_mul(s.into())) + // Minimum execution time: 2_042_664_000 picoseconds. + Weight::from_parts(2_044_771_000, 4127) + // Standard Error: 29 + .saturating_add(Weight::from_parts(691, 0).saturating_mul(i.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(979, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1719,64 +1749,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 878_000 picoseconds. - Weight::from_parts(10_993_950, 0) + // Minimum execution time: 815_000 picoseconds. + Weight::from_parts(7_043_292, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_325, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_423, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_261_000 picoseconds. - Weight::from_parts(9_759_497, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(3_594, 0).saturating_mul(n.into())) + // Minimum execution time: 1_370_000 picoseconds. + Weight::from_parts(6_938_342, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_700, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 726_000 picoseconds. - Weight::from_parts(9_795_728, 0) + // Minimum execution time: 739_000 picoseconds. + Weight::from_parts(11_628_442, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_455, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_550, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 739_000 picoseconds. - Weight::from_parts(9_701_202, 0) + // Minimum execution time: 700_000 picoseconds. + Weight::from_parts(7_414_600, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_557, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_309_000 picoseconds. - Weight::from_parts(41_405_949, 0) - // Standard Error: 8 - .saturating_add(Weight::from_parts(5_336, 0).saturating_mul(n.into())) + // Minimum execution time: 42_852_000 picoseconds. + Weight::from_parts(41_490_939, 0) + // Standard Error: 9 + .saturating_add(Weight::from_parts(5_198, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_880_000 picoseconds. - Weight::from_parts(49_025_000, 0) + // Minimum execution time: 48_300_000 picoseconds. + Weight::from_parts(50_110_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_462_000 picoseconds. - Weight::from_parts(13_631_000, 0) + // Minimum execution time: 13_021_000 picoseconds. + Weight::from_parts(13_158_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1786,8 +1816,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_978_000 picoseconds. - Weight::from_parts(18_578_000, 3895) + // Minimum execution time: 17_509_000 picoseconds. + Weight::from_parts(18_138_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1797,8 +1827,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_384_000 picoseconds. - Weight::from_parts(8_687_000, 3820) + // Minimum execution time: 8_269_000 picoseconds. + Weight::from_parts(8_537_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1808,8 +1838,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_547_000 picoseconds. - Weight::from_parts(7_935_000, 3558) + // Minimum execution time: 7_277_000 picoseconds. + Weight::from_parts(7_513_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1817,15 +1847,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 331_000 picoseconds. - Weight::from_parts(363_000, 0) + // Minimum execution time: 310_000 picoseconds. + Weight::from_parts(336_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 349_000 picoseconds. - Weight::from_parts(365_000, 0) + // Minimum execution time: 372_000 picoseconds. + Weight::from_parts(398_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1833,8 +1863,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_814_000 picoseconds. - Weight::from_parts(3_038_000, 1704) + // Minimum execution time: 2_808_000 picoseconds. + Weight::from_parts(3_003_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1842,9 +1872,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 693_000 picoseconds. - Weight::from_parts(665_431, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(7_030, 0).saturating_mul(r.into())) + // Minimum execution time: 690_000 picoseconds. + Weight::from_parts(831_877, 0) + // Standard Error: 20 + .saturating_add(Weight::from_parts(7_123, 0).saturating_mul(r.into())) } } From 6f713aebe0c8d04bb8effda46e75a993c079a6d8 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 18 Jun 2024 20:36:45 +0200 Subject: [PATCH 17/58] Max storage elements set to 2000 --- substrate/bin/node/runtime/src/lib.rs | 2 +- substrate/frame/contracts/src/benchmarking/mod.rs | 6 ++---- substrate/frame/contracts/uapi/src/host.rs | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 321e30eea22f..03503d088cf5 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1374,7 +1374,7 @@ impl pallet_contracts::Config for Runtime { type InstantiateOrigin = EnsureSigned; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; - type MaxTransientStorageItems = ConstU32<50>; + type MaxTransientStorageItems = ConstU32<2000>; type RuntimeHoldReason = RuntimeHoldReason; #[cfg(not(feature = "runtime-benchmarks"))] type Migrations = (); diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 6427bcf668d5..62e3dd5a4540 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -1196,7 +1196,7 @@ mod benchmarks { let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); let max_storage_items = T::MaxTransientStorageItems::get(); - dummy_transient_storage::(runtime.ext(), max_storage_items, n)?; + dummy_transient_storage::(runtime.ext(), max_storage_items, 1)?; runtime.ext().transient_storage().start_transaction(); runtime .ext() @@ -1216,14 +1216,12 @@ mod benchmarks { let max_value_len = T::Schedule::get().limits.payload_len; let max_key_len = T::MaxStorageKeyLen::get(); let max_storage_items = T::MaxTransientStorageItems::get(); - sp_runtime::print("{max_storage_items}"); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; let value = vec![1u8; max_value_len as usize]; - build_runtime!(runtime, memory: [ key.to_vec(), value.clone(), ]); - dummy_transient_storage::(runtime.ext(), max_storage_items, max_value_len)?; + dummy_transient_storage::(runtime.ext(), max_storage_items, 1)?; runtime .ext() .set_transient_storage(&key, Some(vec![16u8; max_value_len as usize]), false) diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index df47094609eb..e741c2a66324 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -455,7 +455,6 @@ pub trait HostFn { fn get_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result; - hash_fn!(sha2_256, 32); hash_fn!(keccak_256, 32); hash_fn!(blake2_256, 32); From 8c11871960e5c24f364d3964315cc198815af12a Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Tue, 18 Jun 2024 19:31:15 +0000 Subject: [PATCH 18/58] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 768 +++++++++++------------ 1 file changed, 384 insertions(+), 384 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index 4817edc8f514..0faff450cce7 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/frame/contracts/src/weights.rs @@ -129,8 +129,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_933_000 picoseconds. - Weight::from_parts(2_026_000, 1627) + // Minimum execution time: 1_909_000 picoseconds. + Weight::from_parts(2_003_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -140,10 +140,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 10_870_000 picoseconds. - Weight::from_parts(11_176_000, 442) - // Standard Error: 2_048 - .saturating_add(Weight::from_parts(1_251_637, 0).saturating_mul(k.into())) + // Minimum execution time: 10_997_000 picoseconds. + Weight::from_parts(11_373_000, 442) + // Standard Error: 1_547 + .saturating_add(Weight::from_parts(1_170_691, 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)) @@ -157,10 +157,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_525_000 picoseconds. - Weight::from_parts(4_905_215, 6149) + // Minimum execution time: 7_492_000 picoseconds. + Weight::from_parts(4_548_282, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_682, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_637, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -173,8 +173,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 15_910_000 picoseconds. - Weight::from_parts(16_415_000, 6450) + // Minimum execution time: 16_030_000 picoseconds. + Weight::from_parts(16_620_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -187,10 +187,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_164_000 picoseconds. - Weight::from_parts(3_198_000, 3635) - // Standard Error: 691 - .saturating_add(Weight::from_parts(1_094_227, 0).saturating_mul(k.into())) + // Minimum execution time: 3_113_000 picoseconds. + Weight::from_parts(3_184_000, 3635) + // Standard Error: 647 + .saturating_add(Weight::from_parts(1_088_426, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -209,10 +209,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 14_928_000 picoseconds. - Weight::from_parts(15_740_628, 6263) + // Minimum execution time: 15_056_000 picoseconds. + Weight::from_parts(15_717_709, 6263) // Standard Error: 1 - .saturating_add(Weight::from_parts(492, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(434, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -223,8 +223,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 11_896_000 picoseconds. - Weight::from_parts(12_288_000, 6380) + // Minimum execution time: 12_131_000 picoseconds. + Weight::from_parts(12_640_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -238,8 +238,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 46_408_000 picoseconds. - Weight::from_parts(47_498_000, 6292) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(49_173_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -251,8 +251,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_300_000 picoseconds. - Weight::from_parts(53_474_000, 6534) + // Minimum execution time: 53_190_000 picoseconds. + Weight::from_parts(55_025_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -262,8 +262,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_661_000 picoseconds. - Weight::from_parts(11_930_000, 6349) + // Minimum execution time: 11_732_000 picoseconds. + Weight::from_parts(12_076_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -273,8 +273,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_219_000, 1627) + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_227_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -286,8 +286,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_661_000 picoseconds. - Weight::from_parts(11_056_000, 3631) + // Minimum execution time: 10_853_000 picoseconds. + Weight::from_parts(11_240_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -297,8 +297,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_347_000 picoseconds. - Weight::from_parts(4_640_000, 3607) + // Minimum execution time: 4_425_000 picoseconds. + Weight::from_parts(4_562_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -309,8 +309,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_483_000 picoseconds. - Weight::from_parts(5_743_000, 3632) + // Minimum execution time: 5_574_000 picoseconds. + Weight::from_parts(5_806_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -321,8 +321,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_393_000 picoseconds. - Weight::from_parts(5_558_000, 3607) + // Minimum execution time: 5_438_000 picoseconds. + Weight::from_parts(5_671_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -343,10 +343,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 321_985_000 picoseconds. - Weight::from_parts(327_518_509, 4264) - // Standard Error: 10 - .saturating_add(Weight::from_parts(885, 0).saturating_mul(c.into())) + // Minimum execution time: 254_815_000 picoseconds. + Weight::from_parts(268_622_183, 4264) + // Standard Error: 4 + .saturating_add(Weight::from_parts(713, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -374,14 +374,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_997_437_000 picoseconds. - Weight::from_parts(5_149_156_000, 6262) - // Standard Error: 324 - .saturating_add(Weight::from_parts(39_435, 0).saturating_mul(c.into())) - // Standard Error: 38 - .saturating_add(Weight::from_parts(575, 0).saturating_mul(i.into())) - // Standard Error: 38 - .saturating_add(Weight::from_parts(586, 0).saturating_mul(s.into())) + // Minimum execution time: 4_423_645_000 picoseconds. + Weight::from_parts(172_646_323, 6262) + // Standard Error: 134 + .saturating_add(Weight::from_parts(52_694, 0).saturating_mul(c.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(2_127, 0).saturating_mul(i.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(2_209, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -407,12 +407,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_364_282_000 picoseconds. - Weight::from_parts(2_389_446_000, 4029) - // Standard Error: 36 - .saturating_add(Weight::from_parts(1_113, 0).saturating_mul(i.into())) - // Standard Error: 36 - .saturating_add(Weight::from_parts(980, 0).saturating_mul(s.into())) + // Minimum execution time: 2_234_342_000 picoseconds. + Weight::from_parts(2_250_674_000, 4029) + // Standard Error: 31 + .saturating_add(Weight::from_parts(917, 0).saturating_mul(i.into())) + // Standard Error: 31 + .saturating_add(Weight::from_parts(963, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -432,8 +432,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 167_526_000 picoseconds. - Weight::from_parts(174_544_000, 4291) + // Minimum execution time: 165_562_000 picoseconds. + Weight::from_parts(170_601_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -450,10 +450,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 305_053_000 picoseconds. - Weight::from_parts(311_408_314, 3607) - // Standard Error: 56 - .saturating_add(Weight::from_parts(53_656, 0).saturating_mul(c.into())) + // Minimum execution time: 240_647_000 picoseconds. + Weight::from_parts(244_299_946, 3607) + // Standard Error: 75 + .saturating_add(Weight::from_parts(51_236, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -470,10 +470,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 314_292_000 picoseconds. - Weight::from_parts(326_137_586, 3607) + // Minimum execution time: 242_859_000 picoseconds. + Weight::from_parts(260_769_868, 3607) // Standard Error: 52 - .saturating_add(Weight::from_parts(53_388, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(50_936, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -489,8 +489,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 38_404_000 picoseconds. - Weight::from_parts(39_373_000, 3780) + // Minimum execution time: 39_266_000 picoseconds. + Weight::from_parts(40_030_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -504,8 +504,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 24_870_000 picoseconds. - Weight::from_parts(26_097_000, 6492) + // Minimum execution time: 24_627_000 picoseconds. + Weight::from_parts(25_786_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -514,17 +514,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_548_000 picoseconds. - Weight::from_parts(9_354_564, 0) - // Standard Error: 76 - .saturating_add(Weight::from_parts(50_779, 0).saturating_mul(r.into())) + // Minimum execution time: 8_600_000 picoseconds. + Weight::from_parts(9_657_688, 0) + // Standard Error: 78 + .saturating_add(Weight::from_parts(51_082, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 595_000 picoseconds. - Weight::from_parts(629_000, 0) + // Minimum execution time: 588_000 picoseconds. + Weight::from_parts(610_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -532,8 +532,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 5_971_000 picoseconds. - Weight::from_parts(6_418_000, 3819) + // Minimum execution time: 6_237_000 picoseconds. + Weight::from_parts(6_566_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -542,79 +542,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_118_000 picoseconds. - Weight::from_parts(7_406_000, 3912) + // Minimum execution time: 7_445_000 picoseconds. + Weight::from_parts(7_709_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 767_000 picoseconds. - Weight::from_parts(846_000, 0) + // Minimum execution time: 749_000 picoseconds. + Weight::from_parts(819_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 422_000 picoseconds. - Weight::from_parts(461_000, 0) + // Minimum execution time: 427_000 picoseconds. + Weight::from_parts(436_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 329_000 picoseconds. - Weight::from_parts(373_000, 0) + // Minimum execution time: 285_000 picoseconds. + Weight::from_parts(334_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 537_000 picoseconds. - Weight::from_parts(606_000, 0) + // Minimum execution time: 600_000 picoseconds. + Weight::from_parts(634_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 674_000 picoseconds. - Weight::from_parts(706_000, 0) + // Minimum execution time: 676_000 picoseconds. + Weight::from_parts(712_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_600_000 picoseconds. - Weight::from_parts(4_712_000, 0) + // Minimum execution time: 4_439_000 picoseconds. + Weight::from_parts(4_578_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 580_000 picoseconds. - Weight::from_parts(625_000, 0) + // Minimum execution time: 561_000 picoseconds. + Weight::from_parts(604_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 573_000 picoseconds. - Weight::from_parts(614_000, 0) + // Minimum execution time: 562_000 picoseconds. + Weight::from_parts(591_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 531_000 picoseconds. - Weight::from_parts(603_000, 0) + // Minimum execution time: 545_000 picoseconds. + Weight::from_parts(568_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 564_000 picoseconds. - Weight::from_parts(610_000, 0) + // Minimum execution time: 530_000 picoseconds. + Weight::from_parts(595_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -622,8 +622,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_059_000 picoseconds. - Weight::from_parts(4_269_000, 1552) + // Minimum execution time: 4_147_000 picoseconds. + Weight::from_parts(4_328_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -631,20 +631,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 480_000 picoseconds. - Weight::from_parts(511_000, 0) + // Minimum execution time: 451_000 picoseconds. + Weight::from_parts(487_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(310, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(299, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 303_000 picoseconds. - Weight::from_parts(327_000, 0) - // Standard Error: 9 - .saturating_add(Weight::from_parts(488, 0).saturating_mul(n.into())) + // Minimum execution time: 340_000 picoseconds. + Weight::from_parts(365_000, 0) + // Standard Error: 10 + .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -657,10 +657,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_335_000 picoseconds. - Weight::from_parts(15_687_784, 3784) - // Standard Error: 7_246 - .saturating_add(Weight::from_parts(3_411_317, 0).saturating_mul(n.into())) + // Minimum execution time: 13_286_000 picoseconds. + Weight::from_parts(15_522_969, 3784) + // Standard Error: 7_412 + .saturating_add(Weight::from_parts(3_472_121, 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(3_u64)) @@ -673,8 +673,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_347_000 picoseconds. - Weight::from_parts(3_535_000, 1561) + // Minimum execution time: 3_275_000 picoseconds. + Weight::from_parts(3_454_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -685,12 +685,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_619_000 picoseconds. - Weight::from_parts(3_670_641, 990) - // Standard Error: 5_009 - .saturating_add(Weight::from_parts(2_062_438, 0).saturating_mul(t.into())) + // Minimum execution time: 3_622_000 picoseconds. + Weight::from_parts(3_766_383, 990) + // Standard Error: 5_352 + .saturating_add(Weight::from_parts(2_048_975, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(23, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(21, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -700,10 +700,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 438_000 picoseconds. - Weight::from_parts(468_000, 0) + // Minimum execution time: 405_000 picoseconds. + Weight::from_parts(426_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_280, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_204, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -713,12 +713,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 8_832_000 picoseconds. - Weight::from_parts(8_846_472, 249) + // Minimum execution time: 9_004_000 picoseconds. + Weight::from_parts(8_835_907, 249) // Standard Error: 2 - .saturating_add(Weight::from_parts(363, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(257, 0).saturating_mul(n.into())) // Standard Error: 2 - .saturating_add(Weight::from_parts(35, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(44, 0).saturating_mul(o.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(o.into())) @@ -730,10 +730,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_147_000 picoseconds. - Weight::from_parts(7_926_890, 248) + // Minimum execution time: 7_100_000 picoseconds. + Weight::from_parts(7_782_513, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(80, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(105, 0).saturating_mul(n.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(n.into())) @@ -745,10 +745,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_671_000 picoseconds. - Weight::from_parts(7_560_048, 248) + // Minimum execution time: 6_920_000 picoseconds. + Weight::from_parts(7_790_171, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(708, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(601, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -759,10 +759,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_290_000 picoseconds. - Weight::from_parts(6_847_458, 248) + // Minimum execution time: 6_178_000 picoseconds. + Weight::from_parts(6_894_046, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(89, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -773,10 +773,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_557_000 picoseconds. - Weight::from_parts(8_519_922, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(703, 0).saturating_mul(n.into())) + // Minimum execution time: 7_699_000 picoseconds. + Weight::from_parts(8_778_552, 248) + // Standard Error: 5 + .saturating_add(Weight::from_parts(602, 0).saturating_mul(n.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(n.into())) @@ -785,22 +785,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_302_000 picoseconds. - Weight::from_parts(1_377_000, 0) + // Minimum execution time: 1_627_000 picoseconds. + Weight::from_parts(1_719_000, 0) } fn seal_set_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_451_000 picoseconds. - Weight::from_parts(13_684_000, 0) + // Minimum execution time: 11_075_000 picoseconds. + Weight::from_parts(11_284_000, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_516_000 picoseconds. - Weight::from_parts(8_934_000, 0) + // Minimum execution time: 8_583_000 picoseconds. + Weight::from_parts(9_096_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -816,12 +816,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 127_185_000 picoseconds. - Weight::from_parts(124_262_133, 4085) - // Standard Error: 169_873 - .saturating_add(Weight::from_parts(42_039_124, 0).saturating_mul(t.into())) + // Minimum execution time: 123_880_000 picoseconds. + Weight::from_parts(122_086_033, 4085) + // Standard Error: 199_139 + .saturating_add(Weight::from_parts(42_655_535, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(6, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -836,8 +836,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 115_539_000 picoseconds. - Weight::from_parts(118_062_000, 3895) + // Minimum execution time: 110_970_000 picoseconds. + Weight::from_parts(113_154_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -856,12 +856,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4127` - // Minimum execution time: 2_042_664_000 picoseconds. - Weight::from_parts(2_044_771_000, 4127) - // Standard Error: 29 - .saturating_add(Weight::from_parts(691, 0).saturating_mul(i.into())) - // Standard Error: 29 - .saturating_add(Weight::from_parts(979, 0).saturating_mul(s.into())) + // Minimum execution time: 1_869_663_000 picoseconds. + Weight::from_parts(1_875_504_000, 4127) + // Standard Error: 23 + .saturating_add(Weight::from_parts(563, 0).saturating_mul(i.into())) + // Standard Error: 23 + .saturating_add(Weight::from_parts(936, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -870,64 +870,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 815_000 picoseconds. - Weight::from_parts(7_043_292, 0) + // Minimum execution time: 837_000 picoseconds. + Weight::from_parts(10_238_254, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_423, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_318, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_370_000 picoseconds. - Weight::from_parts(6_938_342, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(3_700, 0).saturating_mul(n.into())) + // Minimum execution time: 1_322_000 picoseconds. + Weight::from_parts(11_671_704, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(3_597, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 739_000 picoseconds. - Weight::from_parts(11_628_442, 0) + // Minimum execution time: 778_000 picoseconds. + Weight::from_parts(9_654_074, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_550, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_458, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_000 picoseconds. - Weight::from_parts(7_414_600, 0) + // Minimum execution time: 746_000 picoseconds. + Weight::from_parts(6_120_781, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_557, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_462, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_852_000 picoseconds. - Weight::from_parts(41_490_939, 0) + // Minimum execution time: 43_925_000 picoseconds. + Weight::from_parts(42_372_440, 0) // Standard Error: 9 - .saturating_add(Weight::from_parts(5_198, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(5_074, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 48_300_000 picoseconds. - Weight::from_parts(50_110_000, 0) + // Minimum execution time: 47_928_000 picoseconds. + Weight::from_parts(48_849_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_021_000 picoseconds. - Weight::from_parts(13_158_000, 0) + // Minimum execution time: 12_926_000 picoseconds. + Weight::from_parts(13_021_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -937,8 +937,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_509_000 picoseconds. - Weight::from_parts(18_138_000, 3895) + // Minimum execution time: 17_375_000 picoseconds. + Weight::from_parts(18_081_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -948,8 +948,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_269_000 picoseconds. - Weight::from_parts(8_537_000, 3820) + // Minimum execution time: 8_096_000 picoseconds. + Weight::from_parts(8_388_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -959,8 +959,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_277_000 picoseconds. - Weight::from_parts(7_513_000, 3558) + // Minimum execution time: 7_046_000 picoseconds. + Weight::from_parts(7_556_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -968,15 +968,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 310_000 picoseconds. - Weight::from_parts(336_000, 0) + // Minimum execution time: 345_000 picoseconds. + Weight::from_parts(366_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 372_000 picoseconds. - Weight::from_parts(398_000, 0) + // Minimum execution time: 348_000 picoseconds. + Weight::from_parts(396_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -984,8 +984,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_808_000 picoseconds. - Weight::from_parts(3_003_000, 1704) + // Minimum execution time: 2_771_000 picoseconds. + Weight::from_parts(2_880_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -993,10 +993,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 690_000 picoseconds. - Weight::from_parts(831_877, 0) - // Standard Error: 20 - .saturating_add(Weight::from_parts(7_123, 0).saturating_mul(r.into())) + // Minimum execution time: 647_000 picoseconds. + Weight::from_parts(571_218, 0) + // Standard Error: 8 + .saturating_add(Weight::from_parts(7_394, 0).saturating_mul(r.into())) } } @@ -1008,8 +1008,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_933_000 picoseconds. - Weight::from_parts(2_026_000, 1627) + // Minimum execution time: 1_909_000 picoseconds. + Weight::from_parts(2_003_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1019,10 +1019,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 10_870_000 picoseconds. - Weight::from_parts(11_176_000, 442) - // Standard Error: 2_048 - .saturating_add(Weight::from_parts(1_251_637, 0).saturating_mul(k.into())) + // Minimum execution time: 10_997_000 picoseconds. + Weight::from_parts(11_373_000, 442) + // Standard Error: 1_547 + .saturating_add(Weight::from_parts(1_170_691, 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)) @@ -1036,10 +1036,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_525_000 picoseconds. - Weight::from_parts(4_905_215, 6149) + // Minimum execution time: 7_492_000 picoseconds. + Weight::from_parts(4_548_282, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_682, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_637, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1052,8 +1052,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 15_910_000 picoseconds. - Weight::from_parts(16_415_000, 6450) + // Minimum execution time: 16_030_000 picoseconds. + Weight::from_parts(16_620_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1066,10 +1066,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_164_000 picoseconds. - Weight::from_parts(3_198_000, 3635) - // Standard Error: 691 - .saturating_add(Weight::from_parts(1_094_227, 0).saturating_mul(k.into())) + // Minimum execution time: 3_113_000 picoseconds. + Weight::from_parts(3_184_000, 3635) + // Standard Error: 647 + .saturating_add(Weight::from_parts(1_088_426, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1088,10 +1088,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 14_928_000 picoseconds. - Weight::from_parts(15_740_628, 6263) + // Minimum execution time: 15_056_000 picoseconds. + Weight::from_parts(15_717_709, 6263) // Standard Error: 1 - .saturating_add(Weight::from_parts(492, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(434, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1102,8 +1102,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 11_896_000 picoseconds. - Weight::from_parts(12_288_000, 6380) + // Minimum execution time: 12_131_000 picoseconds. + Weight::from_parts(12_640_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1117,8 +1117,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 46_408_000 picoseconds. - Weight::from_parts(47_498_000, 6292) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(49_173_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1130,8 +1130,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_300_000 picoseconds. - Weight::from_parts(53_474_000, 6534) + // Minimum execution time: 53_190_000 picoseconds. + Weight::from_parts(55_025_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1141,8 +1141,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_661_000 picoseconds. - Weight::from_parts(11_930_000, 6349) + // Minimum execution time: 11_732_000 picoseconds. + Weight::from_parts(12_076_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1152,8 +1152,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_219_000, 1627) + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_227_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1165,8 +1165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_661_000 picoseconds. - Weight::from_parts(11_056_000, 3631) + // Minimum execution time: 10_853_000 picoseconds. + Weight::from_parts(11_240_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1176,8 +1176,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_347_000 picoseconds. - Weight::from_parts(4_640_000, 3607) + // Minimum execution time: 4_425_000 picoseconds. + Weight::from_parts(4_562_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1188,8 +1188,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_483_000 picoseconds. - Weight::from_parts(5_743_000, 3632) + // Minimum execution time: 5_574_000 picoseconds. + Weight::from_parts(5_806_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1200,8 +1200,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_393_000 picoseconds. - Weight::from_parts(5_558_000, 3607) + // Minimum execution time: 5_438_000 picoseconds. + Weight::from_parts(5_671_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1222,10 +1222,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 321_985_000 picoseconds. - Weight::from_parts(327_518_509, 4264) - // Standard Error: 10 - .saturating_add(Weight::from_parts(885, 0).saturating_mul(c.into())) + // Minimum execution time: 254_815_000 picoseconds. + Weight::from_parts(268_622_183, 4264) + // Standard Error: 4 + .saturating_add(Weight::from_parts(713, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1253,14 +1253,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_997_437_000 picoseconds. - Weight::from_parts(5_149_156_000, 6262) - // Standard Error: 324 - .saturating_add(Weight::from_parts(39_435, 0).saturating_mul(c.into())) - // Standard Error: 38 - .saturating_add(Weight::from_parts(575, 0).saturating_mul(i.into())) - // Standard Error: 38 - .saturating_add(Weight::from_parts(586, 0).saturating_mul(s.into())) + // Minimum execution time: 4_423_645_000 picoseconds. + Weight::from_parts(172_646_323, 6262) + // Standard Error: 134 + .saturating_add(Weight::from_parts(52_694, 0).saturating_mul(c.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(2_127, 0).saturating_mul(i.into())) + // Standard Error: 16 + .saturating_add(Weight::from_parts(2_209, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1286,12 +1286,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_364_282_000 picoseconds. - Weight::from_parts(2_389_446_000, 4029) - // Standard Error: 36 - .saturating_add(Weight::from_parts(1_113, 0).saturating_mul(i.into())) - // Standard Error: 36 - .saturating_add(Weight::from_parts(980, 0).saturating_mul(s.into())) + // Minimum execution time: 2_234_342_000 picoseconds. + Weight::from_parts(2_250_674_000, 4029) + // Standard Error: 31 + .saturating_add(Weight::from_parts(917, 0).saturating_mul(i.into())) + // Standard Error: 31 + .saturating_add(Weight::from_parts(963, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1311,8 +1311,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 167_526_000 picoseconds. - Weight::from_parts(174_544_000, 4291) + // Minimum execution time: 165_562_000 picoseconds. + Weight::from_parts(170_601_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1329,10 +1329,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 305_053_000 picoseconds. - Weight::from_parts(311_408_314, 3607) - // Standard Error: 56 - .saturating_add(Weight::from_parts(53_656, 0).saturating_mul(c.into())) + // Minimum execution time: 240_647_000 picoseconds. + Weight::from_parts(244_299_946, 3607) + // Standard Error: 75 + .saturating_add(Weight::from_parts(51_236, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1349,10 +1349,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 314_292_000 picoseconds. - Weight::from_parts(326_137_586, 3607) + // Minimum execution time: 242_859_000 picoseconds. + Weight::from_parts(260_769_868, 3607) // Standard Error: 52 - .saturating_add(Weight::from_parts(53_388, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(50_936, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1368,8 +1368,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 38_404_000 picoseconds. - Weight::from_parts(39_373_000, 3780) + // Minimum execution time: 39_266_000 picoseconds. + Weight::from_parts(40_030_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1383,8 +1383,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 24_870_000 picoseconds. - Weight::from_parts(26_097_000, 6492) + // Minimum execution time: 24_627_000 picoseconds. + Weight::from_parts(25_786_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1393,17 +1393,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_548_000 picoseconds. - Weight::from_parts(9_354_564, 0) - // Standard Error: 76 - .saturating_add(Weight::from_parts(50_779, 0).saturating_mul(r.into())) + // Minimum execution time: 8_600_000 picoseconds. + Weight::from_parts(9_657_688, 0) + // Standard Error: 78 + .saturating_add(Weight::from_parts(51_082, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 595_000 picoseconds. - Weight::from_parts(629_000, 0) + // Minimum execution time: 588_000 picoseconds. + Weight::from_parts(610_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1411,8 +1411,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 5_971_000 picoseconds. - Weight::from_parts(6_418_000, 3819) + // Minimum execution time: 6_237_000 picoseconds. + Weight::from_parts(6_566_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1421,79 +1421,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_118_000 picoseconds. - Weight::from_parts(7_406_000, 3912) + // Minimum execution time: 7_445_000 picoseconds. + Weight::from_parts(7_709_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 767_000 picoseconds. - Weight::from_parts(846_000, 0) + // Minimum execution time: 749_000 picoseconds. + Weight::from_parts(819_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 422_000 picoseconds. - Weight::from_parts(461_000, 0) + // Minimum execution time: 427_000 picoseconds. + Weight::from_parts(436_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 329_000 picoseconds. - Weight::from_parts(373_000, 0) + // Minimum execution time: 285_000 picoseconds. + Weight::from_parts(334_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 537_000 picoseconds. - Weight::from_parts(606_000, 0) + // Minimum execution time: 600_000 picoseconds. + Weight::from_parts(634_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 674_000 picoseconds. - Weight::from_parts(706_000, 0) + // Minimum execution time: 676_000 picoseconds. + Weight::from_parts(712_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_600_000 picoseconds. - Weight::from_parts(4_712_000, 0) + // Minimum execution time: 4_439_000 picoseconds. + Weight::from_parts(4_578_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 580_000 picoseconds. - Weight::from_parts(625_000, 0) + // Minimum execution time: 561_000 picoseconds. + Weight::from_parts(604_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 573_000 picoseconds. - Weight::from_parts(614_000, 0) + // Minimum execution time: 562_000 picoseconds. + Weight::from_parts(591_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 531_000 picoseconds. - Weight::from_parts(603_000, 0) + // Minimum execution time: 545_000 picoseconds. + Weight::from_parts(568_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 564_000 picoseconds. - Weight::from_parts(610_000, 0) + // Minimum execution time: 530_000 picoseconds. + Weight::from_parts(595_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1501,8 +1501,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_059_000 picoseconds. - Weight::from_parts(4_269_000, 1552) + // Minimum execution time: 4_147_000 picoseconds. + Weight::from_parts(4_328_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1510,20 +1510,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 480_000 picoseconds. - Weight::from_parts(511_000, 0) + // Minimum execution time: 451_000 picoseconds. + Weight::from_parts(487_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(310, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(299, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 303_000 picoseconds. - Weight::from_parts(327_000, 0) - // Standard Error: 9 - .saturating_add(Weight::from_parts(488, 0).saturating_mul(n.into())) + // Minimum execution time: 340_000 picoseconds. + Weight::from_parts(365_000, 0) + // Standard Error: 10 + .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1536,10 +1536,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_335_000 picoseconds. - Weight::from_parts(15_687_784, 3784) - // Standard Error: 7_246 - .saturating_add(Weight::from_parts(3_411_317, 0).saturating_mul(n.into())) + // Minimum execution time: 13_286_000 picoseconds. + Weight::from_parts(15_522_969, 3784) + // Standard Error: 7_412 + .saturating_add(Weight::from_parts(3_472_121, 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(3_u64)) @@ -1552,8 +1552,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_347_000 picoseconds. - Weight::from_parts(3_535_000, 1561) + // Minimum execution time: 3_275_000 picoseconds. + Weight::from_parts(3_454_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1564,12 +1564,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_619_000 picoseconds. - Weight::from_parts(3_670_641, 990) - // Standard Error: 5_009 - .saturating_add(Weight::from_parts(2_062_438, 0).saturating_mul(t.into())) + // Minimum execution time: 3_622_000 picoseconds. + Weight::from_parts(3_766_383, 990) + // Standard Error: 5_352 + .saturating_add(Weight::from_parts(2_048_975, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(23, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(21, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1579,10 +1579,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 438_000 picoseconds. - Weight::from_parts(468_000, 0) + // Minimum execution time: 405_000 picoseconds. + Weight::from_parts(426_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_280, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_204, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1592,12 +1592,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 8_832_000 picoseconds. - Weight::from_parts(8_846_472, 249) + // Minimum execution time: 9_004_000 picoseconds. + Weight::from_parts(8_835_907, 249) // Standard Error: 2 - .saturating_add(Weight::from_parts(363, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(257, 0).saturating_mul(n.into())) // Standard Error: 2 - .saturating_add(Weight::from_parts(35, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(44, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1609,10 +1609,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_147_000 picoseconds. - Weight::from_parts(7_926_890, 248) + // Minimum execution time: 7_100_000 picoseconds. + Weight::from_parts(7_782_513, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(80, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(105, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1624,10 +1624,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_671_000 picoseconds. - Weight::from_parts(7_560_048, 248) + // Minimum execution time: 6_920_000 picoseconds. + Weight::from_parts(7_790_171, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(708, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(601, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1638,10 +1638,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_290_000 picoseconds. - Weight::from_parts(6_847_458, 248) + // Minimum execution time: 6_178_000 picoseconds. + Weight::from_parts(6_894_046, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(89, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1652,10 +1652,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_557_000 picoseconds. - Weight::from_parts(8_519_922, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(703, 0).saturating_mul(n.into())) + // Minimum execution time: 7_699_000 picoseconds. + Weight::from_parts(8_778_552, 248) + // Standard Error: 5 + .saturating_add(Weight::from_parts(602, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1664,22 +1664,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_302_000 picoseconds. - Weight::from_parts(1_377_000, 0) + // Minimum execution time: 1_627_000 picoseconds. + Weight::from_parts(1_719_000, 0) } fn seal_set_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_451_000 picoseconds. - Weight::from_parts(13_684_000, 0) + // Minimum execution time: 11_075_000 picoseconds. + Weight::from_parts(11_284_000, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_516_000 picoseconds. - Weight::from_parts(8_934_000, 0) + // Minimum execution time: 8_583_000 picoseconds. + Weight::from_parts(9_096_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1695,12 +1695,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 127_185_000 picoseconds. - Weight::from_parts(124_262_133, 4085) - // Standard Error: 169_873 - .saturating_add(Weight::from_parts(42_039_124, 0).saturating_mul(t.into())) + // Minimum execution time: 123_880_000 picoseconds. + Weight::from_parts(122_086_033, 4085) + // Standard Error: 199_139 + .saturating_add(Weight::from_parts(42_655_535, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(6, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1715,8 +1715,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 115_539_000 picoseconds. - Weight::from_parts(118_062_000, 3895) + // Minimum execution time: 110_970_000 picoseconds. + Weight::from_parts(113_154_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1735,12 +1735,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4127` - // Minimum execution time: 2_042_664_000 picoseconds. - Weight::from_parts(2_044_771_000, 4127) - // Standard Error: 29 - .saturating_add(Weight::from_parts(691, 0).saturating_mul(i.into())) - // Standard Error: 29 - .saturating_add(Weight::from_parts(979, 0).saturating_mul(s.into())) + // Minimum execution time: 1_869_663_000 picoseconds. + Weight::from_parts(1_875_504_000, 4127) + // Standard Error: 23 + .saturating_add(Weight::from_parts(563, 0).saturating_mul(i.into())) + // Standard Error: 23 + .saturating_add(Weight::from_parts(936, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1749,64 +1749,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 815_000 picoseconds. - Weight::from_parts(7_043_292, 0) + // Minimum execution time: 837_000 picoseconds. + Weight::from_parts(10_238_254, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_423, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_318, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_370_000 picoseconds. - Weight::from_parts(6_938_342, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(3_700, 0).saturating_mul(n.into())) + // Minimum execution time: 1_322_000 picoseconds. + Weight::from_parts(11_671_704, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(3_597, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 739_000 picoseconds. - Weight::from_parts(11_628_442, 0) + // Minimum execution time: 778_000 picoseconds. + Weight::from_parts(9_654_074, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_550, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_458, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_000 picoseconds. - Weight::from_parts(7_414_600, 0) + // Minimum execution time: 746_000 picoseconds. + Weight::from_parts(6_120_781, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_557, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_462, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_852_000 picoseconds. - Weight::from_parts(41_490_939, 0) + // Minimum execution time: 43_925_000 picoseconds. + Weight::from_parts(42_372_440, 0) // Standard Error: 9 - .saturating_add(Weight::from_parts(5_198, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(5_074, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 48_300_000 picoseconds. - Weight::from_parts(50_110_000, 0) + // Minimum execution time: 47_928_000 picoseconds. + Weight::from_parts(48_849_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_021_000 picoseconds. - Weight::from_parts(13_158_000, 0) + // Minimum execution time: 12_926_000 picoseconds. + Weight::from_parts(13_021_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1816,8 +1816,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_509_000 picoseconds. - Weight::from_parts(18_138_000, 3895) + // Minimum execution time: 17_375_000 picoseconds. + Weight::from_parts(18_081_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1827,8 +1827,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_269_000 picoseconds. - Weight::from_parts(8_537_000, 3820) + // Minimum execution time: 8_096_000 picoseconds. + Weight::from_parts(8_388_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1838,8 +1838,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_277_000 picoseconds. - Weight::from_parts(7_513_000, 3558) + // Minimum execution time: 7_046_000 picoseconds. + Weight::from_parts(7_556_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1847,15 +1847,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 310_000 picoseconds. - Weight::from_parts(336_000, 0) + // Minimum execution time: 345_000 picoseconds. + Weight::from_parts(366_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 372_000 picoseconds. - Weight::from_parts(398_000, 0) + // Minimum execution time: 348_000 picoseconds. + Weight::from_parts(396_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1863,8 +1863,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_808_000 picoseconds. - Weight::from_parts(3_003_000, 1704) + // Minimum execution time: 2_771_000 picoseconds. + Weight::from_parts(2_880_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1872,9 +1872,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 690_000 picoseconds. - Weight::from_parts(831_877, 0) - // Standard Error: 20 - .saturating_add(Weight::from_parts(7_123, 0).saturating_mul(r.into())) + // Minimum execution time: 647_000 picoseconds. + Weight::from_parts(571_218, 0) + // Standard Error: 8 + .saturating_add(Weight::from_parts(7_394, 0).saturating_mul(r.into())) } } From 664221be3c4f1a515d1e8f253b64293643790030 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 18 Jun 2024 22:20:01 +0200 Subject: [PATCH 19/58] Storage len 50 --- substrate/bin/node/runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 03503d088cf5..321e30eea22f 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1374,7 +1374,7 @@ impl pallet_contracts::Config for Runtime { type InstantiateOrigin = EnsureSigned; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; - type MaxTransientStorageItems = ConstU32<2000>; + type MaxTransientStorageItems = ConstU32<50>; type RuntimeHoldReason = RuntimeHoldReason; #[cfg(not(feature = "runtime-benchmarks"))] type Migrations = (); From d5790054a52991b98f6f81bff7aac045fd188237 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Tue, 18 Jun 2024 21:14:49 +0000 Subject: [PATCH 20/58] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 760 +++++++++++------------ 1 file changed, 380 insertions(+), 380 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index 0faff450cce7..e71bb916c482 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/frame/contracts/src/weights.rs @@ -129,8 +129,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_909_000 picoseconds. - Weight::from_parts(2_003_000, 1627) + // Minimum execution time: 1_932_000 picoseconds. + Weight::from_parts(2_029_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -140,10 +140,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 10_997_000 picoseconds. - Weight::from_parts(11_373_000, 442) - // Standard Error: 1_547 - .saturating_add(Weight::from_parts(1_170_691, 0).saturating_mul(k.into())) + // Minimum execution time: 11_121_000 picoseconds. + Weight::from_parts(11_232_000, 442) + // Standard Error: 1_671 + .saturating_add(Weight::from_parts(1_247_413, 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)) @@ -157,10 +157,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_492_000 picoseconds. - Weight::from_parts(4_548_282, 6149) + // Minimum execution time: 7_611_000 picoseconds. + Weight::from_parts(4_556_039, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_637, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -173,8 +173,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_030_000 picoseconds. - Weight::from_parts(16_620_000, 6450) + // Minimum execution time: 15_687_000 picoseconds. + Weight::from_parts(16_830_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -187,10 +187,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_113_000 picoseconds. - Weight::from_parts(3_184_000, 3635) - // Standard Error: 647 - .saturating_add(Weight::from_parts(1_088_426, 0).saturating_mul(k.into())) + // Minimum execution time: 3_058_000 picoseconds. + Weight::from_parts(3_099_000, 3635) + // Standard Error: 627 + .saturating_add(Weight::from_parts(1_090_078, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -209,10 +209,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_056_000 picoseconds. - Weight::from_parts(15_717_709, 6263) + // Minimum execution time: 15_114_000 picoseconds. + Weight::from_parts(15_675_115, 6263) // Standard Error: 1 - .saturating_add(Weight::from_parts(434, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(409, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -223,8 +223,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_131_000 picoseconds. - Weight::from_parts(12_640_000, 6380) + // Minimum execution time: 11_902_000 picoseconds. + Weight::from_parts(12_535_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -238,8 +238,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(49_173_000, 6292) + // Minimum execution time: 46_473_000 picoseconds. + Weight::from_parts(47_362_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -251,8 +251,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 53_190_000 picoseconds. - Weight::from_parts(55_025_000, 6534) + // Minimum execution time: 51_917_000 picoseconds. + Weight::from_parts(53_767_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -262,8 +262,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_732_000 picoseconds. - Weight::from_parts(12_076_000, 6349) + // Minimum execution time: 11_394_000 picoseconds. + Weight::from_parts(11_917_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -273,8 +273,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_227_000, 1627) + // Minimum execution time: 2_108_000 picoseconds. + Weight::from_parts(2_202_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -286,8 +286,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_853_000 picoseconds. - Weight::from_parts(11_240_000, 3631) + // Minimum execution time: 10_878_000 picoseconds. + Weight::from_parts(11_267_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -297,8 +297,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_425_000 picoseconds. - Weight::from_parts(4_562_000, 3607) + // Minimum execution time: 4_452_000 picoseconds. + Weight::from_parts(4_694_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -309,8 +309,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_574_000 picoseconds. - Weight::from_parts(5_806_000, 3632) + // Minimum execution time: 5_614_000 picoseconds. + Weight::from_parts(5_872_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -321,8 +321,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_438_000 picoseconds. - Weight::from_parts(5_671_000, 3607) + // Minimum execution time: 5_521_000 picoseconds. + Weight::from_parts(5_736_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -343,10 +343,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 254_815_000 picoseconds. - Weight::from_parts(268_622_183, 4264) - // Standard Error: 4 - .saturating_add(Weight::from_parts(713, 0).saturating_mul(c.into())) + // Minimum execution time: 253_608_000 picoseconds. + Weight::from_parts(256_352_977, 4264) + // Standard Error: 11 + .saturating_add(Weight::from_parts(1_162, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -374,14 +374,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_423_645_000 picoseconds. - Weight::from_parts(172_646_323, 6262) - // Standard Error: 134 - .saturating_add(Weight::from_parts(52_694, 0).saturating_mul(c.into())) - // Standard Error: 16 - .saturating_add(Weight::from_parts(2_127, 0).saturating_mul(i.into())) - // Standard Error: 16 - .saturating_add(Weight::from_parts(2_209, 0).saturating_mul(s.into())) + // Minimum execution time: 4_700_467_000 picoseconds. + Weight::from_parts(381_233_736, 6262) + // Standard Error: 274 + .saturating_add(Weight::from_parts(53_487, 0).saturating_mul(c.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(2_308, 0).saturating_mul(i.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(2_302, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -407,12 +407,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_234_342_000 picoseconds. - Weight::from_parts(2_250_674_000, 4029) - // Standard Error: 31 - .saturating_add(Weight::from_parts(917, 0).saturating_mul(i.into())) - // Standard Error: 31 - .saturating_add(Weight::from_parts(963, 0).saturating_mul(s.into())) + // Minimum execution time: 2_246_963_000 picoseconds. + Weight::from_parts(2_279_753_000, 4029) + // Standard Error: 36 + .saturating_add(Weight::from_parts(1_102, 0).saturating_mul(i.into())) + // Standard Error: 36 + .saturating_add(Weight::from_parts(1_008, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -432,8 +432,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 165_562_000 picoseconds. - Weight::from_parts(170_601_000, 4291) + // Minimum execution time: 165_076_000 picoseconds. + Weight::from_parts(168_771_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -450,10 +450,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 240_647_000 picoseconds. - Weight::from_parts(244_299_946, 3607) - // Standard Error: 75 - .saturating_add(Weight::from_parts(51_236, 0).saturating_mul(c.into())) + // Minimum execution time: 224_244_000 picoseconds. + Weight::from_parts(244_252_040, 3607) + // Standard Error: 86 + .saturating_add(Weight::from_parts(51_723, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -470,10 +470,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 242_859_000 picoseconds. - Weight::from_parts(260_769_868, 3607) - // Standard Error: 52 - .saturating_add(Weight::from_parts(50_936, 0).saturating_mul(c.into())) + // Minimum execution time: 232_514_000 picoseconds. + Weight::from_parts(247_372_222, 3607) + // Standard Error: 77 + .saturating_add(Weight::from_parts(51_890, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -489,8 +489,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_266_000 picoseconds. - Weight::from_parts(40_030_000, 3780) + // Minimum execution time: 38_546_000 picoseconds. + Weight::from_parts(40_182_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -504,8 +504,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 24_627_000 picoseconds. - Weight::from_parts(25_786_000, 6492) + // Minimum execution time: 24_632_000 picoseconds. + Weight::from_parts(25_274_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -514,17 +514,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_600_000 picoseconds. - Weight::from_parts(9_657_688, 0) - // Standard Error: 78 - .saturating_add(Weight::from_parts(51_082, 0).saturating_mul(r.into())) + // Minimum execution time: 8_360_000 picoseconds. + Weight::from_parts(9_265_377, 0) + // Standard Error: 73 + .saturating_add(Weight::from_parts(51_488, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 588_000 picoseconds. - Weight::from_parts(610_000, 0) + // Minimum execution time: 576_000 picoseconds. + Weight::from_parts(633_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -532,8 +532,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_237_000 picoseconds. - Weight::from_parts(6_566_000, 3819) + // Minimum execution time: 6_172_000 picoseconds. + Weight::from_parts(6_400_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -542,79 +542,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_445_000 picoseconds. - Weight::from_parts(7_709_000, 3912) + // Minimum execution time: 7_271_000 picoseconds. + Weight::from_parts(7_471_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 749_000 picoseconds. - Weight::from_parts(819_000, 0) + // Minimum execution time: 784_000 picoseconds. + Weight::from_parts(858_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 427_000 picoseconds. - Weight::from_parts(436_000, 0) + // Minimum execution time: 400_000 picoseconds. + Weight::from_parts(442_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 285_000 picoseconds. - Weight::from_parts(334_000, 0) + // Minimum execution time: 356_000 picoseconds. + Weight::from_parts(386_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` // Minimum execution time: 600_000 picoseconds. - Weight::from_parts(634_000, 0) + Weight::from_parts(646_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 676_000 picoseconds. - Weight::from_parts(712_000, 0) + // Minimum execution time: 691_000 picoseconds. + Weight::from_parts(715_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_439_000 picoseconds. - Weight::from_parts(4_578_000, 0) + // Minimum execution time: 4_321_000 picoseconds. + Weight::from_parts(4_570_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 561_000 picoseconds. - Weight::from_parts(604_000, 0) + // Minimum execution time: 570_000 picoseconds. + Weight::from_parts(616_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 562_000 picoseconds. - Weight::from_parts(591_000, 0) + // Minimum execution time: 559_000 picoseconds. + Weight::from_parts(607_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 545_000 picoseconds. - Weight::from_parts(568_000, 0) + // Minimum execution time: 514_000 picoseconds. + Weight::from_parts(598_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 530_000 picoseconds. - Weight::from_parts(595_000, 0) + // Minimum execution time: 605_000 picoseconds. + Weight::from_parts(633_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -622,8 +622,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_147_000 picoseconds. - Weight::from_parts(4_328_000, 1552) + // Minimum execution time: 4_183_000 picoseconds. + Weight::from_parts(4_412_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -631,20 +631,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 451_000 picoseconds. - Weight::from_parts(487_000, 0) + // Minimum execution time: 528_000 picoseconds. + Weight::from_parts(569_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(299, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(300, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 340_000 picoseconds. - Weight::from_parts(365_000, 0) + // Minimum execution time: 365_000 picoseconds. + Weight::from_parts(382_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(407, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -657,10 +657,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_286_000 picoseconds. - Weight::from_parts(15_522_969, 3784) - // Standard Error: 7_412 - .saturating_add(Weight::from_parts(3_472_121, 0).saturating_mul(n.into())) + // Minimum execution time: 13_140_000 picoseconds. + Weight::from_parts(15_258_455, 3784) + // Standard Error: 7_507 + .saturating_add(Weight::from_parts(3_475_009, 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(3_u64)) @@ -673,8 +673,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_275_000 picoseconds. - Weight::from_parts(3_454_000, 1561) + // Minimum execution time: 3_407_000 picoseconds. + Weight::from_parts(3_565_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -685,12 +685,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_622_000 picoseconds. - Weight::from_parts(3_766_383, 990) - // Standard Error: 5_352 - .saturating_add(Weight::from_parts(2_048_975, 0).saturating_mul(t.into())) + // Minimum execution time: 3_534_000 picoseconds. + Weight::from_parts(3_793_333, 990) + // Standard Error: 5_106 + .saturating_add(Weight::from_parts(2_033_824, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(21, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(14, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -700,10 +700,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 405_000 picoseconds. - Weight::from_parts(426_000, 0) + // Minimum execution time: 409_000 picoseconds. + Weight::from_parts(441_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_204, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_207, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -713,12 +713,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_004_000 picoseconds. - Weight::from_parts(8_835_907, 249) + // Minimum execution time: 9_015_000 picoseconds. + Weight::from_parts(8_746_170, 249) // Standard Error: 2 - .saturating_add(Weight::from_parts(257, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(277, 0).saturating_mul(n.into())) // Standard Error: 2 - .saturating_add(Weight::from_parts(44, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(45, 0).saturating_mul(o.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(o.into())) @@ -730,9 +730,9 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_100_000 picoseconds. - Weight::from_parts(7_782_513, 248) - // Standard Error: 1 + // Minimum execution time: 7_178_000 picoseconds. + Weight::from_parts(7_943_459, 248) + // Standard Error: 2 .saturating_add(Weight::from_parts(105, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -745,10 +745,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_920_000 picoseconds. - Weight::from_parts(7_790_171, 248) + // Minimum execution time: 6_779_000 picoseconds. + Weight::from_parts(7_613_139, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(601, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(613, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -759,10 +759,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_178_000 picoseconds. - Weight::from_parts(6_894_046, 248) + // Minimum execution time: 6_337_000 picoseconds. + Weight::from_parts(7_021_294, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(82, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -773,10 +773,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_699_000 picoseconds. - Weight::from_parts(8_778_552, 248) - // Standard Error: 5 - .saturating_add(Weight::from_parts(602, 0).saturating_mul(n.into())) + // Minimum execution time: 7_636_000 picoseconds. + Weight::from_parts(8_561_886, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(634, 0).saturating_mul(n.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(n.into())) @@ -785,22 +785,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_627_000 picoseconds. - Weight::from_parts(1_719_000, 0) + // Minimum execution time: 1_164_000 picoseconds. + Weight::from_parts(1_267_000, 0) } fn seal_set_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_075_000 picoseconds. - Weight::from_parts(11_284_000, 0) + // Minimum execution time: 10_506_000 picoseconds. + Weight::from_parts(10_796_000, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_583_000 picoseconds. - Weight::from_parts(9_096_000, 0) + // Minimum execution time: 8_709_000 picoseconds. + Weight::from_parts(9_168_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -816,12 +816,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 123_880_000 picoseconds. - Weight::from_parts(122_086_033, 4085) - // Standard Error: 199_139 - .saturating_add(Weight::from_parts(42_655_535, 0).saturating_mul(t.into())) + // Minimum execution time: 124_463_000 picoseconds. + Weight::from_parts(119_363_069, 4085) + // Standard Error: 180_701 + .saturating_add(Weight::from_parts(43_298_326, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(9, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -836,8 +836,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 110_970_000 picoseconds. - Weight::from_parts(113_154_000, 3895) + // Minimum execution time: 113_457_000 picoseconds. + Weight::from_parts(116_903_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -856,12 +856,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4127` - // Minimum execution time: 1_869_663_000 picoseconds. - Weight::from_parts(1_875_504_000, 4127) - // Standard Error: 23 - .saturating_add(Weight::from_parts(563, 0).saturating_mul(i.into())) - // Standard Error: 23 - .saturating_add(Weight::from_parts(936, 0).saturating_mul(s.into())) + // Minimum execution time: 1_868_451_000 picoseconds. + Weight::from_parts(1_877_577_000, 4127) + // Standard Error: 24 + .saturating_add(Weight::from_parts(609, 0).saturating_mul(i.into())) + // Standard Error: 24 + .saturating_add(Weight::from_parts(939, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -870,64 +870,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 837_000 picoseconds. - Weight::from_parts(10_238_254, 0) + // Minimum execution time: 918_000 picoseconds. + Weight::from_parts(8_054_119, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_318, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_325, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_322_000 picoseconds. - Weight::from_parts(11_671_704, 0) + // Minimum execution time: 1_349_000 picoseconds. + Weight::from_parts(9_767_297, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(3_597, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_594, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 778_000 picoseconds. - Weight::from_parts(9_654_074, 0) + // Minimum execution time: 754_000 picoseconds. + Weight::from_parts(8_291_218, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_458, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_461, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 746_000 picoseconds. - Weight::from_parts(6_120_781, 0) + // Minimum execution time: 752_000 picoseconds. + Weight::from_parts(9_485_775, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_462, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_458, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_925_000 picoseconds. - Weight::from_parts(42_372_440, 0) - // Standard Error: 9 - .saturating_add(Weight::from_parts(5_074, 0).saturating_mul(n.into())) + // Minimum execution time: 43_395_000 picoseconds. + Weight::from_parts(42_956_300, 0) + // Standard Error: 8 + .saturating_add(Weight::from_parts(5_081, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_928_000 picoseconds. - Weight::from_parts(48_849_000, 0) + // Minimum execution time: 47_711_000 picoseconds. + Weight::from_parts(49_271_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_926_000 picoseconds. - Weight::from_parts(13_021_000, 0) + // Minimum execution time: 13_070_000 picoseconds. + Weight::from_parts(13_205_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -937,8 +937,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_375_000 picoseconds. - Weight::from_parts(18_081_000, 3895) + // Minimum execution time: 17_853_000 picoseconds. + Weight::from_parts(18_208_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -948,8 +948,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_096_000 picoseconds. - Weight::from_parts(8_388_000, 3820) + // Minimum execution time: 8_043_000 picoseconds. + Weight::from_parts(8_615_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -959,8 +959,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_046_000 picoseconds. - Weight::from_parts(7_556_000, 3558) + // Minimum execution time: 7_302_000 picoseconds. + Weight::from_parts(7_611_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -968,15 +968,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 345_000 picoseconds. + // Minimum execution time: 331_000 picoseconds. Weight::from_parts(366_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 348_000 picoseconds. - Weight::from_parts(396_000, 0) + // Minimum execution time: 384_000 picoseconds. + Weight::from_parts(430_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -984,8 +984,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_771_000 picoseconds. - Weight::from_parts(2_880_000, 1704) + // Minimum execution time: 2_806_000 picoseconds. + Weight::from_parts(2_918_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -993,10 +993,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 647_000 picoseconds. - Weight::from_parts(571_218, 0) - // Standard Error: 8 - .saturating_add(Weight::from_parts(7_394, 0).saturating_mul(r.into())) + // Minimum execution time: 604_000 picoseconds. + Weight::from_parts(535_737, 0) + // Standard Error: 17 + .saturating_add(Weight::from_parts(7_199, 0).saturating_mul(r.into())) } } @@ -1008,8 +1008,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_909_000 picoseconds. - Weight::from_parts(2_003_000, 1627) + // Minimum execution time: 1_932_000 picoseconds. + Weight::from_parts(2_029_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1019,10 +1019,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 10_997_000 picoseconds. - Weight::from_parts(11_373_000, 442) - // Standard Error: 1_547 - .saturating_add(Weight::from_parts(1_170_691, 0).saturating_mul(k.into())) + // Minimum execution time: 11_121_000 picoseconds. + Weight::from_parts(11_232_000, 442) + // Standard Error: 1_671 + .saturating_add(Weight::from_parts(1_247_413, 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)) @@ -1036,10 +1036,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_492_000 picoseconds. - Weight::from_parts(4_548_282, 6149) + // Minimum execution time: 7_611_000 picoseconds. + Weight::from_parts(4_556_039, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_637, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1052,8 +1052,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_030_000 picoseconds. - Weight::from_parts(16_620_000, 6450) + // Minimum execution time: 15_687_000 picoseconds. + Weight::from_parts(16_830_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1066,10 +1066,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_113_000 picoseconds. - Weight::from_parts(3_184_000, 3635) - // Standard Error: 647 - .saturating_add(Weight::from_parts(1_088_426, 0).saturating_mul(k.into())) + // Minimum execution time: 3_058_000 picoseconds. + Weight::from_parts(3_099_000, 3635) + // Standard Error: 627 + .saturating_add(Weight::from_parts(1_090_078, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1088,10 +1088,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_056_000 picoseconds. - Weight::from_parts(15_717_709, 6263) + // Minimum execution time: 15_114_000 picoseconds. + Weight::from_parts(15_675_115, 6263) // Standard Error: 1 - .saturating_add(Weight::from_parts(434, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(409, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1102,8 +1102,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_131_000 picoseconds. - Weight::from_parts(12_640_000, 6380) + // Minimum execution time: 11_902_000 picoseconds. + Weight::from_parts(12_535_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1117,8 +1117,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(49_173_000, 6292) + // Minimum execution time: 46_473_000 picoseconds. + Weight::from_parts(47_362_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1130,8 +1130,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 53_190_000 picoseconds. - Weight::from_parts(55_025_000, 6534) + // Minimum execution time: 51_917_000 picoseconds. + Weight::from_parts(53_767_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1141,8 +1141,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_732_000 picoseconds. - Weight::from_parts(12_076_000, 6349) + // Minimum execution time: 11_394_000 picoseconds. + Weight::from_parts(11_917_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1152,8 +1152,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_227_000, 1627) + // Minimum execution time: 2_108_000 picoseconds. + Weight::from_parts(2_202_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1165,8 +1165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_853_000 picoseconds. - Weight::from_parts(11_240_000, 3631) + // Minimum execution time: 10_878_000 picoseconds. + Weight::from_parts(11_267_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1176,8 +1176,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_425_000 picoseconds. - Weight::from_parts(4_562_000, 3607) + // Minimum execution time: 4_452_000 picoseconds. + Weight::from_parts(4_694_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1188,8 +1188,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_574_000 picoseconds. - Weight::from_parts(5_806_000, 3632) + // Minimum execution time: 5_614_000 picoseconds. + Weight::from_parts(5_872_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1200,8 +1200,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_438_000 picoseconds. - Weight::from_parts(5_671_000, 3607) + // Minimum execution time: 5_521_000 picoseconds. + Weight::from_parts(5_736_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1222,10 +1222,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 254_815_000 picoseconds. - Weight::from_parts(268_622_183, 4264) - // Standard Error: 4 - .saturating_add(Weight::from_parts(713, 0).saturating_mul(c.into())) + // Minimum execution time: 253_608_000 picoseconds. + Weight::from_parts(256_352_977, 4264) + // Standard Error: 11 + .saturating_add(Weight::from_parts(1_162, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1253,14 +1253,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_423_645_000 picoseconds. - Weight::from_parts(172_646_323, 6262) - // Standard Error: 134 - .saturating_add(Weight::from_parts(52_694, 0).saturating_mul(c.into())) - // Standard Error: 16 - .saturating_add(Weight::from_parts(2_127, 0).saturating_mul(i.into())) - // Standard Error: 16 - .saturating_add(Weight::from_parts(2_209, 0).saturating_mul(s.into())) + // Minimum execution time: 4_700_467_000 picoseconds. + Weight::from_parts(381_233_736, 6262) + // Standard Error: 274 + .saturating_add(Weight::from_parts(53_487, 0).saturating_mul(c.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(2_308, 0).saturating_mul(i.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(2_302, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1286,12 +1286,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_234_342_000 picoseconds. - Weight::from_parts(2_250_674_000, 4029) - // Standard Error: 31 - .saturating_add(Weight::from_parts(917, 0).saturating_mul(i.into())) - // Standard Error: 31 - .saturating_add(Weight::from_parts(963, 0).saturating_mul(s.into())) + // Minimum execution time: 2_246_963_000 picoseconds. + Weight::from_parts(2_279_753_000, 4029) + // Standard Error: 36 + .saturating_add(Weight::from_parts(1_102, 0).saturating_mul(i.into())) + // Standard Error: 36 + .saturating_add(Weight::from_parts(1_008, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1311,8 +1311,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 165_562_000 picoseconds. - Weight::from_parts(170_601_000, 4291) + // Minimum execution time: 165_076_000 picoseconds. + Weight::from_parts(168_771_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1329,10 +1329,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 240_647_000 picoseconds. - Weight::from_parts(244_299_946, 3607) - // Standard Error: 75 - .saturating_add(Weight::from_parts(51_236, 0).saturating_mul(c.into())) + // Minimum execution time: 224_244_000 picoseconds. + Weight::from_parts(244_252_040, 3607) + // Standard Error: 86 + .saturating_add(Weight::from_parts(51_723, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1349,10 +1349,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 242_859_000 picoseconds. - Weight::from_parts(260_769_868, 3607) - // Standard Error: 52 - .saturating_add(Weight::from_parts(50_936, 0).saturating_mul(c.into())) + // Minimum execution time: 232_514_000 picoseconds. + Weight::from_parts(247_372_222, 3607) + // Standard Error: 77 + .saturating_add(Weight::from_parts(51_890, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1368,8 +1368,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_266_000 picoseconds. - Weight::from_parts(40_030_000, 3780) + // Minimum execution time: 38_546_000 picoseconds. + Weight::from_parts(40_182_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1383,8 +1383,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 24_627_000 picoseconds. - Weight::from_parts(25_786_000, 6492) + // Minimum execution time: 24_632_000 picoseconds. + Weight::from_parts(25_274_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1393,17 +1393,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_600_000 picoseconds. - Weight::from_parts(9_657_688, 0) - // Standard Error: 78 - .saturating_add(Weight::from_parts(51_082, 0).saturating_mul(r.into())) + // Minimum execution time: 8_360_000 picoseconds. + Weight::from_parts(9_265_377, 0) + // Standard Error: 73 + .saturating_add(Weight::from_parts(51_488, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 588_000 picoseconds. - Weight::from_parts(610_000, 0) + // Minimum execution time: 576_000 picoseconds. + Weight::from_parts(633_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1411,8 +1411,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_237_000 picoseconds. - Weight::from_parts(6_566_000, 3819) + // Minimum execution time: 6_172_000 picoseconds. + Weight::from_parts(6_400_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1421,79 +1421,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_445_000 picoseconds. - Weight::from_parts(7_709_000, 3912) + // Minimum execution time: 7_271_000 picoseconds. + Weight::from_parts(7_471_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 749_000 picoseconds. - Weight::from_parts(819_000, 0) + // Minimum execution time: 784_000 picoseconds. + Weight::from_parts(858_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 427_000 picoseconds. - Weight::from_parts(436_000, 0) + // Minimum execution time: 400_000 picoseconds. + Weight::from_parts(442_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 285_000 picoseconds. - Weight::from_parts(334_000, 0) + // Minimum execution time: 356_000 picoseconds. + Weight::from_parts(386_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` // Minimum execution time: 600_000 picoseconds. - Weight::from_parts(634_000, 0) + Weight::from_parts(646_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 676_000 picoseconds. - Weight::from_parts(712_000, 0) + // Minimum execution time: 691_000 picoseconds. + Weight::from_parts(715_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_439_000 picoseconds. - Weight::from_parts(4_578_000, 0) + // Minimum execution time: 4_321_000 picoseconds. + Weight::from_parts(4_570_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 561_000 picoseconds. - Weight::from_parts(604_000, 0) + // Minimum execution time: 570_000 picoseconds. + Weight::from_parts(616_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 562_000 picoseconds. - Weight::from_parts(591_000, 0) + // Minimum execution time: 559_000 picoseconds. + Weight::from_parts(607_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 545_000 picoseconds. - Weight::from_parts(568_000, 0) + // Minimum execution time: 514_000 picoseconds. + Weight::from_parts(598_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 530_000 picoseconds. - Weight::from_parts(595_000, 0) + // Minimum execution time: 605_000 picoseconds. + Weight::from_parts(633_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1501,8 +1501,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_147_000 picoseconds. - Weight::from_parts(4_328_000, 1552) + // Minimum execution time: 4_183_000 picoseconds. + Weight::from_parts(4_412_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1510,20 +1510,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 451_000 picoseconds. - Weight::from_parts(487_000, 0) + // Minimum execution time: 528_000 picoseconds. + Weight::from_parts(569_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(299, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(300, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 340_000 picoseconds. - Weight::from_parts(365_000, 0) + // Minimum execution time: 365_000 picoseconds. + Weight::from_parts(382_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(407, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1536,10 +1536,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_286_000 picoseconds. - Weight::from_parts(15_522_969, 3784) - // Standard Error: 7_412 - .saturating_add(Weight::from_parts(3_472_121, 0).saturating_mul(n.into())) + // Minimum execution time: 13_140_000 picoseconds. + Weight::from_parts(15_258_455, 3784) + // Standard Error: 7_507 + .saturating_add(Weight::from_parts(3_475_009, 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(3_u64)) @@ -1552,8 +1552,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_275_000 picoseconds. - Weight::from_parts(3_454_000, 1561) + // Minimum execution time: 3_407_000 picoseconds. + Weight::from_parts(3_565_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1564,12 +1564,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_622_000 picoseconds. - Weight::from_parts(3_766_383, 990) - // Standard Error: 5_352 - .saturating_add(Weight::from_parts(2_048_975, 0).saturating_mul(t.into())) + // Minimum execution time: 3_534_000 picoseconds. + Weight::from_parts(3_793_333, 990) + // Standard Error: 5_106 + .saturating_add(Weight::from_parts(2_033_824, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(21, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(14, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1579,10 +1579,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 405_000 picoseconds. - Weight::from_parts(426_000, 0) + // Minimum execution time: 409_000 picoseconds. + Weight::from_parts(441_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_204, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_207, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1592,12 +1592,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_004_000 picoseconds. - Weight::from_parts(8_835_907, 249) + // Minimum execution time: 9_015_000 picoseconds. + Weight::from_parts(8_746_170, 249) // Standard Error: 2 - .saturating_add(Weight::from_parts(257, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(277, 0).saturating_mul(n.into())) // Standard Error: 2 - .saturating_add(Weight::from_parts(44, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(45, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1609,9 +1609,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_100_000 picoseconds. - Weight::from_parts(7_782_513, 248) - // Standard Error: 1 + // Minimum execution time: 7_178_000 picoseconds. + Weight::from_parts(7_943_459, 248) + // Standard Error: 2 .saturating_add(Weight::from_parts(105, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1624,10 +1624,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_920_000 picoseconds. - Weight::from_parts(7_790_171, 248) + // Minimum execution time: 6_779_000 picoseconds. + Weight::from_parts(7_613_139, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(601, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(613, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1638,10 +1638,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_178_000 picoseconds. - Weight::from_parts(6_894_046, 248) + // Minimum execution time: 6_337_000 picoseconds. + Weight::from_parts(7_021_294, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(82, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1652,10 +1652,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_699_000 picoseconds. - Weight::from_parts(8_778_552, 248) - // Standard Error: 5 - .saturating_add(Weight::from_parts(602, 0).saturating_mul(n.into())) + // Minimum execution time: 7_636_000 picoseconds. + Weight::from_parts(8_561_886, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(634, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1664,22 +1664,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_627_000 picoseconds. - Weight::from_parts(1_719_000, 0) + // Minimum execution time: 1_164_000 picoseconds. + Weight::from_parts(1_267_000, 0) } fn seal_set_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_075_000 picoseconds. - Weight::from_parts(11_284_000, 0) + // Minimum execution time: 10_506_000 picoseconds. + Weight::from_parts(10_796_000, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_583_000 picoseconds. - Weight::from_parts(9_096_000, 0) + // Minimum execution time: 8_709_000 picoseconds. + Weight::from_parts(9_168_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1695,12 +1695,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 123_880_000 picoseconds. - Weight::from_parts(122_086_033, 4085) - // Standard Error: 199_139 - .saturating_add(Weight::from_parts(42_655_535, 0).saturating_mul(t.into())) + // Minimum execution time: 124_463_000 picoseconds. + Weight::from_parts(119_363_069, 4085) + // Standard Error: 180_701 + .saturating_add(Weight::from_parts(43_298_326, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(9, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1715,8 +1715,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 110_970_000 picoseconds. - Weight::from_parts(113_154_000, 3895) + // Minimum execution time: 113_457_000 picoseconds. + Weight::from_parts(116_903_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1735,12 +1735,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4127` - // Minimum execution time: 1_869_663_000 picoseconds. - Weight::from_parts(1_875_504_000, 4127) - // Standard Error: 23 - .saturating_add(Weight::from_parts(563, 0).saturating_mul(i.into())) - // Standard Error: 23 - .saturating_add(Weight::from_parts(936, 0).saturating_mul(s.into())) + // Minimum execution time: 1_868_451_000 picoseconds. + Weight::from_parts(1_877_577_000, 4127) + // Standard Error: 24 + .saturating_add(Weight::from_parts(609, 0).saturating_mul(i.into())) + // Standard Error: 24 + .saturating_add(Weight::from_parts(939, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1749,64 +1749,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 837_000 picoseconds. - Weight::from_parts(10_238_254, 0) + // Minimum execution time: 918_000 picoseconds. + Weight::from_parts(8_054_119, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_318, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_325, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_322_000 picoseconds. - Weight::from_parts(11_671_704, 0) + // Minimum execution time: 1_349_000 picoseconds. + Weight::from_parts(9_767_297, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(3_597, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_594, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 778_000 picoseconds. - Weight::from_parts(9_654_074, 0) + // Minimum execution time: 754_000 picoseconds. + Weight::from_parts(8_291_218, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_458, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_461, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 746_000 picoseconds. - Weight::from_parts(6_120_781, 0) + // Minimum execution time: 752_000 picoseconds. + Weight::from_parts(9_485_775, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_462, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_458, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_925_000 picoseconds. - Weight::from_parts(42_372_440, 0) - // Standard Error: 9 - .saturating_add(Weight::from_parts(5_074, 0).saturating_mul(n.into())) + // Minimum execution time: 43_395_000 picoseconds. + Weight::from_parts(42_956_300, 0) + // Standard Error: 8 + .saturating_add(Weight::from_parts(5_081, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_928_000 picoseconds. - Weight::from_parts(48_849_000, 0) + // Minimum execution time: 47_711_000 picoseconds. + Weight::from_parts(49_271_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_926_000 picoseconds. - Weight::from_parts(13_021_000, 0) + // Minimum execution time: 13_070_000 picoseconds. + Weight::from_parts(13_205_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1816,8 +1816,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_375_000 picoseconds. - Weight::from_parts(18_081_000, 3895) + // Minimum execution time: 17_853_000 picoseconds. + Weight::from_parts(18_208_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1827,8 +1827,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_096_000 picoseconds. - Weight::from_parts(8_388_000, 3820) + // Minimum execution time: 8_043_000 picoseconds. + Weight::from_parts(8_615_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1838,8 +1838,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_046_000 picoseconds. - Weight::from_parts(7_556_000, 3558) + // Minimum execution time: 7_302_000 picoseconds. + Weight::from_parts(7_611_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1847,15 +1847,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 345_000 picoseconds. + // Minimum execution time: 331_000 picoseconds. Weight::from_parts(366_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 348_000 picoseconds. - Weight::from_parts(396_000, 0) + // Minimum execution time: 384_000 picoseconds. + Weight::from_parts(430_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1863,8 +1863,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_771_000 picoseconds. - Weight::from_parts(2_880_000, 1704) + // Minimum execution time: 2_806_000 picoseconds. + Weight::from_parts(2_918_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1872,9 +1872,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 647_000 picoseconds. - Weight::from_parts(571_218, 0) - // Standard Error: 8 - .saturating_add(Weight::from_parts(7_394, 0).saturating_mul(r.into())) + // Minimum execution time: 604_000 picoseconds. + Weight::from_parts(535_737, 0) + // Standard Error: 17 + .saturating_add(Weight::from_parts(7_199, 0).saturating_mul(r.into())) } } From 5794910174afe99fa2a86cda34b68ee80d9ceb07 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 25 Jun 2024 12:28:37 +0200 Subject: [PATCH 21/58] Change transient storage meter --- substrate/bin/node/runtime/src/lib.rs | 1 - .../frame/contracts/src/benchmarking/mod.rs | 159 ++++++++++++-- substrate/frame/contracts/src/exec.rs | 9 +- substrate/frame/contracts/src/lib.rs | 5 - .../frame/contracts/src/transient_storage.rs | 195 ++++++++++++------ substrate/frame/contracts/uapi/src/host.rs | 3 + .../frame/contracts/uapi/src/host/riscv32.rs | 18 +- .../frame/contracts/uapi/src/host/wasm32.rs | 38 ++++ 8 files changed, 330 insertions(+), 98 deletions(-) diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 321e30eea22f..803901a5ada2 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1374,7 +1374,6 @@ impl pallet_contracts::Config for Runtime { type InstantiateOrigin = EnsureSigned; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; - type MaxTransientStorageItems = ConstU32<50>; type RuntimeHoldReason = RuntimeHoldReason; #[cfg(not(feature = "runtime-benchmarks"))] type Migrations = (); diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 62e3dd5a4540..891a9872ee92 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -186,21 +186,18 @@ fn caller_funding() -> BalanceOf { fn dummy_transient_storage( ext: &mut StackExt, - stor_num: u32, stor_size: u32, ) -> Result<(), BenchmarkError> { - let storage_items = (0..stor_num) - .map(|i| { - let hash = T::Hashing::hash_of(&i) - .as_ref() - .try_into() - .map_err(|_| "Hash too big for storage key")?; - Ok((hash, vec![42u8; stor_size as usize])) - }) - .collect::, &'static str>>()?; - for item in storage_items { - ext.set_transient_storage(&Key::Fix(item.0), Some(item.1.clone()), false) - .map_err(|_| "Failed to write storage to restoration dest")?; + for i in 0u32.. { + let key = + Key::::try_from_var(i.to_le_bytes().to_vec()).map_err(|_| "Key has wrong length")?; + if ext + .set_transient_storage(&key, Some(vec![42u8; stor_size as usize]), false) + .is_err() + { + ext.transient_storage().meter().clear(); + break; + } } Ok(()) } @@ -1186,7 +1183,7 @@ mod benchmarks { // The weight of journal rollbacks should be taken into account when setting storage. #[benchmark] fn rollback_journal() -> Result<(), BenchmarkError> { - let n = T::Schedule::get().limits.payload_len; + let max_value_len = T::Schedule::get().limits.payload_len; let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; @@ -1194,13 +1191,11 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); - let max_storage_items = T::MaxTransientStorageItems::get(); - - dummy_transient_storage::(runtime.ext(), max_storage_items, 1)?; + dummy_transient_storage::(runtime.ext(), 1)?; runtime.ext().transient_storage().start_transaction(); runtime .ext() - .set_transient_storage(&key, Some(vec![0u8; n as _]), false) + .set_transient_storage(&key, Some(vec![42u8; max_value_len as _]), false) .map_err(|_| "Failed to write to storage during setup.")?; #[block] { @@ -1215,16 +1210,15 @@ mod benchmarks { fn seal_set_transient_storage() -> Result<(), BenchmarkError> { let max_value_len = T::Schedule::get().limits.payload_len; let max_key_len = T::MaxStorageKeyLen::get(); - let max_storage_items = T::MaxTransientStorageItems::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; let value = vec![1u8; max_value_len as usize]; build_runtime!(runtime, memory: [ key.to_vec(), value.clone(), ]); - dummy_transient_storage::(runtime.ext(), max_storage_items, 1)?; + dummy_transient_storage::(runtime.ext(), 1)?; runtime .ext() - .set_transient_storage(&key, Some(vec![16u8; max_value_len as usize]), false) + .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) .map_err(|_| "Failed to write to storage during setup.")?; let result; @@ -1245,6 +1239,129 @@ mod benchmarks { Ok(()) } + #[benchmark] + fn seal_clear_transient_storage() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + build_runtime!(runtime, instance, memory: [ key.to_vec(), ]); + + dummy_transient_storage::(runtime.ext(), 1)?; + runtime + .ext() + .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) + .map_err(|_| "Failed to write to storage during setup.")?; + + let result; + #[block] + { + result = + BenchEnv::seal0_clear_transient_storage(&mut runtime, &mut memory, 0, max_key_len); + } + + assert_ok!(result); + assert!(runtime.ext().get_transient_storage(&key).is_none()); + Ok(()) + } + + #[benchmark] + fn seal_get_transient_storage() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + build_runtime!(runtime, instance, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); + dummy_transient_storage::(runtime.ext(), 1)?; + runtime + .ext() + .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) + .map_err(|_| "Failed to write to storage during setup.")?; + + let out_ptr = max_key_len + 4; + let result; + #[block] + { + result = BenchEnv::seal0_get_transient_storage( + &mut runtime, + &mut memory, + 0, // key_ptr + max_key_len, // key_len + out_ptr, // out_ptr + max_key_len, // out_len_ptr + ); + } + + assert_ok!(result); + assert_eq!( + &runtime.ext().get_transient_storage(&key).unwrap(), + &memory[out_ptr as usize..] + ); + Ok(()) + } + + #[benchmark] + fn seal_contains_transient_storage() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + build_runtime!(runtime, instance, memory: [ key.to_vec(), ]); + dummy_transient_storage::(runtime.ext(), 1)?; + runtime + .ext() + .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) + .map_err(|_| "Failed to write to storage during setup.")?; + + let result; + #[block] + { + result = BenchEnv::seal0_contains_transient_storage( + &mut runtime, + &mut memory, + 0, + max_key_len, + ); + } + + assert_eq!(result.unwrap(), max_value_len); + Ok(()) + } + + #[benchmark] + fn seal_take_transient_storage() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + build_runtime!(runtime, instance, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); + dummy_transient_storage::(runtime.ext(), 1)?; + let value = vec![42u8; max_value_len as usize]; + runtime + .ext() + .set_transient_storage(&key, Some(value.clone()), false) + .map_err(|_| "Failed to write to storage during setup.")?; + + let out_ptr = max_key_len + 4; + let result; + #[block] + { + result = BenchEnv::seal0_take_transient_storage( + &mut runtime, + &mut memory, + 0, // key_ptr + max_key_len, // key_len + out_ptr, // out_ptr + max_key_len, // out_len_ptr + ); + } + + assert_ok!(result); + assert!(&runtime.ext().get_transient_storage(&key).is_none()); + assert_eq!(&value, &memory[out_ptr as usize..]); + Ok(()) + } + // We transfer to unique accounts. #[benchmark(pov_mode = Measured)] fn seal_transfer() { diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 0d33c58ccf71..ba5200c638b4 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -329,6 +329,9 @@ pub trait Ext: sealing::Sealed { #[cfg(any(test, feature = "runtime-benchmarks"))] fn contract_info(&mut self) -> &mut ContractInfo; + /// Get a mutable reference to the transient storage. + /// Useful in tests when it is sometimes necessary to modify and inspect the transient storage + /// directly. #[cfg(any(test, feature = "runtime-benchmarks"))] fn transient_storage(&mut self) -> &mut TransientStorage; @@ -811,7 +814,6 @@ where false, )?; - let transient_storage_limit = T::MaxTransientStorageLen::get(); let stack = Self { origin, schedule, @@ -824,10 +826,7 @@ where frames: Default::default(), debug_message, determinism, - transient_storage: TransientStorage::new( - transient_storage_limit, - transient_storage_limit, - ), + transient_storage: TransientStorage::new(T::MaxTransientStorageLen::get()), _phantom: Default::default(), }; diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 55127c316331..c2eb6529936b 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -414,10 +414,6 @@ pub mod pallet { #[pallet::constant] type MaxTransientStorageLen: Get; - /// The maximum length of the transient storage in bytes. - #[pallet::constant] - type MaxTransientStorageItems: Get; - /// Origin allowed to upload code. /// /// By default, it is safe to set this to `EnsureSigned`, allowing anyone to upload contract @@ -564,7 +560,6 @@ pub mod pallet { type MaxDelegateDependencies = MaxDelegateDependencies; type MaxStorageKeyLen = ConstU32<128>; type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; - type MaxTransientStorageItems = ConstU32<{ 50 }>; type Migrations = (); type Time = Self; type Randomness = Self; diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 3d690a3f1f45..d95c2f7a5c2b 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -17,14 +17,13 @@ //! This module contains routines for accessing and altering a contract transient storage. -use core::marker::PhantomData; - use crate::{ exec::{AccountIdOf, Key}, storage::WriteOutcome, Config, Error, }; use codec::Encode; +use core::marker::PhantomData; use frame_support::DefaultNoBound; use sp_runtime::{DispatchError, DispatchResult}; use sp_std::{ @@ -37,85 +36,109 @@ use sp_std::{ /// Meter entry tracks transaction allocations. #[derive(Default, Debug)] struct MeterEntry { - /// Allocation commited from subsequent transactions. - pub nested: u32, - /// Allocation made in the current transaction. - pub current: u32, + /// Allocations made in the current transaction. + pub amount: u32, + /// Allocations limit in the current transaction. + pub limit: u32, } impl MeterEntry { - pub fn sum(&self) -> u32 { - self.current.saturating_add(self.nested) + pub fn new(limit: u32) -> Self { + Self { limit, amount: Default::default() } + } + + pub fn exceeds_limit(&self, amount: u32) -> bool { + self.amount.saturating_add(amount) > self.limit } pub fn absorb(&mut self, rhs: Self) { - self.nested = self.nested.saturating_add(rhs.sum()) + self.amount = self.amount.saturating_add(rhs.amount) } } -/// The storage meter enforces a limit for each nested transaction and the total allocation limit. +// The storage meter enforces a limit for each transaction, +// which is calculated as free_storage * (1 - 1/16) for each subsequent frame. #[derive(DefaultNoBound)] -struct StorageMeter { - total_limit: u32, - transaction_limit: u32, - nested: Vec, - root: MeterEntry, +pub struct StorageMeter { + nested_meters: Vec, + root_meter: MeterEntry, _phantom: PhantomData, } impl StorageMeter { - pub fn new(total_limit: u32, transaction_limit: u32) -> Self { - Self { total_limit, transaction_limit, ..Default::default() } + const STORAGE_FRACTION_DENOMINATOR: u32 = 16; + + pub fn new(memory_limit: u32) -> Self { + Self { root_meter: MeterEntry::new(memory_limit), ..Default::default() } } /// Charge the allocated amount of transaction storage from the meter. pub fn charge(&mut self, amount: u32) -> DispatchResult { - let current_amount = self.current_amount().saturating_add(amount); - if current_amount > self.transaction_limit || - amount.saturating_add(self.total_amount()) > self.total_limit - { + let meter = self.top_meter_mut(); + if meter.exceeds_limit(amount) { return Err(Error::::OutOfTransientStorage.into()); } - self.top_meter_mut().current = current_amount; + meter.amount = meter.amount.saturating_add(amount); Ok(()) } /// The allocated amount of memory inside the current transaction. pub fn current_amount(&self) -> u32 { - self.top_meter().current + self.top_meter().amount + } + + /// The memory limit of the current transaction. + pub fn current_limit(&self) -> u32 { + self.top_meter().limit } /// The total allocated amount of memory. pub fn total_amount(&self) -> u32 { - self.nested + self.nested_meters .iter() - .map(|e: &MeterEntry| e.sum()) - .fold(self.root.sum(), |acc, e| acc.saturating_add(e)) + .fold(self.root_meter.amount, |acc, e| acc.saturating_add(e.amount)) } /// Revert a transaction meter. pub fn revert(&mut self) { - self.nested.pop().expect("There is no nested meter that can be reverted."); + self.nested_meters + .pop() + .expect("There is no nested meter that can be reverted."); } - /// Start a nested transaction meter. + /// Start a transaction meter. pub fn start(&mut self) { - self.nested.push(Default::default()); + let meter = self.top_meter(); + let free = meter.limit - meter.amount; + let transaction_limit = if !self.nested_meters.is_empty() { + // Allow use of (1 - 1/cost_value) of free storage for subsequent calls. + free.saturating_sub(free.saturating_div(Self::STORAGE_FRACTION_DENOMINATOR)) + } else { + free + }; + self.nested_meters.push(MeterEntry::new(transaction_limit)); } /// Commit a transaction meter. pub fn commit(&mut self) { - let nested_meter = - self.nested.pop().expect("There is no nested meter that can be committed."); - self.top_meter_mut().absorb(nested_meter); + let transaction_meter = self + .nested_meters + .pop() + .expect("There is no nested meter that can be committed."); + self.top_meter_mut().absorb(transaction_meter) + } + + pub fn clear(&mut self) { + self.nested_meters.clear(); + self.root_meter.amount = 0; } fn top_meter_mut(&mut self) -> &mut MeterEntry { - self.nested.last_mut().unwrap_or(&mut self.root) + self.nested_meters.last_mut().unwrap_or(&mut self.root_meter) } fn top_meter(&self) -> &MeterEntry { - self.nested.last().unwrap_or(&self.root) + self.nested_meters.last().unwrap_or(&self.root_meter) } } @@ -218,12 +241,12 @@ pub struct TransientStorage { } impl TransientStorage { - pub fn new(total_limit: u32, transaction_limit: u32) -> Self { + pub fn new(memory_limit: u32) -> Self { TransientStorage { current: Default::default(), journal: Journal::new(), checkpoints: Default::default(), - meter: StorageMeter::new(total_limit, transaction_limit), + meter: StorageMeter::new(memory_limit), } } @@ -331,10 +354,15 @@ impl TransientStorage { .expect("No open transient storage transaction that can be committed."); self.meter.commit(); } + + pub fn meter(&mut self) -> &mut StorageMeter { + return &mut self.meter + } } #[cfg(test)] mod tests { + use super::*; use crate::{ tests::{Test, ALICE, BOB, CHARLIE}, @@ -343,7 +371,7 @@ mod tests { #[test] fn read_write_works() { - let mut storage = TransientStorage::::new(2048, 2048); + let mut storage = TransientStorage::::new(2048); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), Ok(WriteOutcome::New) @@ -375,7 +403,7 @@ mod tests { #[test] fn remove_transaction_works() { - let mut storage = TransientStorage::::new(1024, 1024); + let mut storage = TransientStorage::::new(1024); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), Ok(WriteOutcome::New) @@ -396,7 +424,7 @@ mod tests { #[test] fn commit_remove_transaction_works() { - let mut storage = TransientStorage::::new(1024, 256); + let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -420,7 +448,7 @@ mod tests { #[test] fn rollback_remove_transaction_works() { - let mut storage = TransientStorage::::new(1024, 256); + let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -436,7 +464,7 @@ mod tests { #[test] fn rollback_transaction_works() { - let mut storage = TransientStorage::::new(1024, 256); + let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( @@ -449,7 +477,7 @@ mod tests { #[test] fn commit_transaction_works() { - let mut storage = TransientStorage::::new(1024, 256); + let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( @@ -462,7 +490,7 @@ mod tests { #[test] fn overwrite_and_commmit_transaction_works() { - let mut storage = TransientStorage::::new(1024, 512); + let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -478,7 +506,7 @@ mod tests { #[test] fn rollback_in_nested_transaction_works() { - let mut storage = TransientStorage::::new(1024, 256); + let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -497,7 +525,7 @@ mod tests { #[test] fn commit_in_nested_transaction_works() { - let mut storage = TransientStorage::::new(1024, 256); + let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -523,7 +551,7 @@ mod tests { #[test] fn commit_rollback_in_nested_transaction_works() { - let mut storage = TransientStorage::::new(1024, 256); + let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), @@ -548,30 +576,67 @@ mod tests { } #[test] - fn metering_nested_limit_works() { - let mut storage = TransientStorage::::new(1024, 128); + fn metering_transactions_works() { + // 192 bytes is the allocation overhead, plus 32 bytes for the account and 32 bytes for the + // key. Call stack size is 2, so free storage is divided by 2 with each frame. + let mut storage = TransientStorage::::new((4096 + 256) * 2); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); storage.start_transaction(); assert_eq!( - storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); + } + + #[test] + fn metering_nested_transactions_works() { + let mut storage = TransientStorage::::new((4096 + 256) * 3); + + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), + Ok(WriteOutcome::New) + ); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), + Ok(WriteOutcome::New) + ); + storage.commit_transaction(); + storage.commit_transaction(); + } + + #[test] + fn metering_transaction_fails() { + let mut storage = TransientStorage::::new(4096); + storage.start_transaction(); + assert_eq!( + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Err(Error::::OutOfTransientStorage.into()) ); storage.commit_transaction(); - assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); + assert_eq!(storage.meter.total_amount(), 0); } #[test] - fn metering_total_limit_works() { - let mut storage = TransientStorage::::new(256, 256); + fn metering_nested_transactions_fails() { + let mut storage = TransientStorage::::new((4096 + 256) * 2); storage.start_transaction(); assert_eq!( - storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.start_transaction(); assert_eq!( - storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1]), false), + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), Err(Error::::OutOfTransientStorage.into()) ); storage.commit_transaction(); @@ -579,18 +644,22 @@ mod tests { } #[test] - fn metering_total_limit_with_rollback_works() { - let mut storage = TransientStorage::::new(256, 256); + fn metering_nested_transaction_with_rollback_works() { + let mut storage = TransientStorage::::new((4096 + 256) * 2); storage.start_transaction(); + let limit = storage.meter.current_limit(); storage.start_transaction(); assert_eq!( - storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1]), false), + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.rollback_transaction(); + + assert_eq!(storage.meter.total_amount(), 0); + assert_eq!(storage.meter.current_limit(), limit); assert_eq!( - storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.commit_transaction(); @@ -598,27 +667,27 @@ mod tests { #[test] fn metering_with_rollback_works() { - let mut storage = TransientStorage::::new(1024, 256); + let mut storage = TransientStorage::::new((4096 + 256) * 5); storage.start_transaction(); assert_eq!( - storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); let amount = storage.meter.total_amount(); storage.start_transaction(); assert_eq!( - storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![2]), false), + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.start_transaction(); assert_eq!( - storage.write(&BOB, &Key::Fix([1; 32]), Some(vec![3]), false), + storage.write(&BOB, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.commit_transaction(); storage.rollback_transaction(); - storage.commit_transaction(); assert_eq!(amount, storage.meter.total_amount()); + storage.commit_transaction(); } } diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index e741c2a66324..c63102994cad 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -291,6 +291,7 @@ pub trait HostFn { /// /// Returns the size of the pre-existing value at the specified key if any. fn clear_storage_v1(key: &[u8]) -> Option; + fn clear_transient_storage(key: &[u8]) -> Option; /// Retrieve the code hash for a specified contract address. /// @@ -323,6 +324,7 @@ pub trait HostFn { /// /// Returns the size of the pre-existing value at the specified key if any. fn contains_storage_v1(key: &[u8]) -> Option; + fn contains_transient_storage(key: &[u8]) -> Option; /// Emit a custom debug message. /// @@ -698,6 +700,7 @@ pub trait HostFn { /// /// [KeyNotFound][`crate::ReturnErrorCode::KeyNotFound] fn take_storage(key: &[u8], output: &mut &mut [u8]) -> Result; + fn take_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result; /// Transfer some amount of funds into the specified account. /// diff --git a/substrate/frame/contracts/uapi/src/host/riscv32.rs b/substrate/frame/contracts/uapi/src/host/riscv32.rs index 0896eaedc1f6..355520233212 100644 --- a/substrate/frame/contracts/uapi/src/host/riscv32.rs +++ b/substrate/frame/contracts/uapi/src/host/riscv32.rs @@ -172,6 +172,10 @@ impl HostFn for HostFnImpl { todo!() } + fn set_transient_storage(key: &[u8], encoded_value: &[u8]) -> Option { + todo!() + } + fn clear_storage(key: &[u8]) { todo!() } @@ -180,18 +184,22 @@ impl HostFn for HostFnImpl { todo!() } + fn clear_transient_storage(key: &[u8]) -> Option { + todo!() + } + impl_get_storage!(get_storage, sys::get_storage); impl_get_storage!(get_storage_v1, sys::v1::get_storage); - fn set_transient_storage(key: &[u8], encoded_value: &[u8]) -> Option { + fn get_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result { todo!() } - fn get_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result { + fn take_storage(key: &[u8], output: &mut &mut [u8]) -> Result { todo!() } - fn take_storage(key: &[u8], output: &mut &mut [u8]) -> Result { + fn take_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result { todo!() } @@ -203,6 +211,10 @@ impl HostFn for HostFnImpl { todo!() } + fn contains_transient_storage(key: &[u8]) -> Option { + todo!() + } + fn terminate(beneficiary: &[u8]) -> ! { todo!() } diff --git a/substrate/frame/contracts/uapi/src/host/wasm32.rs b/substrate/frame/contracts/uapi/src/host/wasm32.rs index e1c6a6faa3b3..55600bc3201f 100644 --- a/substrate/frame/contracts/uapi/src/host/wasm32.rs +++ b/substrate/frame/contracts/uapi/src/host/wasm32.rs @@ -61,6 +61,8 @@ mod sys { pub fn clear_storage(key_ptr: *const u8); + pub fn clear_transient_storage(key_ptr: *const u8, key_len: u32) -> ReturnCode; + pub fn code_hash( account_id_ptr: *const u8, output_ptr: *mut u8, @@ -69,6 +71,8 @@ mod sys { pub fn contains_storage(key_ptr: *const u8) -> ReturnCode; + pub fn contains_transient_storage(key_ptr: *const u8, key_len: u32) -> ReturnCode; + pub fn debug_message(str_ptr: *const u8, str_len: u32) -> ReturnCode; pub fn delegate_call( @@ -161,6 +165,13 @@ mod sys { out_len_ptr: *mut u32, ) -> ReturnCode; + pub fn take_transient_storage( + key_ptr: *const u8, + key_len: u32, + out_ptr: *mut u8, + out_len_ptr: *mut u32, + ) -> ReturnCode; + pub fn terminate(beneficiary_ptr: *const u8) -> !; pub fn transfer( @@ -633,6 +644,11 @@ impl HostFn for HostFnImpl { ret_code.into() } + fn clear_transient_storage(key: &[u8]) -> Option { + let ret_code = unsafe { sys::clear_transient_storage(key.as_ptr(), key.len() as u32) }; + ret_code.into() + } + #[inline(always)] fn get_storage(key: &[u8], output: &mut &mut [u8]) -> Result { let mut output_len = output.len() as u32; @@ -693,6 +709,23 @@ impl HostFn for HostFnImpl { ret_code.into() } + #[inline(always)] + fn take_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result { + let mut output_len = output.len() as u32; + let ret_code = { + unsafe { + sys::take_transient_storage( + key.as_ptr(), + key.len() as u32, + output.as_mut_ptr(), + &mut output_len, + ) + } + }; + extract_from_slice(output, output_len as usize); + ret_code.into() + } + fn debug_message(str: &[u8]) -> Result { let ret_code = unsafe { sys::debug_message(str.as_ptr(), str.len() as u32) }; ret_code.into() @@ -708,6 +741,11 @@ impl HostFn for HostFnImpl { ret_code.into() } + fn contains_transient_storage(key: &[u8]) -> Option { + let ret_code = unsafe { sys::contains_transient_storage(key.as_ptr(), key.len() as u32) }; + ret_code.into() + } + fn terminate(beneficiary: &[u8]) -> ! { unsafe { sys::terminate(beneficiary.as_ptr()) } } From da8316eaae7616ad073a0dece5689cd2079194d0 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 25 Jun 2024 13:19:03 +0200 Subject: [PATCH 22/58] Fix benchmark warnings --- substrate/frame/contracts/src/benchmarking/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 891a9872ee92..cc4bf4718f48 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -1245,7 +1245,7 @@ mod benchmarks { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - build_runtime!(runtime, instance, memory: [ key.to_vec(), ]); + build_runtime!(runtime, memory: [ key.to_vec(), ]); dummy_transient_storage::(runtime.ext(), 1)?; runtime @@ -1271,7 +1271,7 @@ mod benchmarks { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - build_runtime!(runtime, instance, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); + build_runtime!(runtime, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); dummy_transient_storage::(runtime.ext(), 1)?; runtime .ext() @@ -1306,7 +1306,7 @@ mod benchmarks { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - build_runtime!(runtime, instance, memory: [ key.to_vec(), ]); + build_runtime!(runtime, memory: [ key.to_vec(), ]); dummy_transient_storage::(runtime.ext(), 1)?; runtime .ext() @@ -1334,7 +1334,7 @@ mod benchmarks { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - build_runtime!(runtime, instance, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); + build_runtime!(runtime, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); dummy_transient_storage::(runtime.ext(), 1)?; let value = vec![42u8; max_value_len as usize]; runtime From d8298f09f0f95ac73f790834c678019936ce322e Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Tue, 25 Jun 2024 12:26:48 +0000 Subject: [PATCH 23/58] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 832 ++++++++++++----------- 1 file changed, 446 insertions(+), 386 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index e71bb916c482..36357964dd07 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/frame/contracts/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for `pallet_contracts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-06-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-06-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-1pho9goo-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `runner-x5tnzzy-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: @@ -100,6 +100,10 @@ pub trait WeightInfo { fn seal_take_storage(n: u32, ) -> Weight; fn rollback_journal() -> Weight; fn seal_set_transient_storage() -> Weight; + fn seal_clear_transient_storage() -> Weight; + fn seal_get_transient_storage() -> Weight; + fn seal_contains_transient_storage() -> Weight; + fn seal_take_transient_storage() -> Weight; fn seal_transfer() -> Weight; fn seal_call(t: u32, i: u32, ) -> Weight; fn seal_delegate_call() -> Weight; @@ -129,8 +133,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_932_000 picoseconds. - Weight::from_parts(2_029_000, 1627) + // Minimum execution time: 1_895_000 picoseconds. + Weight::from_parts(1_975_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -140,10 +144,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_121_000 picoseconds. - Weight::from_parts(11_232_000, 442) - // Standard Error: 1_671 - .saturating_add(Weight::from_parts(1_247_413, 0).saturating_mul(k.into())) + // Minimum execution time: 11_200_000 picoseconds. + Weight::from_parts(11_437_000, 442) + // Standard Error: 2_036 + .saturating_add(Weight::from_parts(1_204_457, 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)) @@ -157,10 +161,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_611_000 picoseconds. - Weight::from_parts(4_556_039, 6149) + // Minimum execution time: 7_681_000 picoseconds. + Weight::from_parts(4_863_511, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_627, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -173,8 +177,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 15_687_000 picoseconds. - Weight::from_parts(16_830_000, 6450) + // Minimum execution time: 16_550_000 picoseconds. + Weight::from_parts(16_962_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -187,10 +191,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_058_000 picoseconds. - Weight::from_parts(3_099_000, 3635) - // Standard Error: 627 - .saturating_add(Weight::from_parts(1_090_078, 0).saturating_mul(k.into())) + // Minimum execution time: 3_124_000 picoseconds. + Weight::from_parts(3_152_000, 3635) + // Standard Error: 534 + .saturating_add(Weight::from_parts(1_098_366, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -209,10 +213,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_114_000 picoseconds. - Weight::from_parts(15_675_115, 6263) - // Standard Error: 1 - .saturating_add(Weight::from_parts(409, 0).saturating_mul(c.into())) + // Minimum execution time: 15_059_000 picoseconds. + Weight::from_parts(15_526_712, 6263) + // Standard Error: 2 + .saturating_add(Weight::from_parts(427, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -223,8 +227,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 11_902_000 picoseconds. - Weight::from_parts(12_535_000, 6380) + // Minimum execution time: 12_246_000 picoseconds. + Weight::from_parts(12_747_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -238,8 +242,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 46_473_000 picoseconds. - Weight::from_parts(47_362_000, 6292) + // Minimum execution time: 48_149_000 picoseconds. + Weight::from_parts(48_939_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -251,8 +255,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 51_917_000 picoseconds. - Weight::from_parts(53_767_000, 6534) + // Minimum execution time: 52_500_000 picoseconds. + Weight::from_parts(54_238_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -262,8 +266,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_394_000 picoseconds. - Weight::from_parts(11_917_000, 6349) + // Minimum execution time: 11_882_000 picoseconds. + Weight::from_parts(12_381_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -273,7 +277,7 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_108_000 picoseconds. + // Minimum execution time: 2_081_000 picoseconds. Weight::from_parts(2_202_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -286,8 +290,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_878_000 picoseconds. - Weight::from_parts(11_267_000, 3631) + // Minimum execution time: 10_758_000 picoseconds. + Weight::from_parts(11_201_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -297,8 +301,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_452_000 picoseconds. - Weight::from_parts(4_694_000, 3607) + // Minimum execution time: 4_409_000 picoseconds. + Weight::from_parts(4_594_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -309,8 +313,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_614_000 picoseconds. - Weight::from_parts(5_872_000, 3632) + // Minimum execution time: 5_436_000 picoseconds. + Weight::from_parts(5_812_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -321,8 +325,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_521_000 picoseconds. - Weight::from_parts(5_736_000, 3607) + // Minimum execution time: 5_280_000 picoseconds. + Weight::from_parts(5_646_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -343,10 +347,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 253_608_000 picoseconds. - Weight::from_parts(256_352_977, 4264) - // Standard Error: 11 - .saturating_add(Weight::from_parts(1_162, 0).saturating_mul(c.into())) + // Minimum execution time: 254_639_000 picoseconds. + Weight::from_parts(267_931_959, 4264) + // Standard Error: 5 + .saturating_add(Weight::from_parts(770, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -374,14 +378,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_700_467_000 picoseconds. - Weight::from_parts(381_233_736, 6262) - // Standard Error: 274 - .saturating_add(Weight::from_parts(53_487, 0).saturating_mul(c.into())) - // Standard Error: 32 - .saturating_add(Weight::from_parts(2_308, 0).saturating_mul(i.into())) - // Standard Error: 32 - .saturating_add(Weight::from_parts(2_302, 0).saturating_mul(s.into())) + // Minimum execution time: 4_497_077_000 picoseconds. + Weight::from_parts(38_610_814, 6262) + // Standard Error: 167 + .saturating_add(Weight::from_parts(54_092, 0).saturating_mul(c.into())) + // Standard Error: 20 + .saturating_add(Weight::from_parts(2_300, 0).saturating_mul(i.into())) + // Standard Error: 20 + .saturating_add(Weight::from_parts(2_297, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -407,12 +411,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_246_963_000 picoseconds. - Weight::from_parts(2_279_753_000, 4029) - // Standard Error: 36 - .saturating_add(Weight::from_parts(1_102, 0).saturating_mul(i.into())) - // Standard Error: 36 - .saturating_add(Weight::from_parts(1_008, 0).saturating_mul(s.into())) + // Minimum execution time: 2_227_347_000 picoseconds. + Weight::from_parts(2_263_930_000, 4029) + // Standard Error: 34 + .saturating_add(Weight::from_parts(1_001, 0).saturating_mul(i.into())) + // Standard Error: 34 + .saturating_add(Weight::from_parts(920, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -432,8 +436,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 165_076_000 picoseconds. - Weight::from_parts(168_771_000, 4291) + // Minimum execution time: 166_907_000 picoseconds. + Weight::from_parts(171_544_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -450,10 +454,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 224_244_000 picoseconds. - Weight::from_parts(244_252_040, 3607) - // Standard Error: 86 - .saturating_add(Weight::from_parts(51_723, 0).saturating_mul(c.into())) + // Minimum execution time: 231_632_000 picoseconds. + Weight::from_parts(247_875_779, 3607) + // Standard Error: 60 + .saturating_add(Weight::from_parts(51_391, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -470,10 +474,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 232_514_000 picoseconds. - Weight::from_parts(247_372_222, 3607) - // Standard Error: 77 - .saturating_add(Weight::from_parts(51_890, 0).saturating_mul(c.into())) + // Minimum execution time: 240_526_000 picoseconds. + Weight::from_parts(259_679_899, 3607) + // Standard Error: 59 + .saturating_add(Weight::from_parts(51_451, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -489,8 +493,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 38_546_000 picoseconds. - Weight::from_parts(40_182_000, 3780) + // Minimum execution time: 38_890_000 picoseconds. + Weight::from_parts(39_983_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -504,8 +508,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 24_632_000 picoseconds. - Weight::from_parts(25_274_000, 6492) + // Minimum execution time: 25_587_000 picoseconds. + Weight::from_parts(26_259_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -514,17 +518,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_360_000 picoseconds. - Weight::from_parts(9_265_377, 0) - // Standard Error: 73 - .saturating_add(Weight::from_parts(51_488, 0).saturating_mul(r.into())) + // Minimum execution time: 8_388_000 picoseconds. + Weight::from_parts(9_788_693, 0) + // Standard Error: 83 + .saturating_add(Weight::from_parts(51_386, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 576_000 picoseconds. - Weight::from_parts(633_000, 0) + // Minimum execution time: 666_000 picoseconds. + Weight::from_parts(699_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -532,8 +536,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_172_000 picoseconds. - Weight::from_parts(6_400_000, 3819) + // Minimum execution time: 6_128_000 picoseconds. + Weight::from_parts(6_404_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -542,79 +546,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_271_000 picoseconds. - Weight::from_parts(7_471_000, 3912) + // Minimum execution time: 7_296_000 picoseconds. + Weight::from_parts(7_630_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 784_000 picoseconds. - Weight::from_parts(858_000, 0) + // Minimum execution time: 715_000 picoseconds. + Weight::from_parts(776_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 400_000 picoseconds. - Weight::from_parts(442_000, 0) + // Minimum execution time: 372_000 picoseconds. + Weight::from_parts(404_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 356_000 picoseconds. - Weight::from_parts(386_000, 0) + // Minimum execution time: 296_000 picoseconds. + Weight::from_parts(351_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 600_000 picoseconds. - Weight::from_parts(646_000, 0) + // Minimum execution time: 562_000 picoseconds. + Weight::from_parts(620_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 691_000 picoseconds. - Weight::from_parts(715_000, 0) + // Minimum execution time: 663_000 picoseconds. + Weight::from_parts(718_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_321_000 picoseconds. - Weight::from_parts(4_570_000, 0) + // Minimum execution time: 4_483_000 picoseconds. + Weight::from_parts(4_724_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 570_000 picoseconds. - Weight::from_parts(616_000, 0) + // Minimum execution time: 551_000 picoseconds. + Weight::from_parts(634_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 559_000 picoseconds. - Weight::from_parts(607_000, 0) + // Minimum execution time: 507_000 picoseconds. + Weight::from_parts(587_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 514_000 picoseconds. - Weight::from_parts(598_000, 0) + // Minimum execution time: 556_000 picoseconds. + Weight::from_parts(611_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 605_000 picoseconds. - Weight::from_parts(633_000, 0) + // Minimum execution time: 538_000 picoseconds. + Weight::from_parts(622_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -622,8 +626,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_183_000 picoseconds. - Weight::from_parts(4_412_000, 1552) + // Minimum execution time: 4_101_000 picoseconds. + Weight::from_parts(4_294_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -631,8 +635,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 528_000 picoseconds. - Weight::from_parts(569_000, 0) + // Minimum execution time: 502_000 picoseconds. + Weight::from_parts(530_000, 0) // Standard Error: 3 .saturating_add(Weight::from_parts(300, 0).saturating_mul(n.into())) } @@ -641,10 +645,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 365_000 picoseconds. - Weight::from_parts(382_000, 0) + // Minimum execution time: 380_000 picoseconds. + Weight::from_parts(432_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(407, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -657,10 +661,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_140_000 picoseconds. - Weight::from_parts(15_258_455, 3784) - // Standard Error: 7_507 - .saturating_add(Weight::from_parts(3_475_009, 0).saturating_mul(n.into())) + // Minimum execution time: 13_653_000 picoseconds. + Weight::from_parts(15_911_187, 3784) + // Standard Error: 7_779 + .saturating_add(Weight::from_parts(3_469_493, 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(3_u64)) @@ -673,8 +677,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_407_000 picoseconds. - Weight::from_parts(3_565_000, 1561) + // Minimum execution time: 3_337_000 picoseconds. + Weight::from_parts(3_504_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -685,12 +689,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_534_000 picoseconds. - Weight::from_parts(3_793_333, 990) - // Standard Error: 5_106 - .saturating_add(Weight::from_parts(2_033_824, 0).saturating_mul(t.into())) + // Minimum execution time: 3_629_000 picoseconds. + Weight::from_parts(3_860_500, 990) + // Standard Error: 5_057 + .saturating_add(Weight::from_parts(2_062_375, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(14, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(17, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -700,10 +704,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 409_000 picoseconds. - Weight::from_parts(441_000, 0) + // Minimum execution time: 404_000 picoseconds. + Weight::from_parts(449_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_207, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_206, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -713,12 +717,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_015_000 picoseconds. - Weight::from_parts(8_746_170, 249) - // Standard Error: 2 - .saturating_add(Weight::from_parts(277, 0).saturating_mul(n.into())) - // Standard Error: 2 - .saturating_add(Weight::from_parts(45, 0).saturating_mul(o.into())) + // Minimum execution time: 9_046_000 picoseconds. + Weight::from_parts(8_839_401, 249) + // Standard Error: 1 + .saturating_add(Weight::from_parts(256, 0).saturating_mul(n.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(46, 0).saturating_mul(o.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(o.into())) @@ -730,10 +734,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_178_000 picoseconds. - Weight::from_parts(7_943_459, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(105, 0).saturating_mul(n.into())) + // Minimum execution time: 7_275_000 picoseconds. + Weight::from_parts(7_975_993, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.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(n.into())) @@ -745,10 +749,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_779_000 picoseconds. - Weight::from_parts(7_613_139, 248) - // Standard Error: 1 - .saturating_add(Weight::from_parts(613, 0).saturating_mul(n.into())) + // Minimum execution time: 6_917_000 picoseconds. + Weight::from_parts(7_742_973, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(598, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -759,10 +763,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_337_000 picoseconds. - Weight::from_parts(7_021_294, 248) + // Minimum execution time: 6_214_000 picoseconds. + Weight::from_parts(6_994_418, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(82, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(76, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -773,10 +777,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_636_000 picoseconds. - Weight::from_parts(8_561_886, 248) + // Minimum execution time: 7_587_000 picoseconds. + Weight::from_parts(8_575_913, 248) // Standard Error: 2 - .saturating_add(Weight::from_parts(634, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(609, 0).saturating_mul(n.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(n.into())) @@ -785,22 +789,50 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_164_000 picoseconds. - Weight::from_parts(1_267_000, 0) + // Minimum execution time: 1_571_000 picoseconds. + Weight::from_parts(1_726_000, 0) } fn seal_set_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_506_000 picoseconds. - Weight::from_parts(10_796_000, 0) + // Minimum execution time: 11_305_000 picoseconds. + Weight::from_parts(11_613_000, 0) + } + fn seal_clear_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_127_000 picoseconds. + Weight::from_parts(8_395_000, 0) + } + fn seal_get_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_334_000 picoseconds. + Weight::from_parts(6_630_000, 0) + } + fn seal_contains_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_240_000 picoseconds. + Weight::from_parts(5_137_000, 0) + } + fn seal_take_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 9_862_000 picoseconds. + Weight::from_parts(10_178_000, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_709_000 picoseconds. - Weight::from_parts(9_168_000, 0) + // Minimum execution time: 8_753_000 picoseconds. + Weight::from_parts(8_991_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -816,12 +848,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 124_463_000 picoseconds. - Weight::from_parts(119_363_069, 4085) - // Standard Error: 180_701 - .saturating_add(Weight::from_parts(43_298_326, 0).saturating_mul(t.into())) + // Minimum execution time: 124_989_000 picoseconds. + Weight::from_parts(120_757_179, 4085) + // Standard Error: 180_229 + .saturating_add(Weight::from_parts(44_556_927, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(9, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(8, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -836,8 +868,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 113_457_000 picoseconds. - Weight::from_parts(116_903_000, 3895) + // Minimum execution time: 113_376_000 picoseconds. + Weight::from_parts(116_035_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -856,10 +888,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4127` - // Minimum execution time: 1_868_451_000 picoseconds. - Weight::from_parts(1_877_577_000, 4127) + // Minimum execution time: 1_866_665_000 picoseconds. + Weight::from_parts(1_878_158_000, 4127) // Standard Error: 24 - .saturating_add(Weight::from_parts(609, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(578, 0).saturating_mul(i.into())) // Standard Error: 24 .saturating_add(Weight::from_parts(939, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) @@ -870,64 +902,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 918_000 picoseconds. - Weight::from_parts(8_054_119, 0) + // Minimum execution time: 974_000 picoseconds. + Weight::from_parts(8_785_655, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_325, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_333, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_349_000 picoseconds. - Weight::from_parts(9_767_297, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(3_594, 0).saturating_mul(n.into())) + // Minimum execution time: 1_380_000 picoseconds. + Weight::from_parts(10_136_026, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_591, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 754_000 picoseconds. - Weight::from_parts(8_291_218, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_461, 0).saturating_mul(n.into())) + // Minimum execution time: 737_000 picoseconds. + Weight::from_parts(4_053_205, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_473, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 752_000 picoseconds. - Weight::from_parts(9_485_775, 0) + // Minimum execution time: 818_000 picoseconds. + Weight::from_parts(9_871_804, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_458, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_395_000 picoseconds. - Weight::from_parts(42_956_300, 0) + // Minimum execution time: 42_928_000 picoseconds. + Weight::from_parts(41_138_853, 0) // Standard Error: 8 - .saturating_add(Weight::from_parts(5_081, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(5_217, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_711_000 picoseconds. - Weight::from_parts(49_271_000, 0) + // Minimum execution time: 47_156_000 picoseconds. + Weight::from_parts(48_476_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_070_000 picoseconds. - Weight::from_parts(13_205_000, 0) + // Minimum execution time: 13_064_000 picoseconds. + Weight::from_parts(13_174_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -937,8 +969,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_853_000 picoseconds. - Weight::from_parts(18_208_000, 3895) + // Minimum execution time: 17_611_000 picoseconds. + Weight::from_parts(18_338_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -948,8 +980,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_043_000 picoseconds. - Weight::from_parts(8_615_000, 3820) + // Minimum execution time: 8_308_000 picoseconds. + Weight::from_parts(8_622_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -959,8 +991,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_302_000 picoseconds. - Weight::from_parts(7_611_000, 3558) + // Minimum execution time: 7_377_000 picoseconds. + Weight::from_parts(7_675_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -968,15 +1000,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 331_000 picoseconds. - Weight::from_parts(366_000, 0) + // Minimum execution time: 348_000 picoseconds. + Weight::from_parts(390_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 384_000 picoseconds. - Weight::from_parts(430_000, 0) + // Minimum execution time: 357_000 picoseconds. + Weight::from_parts(398_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -984,8 +1016,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_806_000 picoseconds. - Weight::from_parts(2_918_000, 1704) + // Minimum execution time: 2_678_000 picoseconds. + Weight::from_parts(2_903_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -993,10 +1025,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 604_000 picoseconds. - Weight::from_parts(535_737, 0) - // Standard Error: 17 - .saturating_add(Weight::from_parts(7_199, 0).saturating_mul(r.into())) + // Minimum execution time: 752_000 picoseconds. + Weight::from_parts(721_329, 0) + // Standard Error: 16 + .saturating_add(Weight::from_parts(6_979, 0).saturating_mul(r.into())) } } @@ -1008,8 +1040,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_932_000 picoseconds. - Weight::from_parts(2_029_000, 1627) + // Minimum execution time: 1_895_000 picoseconds. + Weight::from_parts(1_975_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1019,10 +1051,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_121_000 picoseconds. - Weight::from_parts(11_232_000, 442) - // Standard Error: 1_671 - .saturating_add(Weight::from_parts(1_247_413, 0).saturating_mul(k.into())) + // Minimum execution time: 11_200_000 picoseconds. + Weight::from_parts(11_437_000, 442) + // Standard Error: 2_036 + .saturating_add(Weight::from_parts(1_204_457, 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)) @@ -1036,10 +1068,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_611_000 picoseconds. - Weight::from_parts(4_556_039, 6149) + // Minimum execution time: 7_681_000 picoseconds. + Weight::from_parts(4_863_511, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_627, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1052,8 +1084,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 15_687_000 picoseconds. - Weight::from_parts(16_830_000, 6450) + // Minimum execution time: 16_550_000 picoseconds. + Weight::from_parts(16_962_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1066,10 +1098,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_058_000 picoseconds. - Weight::from_parts(3_099_000, 3635) - // Standard Error: 627 - .saturating_add(Weight::from_parts(1_090_078, 0).saturating_mul(k.into())) + // Minimum execution time: 3_124_000 picoseconds. + Weight::from_parts(3_152_000, 3635) + // Standard Error: 534 + .saturating_add(Weight::from_parts(1_098_366, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1088,10 +1120,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_114_000 picoseconds. - Weight::from_parts(15_675_115, 6263) - // Standard Error: 1 - .saturating_add(Weight::from_parts(409, 0).saturating_mul(c.into())) + // Minimum execution time: 15_059_000 picoseconds. + Weight::from_parts(15_526_712, 6263) + // Standard Error: 2 + .saturating_add(Weight::from_parts(427, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1102,8 +1134,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 11_902_000 picoseconds. - Weight::from_parts(12_535_000, 6380) + // Minimum execution time: 12_246_000 picoseconds. + Weight::from_parts(12_747_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1117,8 +1149,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 46_473_000 picoseconds. - Weight::from_parts(47_362_000, 6292) + // Minimum execution time: 48_149_000 picoseconds. + Weight::from_parts(48_939_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1130,8 +1162,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 51_917_000 picoseconds. - Weight::from_parts(53_767_000, 6534) + // Minimum execution time: 52_500_000 picoseconds. + Weight::from_parts(54_238_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1141,8 +1173,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_394_000 picoseconds. - Weight::from_parts(11_917_000, 6349) + // Minimum execution time: 11_882_000 picoseconds. + Weight::from_parts(12_381_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1152,7 +1184,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_108_000 picoseconds. + // Minimum execution time: 2_081_000 picoseconds. Weight::from_parts(2_202_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1165,8 +1197,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_878_000 picoseconds. - Weight::from_parts(11_267_000, 3631) + // Minimum execution time: 10_758_000 picoseconds. + Weight::from_parts(11_201_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1176,8 +1208,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_452_000 picoseconds. - Weight::from_parts(4_694_000, 3607) + // Minimum execution time: 4_409_000 picoseconds. + Weight::from_parts(4_594_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1188,8 +1220,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_614_000 picoseconds. - Weight::from_parts(5_872_000, 3632) + // Minimum execution time: 5_436_000 picoseconds. + Weight::from_parts(5_812_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1200,8 +1232,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_521_000 picoseconds. - Weight::from_parts(5_736_000, 3607) + // Minimum execution time: 5_280_000 picoseconds. + Weight::from_parts(5_646_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1222,10 +1254,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 253_608_000 picoseconds. - Weight::from_parts(256_352_977, 4264) - // Standard Error: 11 - .saturating_add(Weight::from_parts(1_162, 0).saturating_mul(c.into())) + // Minimum execution time: 254_639_000 picoseconds. + Weight::from_parts(267_931_959, 4264) + // Standard Error: 5 + .saturating_add(Weight::from_parts(770, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1253,14 +1285,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_700_467_000 picoseconds. - Weight::from_parts(381_233_736, 6262) - // Standard Error: 274 - .saturating_add(Weight::from_parts(53_487, 0).saturating_mul(c.into())) - // Standard Error: 32 - .saturating_add(Weight::from_parts(2_308, 0).saturating_mul(i.into())) - // Standard Error: 32 - .saturating_add(Weight::from_parts(2_302, 0).saturating_mul(s.into())) + // Minimum execution time: 4_497_077_000 picoseconds. + Weight::from_parts(38_610_814, 6262) + // Standard Error: 167 + .saturating_add(Weight::from_parts(54_092, 0).saturating_mul(c.into())) + // Standard Error: 20 + .saturating_add(Weight::from_parts(2_300, 0).saturating_mul(i.into())) + // Standard Error: 20 + .saturating_add(Weight::from_parts(2_297, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1286,12 +1318,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_246_963_000 picoseconds. - Weight::from_parts(2_279_753_000, 4029) - // Standard Error: 36 - .saturating_add(Weight::from_parts(1_102, 0).saturating_mul(i.into())) - // Standard Error: 36 - .saturating_add(Weight::from_parts(1_008, 0).saturating_mul(s.into())) + // Minimum execution time: 2_227_347_000 picoseconds. + Weight::from_parts(2_263_930_000, 4029) + // Standard Error: 34 + .saturating_add(Weight::from_parts(1_001, 0).saturating_mul(i.into())) + // Standard Error: 34 + .saturating_add(Weight::from_parts(920, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1311,8 +1343,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 165_076_000 picoseconds. - Weight::from_parts(168_771_000, 4291) + // Minimum execution time: 166_907_000 picoseconds. + Weight::from_parts(171_544_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1329,10 +1361,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 224_244_000 picoseconds. - Weight::from_parts(244_252_040, 3607) - // Standard Error: 86 - .saturating_add(Weight::from_parts(51_723, 0).saturating_mul(c.into())) + // Minimum execution time: 231_632_000 picoseconds. + Weight::from_parts(247_875_779, 3607) + // Standard Error: 60 + .saturating_add(Weight::from_parts(51_391, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1349,10 +1381,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 232_514_000 picoseconds. - Weight::from_parts(247_372_222, 3607) - // Standard Error: 77 - .saturating_add(Weight::from_parts(51_890, 0).saturating_mul(c.into())) + // Minimum execution time: 240_526_000 picoseconds. + Weight::from_parts(259_679_899, 3607) + // Standard Error: 59 + .saturating_add(Weight::from_parts(51_451, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1368,8 +1400,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 38_546_000 picoseconds. - Weight::from_parts(40_182_000, 3780) + // Minimum execution time: 38_890_000 picoseconds. + Weight::from_parts(39_983_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1383,8 +1415,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 24_632_000 picoseconds. - Weight::from_parts(25_274_000, 6492) + // Minimum execution time: 25_587_000 picoseconds. + Weight::from_parts(26_259_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1393,17 +1425,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_360_000 picoseconds. - Weight::from_parts(9_265_377, 0) - // Standard Error: 73 - .saturating_add(Weight::from_parts(51_488, 0).saturating_mul(r.into())) + // Minimum execution time: 8_388_000 picoseconds. + Weight::from_parts(9_788_693, 0) + // Standard Error: 83 + .saturating_add(Weight::from_parts(51_386, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 576_000 picoseconds. - Weight::from_parts(633_000, 0) + // Minimum execution time: 666_000 picoseconds. + Weight::from_parts(699_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1411,8 +1443,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_172_000 picoseconds. - Weight::from_parts(6_400_000, 3819) + // Minimum execution time: 6_128_000 picoseconds. + Weight::from_parts(6_404_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1421,79 +1453,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_271_000 picoseconds. - Weight::from_parts(7_471_000, 3912) + // Minimum execution time: 7_296_000 picoseconds. + Weight::from_parts(7_630_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 784_000 picoseconds. - Weight::from_parts(858_000, 0) + // Minimum execution time: 715_000 picoseconds. + Weight::from_parts(776_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 400_000 picoseconds. - Weight::from_parts(442_000, 0) + // Minimum execution time: 372_000 picoseconds. + Weight::from_parts(404_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 356_000 picoseconds. - Weight::from_parts(386_000, 0) + // Minimum execution time: 296_000 picoseconds. + Weight::from_parts(351_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 600_000 picoseconds. - Weight::from_parts(646_000, 0) + // Minimum execution time: 562_000 picoseconds. + Weight::from_parts(620_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 691_000 picoseconds. - Weight::from_parts(715_000, 0) + // Minimum execution time: 663_000 picoseconds. + Weight::from_parts(718_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_321_000 picoseconds. - Weight::from_parts(4_570_000, 0) + // Minimum execution time: 4_483_000 picoseconds. + Weight::from_parts(4_724_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 570_000 picoseconds. - Weight::from_parts(616_000, 0) + // Minimum execution time: 551_000 picoseconds. + Weight::from_parts(634_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 559_000 picoseconds. - Weight::from_parts(607_000, 0) + // Minimum execution time: 507_000 picoseconds. + Weight::from_parts(587_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 514_000 picoseconds. - Weight::from_parts(598_000, 0) + // Minimum execution time: 556_000 picoseconds. + Weight::from_parts(611_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 605_000 picoseconds. - Weight::from_parts(633_000, 0) + // Minimum execution time: 538_000 picoseconds. + Weight::from_parts(622_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1501,8 +1533,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_183_000 picoseconds. - Weight::from_parts(4_412_000, 1552) + // Minimum execution time: 4_101_000 picoseconds. + Weight::from_parts(4_294_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1510,8 +1542,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 528_000 picoseconds. - Weight::from_parts(569_000, 0) + // Minimum execution time: 502_000 picoseconds. + Weight::from_parts(530_000, 0) // Standard Error: 3 .saturating_add(Weight::from_parts(300, 0).saturating_mul(n.into())) } @@ -1520,10 +1552,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 365_000 picoseconds. - Weight::from_parts(382_000, 0) + // Minimum execution time: 380_000 picoseconds. + Weight::from_parts(432_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(407, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1536,10 +1568,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_140_000 picoseconds. - Weight::from_parts(15_258_455, 3784) - // Standard Error: 7_507 - .saturating_add(Weight::from_parts(3_475_009, 0).saturating_mul(n.into())) + // Minimum execution time: 13_653_000 picoseconds. + Weight::from_parts(15_911_187, 3784) + // Standard Error: 7_779 + .saturating_add(Weight::from_parts(3_469_493, 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(3_u64)) @@ -1552,8 +1584,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_407_000 picoseconds. - Weight::from_parts(3_565_000, 1561) + // Minimum execution time: 3_337_000 picoseconds. + Weight::from_parts(3_504_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1564,12 +1596,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_534_000 picoseconds. - Weight::from_parts(3_793_333, 990) - // Standard Error: 5_106 - .saturating_add(Weight::from_parts(2_033_824, 0).saturating_mul(t.into())) + // Minimum execution time: 3_629_000 picoseconds. + Weight::from_parts(3_860_500, 990) + // Standard Error: 5_057 + .saturating_add(Weight::from_parts(2_062_375, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(14, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(17, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1579,10 +1611,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 409_000 picoseconds. - Weight::from_parts(441_000, 0) + // Minimum execution time: 404_000 picoseconds. + Weight::from_parts(449_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_207, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_206, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1592,12 +1624,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_015_000 picoseconds. - Weight::from_parts(8_746_170, 249) - // Standard Error: 2 - .saturating_add(Weight::from_parts(277, 0).saturating_mul(n.into())) - // Standard Error: 2 - .saturating_add(Weight::from_parts(45, 0).saturating_mul(o.into())) + // Minimum execution time: 9_046_000 picoseconds. + Weight::from_parts(8_839_401, 249) + // Standard Error: 1 + .saturating_add(Weight::from_parts(256, 0).saturating_mul(n.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(46, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1609,10 +1641,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_178_000 picoseconds. - Weight::from_parts(7_943_459, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(105, 0).saturating_mul(n.into())) + // Minimum execution time: 7_275_000 picoseconds. + Weight::from_parts(7_975_993, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1624,10 +1656,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_779_000 picoseconds. - Weight::from_parts(7_613_139, 248) - // Standard Error: 1 - .saturating_add(Weight::from_parts(613, 0).saturating_mul(n.into())) + // Minimum execution time: 6_917_000 picoseconds. + Weight::from_parts(7_742_973, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(598, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1638,10 +1670,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_337_000 picoseconds. - Weight::from_parts(7_021_294, 248) + // Minimum execution time: 6_214_000 picoseconds. + Weight::from_parts(6_994_418, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(82, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(76, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1652,10 +1684,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_636_000 picoseconds. - Weight::from_parts(8_561_886, 248) + // Minimum execution time: 7_587_000 picoseconds. + Weight::from_parts(8_575_913, 248) // Standard Error: 2 - .saturating_add(Weight::from_parts(634, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(609, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1664,22 +1696,50 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_164_000 picoseconds. - Weight::from_parts(1_267_000, 0) + // Minimum execution time: 1_571_000 picoseconds. + Weight::from_parts(1_726_000, 0) } fn seal_set_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_506_000 picoseconds. - Weight::from_parts(10_796_000, 0) + // Minimum execution time: 11_305_000 picoseconds. + Weight::from_parts(11_613_000, 0) + } + fn seal_clear_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_127_000 picoseconds. + Weight::from_parts(8_395_000, 0) + } + fn seal_get_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_334_000 picoseconds. + Weight::from_parts(6_630_000, 0) + } + fn seal_contains_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_240_000 picoseconds. + Weight::from_parts(5_137_000, 0) + } + fn seal_take_transient_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 9_862_000 picoseconds. + Weight::from_parts(10_178_000, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_709_000 picoseconds. - Weight::from_parts(9_168_000, 0) + // Minimum execution time: 8_753_000 picoseconds. + Weight::from_parts(8_991_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1695,12 +1755,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 124_463_000 picoseconds. - Weight::from_parts(119_363_069, 4085) - // Standard Error: 180_701 - .saturating_add(Weight::from_parts(43_298_326, 0).saturating_mul(t.into())) + // Minimum execution time: 124_989_000 picoseconds. + Weight::from_parts(120_757_179, 4085) + // Standard Error: 180_229 + .saturating_add(Weight::from_parts(44_556_927, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(9, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(8, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1715,8 +1775,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 113_457_000 picoseconds. - Weight::from_parts(116_903_000, 3895) + // Minimum execution time: 113_376_000 picoseconds. + Weight::from_parts(116_035_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1735,10 +1795,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4127` - // Minimum execution time: 1_868_451_000 picoseconds. - Weight::from_parts(1_877_577_000, 4127) + // Minimum execution time: 1_866_665_000 picoseconds. + Weight::from_parts(1_878_158_000, 4127) // Standard Error: 24 - .saturating_add(Weight::from_parts(609, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(578, 0).saturating_mul(i.into())) // Standard Error: 24 .saturating_add(Weight::from_parts(939, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) @@ -1749,64 +1809,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 918_000 picoseconds. - Weight::from_parts(8_054_119, 0) + // Minimum execution time: 974_000 picoseconds. + Weight::from_parts(8_785_655, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_325, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_333, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_349_000 picoseconds. - Weight::from_parts(9_767_297, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(3_594, 0).saturating_mul(n.into())) + // Minimum execution time: 1_380_000 picoseconds. + Weight::from_parts(10_136_026, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_591, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 754_000 picoseconds. - Weight::from_parts(8_291_218, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_461, 0).saturating_mul(n.into())) + // Minimum execution time: 737_000 picoseconds. + Weight::from_parts(4_053_205, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_473, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 752_000 picoseconds. - Weight::from_parts(9_485_775, 0) + // Minimum execution time: 818_000 picoseconds. + Weight::from_parts(9_871_804, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_458, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_395_000 picoseconds. - Weight::from_parts(42_956_300, 0) + // Minimum execution time: 42_928_000 picoseconds. + Weight::from_parts(41_138_853, 0) // Standard Error: 8 - .saturating_add(Weight::from_parts(5_081, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(5_217, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_711_000 picoseconds. - Weight::from_parts(49_271_000, 0) + // Minimum execution time: 47_156_000 picoseconds. + Weight::from_parts(48_476_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_070_000 picoseconds. - Weight::from_parts(13_205_000, 0) + // Minimum execution time: 13_064_000 picoseconds. + Weight::from_parts(13_174_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1816,8 +1876,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_853_000 picoseconds. - Weight::from_parts(18_208_000, 3895) + // Minimum execution time: 17_611_000 picoseconds. + Weight::from_parts(18_338_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1827,8 +1887,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_043_000 picoseconds. - Weight::from_parts(8_615_000, 3820) + // Minimum execution time: 8_308_000 picoseconds. + Weight::from_parts(8_622_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1838,8 +1898,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_302_000 picoseconds. - Weight::from_parts(7_611_000, 3558) + // Minimum execution time: 7_377_000 picoseconds. + Weight::from_parts(7_675_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1847,15 +1907,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 331_000 picoseconds. - Weight::from_parts(366_000, 0) + // Minimum execution time: 348_000 picoseconds. + Weight::from_parts(390_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 384_000 picoseconds. - Weight::from_parts(430_000, 0) + // Minimum execution time: 357_000 picoseconds. + Weight::from_parts(398_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1863,8 +1923,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_806_000 picoseconds. - Weight::from_parts(2_918_000, 1704) + // Minimum execution time: 2_678_000 picoseconds. + Weight::from_parts(2_903_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1872,9 +1932,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 604_000 picoseconds. - Weight::from_parts(535_737, 0) - // Standard Error: 17 - .saturating_add(Weight::from_parts(7_199, 0).saturating_mul(r.into())) + // Minimum execution time: 752_000 picoseconds. + Weight::from_parts(721_329, 0) + // Standard Error: 16 + .saturating_add(Weight::from_parts(6_979, 0).saturating_mul(r.into())) } } From 339e935cfbaabee41abb5e2ba8d47fc84840d4c8 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 26 Jun 2024 20:35:31 +0200 Subject: [PATCH 24/58] Refactor benchmarks --- .../src/benchmarking/call_builder.rs | 13 +- .../frame/contracts/src/benchmarking/mod.rs | 34 +---- substrate/frame/contracts/src/exec.rs | 127 +++++++++++++++- .../frame/contracts/src/transient_storage.rs | 136 +++++++----------- substrate/frame/contracts/src/wasm/mod.rs | 5 - substrate/frame/contracts/src/wasm/runtime.rs | 89 +++++++----- 6 files changed, 249 insertions(+), 155 deletions(-) diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index fee09166933f..dd62ba70ff35 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -17,7 +17,7 @@ use crate::{ benchmarking::{Contract, WasmModule}, - exec::Stack, + exec::{Ext, Key, Stack}, storage::meter::Meter, wasm::Runtime, BalanceOf, Config, DebugBufferVec, Determinism, ExecReturnValue, GasMeter, Origin, Schedule, @@ -160,6 +160,17 @@ where ) } + /// Add transient_storage + pub fn with_transient_storage(ext: &mut StackExt) { + for i in 0u32.. { + let key = Key::::try_from_var(i.to_le_bytes().to_vec()).unwrap(); + if ext.set_transient_storage(&key, Some(Vec::new()), false).is_err() { + ext.transient_storage().meter().clear(); + break; + } + } + } + /// Prepare a call to the module. pub fn prepare_call<'a>( ext: &'a mut StackExt<'a, T>, diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index cc4bf4718f48..72a5f8fe8935 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -22,7 +22,7 @@ mod call_builder; mod code; mod sandbox; use self::{ - call_builder::{CallSetup, StackExt}, + call_builder::CallSetup, code::{body, ImportedMemory, Location, ModuleDefinition, WasmModule}, sandbox::Sandbox, }; @@ -184,24 +184,6 @@ fn caller_funding() -> BalanceOf { BalanceOf::::max_value() / 10_000u32.into() } -fn dummy_transient_storage( - ext: &mut StackExt, - stor_size: u32, -) -> Result<(), BenchmarkError> { - for i in 0u32.. { - let key = - Key::::try_from_var(i.to_le_bytes().to_vec()).map_err(|_| "Key has wrong length")?; - if ext - .set_transient_storage(&key, Some(vec![42u8; stor_size as usize]), false) - .is_err() - { - ext.transient_storage().meter().clear(); - break; - } - } - Ok(()) -} - #[benchmarks( where as codec::HasCompact>::Type: Clone + Eq + PartialEq + sp_std::fmt::Debug + scale_info::TypeInfo + codec::Encode, @@ -1190,8 +1172,8 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); + CallSetup::::with_transient_storage(&mut ext); let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); - dummy_transient_storage::(runtime.ext(), 1)?; runtime.ext().transient_storage().start_transaction(); runtime .ext() @@ -1214,8 +1196,7 @@ mod benchmarks { .map_err(|_| "Key has wrong length")?; let value = vec![1u8; max_value_len as usize]; build_runtime!(runtime, memory: [ key.to_vec(), value.clone(), ]); - - dummy_transient_storage::(runtime.ext(), 1)?; + CallSetup::::with_transient_storage(runtime.ext()); runtime .ext() .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) @@ -1246,8 +1227,7 @@ mod benchmarks { let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), ]); - - dummy_transient_storage::(runtime.ext(), 1)?; + CallSetup::::with_transient_storage(runtime.ext()); runtime .ext() .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) @@ -1272,7 +1252,7 @@ mod benchmarks { let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); - dummy_transient_storage::(runtime.ext(), 1)?; + CallSetup::::with_transient_storage(runtime.ext()); runtime .ext() .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) @@ -1307,7 +1287,7 @@ mod benchmarks { let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), ]); - dummy_transient_storage::(runtime.ext(), 1)?; + CallSetup::::with_transient_storage(runtime.ext()); runtime .ext() .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) @@ -1335,7 +1315,7 @@ mod benchmarks { let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); - dummy_transient_storage::(runtime.ext(), 1)?; + CallSetup::::with_transient_storage(runtime.ext()); let value = vec![42u8; max_value_len as usize]; runtime .ext() diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index ba5200c638b4..8ae708b9cba5 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -332,7 +332,7 @@ pub trait Ext: sealing::Sealed { /// Get a mutable reference to the transient storage. /// Useful in tests when it is sometimes necessary to modify and inspect the transient storage /// directly. - #[cfg(any(test, feature = "runtime-benchmarks"))] + #[cfg(feature = "runtime-benchmarks")] fn transient_storage(&mut self) -> &mut TransientStorage; /// Sets new code hash for existing contract. @@ -1381,7 +1381,6 @@ where .charge_deposit(account_id.clone(), StorageDeposit::Refund(*deposit)); } - self.transient_storage.remove(&account_id); Contracts::::deposit_event(Event::Terminated { contract: account_id, beneficiary: beneficiary.clone(), @@ -1578,7 +1577,7 @@ where self.top_frame_mut().contract_info() } - #[cfg(any(test, feature = "runtime-benchmarks"))] + #[cfg(feature = "runtime-benchmarks")] fn transient_storage(&mut self) -> &mut TransientStorage { &mut self.transient_storage } @@ -3892,7 +3891,84 @@ mod tests { } #[test] - fn transient_storage_works() { + fn set_transient_storage_works() { + let code_hash = MockLoader::insert(Call, |ctx, _| { + // Write + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([1; 32]), Some(vec![1, 2, 3]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([2; 32]), Some(vec![4, 5, 6]), true), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([3; 32]), None, false), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([4; 32]), None, true), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([5; 32]), Some(vec![]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([6; 32]), Some(vec![]), true), + Ok(WriteOutcome::New) + ); + + // Overwrite + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([1; 32]), Some(vec![42]), false), + Ok(WriteOutcome::Overwritten(3)) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([2; 32]), Some(vec![48]), true), + Ok(WriteOutcome::Taken(vec![4, 5, 6])) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([3; 32]), None, false), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([4; 32]), None, true), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([5; 32]), Some(vec![]), false), + Ok(WriteOutcome::Overwritten(0)) + ); + assert_eq!( + ctx.ext.set_transient_storage(&Key::Fix([6; 32]), Some(vec![]), true), + Ok(WriteOutcome::Taken(vec![])) + ); + + exec_success() + }); + + ExtBuilder::default().build().execute_with(|| { + let schedule = ::Schedule::get(); + place_contract(&BOB, code_hash); + let contract_origin = Origin::from_account_id(ALICE); + let mut storage_meter = storage::meter::Meter::new(&contract_origin, None, 0).unwrap(); + assert_ok!(MockStack::run_call( + contract_origin, + BOB, + &mut GasMeter::::new(GAS_LIMIT), + &mut storage_meter, + &schedule, + 0, + vec![], + None, + Determinism::Enforced + )); + }); + } + + #[test] + fn get_transient_storage_works() { // Call stack: BOB -> CHARLIE(success) -> BOB' (success) let storage_key_1 = &Key::Fix([1; 32]); let storage_key_2 = &Key::Fix([2; 32]); @@ -3963,7 +4039,48 @@ mod tests { } #[test] - fn transient_storage_rollback_works() { + fn get_transient_storage_size_works() { + let storage_key_1 = &Key::Fix([1; 32]); + let storage_key_2 = &Key::Fix([2; 32]); + let storage_key_3 = &Key::Fix([3; 32]); + let code_hash = MockLoader::insert(Call, |ctx, _| { + assert_eq!( + ctx.ext.set_transient_storage(storage_key_1, Some(vec![1, 2, 3]), false), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_transient_storage(storage_key_2, Some(vec![]), false), + Ok(WriteOutcome::New) + ); + assert_eq!(ctx.ext.get_transient_storage_size(storage_key_1), Some(3)); + assert_eq!(ctx.ext.get_transient_storage_size(storage_key_2), Some(0)); + assert_eq!(ctx.ext.get_transient_storage_size(storage_key_3), None); + + exec_success() + }); + + ExtBuilder::default().build().execute_with(|| { + let schedule = ::Schedule::get(); + place_contract(&BOB, code_hash); + let contract_origin = Origin::from_account_id(ALICE); + let mut storage_meter = + storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); + assert_ok!(MockStack::run_call( + contract_origin, + BOB, + &mut GasMeter::::new(GAS_LIMIT), + &mut storage_meter, + &schedule, + 0, + vec![], + None, + Determinism::Enforced + )); + }); + } + + #[test] + fn rollback_transient_storage_works() { // Call stack: BOB -> CHARLIE (trap) -> BOB' (success) let storage_key = &Key::Fix([1; 32]); let code_bob = MockLoader::insert(Call, |ctx, _| { diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index d95c2f7a5c2b..dafbd9a6fba3 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -26,12 +26,7 @@ use codec::Encode; use core::marker::PhantomData; use frame_support::DefaultNoBound; use sp_runtime::{DispatchError, DispatchResult}; -use sp_std::{ - collections::btree_map::BTreeMap, - mem, - ops::Bound::{Included, Unbounded}, - vec::Vec, -}; +use sp_std::{collections::btree_map::BTreeMap, mem, vec::Vec}; /// Meter entry tracks transaction allocations. #[derive(Default, Debug)] @@ -109,9 +104,10 @@ impl StorageMeter { /// Start a transaction meter. pub fn start(&mut self) { let meter = self.top_meter(); - let free = meter.limit - meter.amount; + let free = meter.limit.saturating_sub(meter.amount); let transaction_limit = if !self.nested_meters.is_empty() { - // Allow use of (1 - 1/cost_value) of free storage for subsequent calls. + // Allow use of (1 - 1/STORAGE_FRACTION_DENOMINATOR) of free storage for subsequent + // calls. free.saturating_sub(free.saturating_div(Self::STORAGE_FRACTION_DENOMINATOR)) } else { free @@ -207,14 +203,6 @@ impl Storage { } } - /// Get the storage keys for the account. - pub fn keys<'a>(&'a self, account: &'a [u8]) -> impl Iterator> + 'a { - self.0 - .range((Included(account.to_vec()), Unbounded)) - .take_while(|(key, _)| key.starts_with(account)) - .map(|(key, _)| key[account.len()..].to_vec()) - } - fn storage_key(account: &[u8], key: &[u8]) -> Vec { let mut storage_key = Vec::with_capacity(account.len() + key.len()); storage_key.extend_from_slice(&account); @@ -232,7 +220,7 @@ impl Storage { /// On `rollback_transaction`, all entries are reverted up to the last checkpoint. pub struct TransientStorage { // The storage and journal size is limited by the storage meter. - current: Storage, + storage: Storage, journal: Journal, // The size of the StorageMeter is limited by the stack depth. meter: StorageMeter, @@ -243,7 +231,7 @@ pub struct TransientStorage { impl TransientStorage { pub fn new(memory_limit: u32) -> Self { TransientStorage { - current: Default::default(), + storage: Default::default(), journal: Journal::new(), checkpoints: Default::default(), meter: StorageMeter::new(memory_limit), @@ -252,7 +240,7 @@ impl TransientStorage { /// Read the storage entry. pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option> { - self.current.read(&account.encode(), &key.hash()) + self.storage.read(&account.encode(), &key.hash()) } /// Write a value to storage. @@ -291,7 +279,7 @@ impl TransientStorage { } self.meter.charge(amount as _)?; } - self.current.write(&account, &key, value); + self.storage.write(&account, &key, value); // Update the journal. self.journal.push(JournalEntry::new(&account, &key, prev_value.clone())); } @@ -303,18 +291,6 @@ impl TransientStorage { }) } - /// Remove a contract, clearing all its storage entries. - pub fn remove(&mut self, account: &AccountIdOf) { - let account = account.encode(); - // Remove all account entries. - let keys = self.current.keys(&account).collect::>(); - for key in keys { - let prev_value = self.current.write(&account, &key, None); - // Update the journal. - self.journal.push(JournalEntry::new(&account, &key, prev_value)); - } - } - /// Start a new nested transaction. /// /// This allows to either commit or roll back all changes that are made after this call. @@ -338,7 +314,7 @@ impl TransientStorage { .pop() .expect("No open transient storage transaction that can be rolled back."); self.meter.revert(); - self.journal.rollback(&mut self.current, checkpoint); + self.journal.rollback(&mut self.storage, checkpoint); } /// Commit the last transaction started by `start_transaction`. @@ -377,7 +353,7 @@ mod tests { Ok(WriteOutcome::New) ); assert_eq!( - storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![2]), false), + storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![2]), true), Ok(WriteOutcome::New) ); assert_eq!( @@ -399,67 +375,63 @@ mod tests { assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), Some(vec![4, 5])); assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), Some(vec![6, 7])); + + assert_eq!( + storage.write(&BOB, &Key::Fix([3; 32]), Some(vec![]), true), + Ok(WriteOutcome::Taken(vec![6, 7])) + ); + assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), Some(vec![])); + + assert_eq!( + storage.write(&BOB, &Key::Fix([3; 32]), None, true), + Ok(WriteOutcome::Taken(vec![])) + ); + assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), None); } #[test] - fn remove_transaction_works() { - let mut storage = TransientStorage::::new(1024); + fn read_write_with_var_sized_keys_works() { + let mut storage = TransientStorage::::new(2048); assert_eq!( - storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), + storage.write( + &ALICE, + &Key::::try_from_var([1; 64].to_vec()).unwrap(), + Some(vec![1]), + false + ), Ok(WriteOutcome::New) ); assert_eq!( - storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![2]), false), + storage.write( + &BOB, + &Key::::try_from_var([2; 64].to_vec()).unwrap(), + Some(vec![2, 3]), + false + ), Ok(WriteOutcome::New) ); assert_eq!( - storage.write(&BOB, &Key::Fix([1; 32]), Some(vec![3]), false), - Ok(WriteOutcome::New) + storage.read(&ALICE, &Key::::try_from_var([1; 64].to_vec()).unwrap()), + Some(vec![1]) ); - storage.remove(&ALICE); - assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); - assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), None); - assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), Some(vec![3])); - } - - #[test] - fn commit_remove_transaction_works() { - let mut storage = TransientStorage::::new(1024); - storage.start_transaction(); assert_eq!( - storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), - Ok(WriteOutcome::New) + storage.read(&BOB, &Key::::try_from_var([2; 64].to_vec()).unwrap()), + Some(vec![2, 3]) ); - storage.remove(&ALICE); - storage.commit_transaction(); - assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); - - storage.start_transaction(); - storage.start_transaction(); + // Overwrite values. assert_eq!( - storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), - Ok(WriteOutcome::New) + storage.write( + &ALICE, + &Key::::try_from_var([1; 64].to_vec()).unwrap(), + Some(vec![4, 5]), + false + ), + Ok(WriteOutcome::Overwritten(1)) ); - storage.commit_transaction(); - storage.remove(&ALICE); - storage.commit_transaction(); - assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); - } - - #[test] - fn rollback_remove_transaction_works() { - let mut storage = TransientStorage::::new(1024); - storage.start_transaction(); assert_eq!( - storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), - Ok(WriteOutcome::New) + storage.read(&ALICE, &Key::::try_from_var([1; 64].to_vec()).unwrap()), + Some(vec![4, 5]) ); - storage.start_transaction(); - storage.remove(&ALICE); - assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); - storage.rollback_transaction(); - storage.commit_transaction(); - assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); } #[test] @@ -550,7 +522,7 @@ mod tests { } #[test] - fn commit_rollback_in_nested_transaction_works() { + fn rollback_all_transactions_works() { let mut storage = TransientStorage::::new(1024); storage.start_transaction(); assert_eq!( @@ -568,9 +540,9 @@ mod tests { Ok(WriteOutcome::New) ); storage.commit_transaction(); - storage.rollback_transaction(); storage.commit_transaction(); - assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), Some(vec![1])); + storage.rollback_transaction(); + assert_eq!(storage.read(&ALICE, &Key::Fix([1; 32])), None); assert_eq!(storage.read(&BOB, &Key::Fix([1; 32])), None); assert_eq!(storage.read(&CHARLIE, &Key::Fix([1; 32])), None); } @@ -578,7 +550,7 @@ mod tests { #[test] fn metering_transactions_works() { // 192 bytes is the allocation overhead, plus 32 bytes for the account and 32 bytes for the - // key. Call stack size is 2, so free storage is divided by 2 with each frame. + // key. The first transaction can use all the available storage. let mut storage = TransientStorage::::new((4096 + 256) * 2); storage.start_transaction(); assert_eq!( diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 16d12e8a5eba..b649f9853576 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -811,11 +811,6 @@ mod tests { fn contract_info(&mut self) -> &mut crate::ContractInfo { unimplemented!() } - fn transient_storage( - &mut self, - ) -> &mut crate::transient_storage::TransientStorage { - unimplemented!() - } fn ecdsa_to_eth_address(&self, _pk: &[u8; 33]) -> Result<[u8; 20], ()> { Ok([2u8; 20]) } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 9961e2336a36..ef1e6cb6a3e6 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -198,6 +198,16 @@ pub enum RuntimeCosts { GetStorage(u32), /// Weight of calling `seal_take_storage` for the given size. TakeStorage(u32), + /// Weight of calling `seal_set_transient_storage`. + SetTransientStorage, + /// Weight of calling `seal_clear_transient_storage` per cleared byte. + ClearTransientStorage, + /// Weight of calling `seal_contains_transient_storage` per byte of the checked item. + ContainsTransientStorage, + /// Weight of calling `seal_get_transient_storage` with the specified size in storage. + GetTransientStorage, + /// Weight of calling `seal_take_transient_storage` for the given size. + TakeTransientStorage, /// Weight of calling `seal_transfer`. Transfer, /// Base weight of calling `seal_call`. @@ -244,6 +254,13 @@ pub enum RuntimeCosts { UnlockDelegateDependency, } +macro_rules! cost_rollback { + // cost_rollback!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::journal_rollback()) + ($name:ident $(, $arg:expr )*) => { + (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::rollback_journal())) + }; +} + macro_rules! cost_args { // cost_args!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_sub(T::WeightInfo::name(0, 0, 0)) ($name:ident, $( $arg: expr ),+) => { @@ -295,6 +312,11 @@ impl Token for RuntimeCosts { ContainsStorage(len) => T::WeightInfo::seal_contains_storage(len), GetStorage(len) => T::WeightInfo::seal_get_storage(len), TakeStorage(len) => T::WeightInfo::seal_take_storage(len), + SetTransientStorage => cost_rollback!(seal_set_transient_storage), + ClearTransientStorage => cost_rollback!(seal_clear_transient_storage), + ContainsTransientStorage => T::WeightInfo::seal_contains_transient_storage(), + GetTransientStorage => T::WeightInfo::seal_get_transient_storage(), + TakeTransientStorage => cost_rollback!(seal_take_transient_storage), Transfer => T::WeightInfo::seal_transfer(), CallBase => T::WeightInfo::seal_call(0, 0), DelegateCallBase => T::WeightInfo::seal_delegate_call(), @@ -795,7 +817,6 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { Ok(outcome.unwrap_or(SENTINEL)) } - // TODO: Implement weights fn set_transient_storage( &mut self, memory: &[u8], @@ -805,19 +826,13 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { value_len: u32, ) -> Result { let max_size = self.ext.max_value_size(); - let charged = self - .charge_gas(RuntimeCosts::SetStorage { new_bytes: value_len, old_bytes: max_size })?; + self.charge_gas(RuntimeCosts::SetTransientStorage)?; if value_len > max_size { return Err(Error::::ValueTooLarge.into()) } let key = self.decode_key(memory, key_type, key_ptr)?; let value = Some(self.read_sandbox_memory(memory, value_ptr, value_len)?); let write_outcome = self.ext.set_transient_storage(&key, value, false)?; - - self.adjust_gas( - charged, - RuntimeCosts::SetStorage { new_bytes: value_len, old_bytes: write_outcome.old_len() }, - ); Ok(write_outcome.old_len_with_sentinel()) } @@ -827,11 +842,9 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { key_type: KeyType, key_ptr: u32, ) -> Result { - let charged = self.charge_gas(RuntimeCosts::ClearStorage(self.ext.max_value_size()))?; + self.charge_gas(RuntimeCosts::ClearTransientStorage)?; let key = self.decode_key(memory, key_type, key_ptr)?; let outcome = self.ext.set_transient_storage(&key, None, false)?; - - self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.old_len())); Ok(outcome.old_len_with_sentinel()) } @@ -843,12 +856,11 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { out_ptr: u32, out_len_ptr: u32, ) -> Result { - let charged = self.charge_gas(RuntimeCosts::GetStorage(self.ext.max_value_size()))?; + self.charge_gas(RuntimeCosts::GetTransientStorage)?; let key = self.decode_key(memory, key_type, key_ptr)?; let outcome = self.ext.get_transient_storage(&key); if let Some(value) = outcome { - self.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); self.write_sandbox_output( memory, out_ptr, @@ -859,7 +871,6 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { )?; Ok(ReturnErrorCode::Success) } else { - self.adjust_gas(charged, RuntimeCosts::GetStorage(0)); Ok(ReturnErrorCode::KeyNotFound) } } @@ -870,14 +881,39 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { key_type: KeyType, key_ptr: u32, ) -> Result { - let charged = self.charge_gas(RuntimeCosts::ContainsStorage(self.ext.max_value_size()))?; + self.charge_gas(RuntimeCosts::ContainsTransientStorage)?; let key = self.decode_key(memory, key_type, key_ptr)?; let outcome = self.ext.get_transient_storage_size(&key); - - self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.unwrap_or(0))); Ok(outcome.unwrap_or(SENTINEL)) } + fn take_transient_storage( + &mut self, + memory: &mut [u8], + key_type: KeyType, + key_ptr: u32, + out_ptr: u32, + out_len_ptr: u32, + ) -> Result { + self.charge_gas(RuntimeCosts::TakeTransientStorage)?; + let key = self.decode_key(memory, key_type, key_ptr)?; + if let crate::storage::WriteOutcome::Taken(value) = + self.ext.set_transient_storage(&key, None, true)? + { + self.write_sandbox_output( + memory, + out_ptr, + out_len_ptr, + &value, + false, + already_charged, + )?; + Ok(ReturnErrorCode::Success) + } else { + Ok(ReturnErrorCode::KeyNotFound) + } + } + fn call( &mut self, memory: &mut [u8], @@ -1239,24 +1275,7 @@ pub mod env { out_ptr: u32, out_len_ptr: u32, ) -> Result { - let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; - ensure!( - key_len <= <::T as Config>::MaxStorageKeyLen::get(), - Error::::DecodingFailed - ); - let key = ctx.read_sandbox_memory(memory, key_ptr, key_len)?; - if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_transient_storage( - &Key::::try_from_var(key).map_err(|_| Error::::DecodingFailed)?, - None, - true, - )? { - ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); - ctx.write_sandbox_output(memory, out_ptr, out_len_ptr, &value, false, already_charged)?; - Ok(ReturnErrorCode::Success) - } else { - ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(0)); - Ok(ReturnErrorCode::KeyNotFound) - } + ctx.take_transient_storage(memory, KeyType::Var(key_len), key_ptr, out_ptr, out_len_ptr) } /// Transfer some value to another account. From 735faae955bc37c97e0ce046fdbbe8c87a535e2d Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 26 Jun 2024 23:59:17 +0200 Subject: [PATCH 25/58] Refactor transient storage --- .../src/benchmarking/call_builder.rs | 6 +- substrate/frame/contracts/src/lib.rs | 1 + .../frame/contracts/src/transient_storage.rs | 55 +++++++++---------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index dd62ba70ff35..19636e05c962 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -163,7 +163,11 @@ where /// Add transient_storage pub fn with_transient_storage(ext: &mut StackExt) { for i in 0u32.. { - let key = Key::::try_from_var(i.to_le_bytes().to_vec()).unwrap(); + let mut key_data = i.to_le_bytes().to_vec(); + while key_data.first() == Some(&0) { + key_data.remove(0); + } + let key = Key::::try_from_var(key_data).unwrap(); if ext.set_transient_storage(&key, Some(Vec::new()), false).is_err() { ext.transient_storage().meter().clear(); break; diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index c2eb6529936b..7f0544d0391b 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -411,6 +411,7 @@ pub mod pallet { type MaxDebugBufferLen: Get; /// The maximum length of the transient storage in bytes. + /// This includes keys, values, and previous entries used for storage rollback. #[pallet::constant] type MaxTransientStorageLen: Get; diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index dafbd9a6fba3..1fd0c29a6222 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -140,20 +140,19 @@ impl StorageMeter { /// An entry representing a journal change. struct JournalEntry { - account: Vec, key: Vec, prev_value: Option>, } impl JournalEntry { /// Create a new change. - pub fn new(account: &[u8], key: &[u8], prev_value: Option>) -> Self { - Self { account: account.to_vec(), key: key.to_vec(), prev_value } + pub fn new(key: Vec, prev_value: Option>) -> Self { + Self { key, prev_value } } /// Revert the change. pub fn revert(self, storage: &mut Storage) { - storage.write(&self.account, &self.key, self.prev_value); + storage.write(&self.key, self.prev_value); } } @@ -188,27 +187,20 @@ struct Storage(BTreeMap, Vec>); impl Storage { /// Read the storage entry. - pub fn read(&self, account: &[u8], key: &[u8]) -> Option> { - self.0.get(&Self::storage_key(account, key)).cloned() + pub fn read(&self, key: &Vec) -> Option> { + self.0.get(key).cloned() } /// Write the storage entry. - pub fn write(&mut self, account: &[u8], key: &[u8], value: Option>) -> Option> { + pub fn write(&mut self, key: &Vec, value: Option>) -> Option> { if let Some(value) = value { // Insert storage entry. - self.0.insert(Self::storage_key(account, key), value) + self.0.insert(key.clone(), value) } else { // Remove storage entry. - self.0.remove(&Self::storage_key(account, key)) + self.0.remove(key) } } - - fn storage_key(account: &[u8], key: &[u8]) -> Vec { - let mut storage_key = Vec::with_capacity(account.len() + key.len()); - storage_key.extend_from_slice(&account); - storage_key.extend_from_slice(&key); - storage_key - } } /// Transient storage behaves almost identically to regular storage but is discarded after each @@ -240,7 +232,7 @@ impl TransientStorage { /// Read the storage entry. pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option> { - self.storage.read(&account.encode(), &key.hash()) + self.storage.read(&Self::storage_key(&account.encode(), &key.hash())) } /// Write a value to storage. @@ -254,34 +246,32 @@ impl TransientStorage { let prev_value = self.read(account, key); // Skip if the same value is being set. if prev_value != value { - let key = key.hash(); - let account = account.encode(); + let key = Self::storage_key(&account.encode(), &key.hash()); // Calculate the allocation size. if let Some(value) = &value { - // Charge the keys, value and journal entry. + // Charge the key, value and journal entry. // If a new value is written, a new journal entry is created. The previous value is - // moved to the journal along with its keys, and the new value is written to + // moved to the journal along with its key, and the new value is written to // storage. - let keys_len = account.len().saturating_add(key.len()); + let key_len = key.capacity(); let mut amount = value - .len() - .saturating_add(keys_len) + .capacity() + .saturating_add(key_len) .saturating_add(mem::size_of::()); if prev_value.is_none() { // Charge a new storage entry. // If there was no previous value, a new entry is added to storage (BTreeMap) // containing a Vec for the key and a Vec for the value. The value was already // included in the amount. - amount = amount - .saturating_add(keys_len) - .saturating_add(mem::size_of::>().saturating_mul(2)); + amount = + amount.saturating_add(key_len).saturating_add(mem::size_of::>()); } self.meter.charge(amount as _)?; } - self.storage.write(&account, &key, value); + self.storage.write(&key, value); // Update the journal. - self.journal.push(JournalEntry::new(&account, &key, prev_value.clone())); + self.journal.push(JournalEntry::new(key, prev_value.clone())); } Ok(match (take, prev_value) { @@ -334,6 +324,13 @@ impl TransientStorage { pub fn meter(&mut self) -> &mut StorageMeter { return &mut self.meter } + + fn storage_key(account: &[u8], key: &[u8]) -> Vec { + let mut storage_key = Vec::with_capacity(account.len() + key.len()); + storage_key.extend_from_slice(&account); + storage_key.extend_from_slice(&key); + storage_key + } } #[cfg(test)] From 51fb39c9ec35fd0c46d6de6fe872503fa56e0ea3 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 27 Jun 2024 16:38:51 +0200 Subject: [PATCH 26/58] Add test benchmarks --- .../frame/contracts/src/benchmarking/mod.rs | 175 ++++++++++++++---- substrate/frame/contracts/src/exec.rs | 4 +- substrate/frame/contracts/src/storage.rs | 2 +- .../frame/contracts/src/transient_storage.rs | 53 +++--- 4 files changed, 173 insertions(+), 61 deletions(-) diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 72a5f8fe8935..14b3713d3b9a 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -31,6 +31,7 @@ use crate::{ migration::{ codegen::LATEST_MIGRATION_VERSION, v09, v10, v11, v12, v13, v14, v15, v16, MigrationStep, }, + storage::WriteOutcome, wasm::BenchEnv, Pallet as Contracts, *, }; @@ -1162,9 +1163,109 @@ mod benchmarks { Ok(()) } + #[benchmark(pov_mode = Ignored)] + fn set_transient_storage_empty() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + + let mut setup = CallSetup::::default(); + let (mut ext, _) = setup.ext(); + let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + let result; + #[block] + { + result = runtime.ext().set_transient_storage( + &key, + Some(vec![42u8; max_value_len as _]), + false, + ); + } + + assert_eq!(result, Ok(WriteOutcome::New)); + assert_eq!(runtime.ext().get_transient_storage(&key), Some(vec![42u8; max_value_len as _])); + Ok(()) + } + + #[benchmark(pov_mode = Ignored)] + fn set_transient_storage_full() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + + let mut setup = CallSetup::::default(); + let (mut ext, _) = setup.ext(); + CallSetup::::with_transient_storage(&mut ext); + let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + let result; + #[block] + { + result = runtime.ext().set_transient_storage( + &key, + Some(vec![42u8; max_value_len as _]), + false, + ); + } + + assert_eq!(result, Ok(WriteOutcome::New)); + assert_eq!(runtime.ext().get_transient_storage(&key), Some(vec![42u8; max_value_len as _])); + Ok(()) + } + + #[benchmark(pov_mode = Ignored)] + fn get_transient_storage_empty() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + + let mut setup = CallSetup::::default(); + let (mut ext, _) = setup.ext(); + let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + runtime + .ext() + .set_transient_storage(&key, Some(vec![42u8; max_value_len as _]), false) + .map_err(|_| "Failed to write to storage during setup.")?; + let result; + #[block] + { + result = runtime.ext().get_transient_storage(&key); + } + + assert_eq!(result, Some(vec![42u8; max_value_len as _])); + Ok(()) + } + + #[benchmark(pov_mode = Ignored)] + fn get_transient_storage_full() -> Result<(), BenchmarkError> { + let max_value_len = T::Schedule::get().limits.payload_len; + let max_key_len = T::MaxStorageKeyLen::get(); + let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) + .map_err(|_| "Key has wrong length")?; + + let mut setup = CallSetup::::default(); + let (mut ext, _) = setup.ext(); + CallSetup::::with_transient_storage(&mut ext); + let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + runtime + .ext() + .set_transient_storage(&key, Some(vec![42u8; max_value_len as _]), false) + .map_err(|_| "Failed to write to storage during setup.")?; + let result; + #[block] + { + result = runtime.ext().get_transient_storage(&key); + } + + assert_eq!(result, Some(vec![42u8; max_value_len as _])); + Ok(()) + } + // The weight of journal rollbacks should be taken into account when setting storage. - #[benchmark] - fn rollback_journal() -> Result<(), BenchmarkError> { + #[benchmark(pov_mode = Ignored)] + fn rollback_transient_storage() -> Result<(), BenchmarkError> { let max_value_len = T::Schedule::get().limits.payload_len; let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) @@ -1188,18 +1289,21 @@ mod benchmarks { Ok(()) } - #[benchmark] - fn seal_set_transient_storage() -> Result<(), BenchmarkError> { - let max_value_len = T::Schedule::get().limits.payload_len; + // n: new byte size + // o: old byte size + #[benchmark(pov_mode = Measured)] + fn seal_set_transient_storage( + n: Linear<0, { T::Schedule::get().limits.payload_len }>, + o: Linear<0, { T::Schedule::get().limits.payload_len }>, + ) -> Result<(), BenchmarkError> { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - let value = vec![1u8; max_value_len as usize]; + let value = vec![1u8; n as usize]; build_runtime!(runtime, memory: [ key.to_vec(), value.clone(), ]); - CallSetup::::with_transient_storage(runtime.ext()); runtime .ext() - .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) + .set_transient_storage(&key, Some(vec![42u8; o as usize]), false) .map_err(|_| "Failed to write to storage during setup.")?; let result; @@ -1208,10 +1312,10 @@ mod benchmarks { result = BenchEnv::seal0_set_transient_storage( &mut runtime, &mut memory, - 0, // key_ptr - max_key_len, // key_len - max_key_len, // value_ptr - max_value_len, // value_len + 0, // key_ptr + max_key_len, // key_len + max_key_len, // value_ptr + n, // value_len ); } @@ -1220,17 +1324,17 @@ mod benchmarks { Ok(()) } - #[benchmark] - fn seal_clear_transient_storage() -> Result<(), BenchmarkError> { - let max_value_len = T::Schedule::get().limits.payload_len; + #[benchmark(pov_mode = Measured)] + fn seal_clear_transient_storage( + n: Linear<0, { T::Schedule::get().limits.payload_len }>, + ) -> Result<(), BenchmarkError> { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), ]); - CallSetup::::with_transient_storage(runtime.ext()); runtime .ext() - .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) + .set_transient_storage(&key, Some(vec![42u8; n as usize]), false) .map_err(|_| "Failed to write to storage during setup.")?; let result; @@ -1245,17 +1349,17 @@ mod benchmarks { Ok(()) } - #[benchmark] - fn seal_get_transient_storage() -> Result<(), BenchmarkError> { - let max_value_len = T::Schedule::get().limits.payload_len; + #[benchmark(pov_mode = Measured)] + fn seal_get_transient_storage( + n: Linear<0, { T::Schedule::get().limits.payload_len }>, + ) -> Result<(), BenchmarkError> { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - build_runtime!(runtime, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); - CallSetup::::with_transient_storage(runtime.ext()); + build_runtime!(runtime, memory: [ key.to_vec(), n.to_le_bytes(), vec![0u8; n as _], ]); runtime .ext() - .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) + .set_transient_storage(&key, Some(vec![42u8; n as usize]), false) .map_err(|_| "Failed to write to storage during setup.")?; let out_ptr = max_key_len + 4; @@ -1280,17 +1384,17 @@ mod benchmarks { Ok(()) } - #[benchmark] - fn seal_contains_transient_storage() -> Result<(), BenchmarkError> { - let max_value_len = T::Schedule::get().limits.payload_len; + #[benchmark(pov_mode = Measured)] + fn seal_contains_transient_storage( + n: Linear<0, { T::Schedule::get().limits.payload_len }>, + ) -> Result<(), BenchmarkError> { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), ]); - CallSetup::::with_transient_storage(runtime.ext()); runtime .ext() - .set_transient_storage(&key, Some(vec![42u8; max_value_len as usize]), false) + .set_transient_storage(&key, Some(vec![42u8; n as usize]), false) .map_err(|_| "Failed to write to storage during setup.")?; let result; @@ -1304,19 +1408,20 @@ mod benchmarks { ); } - assert_eq!(result.unwrap(), max_value_len); + assert_eq!(result.unwrap(), n); Ok(()) } - #[benchmark] - fn seal_take_transient_storage() -> Result<(), BenchmarkError> { - let max_value_len = T::Schedule::get().limits.payload_len; + #[benchmark(pov_mode = Measured)] + fn seal_take_transient_storage( + n: Linear<0, { T::Schedule::get().limits.payload_len }>, + ) -> Result<(), BenchmarkError> { + let n = T::Schedule::get().limits.payload_len; let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - build_runtime!(runtime, memory: [ key.to_vec(), max_value_len.to_le_bytes(), vec![0u8; max_value_len as _], ]); - CallSetup::::with_transient_storage(runtime.ext()); - let value = vec![42u8; max_value_len as usize]; + build_runtime!(runtime, memory: [ key.to_vec(), n.to_le_bytes(), vec![0u8; n as _], ]); + let value = vec![42u8; n as usize]; runtime .ext() .set_transient_storage(&key, Some(value.clone()), false) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 8ae708b9cba5..6d014f559009 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -330,8 +330,8 @@ pub trait Ext: sealing::Sealed { fn contract_info(&mut self) -> &mut ContractInfo; /// Get a mutable reference to the transient storage. - /// Useful in tests when it is sometimes necessary to modify and inspect the transient storage - /// directly. + /// Useful in benchmarks when it is sometimes necessary to modify and inspect the transient + /// storage directly. #[cfg(feature = "runtime-benchmarks")] fn transient_storage(&mut self) -> &mut TransientStorage; diff --git a/substrate/frame/contracts/src/storage.rs b/substrate/frame/contracts/src/storage.rs index 1e9739a1599e..5e87ab31b389 100644 --- a/substrate/frame/contracts/src/storage.rs +++ b/substrate/frame/contracts/src/storage.rs @@ -334,7 +334,7 @@ impl ContractInfo { } /// Information about what happened to the pre-existing value when calling [`ContractInfo::write`]. -#[cfg_attr(test, derive(Debug, PartialEq))] +#[cfg_attr(any(test, feature = "runtime-benchmarks"), derive(Debug, PartialEq))] pub enum WriteOutcome { /// No value existed at the specified key. New, diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 1fd0c29a6222..2ca1fd0c5bab 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -77,23 +77,6 @@ impl StorageMeter { Ok(()) } - /// The allocated amount of memory inside the current transaction. - pub fn current_amount(&self) -> u32 { - self.top_meter().amount - } - - /// The memory limit of the current transaction. - pub fn current_limit(&self) -> u32 { - self.top_meter().limit - } - - /// The total allocated amount of memory. - pub fn total_amount(&self) -> u32 { - self.nested_meters - .iter() - .fold(self.root_meter.amount, |acc, e| acc.saturating_add(e.amount)) - } - /// Revert a transaction meter. pub fn revert(&mut self) { self.nested_meters @@ -104,14 +87,15 @@ impl StorageMeter { /// Start a transaction meter. pub fn start(&mut self) { let meter = self.top_meter(); - let free = meter.limit.saturating_sub(meter.amount); - let transaction_limit = if !self.nested_meters.is_empty() { + let mut transaction_limit = meter.limit.saturating_sub(meter.amount); + if !self.nested_meters.is_empty() { // Allow use of (1 - 1/STORAGE_FRACTION_DENOMINATOR) of free storage for subsequent // calls. - free.saturating_sub(free.saturating_div(Self::STORAGE_FRACTION_DENOMINATOR)) - } else { - free - }; + transaction_limit = transaction_limit.saturating_sub( + transaction_limit.saturating_div(Self::STORAGE_FRACTION_DENOMINATOR), + ); + } + self.nested_meters.push(MeterEntry::new(transaction_limit)); } @@ -124,11 +108,33 @@ impl StorageMeter { self.top_meter_mut().absorb(transaction_meter) } + /// Clear a transaction meter + #[cfg(any(test, feature = "runtime-benchmarks"))] pub fn clear(&mut self) { self.nested_meters.clear(); self.root_meter.amount = 0; } + /// The allocated amount of memory inside the current transaction. + #[cfg(any(test, feature = "runtime-benchmarks"))] + pub fn current_amount(&self) -> u32 { + self.top_meter().amount + } + + /// The memory limit of the current transaction. + #[cfg(any(test, feature = "runtime-benchmarks"))] + pub fn current_limit(&self) -> u32 { + self.top_meter().limit + } + + /// The total allocated amount of memory. + #[cfg(any(test, feature = "runtime-benchmarks"))] + pub fn total_amount(&self) -> u32 { + self.nested_meters + .iter() + .fold(self.root_meter.amount, |acc, e| acc.saturating_add(e.amount)) + } + fn top_meter_mut(&mut self) -> &mut MeterEntry { self.nested_meters.last_mut().unwrap_or(&mut self.root_meter) } @@ -321,6 +327,7 @@ impl TransientStorage { self.meter.commit(); } + #[cfg(any(test, feature = "runtime-benchmarks"))] pub fn meter(&mut self) -> &mut StorageMeter { return &mut self.meter } From b2c700589496ffa80e63a0e464679832673d68c1 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Thu, 27 Jun 2024 15:32:29 +0000 Subject: [PATCH 27/58] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 948 +++++++++++++---------- 1 file changed, 522 insertions(+), 426 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index 36357964dd07..23b0a872a9ca 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/frame/contracts/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for `pallet_contracts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-06-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-x5tnzzy-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `runner-7wrmsoux-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: @@ -98,12 +98,16 @@ pub trait WeightInfo { fn seal_get_storage(n: u32, ) -> Weight; fn seal_contains_storage(n: u32, ) -> Weight; fn seal_take_storage(n: u32, ) -> Weight; - fn rollback_journal() -> Weight; - fn seal_set_transient_storage() -> Weight; - fn seal_clear_transient_storage() -> Weight; - fn seal_get_transient_storage() -> Weight; - fn seal_contains_transient_storage() -> Weight; - fn seal_take_transient_storage() -> Weight; + fn set_transient_storage_empty() -> Weight; + fn set_transient_storage_full() -> Weight; + fn get_transient_storage_empty() -> Weight; + fn get_transient_storage_full() -> Weight; + fn rollback_transient_storage() -> Weight; + fn seal_set_transient_storage(n: u32, o: u32, ) -> Weight; + fn seal_clear_transient_storage(n: u32, ) -> Weight; + fn seal_get_transient_storage(n: u32, ) -> Weight; + fn seal_contains_transient_storage(n: u32, ) -> Weight; + fn seal_take_transient_storage(n: u32, ) -> Weight; fn seal_transfer() -> Weight; fn seal_call(t: u32, i: u32, ) -> Weight; fn seal_delegate_call() -> Weight; @@ -133,8 +137,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_895_000 picoseconds. - Weight::from_parts(1_975_000, 1627) + // Minimum execution time: 1_937_000 picoseconds. + Weight::from_parts(1_999_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -144,10 +148,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_200_000 picoseconds. - Weight::from_parts(11_437_000, 442) - // Standard Error: 2_036 - .saturating_add(Weight::from_parts(1_204_457, 0).saturating_mul(k.into())) + // Minimum execution time: 11_396_000 picoseconds. + Weight::from_parts(11_740_000, 442) + // Standard Error: 1_717 + .saturating_add(Weight::from_parts(1_184_048, 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)) @@ -161,10 +165,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_681_000 picoseconds. - Weight::from_parts(4_863_511, 6149) + // Minimum execution time: 7_651_000 picoseconds. + Weight::from_parts(4_745_475, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_627, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_635, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -177,8 +181,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_550_000 picoseconds. - Weight::from_parts(16_962_000, 6450) + // Minimum execution time: 16_479_000 picoseconds. + Weight::from_parts(17_172_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -191,10 +195,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_124_000 picoseconds. - Weight::from_parts(3_152_000, 3635) - // Standard Error: 534 - .saturating_add(Weight::from_parts(1_098_366, 0).saturating_mul(k.into())) + // Minimum execution time: 3_127_000 picoseconds. + Weight::from_parts(3_194_000, 3635) + // Standard Error: 616 + .saturating_add(Weight::from_parts(1_144_683, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -213,10 +217,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_059_000 picoseconds. - Weight::from_parts(15_526_712, 6263) + // Minimum execution time: 15_217_000 picoseconds. + Weight::from_parts(15_663_753, 6263) // Standard Error: 2 - .saturating_add(Weight::from_parts(427, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(425, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -227,8 +231,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_246_000 picoseconds. - Weight::from_parts(12_747_000, 6380) + // Minimum execution time: 12_664_000 picoseconds. + Weight::from_parts(13_177_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -242,8 +246,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 48_149_000 picoseconds. - Weight::from_parts(48_939_000, 6292) + // Minimum execution time: 47_615_000 picoseconds. + Weight::from_parts(49_024_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -255,8 +259,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_500_000 picoseconds. - Weight::from_parts(54_238_000, 6534) + // Minimum execution time: 54_439_000 picoseconds. + Weight::from_parts(59_533_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -266,8 +270,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_882_000 picoseconds. - Weight::from_parts(12_381_000, 6349) + // Minimum execution time: 12_116_000 picoseconds. + Weight::from_parts(12_414_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -277,8 +281,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_081_000 picoseconds. - Weight::from_parts(2_202_000, 1627) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_264_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -290,8 +294,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_758_000 picoseconds. - Weight::from_parts(11_201_000, 3631) + // Minimum execution time: 10_993_000 picoseconds. + Weight::from_parts(11_358_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -301,8 +305,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_409_000 picoseconds. - Weight::from_parts(4_594_000, 3607) + // Minimum execution time: 4_293_000 picoseconds. + Weight::from_parts(4_531_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -313,8 +317,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_436_000 picoseconds. - Weight::from_parts(5_812_000, 3632) + // Minimum execution time: 5_528_000 picoseconds. + Weight::from_parts(5_761_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -325,8 +329,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_280_000 picoseconds. - Weight::from_parts(5_646_000, 3607) + // Minimum execution time: 5_426_000 picoseconds. + Weight::from_parts(5_692_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -345,12 +349,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `c` is `[0, 125952]`. fn call_with_code_per_byte(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `801 + c * (1 ±0)` - // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 254_639_000 picoseconds. - Weight::from_parts(267_931_959, 4264) + // Measured: `800 + c * (1 ±0)` + // Estimated: `4266 + c * (1 ±0)` + // Minimum execution time: 264_205_000 picoseconds. + Weight::from_parts(268_661_799, 4266) // Standard Error: 5 - .saturating_add(Weight::from_parts(770, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(796, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -378,14 +382,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_497_077_000 picoseconds. - Weight::from_parts(38_610_814, 6262) - // Standard Error: 167 - .saturating_add(Weight::from_parts(54_092, 0).saturating_mul(c.into())) - // Standard Error: 20 - .saturating_add(Weight::from_parts(2_300, 0).saturating_mul(i.into())) - // Standard Error: 20 - .saturating_add(Weight::from_parts(2_297, 0).saturating_mul(s.into())) + // Minimum execution time: 4_571_933_000 picoseconds. + Weight::from_parts(4_813_995_000, 6262) + // Standard Error: 311 + .saturating_add(Weight::from_parts(38_636, 0).saturating_mul(c.into())) + // Standard Error: 37 + .saturating_add(Weight::from_parts(516, 0).saturating_mul(i.into())) + // Standard Error: 37 + .saturating_add(Weight::from_parts(523, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -410,13 +414,13 @@ impl WeightInfo for SubstrateWeight { fn instantiate(i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `560` - // Estimated: `4029` - // Minimum execution time: 2_227_347_000 picoseconds. - Weight::from_parts(2_263_930_000, 4029) - // Standard Error: 34 - .saturating_add(Weight::from_parts(1_001, 0).saturating_mul(i.into())) - // Standard Error: 34 - .saturating_add(Weight::from_parts(920, 0).saturating_mul(s.into())) + // Estimated: `4017` + // Minimum execution time: 2_213_558_000 picoseconds. + Weight::from_parts(2_261_695_000, 4017) + // Standard Error: 33 + .saturating_add(Weight::from_parts(942, 0).saturating_mul(i.into())) + // Standard Error: 33 + .saturating_add(Weight::from_parts(973, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -436,8 +440,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 166_907_000 picoseconds. - Weight::from_parts(171_544_000, 4291) + // Minimum execution time: 169_671_000 picoseconds. + Weight::from_parts(174_356_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -454,10 +458,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 231_632_000 picoseconds. - Weight::from_parts(247_875_779, 3607) - // Standard Error: 60 - .saturating_add(Weight::from_parts(51_391, 0).saturating_mul(c.into())) + // Minimum execution time: 229_319_000 picoseconds. + Weight::from_parts(221_512_691, 3607) + // Standard Error: 219 + .saturating_add(Weight::from_parts(53_141, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -474,10 +478,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 240_526_000 picoseconds. - Weight::from_parts(259_679_899, 3607) - // Standard Error: 59 - .saturating_add(Weight::from_parts(51_451, 0).saturating_mul(c.into())) + // Minimum execution time: 238_249_000 picoseconds. + Weight::from_parts(278_776_471, 3607) + // Standard Error: 107 + .saturating_add(Weight::from_parts(52_097, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -493,8 +497,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 38_890_000 picoseconds. - Weight::from_parts(39_983_000, 3780) + // Minimum execution time: 39_158_000 picoseconds. + Weight::from_parts(40_370_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -508,8 +512,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_587_000 picoseconds. - Weight::from_parts(26_259_000, 6492) + // Minimum execution time: 25_001_000 picoseconds. + Weight::from_parts(25_739_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -518,17 +522,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_388_000 picoseconds. - Weight::from_parts(9_788_693, 0) - // Standard Error: 83 - .saturating_add(Weight::from_parts(51_386, 0).saturating_mul(r.into())) + // Minimum execution time: 8_408_000 picoseconds. + Weight::from_parts(9_835_104, 0) + // Standard Error: 100 + .saturating_add(Weight::from_parts(51_219, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 666_000 picoseconds. - Weight::from_parts(699_000, 0) + // Minimum execution time: 697_000 picoseconds. + Weight::from_parts(736_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -536,8 +540,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_128_000 picoseconds. - Weight::from_parts(6_404_000, 3819) + // Minimum execution time: 6_088_000 picoseconds. + Weight::from_parts(6_397_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -546,79 +550,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_296_000 picoseconds. - Weight::from_parts(7_630_000, 3912) + // Minimum execution time: 7_508_000 picoseconds. + Weight::from_parts(7_691_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 715_000 picoseconds. - Weight::from_parts(776_000, 0) + // Minimum execution time: 783_000 picoseconds. + Weight::from_parts(853_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 372_000 picoseconds. - Weight::from_parts(404_000, 0) + // Minimum execution time: 410_000 picoseconds. + Weight::from_parts(437_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 296_000 picoseconds. - Weight::from_parts(351_000, 0) + // Minimum execution time: 340_000 picoseconds. + Weight::from_parts(365_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 562_000 picoseconds. - Weight::from_parts(620_000, 0) + // Minimum execution time: 598_000 picoseconds. + Weight::from_parts(663_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 663_000 picoseconds. - Weight::from_parts(718_000, 0) + // Minimum execution time: 672_000 picoseconds. + Weight::from_parts(724_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_483_000 picoseconds. - Weight::from_parts(4_724_000, 0) + // Minimum execution time: 4_407_000 picoseconds. + Weight::from_parts(4_620_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 551_000 picoseconds. - Weight::from_parts(634_000, 0) + // Minimum execution time: 575_000 picoseconds. + Weight::from_parts(623_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 507_000 picoseconds. - Weight::from_parts(587_000, 0) + // Minimum execution time: 595_000 picoseconds. + Weight::from_parts(637_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 556_000 picoseconds. - Weight::from_parts(611_000, 0) + // Minimum execution time: 560_000 picoseconds. + Weight::from_parts(618_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 538_000 picoseconds. - Weight::from_parts(622_000, 0) + // Minimum execution time: 524_000 picoseconds. + Weight::from_parts(609_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -626,8 +630,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_101_000 picoseconds. - Weight::from_parts(4_294_000, 1552) + // Minimum execution time: 4_264_000 picoseconds. + Weight::from_parts(4_464_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -635,8 +639,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 502_000 picoseconds. - Weight::from_parts(530_000, 0) + // Minimum execution time: 527_000 picoseconds. + Weight::from_parts(547_000, 0) // Standard Error: 3 .saturating_add(Weight::from_parts(300, 0).saturating_mul(n.into())) } @@ -645,10 +649,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 380_000 picoseconds. - Weight::from_parts(432_000, 0) + // Minimum execution time: 399_000 picoseconds. + Weight::from_parts(409_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(408, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -661,10 +665,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_653_000 picoseconds. - Weight::from_parts(15_911_187, 3784) - // Standard Error: 7_779 - .saturating_add(Weight::from_parts(3_469_493, 0).saturating_mul(n.into())) + // Minimum execution time: 13_210_000 picoseconds. + Weight::from_parts(15_349_133, 3784) + // Standard Error: 7_527 + .saturating_add(Weight::from_parts(3_564_903, 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(3_u64)) @@ -677,8 +681,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_337_000 picoseconds. - Weight::from_parts(3_504_000, 1561) + // Minimum execution time: 3_350_000 picoseconds. + Weight::from_parts(3_494_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -689,12 +693,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_629_000 picoseconds. - Weight::from_parts(3_860_500, 990) - // Standard Error: 5_057 - .saturating_add(Weight::from_parts(2_062_375, 0).saturating_mul(t.into())) + // Minimum execution time: 3_610_000 picoseconds. + Weight::from_parts(3_761_045, 990) + // Standard Error: 5_750 + .saturating_add(Weight::from_parts(2_072_190, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(17, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(22, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -704,10 +708,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 404_000 picoseconds. - Weight::from_parts(449_000, 0) + // Minimum execution time: 424_000 picoseconds. + Weight::from_parts(439_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_206, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_210, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -717,12 +721,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_046_000 picoseconds. - Weight::from_parts(8_839_401, 249) + // Minimum execution time: 9_214_000 picoseconds. + Weight::from_parts(8_653_412, 249) // Standard Error: 1 - .saturating_add(Weight::from_parts(256, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(262, 0).saturating_mul(n.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(46, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(64, 0).saturating_mul(o.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(o.into())) @@ -734,10 +738,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_275_000 picoseconds. - Weight::from_parts(7_975_993, 248) + // Minimum execution time: 7_482_000 picoseconds. + Weight::from_parts(8_180_823, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.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(n.into())) @@ -749,10 +753,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_917_000 picoseconds. - Weight::from_parts(7_742_973, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(598, 0).saturating_mul(n.into())) + // Minimum execution time: 6_922_000 picoseconds. + Weight::from_parts(7_810_093, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(617, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -763,10 +767,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_214_000 picoseconds. - Weight::from_parts(6_994_418, 248) + // Minimum execution time: 6_319_000 picoseconds. + Weight::from_parts(7_113_817, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(76, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -777,62 +781,108 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_587_000 picoseconds. - Weight::from_parts(8_575_913, 248) + // Minimum execution time: 7_861_000 picoseconds. + Weight::from_parts(8_757_100, 248) // Standard Error: 2 - .saturating_add(Weight::from_parts(609, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(627, 0).saturating_mul(n.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(n.into())) } - fn rollback_journal() -> Weight { + fn set_transient_storage_empty() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_456_000 picoseconds. + Weight::from_parts(3_837_000, 0) + } + fn set_transient_storage_full() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_753_000 picoseconds. + Weight::from_parts(4_915_000, 0) + } + fn get_transient_storage_empty() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_157_000 picoseconds. + Weight::from_parts(3_224_000, 0) + } + fn get_transient_storage_full() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_748_000 picoseconds. + Weight::from_parts(4_056_000, 0) + } + fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_571_000 picoseconds. - Weight::from_parts(1_726_000, 0) + // Minimum execution time: 1_437_000 picoseconds. + Weight::from_parts(1_523_000, 0) } - fn seal_set_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + /// The range of component `o` is `[0, 16384]`. + fn seal_set_transient_storage(n: u32, o: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_305_000 picoseconds. - Weight::from_parts(11_613_000, 0) + // Minimum execution time: 6_171_000 picoseconds. + Weight::from_parts(3_215_064, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(203, 0).saturating_mul(n.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(236, 0).saturating_mul(o.into())) } - fn seal_clear_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + fn seal_clear_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_127_000 picoseconds. - Weight::from_parts(8_395_000, 0) + // Minimum execution time: 2_772_000 picoseconds. + Weight::from_parts(3_120_514, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(231, 0).saturating_mul(n.into())) } - fn seal_get_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_334_000 picoseconds. - Weight::from_parts(6_630_000, 0) + // Minimum execution time: 1_769_000 picoseconds. + Weight::from_parts(2_055_515, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(227, 0).saturating_mul(n.into())) } - fn seal_contains_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + fn seal_contains_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_240_000 picoseconds. - Weight::from_parts(5_137_000, 0) + // Minimum execution time: 1_702_000 picoseconds. + Weight::from_parts(1_877_427, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(113, 0).saturating_mul(n.into())) } - fn seal_take_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + fn seal_take_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_862_000 picoseconds. - Weight::from_parts(10_178_000, 0) + // Minimum execution time: 8_600_000 picoseconds. + Weight::from_parts(8_975_836, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(3, 0).saturating_mul(n.into())) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_753_000 picoseconds. - Weight::from_parts(8_991_000, 0) + // Minimum execution time: 8_681_000 picoseconds. + Weight::from_parts(8_895_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -848,12 +898,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 124_989_000 picoseconds. - Weight::from_parts(120_757_179, 4085) - // Standard Error: 180_229 - .saturating_add(Weight::from_parts(44_556_927, 0).saturating_mul(t.into())) + // Minimum execution time: 126_413_000 picoseconds. + Weight::from_parts(126_832_549, 4085) + // Standard Error: 197_984 + .saturating_add(Weight::from_parts(43_232_174, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(8, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(4, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -868,8 +918,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 113_376_000 picoseconds. - Weight::from_parts(116_035_000, 3895) + // Minimum execution time: 113_966_000 picoseconds. + Weight::from_parts(116_498_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -887,13 +937,13 @@ impl WeightInfo for SubstrateWeight { fn seal_instantiate(i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `676` - // Estimated: `4127` - // Minimum execution time: 1_866_665_000 picoseconds. - Weight::from_parts(1_878_158_000, 4127) - // Standard Error: 24 - .saturating_add(Weight::from_parts(578, 0).saturating_mul(i.into())) - // Standard Error: 24 - .saturating_add(Weight::from_parts(939, 0).saturating_mul(s.into())) + // Estimated: `4132` + // Minimum execution time: 1_857_056_000 picoseconds. + Weight::from_parts(1_868_503_000, 4132) + // Standard Error: 23 + .saturating_add(Weight::from_parts(579, 0).saturating_mul(i.into())) + // Standard Error: 23 + .saturating_add(Weight::from_parts(935, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -902,64 +952,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 974_000 picoseconds. - Weight::from_parts(8_785_655, 0) + // Minimum execution time: 948_000 picoseconds. + Weight::from_parts(12_101_598, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_333, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_312, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_380_000 picoseconds. - Weight::from_parts(10_136_026, 0) + // Minimum execution time: 1_391_000 picoseconds. + Weight::from_parts(9_088_457, 0) // Standard Error: 1 - .saturating_add(Weight::from_parts(3_591, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_589, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 737_000 picoseconds. - Weight::from_parts(4_053_205, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_473, 0).saturating_mul(n.into())) + // Minimum execution time: 800_000 picoseconds. + Weight::from_parts(11_056_529, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 818_000 picoseconds. - Weight::from_parts(9_871_804, 0) + // Minimum execution time: 729_000 picoseconds. + Weight::from_parts(9_991_880, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_455, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_928_000 picoseconds. - Weight::from_parts(41_138_853, 0) - // Standard Error: 8 - .saturating_add(Weight::from_parts(5_217, 0).saturating_mul(n.into())) + // Minimum execution time: 43_313_000 picoseconds. + Weight::from_parts(40_779_201, 0) + // Standard Error: 11 + .saturating_add(Weight::from_parts(5_093, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_156_000 picoseconds. - Weight::from_parts(48_476_000, 0) + // Minimum execution time: 47_784_000 picoseconds. + Weight::from_parts(48_901_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_064_000 picoseconds. - Weight::from_parts(13_174_000, 0) + // Minimum execution time: 12_823_000 picoseconds. + Weight::from_parts(12_972_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -969,8 +1019,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_611_000 picoseconds. - Weight::from_parts(18_338_000, 3895) + // Minimum execution time: 18_007_000 picoseconds. + Weight::from_parts(18_587_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -980,8 +1030,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_308_000 picoseconds. - Weight::from_parts(8_622_000, 3820) + // Minimum execution time: 8_436_000 picoseconds. + Weight::from_parts(8_772_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -991,8 +1041,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_377_000 picoseconds. - Weight::from_parts(7_675_000, 3558) + // Minimum execution time: 7_447_000 picoseconds. + Weight::from_parts(7_764_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1000,15 +1050,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 348_000 picoseconds. - Weight::from_parts(390_000, 0) + // Minimum execution time: 346_000 picoseconds. + Weight::from_parts(384_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 357_000 picoseconds. - Weight::from_parts(398_000, 0) + // Minimum execution time: 369_000 picoseconds. + Weight::from_parts(412_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1016,8 +1066,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_678_000 picoseconds. - Weight::from_parts(2_903_000, 1704) + // Minimum execution time: 2_781_000 picoseconds. + Weight::from_parts(3_037_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1025,10 +1075,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 752_000 picoseconds. - Weight::from_parts(721_329, 0) - // Standard Error: 16 - .saturating_add(Weight::from_parts(6_979, 0).saturating_mul(r.into())) + // Minimum execution time: 714_000 picoseconds. + Weight::from_parts(974_967, 0) + // Standard Error: 19 + .saturating_add(Weight::from_parts(7_028, 0).saturating_mul(r.into())) } } @@ -1040,8 +1090,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_895_000 picoseconds. - Weight::from_parts(1_975_000, 1627) + // Minimum execution time: 1_937_000 picoseconds. + Weight::from_parts(1_999_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1051,10 +1101,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_200_000 picoseconds. - Weight::from_parts(11_437_000, 442) - // Standard Error: 2_036 - .saturating_add(Weight::from_parts(1_204_457, 0).saturating_mul(k.into())) + // Minimum execution time: 11_396_000 picoseconds. + Weight::from_parts(11_740_000, 442) + // Standard Error: 1_717 + .saturating_add(Weight::from_parts(1_184_048, 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)) @@ -1068,10 +1118,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_681_000 picoseconds. - Weight::from_parts(4_863_511, 6149) + // Minimum execution time: 7_651_000 picoseconds. + Weight::from_parts(4_745_475, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_627, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_635, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1084,8 +1134,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_550_000 picoseconds. - Weight::from_parts(16_962_000, 6450) + // Minimum execution time: 16_479_000 picoseconds. + Weight::from_parts(17_172_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1098,10 +1148,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_124_000 picoseconds. - Weight::from_parts(3_152_000, 3635) - // Standard Error: 534 - .saturating_add(Weight::from_parts(1_098_366, 0).saturating_mul(k.into())) + // Minimum execution time: 3_127_000 picoseconds. + Weight::from_parts(3_194_000, 3635) + // Standard Error: 616 + .saturating_add(Weight::from_parts(1_144_683, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1120,10 +1170,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_059_000 picoseconds. - Weight::from_parts(15_526_712, 6263) + // Minimum execution time: 15_217_000 picoseconds. + Weight::from_parts(15_663_753, 6263) // Standard Error: 2 - .saturating_add(Weight::from_parts(427, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(425, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1134,8 +1184,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_246_000 picoseconds. - Weight::from_parts(12_747_000, 6380) + // Minimum execution time: 12_664_000 picoseconds. + Weight::from_parts(13_177_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1149,8 +1199,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 48_149_000 picoseconds. - Weight::from_parts(48_939_000, 6292) + // Minimum execution time: 47_615_000 picoseconds. + Weight::from_parts(49_024_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1162,8 +1212,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_500_000 picoseconds. - Weight::from_parts(54_238_000, 6534) + // Minimum execution time: 54_439_000 picoseconds. + Weight::from_parts(59_533_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1173,8 +1223,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_882_000 picoseconds. - Weight::from_parts(12_381_000, 6349) + // Minimum execution time: 12_116_000 picoseconds. + Weight::from_parts(12_414_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1184,8 +1234,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_081_000 picoseconds. - Weight::from_parts(2_202_000, 1627) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_264_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1197,8 +1247,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_758_000 picoseconds. - Weight::from_parts(11_201_000, 3631) + // Minimum execution time: 10_993_000 picoseconds. + Weight::from_parts(11_358_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1208,8 +1258,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_409_000 picoseconds. - Weight::from_parts(4_594_000, 3607) + // Minimum execution time: 4_293_000 picoseconds. + Weight::from_parts(4_531_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1220,8 +1270,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_436_000 picoseconds. - Weight::from_parts(5_812_000, 3632) + // Minimum execution time: 5_528_000 picoseconds. + Weight::from_parts(5_761_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1232,8 +1282,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_280_000 picoseconds. - Weight::from_parts(5_646_000, 3607) + // Minimum execution time: 5_426_000 picoseconds. + Weight::from_parts(5_692_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1252,12 +1302,12 @@ impl WeightInfo for () { /// The range of component `c` is `[0, 125952]`. fn call_with_code_per_byte(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `801 + c * (1 ±0)` - // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 254_639_000 picoseconds. - Weight::from_parts(267_931_959, 4264) + // Measured: `800 + c * (1 ±0)` + // Estimated: `4266 + c * (1 ±0)` + // Minimum execution time: 264_205_000 picoseconds. + Weight::from_parts(268_661_799, 4266) // Standard Error: 5 - .saturating_add(Weight::from_parts(770, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(796, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1285,14 +1335,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_497_077_000 picoseconds. - Weight::from_parts(38_610_814, 6262) - // Standard Error: 167 - .saturating_add(Weight::from_parts(54_092, 0).saturating_mul(c.into())) - // Standard Error: 20 - .saturating_add(Weight::from_parts(2_300, 0).saturating_mul(i.into())) - // Standard Error: 20 - .saturating_add(Weight::from_parts(2_297, 0).saturating_mul(s.into())) + // Minimum execution time: 4_571_933_000 picoseconds. + Weight::from_parts(4_813_995_000, 6262) + // Standard Error: 311 + .saturating_add(Weight::from_parts(38_636, 0).saturating_mul(c.into())) + // Standard Error: 37 + .saturating_add(Weight::from_parts(516, 0).saturating_mul(i.into())) + // Standard Error: 37 + .saturating_add(Weight::from_parts(523, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1317,13 +1367,13 @@ impl WeightInfo for () { fn instantiate(i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `560` - // Estimated: `4029` - // Minimum execution time: 2_227_347_000 picoseconds. - Weight::from_parts(2_263_930_000, 4029) - // Standard Error: 34 - .saturating_add(Weight::from_parts(1_001, 0).saturating_mul(i.into())) - // Standard Error: 34 - .saturating_add(Weight::from_parts(920, 0).saturating_mul(s.into())) + // Estimated: `4017` + // Minimum execution time: 2_213_558_000 picoseconds. + Weight::from_parts(2_261_695_000, 4017) + // Standard Error: 33 + .saturating_add(Weight::from_parts(942, 0).saturating_mul(i.into())) + // Standard Error: 33 + .saturating_add(Weight::from_parts(973, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1343,8 +1393,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 166_907_000 picoseconds. - Weight::from_parts(171_544_000, 4291) + // Minimum execution time: 169_671_000 picoseconds. + Weight::from_parts(174_356_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1361,10 +1411,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 231_632_000 picoseconds. - Weight::from_parts(247_875_779, 3607) - // Standard Error: 60 - .saturating_add(Weight::from_parts(51_391, 0).saturating_mul(c.into())) + // Minimum execution time: 229_319_000 picoseconds. + Weight::from_parts(221_512_691, 3607) + // Standard Error: 219 + .saturating_add(Weight::from_parts(53_141, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1381,10 +1431,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 240_526_000 picoseconds. - Weight::from_parts(259_679_899, 3607) - // Standard Error: 59 - .saturating_add(Weight::from_parts(51_451, 0).saturating_mul(c.into())) + // Minimum execution time: 238_249_000 picoseconds. + Weight::from_parts(278_776_471, 3607) + // Standard Error: 107 + .saturating_add(Weight::from_parts(52_097, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1400,8 +1450,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 38_890_000 picoseconds. - Weight::from_parts(39_983_000, 3780) + // Minimum execution time: 39_158_000 picoseconds. + Weight::from_parts(40_370_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1415,8 +1465,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_587_000 picoseconds. - Weight::from_parts(26_259_000, 6492) + // Minimum execution time: 25_001_000 picoseconds. + Weight::from_parts(25_739_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1425,17 +1475,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_388_000 picoseconds. - Weight::from_parts(9_788_693, 0) - // Standard Error: 83 - .saturating_add(Weight::from_parts(51_386, 0).saturating_mul(r.into())) + // Minimum execution time: 8_408_000 picoseconds. + Weight::from_parts(9_835_104, 0) + // Standard Error: 100 + .saturating_add(Weight::from_parts(51_219, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 666_000 picoseconds. - Weight::from_parts(699_000, 0) + // Minimum execution time: 697_000 picoseconds. + Weight::from_parts(736_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1443,8 +1493,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_128_000 picoseconds. - Weight::from_parts(6_404_000, 3819) + // Minimum execution time: 6_088_000 picoseconds. + Weight::from_parts(6_397_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1453,79 +1503,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_296_000 picoseconds. - Weight::from_parts(7_630_000, 3912) + // Minimum execution time: 7_508_000 picoseconds. + Weight::from_parts(7_691_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 715_000 picoseconds. - Weight::from_parts(776_000, 0) + // Minimum execution time: 783_000 picoseconds. + Weight::from_parts(853_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 372_000 picoseconds. - Weight::from_parts(404_000, 0) + // Minimum execution time: 410_000 picoseconds. + Weight::from_parts(437_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 296_000 picoseconds. - Weight::from_parts(351_000, 0) + // Minimum execution time: 340_000 picoseconds. + Weight::from_parts(365_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 562_000 picoseconds. - Weight::from_parts(620_000, 0) + // Minimum execution time: 598_000 picoseconds. + Weight::from_parts(663_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 663_000 picoseconds. - Weight::from_parts(718_000, 0) + // Minimum execution time: 672_000 picoseconds. + Weight::from_parts(724_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_483_000 picoseconds. - Weight::from_parts(4_724_000, 0) + // Minimum execution time: 4_407_000 picoseconds. + Weight::from_parts(4_620_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 551_000 picoseconds. - Weight::from_parts(634_000, 0) + // Minimum execution time: 575_000 picoseconds. + Weight::from_parts(623_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 507_000 picoseconds. - Weight::from_parts(587_000, 0) + // Minimum execution time: 595_000 picoseconds. + Weight::from_parts(637_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 556_000 picoseconds. - Weight::from_parts(611_000, 0) + // Minimum execution time: 560_000 picoseconds. + Weight::from_parts(618_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 538_000 picoseconds. - Weight::from_parts(622_000, 0) + // Minimum execution time: 524_000 picoseconds. + Weight::from_parts(609_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1533,8 +1583,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_101_000 picoseconds. - Weight::from_parts(4_294_000, 1552) + // Minimum execution time: 4_264_000 picoseconds. + Weight::from_parts(4_464_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1542,8 +1592,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 502_000 picoseconds. - Weight::from_parts(530_000, 0) + // Minimum execution time: 527_000 picoseconds. + Weight::from_parts(547_000, 0) // Standard Error: 3 .saturating_add(Weight::from_parts(300, 0).saturating_mul(n.into())) } @@ -1552,10 +1602,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 380_000 picoseconds. - Weight::from_parts(432_000, 0) + // Minimum execution time: 399_000 picoseconds. + Weight::from_parts(409_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(405, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(408, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1568,10 +1618,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_653_000 picoseconds. - Weight::from_parts(15_911_187, 3784) - // Standard Error: 7_779 - .saturating_add(Weight::from_parts(3_469_493, 0).saturating_mul(n.into())) + // Minimum execution time: 13_210_000 picoseconds. + Weight::from_parts(15_349_133, 3784) + // Standard Error: 7_527 + .saturating_add(Weight::from_parts(3_564_903, 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(3_u64)) @@ -1584,8 +1634,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_337_000 picoseconds. - Weight::from_parts(3_504_000, 1561) + // Minimum execution time: 3_350_000 picoseconds. + Weight::from_parts(3_494_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1596,12 +1646,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_629_000 picoseconds. - Weight::from_parts(3_860_500, 990) - // Standard Error: 5_057 - .saturating_add(Weight::from_parts(2_062_375, 0).saturating_mul(t.into())) + // Minimum execution time: 3_610_000 picoseconds. + Weight::from_parts(3_761_045, 990) + // Standard Error: 5_750 + .saturating_add(Weight::from_parts(2_072_190, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(17, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(22, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1611,10 +1661,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 404_000 picoseconds. - Weight::from_parts(449_000, 0) + // Minimum execution time: 424_000 picoseconds. + Weight::from_parts(439_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_206, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_210, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1624,12 +1674,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_046_000 picoseconds. - Weight::from_parts(8_839_401, 249) + // Minimum execution time: 9_214_000 picoseconds. + Weight::from_parts(8_653_412, 249) // Standard Error: 1 - .saturating_add(Weight::from_parts(256, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(262, 0).saturating_mul(n.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(46, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(64, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1641,10 +1691,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_275_000 picoseconds. - Weight::from_parts(7_975_993, 248) + // Minimum execution time: 7_482_000 picoseconds. + Weight::from_parts(8_180_823, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1656,10 +1706,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_917_000 picoseconds. - Weight::from_parts(7_742_973, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(598, 0).saturating_mul(n.into())) + // Minimum execution time: 6_922_000 picoseconds. + Weight::from_parts(7_810_093, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(617, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1670,10 +1720,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_214_000 picoseconds. - Weight::from_parts(6_994_418, 248) + // Minimum execution time: 6_319_000 picoseconds. + Weight::from_parts(7_113_817, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(76, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1684,62 +1734,108 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_587_000 picoseconds. - Weight::from_parts(8_575_913, 248) + // Minimum execution time: 7_861_000 picoseconds. + Weight::from_parts(8_757_100, 248) // Standard Error: 2 - .saturating_add(Weight::from_parts(609, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(627, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } - fn rollback_journal() -> Weight { + fn set_transient_storage_empty() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_456_000 picoseconds. + Weight::from_parts(3_837_000, 0) + } + fn set_transient_storage_full() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_753_000 picoseconds. + Weight::from_parts(4_915_000, 0) + } + fn get_transient_storage_empty() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_157_000 picoseconds. + Weight::from_parts(3_224_000, 0) + } + fn get_transient_storage_full() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_748_000 picoseconds. + Weight::from_parts(4_056_000, 0) + } + fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_571_000 picoseconds. - Weight::from_parts(1_726_000, 0) + // Minimum execution time: 1_437_000 picoseconds. + Weight::from_parts(1_523_000, 0) } - fn seal_set_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + /// The range of component `o` is `[0, 16384]`. + fn seal_set_transient_storage(n: u32, o: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_305_000 picoseconds. - Weight::from_parts(11_613_000, 0) + // Minimum execution time: 6_171_000 picoseconds. + Weight::from_parts(3_215_064, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(203, 0).saturating_mul(n.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(236, 0).saturating_mul(o.into())) } - fn seal_clear_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + fn seal_clear_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_127_000 picoseconds. - Weight::from_parts(8_395_000, 0) + // Minimum execution time: 2_772_000 picoseconds. + Weight::from_parts(3_120_514, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(231, 0).saturating_mul(n.into())) } - fn seal_get_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_334_000 picoseconds. - Weight::from_parts(6_630_000, 0) + // Minimum execution time: 1_769_000 picoseconds. + Weight::from_parts(2_055_515, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(227, 0).saturating_mul(n.into())) } - fn seal_contains_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + fn seal_contains_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_240_000 picoseconds. - Weight::from_parts(5_137_000, 0) + // Minimum execution time: 1_702_000 picoseconds. + Weight::from_parts(1_877_427, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(113, 0).saturating_mul(n.into())) } - fn seal_take_transient_storage() -> Weight { + /// The range of component `n` is `[0, 16384]`. + fn seal_take_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_862_000 picoseconds. - Weight::from_parts(10_178_000, 0) + // Minimum execution time: 8_600_000 picoseconds. + Weight::from_parts(8_975_836, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(3, 0).saturating_mul(n.into())) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_753_000 picoseconds. - Weight::from_parts(8_991_000, 0) + // Minimum execution time: 8_681_000 picoseconds. + Weight::from_parts(8_895_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1755,12 +1851,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 124_989_000 picoseconds. - Weight::from_parts(120_757_179, 4085) - // Standard Error: 180_229 - .saturating_add(Weight::from_parts(44_556_927, 0).saturating_mul(t.into())) + // Minimum execution time: 126_413_000 picoseconds. + Weight::from_parts(126_832_549, 4085) + // Standard Error: 197_984 + .saturating_add(Weight::from_parts(43_232_174, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(8, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(4, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1775,8 +1871,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 113_376_000 picoseconds. - Weight::from_parts(116_035_000, 3895) + // Minimum execution time: 113_966_000 picoseconds. + Weight::from_parts(116_498_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1794,13 +1890,13 @@ impl WeightInfo for () { fn seal_instantiate(i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `676` - // Estimated: `4127` - // Minimum execution time: 1_866_665_000 picoseconds. - Weight::from_parts(1_878_158_000, 4127) - // Standard Error: 24 - .saturating_add(Weight::from_parts(578, 0).saturating_mul(i.into())) - // Standard Error: 24 - .saturating_add(Weight::from_parts(939, 0).saturating_mul(s.into())) + // Estimated: `4132` + // Minimum execution time: 1_857_056_000 picoseconds. + Weight::from_parts(1_868_503_000, 4132) + // Standard Error: 23 + .saturating_add(Weight::from_parts(579, 0).saturating_mul(i.into())) + // Standard Error: 23 + .saturating_add(Weight::from_parts(935, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1809,64 +1905,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 974_000 picoseconds. - Weight::from_parts(8_785_655, 0) + // Minimum execution time: 948_000 picoseconds. + Weight::from_parts(12_101_598, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_333, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_312, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_380_000 picoseconds. - Weight::from_parts(10_136_026, 0) + // Minimum execution time: 1_391_000 picoseconds. + Weight::from_parts(9_088_457, 0) // Standard Error: 1 - .saturating_add(Weight::from_parts(3_591, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_589, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 737_000 picoseconds. - Weight::from_parts(4_053_205, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_473, 0).saturating_mul(n.into())) + // Minimum execution time: 800_000 picoseconds. + Weight::from_parts(11_056_529, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 818_000 picoseconds. - Weight::from_parts(9_871_804, 0) + // Minimum execution time: 729_000 picoseconds. + Weight::from_parts(9_991_880, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_455, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_928_000 picoseconds. - Weight::from_parts(41_138_853, 0) - // Standard Error: 8 - .saturating_add(Weight::from_parts(5_217, 0).saturating_mul(n.into())) + // Minimum execution time: 43_313_000 picoseconds. + Weight::from_parts(40_779_201, 0) + // Standard Error: 11 + .saturating_add(Weight::from_parts(5_093, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_156_000 picoseconds. - Weight::from_parts(48_476_000, 0) + // Minimum execution time: 47_784_000 picoseconds. + Weight::from_parts(48_901_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_064_000 picoseconds. - Weight::from_parts(13_174_000, 0) + // Minimum execution time: 12_823_000 picoseconds. + Weight::from_parts(12_972_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1876,8 +1972,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_611_000 picoseconds. - Weight::from_parts(18_338_000, 3895) + // Minimum execution time: 18_007_000 picoseconds. + Weight::from_parts(18_587_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1887,8 +1983,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_308_000 picoseconds. - Weight::from_parts(8_622_000, 3820) + // Minimum execution time: 8_436_000 picoseconds. + Weight::from_parts(8_772_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1898,8 +1994,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_377_000 picoseconds. - Weight::from_parts(7_675_000, 3558) + // Minimum execution time: 7_447_000 picoseconds. + Weight::from_parts(7_764_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1907,15 +2003,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 348_000 picoseconds. - Weight::from_parts(390_000, 0) + // Minimum execution time: 346_000 picoseconds. + Weight::from_parts(384_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 357_000 picoseconds. - Weight::from_parts(398_000, 0) + // Minimum execution time: 369_000 picoseconds. + Weight::from_parts(412_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1923,8 +2019,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_678_000 picoseconds. - Weight::from_parts(2_903_000, 1704) + // Minimum execution time: 2_781_000 picoseconds. + Weight::from_parts(3_037_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1932,9 +2028,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 752_000 picoseconds. - Weight::from_parts(721_329, 0) - // Standard Error: 16 - .saturating_add(Weight::from_parts(6_979, 0).saturating_mul(r.into())) + // Minimum execution time: 714_000 picoseconds. + Weight::from_parts(974_967, 0) + // Standard Error: 19 + .saturating_add(Weight::from_parts(7_028, 0).saturating_mul(r.into())) } } From 01365cfabe82a1aec6adf242d5e738643da93763 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 27 Jun 2024 22:58:12 +0200 Subject: [PATCH 28/58] Refactored benchmarks --- .../frame/contracts/src/transient_storage.rs | 39 ++++++++--- substrate/frame/contracts/src/wasm/runtime.rs | 68 +++++++++++++------ 2 files changed, 78 insertions(+), 29 deletions(-) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 2ca1fd0c5bab..07013830ad8d 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -62,7 +62,7 @@ pub struct StorageMeter { impl StorageMeter { const STORAGE_FRACTION_DENOMINATOR: u32 = 16; - + /// Create a new storage allocation meter. pub fn new(memory_limit: u32) -> Self { Self { root_meter: MeterEntry::new(memory_limit), ..Default::default() } } @@ -227,6 +227,7 @@ pub struct TransientStorage { } impl TransientStorage { + /// Create new transient storage with the supplied memory limit. pub fn new(memory_limit: u32) -> Self { TransientStorage { storage: Default::default(), @@ -327,6 +328,7 @@ impl TransientStorage { self.meter.commit(); } + /// The storage allocation meter used for transaction metering. #[cfg(any(test, feature = "runtime-benchmarks"))] pub fn meter(&mut self) -> &mut StorageMeter { return &mut self.meter @@ -343,15 +345,27 @@ impl TransientStorage { #[cfg(test)] mod tests { + use core::u32::MAX; + use super::*; use crate::{ tests::{Test, ALICE, BOB, CHARLIE}, Error, }; + fn allocation_size( + account: &AccountIdOf, + key: &Key, + value: Option>, + ) -> u32 { + let mut storage: TransientStorage = TransientStorage::::new(MAX); + storage.write(account, key, value, false).expect("Could not write to storage."); + storage.meter().current_amount() + } + #[test] fn read_write_works() { - let mut storage = TransientStorage::::new(2048); + let mut storage: TransientStorage = TransientStorage::::new(2048); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1]), false), Ok(WriteOutcome::New) @@ -553,9 +567,9 @@ mod tests { #[test] fn metering_transactions_works() { - // 192 bytes is the allocation overhead, plus 32 bytes for the account and 32 bytes for the - // key. The first transaction can use all the available storage. - let mut storage = TransientStorage::::new((4096 + 256) * 2); + let size = allocation_size(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096])); + + let mut storage = TransientStorage::::new(size * 2); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), @@ -573,7 +587,8 @@ mod tests { #[test] fn metering_nested_transactions_works() { - let mut storage = TransientStorage::::new((4096 + 256) * 3); + let size = allocation_size(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096])); + let mut storage = TransientStorage::::new(size * 3); storage.start_transaction(); assert_eq!( @@ -591,7 +606,8 @@ mod tests { #[test] fn metering_transaction_fails() { - let mut storage = TransientStorage::::new(4096); + let size = allocation_size(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096])); + let mut storage = TransientStorage::::new(size - 1); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), @@ -603,7 +619,8 @@ mod tests { #[test] fn metering_nested_transactions_fails() { - let mut storage = TransientStorage::::new((4096 + 256) * 2); + let size = allocation_size(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096])); + let mut storage = TransientStorage::::new(size * 2); storage.start_transaction(); assert_eq!( @@ -621,7 +638,8 @@ mod tests { #[test] fn metering_nested_transaction_with_rollback_works() { - let mut storage = TransientStorage::::new((4096 + 256) * 2); + let size = allocation_size(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096])); + let mut storage = TransientStorage::::new(size * 2); storage.start_transaction(); let limit = storage.meter.current_limit(); @@ -643,7 +661,8 @@ mod tests { #[test] fn metering_with_rollback_works() { - let mut storage = TransientStorage::::new((4096 + 256) * 5); + let size = allocation_size(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096])); + let mut storage = TransientStorage::::new(size * 5); storage.start_transaction(); assert_eq!( diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index ef1e6cb6a3e6..a9daf9a94755 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -199,15 +199,15 @@ pub enum RuntimeCosts { /// Weight of calling `seal_take_storage` for the given size. TakeStorage(u32), /// Weight of calling `seal_set_transient_storage`. - SetTransientStorage, + SetTransientStorage { old_bytes: u32, new_bytes: u32 }, /// Weight of calling `seal_clear_transient_storage` per cleared byte. - ClearTransientStorage, + ClearTransientStorage(u32), /// Weight of calling `seal_contains_transient_storage` per byte of the checked item. - ContainsTransientStorage, + ContainsTransientStorage(u32), /// Weight of calling `seal_get_transient_storage` with the specified size in storage. - GetTransientStorage, + GetTransientStorage(u32), /// Weight of calling `seal_take_transient_storage` for the given size. - TakeTransientStorage, + TakeTransientStorage(u32), /// Weight of calling `seal_transfer`. Transfer, /// Base weight of calling `seal_call`. @@ -254,10 +254,17 @@ pub enum RuntimeCosts { UnlockDelegateDependency, } -macro_rules! cost_rollback { - // cost_rollback!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::journal_rollback()) +macro_rules! cost_write { + // cost_rollback!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::rollback_transient_storage()).saturating_add(T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty()) ($name:ident $(, $arg:expr )*) => { - (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::rollback_journal())) + (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::rollback_transient_storage()).saturating_add(T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty()))) + }; +} + +macro_rules! cost_read { + // cost_rollback!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::get_transient_storage_full().saturating_sub(T::WeightInfo::get_transient_storage_empty()) + ($name:ident $(, $arg:expr )*) => { + (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::get_transient_storage_full().saturating_sub(T::WeightInfo::get_transient_storage_empty()))) }; } @@ -312,11 +319,12 @@ impl Token for RuntimeCosts { ContainsStorage(len) => T::WeightInfo::seal_contains_storage(len), GetStorage(len) => T::WeightInfo::seal_get_storage(len), TakeStorage(len) => T::WeightInfo::seal_take_storage(len), - SetTransientStorage => cost_rollback!(seal_set_transient_storage), - ClearTransientStorage => cost_rollback!(seal_clear_transient_storage), - ContainsTransientStorage => T::WeightInfo::seal_contains_transient_storage(), - GetTransientStorage => T::WeightInfo::seal_get_transient_storage(), - TakeTransientStorage => cost_rollback!(seal_take_transient_storage), + SetTransientStorage { new_bytes, old_bytes } => + cost_write!(seal_set_transient_storage, new_bytes, old_bytes), + ClearTransientStorage(len) => cost_write!(seal_clear_transient_storage, len), + ContainsTransientStorage(len) => cost_read!(seal_contains_transient_storage, len), + GetTransientStorage(len) => cost_read!(seal_get_transient_storage, len), + TakeTransientStorage(len) => cost_write!(seal_take_transient_storage, len), Transfer => T::WeightInfo::seal_transfer(), CallBase => T::WeightInfo::seal_call(0, 0), DelegateCallBase => T::WeightInfo::seal_delegate_call(), @@ -813,7 +821,7 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { let key = self.decode_key(memory, key_type, key_ptr)?; let outcome = self.ext.get_storage_size(&key); - self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.unwrap_or(0))); + self.adjust_gas(charged, RuntimeCosts::ContainsStorage(outcome.unwrap_or(0))); Ok(outcome.unwrap_or(SENTINEL)) } @@ -826,13 +834,23 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { value_len: u32, ) -> Result { let max_size = self.ext.max_value_size(); - self.charge_gas(RuntimeCosts::SetTransientStorage)?; + let charged = self.charge_gas(RuntimeCosts::SetTransientStorage { + new_bytes: value_len, + old_bytes: max_size, + })?; if value_len > max_size { return Err(Error::::ValueTooLarge.into()) } let key = self.decode_key(memory, key_type, key_ptr)?; let value = Some(self.read_sandbox_memory(memory, value_ptr, value_len)?); let write_outcome = self.ext.set_transient_storage(&key, value, false)?; + self.adjust_gas( + charged, + RuntimeCosts::SetTransientStorage { + new_bytes: value_len, + old_bytes: write_outcome.old_len(), + }, + ); Ok(write_outcome.old_len_with_sentinel()) } @@ -842,9 +860,12 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { key_type: KeyType, key_ptr: u32, ) -> Result { - self.charge_gas(RuntimeCosts::ClearTransientStorage)?; + let charged = + self.charge_gas(RuntimeCosts::ClearTransientStorage(self.ext.max_value_size()))?; let key = self.decode_key(memory, key_type, key_ptr)?; let outcome = self.ext.set_transient_storage(&key, None, false)?; + + self.adjust_gas(charged, RuntimeCosts::ClearTransientStorage(outcome.old_len())); Ok(outcome.old_len_with_sentinel()) } @@ -856,11 +877,13 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { out_ptr: u32, out_len_ptr: u32, ) -> Result { - self.charge_gas(RuntimeCosts::GetTransientStorage)?; + let charged = + self.charge_gas(RuntimeCosts::GetTransientStorage(self.ext.max_value_size()))?; let key = self.decode_key(memory, key_type, key_ptr)?; let outcome = self.ext.get_transient_storage(&key); if let Some(value) = outcome { + self.adjust_gas(charged, RuntimeCosts::GetTransientStorage(value.len() as u32)); self.write_sandbox_output( memory, out_ptr, @@ -871,6 +894,7 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { )?; Ok(ReturnErrorCode::Success) } else { + self.adjust_gas(charged, RuntimeCosts::GetTransientStorage(0)); Ok(ReturnErrorCode::KeyNotFound) } } @@ -881,9 +905,12 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { key_type: KeyType, key_ptr: u32, ) -> Result { - self.charge_gas(RuntimeCosts::ContainsTransientStorage)?; + let charged = + self.charge_gas(RuntimeCosts::ContainsTransientStorage(self.ext.max_value_size()))?; let key = self.decode_key(memory, key_type, key_ptr)?; let outcome = self.ext.get_transient_storage_size(&key); + + self.adjust_gas(charged, RuntimeCosts::ContainsTransientStorage(outcome.unwrap_or(0))); Ok(outcome.unwrap_or(SENTINEL)) } @@ -895,11 +922,13 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { out_ptr: u32, out_len_ptr: u32, ) -> Result { - self.charge_gas(RuntimeCosts::TakeTransientStorage)?; + let charged = + self.charge_gas(RuntimeCosts::TakeTransientStorage(self.ext.max_value_size()))?; let key = self.decode_key(memory, key_type, key_ptr)?; if let crate::storage::WriteOutcome::Taken(value) = self.ext.set_transient_storage(&key, None, true)? { + self.adjust_gas(charged, RuntimeCosts::TakeTransientStorage(value.len() as u32)); self.write_sandbox_output( memory, out_ptr, @@ -910,6 +939,7 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { )?; Ok(ReturnErrorCode::Success) } else { + self.adjust_gas(charged, RuntimeCosts::TakeTransientStorage(0)); Ok(ReturnErrorCode::KeyNotFound) } } From a2dfb2341c8cd0a46813b7f6255c38b10ce2841e Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 28 Jun 2024 12:00:12 +0200 Subject: [PATCH 29/58] Add wasm tests --- .../src/benchmarking/call_builder.rs | 23 +- .../frame/contracts/src/benchmarking/mod.rs | 6 +- .../frame/contracts/src/transient_storage.rs | 16 +- substrate/frame/contracts/src/wasm/mod.rs | 355 +++++++++++++++++- 4 files changed, 368 insertions(+), 32 deletions(-) diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index 19636e05c962..ce9c4ef8234a 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -20,8 +20,8 @@ use crate::{ exec::{Ext, Key, Stack}, storage::meter::Meter, wasm::Runtime, - BalanceOf, Config, DebugBufferVec, Determinism, ExecReturnValue, GasMeter, Origin, Schedule, - TypeInfo, WasmBlob, Weight, + BalanceOf, Config, DebugBufferVec, Determinism, Error, ExecReturnValue, GasMeter, Origin, + Schedule, TypeInfo, WasmBlob, Weight, }; use codec::{Encode, HasCompact}; use core::fmt::Debug; @@ -29,7 +29,7 @@ use frame_benchmarking::benchmarking; use sp_core::Get; use sp_std::prelude::*; -pub type StackExt<'a, T> = Stack<'a, T, WasmBlob>; +type StackExt<'a, T> = Stack<'a, T, WasmBlob>; /// A prepared contract call ready to be executed. pub struct PreparedCall<'a, T: Config> { @@ -161,18 +161,23 @@ where } /// Add transient_storage - pub fn with_transient_storage(ext: &mut StackExt) { + pub fn with_transient_storage(ext: &mut StackExt) -> Result<(), &'static str> { for i in 0u32.. { let mut key_data = i.to_le_bytes().to_vec(); - while key_data.first() == Some(&0) { - key_data.remove(0); + while key_data.last() == Some(&0) { + key_data.pop(); } let key = Key::::try_from_var(key_data).unwrap(); - if ext.set_transient_storage(&key, Some(Vec::new()), false).is_err() { - ext.transient_storage().meter().clear(); - break; + if let Err(e) = ext.set_transient_storage(&key, Some(Vec::new()), false) { + if e == Error::::OutOfTransientStorage.into() { + ext.transient_storage().meter().clear(); + break; + } else { + return Err("Initialization of the transient storage failed"); + } } } + Ok(()) } /// Prepare a call to the module. diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 14b3713d3b9a..a303240e2256 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -1197,7 +1197,7 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext); + CallSetup::::with_transient_storage(&mut ext)?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); let result; #[block] @@ -1247,7 +1247,7 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext); + CallSetup::::with_transient_storage(&mut ext)?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); runtime .ext() @@ -1273,7 +1273,7 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext); + CallSetup::::with_transient_storage(&mut ext)?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); runtime.ext().transient_storage().start_transaction(); runtime diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 07013830ad8d..44934f78e56a 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -344,14 +344,12 @@ impl TransientStorage { #[cfg(test)] mod tests { - - use core::u32::MAX; - use super::*; use crate::{ tests::{Test, ALICE, BOB, CHARLIE}, Error, }; + use core::u32::MAX; fn allocation_size( account: &AccountIdOf, @@ -568,20 +566,23 @@ mod tests { #[test] fn metering_transactions_works() { let size = allocation_size(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096])); - let mut storage = TransientStorage::::new(size * 2); storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); + let limit = storage.meter().current_limit(); storage.commit_transaction(); storage.start_transaction(); + assert_eq!(storage.meter().current_limit() - storage.meter().current_amount(), size); assert_eq!( storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); + assert_eq!(storage.meter().current_limit(), limit - size); + assert_eq!(storage.meter().current_amount() * 2, storage.meter().total_amount()); storage.commit_transaction(); } @@ -591,16 +592,21 @@ mod tests { let mut storage = TransientStorage::::new(size * 3); storage.start_transaction(); + let limit = storage.meter().current_limit(); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.start_transaction(); + assert_eq!(storage.meter().total_amount(), size); + assert!(storage.meter().current_limit() < limit - size); assert_eq!( storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.commit_transaction(); + assert_eq!(storage.meter().current_limit(), limit); + assert_eq!(storage.meter().total_amount(), storage.meter().current_amount()); storage.commit_transaction(); } @@ -634,6 +640,7 @@ mod tests { ); storage.commit_transaction(); storage.commit_transaction(); + assert_eq!(storage.meter.total_amount(), size); } #[test] @@ -656,6 +663,7 @@ mod tests { storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); + assert_eq!(storage.meter().current_amount(), storage.meter().total_amount()); storage.commit_transaction(); } diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index b649f9853576..8877ad040f4a 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -506,6 +506,7 @@ mod tests { primitives::ExecReturnValue, storage::WriteOutcome, tests::{RuntimeCall, Test, ALICE, BOB}, + transient_storage::{self, TransientStorage}, BalanceOf, CodeHash, Error, Origin, Pallet as Contracts, }; use assert_matches::assert_matches; @@ -563,7 +564,7 @@ mod tests { pub struct MockExt { storage: HashMap, Vec>, - transient_storage: HashMap, Vec>, + transient_storage: TransientStorage, instantiates: Vec, terminations: Vec, calls: Vec, @@ -592,7 +593,7 @@ mod tests { Self { code_hashes: Default::default(), storage: Default::default(), - transient_storage: Default::default(), + transient_storage: TransientStorage::new(1024 * 1024), instantiates: Default::default(), terminations: Default::default(), calls: Default::default(), @@ -694,10 +695,10 @@ mod tests { Ok(result) } fn get_transient_storage(&self, key: &Key) -> Option> { - self.transient_storage.get(&key.to_vec()).cloned() + self.transient_storage.read(self.address(), key) } fn get_transient_storage_size(&self, key: &Key) -> Option { - self.transient_storage.get(&key.to_vec()).map(|val| val.len() as u32) + self.transient_storage.read(self.address(), key).map(|value| value.len() as _) } fn set_transient_storage( &mut self, @@ -705,18 +706,8 @@ mod tests { value: Option>, take_old: bool, ) -> Result { - let key = key.to_vec(); - let entry = self.storage.entry(key.clone()); - let result = match (entry, take_old) { - (Entry::Vacant(_), _) => WriteOutcome::New, - (Entry::Occupied(entry), false) => - WriteOutcome::Overwritten(entry.remove().len() as u32), - (Entry::Occupied(entry), true) => WriteOutcome::Taken(entry.remove()), - }; - if let Some(value) = value { - self.transient_storage.insert(key, value); - } - Ok(result) + let account_id = self.address().clone(); + self.transient_storage.write(&account_id, key, value, take_old) } fn caller(&self) -> Origin { self.caller.clone() @@ -3073,6 +3064,338 @@ mod tests { assert_eq!(&result.data[4..], &[0u8; 0]); } + // transient_storage + #[test] + fn set_transient_storage_works() { + const CODE: &str = r#" +(module + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) + (import "seal0" "set_transient_storage" (func $set_transient_storage (param i32 i32 i32 i32) (result i32))) + (import "env" "memory" (memory 1 1)) + + ;; [0, 4) size of input buffer + ;; 4k in little endian + (data (i32.const 0) "\00\10") + + ;; [4, 4100) input buffer + + (func (export "call") + ;; Receive (key ++ value_to_write) + (call $seal_input + (i32.const 4) ;; Pointer to the input buffer + (i32.const 0) ;; Size of the input buffer + ) + ;; Store the passed value to the passed key and store result to memory + (i32.store (i32.const 168) + (call $set_transient_storage + (i32.const 8) ;; key_ptr + (i32.load (i32.const 4)) ;; key_len + (i32.add ;; value_ptr = 8 + key_len + (i32.const 8) + (i32.load (i32.const 4))) + (i32.sub ;; value_len (input_size - (key_len + key_len_len)) + (i32.load (i32.const 0)) + (i32.add + (i32.load (i32.const 4)) + (i32.const 4) + ) + ) + ) + ) + (call $seal_return + (i32.const 0) ;; flags + (i32.const 168) ;; ptr to returned value + (i32.const 4) ;; length of returned value + ) + ) + + (func (export "deploy")) +) +"#; + + let mut ext = MockExt::default(); + + // value did not exist before -> sentinel returned + let input = (32, [1u8; 32], [42u8, 48]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!(u32::from_le_bytes(result.data.try_into().unwrap()), crate::SENTINEL); + assert_eq!( + ext.get_transient_storage(&Key::::try_from_var([1u8; 32].to_vec()).unwrap()), + Some(vec![42, 48]) + ); + + // value do exist -> length of old value returned + let input = (32, [1u8; 32], [0u8; 0]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!(u32::from_le_bytes(result.data.try_into().unwrap()), 2); + assert_eq!( + ext.get_transient_storage(&Key::::try_from_var([1u8; 32].to_vec()).unwrap()), + Some(vec![]) + ); + + // value do exist -> length of old value returned (test for zero sized val) + let input = (32, [1u8; 32], [99u8]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!(u32::from_le_bytes(result.data.try_into().unwrap()), 0); + assert_eq!( + ext.get_transient_storage(&Key::::try_from_var([1u8; 32].to_vec()).unwrap()), + Some(vec![99]) + ); + } + + #[test] + fn get_transient_storage_works() { + const CODE: &str = r#" +(module + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) + (import "seal0" "get_transient_storage" (func $get_transient_storage (param i32 i32 i32 i32) (result i32))) + (import "env" "memory" (memory 1 1)) + + ;; [0, 4) size of input buffer (160 bytes as we copy the key+len here) + (data (i32.const 0) "\A0") + + ;; [4, 8) size of output buffer + ;; 4k in little endian + (data (i32.const 4) "\00\10") + + ;; [8, 168) input buffer + ;; [168, 4264) output buffer + + (func (export "call") + ;; Receive (key ++ value_to_write) + (call $seal_input + (i32.const 8) ;; Pointer to the input buffer + (i32.const 0) ;; Size of the input buffer + ) + ;; Load a storage value and result of this call into the output buffer + (i32.store (i32.const 168) + (call $get_transient_storage + (i32.const 12) ;; key_ptr + (i32.load (i32.const 8)) ;; key_len + (i32.const 172) ;; Pointer to the output buffer + (i32.const 4) ;; Pointer to the size of the buffer + ) + ) + (call $seal_return + (i32.const 0) ;; flags + (i32.const 168) ;; output buffer ptr + (i32.add ;; length: output size + 4 (retval) + (i32.load (i32.const 4)) + (i32.const 4) + ) + ) + ) + + (func (export "deploy")) +) +"#; + + let mut ext = MockExt::default(); + + assert_ok!(ext.set_transient_storage( + &Key::::try_from_var([1u8; 64].to_vec()).unwrap(), + Some(vec![42u8]), + false + )); + assert_ok!(ext.set_transient_storage( + &Key::::try_from_var([2u8; 19].to_vec()).unwrap(), + Some(vec![]), + false + )); + + // value does not exist + let input = (63, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data[0..4].try_into().unwrap()), + ReturnErrorCode::KeyNotFound as u32 + ); + + // value exists + let input = (64, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data[0..4].try_into().unwrap()), + ReturnErrorCode::Success as u32 + ); + assert_eq!(&result.data[4..], &[42u8]); + + // value exists (test for 0 sized) + let input = (19, [2u8; 19]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data[0..4].try_into().unwrap()), + ReturnErrorCode::Success as u32 + ); + assert_eq!(&result.data[4..], &([] as [u8; 0])); + } + + #[test] + fn clear_transient_storage_works() { + const CODE: &str = r#" +(module + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) + (import "seal0" "clear_transient_storage" (func $clear_transient_storage (param i32 i32) (result i32))) + (import "env" "memory" (memory 1 1)) + + ;; size of input buffer + ;; [0, 4) size of input buffer (128+32 = 160 bytes = 0xA0) + (data (i32.const 0) "\A0") + + ;; [4, 164) input buffer + + (func (export "call") + ;; Receive key + (call $seal_input + (i32.const 4) ;; Where we take input and store it + (i32.const 0) ;; Where we take and store the length of thedata + ) + ;; Call seal_clear_storage and save what it returns at 0 + (i32.store (i32.const 0) + (call $clear_transient_storage + (i32.const 8) ;; key_ptr + (i32.load (i32.const 4)) ;; key_len + ) + ) + (call $seal_return + (i32.const 0) ;; flags + (i32.const 0) ;; returned value + (i32.const 4) ;; length of returned value + ) + ) + + (func (export "deploy")) +) +"#; + + let mut ext = MockExt::default(); + + assert_ok!(ext.set_transient_storage( + &Key::::try_from_var([1u8; 64].to_vec()).unwrap(), + Some(vec![42u8]), + false + )); + + // value did not exist + let input = (32, [3u8; 32]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + // sentinel returned + assert_eq!(u32::from_le_bytes(result.data.try_into().unwrap()), crate::SENTINEL); + + // value did exist + let input = (64, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + // length returned + assert_eq!(u32::from_le_bytes(result.data.try_into().unwrap()), 1); + // value cleared + assert_eq!( + ext.get_transient_storage(&Key::::try_from_var([1u8; 64].to_vec()).unwrap()), + None + ); + } + + #[test] + fn take_transient_storage_works() { + const CODE: &str = r#" +(module + (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "seal0" "take_transient_storage" (func $take_transient_storage (param i32 i32 i32 i32) (result i32))) + (import "env" "memory" (memory 1 1)) + + ;; [0, 4) size of input buffer (160 bytes as we copy the key+len here) + (data (i32.const 0) "\A0") + + ;; [4, 8) size of output buffer + ;; 4k in little endian + (data (i32.const 4) "\00\10") + + ;; [8, 168) input buffer + ;; [168, 4264) output buffer + + (func (export "call") + ;; Receive key + (call $seal_input + (i32.const 8) ;; Pointer to the input buffer + (i32.const 0) ;; Size of the length buffer + ) + + ;; Load a storage value and result of this call into the output buffer + (i32.store (i32.const 168) + (call $take_transient_storage + (i32.const 12) ;; key_ptr + (i32.load (i32.const 8)) ;; key_len + (i32.const 172) ;; Pointer to the output buffer + (i32.const 4) ;; Pointer to the size of the buffer + ) + ) + + ;; Return the contents of the buffer + (call $seal_return + (i32.const 0) ;; flags + (i32.const 168) ;; output buffer ptr + (i32.add ;; length: storage size + 4 (retval) + (i32.load (i32.const 4)) + (i32.const 4) + ) + ) + ) + + (func (export "deploy")) +) +"#; + + let mut ext = MockExt::default(); + + assert_ok!(ext.set_transient_storage( + &Key::::try_from_var([1u8; 64].to_vec()).unwrap(), + Some(vec![42u8]), + false + )); + assert_ok!(ext.set_transient_storage( + &Key::::try_from_var([2u8; 19].to_vec()).unwrap(), + Some(vec![]), + false + )); + + // value does not exist -> error returned + let input = (63, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data[0..4].try_into().unwrap()), + ReturnErrorCode::KeyNotFound as u32 + ); + + // value did exist -> value returned + let input = (64, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data[0..4].try_into().unwrap()), + ReturnErrorCode::Success as u32 + ); + assert_eq!( + ext.get_transient_storage(&Key::::try_from_var([1u8; 64].to_vec()).unwrap()), + None + ); + assert_eq!(&result.data[4..], &[42u8]); + + // value did exist -> length returned (test for 0 sized) + let input = (19, [2u8; 19]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data[0..4].try_into().unwrap()), + ReturnErrorCode::Success as u32 + ); + assert_eq!( + ext.get_transient_storage(&Key::::try_from_var([2u8; 19].to_vec()).unwrap()), + None + ); + assert_eq!(&result.data[4..], &[0u8; 0]); + } + #[test] fn is_contract_works() { const CODE_IS_CONTRACT: &str = r#" From ca1a323c5bf4eaae229a1e27c2e2fab862b132e4 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 28 Jun 2024 17:39:37 +0200 Subject: [PATCH 30/58] Add E2E tests --- .../create_transient_storage_and_call.rs | 55 ++++++++++++++++++ .../contracts/set_transient_storage.rs | 41 ++++++++++++++ .../fixtures/contracts/transient_storage.rs | 56 +++++++++++++++++++ substrate/frame/contracts/src/lib.rs | 2 +- substrate/frame/contracts/src/tests.rs | 39 +++++++++++++ .../frame/contracts/src/transient_storage.rs | 2 +- substrate/frame/contracts/src/wasm/mod.rs | 2 +- 7 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs create mode 100644 substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs create mode 100644 substrate/frame/contracts/fixtures/contracts/transient_storage.rs diff --git a/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs b/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs new file mode 100644 index 000000000000..ffdcc8a84fdc --- /dev/null +++ b/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs @@ -0,0 +1,55 @@ +// 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. + +//! This calls another contract as passed as its account id. It also creates some storage. +#![no_std] +#![no_main] + +use common::input; +use uapi::{HostFn, HostFnImpl as api}; + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn deploy() {} + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn call() { + input!( + buffer, + input: [u8; 4], + callee: [u8; 32], + len: u32, + ); + + let data = [0u8; 16 * 1024 + 1]; + let value = &data[..len as usize]; + api::set_transient_storage(buffer, value); + + // Call the callee + api::call_v2( + uapi::CallFlags::empty(), + callee, + 0u64, // How much ref_time weight to devote for the execution. 0 = all. + 0u64, // How much proof_size weight to devote for the execution. 0 = all. + None, + &0u64.to_le_bytes(), // Value transferred to the contract. + input, + None, + ) + .unwrap(); +} diff --git a/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs b/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs new file mode 100644 index 000000000000..fc883adff7da --- /dev/null +++ b/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs @@ -0,0 +1,41 @@ +// 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. + +#![no_std] +#![no_main] + +use common::input; +use uapi::{HostFn, HostFnImpl as api}; + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn deploy() {} + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn call() { + input!(len: u32, ); + + let buffer = [0u8; 16 * 1024 + 1]; + let data = &buffer[..len as usize]; + + // Place a garbage value in transient storage, the size of which is specified by the call input. + let mut key = [0u8; 32]; + key[0] = 1; + + api::set_transient_storage(&key, data); +} diff --git a/substrate/frame/contracts/fixtures/contracts/transient_storage.rs b/substrate/frame/contracts/fixtures/contracts/transient_storage.rs new file mode 100644 index 000000000000..53d50b91174d --- /dev/null +++ b/substrate/frame/contracts/fixtures/contracts/transient_storage.rs @@ -0,0 +1,56 @@ +// 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. + +//! This contract tests the storage APIs. It sets and clears storage values using the different +//! versions of the storage APIs. +#![no_std] +#![no_main] + +use common::unwrap_output; +use uapi::{HostFn, HostFnImpl as api}; + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn deploy() {} + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn call() { + const KEY: [u8; 32] = [1u8; 32]; + const VALUE_1: [u8; 4] = [1u8; 4]; + const VALUE_2: [u8; 4] = [2u8; 4]; + const VALUE_3: [u8; 4] = [3u8; 4]; + + let existing = api::set_transient_storage(&KEY, &VALUE_1); + assert_eq!(existing, None); + assert_eq!(api::contains_transient_storage(&KEY), Some(VALUE_1.len() as _)); + unwrap_output!(val, [0u8; 4], api::get_transient_storage, &KEY); + assert_eq!(**val, VALUE_1); + + let existing = api::set_transient_storage(&KEY, &VALUE_2); + assert_eq!(existing, Some(VALUE_1.len() as _)); + unwrap_output!(val, [0u8; 4], api::get_transient_storage, &KEY); + assert_eq!(**val, VALUE_2); + + api::clear_transient_storage(&KEY); + assert_eq!(api::contains_storage(&KEY), None); + + let existing = api::set_transient_storage(&KEY, &VALUE_3); + assert_eq!(existing, None); + unwrap_output!(val, [0u8; 32], api::take_transient_storage, &KEY); + assert_eq!(**val, VALUE_3); +} diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 7f0544d0391b..d8775185eb50 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -560,7 +560,7 @@ pub mod pallet { type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxDelegateDependencies = MaxDelegateDependencies; type MaxStorageKeyLen = ConstU32<128>; - type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; + type MaxTransientStorageLen = ConstU32<{ 4 * 1024 }>; type Migrations = (); type Time = Self; type Randomness = Self; diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index c20577a3f645..74e21efd39f7 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -962,6 +962,45 @@ fn storage_max_value_limit() { }); } +#[test] +fn transient_storage_work() { + let (code, _code_hash) = compile_module::("transient_storage").unwrap(); + + ExtBuilder::default().build().execute_with(|| { + let _ = ::Currency::set_balance(&ALICE, 1_000_000); + let min_balance = Contracts::min_balance(); + let addr = builder::bare_instantiate(Code::Upload(code)) + .value(min_balance * 100) + .build_and_unwrap_account_id(); + + builder::bare_call(addr).build_and_unwrap_result(); + }); +} + +#[test] +fn transient_storage_limit_in_nested_call() { + let (wasm_caller, _code_hash_caller) = + compile_module::("create_transient_storage_and_call").unwrap(); + let (wasm_callee, _code_hash_callee) = compile_module::("set_transient_storage").unwrap(); + ExtBuilder::default().build().execute_with(|| { + let _ = ::Currency::set_balance(&ALICE, 1_000_000); + let min_balance = Contracts::min_balance(); + + // Create both contracts: Constructors do nothing. + let addr_caller = + builder::bare_instantiate(Code::Upload(wasm_caller)).value(min_balance * 100).build_and_unwrap_account_id(); + let addr_callee = + builder::bare_instantiate(Code::Upload(wasm_callee)).value(min_balance * 100).build_and_unwrap_account_id(); + + assert_err_ignore_postinfo!( + builder::call(addr_caller) + .data((10u32, &addr_callee, 10_000u32).encode()) + .build(), + >::OutOfTransientStorage, + ); + }); +} + #[test] fn deploy_and_call_other_contract() { let (caller_wasm, _caller_code_hash) = compile_module::("caller_contract").unwrap(); diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 44934f78e56a..ce8c2eebe7b6 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -109,7 +109,7 @@ impl StorageMeter { } /// Clear a transaction meter - #[cfg(any(test, feature = "runtime-benchmarks"))] + #[cfg(feature = "runtime-benchmarks")] pub fn clear(&mut self) { self.nested_meters.clear(); self.root_meter.amount = 0; diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 8877ad040f4a..396a1080d278 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -506,7 +506,7 @@ mod tests { primitives::ExecReturnValue, storage::WriteOutcome, tests::{RuntimeCall, Test, ALICE, BOB}, - transient_storage::{self, TransientStorage}, + transient_storage::TransientStorage, BalanceOf, CodeHash, Error, Origin, Pallet as Contracts, }; use assert_matches::assert_matches; From 6d8dc05593d136d5e36693984e4eec637bb52d97 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Fri, 28 Jun 2024 16:32:55 +0000 Subject: [PATCH 31/58] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 878 +++++++++++------------ 1 file changed, 439 insertions(+), 439 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index 23b0a872a9ca..0eda59aa4158 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/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 32.0.0 -//! DATE: 2024-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-06-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `runner-7wrmsoux-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` @@ -137,8 +137,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_937_000 picoseconds. - Weight::from_parts(1_999_000, 1627) + // Minimum execution time: 1_847_000 picoseconds. + Weight::from_parts(1_905_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -148,10 +148,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_396_000 picoseconds. - Weight::from_parts(11_740_000, 442) - // Standard Error: 1_717 - .saturating_add(Weight::from_parts(1_184_048, 0).saturating_mul(k.into())) + // Minimum execution time: 10_732_000 picoseconds. + Weight::from_parts(11_004_000, 442) + // Standard Error: 1_793 + .saturating_add(Weight::from_parts(1_230_603, 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)) @@ -165,10 +165,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_651_000 picoseconds. - Weight::from_parts(4_745_475, 6149) + // Minimum execution time: 7_703_000 picoseconds. + Weight::from_parts(4_323_140, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_635, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -181,8 +181,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_479_000 picoseconds. - Weight::from_parts(17_172_000, 6450) + // Minimum execution time: 16_011_000 picoseconds. + Weight::from_parts(17_043_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -195,10 +195,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_127_000 picoseconds. - Weight::from_parts(3_194_000, 3635) - // Standard Error: 616 - .saturating_add(Weight::from_parts(1_144_683, 0).saturating_mul(k.into())) + // Minimum execution time: 3_128_000 picoseconds. + Weight::from_parts(3_173_000, 3635) + // Standard Error: 654 + .saturating_add(Weight::from_parts(1_110_890, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -217,10 +217,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_217_000 picoseconds. - Weight::from_parts(15_663_753, 6263) + // Minimum execution time: 14_921_000 picoseconds. + Weight::from_parts(15_612_273, 6263) // Standard Error: 2 - .saturating_add(Weight::from_parts(425, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(418, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -231,8 +231,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_664_000 picoseconds. - Weight::from_parts(13_177_000, 6380) + // Minimum execution time: 11_955_000 picoseconds. + Weight::from_parts(12_583_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -246,8 +246,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 47_615_000 picoseconds. - Weight::from_parts(49_024_000, 6292) + // Minimum execution time: 47_089_000 picoseconds. + Weight::from_parts(48_541_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -259,8 +259,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 54_439_000 picoseconds. - Weight::from_parts(59_533_000, 6534) + // Minimum execution time: 52_300_000 picoseconds. + Weight::from_parts(53_751_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -270,8 +270,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 12_116_000 picoseconds. - Weight::from_parts(12_414_000, 6349) + // Minimum execution time: 11_739_000 picoseconds. + Weight::from_parts(11_924_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -281,8 +281,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_264_000, 1627) + // Minimum execution time: 2_120_000 picoseconds. + Weight::from_parts(2_208_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -294,8 +294,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_993_000 picoseconds. - Weight::from_parts(11_358_000, 3631) + // Minimum execution time: 10_800_000 picoseconds. + Weight::from_parts(11_293_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -305,8 +305,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_293_000 picoseconds. - Weight::from_parts(4_531_000, 3607) + // Minimum execution time: 4_523_000 picoseconds. + Weight::from_parts(4_675_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -317,8 +317,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_528_000 picoseconds. - Weight::from_parts(5_761_000, 3632) + // Minimum execution time: 5_705_000 picoseconds. + Weight::from_parts(5_934_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -329,8 +329,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_426_000 picoseconds. - Weight::from_parts(5_692_000, 3607) + // Minimum execution time: 5_563_000 picoseconds. + Weight::from_parts(5_759_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -351,10 +351,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `800 + c * (1 ±0)` // Estimated: `4266 + c * (1 ±0)` - // Minimum execution time: 264_205_000 picoseconds. - Weight::from_parts(268_661_799, 4266) - // Standard Error: 5 - .saturating_add(Weight::from_parts(796, 0).saturating_mul(c.into())) + // Minimum execution time: 246_043_000 picoseconds. + Weight::from_parts(258_567_009, 4266) + // Standard Error: 10 + .saturating_add(Weight::from_parts(1_071, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -382,14 +382,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_571_933_000 picoseconds. - Weight::from_parts(4_813_995_000, 6262) - // Standard Error: 311 - .saturating_add(Weight::from_parts(38_636, 0).saturating_mul(c.into())) - // Standard Error: 37 - .saturating_add(Weight::from_parts(516, 0).saturating_mul(i.into())) - // Standard Error: 37 - .saturating_add(Weight::from_parts(523, 0).saturating_mul(s.into())) + // Minimum execution time: 4_647_328_000 picoseconds. + Weight::from_parts(27_062_930, 6262) + // Standard Error: 185 + .saturating_add(Weight::from_parts(57_634, 0).saturating_mul(c.into())) + // Standard Error: 22 + .saturating_add(Weight::from_parts(2_185, 0).saturating_mul(i.into())) + // Standard Error: 22 + .saturating_add(Weight::from_parts(2_465, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -415,12 +415,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4017` - // Minimum execution time: 2_213_558_000 picoseconds. - Weight::from_parts(2_261_695_000, 4017) - // Standard Error: 33 - .saturating_add(Weight::from_parts(942, 0).saturating_mul(i.into())) - // Standard Error: 33 - .saturating_add(Weight::from_parts(973, 0).saturating_mul(s.into())) + // Minimum execution time: 2_248_169_000 picoseconds. + Weight::from_parts(2_281_849_000, 4017) + // Standard Error: 35 + .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(i.into())) + // Standard Error: 35 + .saturating_add(Weight::from_parts(993, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -440,8 +440,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 169_671_000 picoseconds. - Weight::from_parts(174_356_000, 4291) + // Minimum execution time: 165_105_000 picoseconds. + Weight::from_parts(168_941_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -458,10 +458,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 229_319_000 picoseconds. - Weight::from_parts(221_512_691, 3607) - // Standard Error: 219 - .saturating_add(Weight::from_parts(53_141, 0).saturating_mul(c.into())) + // Minimum execution time: 241_997_000 picoseconds. + Weight::from_parts(241_560_387, 3607) + // Standard Error: 64 + .saturating_add(Weight::from_parts(51_887, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -478,10 +478,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 238_249_000 picoseconds. - Weight::from_parts(278_776_471, 3607) - // Standard Error: 107 - .saturating_add(Weight::from_parts(52_097, 0).saturating_mul(c.into())) + // Minimum execution time: 236_134_000 picoseconds. + Weight::from_parts(240_786_320, 3607) + // Standard Error: 71 + .saturating_add(Weight::from_parts(52_250, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -497,8 +497,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_158_000 picoseconds. - Weight::from_parts(40_370_000, 3780) + // Minimum execution time: 39_146_000 picoseconds. + Weight::from_parts(40_274_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -512,8 +512,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_001_000 picoseconds. - Weight::from_parts(25_739_000, 6492) + // Minimum execution time: 25_363_000 picoseconds. + Weight::from_parts(26_598_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -522,17 +522,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_408_000 picoseconds. - Weight::from_parts(9_835_104, 0) - // Standard Error: 100 - .saturating_add(Weight::from_parts(51_219, 0).saturating_mul(r.into())) + // Minimum execution time: 8_569_000 picoseconds. + Weight::from_parts(9_300_084, 0) + // Standard Error: 108 + .saturating_add(Weight::from_parts(52_313, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 697_000 picoseconds. - Weight::from_parts(736_000, 0) + // Minimum execution time: 707_000 picoseconds. + Weight::from_parts(730_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -540,8 +540,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_088_000 picoseconds. - Weight::from_parts(6_397_000, 3819) + // Minimum execution time: 6_210_000 picoseconds. + Weight::from_parts(6_574_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -550,79 +550,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_508_000 picoseconds. - Weight::from_parts(7_691_000, 3912) + // Minimum execution time: 7_466_000 picoseconds. + Weight::from_parts(7_597_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 783_000 picoseconds. - Weight::from_parts(853_000, 0) + // Minimum execution time: 815_000 picoseconds. + Weight::from_parts(850_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 410_000 picoseconds. - Weight::from_parts(437_000, 0) + // Minimum execution time: 423_000 picoseconds. + Weight::from_parts(460_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 340_000 picoseconds. - Weight::from_parts(365_000, 0) + // Minimum execution time: 359_000 picoseconds. + Weight::from_parts(383_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 598_000 picoseconds. - Weight::from_parts(663_000, 0) + // Minimum execution time: 642_000 picoseconds. + Weight::from_parts(662_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 672_000 picoseconds. - Weight::from_parts(724_000, 0) + // Minimum execution time: 698_000 picoseconds. + Weight::from_parts(745_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_407_000 picoseconds. - Weight::from_parts(4_620_000, 0) + // Minimum execution time: 4_309_000 picoseconds. + Weight::from_parts(4_551_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 575_000 picoseconds. - Weight::from_parts(623_000, 0) + // Minimum execution time: 581_000 picoseconds. + Weight::from_parts(622_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 595_000 picoseconds. - Weight::from_parts(637_000, 0) + // Minimum execution time: 534_000 picoseconds. + Weight::from_parts(603_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 560_000 picoseconds. - Weight::from_parts(618_000, 0) + // Minimum execution time: 576_000 picoseconds. + Weight::from_parts(629_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 524_000 picoseconds. - Weight::from_parts(609_000, 0) + // Minimum execution time: 586_000 picoseconds. + Weight::from_parts(618_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -630,8 +630,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_264_000 picoseconds. - Weight::from_parts(4_464_000, 1552) + // Minimum execution time: 4_114_000 picoseconds. + Weight::from_parts(4_266_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -639,20 +639,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 527_000 picoseconds. - Weight::from_parts(547_000, 0) + // Minimum execution time: 525_000 picoseconds. + Weight::from_parts(554_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(300, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(301, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 399_000 picoseconds. - Weight::from_parts(409_000, 0) - // Standard Error: 10 - .saturating_add(Weight::from_parts(408, 0).saturating_mul(n.into())) + // Minimum execution time: 355_000 picoseconds. + Weight::from_parts(414_000, 0) + // Standard Error: 9 + .saturating_add(Weight::from_parts(411, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -665,10 +665,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_210_000 picoseconds. - Weight::from_parts(15_349_133, 3784) - // Standard Error: 7_527 - .saturating_add(Weight::from_parts(3_564_903, 0).saturating_mul(n.into())) + // Minimum execution time: 13_189_000 picoseconds. + Weight::from_parts(15_521_424, 3784) + // Standard Error: 7_042 + .saturating_add(Weight::from_parts(3_540_946, 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(3_u64)) @@ -681,8 +681,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_350_000 picoseconds. - Weight::from_parts(3_494_000, 1561) + // Minimum execution time: 3_318_000 picoseconds. + Weight::from_parts(3_502_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -693,12 +693,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_610_000 picoseconds. - Weight::from_parts(3_761_045, 990) - // Standard Error: 5_750 - .saturating_add(Weight::from_parts(2_072_190, 0).saturating_mul(t.into())) + // Minimum execution time: 4_046_000 picoseconds. + Weight::from_parts(4_283_714, 990) + // Standard Error: 5_982 + .saturating_add(Weight::from_parts(2_087_616, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(22, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(17, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -708,8 +708,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 424_000 picoseconds. - Weight::from_parts(439_000, 0) + // Minimum execution time: 455_000 picoseconds. + Weight::from_parts(472_000, 0) // Standard Error: 10 .saturating_add(Weight::from_parts(1_210, 0).saturating_mul(i.into())) } @@ -721,12 +721,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_214_000 picoseconds. - Weight::from_parts(8_653_412, 249) + // Minimum execution time: 8_954_000 picoseconds. + Weight::from_parts(8_623_673, 249) // Standard Error: 1 - .saturating_add(Weight::from_parts(262, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(259, 0).saturating_mul(n.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(64, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(60, 0).saturating_mul(o.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(o.into())) @@ -738,10 +738,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_482_000 picoseconds. - Weight::from_parts(8_180_823, 248) + // Minimum execution time: 7_206_000 picoseconds. + Weight::from_parts(8_004_406, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(94, 0).saturating_mul(n.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(n.into())) @@ -753,10 +753,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_922_000 picoseconds. - Weight::from_parts(7_810_093, 248) - // Standard Error: 1 - .saturating_add(Weight::from_parts(617, 0).saturating_mul(n.into())) + // Minimum execution time: 6_954_000 picoseconds. + Weight::from_parts(7_884_753, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(608, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -767,10 +767,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_319_000 picoseconds. - Weight::from_parts(7_113_817, 248) + // Minimum execution time: 6_338_000 picoseconds. + Weight::from_parts(7_024_910, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -781,10 +781,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_861_000 picoseconds. - Weight::from_parts(8_757_100, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(627, 0).saturating_mul(n.into())) + // Minimum execution time: 7_311_000 picoseconds. + Weight::from_parts(8_532_828, 248) + // Standard Error: 5 + .saturating_add(Weight::from_parts(626, 0).saturating_mul(n.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(n.into())) @@ -793,36 +793,36 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_456_000 picoseconds. - Weight::from_parts(3_837_000, 0) + // Minimum execution time: 3_480_000 picoseconds. + Weight::from_parts(3_792_000, 0) } fn set_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_753_000 picoseconds. - Weight::from_parts(4_915_000, 0) + // Minimum execution time: 5_033_000 picoseconds. + Weight::from_parts(5_773_000, 0) } fn get_transient_storage_empty() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_157_000 picoseconds. - Weight::from_parts(3_224_000, 0) + // Minimum execution time: 3_070_000 picoseconds. + Weight::from_parts(3_166_000, 0) } fn get_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_748_000 picoseconds. - Weight::from_parts(4_056_000, 0) + // Minimum execution time: 4_004_000 picoseconds. + Weight::from_parts(4_592_000, 0) } fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_437_000 picoseconds. - Weight::from_parts(1_523_000, 0) + // Minimum execution time: 1_770_000 picoseconds. + Weight::from_parts(2_182_000, 0) } /// The range of component `n` is `[0, 16384]`. /// The range of component `o` is `[0, 16384]`. @@ -830,11 +830,11 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_171_000 picoseconds. - Weight::from_parts(3_215_064, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(203, 0).saturating_mul(n.into())) - // Standard Error: 1 + // Minimum execution time: 6_127_000 picoseconds. + Weight::from_parts(3_326_103, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(196, 0).saturating_mul(n.into())) + // Standard Error: 2 .saturating_add(Weight::from_parts(236, 0).saturating_mul(o.into())) } /// The range of component `n` is `[0, 16384]`. @@ -842,47 +842,47 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_772_000 picoseconds. - Weight::from_parts(3_120_514, 0) + // Minimum execution time: 2_737_000 picoseconds. + Weight::from_parts(3_076_732, 0) // Standard Error: 1 - .saturating_add(Weight::from_parts(231, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(235, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_769_000 picoseconds. - Weight::from_parts(2_055_515, 0) + // Minimum execution time: 1_840_000 picoseconds. + Weight::from_parts(2_069_155, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(227, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(223, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_contains_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_702_000 picoseconds. - Weight::from_parts(1_877_427, 0) + // Minimum execution time: 1_632_000 picoseconds. + Weight::from_parts(1_831_601, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(113, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(114, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_take_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_600_000 picoseconds. - Weight::from_parts(8_975_836, 0) - // Standard Error: 2 + // Minimum execution time: 8_620_000 picoseconds. + Weight::from_parts(8_975_587, 0) + // Standard Error: 3 .saturating_add(Weight::from_parts(3, 0).saturating_mul(n.into())) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_681_000 picoseconds. - Weight::from_parts(8_895_000, 0) + // Minimum execution time: 8_575_000 picoseconds. + Weight::from_parts(8_822_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -898,12 +898,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 126_413_000 picoseconds. - Weight::from_parts(126_832_549, 4085) - // Standard Error: 197_984 - .saturating_add(Weight::from_parts(43_232_174, 0).saturating_mul(t.into())) + // Minimum execution time: 122_879_000 picoseconds. + Weight::from_parts(118_946_943, 4085) + // Standard Error: 178_620 + .saturating_add(Weight::from_parts(44_449_408, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(4, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(7, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -918,8 +918,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 113_966_000 picoseconds. - Weight::from_parts(116_498_000, 3895) + // Minimum execution time: 111_844_000 picoseconds. + Weight::from_parts(116_455_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -938,12 +938,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4132` - // Minimum execution time: 1_857_056_000 picoseconds. - Weight::from_parts(1_868_503_000, 4132) - // Standard Error: 23 - .saturating_add(Weight::from_parts(579, 0).saturating_mul(i.into())) - // Standard Error: 23 - .saturating_add(Weight::from_parts(935, 0).saturating_mul(s.into())) + // Minimum execution time: 1_896_838_000 picoseconds. + Weight::from_parts(1_918_193_000, 4132) + // Standard Error: 28 + .saturating_add(Weight::from_parts(641, 0).saturating_mul(i.into())) + // Standard Error: 28 + .saturating_add(Weight::from_parts(996, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -952,64 +952,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 948_000 picoseconds. - Weight::from_parts(12_101_598, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_312, 0).saturating_mul(n.into())) + // Minimum execution time: 879_000 picoseconds. + Weight::from_parts(8_480_018, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_328, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_391_000 picoseconds. - Weight::from_parts(9_088_457, 0) + // Minimum execution time: 1_472_000 picoseconds. + Weight::from_parts(12_900_224, 0) // Standard Error: 1 - .saturating_add(Weight::from_parts(3_589, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_597, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 800_000 picoseconds. - Weight::from_parts(11_056_529, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) + // Minimum execution time: 775_000 picoseconds. + Weight::from_parts(9_895_369, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_463, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 729_000 picoseconds. - Weight::from_parts(9_991_880, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_455, 0).saturating_mul(n.into())) + // Minimum execution time: 730_000 picoseconds. + Weight::from_parts(8_105_347, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_464, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_313_000 picoseconds. - Weight::from_parts(40_779_201, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(5_093, 0).saturating_mul(n.into())) + // Minimum execution time: 42_581_000 picoseconds. + Weight::from_parts(40_545_608, 0) + // Standard Error: 10 + .saturating_add(Weight::from_parts(5_128, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_784_000 picoseconds. - Weight::from_parts(48_901_000, 0) + // Minimum execution time: 48_295_000 picoseconds. + Weight::from_parts(49_412_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_823_000 picoseconds. - Weight::from_parts(12_972_000, 0) + // Minimum execution time: 13_287_000 picoseconds. + Weight::from_parts(13_447_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1019,8 +1019,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 18_007_000 picoseconds. - Weight::from_parts(18_587_000, 3895) + // Minimum execution time: 17_815_000 picoseconds. + Weight::from_parts(18_536_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1030,8 +1030,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_436_000 picoseconds. - Weight::from_parts(8_772_000, 3820) + // Minimum execution time: 8_140_000 picoseconds. + Weight::from_parts(8_538_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1041,8 +1041,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_447_000 picoseconds. - Weight::from_parts(7_764_000, 3558) + // Minimum execution time: 7_253_000 picoseconds. + Weight::from_parts(7_662_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1050,15 +1050,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 346_000 picoseconds. - Weight::from_parts(384_000, 0) + // Minimum execution time: 340_000 picoseconds. + Weight::from_parts(373_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 369_000 picoseconds. - Weight::from_parts(412_000, 0) + // Minimum execution time: 353_000 picoseconds. + Weight::from_parts(392_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1066,8 +1066,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_781_000 picoseconds. - Weight::from_parts(3_037_000, 1704) + // Minimum execution time: 2_827_000 picoseconds. + Weight::from_parts(2_924_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1075,10 +1075,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_000 picoseconds. - Weight::from_parts(974_967, 0) - // Standard Error: 19 - .saturating_add(Weight::from_parts(7_028, 0).saturating_mul(r.into())) + // Minimum execution time: 843_000 picoseconds. + Weight::from_parts(919_937, 0) + // Standard Error: 21 + .saturating_add(Weight::from_parts(7_087, 0).saturating_mul(r.into())) } } @@ -1090,8 +1090,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_937_000 picoseconds. - Weight::from_parts(1_999_000, 1627) + // Minimum execution time: 1_847_000 picoseconds. + Weight::from_parts(1_905_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1101,10 +1101,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_396_000 picoseconds. - Weight::from_parts(11_740_000, 442) - // Standard Error: 1_717 - .saturating_add(Weight::from_parts(1_184_048, 0).saturating_mul(k.into())) + // Minimum execution time: 10_732_000 picoseconds. + Weight::from_parts(11_004_000, 442) + // Standard Error: 1_793 + .saturating_add(Weight::from_parts(1_230_603, 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)) @@ -1118,10 +1118,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_651_000 picoseconds. - Weight::from_parts(4_745_475, 6149) + // Minimum execution time: 7_703_000 picoseconds. + Weight::from_parts(4_323_140, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_635, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1134,8 +1134,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_479_000 picoseconds. - Weight::from_parts(17_172_000, 6450) + // Minimum execution time: 16_011_000 picoseconds. + Weight::from_parts(17_043_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1148,10 +1148,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_127_000 picoseconds. - Weight::from_parts(3_194_000, 3635) - // Standard Error: 616 - .saturating_add(Weight::from_parts(1_144_683, 0).saturating_mul(k.into())) + // Minimum execution time: 3_128_000 picoseconds. + Weight::from_parts(3_173_000, 3635) + // Standard Error: 654 + .saturating_add(Weight::from_parts(1_110_890, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1170,10 +1170,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 15_217_000 picoseconds. - Weight::from_parts(15_663_753, 6263) + // Minimum execution time: 14_921_000 picoseconds. + Weight::from_parts(15_612_273, 6263) // Standard Error: 2 - .saturating_add(Weight::from_parts(425, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(418, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1184,8 +1184,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_664_000 picoseconds. - Weight::from_parts(13_177_000, 6380) + // Minimum execution time: 11_955_000 picoseconds. + Weight::from_parts(12_583_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1199,8 +1199,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 47_615_000 picoseconds. - Weight::from_parts(49_024_000, 6292) + // Minimum execution time: 47_089_000 picoseconds. + Weight::from_parts(48_541_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1212,8 +1212,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 54_439_000 picoseconds. - Weight::from_parts(59_533_000, 6534) + // Minimum execution time: 52_300_000 picoseconds. + Weight::from_parts(53_751_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1223,8 +1223,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 12_116_000 picoseconds. - Weight::from_parts(12_414_000, 6349) + // Minimum execution time: 11_739_000 picoseconds. + Weight::from_parts(11_924_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1234,8 +1234,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_264_000, 1627) + // Minimum execution time: 2_120_000 picoseconds. + Weight::from_parts(2_208_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1247,8 +1247,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_993_000 picoseconds. - Weight::from_parts(11_358_000, 3631) + // Minimum execution time: 10_800_000 picoseconds. + Weight::from_parts(11_293_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1258,8 +1258,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_293_000 picoseconds. - Weight::from_parts(4_531_000, 3607) + // Minimum execution time: 4_523_000 picoseconds. + Weight::from_parts(4_675_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1270,8 +1270,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_528_000 picoseconds. - Weight::from_parts(5_761_000, 3632) + // Minimum execution time: 5_705_000 picoseconds. + Weight::from_parts(5_934_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1282,8 +1282,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_426_000 picoseconds. - Weight::from_parts(5_692_000, 3607) + // Minimum execution time: 5_563_000 picoseconds. + Weight::from_parts(5_759_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1304,10 +1304,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `800 + c * (1 ±0)` // Estimated: `4266 + c * (1 ±0)` - // Minimum execution time: 264_205_000 picoseconds. - Weight::from_parts(268_661_799, 4266) - // Standard Error: 5 - .saturating_add(Weight::from_parts(796, 0).saturating_mul(c.into())) + // Minimum execution time: 246_043_000 picoseconds. + Weight::from_parts(258_567_009, 4266) + // Standard Error: 10 + .saturating_add(Weight::from_parts(1_071, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1335,14 +1335,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_571_933_000 picoseconds. - Weight::from_parts(4_813_995_000, 6262) - // Standard Error: 311 - .saturating_add(Weight::from_parts(38_636, 0).saturating_mul(c.into())) - // Standard Error: 37 - .saturating_add(Weight::from_parts(516, 0).saturating_mul(i.into())) - // Standard Error: 37 - .saturating_add(Weight::from_parts(523, 0).saturating_mul(s.into())) + // Minimum execution time: 4_647_328_000 picoseconds. + Weight::from_parts(27_062_930, 6262) + // Standard Error: 185 + .saturating_add(Weight::from_parts(57_634, 0).saturating_mul(c.into())) + // Standard Error: 22 + .saturating_add(Weight::from_parts(2_185, 0).saturating_mul(i.into())) + // Standard Error: 22 + .saturating_add(Weight::from_parts(2_465, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1368,12 +1368,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4017` - // Minimum execution time: 2_213_558_000 picoseconds. - Weight::from_parts(2_261_695_000, 4017) - // Standard Error: 33 - .saturating_add(Weight::from_parts(942, 0).saturating_mul(i.into())) - // Standard Error: 33 - .saturating_add(Weight::from_parts(973, 0).saturating_mul(s.into())) + // Minimum execution time: 2_248_169_000 picoseconds. + Weight::from_parts(2_281_849_000, 4017) + // Standard Error: 35 + .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(i.into())) + // Standard Error: 35 + .saturating_add(Weight::from_parts(993, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1393,8 +1393,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 169_671_000 picoseconds. - Weight::from_parts(174_356_000, 4291) + // Minimum execution time: 165_105_000 picoseconds. + Weight::from_parts(168_941_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1411,10 +1411,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 229_319_000 picoseconds. - Weight::from_parts(221_512_691, 3607) - // Standard Error: 219 - .saturating_add(Weight::from_parts(53_141, 0).saturating_mul(c.into())) + // Minimum execution time: 241_997_000 picoseconds. + Weight::from_parts(241_560_387, 3607) + // Standard Error: 64 + .saturating_add(Weight::from_parts(51_887, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1431,10 +1431,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 238_249_000 picoseconds. - Weight::from_parts(278_776_471, 3607) - // Standard Error: 107 - .saturating_add(Weight::from_parts(52_097, 0).saturating_mul(c.into())) + // Minimum execution time: 236_134_000 picoseconds. + Weight::from_parts(240_786_320, 3607) + // Standard Error: 71 + .saturating_add(Weight::from_parts(52_250, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1450,8 +1450,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_158_000 picoseconds. - Weight::from_parts(40_370_000, 3780) + // Minimum execution time: 39_146_000 picoseconds. + Weight::from_parts(40_274_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1465,8 +1465,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_001_000 picoseconds. - Weight::from_parts(25_739_000, 6492) + // Minimum execution time: 25_363_000 picoseconds. + Weight::from_parts(26_598_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1475,17 +1475,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_408_000 picoseconds. - Weight::from_parts(9_835_104, 0) - // Standard Error: 100 - .saturating_add(Weight::from_parts(51_219, 0).saturating_mul(r.into())) + // Minimum execution time: 8_569_000 picoseconds. + Weight::from_parts(9_300_084, 0) + // Standard Error: 108 + .saturating_add(Weight::from_parts(52_313, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 697_000 picoseconds. - Weight::from_parts(736_000, 0) + // Minimum execution time: 707_000 picoseconds. + Weight::from_parts(730_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1493,8 +1493,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_088_000 picoseconds. - Weight::from_parts(6_397_000, 3819) + // Minimum execution time: 6_210_000 picoseconds. + Weight::from_parts(6_574_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1503,79 +1503,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_508_000 picoseconds. - Weight::from_parts(7_691_000, 3912) + // Minimum execution time: 7_466_000 picoseconds. + Weight::from_parts(7_597_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 783_000 picoseconds. - Weight::from_parts(853_000, 0) + // Minimum execution time: 815_000 picoseconds. + Weight::from_parts(850_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 410_000 picoseconds. - Weight::from_parts(437_000, 0) + // Minimum execution time: 423_000 picoseconds. + Weight::from_parts(460_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 340_000 picoseconds. - Weight::from_parts(365_000, 0) + // Minimum execution time: 359_000 picoseconds. + Weight::from_parts(383_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 598_000 picoseconds. - Weight::from_parts(663_000, 0) + // Minimum execution time: 642_000 picoseconds. + Weight::from_parts(662_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 672_000 picoseconds. - Weight::from_parts(724_000, 0) + // Minimum execution time: 698_000 picoseconds. + Weight::from_parts(745_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_407_000 picoseconds. - Weight::from_parts(4_620_000, 0) + // Minimum execution time: 4_309_000 picoseconds. + Weight::from_parts(4_551_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 575_000 picoseconds. - Weight::from_parts(623_000, 0) + // Minimum execution time: 581_000 picoseconds. + Weight::from_parts(622_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 595_000 picoseconds. - Weight::from_parts(637_000, 0) + // Minimum execution time: 534_000 picoseconds. + Weight::from_parts(603_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 560_000 picoseconds. - Weight::from_parts(618_000, 0) + // Minimum execution time: 576_000 picoseconds. + Weight::from_parts(629_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 524_000 picoseconds. - Weight::from_parts(609_000, 0) + // Minimum execution time: 586_000 picoseconds. + Weight::from_parts(618_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1583,8 +1583,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_264_000 picoseconds. - Weight::from_parts(4_464_000, 1552) + // Minimum execution time: 4_114_000 picoseconds. + Weight::from_parts(4_266_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1592,20 +1592,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 527_000 picoseconds. - Weight::from_parts(547_000, 0) + // Minimum execution time: 525_000 picoseconds. + Weight::from_parts(554_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(300, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(301, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 399_000 picoseconds. - Weight::from_parts(409_000, 0) - // Standard Error: 10 - .saturating_add(Weight::from_parts(408, 0).saturating_mul(n.into())) + // Minimum execution time: 355_000 picoseconds. + Weight::from_parts(414_000, 0) + // Standard Error: 9 + .saturating_add(Weight::from_parts(411, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1618,10 +1618,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_210_000 picoseconds. - Weight::from_parts(15_349_133, 3784) - // Standard Error: 7_527 - .saturating_add(Weight::from_parts(3_564_903, 0).saturating_mul(n.into())) + // Minimum execution time: 13_189_000 picoseconds. + Weight::from_parts(15_521_424, 3784) + // Standard Error: 7_042 + .saturating_add(Weight::from_parts(3_540_946, 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(3_u64)) @@ -1634,8 +1634,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_350_000 picoseconds. - Weight::from_parts(3_494_000, 1561) + // Minimum execution time: 3_318_000 picoseconds. + Weight::from_parts(3_502_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1646,12 +1646,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_610_000 picoseconds. - Weight::from_parts(3_761_045, 990) - // Standard Error: 5_750 - .saturating_add(Weight::from_parts(2_072_190, 0).saturating_mul(t.into())) + // Minimum execution time: 4_046_000 picoseconds. + Weight::from_parts(4_283_714, 990) + // Standard Error: 5_982 + .saturating_add(Weight::from_parts(2_087_616, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(22, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(17, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1661,8 +1661,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 424_000 picoseconds. - Weight::from_parts(439_000, 0) + // Minimum execution time: 455_000 picoseconds. + Weight::from_parts(472_000, 0) // Standard Error: 10 .saturating_add(Weight::from_parts(1_210, 0).saturating_mul(i.into())) } @@ -1674,12 +1674,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 9_214_000 picoseconds. - Weight::from_parts(8_653_412, 249) + // Minimum execution time: 8_954_000 picoseconds. + Weight::from_parts(8_623_673, 249) // Standard Error: 1 - .saturating_add(Weight::from_parts(262, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(259, 0).saturating_mul(n.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(64, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(60, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1691,10 +1691,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_482_000 picoseconds. - Weight::from_parts(8_180_823, 248) + // Minimum execution time: 7_206_000 picoseconds. + Weight::from_parts(8_004_406, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(94, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1706,10 +1706,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_922_000 picoseconds. - Weight::from_parts(7_810_093, 248) - // Standard Error: 1 - .saturating_add(Weight::from_parts(617, 0).saturating_mul(n.into())) + // Minimum execution time: 6_954_000 picoseconds. + Weight::from_parts(7_884_753, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(608, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1720,10 +1720,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_319_000 picoseconds. - Weight::from_parts(7_113_817, 248) + // Minimum execution time: 6_338_000 picoseconds. + Weight::from_parts(7_024_910, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1734,10 +1734,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_861_000 picoseconds. - Weight::from_parts(8_757_100, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(627, 0).saturating_mul(n.into())) + // Minimum execution time: 7_311_000 picoseconds. + Weight::from_parts(8_532_828, 248) + // Standard Error: 5 + .saturating_add(Weight::from_parts(626, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1746,36 +1746,36 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_456_000 picoseconds. - Weight::from_parts(3_837_000, 0) + // Minimum execution time: 3_480_000 picoseconds. + Weight::from_parts(3_792_000, 0) } fn set_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_753_000 picoseconds. - Weight::from_parts(4_915_000, 0) + // Minimum execution time: 5_033_000 picoseconds. + Weight::from_parts(5_773_000, 0) } fn get_transient_storage_empty() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_157_000 picoseconds. - Weight::from_parts(3_224_000, 0) + // Minimum execution time: 3_070_000 picoseconds. + Weight::from_parts(3_166_000, 0) } fn get_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_748_000 picoseconds. - Weight::from_parts(4_056_000, 0) + // Minimum execution time: 4_004_000 picoseconds. + Weight::from_parts(4_592_000, 0) } fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_437_000 picoseconds. - Weight::from_parts(1_523_000, 0) + // Minimum execution time: 1_770_000 picoseconds. + Weight::from_parts(2_182_000, 0) } /// The range of component `n` is `[0, 16384]`. /// The range of component `o` is `[0, 16384]`. @@ -1783,11 +1783,11 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_171_000 picoseconds. - Weight::from_parts(3_215_064, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(203, 0).saturating_mul(n.into())) - // Standard Error: 1 + // Minimum execution time: 6_127_000 picoseconds. + Weight::from_parts(3_326_103, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(196, 0).saturating_mul(n.into())) + // Standard Error: 2 .saturating_add(Weight::from_parts(236, 0).saturating_mul(o.into())) } /// The range of component `n` is `[0, 16384]`. @@ -1795,47 +1795,47 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_772_000 picoseconds. - Weight::from_parts(3_120_514, 0) + // Minimum execution time: 2_737_000 picoseconds. + Weight::from_parts(3_076_732, 0) // Standard Error: 1 - .saturating_add(Weight::from_parts(231, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(235, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_769_000 picoseconds. - Weight::from_parts(2_055_515, 0) + // Minimum execution time: 1_840_000 picoseconds. + Weight::from_parts(2_069_155, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(227, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(223, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_contains_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_702_000 picoseconds. - Weight::from_parts(1_877_427, 0) + // Minimum execution time: 1_632_000 picoseconds. + Weight::from_parts(1_831_601, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(113, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(114, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_take_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_600_000 picoseconds. - Weight::from_parts(8_975_836, 0) - // Standard Error: 2 + // Minimum execution time: 8_620_000 picoseconds. + Weight::from_parts(8_975_587, 0) + // Standard Error: 3 .saturating_add(Weight::from_parts(3, 0).saturating_mul(n.into())) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_681_000 picoseconds. - Weight::from_parts(8_895_000, 0) + // Minimum execution time: 8_575_000 picoseconds. + Weight::from_parts(8_822_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1851,12 +1851,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 126_413_000 picoseconds. - Weight::from_parts(126_832_549, 4085) - // Standard Error: 197_984 - .saturating_add(Weight::from_parts(43_232_174, 0).saturating_mul(t.into())) + // Minimum execution time: 122_879_000 picoseconds. + Weight::from_parts(118_946_943, 4085) + // Standard Error: 178_620 + .saturating_add(Weight::from_parts(44_449_408, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(4, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(7, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1871,8 +1871,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 113_966_000 picoseconds. - Weight::from_parts(116_498_000, 3895) + // Minimum execution time: 111_844_000 picoseconds. + Weight::from_parts(116_455_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1891,12 +1891,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4132` - // Minimum execution time: 1_857_056_000 picoseconds. - Weight::from_parts(1_868_503_000, 4132) - // Standard Error: 23 - .saturating_add(Weight::from_parts(579, 0).saturating_mul(i.into())) - // Standard Error: 23 - .saturating_add(Weight::from_parts(935, 0).saturating_mul(s.into())) + // Minimum execution time: 1_896_838_000 picoseconds. + Weight::from_parts(1_918_193_000, 4132) + // Standard Error: 28 + .saturating_add(Weight::from_parts(641, 0).saturating_mul(i.into())) + // Standard Error: 28 + .saturating_add(Weight::from_parts(996, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1905,64 +1905,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 948_000 picoseconds. - Weight::from_parts(12_101_598, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_312, 0).saturating_mul(n.into())) + // Minimum execution time: 879_000 picoseconds. + Weight::from_parts(8_480_018, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_328, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_391_000 picoseconds. - Weight::from_parts(9_088_457, 0) + // Minimum execution time: 1_472_000 picoseconds. + Weight::from_parts(12_900_224, 0) // Standard Error: 1 - .saturating_add(Weight::from_parts(3_589, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_597, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 800_000 picoseconds. - Weight::from_parts(11_056_529, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_459, 0).saturating_mul(n.into())) + // Minimum execution time: 775_000 picoseconds. + Weight::from_parts(9_895_369, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_463, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 729_000 picoseconds. - Weight::from_parts(9_991_880, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_455, 0).saturating_mul(n.into())) + // Minimum execution time: 730_000 picoseconds. + Weight::from_parts(8_105_347, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_464, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_313_000 picoseconds. - Weight::from_parts(40_779_201, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(5_093, 0).saturating_mul(n.into())) + // Minimum execution time: 42_581_000 picoseconds. + Weight::from_parts(40_545_608, 0) + // Standard Error: 10 + .saturating_add(Weight::from_parts(5_128, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_784_000 picoseconds. - Weight::from_parts(48_901_000, 0) + // Minimum execution time: 48_295_000 picoseconds. + Weight::from_parts(49_412_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_823_000 picoseconds. - Weight::from_parts(12_972_000, 0) + // Minimum execution time: 13_287_000 picoseconds. + Weight::from_parts(13_447_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1972,8 +1972,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 18_007_000 picoseconds. - Weight::from_parts(18_587_000, 3895) + // Minimum execution time: 17_815_000 picoseconds. + Weight::from_parts(18_536_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1983,8 +1983,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_436_000 picoseconds. - Weight::from_parts(8_772_000, 3820) + // Minimum execution time: 8_140_000 picoseconds. + Weight::from_parts(8_538_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1994,8 +1994,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_447_000 picoseconds. - Weight::from_parts(7_764_000, 3558) + // Minimum execution time: 7_253_000 picoseconds. + Weight::from_parts(7_662_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -2003,15 +2003,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 346_000 picoseconds. - Weight::from_parts(384_000, 0) + // Minimum execution time: 340_000 picoseconds. + Weight::from_parts(373_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 369_000 picoseconds. - Weight::from_parts(412_000, 0) + // Minimum execution time: 353_000 picoseconds. + Weight::from_parts(392_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -2019,8 +2019,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_781_000 picoseconds. - Weight::from_parts(3_037_000, 1704) + // Minimum execution time: 2_827_000 picoseconds. + Weight::from_parts(2_924_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -2028,9 +2028,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_000 picoseconds. - Weight::from_parts(974_967, 0) - // Standard Error: 19 - .saturating_add(Weight::from_parts(7_028, 0).saturating_mul(r.into())) + // Minimum execution time: 843_000 picoseconds. + Weight::from_parts(919_937, 0) + // Standard Error: 21 + .saturating_add(Weight::from_parts(7_087, 0).saturating_mul(r.into())) } } From 1ed42f439127955f72df66a7d5c0ae1aadce41c0 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 1 Jul 2024 12:50:36 +0200 Subject: [PATCH 32/58] Add docs --- .../create_transient_storage_and_call.rs | 4 +- .../contracts/set_transient_storage.rs | 2 +- .../fixtures/contracts/transient_storage.rs | 3 +- .../src/benchmarking/call_builder.rs | 2 +- substrate/frame/contracts/src/exec.rs | 21 +++---- substrate/frame/contracts/src/lib.rs | 2 +- substrate/frame/contracts/src/tests.rs | 28 +++++++--- .../frame/contracts/src/transient_storage.rs | 10 +++- substrate/frame/contracts/src/wasm/mod.rs | 1 - substrate/frame/contracts/src/wasm/runtime.rs | 2 +- substrate/frame/contracts/uapi/src/host.rs | 56 +++++++++++++++++++ 11 files changed, 102 insertions(+), 29 deletions(-) diff --git a/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs b/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs index ffdcc8a84fdc..675ac38ef03d 100644 --- a/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs +++ b/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! This calls another contract as passed as its account id. It also creates some storage. +//! This calls another contract as passed as its account id. It also creates some transient storage. #![no_std] #![no_main] @@ -31,9 +31,9 @@ pub extern "C" fn deploy() {} pub extern "C" fn call() { input!( buffer, + len: u32, input: [u8; 4], callee: [u8; 32], - len: u32, ); let data = [0u8; 16 * 1024 + 1]; diff --git a/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs b/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs index fc883adff7da..c1abb503029c 100644 --- a/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs +++ b/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs @@ -33,7 +33,7 @@ pub extern "C" fn call() { let buffer = [0u8; 16 * 1024 + 1]; let data = &buffer[..len as usize]; - // Place a garbage value in transient storage, the size of which is specified by the call input. + // Place a garbage value in the transient storage, with the size specified by the call input. let mut key = [0u8; 32]; key[0] = 1; diff --git a/substrate/frame/contracts/fixtures/contracts/transient_storage.rs b/substrate/frame/contracts/fixtures/contracts/transient_storage.rs index 53d50b91174d..8d7eff90740a 100644 --- a/substrate/frame/contracts/fixtures/contracts/transient_storage.rs +++ b/substrate/frame/contracts/fixtures/contracts/transient_storage.rs @@ -15,8 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! This contract tests the storage APIs. It sets and clears storage values using the different -//! versions of the storage APIs. +//! This contract tests the transient storage APIs. #![no_std] #![no_main] diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index ce9c4ef8234a..36ea67fb2b17 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -162,7 +162,7 @@ where /// Add transient_storage pub fn with_transient_storage(ext: &mut StackExt) -> Result<(), &'static str> { - for i in 0u32.. { + for i in 1u32.. { let mut key_data = i.to_le_bytes().to_vec(); while key_data.last() == Some(&0) { key_data.pop(); diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 6d014f559009..588a52cc8ba8 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -210,20 +210,20 @@ pub trait Ext: sealing::Sealed { take_old: bool, ) -> Result; - /// Returns the storage entry of the executing account by the given `key`. + /// Returns the transient storage entry of the executing account by the given `key`. /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. fn get_transient_storage(&self, key: &Key) -> Option>; - /// Returns `Some(len)` (in bytes) if a storage item exists at `key`. + /// Returns `Some(len)` (in bytes) if a transient storage item exists at `key`. /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. fn get_transient_storage_size(&self, key: &Key) -> Option; - /// Sets the storage entry by the given key to the specified value. If `value` is `None` then - /// the storage entry is deleted. + /// Sets the transient storage entry by the given key to the specified value. If `value` is + /// `None` then the storage entry is deleted. fn set_transient_storage( &mut self, key: &Key, @@ -1366,23 +1366,22 @@ where return Err(Error::::TerminatedWhileReentrant.into()) } let frame = self.top_frame_mut(); - let account_id = frame.account_id.clone(); let info = frame.terminate(); frame.nested_storage.terminate(&info, beneficiary.clone()); info.queue_trie_for_deletion(); - ContractInfoOf::::remove(&account_id); + ContractInfoOf::::remove(&frame.account_id); Self::decrement_refcount(info.code_hash); for (code_hash, deposit) in info.delegate_dependencies() { Self::decrement_refcount(*code_hash); frame .nested_storage - .charge_deposit(account_id.clone(), StorageDeposit::Refund(*deposit)); + .charge_deposit(frame.account_id.clone(), StorageDeposit::Refund(*deposit)); } Contracts::::deposit_event(Event::Terminated { - contract: account_id, + contract: frame.account_id.clone(), beneficiary: beneficiary.clone(), }); Ok(()) @@ -3972,6 +3971,7 @@ mod tests { // Call stack: BOB -> CHARLIE(success) -> BOB' (success) let storage_key_1 = &Key::Fix([1; 32]); let storage_key_2 = &Key::Fix([2; 32]); + let storage_key_3 = &Key::Fix([3; 32]); let code_bob = MockLoader::insert(Call, |ctx, _| { if ctx.input_data[0] == 0 { assert_eq!( @@ -3991,14 +3991,15 @@ mod tests { exec_success() ); assert_eq!(ctx.ext.get_transient_storage(storage_key_1), Some(vec![3])); - assert_eq!(ctx.ext.get_transient_storage(storage_key_2), Some(vec![4])); + assert_eq!(ctx.ext.get_transient_storage(storage_key_2), Some(vec![])); + assert_eq!(ctx.ext.get_transient_storage(storage_key_3), None); } else { assert_eq!( ctx.ext.set_transient_storage(storage_key_1, Some(vec![3]), true), Ok(WriteOutcome::Taken(vec![1, 2])) ); assert_eq!( - ctx.ext.set_transient_storage(storage_key_2, Some(vec![4]), false), + ctx.ext.set_transient_storage(storage_key_2, Some(vec![]), false), Ok(WriteOutcome::New) ); } diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index d8775185eb50..011906ba4c77 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -616,7 +616,7 @@ pub mod pallet { // key-value data. To ensure safety, a margin of 2x the raw key-value size is used. let max_transient_storage_len = T::MaxTransientStorageLen::get() .checked_mul(2) - .expect("MaxTransientStorageLen to big"); + .expect("MaxTransientStorageLen is too large"); // Check that given configured `MaxCodeLen`, runtime heap memory limit can't be broken. // // In worst case, the decoded Wasm contract code would be `x16` times larger than the diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 74e21efd39f7..691f20ac8308 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -978,7 +978,7 @@ fn transient_storage_work() { } #[test] -fn transient_storage_limit_in_nested_call() { +fn transient_storage_limit_in_call() { let (wasm_caller, _code_hash_caller) = compile_module::("create_transient_storage_and_call").unwrap(); let (wasm_callee, _code_hash_callee) = compile_module::("set_transient_storage").unwrap(); @@ -987,17 +987,31 @@ fn transient_storage_limit_in_nested_call() { let min_balance = Contracts::min_balance(); // Create both contracts: Constructors do nothing. - let addr_caller = - builder::bare_instantiate(Code::Upload(wasm_caller)).value(min_balance * 100).build_and_unwrap_account_id(); - let addr_callee = - builder::bare_instantiate(Code::Upload(wasm_callee)).value(min_balance * 100).build_and_unwrap_account_id(); + let addr_caller = builder::bare_instantiate(Code::Upload(wasm_caller)) + .value(min_balance * 100) + .build_and_unwrap_account_id(); + let addr_callee = builder::bare_instantiate(Code::Upload(wasm_callee)) + .value(min_balance * 100) + .build_and_unwrap_account_id(); + + // The transient storage limit is set to 4KB. + assert_ok!(builder::call(addr_caller.clone()) + .data((1_000u32, 2_000u32, &addr_callee).encode()) + .build(),); assert_err_ignore_postinfo!( - builder::call(addr_caller) - .data((10u32, &addr_callee, 10_000u32).encode()) + builder::call(addr_caller.clone()) + .data((5_000u32, 1_000u32, &addr_callee).encode()) .build(), >::OutOfTransientStorage, ); + + assert_err_ignore_postinfo!( + builder::call(addr_caller) + .data((1_000u32, 4_000u32, &addr_callee).encode()) + .build(), + >::ContractTrapped + ); }); } diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index ce8c2eebe7b6..759e8b026a2c 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -351,6 +351,7 @@ mod tests { }; use core::u32::MAX; + // Calculate the allocation size for the given entry. fn allocation_size( account: &AccountIdOf, key: &Key, @@ -392,6 +393,7 @@ mod tests { assert_eq!(storage.read(&ALICE, &Key::Fix([2; 32])), Some(vec![4, 5])); assert_eq!(storage.read(&BOB, &Key::Fix([3; 32])), Some(vec![6, 7])); + // Check for an empty value. assert_eq!( storage.write(&BOB, &Key::Fix([3; 32]), Some(vec![]), true), Ok(WriteOutcome::Taken(vec![6, 7])) @@ -576,14 +578,15 @@ mod tests { storage.commit_transaction(); storage.start_transaction(); + assert_eq!(storage.meter().current_limit(), limit - size); assert_eq!(storage.meter().current_limit() - storage.meter().current_amount(), size); assert_eq!( storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); - assert_eq!(storage.meter().current_limit(), limit - size); - assert_eq!(storage.meter().current_amount() * 2, storage.meter().total_amount()); + assert_eq!(storage.meter().current_amount(), storage.meter().total_amount() - size); storage.commit_transaction(); + assert_eq!(storage.meter().total_amount(), size * 2); } #[test] @@ -619,6 +622,7 @@ mod tests { storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Err(Error::::OutOfTransientStorage.into()) ); + assert_eq!(storage.meter.current_amount(), 0); storage.commit_transaction(); assert_eq!(storage.meter.total_amount(), 0); } @@ -690,7 +694,7 @@ mod tests { ); storage.commit_transaction(); storage.rollback_transaction(); - assert_eq!(amount, storage.meter.total_amount()); + assert_eq!(storage.meter.total_amount(), amount); storage.commit_transaction(); } } diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 396a1080d278..7be3f56305ac 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -3064,7 +3064,6 @@ mod tests { assert_eq!(&result.data[4..], &[0u8; 0]); } - // transient_storage #[test] fn set_transient_storage_works() { const CODE: &str = r#" diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index a9daf9a94755..0a420a28ccf7 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -198,7 +198,7 @@ pub enum RuntimeCosts { GetStorage(u32), /// Weight of calling `seal_take_storage` for the given size. TakeStorage(u32), - /// Weight of calling `seal_set_transient_storage`. + /// Weight of calling `seal_set_transient_storage` for the given storage item sizes. SetTransientStorage { old_bytes: u32, new_bytes: u32 }, /// Weight of calling `seal_clear_transient_storage` per cleared byte. ClearTransientStorage(u32), diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index c63102994cad..90c8f89fedee 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -291,6 +291,16 @@ pub trait HostFn { /// /// Returns the size of the pre-existing value at the specified key if any. fn clear_storage_v1(key: &[u8]) -> Option; + + /// Clear the value at the given key in the contract transient storage. + /// + /// # Parameters + /// + /// - `key`: The storage key. + /// + /// # Return + /// + /// Returns the size of the pre-existing value at the specified key if any. fn clear_transient_storage(key: &[u8]) -> Option; /// Retrieve the code hash for a specified contract address. @@ -324,6 +334,17 @@ pub trait HostFn { /// /// Returns the size of the pre-existing value at the specified key if any. fn contains_storage_v1(key: &[u8]) -> Option; + + /// Checks whether there is a value stored under the given key in transient storage. + /// + /// The key length must not exceed the maximum defined by the contracts module parameter. + /// + /// # Parameters + /// - `key`: The storage key. + /// + /// # Return + /// + /// Returns the size of the pre-existing value at the specified key if any. fn contains_transient_storage(key: &[u8]) -> Option; /// Emit a custom debug message. @@ -455,6 +476,17 @@ pub trait HostFn { /// [KeyNotFound][`crate::ReturnErrorCode::KeyNotFound] fn get_storage_v1(key: &[u8], output: &mut &mut [u8]) -> Result; + /// Retrieve the value under the given key from transient storage. + /// + /// The key length must not exceed the maximum defined by the contracts module parameter. + /// + /// # Parameters + /// - `key`: The storage key. + /// - `output`: A reference to the output data buffer to write the storage entry. + /// + /// # Errors + /// + /// [KeyNotFound][`crate::ReturnErrorCode::KeyNotFound] fn get_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result; hash_fn!(sha2_256, 32); @@ -676,6 +708,20 @@ pub trait HostFn { /// /// Returns the size of the pre-existing value at the specified key if any. fn set_storage_v2(key: &[u8], value: &[u8]) -> Option; + + /// Set the value at the given key in the contract transient storage. + /// + /// The key and value lengths must not exceed the maximums defined by the contracts module + /// parameters. + /// + /// # Parameters + /// + /// - `key`: The storage key. + /// - `encoded_value`: The storage value. + /// + /// # Return + /// + /// Returns the size of the pre-existing value at the specified key if any. fn set_transient_storage(key: &[u8], value: &[u8]) -> Option; /// Verify a sr25519 signature @@ -700,6 +746,16 @@ pub trait HostFn { /// /// [KeyNotFound][`crate::ReturnErrorCode::KeyNotFound] fn take_storage(key: &[u8], output: &mut &mut [u8]) -> Result; + + /// Retrieve and remove the value under the given key from transient storage. + /// + /// # Parameters + /// - `key`: The storage key. + /// - `output`: A reference to the output data buffer to write the storage entry. + /// + /// # Errors + /// + /// [KeyNotFound][`crate::ReturnErrorCode::KeyNotFound] fn take_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result; /// Transfer some amount of funds into the specified account. From 3ec46266b399297d9f6629d7af34e5068185d368 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 1 Jul 2024 14:09:01 +0200 Subject: [PATCH 33/58] Fix tests --- .../contracts-rococo/src/contracts.rs | 1 + prdoc/pr_4566.prdoc | 20 +++++++++++++++++++ substrate/frame/contracts/src/lib.rs | 12 +++++------ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 prdoc/pr_4566.prdoc diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs index fcd786711bbe..f1443473c8d2 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs @@ -65,6 +65,7 @@ impl Config for Runtime { type AddressGenerator = DefaultAddressGenerator; type MaxCodeLen = ConstU32<{ 123 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; + type MaxTransientStorageLen = ConstU32<1 * 1024 * 1024>; type UnsafeUnstableInterface = ConstBool; type UploadOrigin = EnsureSigned; type InstantiateOrigin = EnsureSigned; diff --git a/prdoc/pr_4566.prdoc b/prdoc/pr_4566.prdoc new file mode 100644 index 000000000000..e4b9e5285e9f --- /dev/null +++ b/prdoc/pr_4566.prdoc @@ -0,0 +1,20 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: "[pallet_contracts] Add support for transient storage in contracts host functions" + +doc: + - audience: Runtime User + description: | + This PR implements transient storage, which behaves identically to regular storage + but is kept only in memory and discarded after every transaction. + This functionality is similar to the `TSTORE` and `TLOAD` operations used in Ethereum. + The following new host functions have been introduced: `get_transient_storage`, + `set_transient_storage`, `take_transient_storage`, `clear_transient_storage` and + `contains_transient_storage` + +crates: + - name: pallet-contracts + bump: minor + - name: pallet-contracts-uapi + bump: minor diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 011906ba4c77..06f5e4d0a7f6 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -224,7 +224,7 @@ pub struct Environment { pub struct ApiVersion(u16); impl Default for ApiVersion { fn default() -> Self { - Self(4) + Self(5) } } @@ -389,6 +389,11 @@ pub mod pallet { #[pallet::constant] type MaxStorageKeyLen: Get; + /// The maximum length of the transient storage in bytes. + /// This includes keys, values, and previous entries used for storage rollback. + #[pallet::constant] + type MaxTransientStorageLen: Get; + /// The maximum number of delegate_dependencies that a contract can lock with /// [`chain_extension::Ext::lock_delegate_dependency`]. #[pallet::constant] @@ -410,11 +415,6 @@ pub mod pallet { #[pallet::constant] type MaxDebugBufferLen: Get; - /// The maximum length of the transient storage in bytes. - /// This includes keys, values, and previous entries used for storage rollback. - #[pallet::constant] - type MaxTransientStorageLen: Get; - /// Origin allowed to upload code. /// /// By default, it is safe to set this to `EnsureSigned`, allowing anyone to upload contract From 2d3a82301b631cab2a2539cb79e49034bfdbcc91 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 1 Jul 2024 14:38:41 +0200 Subject: [PATCH 34/58] Fix contracts-rococo configuration --- .../runtimes/contracts/contracts-rococo/src/contracts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs index f1443473c8d2..f9edef072e28 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs @@ -65,7 +65,7 @@ impl Config for Runtime { type AddressGenerator = DefaultAddressGenerator; type MaxCodeLen = ConstU32<{ 123 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; - type MaxTransientStorageLen = ConstU32<1 * 1024 * 1024>; + type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; type UnsafeUnstableInterface = ConstBool; type UploadOrigin = EnsureSigned; type InstantiateOrigin = EnsureSigned; From 09ff9085fd584786cfe7b9642486dda0026a850f Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 1 Jul 2024 14:47:12 +0200 Subject: [PATCH 35/58] Fmt --- .../runtimes/contracts/contracts-rococo/src/contracts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs index f9edef072e28..52805aadaa0a 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs @@ -65,7 +65,7 @@ impl Config for Runtime { type AddressGenerator = DefaultAddressGenerator; type MaxCodeLen = ConstU32<{ 123 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; - type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; + type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; type UnsafeUnstableInterface = ConstBool; type UploadOrigin = EnsureSigned; type InstantiateOrigin = EnsureSigned; From 5fa1b1b1118477601db7f3e3d6f3f25d0bde8b07 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 1 Jul 2024 15:06:12 +0200 Subject: [PATCH 36/58] Update PR doc --- .../runtimes/contracts/contracts-rococo/src/contracts.rs | 2 +- prdoc/pr_4566.prdoc | 2 ++ substrate/frame/contracts/src/wasm/mod.rs | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs index 52805aadaa0a..34498b63bfa2 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs @@ -65,7 +65,7 @@ impl Config for Runtime { type AddressGenerator = DefaultAddressGenerator; type MaxCodeLen = ConstU32<{ 123 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; - type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; + type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; type UnsafeUnstableInterface = ConstBool; type UploadOrigin = EnsureSigned; type InstantiateOrigin = EnsureSigned; diff --git a/prdoc/pr_4566.prdoc b/prdoc/pr_4566.prdoc index e4b9e5285e9f..d3f04310c8bf 100644 --- a/prdoc/pr_4566.prdoc +++ b/prdoc/pr_4566.prdoc @@ -18,3 +18,5 @@ crates: bump: minor - name: pallet-contracts-uapi bump: minor + - name: contracts-rococo-runtime + bump: minor diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 7be3f56305ac..be23ec7e126f 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -802,6 +802,10 @@ mod tests { fn contract_info(&mut self) -> &mut crate::ContractInfo { unimplemented!() } + #[cfg(feature = "runtime-benchmarks")] + fn transient_storage(&mut self) -> &mut TransientStorage { + unimplemented!() + } fn ecdsa_to_eth_address(&self, _pk: &[u8; 33]) -> Result<[u8; 20], ()> { Ok([2u8; 20]) } From f6aeb8711cbf56d403f07c80c344bdad4a9c2217 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 1 Jul 2024 22:39:59 +0200 Subject: [PATCH 37/58] Cleanup --- .../create_transient_storage_and_call.rs | 2 +- .../contracts/set_transient_storage.rs | 2 +- substrate/frame/contracts/src/wasm/runtime.rs | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs b/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs index 675ac38ef03d..3d9ef205dd7f 100644 --- a/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs +++ b/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs @@ -36,7 +36,7 @@ pub extern "C" fn call() { callee: [u8; 32], ); - let data = [0u8; 16 * 1024 + 1]; + let data = [0u8; 16 * 1024]; let value = &data[..len as usize]; api::set_transient_storage(buffer, value); diff --git a/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs b/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs index c1abb503029c..f7b6365c003a 100644 --- a/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs +++ b/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs @@ -30,7 +30,7 @@ pub extern "C" fn deploy() {} pub extern "C" fn call() { input!(len: u32, ); - let buffer = [0u8; 16 * 1024 + 1]; + let buffer = [0u8; 16 * 1024]; let data = &buffer[..len as usize]; // Place a garbage value in the transient storage, with the size specified by the call input. diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 0a420a28ccf7..38115b2c683d 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -255,17 +255,27 @@ pub enum RuntimeCosts { } macro_rules! cost_write { - // cost_rollback!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::rollback_transient_storage()).saturating_add(T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty()) + // cost_write!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::rollback_transient_storage()) + // .saturating_add(T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty()) ($name:ident $(, $arg:expr )*) => { - (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::rollback_transient_storage()).saturating_add(T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty()))) + (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::rollback_transient_storage()).saturating_add(cost_write!(@storage_cost))) }; + + (@storage_cost) => { + T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty()) + }; } macro_rules! cost_read { - // cost_rollback!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::get_transient_storage_full().saturating_sub(T::WeightInfo::get_transient_storage_empty()) + // cost_read!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::get_transient_storage_full() + // .saturating_sub(T::WeightInfo::get_transient_storage_empty()) ($name:ident $(, $arg:expr )*) => { - (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::get_transient_storage_full().saturating_sub(T::WeightInfo::get_transient_storage_empty()))) + (T::WeightInfo::$name($( $arg ),*).saturating_add(cost_read!(@storage_cost))) }; + + (@storage_cost) => { + T::WeightInfo::get_transient_storage_full().saturating_sub(T::WeightInfo::get_transient_storage_empty()) + }; } macro_rules! cost_args { From 486343139f8bbbd9cc3c9ae228b9d0d9e790a71d Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 2 Jul 2024 10:10:31 +0200 Subject: [PATCH 38/58] Remove transient storage limit in benchmark --- .../src/benchmarking/call_builder.rs | 9 ++- .../frame/contracts/src/benchmarking/mod.rs | 32 ++++++---- .../frame/contracts/src/transient_storage.rs | 64 ++++++++----------- 3 files changed, 53 insertions(+), 52 deletions(-) diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index 36ea67fb2b17..b5f8c6c594ed 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -161,7 +161,10 @@ where } /// Add transient_storage - pub fn with_transient_storage(ext: &mut StackExt) -> Result<(), &'static str> { + pub fn with_transient_storage(ext: &mut StackExt, size: u32) -> Result<(), &'static str> { + let amount = ext.transient_storage().meter().current().amount; + let limit = ext.transient_storage().meter().current().limit; + ext.transient_storage().meter().current_mut().limit = size; for i in 1u32.. { let mut key_data = i.to_le_bytes().to_vec(); while key_data.last() == Some(&0) { @@ -169,8 +172,10 @@ where } let key = Key::::try_from_var(key_data).unwrap(); if let Err(e) = ext.set_transient_storage(&key, Some(Vec::new()), false) { + // Restore previous settings. + ext.transient_storage().meter().current_mut().limit = limit; + ext.transient_storage().meter().current_mut().amount = amount; if e == Error::::OutOfTransientStorage.into() { - ext.transient_storage().meter().clear(); break; } else { return Err("Initialization of the transient storage failed"); diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index a303240e2256..814d38b65c7a 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -1173,6 +1173,7 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; let result; #[block] { @@ -1197,8 +1198,9 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext)?; + CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageLen::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; let result; #[block] { @@ -1224,10 +1226,11 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime .ext() .set_transient_storage(&key, Some(vec![42u8; max_value_len as _]), false) - .map_err(|_| "Failed to write to storage during setup.")?; + .map_err(|_| "Failed to write to transient storage during setup.")?; let result; #[block] { @@ -1247,12 +1250,13 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext)?; + CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageLen::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime .ext() .set_transient_storage(&key, Some(vec![42u8; max_value_len as _]), false) - .map_err(|_| "Failed to write to storage during setup.")?; + .map_err(|_| "Failed to write to transient storage during setup.")?; let result; #[block] { @@ -1273,13 +1277,14 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext)?; + CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageLen::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime.ext().transient_storage().start_transaction(); runtime .ext() .set_transient_storage(&key, Some(vec![42u8; max_value_len as _]), false) - .map_err(|_| "Failed to write to storage during setup.")?; + .map_err(|_| "Failed to write to transient storage during setup.")?; #[block] { runtime.ext().transient_storage().rollback_transaction(); @@ -1301,10 +1306,11 @@ mod benchmarks { .map_err(|_| "Key has wrong length")?; let value = vec![1u8; n as usize]; build_runtime!(runtime, memory: [ key.to_vec(), value.clone(), ]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime .ext() .set_transient_storage(&key, Some(vec![42u8; o as usize]), false) - .map_err(|_| "Failed to write to storage during setup.")?; + .map_err(|_| "Failed to write to transient storage during setup.")?; let result; #[block] @@ -1332,10 +1338,11 @@ mod benchmarks { let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), ]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime .ext() .set_transient_storage(&key, Some(vec![42u8; n as usize]), false) - .map_err(|_| "Failed to write to storage during setup.")?; + .map_err(|_| "Failed to write to transient storage during setup.")?; let result; #[block] @@ -1357,10 +1364,11 @@ mod benchmarks { let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), n.to_le_bytes(), vec![0u8; n as _], ]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime .ext() .set_transient_storage(&key, Some(vec![42u8; n as usize]), false) - .map_err(|_| "Failed to write to storage during setup.")?; + .map_err(|_| "Failed to write to transient storage during setup.")?; let out_ptr = max_key_len + 4; let result; @@ -1392,10 +1400,11 @@ mod benchmarks { let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), ]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime .ext() .set_transient_storage(&key, Some(vec![42u8; n as usize]), false) - .map_err(|_| "Failed to write to storage during setup.")?; + .map_err(|_| "Failed to write to transient storage during setup.")?; let result; #[block] @@ -1421,11 +1430,12 @@ mod benchmarks { let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; build_runtime!(runtime, memory: [ key.to_vec(), n.to_le_bytes(), vec![0u8; n as _], ]); + runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; let value = vec![42u8; n as usize]; runtime .ext() .set_transient_storage(&key, Some(value.clone()), false) - .map_err(|_| "Failed to write to storage during setup.")?; + .map_err(|_| "Failed to write to transient storage during setup.")?; let out_ptr = max_key_len + 4; let result; diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 759e8b026a2c..80fc0399ff0c 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -30,7 +30,7 @@ use sp_std::{collections::btree_map::BTreeMap, mem, vec::Vec}; /// Meter entry tracks transaction allocations. #[derive(Default, Debug)] -struct MeterEntry { +pub struct MeterEntry { /// Allocations made in the current transaction. pub amount: u32, /// Allocations limit in the current transaction. @@ -69,7 +69,7 @@ impl StorageMeter { /// Charge the allocated amount of transaction storage from the meter. pub fn charge(&mut self, amount: u32) -> DispatchResult { - let meter = self.top_meter_mut(); + let meter = self.current_mut(); if meter.exceeds_limit(amount) { return Err(Error::::OutOfTransientStorage.into()); } @@ -86,7 +86,7 @@ impl StorageMeter { /// Start a transaction meter. pub fn start(&mut self) { - let meter = self.top_meter(); + let meter = self.current(); let mut transaction_limit = meter.limit.saturating_sub(meter.amount); if !self.nested_meters.is_empty() { // Allow use of (1 - 1/STORAGE_FRACTION_DENOMINATOR) of free storage for subsequent @@ -105,26 +105,7 @@ impl StorageMeter { .nested_meters .pop() .expect("There is no nested meter that can be committed."); - self.top_meter_mut().absorb(transaction_meter) - } - - /// Clear a transaction meter - #[cfg(feature = "runtime-benchmarks")] - pub fn clear(&mut self) { - self.nested_meters.clear(); - self.root_meter.amount = 0; - } - - /// The allocated amount of memory inside the current transaction. - #[cfg(any(test, feature = "runtime-benchmarks"))] - pub fn current_amount(&self) -> u32 { - self.top_meter().amount - } - - /// The memory limit of the current transaction. - #[cfg(any(test, feature = "runtime-benchmarks"))] - pub fn current_limit(&self) -> u32 { - self.top_meter().limit + self.current_mut().absorb(transaction_meter) } /// The total allocated amount of memory. @@ -135,11 +116,13 @@ impl StorageMeter { .fold(self.root_meter.amount, |acc, e| acc.saturating_add(e.amount)) } - fn top_meter_mut(&mut self) -> &mut MeterEntry { + /// A mutable reference to the current meter entry. + pub fn current_mut(&mut self) -> &mut MeterEntry { self.nested_meters.last_mut().unwrap_or(&mut self.root_meter) } - fn top_meter(&self) -> &MeterEntry { + /// A reference to the current meter entry. + pub fn current(&self) -> &MeterEntry { self.nested_meters.last().unwrap_or(&self.root_meter) } } @@ -358,8 +341,10 @@ mod tests { value: Option>, ) -> u32 { let mut storage: TransientStorage = TransientStorage::::new(MAX); - storage.write(account, key, value, false).expect("Could not write to storage."); - storage.meter().current_amount() + storage + .write(account, key, value, false) + .expect("Could not write to transient storage."); + storage.meter().current().amount } #[test] @@ -574,17 +559,17 @@ mod tests { storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); - let limit = storage.meter().current_limit(); + let limit = storage.meter().current().limit; storage.commit_transaction(); storage.start_transaction(); - assert_eq!(storage.meter().current_limit(), limit - size); - assert_eq!(storage.meter().current_limit() - storage.meter().current_amount(), size); + assert_eq!(storage.meter().current().limit, limit - size); + assert_eq!(storage.meter().current().limit - storage.meter().current().amount, size); assert_eq!( storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); - assert_eq!(storage.meter().current_amount(), storage.meter().total_amount() - size); + assert_eq!(storage.meter().current().amount, size); storage.commit_transaction(); assert_eq!(storage.meter().total_amount(), size * 2); } @@ -595,21 +580,21 @@ mod tests { let mut storage = TransientStorage::::new(size * 3); storage.start_transaction(); - let limit = storage.meter().current_limit(); + let limit = storage.meter().current().limit; assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.start_transaction(); assert_eq!(storage.meter().total_amount(), size); - assert!(storage.meter().current_limit() < limit - size); + assert!(storage.meter().current().limit < limit - size); assert_eq!( storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); storage.commit_transaction(); - assert_eq!(storage.meter().current_limit(), limit); - assert_eq!(storage.meter().total_amount(), storage.meter().current_amount()); + assert_eq!(storage.meter().current().limit, limit); + assert_eq!(storage.meter().total_amount(), storage.meter().current().amount); storage.commit_transaction(); } @@ -622,7 +607,7 @@ mod tests { storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Err(Error::::OutOfTransientStorage.into()) ); - assert_eq!(storage.meter.current_amount(), 0); + assert_eq!(storage.meter.current().amount, 0); storage.commit_transaction(); assert_eq!(storage.meter.total_amount(), 0); } @@ -653,7 +638,7 @@ mod tests { let mut storage = TransientStorage::::new(size * 2); storage.start_transaction(); - let limit = storage.meter.current_limit(); + let limit = storage.meter.current().limit; storage.start_transaction(); assert_eq!( storage.write(&ALICE, &Key::Fix([2; 32]), Some(vec![1u8; 4096]), false), @@ -662,12 +647,13 @@ mod tests { storage.rollback_transaction(); assert_eq!(storage.meter.total_amount(), 0); - assert_eq!(storage.meter.current_limit(), limit); + assert_eq!(storage.meter.current().limit, limit); assert_eq!( storage.write(&ALICE, &Key::Fix([1; 32]), Some(vec![1u8; 4096]), false), Ok(WriteOutcome::New) ); - assert_eq!(storage.meter().current_amount(), storage.meter().total_amount()); + let amount = storage.meter().current().amount; + assert_eq!(storage.meter().total_amount(), amount); storage.commit_transaction(); } From baa943f0b9e743f05a1c89a7cd52f9f414723ab7 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 2 Jul 2024 11:53:07 +0200 Subject: [PATCH 39/58] Cleanup --- .../contracts/contracts-rococo/src/contracts.rs | 2 +- substrate/bin/node/runtime/src/lib.rs | 2 +- substrate/frame/contracts/src/benchmarking/mod.rs | 6 +++--- substrate/frame/contracts/src/exec.rs | 8 ++++---- substrate/frame/contracts/src/lib.rs | 10 +++++----- substrate/frame/contracts/src/transient_storage.rs | 9 ++++++++- substrate/frame/contracts/src/wasm/runtime.rs | 8 ++++---- 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs index 34498b63bfa2..e8cc9d02fb0e 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs @@ -65,7 +65,7 @@ impl Config for Runtime { type AddressGenerator = DefaultAddressGenerator; type MaxCodeLen = ConstU32<{ 123 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; - type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; + type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>; type UnsafeUnstableInterface = ConstBool; type UploadOrigin = EnsureSigned; type InstantiateOrigin = EnsureSigned; diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 6092a1cc72df..84dd4276eff5 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1371,7 +1371,7 @@ impl pallet_contracts::Config for Runtime { type UploadOrigin = EnsureSigned; type InstantiateOrigin = EnsureSigned; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; - type MaxTransientStorageLen = ConstU32<{ 1 * 1024 * 1024 }>; + type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>; type RuntimeHoldReason = RuntimeHoldReason; #[cfg(not(feature = "runtime-benchmarks"))] type Migrations = (); diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 814d38b65c7a..aa9f54914a60 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -1198,7 +1198,7 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageLen::get())?; + CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageSize::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; let result; @@ -1250,7 +1250,7 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageLen::get())?; + CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageSize::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime @@ -1277,7 +1277,7 @@ mod benchmarks { let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageLen::get())?; + CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageSize::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime.ext().transient_storage().start_transaction(); diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 588a52cc8ba8..32a01d8025cc 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -212,13 +212,13 @@ pub trait Ext: sealing::Sealed { /// Returns the transient storage entry of the executing account by the given `key`. /// - /// Returns `None` if the `key` wasn't previously set by `set_storage` or + /// Returns `None` if the `key` wasn't previously set by `set_transient_storage` or /// was deleted. fn get_transient_storage(&self, key: &Key) -> Option>; /// Returns `Some(len)` (in bytes) if a transient storage item exists at `key`. /// - /// Returns `None` if the `key` wasn't previously set by `set_storage` or + /// Returns `None` if the `key` wasn't previously set by `set_transient_storage` or /// was deleted. fn get_transient_storage_size(&self, key: &Key) -> Option; @@ -501,7 +501,7 @@ pub struct Stack<'a, T: Config, E> { debug_message: Option<&'a mut DebugBufferVec>, /// The determinism requirement of this call stack. determinism: Determinism, - /// Transient storage + /// Transient storage used to store data, which is kept for the duration of a transaction. transient_storage: TransientStorage, /// No executable is held by the struct but influences its behaviour. _phantom: PhantomData, @@ -826,7 +826,7 @@ where frames: Default::default(), debug_message, determinism, - transient_storage: TransientStorage::new(T::MaxTransientStorageLen::get()), + transient_storage: TransientStorage::new(T::MaxTransientStorageSize::get()), _phantom: Default::default(), }; diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 06f5e4d0a7f6..1bd792ffcb7c 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -392,7 +392,7 @@ pub mod pallet { /// The maximum length of the transient storage in bytes. /// This includes keys, values, and previous entries used for storage rollback. #[pallet::constant] - type MaxTransientStorageLen: Get; + type MaxTransientStorageSize: Get; /// The maximum number of delegate_dependencies that a contract can lock with /// [`chain_extension::Ext::lock_delegate_dependency`]. @@ -560,7 +560,7 @@ pub mod pallet { type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxDelegateDependencies = MaxDelegateDependencies; type MaxStorageKeyLen = ConstU32<128>; - type MaxTransientStorageLen = ConstU32<{ 4 * 1024 }>; + type MaxTransientStorageSize = ConstU32<{ 4 * 1024 }>; type Migrations = (); type Time = Self; type Randomness = Self; @@ -614,9 +614,9 @@ pub mod pallet { .expect("CallStack size is too big"); // Transient storage uses a BTreeMap, which has overhead compared to the raw size of // key-value data. To ensure safety, a margin of 2x the raw key-value size is used. - let max_transient_storage_len = T::MaxTransientStorageLen::get() + let max_transient_storage_size = T::MaxTransientStorageSize::get() .checked_mul(2) - .expect("MaxTransientStorageLen is too large"); + .expect("MaxTransientStorageSize is too large"); // Check that given configured `MaxCodeLen`, runtime heap memory limit can't be broken. // // In worst case, the decoded Wasm contract code would be `x16` times larger than the @@ -648,7 +648,7 @@ pub mod pallet { // Hence the upper limit for the `MaxCodeLen` can be defined as follows: let code_len_limit = max_runtime_mem .saturating_div(2) - .saturating_sub(max_transient_storage_len) + .saturating_sub(max_transient_storage_size) .saturating_div(max_call_depth) .saturating_sub(max_heap_size) .saturating_sub(MAX_STACK_SIZE) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 80fc0399ff0c..be70d9b136b2 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -38,14 +38,17 @@ pub struct MeterEntry { } impl MeterEntry { + /// Create a new entry. pub fn new(limit: u32) -> Self { Self { limit, amount: Default::default() } } + /// Check if the allocated amount exceeds the limit. pub fn exceeds_limit(&self, amount: u32) -> bool { self.amount.saturating_add(amount) > self.limit } + /// Absorb the allocation amount of the nested entry into the current entry. pub fn absorb(&mut self, rhs: Self) { self.amount = self.amount.saturating_add(rhs.amount) } @@ -220,12 +223,16 @@ impl TransientStorage { } } - /// Read the storage entry. + /// Read the storage value. If the entry does not exist, `None` is returned. pub fn read(&self, account: &AccountIdOf, key: &Key) -> Option> { self.storage.read(&Self::storage_key(&account.encode(), &key.hash())) } /// Write a value to storage. + /// + /// If the `value` is `None`, then the entry is removed. If `take` is true, + /// a [`WriteOutcome::Taken`] is returned instead of a [`WriteOutcome::Overwritten`]. + /// If the entry did not exist, [`WriteOutcome::New`] is returned. pub fn write( &mut self, account: &AccountIdOf, diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 38115b2c683d..f1a7f547e94f 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -258,10 +258,10 @@ macro_rules! cost_write { // cost_write!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::rollback_transient_storage()) // .saturating_add(T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty()) ($name:ident $(, $arg:expr )*) => { - (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::rollback_transient_storage()).saturating_add(cost_write!(@storage_cost))) + (T::WeightInfo::$name($( $arg ),*).saturating_add(T::WeightInfo::rollback_transient_storage()).saturating_add(cost_write!(@cost_storage))) }; - (@storage_cost) => { + (@cost_storage) => { T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty()) }; } @@ -270,10 +270,10 @@ macro_rules! cost_read { // cost_read!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::get_transient_storage_full() // .saturating_sub(T::WeightInfo::get_transient_storage_empty()) ($name:ident $(, $arg:expr )*) => { - (T::WeightInfo::$name($( $arg ),*).saturating_add(cost_read!(@storage_cost))) + (T::WeightInfo::$name($( $arg ),*).saturating_add(cost_read!(@cost_storage))) }; - (@storage_cost) => { + (@cost_storage) => { T::WeightInfo::get_transient_storage_full().saturating_sub(T::WeightInfo::get_transient_storage_empty()) }; } From bcde2de841a9537d8a53d2e4d116875751cea7be Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 2 Jul 2024 13:01:01 +0200 Subject: [PATCH 40/58] Fix description --- substrate/frame/contracts/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 1bd792ffcb7c..ecbbc6fad18b 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -389,7 +389,7 @@ pub mod pallet { #[pallet::constant] type MaxStorageKeyLen: Get; - /// The maximum length of the transient storage in bytes. + /// The maximum size of the transient storage in bytes. /// This includes keys, values, and previous entries used for storage rollback. #[pallet::constant] type MaxTransientStorageSize: Get; From 9a204bdb34ebaea60f191edd7c7f8ad841495417 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Tue, 2 Jul 2024 12:10:52 +0000 Subject: [PATCH 41/58] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 910 +++++++++++------------ 1 file changed, 453 insertions(+), 457 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index 0eda59aa4158..e693400bf704 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/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 32.0.0 -//! DATE: 2024-06-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-07-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `runner-7wrmsoux-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` @@ -137,8 +137,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_847_000 picoseconds. - Weight::from_parts(1_905_000, 1627) + // Minimum execution time: 1_868_000 picoseconds. + Weight::from_parts(1_940_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -148,10 +148,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 10_732_000 picoseconds. - Weight::from_parts(11_004_000, 442) - // Standard Error: 1_793 - .saturating_add(Weight::from_parts(1_230_603, 0).saturating_mul(k.into())) + // Minimum execution time: 11_390_000 picoseconds. + Weight::from_parts(11_812_000, 442) + // Standard Error: 1_686 + .saturating_add(Weight::from_parts(1_137_138, 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)) @@ -165,10 +165,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_703_000 picoseconds. - Weight::from_parts(4_323_140, 6149) + // Minimum execution time: 7_576_000 picoseconds. + Weight::from_parts(4_420_265, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_649, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -181,8 +181,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_011_000 picoseconds. - Weight::from_parts(17_043_000, 6450) + // Minimum execution time: 16_147_000 picoseconds. + Weight::from_parts(16_485_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -195,10 +195,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_128_000 picoseconds. - Weight::from_parts(3_173_000, 3635) - // Standard Error: 654 - .saturating_add(Weight::from_parts(1_110_890, 0).saturating_mul(k.into())) + // Minimum execution time: 3_140_000 picoseconds. + Weight::from_parts(3_203_000, 3635) + // Standard Error: 660 + .saturating_add(Weight::from_parts(1_106_850, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -217,10 +217,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 14_921_000 picoseconds. - Weight::from_parts(15_612_273, 6263) - // Standard Error: 2 - .saturating_add(Weight::from_parts(418, 0).saturating_mul(c.into())) + // Minimum execution time: 14_742_000 picoseconds. + Weight::from_parts(15_346_515, 6263) + // Standard Error: 1 + .saturating_add(Weight::from_parts(454, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -231,8 +231,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 11_955_000 picoseconds. - Weight::from_parts(12_583_000, 6380) + // Minimum execution time: 12_060_000 picoseconds. + Weight::from_parts(12_694_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -246,8 +246,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 47_089_000 picoseconds. - Weight::from_parts(48_541_000, 6292) + // Minimum execution time: 47_782_000 picoseconds. + Weight::from_parts(48_385_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -259,8 +259,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_300_000 picoseconds. - Weight::from_parts(53_751_000, 6534) + // Minimum execution time: 52_281_000 picoseconds. + Weight::from_parts(54_174_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -270,8 +270,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_739_000 picoseconds. - Weight::from_parts(11_924_000, 6349) + // Minimum execution time: 11_337_000 picoseconds. + Weight::from_parts(11_890_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -281,8 +281,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_120_000 picoseconds. - Weight::from_parts(2_208_000, 1627) + // Minimum execution time: 2_126_000 picoseconds. + Weight::from_parts(2_260_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -294,8 +294,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_800_000 picoseconds. - Weight::from_parts(11_293_000, 3631) + // Minimum execution time: 10_757_000 picoseconds. + Weight::from_parts(11_120_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -305,8 +305,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_523_000 picoseconds. - Weight::from_parts(4_675_000, 3607) + // Minimum execution time: 4_342_000 picoseconds. + Weight::from_parts(4_510_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -317,8 +317,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_705_000 picoseconds. - Weight::from_parts(5_934_000, 3632) + // Minimum execution time: 5_534_000 picoseconds. + Weight::from_parts(5_731_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -329,8 +329,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_563_000 picoseconds. - Weight::from_parts(5_759_000, 3607) + // Minimum execution time: 5_439_000 picoseconds. + Weight::from_parts(5_699_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -351,10 +351,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `800 + c * (1 ±0)` // Estimated: `4266 + c * (1 ±0)` - // Minimum execution time: 246_043_000 picoseconds. - Weight::from_parts(258_567_009, 4266) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_071, 0).saturating_mul(c.into())) + // Minimum execution time: 259_120_000 picoseconds. + Weight::from_parts(269_467_515, 4266) + // Standard Error: 4 + .saturating_add(Weight::from_parts(731, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -382,14 +382,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_647_328_000 picoseconds. - Weight::from_parts(27_062_930, 6262) - // Standard Error: 185 - .saturating_add(Weight::from_parts(57_634, 0).saturating_mul(c.into())) - // Standard Error: 22 - .saturating_add(Weight::from_parts(2_185, 0).saturating_mul(i.into())) - // Standard Error: 22 - .saturating_add(Weight::from_parts(2_465, 0).saturating_mul(s.into())) + // Minimum execution time: 4_610_363_000 picoseconds. + Weight::from_parts(149_861_617, 6262) + // Standard Error: 126 + .saturating_add(Weight::from_parts(53_395, 0).saturating_mul(c.into())) + // Standard Error: 15 + .saturating_add(Weight::from_parts(2_292, 0).saturating_mul(i.into())) + // Standard Error: 15 + .saturating_add(Weight::from_parts(2_268, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -415,12 +415,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4017` - // Minimum execution time: 2_248_169_000 picoseconds. - Weight::from_parts(2_281_849_000, 4017) - // Standard Error: 35 - .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(i.into())) - // Standard Error: 35 - .saturating_add(Weight::from_parts(993, 0).saturating_mul(s.into())) + // Minimum execution time: 2_299_412_000 picoseconds. + Weight::from_parts(2_314_212_000, 4017) + // Standard Error: 32 + .saturating_add(Weight::from_parts(1_003, 0).saturating_mul(i.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(937, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -440,8 +440,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 165_105_000 picoseconds. - Weight::from_parts(168_941_000, 4291) + // Minimum execution time: 166_492_000 picoseconds. + Weight::from_parts(170_786_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -458,10 +458,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 241_997_000 picoseconds. - Weight::from_parts(241_560_387, 3607) - // Standard Error: 64 - .saturating_add(Weight::from_parts(51_887, 0).saturating_mul(c.into())) + // Minimum execution time: 227_831_000 picoseconds. + Weight::from_parts(276_759_168, 3607) + // Standard Error: 73 + .saturating_add(Weight::from_parts(51_518, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -478,10 +478,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 236_134_000 picoseconds. - Weight::from_parts(240_786_320, 3607) - // Standard Error: 71 - .saturating_add(Weight::from_parts(52_250, 0).saturating_mul(c.into())) + // Minimum execution time: 242_961_000 picoseconds. + Weight::from_parts(276_454_808, 3607) + // Standard Error: 52 + .saturating_add(Weight::from_parts(51_574, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -497,8 +497,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_146_000 picoseconds. - Weight::from_parts(40_274_000, 3780) + // Minimum execution time: 39_314_000 picoseconds. + Weight::from_parts(40_497_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -512,8 +512,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_363_000 picoseconds. - Weight::from_parts(26_598_000, 6492) + // Minimum execution time: 25_080_000 picoseconds. + Weight::from_parts(26_235_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -522,17 +522,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_569_000 picoseconds. - Weight::from_parts(9_300_084, 0) - // Standard Error: 108 - .saturating_add(Weight::from_parts(52_313, 0).saturating_mul(r.into())) + // Minimum execution time: 8_312_000 picoseconds. + Weight::from_parts(9_396_819, 0) + // Standard Error: 92 + .saturating_add(Weight::from_parts(51_946, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_000 picoseconds. - Weight::from_parts(730_000, 0) + // Minimum execution time: 685_000 picoseconds. + Weight::from_parts(725_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -540,8 +540,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_210_000 picoseconds. - Weight::from_parts(6_574_000, 3819) + // Minimum execution time: 6_037_000 picoseconds. + Weight::from_parts(6_379_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -550,79 +550,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_466_000 picoseconds. - Weight::from_parts(7_597_000, 3912) + // Minimum execution time: 7_193_000 picoseconds. + Weight::from_parts(7_542_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 815_000 picoseconds. - Weight::from_parts(850_000, 0) + // Minimum execution time: 744_000 picoseconds. + Weight::from_parts(793_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 423_000 picoseconds. - Weight::from_parts(460_000, 0) + // Minimum execution time: 360_000 picoseconds. + Weight::from_parts(405_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 359_000 picoseconds. - Weight::from_parts(383_000, 0) + // Minimum execution time: 304_000 picoseconds. + Weight::from_parts(344_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 642_000 picoseconds. - Weight::from_parts(662_000, 0) + // Minimum execution time: 610_000 picoseconds. + Weight::from_parts(659_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 698_000 picoseconds. - Weight::from_parts(745_000, 0) + // Minimum execution time: 656_000 picoseconds. + Weight::from_parts(691_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_309_000 picoseconds. - Weight::from_parts(4_551_000, 0) + // Minimum execution time: 4_413_000 picoseconds. + Weight::from_parts(4_644_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 581_000 picoseconds. - Weight::from_parts(622_000, 0) + // Minimum execution time: 577_000 picoseconds. + Weight::from_parts(633_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 534_000 picoseconds. - Weight::from_parts(603_000, 0) + // Minimum execution time: 547_000 picoseconds. + Weight::from_parts(589_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 576_000 picoseconds. - Weight::from_parts(629_000, 0) + // Minimum execution time: 572_000 picoseconds. + Weight::from_parts(605_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 586_000 picoseconds. - Weight::from_parts(618_000, 0) + // Minimum execution time: 544_000 picoseconds. + Weight::from_parts(593_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -630,8 +630,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_114_000 picoseconds. - Weight::from_parts(4_266_000, 1552) + // Minimum execution time: 4_073_000 picoseconds. + Weight::from_parts(4_396_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -639,20 +639,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 525_000 picoseconds. - Weight::from_parts(554_000, 0) + // Minimum execution time: 496_000 picoseconds. + Weight::from_parts(508_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(301, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(310, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 355_000 picoseconds. - Weight::from_parts(414_000, 0) + // Minimum execution time: 322_000 picoseconds. + Weight::from_parts(353_000, 0) // Standard Error: 9 - .saturating_add(Weight::from_parts(411, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(429, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -665,10 +665,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_189_000 picoseconds. - Weight::from_parts(15_521_424, 3784) - // Standard Error: 7_042 - .saturating_add(Weight::from_parts(3_540_946, 0).saturating_mul(n.into())) + // Minimum execution time: 13_135_000 picoseconds. + Weight::from_parts(15_444_257, 3784) + // Standard Error: 7_383 + .saturating_add(Weight::from_parts(3_433_291, 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(3_u64)) @@ -681,8 +681,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_318_000 picoseconds. - Weight::from_parts(3_502_000, 1561) + // Minimum execution time: 3_284_000 picoseconds. + Weight::from_parts(3_578_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -693,12 +693,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 4_046_000 picoseconds. - Weight::from_parts(4_283_714, 990) - // Standard Error: 5_982 - .saturating_add(Weight::from_parts(2_087_616, 0).saturating_mul(t.into())) + // Minimum execution time: 3_656_000 picoseconds. + Weight::from_parts(3_844_233, 990) + // Standard Error: 5_163 + .saturating_add(Weight::from_parts(2_020_870, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(17, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(18, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -708,10 +708,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 455_000 picoseconds. - Weight::from_parts(472_000, 0) + // Minimum execution time: 401_000 picoseconds. + Weight::from_parts(427_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_210, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_218, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -721,12 +721,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 8_954_000 picoseconds. - Weight::from_parts(8_623_673, 249) - // Standard Error: 1 - .saturating_add(Weight::from_parts(259, 0).saturating_mul(n.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(60, 0).saturating_mul(o.into())) + // Minimum execution time: 8_796_000 picoseconds. + Weight::from_parts(8_510_040, 249) + // Standard Error: 2 + .saturating_add(Weight::from_parts(305, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(56, 0).saturating_mul(o.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(o.into())) @@ -738,10 +738,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_206_000 picoseconds. - Weight::from_parts(8_004_406, 248) + // Minimum execution time: 7_094_000 picoseconds. + Weight::from_parts(7_890_157, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(94, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(95, 0).saturating_mul(n.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(n.into())) @@ -753,10 +753,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_954_000 picoseconds. - Weight::from_parts(7_884_753, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(608, 0).saturating_mul(n.into())) + // Minimum execution time: 6_787_000 picoseconds. + Weight::from_parts(7_702_986, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(661, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -767,10 +767,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_338_000 picoseconds. - Weight::from_parts(7_024_910, 248) + // Minimum execution time: 6_292_000 picoseconds. + Weight::from_parts(6_980_800, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(78, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -781,10 +781,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_311_000 picoseconds. - Weight::from_parts(8_532_828, 248) - // Standard Error: 5 - .saturating_add(Weight::from_parts(626, 0).saturating_mul(n.into())) + // Minimum execution time: 7_701_000 picoseconds. + Weight::from_parts(8_452_715, 248) + // Standard Error: 4 + .saturating_add(Weight::from_parts(663, 0).saturating_mul(n.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(n.into())) @@ -793,36 +793,36 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_480_000 picoseconds. - Weight::from_parts(3_792_000, 0) + // Minimum execution time: 3_664_000 picoseconds. + Weight::from_parts(3_747_000, 0) } fn set_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_033_000 picoseconds. - Weight::from_parts(5_773_000, 0) + // Minimum execution time: 4_878_000 picoseconds. + Weight::from_parts(5_119_000, 0) } fn get_transient_storage_empty() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_070_000 picoseconds. - Weight::from_parts(3_166_000, 0) + // Minimum execution time: 3_680_000 picoseconds. + Weight::from_parts(3_737_000, 0) } fn get_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_004_000 picoseconds. - Weight::from_parts(4_592_000, 0) + // Minimum execution time: 4_403_000 picoseconds. + Weight::from_parts(4_526_000, 0) } fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_770_000 picoseconds. - Weight::from_parts(2_182_000, 0) + // Minimum execution time: 1_532_000 picoseconds. + Weight::from_parts(1_657_000, 0) } /// The range of component `n` is `[0, 16384]`. /// The range of component `o` is `[0, 16384]`. @@ -830,59 +830,57 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_127_000 picoseconds. - Weight::from_parts(3_326_103, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(196, 0).saturating_mul(n.into())) - // Standard Error: 2 - .saturating_add(Weight::from_parts(236, 0).saturating_mul(o.into())) + // Minimum execution time: 6_621_000 picoseconds. + Weight::from_parts(3_101_448, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(241, 0).saturating_mul(n.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(301, 0).saturating_mul(o.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_clear_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_737_000 picoseconds. - Weight::from_parts(3_076_732, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(235, 0).saturating_mul(n.into())) + // Minimum execution time: 2_646_000 picoseconds. + Weight::from_parts(3_011_683, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(301, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_840_000 picoseconds. - Weight::from_parts(2_069_155, 0) + // Minimum execution time: 1_793_000 picoseconds. + Weight::from_parts(1_962_873, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(223, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(302, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_contains_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_632_000 picoseconds. - Weight::from_parts(1_831_601, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(114, 0).saturating_mul(n.into())) + // Minimum execution time: 1_611_000 picoseconds. + Weight::from_parts(1_797_598, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(154, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. - fn seal_take_transient_storage(n: u32, ) -> Weight { + fn seal_take_transient_storage(_n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_620_000 picoseconds. - Weight::from_parts(8_975_587, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3, 0).saturating_mul(n.into())) + // Minimum execution time: 10_354_000 picoseconds. + Weight::from_parts(10_838_032, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_575_000 picoseconds. - Weight::from_parts(8_822_000, 0) + // Minimum execution time: 8_446_000 picoseconds. + Weight::from_parts(8_671_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -898,12 +896,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 122_879_000 picoseconds. - Weight::from_parts(118_946_943, 4085) - // Standard Error: 178_620 - .saturating_add(Weight::from_parts(44_449_408, 0).saturating_mul(t.into())) + // Minimum execution time: 124_785_000 picoseconds. + Weight::from_parts(123_734_045, 4085) + // Standard Error: 216_532 + .saturating_add(Weight::from_parts(42_188_553, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(7, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -918,8 +916,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 111_844_000 picoseconds. - Weight::from_parts(116_455_000, 3895) + // Minimum execution time: 111_252_000 picoseconds. + Weight::from_parts(113_980_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -938,12 +936,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4132` - // Minimum execution time: 1_896_838_000 picoseconds. - Weight::from_parts(1_918_193_000, 4132) - // Standard Error: 28 - .saturating_add(Weight::from_parts(641, 0).saturating_mul(i.into())) - // Standard Error: 28 - .saturating_add(Weight::from_parts(996, 0).saturating_mul(s.into())) + // Minimum execution time: 1_960_976_000 picoseconds. + Weight::from_parts(1_980_055_000, 4132) + // Standard Error: 24 + .saturating_add(Weight::from_parts(619, 0).saturating_mul(i.into())) + // Standard Error: 24 + .saturating_add(Weight::from_parts(913, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -952,64 +950,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 879_000 picoseconds. - Weight::from_parts(8_480_018, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_328, 0).saturating_mul(n.into())) + // Minimum execution time: 859_000 picoseconds. + Weight::from_parts(9_249_672, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_357, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_472_000 picoseconds. - Weight::from_parts(12_900_224, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(3_597, 0).saturating_mul(n.into())) + // Minimum execution time: 1_345_000 picoseconds. + Weight::from_parts(8_050_662, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(3_628, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 775_000 picoseconds. - Weight::from_parts(9_895_369, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_463, 0).saturating_mul(n.into())) + // Minimum execution time: 766_000 picoseconds. + Weight::from_parts(10_050_435, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_490, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 730_000 picoseconds. - Weight::from_parts(8_105_347, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_464, 0).saturating_mul(n.into())) + // Minimum execution time: 769_000 picoseconds. + Weight::from_parts(8_125_044, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_491, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_581_000 picoseconds. - Weight::from_parts(40_545_608, 0) - // Standard Error: 10 - .saturating_add(Weight::from_parts(5_128, 0).saturating_mul(n.into())) + // Minimum execution time: 45_430_000 picoseconds. + Weight::from_parts(44_038_200, 0) + // Standard Error: 11 + .saturating_add(Weight::from_parts(5_135, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 48_295_000 picoseconds. - Weight::from_parts(49_412_000, 0) + // Minimum execution time: 46_948_000 picoseconds. + Weight::from_parts(48_692_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_287_000 picoseconds. - Weight::from_parts(13_447_000, 0) + // Minimum execution time: 12_982_000 picoseconds. + Weight::from_parts(13_142_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1019,8 +1017,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_815_000 picoseconds. - Weight::from_parts(18_536_000, 3895) + // Minimum execution time: 17_539_000 picoseconds. + Weight::from_parts(18_145_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1030,8 +1028,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_140_000 picoseconds. - Weight::from_parts(8_538_000, 3820) + // Minimum execution time: 8_323_000 picoseconds. + Weight::from_parts(8_600_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1041,8 +1039,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_253_000 picoseconds. - Weight::from_parts(7_662_000, 3558) + // Minimum execution time: 7_529_000 picoseconds. + Weight::from_parts(7_732_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1050,15 +1048,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 340_000 picoseconds. - Weight::from_parts(373_000, 0) + // Minimum execution time: 318_000 picoseconds. + Weight::from_parts(362_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 353_000 picoseconds. - Weight::from_parts(392_000, 0) + // Minimum execution time: 349_000 picoseconds. + Weight::from_parts(386_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1066,8 +1064,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_827_000 picoseconds. - Weight::from_parts(2_924_000, 1704) + // Minimum execution time: 2_885_000 picoseconds. + Weight::from_parts(3_005_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1075,10 +1073,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 843_000 picoseconds. - Weight::from_parts(919_937, 0) - // Standard Error: 21 - .saturating_add(Weight::from_parts(7_087, 0).saturating_mul(r.into())) + // Minimum execution time: 732_000 picoseconds. + Weight::from_parts(930_550, 0) + // Standard Error: 25 + .saturating_add(Weight::from_parts(7_096, 0).saturating_mul(r.into())) } } @@ -1090,8 +1088,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_847_000 picoseconds. - Weight::from_parts(1_905_000, 1627) + // Minimum execution time: 1_868_000 picoseconds. + Weight::from_parts(1_940_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1101,10 +1099,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 10_732_000 picoseconds. - Weight::from_parts(11_004_000, 442) - // Standard Error: 1_793 - .saturating_add(Weight::from_parts(1_230_603, 0).saturating_mul(k.into())) + // Minimum execution time: 11_390_000 picoseconds. + Weight::from_parts(11_812_000, 442) + // Standard Error: 1_686 + .saturating_add(Weight::from_parts(1_137_138, 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)) @@ -1118,10 +1116,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_703_000 picoseconds. - Weight::from_parts(4_323_140, 6149) + // Minimum execution time: 7_576_000 picoseconds. + Weight::from_parts(4_420_265, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_649, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1134,8 +1132,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_011_000 picoseconds. - Weight::from_parts(17_043_000, 6450) + // Minimum execution time: 16_147_000 picoseconds. + Weight::from_parts(16_485_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1148,10 +1146,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_128_000 picoseconds. - Weight::from_parts(3_173_000, 3635) - // Standard Error: 654 - .saturating_add(Weight::from_parts(1_110_890, 0).saturating_mul(k.into())) + // Minimum execution time: 3_140_000 picoseconds. + Weight::from_parts(3_203_000, 3635) + // Standard Error: 660 + .saturating_add(Weight::from_parts(1_106_850, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1170,10 +1168,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 14_921_000 picoseconds. - Weight::from_parts(15_612_273, 6263) - // Standard Error: 2 - .saturating_add(Weight::from_parts(418, 0).saturating_mul(c.into())) + // Minimum execution time: 14_742_000 picoseconds. + Weight::from_parts(15_346_515, 6263) + // Standard Error: 1 + .saturating_add(Weight::from_parts(454, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1184,8 +1182,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 11_955_000 picoseconds. - Weight::from_parts(12_583_000, 6380) + // Minimum execution time: 12_060_000 picoseconds. + Weight::from_parts(12_694_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1199,8 +1197,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 47_089_000 picoseconds. - Weight::from_parts(48_541_000, 6292) + // Minimum execution time: 47_782_000 picoseconds. + Weight::from_parts(48_385_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1212,8 +1210,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_300_000 picoseconds. - Weight::from_parts(53_751_000, 6534) + // Minimum execution time: 52_281_000 picoseconds. + Weight::from_parts(54_174_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1223,8 +1221,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_739_000 picoseconds. - Weight::from_parts(11_924_000, 6349) + // Minimum execution time: 11_337_000 picoseconds. + Weight::from_parts(11_890_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1234,8 +1232,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_120_000 picoseconds. - Weight::from_parts(2_208_000, 1627) + // Minimum execution time: 2_126_000 picoseconds. + Weight::from_parts(2_260_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1247,8 +1245,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_800_000 picoseconds. - Weight::from_parts(11_293_000, 3631) + // Minimum execution time: 10_757_000 picoseconds. + Weight::from_parts(11_120_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1258,8 +1256,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_523_000 picoseconds. - Weight::from_parts(4_675_000, 3607) + // Minimum execution time: 4_342_000 picoseconds. + Weight::from_parts(4_510_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1270,8 +1268,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_705_000 picoseconds. - Weight::from_parts(5_934_000, 3632) + // Minimum execution time: 5_534_000 picoseconds. + Weight::from_parts(5_731_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1282,8 +1280,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_563_000 picoseconds. - Weight::from_parts(5_759_000, 3607) + // Minimum execution time: 5_439_000 picoseconds. + Weight::from_parts(5_699_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1304,10 +1302,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `800 + c * (1 ±0)` // Estimated: `4266 + c * (1 ±0)` - // Minimum execution time: 246_043_000 picoseconds. - Weight::from_parts(258_567_009, 4266) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_071, 0).saturating_mul(c.into())) + // Minimum execution time: 259_120_000 picoseconds. + Weight::from_parts(269_467_515, 4266) + // Standard Error: 4 + .saturating_add(Weight::from_parts(731, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1335,14 +1333,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_647_328_000 picoseconds. - Weight::from_parts(27_062_930, 6262) - // Standard Error: 185 - .saturating_add(Weight::from_parts(57_634, 0).saturating_mul(c.into())) - // Standard Error: 22 - .saturating_add(Weight::from_parts(2_185, 0).saturating_mul(i.into())) - // Standard Error: 22 - .saturating_add(Weight::from_parts(2_465, 0).saturating_mul(s.into())) + // Minimum execution time: 4_610_363_000 picoseconds. + Weight::from_parts(149_861_617, 6262) + // Standard Error: 126 + .saturating_add(Weight::from_parts(53_395, 0).saturating_mul(c.into())) + // Standard Error: 15 + .saturating_add(Weight::from_parts(2_292, 0).saturating_mul(i.into())) + // Standard Error: 15 + .saturating_add(Weight::from_parts(2_268, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1368,12 +1366,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4017` - // Minimum execution time: 2_248_169_000 picoseconds. - Weight::from_parts(2_281_849_000, 4017) - // Standard Error: 35 - .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(i.into())) - // Standard Error: 35 - .saturating_add(Weight::from_parts(993, 0).saturating_mul(s.into())) + // Minimum execution time: 2_299_412_000 picoseconds. + Weight::from_parts(2_314_212_000, 4017) + // Standard Error: 32 + .saturating_add(Weight::from_parts(1_003, 0).saturating_mul(i.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(937, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1393,8 +1391,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 165_105_000 picoseconds. - Weight::from_parts(168_941_000, 4291) + // Minimum execution time: 166_492_000 picoseconds. + Weight::from_parts(170_786_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1411,10 +1409,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 241_997_000 picoseconds. - Weight::from_parts(241_560_387, 3607) - // Standard Error: 64 - .saturating_add(Weight::from_parts(51_887, 0).saturating_mul(c.into())) + // Minimum execution time: 227_831_000 picoseconds. + Weight::from_parts(276_759_168, 3607) + // Standard Error: 73 + .saturating_add(Weight::from_parts(51_518, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1431,10 +1429,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 236_134_000 picoseconds. - Weight::from_parts(240_786_320, 3607) - // Standard Error: 71 - .saturating_add(Weight::from_parts(52_250, 0).saturating_mul(c.into())) + // Minimum execution time: 242_961_000 picoseconds. + Weight::from_parts(276_454_808, 3607) + // Standard Error: 52 + .saturating_add(Weight::from_parts(51_574, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1450,8 +1448,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_146_000 picoseconds. - Weight::from_parts(40_274_000, 3780) + // Minimum execution time: 39_314_000 picoseconds. + Weight::from_parts(40_497_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1465,8 +1463,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_363_000 picoseconds. - Weight::from_parts(26_598_000, 6492) + // Minimum execution time: 25_080_000 picoseconds. + Weight::from_parts(26_235_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1475,17 +1473,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_569_000 picoseconds. - Weight::from_parts(9_300_084, 0) - // Standard Error: 108 - .saturating_add(Weight::from_parts(52_313, 0).saturating_mul(r.into())) + // Minimum execution time: 8_312_000 picoseconds. + Weight::from_parts(9_396_819, 0) + // Standard Error: 92 + .saturating_add(Weight::from_parts(51_946, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_000 picoseconds. - Weight::from_parts(730_000, 0) + // Minimum execution time: 685_000 picoseconds. + Weight::from_parts(725_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1493,8 +1491,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_210_000 picoseconds. - Weight::from_parts(6_574_000, 3819) + // Minimum execution time: 6_037_000 picoseconds. + Weight::from_parts(6_379_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1503,79 +1501,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_466_000 picoseconds. - Weight::from_parts(7_597_000, 3912) + // Minimum execution time: 7_193_000 picoseconds. + Weight::from_parts(7_542_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 815_000 picoseconds. - Weight::from_parts(850_000, 0) + // Minimum execution time: 744_000 picoseconds. + Weight::from_parts(793_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 423_000 picoseconds. - Weight::from_parts(460_000, 0) + // Minimum execution time: 360_000 picoseconds. + Weight::from_parts(405_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 359_000 picoseconds. - Weight::from_parts(383_000, 0) + // Minimum execution time: 304_000 picoseconds. + Weight::from_parts(344_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 642_000 picoseconds. - Weight::from_parts(662_000, 0) + // Minimum execution time: 610_000 picoseconds. + Weight::from_parts(659_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 698_000 picoseconds. - Weight::from_parts(745_000, 0) + // Minimum execution time: 656_000 picoseconds. + Weight::from_parts(691_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_309_000 picoseconds. - Weight::from_parts(4_551_000, 0) + // Minimum execution time: 4_413_000 picoseconds. + Weight::from_parts(4_644_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 581_000 picoseconds. - Weight::from_parts(622_000, 0) + // Minimum execution time: 577_000 picoseconds. + Weight::from_parts(633_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 534_000 picoseconds. - Weight::from_parts(603_000, 0) + // Minimum execution time: 547_000 picoseconds. + Weight::from_parts(589_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 576_000 picoseconds. - Weight::from_parts(629_000, 0) + // Minimum execution time: 572_000 picoseconds. + Weight::from_parts(605_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 586_000 picoseconds. - Weight::from_parts(618_000, 0) + // Minimum execution time: 544_000 picoseconds. + Weight::from_parts(593_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1583,8 +1581,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_114_000 picoseconds. - Weight::from_parts(4_266_000, 1552) + // Minimum execution time: 4_073_000 picoseconds. + Weight::from_parts(4_396_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1592,20 +1590,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 525_000 picoseconds. - Weight::from_parts(554_000, 0) + // Minimum execution time: 496_000 picoseconds. + Weight::from_parts(508_000, 0) // Standard Error: 3 - .saturating_add(Weight::from_parts(301, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(310, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048572]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 355_000 picoseconds. - Weight::from_parts(414_000, 0) + // Minimum execution time: 322_000 picoseconds. + Weight::from_parts(353_000, 0) // Standard Error: 9 - .saturating_add(Weight::from_parts(411, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(429, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1618,10 +1616,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_189_000 picoseconds. - Weight::from_parts(15_521_424, 3784) - // Standard Error: 7_042 - .saturating_add(Weight::from_parts(3_540_946, 0).saturating_mul(n.into())) + // Minimum execution time: 13_135_000 picoseconds. + Weight::from_parts(15_444_257, 3784) + // Standard Error: 7_383 + .saturating_add(Weight::from_parts(3_433_291, 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(3_u64)) @@ -1634,8 +1632,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_318_000 picoseconds. - Weight::from_parts(3_502_000, 1561) + // Minimum execution time: 3_284_000 picoseconds. + Weight::from_parts(3_578_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1646,12 +1644,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 4_046_000 picoseconds. - Weight::from_parts(4_283_714, 990) - // Standard Error: 5_982 - .saturating_add(Weight::from_parts(2_087_616, 0).saturating_mul(t.into())) + // Minimum execution time: 3_656_000 picoseconds. + Weight::from_parts(3_844_233, 990) + // Standard Error: 5_163 + .saturating_add(Weight::from_parts(2_020_870, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(17, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(18, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1661,10 +1659,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 455_000 picoseconds. - Weight::from_parts(472_000, 0) + // Minimum execution time: 401_000 picoseconds. + Weight::from_parts(427_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_210, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_218, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1674,12 +1672,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 8_954_000 picoseconds. - Weight::from_parts(8_623_673, 249) - // Standard Error: 1 - .saturating_add(Weight::from_parts(259, 0).saturating_mul(n.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(60, 0).saturating_mul(o.into())) + // Minimum execution time: 8_796_000 picoseconds. + Weight::from_parts(8_510_040, 249) + // Standard Error: 2 + .saturating_add(Weight::from_parts(305, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(56, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1691,10 +1689,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_206_000 picoseconds. - Weight::from_parts(8_004_406, 248) + // Minimum execution time: 7_094_000 picoseconds. + Weight::from_parts(7_890_157, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(94, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(95, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1706,10 +1704,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_954_000 picoseconds. - Weight::from_parts(7_884_753, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(608, 0).saturating_mul(n.into())) + // Minimum execution time: 6_787_000 picoseconds. + Weight::from_parts(7_702_986, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(661, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1720,10 +1718,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_338_000 picoseconds. - Weight::from_parts(7_024_910, 248) + // Minimum execution time: 6_292_000 picoseconds. + Weight::from_parts(6_980_800, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(81, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(78, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1734,10 +1732,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_311_000 picoseconds. - Weight::from_parts(8_532_828, 248) - // Standard Error: 5 - .saturating_add(Weight::from_parts(626, 0).saturating_mul(n.into())) + // Minimum execution time: 7_701_000 picoseconds. + Weight::from_parts(8_452_715, 248) + // Standard Error: 4 + .saturating_add(Weight::from_parts(663, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1746,36 +1744,36 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_480_000 picoseconds. - Weight::from_parts(3_792_000, 0) + // Minimum execution time: 3_664_000 picoseconds. + Weight::from_parts(3_747_000, 0) } fn set_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_033_000 picoseconds. - Weight::from_parts(5_773_000, 0) + // Minimum execution time: 4_878_000 picoseconds. + Weight::from_parts(5_119_000, 0) } fn get_transient_storage_empty() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_070_000 picoseconds. - Weight::from_parts(3_166_000, 0) + // Minimum execution time: 3_680_000 picoseconds. + Weight::from_parts(3_737_000, 0) } fn get_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_004_000 picoseconds. - Weight::from_parts(4_592_000, 0) + // Minimum execution time: 4_403_000 picoseconds. + Weight::from_parts(4_526_000, 0) } fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_770_000 picoseconds. - Weight::from_parts(2_182_000, 0) + // Minimum execution time: 1_532_000 picoseconds. + Weight::from_parts(1_657_000, 0) } /// The range of component `n` is `[0, 16384]`. /// The range of component `o` is `[0, 16384]`. @@ -1783,59 +1781,57 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_127_000 picoseconds. - Weight::from_parts(3_326_103, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(196, 0).saturating_mul(n.into())) - // Standard Error: 2 - .saturating_add(Weight::from_parts(236, 0).saturating_mul(o.into())) + // Minimum execution time: 6_621_000 picoseconds. + Weight::from_parts(3_101_448, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(241, 0).saturating_mul(n.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(301, 0).saturating_mul(o.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_clear_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_737_000 picoseconds. - Weight::from_parts(3_076_732, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(235, 0).saturating_mul(n.into())) + // Minimum execution time: 2_646_000 picoseconds. + Weight::from_parts(3_011_683, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(301, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_840_000 picoseconds. - Weight::from_parts(2_069_155, 0) + // Minimum execution time: 1_793_000 picoseconds. + Weight::from_parts(1_962_873, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(223, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(302, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_contains_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_632_000 picoseconds. - Weight::from_parts(1_831_601, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(114, 0).saturating_mul(n.into())) + // Minimum execution time: 1_611_000 picoseconds. + Weight::from_parts(1_797_598, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(154, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. - fn seal_take_transient_storage(n: u32, ) -> Weight { + fn seal_take_transient_storage(_n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_620_000 picoseconds. - Weight::from_parts(8_975_587, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3, 0).saturating_mul(n.into())) + // Minimum execution time: 10_354_000 picoseconds. + Weight::from_parts(10_838_032, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_575_000 picoseconds. - Weight::from_parts(8_822_000, 0) + // Minimum execution time: 8_446_000 picoseconds. + Weight::from_parts(8_671_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1851,12 +1847,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 122_879_000 picoseconds. - Weight::from_parts(118_946_943, 4085) - // Standard Error: 178_620 - .saturating_add(Weight::from_parts(44_449_408, 0).saturating_mul(t.into())) + // Minimum execution time: 124_785_000 picoseconds. + Weight::from_parts(123_734_045, 4085) + // Standard Error: 216_532 + .saturating_add(Weight::from_parts(42_188_553, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(7, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1871,8 +1867,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 111_844_000 picoseconds. - Weight::from_parts(116_455_000, 3895) + // Minimum execution time: 111_252_000 picoseconds. + Weight::from_parts(113_980_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1891,12 +1887,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4132` - // Minimum execution time: 1_896_838_000 picoseconds. - Weight::from_parts(1_918_193_000, 4132) - // Standard Error: 28 - .saturating_add(Weight::from_parts(641, 0).saturating_mul(i.into())) - // Standard Error: 28 - .saturating_add(Weight::from_parts(996, 0).saturating_mul(s.into())) + // Minimum execution time: 1_960_976_000 picoseconds. + Weight::from_parts(1_980_055_000, 4132) + // Standard Error: 24 + .saturating_add(Weight::from_parts(619, 0).saturating_mul(i.into())) + // Standard Error: 24 + .saturating_add(Weight::from_parts(913, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1905,64 +1901,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 879_000 picoseconds. - Weight::from_parts(8_480_018, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_328, 0).saturating_mul(n.into())) + // Minimum execution time: 859_000 picoseconds. + Weight::from_parts(9_249_672, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_357, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_472_000 picoseconds. - Weight::from_parts(12_900_224, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(3_597, 0).saturating_mul(n.into())) + // Minimum execution time: 1_345_000 picoseconds. + Weight::from_parts(8_050_662, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(3_628, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 775_000 picoseconds. - Weight::from_parts(9_895_369, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_463, 0).saturating_mul(n.into())) + // Minimum execution time: 766_000 picoseconds. + Weight::from_parts(10_050_435, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_490, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 730_000 picoseconds. - Weight::from_parts(8_105_347, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_464, 0).saturating_mul(n.into())) + // Minimum execution time: 769_000 picoseconds. + Weight::from_parts(8_125_044, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_491, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_581_000 picoseconds. - Weight::from_parts(40_545_608, 0) - // Standard Error: 10 - .saturating_add(Weight::from_parts(5_128, 0).saturating_mul(n.into())) + // Minimum execution time: 45_430_000 picoseconds. + Weight::from_parts(44_038_200, 0) + // Standard Error: 11 + .saturating_add(Weight::from_parts(5_135, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 48_295_000 picoseconds. - Weight::from_parts(49_412_000, 0) + // Minimum execution time: 46_948_000 picoseconds. + Weight::from_parts(48_692_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_287_000 picoseconds. - Weight::from_parts(13_447_000, 0) + // Minimum execution time: 12_982_000 picoseconds. + Weight::from_parts(13_142_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1972,8 +1968,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_815_000 picoseconds. - Weight::from_parts(18_536_000, 3895) + // Minimum execution time: 17_539_000 picoseconds. + Weight::from_parts(18_145_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1983,8 +1979,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_140_000 picoseconds. - Weight::from_parts(8_538_000, 3820) + // Minimum execution time: 8_323_000 picoseconds. + Weight::from_parts(8_600_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1994,8 +1990,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_253_000 picoseconds. - Weight::from_parts(7_662_000, 3558) + // Minimum execution time: 7_529_000 picoseconds. + Weight::from_parts(7_732_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -2003,15 +1999,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 340_000 picoseconds. - Weight::from_parts(373_000, 0) + // Minimum execution time: 318_000 picoseconds. + Weight::from_parts(362_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 353_000 picoseconds. - Weight::from_parts(392_000, 0) + // Minimum execution time: 349_000 picoseconds. + Weight::from_parts(386_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -2019,8 +2015,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_827_000 picoseconds. - Weight::from_parts(2_924_000, 1704) + // Minimum execution time: 2_885_000 picoseconds. + Weight::from_parts(3_005_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -2028,9 +2024,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 843_000 picoseconds. - Weight::from_parts(919_937, 0) - // Standard Error: 21 - .saturating_add(Weight::from_parts(7_087, 0).saturating_mul(r.into())) + // Minimum execution time: 732_000 picoseconds. + Weight::from_parts(930_550, 0) + // Standard Error: 25 + .saturating_add(Weight::from_parts(7_096, 0).saturating_mul(r.into())) } } From 037f0e61ef6afb2df83f8a2fc5fce7bf2e945d55 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 3 Jul 2024 11:13:38 +0200 Subject: [PATCH 42/58] Update substrate/frame/contracts/src/exec.rs Co-authored-by: PG Herveou --- substrate/frame/contracts/src/exec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 32a01d8025cc..8688f7cf3118 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -210,7 +210,7 @@ pub trait Ext: sealing::Sealed { take_old: bool, ) -> Result; - /// Returns the transient storage entry of the executing account by the given `key`. + /// Returns the transient storage entry of the executing account for the given `key`. /// /// Returns `None` if the `key` wasn't previously set by `set_transient_storage` or /// was deleted. From ea62ecea0f2488dfc27c7523702bfa844b68380f Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 3 Jul 2024 11:13:53 +0200 Subject: [PATCH 43/58] Update substrate/frame/contracts/src/exec.rs Co-authored-by: PG Herveou --- substrate/frame/contracts/src/exec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 8688f7cf3118..ace2198505f9 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -222,7 +222,7 @@ pub trait Ext: sealing::Sealed { /// was deleted. fn get_transient_storage_size(&self, key: &Key) -> Option; - /// Sets the transient storage entry by the given key to the specified value. If `value` is + /// Sets the transient storage entry for the given key to the specified value. If `value` is /// `None` then the storage entry is deleted. fn set_transient_storage( &mut self, From 08881643a897e320e289466645099d91044b70ac Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 4 Jul 2024 14:55:47 +0200 Subject: [PATCH 44/58] Update substrate/frame/contracts/src/transient_storage.rs Co-authored-by: PG Herveou --- substrate/frame/contracts/src/transient_storage.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index be70d9b136b2..20ea69c2e473 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -157,7 +157,7 @@ impl Journal { Self(Default::default()) } - /// Add a chenge to the journal. + /// Add a change to the journal. pub fn push(&mut self, entry: JournalEntry) { self.0.push(entry); } From 176bbc569a04c19b98e587c89118d146213d668e Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 4 Jul 2024 15:50:55 +0200 Subject: [PATCH 45/58] Update substrate/frame/contracts/src/transient_storage.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- substrate/frame/contracts/src/transient_storage.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 20ea69c2e473..802df14a3a66 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -76,7 +76,7 @@ impl StorageMeter { if meter.exceeds_limit(amount) { return Err(Error::::OutOfTransientStorage.into()); } - meter.amount = meter.amount.saturating_add(amount); + meter.amount.saturating_accrue(amount); Ok(()) } From fb8f0ad8331f7c814fc8b316b328af35a6a3d972 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 4 Jul 2024 17:40:14 +0200 Subject: [PATCH 46/58] Change fn visibility and code cleanup --- prdoc/pr_4566.prdoc | 3 +- .../frame/contracts/src/transient_storage.rs | 45 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/prdoc/pr_4566.prdoc b/prdoc/pr_4566.prdoc index d3f04310c8bf..b5a8cce1d1b0 100644 --- a/prdoc/pr_4566.prdoc +++ b/prdoc/pr_4566.prdoc @@ -11,7 +11,8 @@ doc: This functionality is similar to the `TSTORE` and `TLOAD` operations used in Ethereum. The following new host functions have been introduced: `get_transient_storage`, `set_transient_storage`, `take_transient_storage`, `clear_transient_storage` and - `contains_transient_storage` + `contains_transient_storage`. + These functions are declared as unstable and thus are not activated. crates: - name: pallet-contracts diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 802df14a3a66..553f72dfba77 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -25,7 +25,7 @@ use crate::{ use codec::Encode; use core::marker::PhantomData; use frame_support::DefaultNoBound; -use sp_runtime::{DispatchError, DispatchResult}; +use sp_runtime::{DispatchError, DispatchResult, Saturating}; use sp_std::{collections::btree_map::BTreeMap, mem, vec::Vec}; /// Meter entry tracks transaction allocations. @@ -39,18 +39,18 @@ pub struct MeterEntry { impl MeterEntry { /// Create a new entry. - pub fn new(limit: u32) -> Self { + fn new(limit: u32) -> Self { Self { limit, amount: Default::default() } } /// Check if the allocated amount exceeds the limit. - pub fn exceeds_limit(&self, amount: u32) -> bool { + fn exceeds_limit(&self, amount: u32) -> bool { self.amount.saturating_add(amount) > self.limit } /// Absorb the allocation amount of the nested entry into the current entry. - pub fn absorb(&mut self, rhs: Self) { - self.amount = self.amount.saturating_add(rhs.amount) + fn absorb(&mut self, rhs: Self) { + self.amount.saturating_accrue(rhs.amount) } } @@ -66,12 +66,12 @@ pub struct StorageMeter { impl StorageMeter { const STORAGE_FRACTION_DENOMINATOR: u32 = 16; /// Create a new storage allocation meter. - pub fn new(memory_limit: u32) -> Self { + fn new(memory_limit: u32) -> Self { Self { root_meter: MeterEntry::new(memory_limit), ..Default::default() } } /// Charge the allocated amount of transaction storage from the meter. - pub fn charge(&mut self, amount: u32) -> DispatchResult { + fn charge(&mut self, amount: u32) -> DispatchResult { let meter = self.current_mut(); if meter.exceeds_limit(amount) { return Err(Error::::OutOfTransientStorage.into()); @@ -81,20 +81,20 @@ impl StorageMeter { } /// Revert a transaction meter. - pub fn revert(&mut self) { + fn revert(&mut self) { self.nested_meters .pop() .expect("There is no nested meter that can be reverted."); } /// Start a transaction meter. - pub fn start(&mut self) { + fn start(&mut self) { let meter = self.current(); let mut transaction_limit = meter.limit.saturating_sub(meter.amount); if !self.nested_meters.is_empty() { // Allow use of (1 - 1/STORAGE_FRACTION_DENOMINATOR) of free storage for subsequent // calls. - transaction_limit = transaction_limit.saturating_sub( + transaction_limit.saturating_reduce( transaction_limit.saturating_div(Self::STORAGE_FRACTION_DENOMINATOR), ); } @@ -103,7 +103,7 @@ impl StorageMeter { } /// Commit a transaction meter. - pub fn commit(&mut self) { + fn commit(&mut self) { let transaction_meter = self .nested_meters .pop() @@ -112,8 +112,8 @@ impl StorageMeter { } /// The total allocated amount of memory. - #[cfg(any(test, feature = "runtime-benchmarks"))] - pub fn total_amount(&self) -> u32 { + #[cfg(test)] + fn total_amount(&self) -> u32 { self.nested_meters .iter() .fold(self.root_meter.amount, |acc, e| acc.saturating_add(e.amount)) @@ -138,12 +138,12 @@ struct JournalEntry { impl JournalEntry { /// Create a new change. - pub fn new(key: Vec, prev_value: Option>) -> Self { + fn new(key: Vec, prev_value: Option>) -> Self { Self { key, prev_value } } /// Revert the change. - pub fn revert(self, storage: &mut Storage) { + fn revert(self, storage: &mut Storage) { storage.write(&self.key, self.prev_value); } } @@ -153,22 +153,22 @@ struct Journal(Vec); impl Journal { /// Create a new journal. - pub fn new() -> Self { + fn new() -> Self { Self(Default::default()) } /// Add a change to the journal. - pub fn push(&mut self, entry: JournalEntry) { + fn push(&mut self, entry: JournalEntry) { self.0.push(entry); } /// Length of the journal. - pub fn len(&self) -> usize { + fn len(&self) -> usize { self.0.len() } /// Roll back all journal changes until the chackpoint - pub fn rollback(&mut self, storage: &mut Storage, checkpoint: usize) { + fn rollback(&mut self, storage: &mut Storage, checkpoint: usize) { self.0.drain(checkpoint..).rev().for_each(|entry| entry.revert(storage)); } } @@ -179,12 +179,12 @@ struct Storage(BTreeMap, Vec>); impl Storage { /// Read the storage entry. - pub fn read(&self, key: &Vec) -> Option> { + fn read(&self, key: &Vec) -> Option> { self.0.get(key).cloned() } /// Write the storage entry. - pub fn write(&mut self, key: &Vec, value: Option>) -> Option> { + fn write(&mut self, key: &Vec, value: Option>) -> Option> { if let Some(value) = value { // Insert storage entry. self.0.insert(key.clone(), value) @@ -261,8 +261,7 @@ impl TransientStorage { // If there was no previous value, a new entry is added to storage (BTreeMap) // containing a Vec for the key and a Vec for the value. The value was already // included in the amount. - amount = - amount.saturating_add(key_len).saturating_add(mem::size_of::>()); + amount.saturating_accrue(key_len.saturating_add(mem::size_of::>())); } self.meter.charge(amount as _)?; } From 4b148b9a2dce6d7c97e073dbd368adc0fdb3436c Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 4 Jul 2024 23:30:21 +0200 Subject: [PATCH 47/58] Update tests --- prdoc/pr_4566.prdoc | 2 +- substrate/frame/contracts/src/lib.rs | 2 +- substrate/frame/contracts/src/tests.rs | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/prdoc/pr_4566.prdoc b/prdoc/pr_4566.prdoc index b5a8cce1d1b0..5f7bb6ac80a8 100644 --- a/prdoc/pr_4566.prdoc +++ b/prdoc/pr_4566.prdoc @@ -16,7 +16,7 @@ doc: crates: - name: pallet-contracts - bump: minor + bump: major - name: pallet-contracts-uapi bump: minor - name: contracts-rococo-runtime diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index ecbbc6fad18b..dd2d42afcade 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -560,7 +560,7 @@ pub mod pallet { type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxDelegateDependencies = MaxDelegateDependencies; type MaxStorageKeyLen = ConstU32<128>; - type MaxTransientStorageSize = ConstU32<{ 4 * 1024 }>; + type MaxTransientStorageSize = ConstU32<{ 1 * 1024 * 1024 }>; type Migrations = (); type Time = Self; type Randomness = Self; diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 691f20ac8308..37eb0538ec6e 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -411,6 +411,7 @@ parameter_types! { pub static DepositPerByte: BalanceOf = 1; pub const DepositPerItem: BalanceOf = 2; pub static MaxDelegateDependencies: u32 = 32; + pub static MaxTransientStorageSize: u32 = 4 * 1024; pub static CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(0); // We need this one set high enough for running benchmarks. @@ -504,6 +505,7 @@ impl Config for Test { type Migrations = crate::migration::codegen::BenchMigrations; type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type MaxDelegateDependencies = MaxDelegateDependencies; + type MaxTransientStorageSize = MaxTransientStorageSize; type Debug = TestDebug; } @@ -994,21 +996,29 @@ fn transient_storage_limit_in_call() { .value(min_balance * 100) .build_and_unwrap_account_id(); - // The transient storage limit is set to 4KB. + MaxTransientStorageSize::set(4 * 1024); + // Call contracts with storage values within the limit. + // Caller and Callee contracts each set a transient storage value of size 1000. assert_ok!(builder::call(addr_caller.clone()) - .data((1_000u32, 2_000u32, &addr_callee).encode()) + .data((1_000u32, 1_000u32, &addr_callee).encode()) .build(),); + MaxTransientStorageSize::set(512); + // Call a contract with a storage value that is too large. + // Limit exceeded in the caller contract. assert_err_ignore_postinfo!( builder::call(addr_caller.clone()) - .data((5_000u32, 1_000u32, &addr_callee).encode()) + .data((1_000u32, 1_000u32, &addr_callee).encode()) .build(), >::OutOfTransientStorage, ); + MaxTransientStorageSize::set(1536); + // Call a contract with a storage value that is too large. + // Limit exceeded in the callee contract. assert_err_ignore_postinfo!( builder::call(addr_caller) - .data((1_000u32, 4_000u32, &addr_callee).encode()) + .data((1_000u32, 1_000u32, &addr_callee).encode()) .build(), >::ContractTrapped ); From 057fd0d3c681535bac71d21e9624a112daa65efa Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 4 Jul 2024 23:35:27 +0200 Subject: [PATCH 48/58] Update tests --- substrate/frame/contracts/src/tests.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 37eb0538ec6e..ce5144a462ad 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -996,11 +996,12 @@ fn transient_storage_limit_in_call() { .value(min_balance * 100) .build_and_unwrap_account_id(); + let storage_value_size = 1000; MaxTransientStorageSize::set(4 * 1024); // Call contracts with storage values within the limit. // Caller and Callee contracts each set a transient storage value of size 1000. assert_ok!(builder::call(addr_caller.clone()) - .data((1_000u32, 1_000u32, &addr_callee).encode()) + .data((storage_value_size, storage_value_size, &addr_callee).encode()) .build(),); MaxTransientStorageSize::set(512); @@ -1008,7 +1009,7 @@ fn transient_storage_limit_in_call() { // Limit exceeded in the caller contract. assert_err_ignore_postinfo!( builder::call(addr_caller.clone()) - .data((1_000u32, 1_000u32, &addr_callee).encode()) + .data((storage_value_size, storage_value_size, &addr_callee).encode()) .build(), >::OutOfTransientStorage, ); @@ -1018,7 +1019,7 @@ fn transient_storage_limit_in_call() { // Limit exceeded in the callee contract. assert_err_ignore_postinfo!( builder::call(addr_caller) - .data((1_000u32, 1_000u32, &addr_callee).encode()) + .data((storage_value_size, storage_value_size, &addr_callee).encode()) .build(), >::ContractTrapped ); From 6acc50f810548992a683452aeed205029d6ce56f Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 5 Jul 2024 09:38:06 +0200 Subject: [PATCH 49/58] Remove double key creation --- substrate/frame/contracts/src/transient_storage.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 553f72dfba77..154189a10bd2 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -240,11 +240,10 @@ impl TransientStorage { value: Option>, take: bool, ) -> Result { - let prev_value = self.read(account, key); + let key = Self::storage_key(&account.encode(), &key.hash()); + let prev_value = self.storage.read(&key); // Skip if the same value is being set. if prev_value != value { - let key = Self::storage_key(&account.encode(), &key.hash()); - // Calculate the allocation size. if let Some(value) = &value { // Charge the key, value and journal entry. From b9aa45205d955fa8a311209ef5da623dc4c729e6 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 5 Jul 2024 12:09:17 +0200 Subject: [PATCH 50/58] Update panic messages --- .../frame/contracts/src/transient_storage.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 154189a10bd2..3070e1b03dbb 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -82,9 +82,9 @@ impl StorageMeter { /// Revert a transaction meter. fn revert(&mut self) { - self.nested_meters - .pop() - .expect("There is no nested meter that can be reverted."); + self.nested_meters.pop().expect( + "A call to revert a meter must be preceded by a corresponding call to start a meter.", + ); } /// Start a transaction meter. @@ -104,10 +104,9 @@ impl StorageMeter { /// Commit a transaction meter. fn commit(&mut self) { - let transaction_meter = self - .nested_meters - .pop() - .expect("There is no nested meter that can be committed."); + let transaction_meter = self.nested_meters.pop().expect( + "A call to commit a meter must be preceded by a corresponding call to start a meter.", + ); self.current_mut().absorb(transaction_meter) } @@ -297,7 +296,7 @@ impl TransientStorage { let checkpoint = self .checkpoints .pop() - .expect("No open transient storage transaction that can be rolled back."); + .expect("A call to rollback_transaction must be preceded by a corresponding call to start_transaction."); self.meter.revert(); self.journal.rollback(&mut self.storage, checkpoint); } @@ -312,7 +311,7 @@ impl TransientStorage { pub fn commit_transaction(&mut self) { self.checkpoints .pop() - .expect("No open transient storage transaction that can be committed."); + .expect("A call to commit_transaction must be preceded by a corresponding call to start_transaction."); self.meter.commit(); } From 2bb933e8e6b2da0b0cbfd38a80360e5537613ab9 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 5 Jul 2024 15:24:08 +0200 Subject: [PATCH 51/58] Update substrate/frame/contracts/src/lib.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- substrate/frame/contracts/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index dd2d42afcade..9c3b602a1523 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -224,7 +224,7 @@ pub struct Environment { pub struct ApiVersion(u16); impl Default for ApiVersion { fn default() -> Self { - Self(5) + Self(4) } } From 0c189a600741af0824915366f938f47f1bcc39d4 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 5 Jul 2024 15:55:23 +0200 Subject: [PATCH 52/58] Cleanup benchmarks --- prdoc/pr_4566.prdoc | 2 +- .../frame/contracts/src/benchmarking/mod.rs | 20 ++++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/prdoc/pr_4566.prdoc b/prdoc/pr_4566.prdoc index 5f7bb6ac80a8..ea2979bb363a 100644 --- a/prdoc/pr_4566.prdoc +++ b/prdoc/pr_4566.prdoc @@ -18,6 +18,6 @@ crates: - name: pallet-contracts bump: major - name: pallet-contracts-uapi - bump: minor + bump: major - name: contracts-rococo-runtime bump: minor diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index aa9f54914a60..1a8b764b4bc8 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -1163,13 +1163,17 @@ mod benchmarks { Ok(()) } + // We use both full and empty benchmarks here instead of benchmarking transient_storage + // (BTreeMap) directly. This approach is necessary because benchmarking this BTreeMap is very + // slow. Additionally, we use linear regression for our benchmarks, and the BTreeMap's log(n) + // complexity can introduce approximation errors. #[benchmark(pov_mode = Ignored)] fn set_transient_storage_empty() -> Result<(), BenchmarkError> { let max_value_len = T::Schedule::get().limits.payload_len; let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - + let value = Some(vec![42u8; max_value_len as _]); let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); @@ -1177,11 +1181,7 @@ mod benchmarks { let result; #[block] { - result = runtime.ext().set_transient_storage( - &key, - Some(vec![42u8; max_value_len as _]), - false, - ); + result = runtime.ext().set_transient_storage(&key, value, false); } assert_eq!(result, Ok(WriteOutcome::New)); @@ -1195,7 +1195,7 @@ mod benchmarks { let max_key_len = T::MaxStorageKeyLen::get(); let key = Key::::try_from_var(vec![0u8; max_key_len as usize]) .map_err(|_| "Key has wrong length")?; - + let value = Some(vec![42u8; max_value_len as _]); let mut setup = CallSetup::::default(); let (mut ext, _) = setup.ext(); CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageSize::get())?; @@ -1204,11 +1204,7 @@ mod benchmarks { let result; #[block] { - result = runtime.ext().set_transient_storage( - &key, - Some(vec![42u8; max_value_len as _]), - false, - ); + result = runtime.ext().set_transient_storage(&key, value, false); } assert_eq!(result, Ok(WriteOutcome::New)); From 865886d48d5c8fe41814a83045c08e34ddd7f136 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 5 Jul 2024 16:19:17 +0200 Subject: [PATCH 53/58] Improve panic messages --- .../frame/contracts/src/transient_storage.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/substrate/frame/contracts/src/transient_storage.rs b/substrate/frame/contracts/src/transient_storage.rs index 3070e1b03dbb..c795a966385a 100644 --- a/substrate/frame/contracts/src/transient_storage.rs +++ b/substrate/frame/contracts/src/transient_storage.rs @@ -83,7 +83,8 @@ impl StorageMeter { /// Revert a transaction meter. fn revert(&mut self) { self.nested_meters.pop().expect( - "A call to revert a meter must be preceded by a corresponding call to start a meter.", + "A call to revert a meter must be preceded by a corresponding call to start a meter; + the code within this crate makes sure that this is always the case; qed", ); } @@ -105,7 +106,8 @@ impl StorageMeter { /// Commit a transaction meter. fn commit(&mut self) { let transaction_meter = self.nested_meters.pop().expect( - "A call to commit a meter must be preceded by a corresponding call to start a meter.", + "A call to commit a meter must be preceded by a corresponding call to start a meter; + the code within this crate makes sure that this is always the case; qed", ); self.current_mut().absorb(transaction_meter) } @@ -296,7 +298,10 @@ impl TransientStorage { let checkpoint = self .checkpoints .pop() - .expect("A call to rollback_transaction must be preceded by a corresponding call to start_transaction."); + .expect( + "A call to rollback_transaction must be preceded by a corresponding call to start_transaction; + the code within this crate makes sure that this is always the case; qed" + ); self.meter.revert(); self.journal.rollback(&mut self.storage, checkpoint); } @@ -311,7 +316,10 @@ impl TransientStorage { pub fn commit_transaction(&mut self) { self.checkpoints .pop() - .expect("A call to commit_transaction must be preceded by a corresponding call to start_transaction."); + .expect( + "A call to commit_transaction must be preceded by a corresponding call to start_transaction; + the code within this crate makes sure that this is always the case; qed" + ); self.meter.commit(); } From 03f10f9842b8f64f63a56cf6a15016971e40318f Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 8 Jul 2024 23:00:44 +0200 Subject: [PATCH 54/58] Marked functions as unstable --- .../create_transient_storage_and_call.rs | 1 + .../contracts/set_transient_storage.rs | 1 + .../fixtures/contracts/transient_storage.rs | 39 ++++++++++--------- .../src/benchmarking/call_builder.rs | 3 +- substrate/frame/contracts/uapi/src/host.rs | 15 +++++++ 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs b/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs index 3d9ef205dd7f..6bafee555771 100644 --- a/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs +++ b/substrate/frame/contracts/fixtures/contracts/create_transient_storage_and_call.rs @@ -38,6 +38,7 @@ pub extern "C" fn call() { let data = [0u8; 16 * 1024]; let value = &data[..len as usize]; + #[allow(deprecated)] api::set_transient_storage(buffer, value); // Call the callee diff --git a/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs b/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs index f7b6365c003a..e4fde08314ce 100644 --- a/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs +++ b/substrate/frame/contracts/fixtures/contracts/set_transient_storage.rs @@ -37,5 +37,6 @@ pub extern "C" fn call() { let mut key = [0u8; 32]; key[0] = 1; + #[allow(deprecated)] api::set_transient_storage(&key, data); } diff --git a/substrate/frame/contracts/fixtures/contracts/transient_storage.rs b/substrate/frame/contracts/fixtures/contracts/transient_storage.rs index 8d7eff90740a..c797e17887bc 100644 --- a/substrate/frame/contracts/fixtures/contracts/transient_storage.rs +++ b/substrate/frame/contracts/fixtures/contracts/transient_storage.rs @@ -34,22 +34,25 @@ pub extern "C" fn call() { const VALUE_2: [u8; 4] = [2u8; 4]; const VALUE_3: [u8; 4] = [3u8; 4]; - let existing = api::set_transient_storage(&KEY, &VALUE_1); - assert_eq!(existing, None); - assert_eq!(api::contains_transient_storage(&KEY), Some(VALUE_1.len() as _)); - unwrap_output!(val, [0u8; 4], api::get_transient_storage, &KEY); - assert_eq!(**val, VALUE_1); - - let existing = api::set_transient_storage(&KEY, &VALUE_2); - assert_eq!(existing, Some(VALUE_1.len() as _)); - unwrap_output!(val, [0u8; 4], api::get_transient_storage, &KEY); - assert_eq!(**val, VALUE_2); - - api::clear_transient_storage(&KEY); - assert_eq!(api::contains_storage(&KEY), None); - - let existing = api::set_transient_storage(&KEY, &VALUE_3); - assert_eq!(existing, None); - unwrap_output!(val, [0u8; 32], api::take_transient_storage, &KEY); - assert_eq!(**val, VALUE_3); + #[allow(deprecated)] + { + let existing = api::set_transient_storage(&KEY, &VALUE_1); + assert_eq!(existing, None); + assert_eq!(api::contains_transient_storage(&KEY), Some(VALUE_1.len() as _)); + unwrap_output!(val, [0u8; 4], api::get_transient_storage, &KEY); + assert_eq!(**val, VALUE_1); + + let existing = api::set_transient_storage(&KEY, &VALUE_2); + assert_eq!(existing, Some(VALUE_1.len() as _)); + unwrap_output!(val, [0u8; 4], api::get_transient_storage, &KEY); + assert_eq!(**val, VALUE_2); + + api::clear_transient_storage(&KEY); + assert_eq!(api::contains_transient_storage(&KEY), None); + + let existing = api::set_transient_storage(&KEY, &VALUE_3); + assert_eq!(existing, None); + unwrap_output!(val, [0u8; 32], api::take_transient_storage, &KEY); + assert_eq!(**val, VALUE_3); + } } diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index b5f8c6c594ed..32ea48c3de3f 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -162,8 +162,7 @@ where /// Add transient_storage pub fn with_transient_storage(ext: &mut StackExt, size: u32) -> Result<(), &'static str> { - let amount = ext.transient_storage().meter().current().amount; - let limit = ext.transient_storage().meter().current().limit; + let &MeterEntry { amount, limit } = ext.transient_storage().meter().current(); ext.transient_storage().meter().current_mut().limit = size; for i in 1u32.. { let mut key_data = i.to_le_bytes().to_vec(); diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index 90c8f89fedee..333ef2c0eaa7 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -301,6 +301,9 @@ pub trait HostFn { /// # Return /// /// Returns the size of the pre-existing value at the specified key if any. + #[deprecated( + note = "Unstable function. Behaviour can change without further notice. Use only for testing." + )] fn clear_transient_storage(key: &[u8]) -> Option; /// Retrieve the code hash for a specified contract address. @@ -345,6 +348,9 @@ pub trait HostFn { /// # Return /// /// Returns the size of the pre-existing value at the specified key if any. + #[deprecated( + note = "Unstable function. Behaviour can change without further notice. Use only for testing." + )] fn contains_transient_storage(key: &[u8]) -> Option; /// Emit a custom debug message. @@ -487,6 +493,9 @@ pub trait HostFn { /// # Errors /// /// [KeyNotFound][`crate::ReturnErrorCode::KeyNotFound] + #[deprecated( + note = "Unstable function. Behaviour can change without further notice. Use only for testing." + )] fn get_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result; hash_fn!(sha2_256, 32); @@ -722,6 +731,9 @@ pub trait HostFn { /// # Return /// /// Returns the size of the pre-existing value at the specified key if any. + #[deprecated( + note = "Unstable function. Behaviour can change without further notice. Use only for testing." + )] fn set_transient_storage(key: &[u8], value: &[u8]) -> Option; /// Verify a sr25519 signature @@ -756,6 +768,9 @@ pub trait HostFn { /// # Errors /// /// [KeyNotFound][`crate::ReturnErrorCode::KeyNotFound] + #[deprecated( + note = "Unstable function. Behaviour can change without further notice. Use only for testing." + )] fn take_transient_storage(key: &[u8], output: &mut &mut [u8]) -> Result; /// Transfer some amount of funds into the specified account. From 5c59336936ebe2a2e569ae14dd00161840554de3 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 9 Jul 2024 10:28:13 +0200 Subject: [PATCH 55/58] Sealed HostFn trait --- substrate/frame/contracts/uapi/src/host.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index 333ef2c0eaa7..51f0cd7eb2dc 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -67,7 +67,7 @@ fn ptr_or_sentinel(data: &Option<&[u8]>) -> *const u8 { pub enum HostFnImpl {} /// Defines all the host apis implemented by both wasm and RISC-V vms. -pub trait HostFn { +pub trait HostFn: private::Sealed { /// Returns the number of times specified contract exists on the call stack. Delegated calls are /// not counted as separate calls. /// @@ -881,3 +881,8 @@ pub trait HostFn { )] fn xcm_send(dest: &[u8], msg: &[u8], output: &mut [u8; 32]) -> Result; } + +mod private { + pub trait Sealed {} + impl Sealed for super::HostFnImpl {} +} From 8d36584e00db7858c68fa3264d500a502f753a17 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 9 Jul 2024 12:09:44 +0200 Subject: [PATCH 56/58] Refactor benchmarks --- .../src/benchmarking/call_builder.rs | 38 ++++++++++++------- .../frame/contracts/src/benchmarking/mod.rs | 6 +-- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index 32ea48c3de3f..8649566936d5 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -19,6 +19,7 @@ use crate::{ benchmarking::{Contract, WasmModule}, exec::{Ext, Key, Stack}, storage::meter::Meter, + transient_storage::MeterEntry, wasm::Runtime, BalanceOf, Config, DebugBufferVec, Determinism, Error, ExecReturnValue, GasMeter, Origin, Schedule, TypeInfo, WasmBlob, Weight, @@ -56,6 +57,7 @@ pub struct CallSetup { debug_message: Option>, determinism: Determinism, data: Vec, + transient_storage_size: u32, } impl Default for CallSetup @@ -103,6 +105,7 @@ where debug_message: None, determinism: Determinism::Enforced, data: vec![], + transient_storage_size: 0, } } @@ -126,6 +129,11 @@ where self.data = value; } + /// Set the transient storage size. + pub fn set_transient_storage_size(&mut self, size: u32) { + self.transient_storage_size = size; + } + /// Set the debug message. pub fn enable_debug_message(&mut self) { self.debug_message = Some(Default::default()); @@ -148,7 +156,7 @@ where /// Build the call stack. pub fn ext(&mut self) -> (StackExt<'_, T>, WasmBlob) { - StackExt::bench_new_call( + let mut ext = StackExt::bench_new_call( self.dest.clone(), self.origin.clone(), &mut self.gas_meter, @@ -157,11 +165,25 @@ where self.value, self.debug_message.as_mut(), self.determinism, - ) + ); + if self.transient_storage_size > 0 { + Self::with_transient_storage(&mut ext.0, self.transient_storage_size).unwrap(); + } + ext + } + + /// Prepare a call to the module. + pub fn prepare_call<'a>( + ext: &'a mut StackExt<'a, T>, + module: WasmBlob, + input: Vec, + ) -> PreparedCall<'a, T> { + let (func, store) = module.bench_prepare_call(ext, input); + PreparedCall { func, store } } /// Add transient_storage - pub fn with_transient_storage(ext: &mut StackExt, size: u32) -> Result<(), &'static str> { + fn with_transient_storage(ext: &mut StackExt, size: u32) -> Result<(), &'static str> { let &MeterEntry { amount, limit } = ext.transient_storage().meter().current(); ext.transient_storage().meter().current_mut().limit = size; for i in 1u32.. { @@ -183,16 +205,6 @@ where } Ok(()) } - - /// Prepare a call to the module. - pub fn prepare_call<'a>( - ext: &'a mut StackExt<'a, T>, - module: WasmBlob, - input: Vec, - ) -> PreparedCall<'a, T> { - let (func, store) = module.bench_prepare_call(ext, input); - PreparedCall { func, store } - } } #[macro_export] diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 1a8b764b4bc8..a8088e72b566 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -1197,8 +1197,8 @@ mod benchmarks { .map_err(|_| "Key has wrong length")?; let value = Some(vec![42u8; max_value_len as _]); let mut setup = CallSetup::::default(); + setup.set_transient_storage_size(T::MaxTransientStorageSize::get()); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageSize::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; let result; @@ -1245,8 +1245,8 @@ mod benchmarks { .map_err(|_| "Key has wrong length")?; let mut setup = CallSetup::::default(); + setup.set_transient_storage_size(T::MaxTransientStorageSize::get()); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageSize::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime @@ -1272,8 +1272,8 @@ mod benchmarks { .map_err(|_| "Key has wrong length")?; let mut setup = CallSetup::::default(); + setup.set_transient_storage_size(T::MaxTransientStorageSize::get()); let (mut ext, _) = setup.ext(); - CallSetup::::with_transient_storage(&mut ext, T::MaxTransientStorageSize::get())?; let mut runtime = crate::wasm::Runtime::new(&mut ext, vec![]); runtime.ext().transient_storage().meter().current_mut().limit = u32::MAX; runtime.ext().transient_storage().start_transaction(); From f2cfb7624c280ac0a37ef743c62a7be2f705f54e Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Tue, 9 Jul 2024 11:02:01 +0000 Subject: [PATCH 57/58] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 840 +++++++++++------------ 1 file changed, 420 insertions(+), 420 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index e693400bf704..dc10a8aee773 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/frame/contracts/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for `pallet_contracts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-07-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-07-09, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-7wrmsoux-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `runner-yaoqqom-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: @@ -137,8 +137,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_868_000 picoseconds. - Weight::from_parts(1_940_000, 1627) + // Minimum execution time: 1_921_000 picoseconds. + Weight::from_parts(2_003_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -148,10 +148,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_390_000 picoseconds. - Weight::from_parts(11_812_000, 442) - // Standard Error: 1_686 - .saturating_add(Weight::from_parts(1_137_138, 0).saturating_mul(k.into())) + // Minimum execution time: 11_364_000 picoseconds. + Weight::from_parts(11_463_000, 442) + // Standard Error: 2_141 + .saturating_add(Weight::from_parts(1_149_944, 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)) @@ -165,10 +165,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_576_000 picoseconds. - Weight::from_parts(4_420_265, 6149) + // Minimum execution time: 7_565_000 picoseconds. + Weight::from_parts(5_041_009, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_649, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -181,8 +181,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_147_000 picoseconds. - Weight::from_parts(16_485_000, 6450) + // Minimum execution time: 15_894_000 picoseconds. + Weight::from_parts(16_618_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -195,10 +195,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_140_000 picoseconds. - Weight::from_parts(3_203_000, 3635) - // Standard Error: 660 - .saturating_add(Weight::from_parts(1_106_850, 0).saturating_mul(k.into())) + // Minimum execution time: 3_077_000 picoseconds. + Weight::from_parts(3_144_000, 3635) + // Standard Error: 650 + .saturating_add(Weight::from_parts(1_095_835, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -217,10 +217,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 14_742_000 picoseconds. - Weight::from_parts(15_346_515, 6263) + // Minimum execution time: 14_960_000 picoseconds. + Weight::from_parts(15_778_951, 6263) // Standard Error: 1 - .saturating_add(Weight::from_parts(454, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(443, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -231,8 +231,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_060_000 picoseconds. - Weight::from_parts(12_694_000, 6380) + // Minimum execution time: 11_849_000 picoseconds. + Weight::from_parts(12_273_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -246,8 +246,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 47_782_000 picoseconds. - Weight::from_parts(48_385_000, 6292) + // Minimum execution time: 47_862_000 picoseconds. + Weight::from_parts(48_879_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -259,8 +259,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_281_000 picoseconds. - Weight::from_parts(54_174_000, 6534) + // Minimum execution time: 50_754_000 picoseconds. + Weight::from_parts(52_720_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -270,8 +270,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_337_000 picoseconds. - Weight::from_parts(11_890_000, 6349) + // Minimum execution time: 11_459_000 picoseconds. + Weight::from_parts(11_921_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -281,8 +281,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_126_000 picoseconds. - Weight::from_parts(2_260_000, 1627) + // Minimum execution time: 2_135_000 picoseconds. + Weight::from_parts(2_247_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -294,8 +294,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_757_000 picoseconds. - Weight::from_parts(11_120_000, 3631) + // Minimum execution time: 10_645_000 picoseconds. + Weight::from_parts(11_107_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -305,8 +305,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_342_000 picoseconds. - Weight::from_parts(4_510_000, 3607) + // Minimum execution time: 4_353_000 picoseconds. + Weight::from_parts(4_628_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -317,8 +317,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_534_000 picoseconds. - Weight::from_parts(5_731_000, 3632) + // Minimum execution time: 5_432_000 picoseconds. + Weight::from_parts(5_624_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -329,8 +329,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_439_000 picoseconds. - Weight::from_parts(5_699_000, 3607) + // Minimum execution time: 5_371_000 picoseconds. + Weight::from_parts(5_794_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -351,10 +351,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `800 + c * (1 ±0)` // Estimated: `4266 + c * (1 ±0)` - // Minimum execution time: 259_120_000 picoseconds. - Weight::from_parts(269_467_515, 4266) + // Minimum execution time: 247_157_000 picoseconds. + Weight::from_parts(269_252_698, 4266) // Standard Error: 4 - .saturating_add(Weight::from_parts(731, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(729, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -382,14 +382,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_610_363_000 picoseconds. - Weight::from_parts(149_861_617, 6262) - // Standard Error: 126 - .saturating_add(Weight::from_parts(53_395, 0).saturating_mul(c.into())) + // Minimum execution time: 4_575_784_000 picoseconds. + Weight::from_parts(207_379_459, 6262) + // Standard Error: 124 + .saturating_add(Weight::from_parts(52_392, 0).saturating_mul(c.into())) // Standard Error: 15 - .saturating_add(Weight::from_parts(2_292, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(2_257, 0).saturating_mul(i.into())) // Standard Error: 15 - .saturating_add(Weight::from_parts(2_268, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_263, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -415,12 +415,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4017` - // Minimum execution time: 2_299_412_000 picoseconds. - Weight::from_parts(2_314_212_000, 4017) - // Standard Error: 32 - .saturating_add(Weight::from_parts(1_003, 0).saturating_mul(i.into())) - // Standard Error: 32 - .saturating_add(Weight::from_parts(937, 0).saturating_mul(s.into())) + // Minimum execution time: 2_306_770_000 picoseconds. + Weight::from_parts(2_462_908_000, 4017) + // Standard Error: 33 + .saturating_add(Weight::from_parts(898, 0).saturating_mul(i.into())) + // Standard Error: 33 + .saturating_add(Weight::from_parts(859, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -440,8 +440,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 166_492_000 picoseconds. - Weight::from_parts(170_786_000, 4291) + // Minimum execution time: 165_499_000 picoseconds. + Weight::from_parts(169_903_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -458,10 +458,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 227_831_000 picoseconds. - Weight::from_parts(276_759_168, 3607) - // Standard Error: 73 - .saturating_add(Weight::from_parts(51_518, 0).saturating_mul(c.into())) + // Minimum execution time: 227_590_000 picoseconds. + Weight::from_parts(260_045_588, 3607) + // Standard Error: 52 + .saturating_add(Weight::from_parts(51_305, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -478,10 +478,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 242_961_000 picoseconds. - Weight::from_parts(276_454_808, 3607) - // Standard Error: 52 - .saturating_add(Weight::from_parts(51_574, 0).saturating_mul(c.into())) + // Minimum execution time: 239_634_000 picoseconds. + Weight::from_parts(262_040_831, 3607) + // Standard Error: 103 + .saturating_add(Weight::from_parts(51_590, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -497,8 +497,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_314_000 picoseconds. - Weight::from_parts(40_497_000, 3780) + // Minimum execution time: 39_152_000 picoseconds. + Weight::from_parts(39_970_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -512,8 +512,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_080_000 picoseconds. - Weight::from_parts(26_235_000, 6492) + // Minimum execution time: 25_143_000 picoseconds. + Weight::from_parts(26_103_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -522,17 +522,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_312_000 picoseconds. - Weight::from_parts(9_396_819, 0) - // Standard Error: 92 - .saturating_add(Weight::from_parts(51_946, 0).saturating_mul(r.into())) + // Minimum execution time: 8_406_000 picoseconds. + Weight::from_parts(9_056_753, 0) + // Standard Error: 98 + .saturating_add(Weight::from_parts(53_110, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 685_000 picoseconds. - Weight::from_parts(725_000, 0) + // Minimum execution time: 659_000 picoseconds. + Weight::from_parts(705_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -540,8 +540,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_037_000 picoseconds. - Weight::from_parts(6_379_000, 3819) + // Minimum execution time: 6_165_000 picoseconds. + Weight::from_parts(6_340_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -550,79 +550,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_193_000 picoseconds. - Weight::from_parts(7_542_000, 3912) + // Minimum execution time: 7_398_000 picoseconds. + Weight::from_parts(7_661_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 744_000 picoseconds. + // Minimum execution time: 723_000 picoseconds. Weight::from_parts(793_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 360_000 picoseconds. - Weight::from_parts(405_000, 0) + // Minimum execution time: 398_000 picoseconds. + Weight::from_parts(428_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 304_000 picoseconds. - Weight::from_parts(344_000, 0) + // Minimum execution time: 329_000 picoseconds. + Weight::from_parts(364_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 610_000 picoseconds. - Weight::from_parts(659_000, 0) + // Minimum execution time: 592_000 picoseconds. + Weight::from_parts(624_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 656_000 picoseconds. - Weight::from_parts(691_000, 0) + // Minimum execution time: 665_000 picoseconds. + Weight::from_parts(714_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_413_000 picoseconds. - Weight::from_parts(4_644_000, 0) + // Minimum execution time: 4_486_000 picoseconds. + Weight::from_parts(4_668_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 577_000 picoseconds. - Weight::from_parts(633_000, 0) + // Minimum execution time: 548_000 picoseconds. + Weight::from_parts(590_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 547_000 picoseconds. - Weight::from_parts(589_000, 0) + // Minimum execution time: 536_000 picoseconds. + Weight::from_parts(578_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 572_000 picoseconds. - Weight::from_parts(605_000, 0) + // Minimum execution time: 552_000 picoseconds. + Weight::from_parts(599_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 544_000 picoseconds. - Weight::from_parts(593_000, 0) + // Minimum execution time: 556_000 picoseconds. + Weight::from_parts(600_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -630,8 +630,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_073_000 picoseconds. - Weight::from_parts(4_396_000, 1552) + // Minimum execution time: 4_084_000 picoseconds. + Weight::from_parts(4_321_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -639,8 +639,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 496_000 picoseconds. - Weight::from_parts(508_000, 0) + // Minimum execution time: 468_000 picoseconds. + Weight::from_parts(492_000, 0) // Standard Error: 3 .saturating_add(Weight::from_parts(310, 0).saturating_mul(n.into())) } @@ -649,10 +649,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 322_000 picoseconds. - Weight::from_parts(353_000, 0) + // Minimum execution time: 377_000 picoseconds. + Weight::from_parts(396_000, 0) // Standard Error: 9 - .saturating_add(Weight::from_parts(429, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(431, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -665,10 +665,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_135_000 picoseconds. - Weight::from_parts(15_444_257, 3784) - // Standard Error: 7_383 - .saturating_add(Weight::from_parts(3_433_291, 0).saturating_mul(n.into())) + // Minimum execution time: 13_028_000 picoseconds. + Weight::from_parts(15_330_917, 3784) + // Standard Error: 8_260 + .saturating_add(Weight::from_parts(3_594_893, 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(3_u64)) @@ -681,8 +681,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_284_000 picoseconds. - Weight::from_parts(3_578_000, 1561) + // Minimum execution time: 3_367_000 picoseconds. + Weight::from_parts(3_555_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -693,12 +693,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_656_000 picoseconds. - Weight::from_parts(3_844_233, 990) - // Standard Error: 5_163 - .saturating_add(Weight::from_parts(2_020_870, 0).saturating_mul(t.into())) + // Minimum execution time: 3_779_000 picoseconds. + Weight::from_parts(4_003_836, 990) + // Standard Error: 5_409 + .saturating_add(Weight::from_parts(2_082_176, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(18, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(14, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -708,10 +708,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 401_000 picoseconds. - Weight::from_parts(427_000, 0) + // Minimum execution time: 409_000 picoseconds. + Weight::from_parts(447_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_218, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_219, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -721,12 +721,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 8_796_000 picoseconds. - Weight::from_parts(8_510_040, 249) - // Standard Error: 2 - .saturating_add(Weight::from_parts(305, 0).saturating_mul(n.into())) - // Standard Error: 2 - .saturating_add(Weight::from_parts(56, 0).saturating_mul(o.into())) + // Minimum execution time: 9_176_000 picoseconds. + Weight::from_parts(9_121_191, 249) + // Standard Error: 1 + .saturating_add(Weight::from_parts(292, 0).saturating_mul(n.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(31, 0).saturating_mul(o.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(o.into())) @@ -738,10 +738,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_094_000 picoseconds. - Weight::from_parts(7_890_157, 248) + // Minimum execution time: 7_294_000 picoseconds. + Weight::from_parts(7_963_151, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(95, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(92, 0).saturating_mul(n.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(n.into())) @@ -753,10 +753,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_787_000 picoseconds. - Weight::from_parts(7_702_986, 248) + // Minimum execution time: 6_978_000 picoseconds. + Weight::from_parts(7_741_355, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(661, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(654, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -767,10 +767,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_292_000 picoseconds. - Weight::from_parts(6_980_800, 248) + // Minimum execution time: 6_286_000 picoseconds. + Weight::from_parts(7_026_923, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(78, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -781,10 +781,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_701_000 picoseconds. - Weight::from_parts(8_452_715, 248) - // Standard Error: 4 - .saturating_add(Weight::from_parts(663, 0).saturating_mul(n.into())) + // Minimum execution time: 7_597_000 picoseconds. + Weight::from_parts(8_706_785, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(653, 0).saturating_mul(n.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(n.into())) @@ -793,36 +793,36 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_664_000 picoseconds. - Weight::from_parts(3_747_000, 0) + // Minimum execution time: 1_497_000 picoseconds. + Weight::from_parts(1_564_000, 0) } fn set_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_878_000 picoseconds. - Weight::from_parts(5_119_000, 0) + // Minimum execution time: 2_670_000 picoseconds. + Weight::from_parts(2_807_000, 0) } fn get_transient_storage_empty() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_680_000 picoseconds. - Weight::from_parts(3_737_000, 0) + // Minimum execution time: 3_836_000 picoseconds. + Weight::from_parts(3_878_000, 0) } fn get_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_403_000 picoseconds. - Weight::from_parts(4_526_000, 0) + // Minimum execution time: 4_537_000 picoseconds. + Weight::from_parts(4_665_000, 0) } fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_532_000 picoseconds. - Weight::from_parts(1_657_000, 0) + // Minimum execution time: 1_592_000 picoseconds. + Weight::from_parts(1_742_000, 0) } /// The range of component `n` is `[0, 16384]`. /// The range of component `o` is `[0, 16384]`. @@ -830,30 +830,30 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_621_000 picoseconds. - Weight::from_parts(3_101_448, 0) + // Minimum execution time: 6_101_000 picoseconds. + Weight::from_parts(2_481_218, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(241, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(242, 0).saturating_mul(n.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(301, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(300, 0).saturating_mul(o.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_clear_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_646_000 picoseconds. - Weight::from_parts(3_011_683, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(301, 0).saturating_mul(n.into())) + // Minimum execution time: 2_059_000 picoseconds. + Weight::from_parts(2_426_609, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(307, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_793_000 picoseconds. - Weight::from_parts(1_962_873, 0) + // Minimum execution time: 1_918_000 picoseconds. + Weight::from_parts(2_114_837, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(302, 0).saturating_mul(n.into())) } @@ -862,25 +862,25 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_611_000 picoseconds. - Weight::from_parts(1_797_598, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(154, 0).saturating_mul(n.into())) + // Minimum execution time: 1_759_000 picoseconds. + Weight::from_parts(1_959_995, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(147, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_take_transient_storage(_n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_354_000 picoseconds. - Weight::from_parts(10_838_032, 0) + // Minimum execution time: 9_759_000 picoseconds. + Weight::from_parts(9_952_099, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_446_000 picoseconds. - Weight::from_parts(8_671_000, 0) + // Minimum execution time: 8_700_000 picoseconds. + Weight::from_parts(8_903_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -896,12 +896,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 124_785_000 picoseconds. - Weight::from_parts(123_734_045, 4085) - // Standard Error: 216_532 - .saturating_add(Weight::from_parts(42_188_553, 0).saturating_mul(t.into())) + // Minimum execution time: 123_399_000 picoseconds. + Weight::from_parts(120_909_821, 4085) + // Standard Error: 166_830 + .saturating_add(Weight::from_parts(43_853_642, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(6, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -916,8 +916,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 111_252_000 picoseconds. - Weight::from_parts(113_980_000, 3895) + // Minimum execution time: 112_350_000 picoseconds. + Weight::from_parts(116_003_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -936,12 +936,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4132` - // Minimum execution time: 1_960_976_000 picoseconds. - Weight::from_parts(1_980_055_000, 4132) + // Minimum execution time: 1_972_276_000 picoseconds. + Weight::from_parts(1_977_872_000, 4132) // Standard Error: 24 - .saturating_add(Weight::from_parts(619, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(623, 0).saturating_mul(i.into())) // Standard Error: 24 - .saturating_add(Weight::from_parts(913, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(917, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -950,64 +950,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 859_000 picoseconds. - Weight::from_parts(9_249_672, 0) + // Minimum execution time: 899_000 picoseconds. + Weight::from_parts(10_963_972, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_357, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_355, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_345_000 picoseconds. - Weight::from_parts(8_050_662, 0) + // Minimum execution time: 1_396_000 picoseconds. + Weight::from_parts(9_404_986, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(3_628, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_627, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 766_000 picoseconds. - Weight::from_parts(10_050_435, 0) + // Minimum execution time: 834_000 picoseconds. + Weight::from_parts(9_749_716, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_490, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_500, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 769_000 picoseconds. - Weight::from_parts(8_125_044, 0) + // Minimum execution time: 756_000 picoseconds. + Weight::from_parts(8_995_036, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_491, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_495, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_430_000 picoseconds. - Weight::from_parts(44_038_200, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(5_135, 0).saturating_mul(n.into())) + // Minimum execution time: 45_800_000 picoseconds. + Weight::from_parts(44_676_829, 0) + // Standard Error: 8 + .saturating_add(Weight::from_parts(5_315, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_948_000 picoseconds. - Weight::from_parts(48_692_000, 0) + // Minimum execution time: 47_415_000 picoseconds. + Weight::from_parts(48_743_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_982_000 picoseconds. - Weight::from_parts(13_142_000, 0) + // Minimum execution time: 13_437_000 picoseconds. + Weight::from_parts(13_588_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1017,8 +1017,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_539_000 picoseconds. - Weight::from_parts(18_145_000, 3895) + // Minimum execution time: 17_775_000 picoseconds. + Weight::from_parts(18_332_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1028,8 +1028,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_323_000 picoseconds. - Weight::from_parts(8_600_000, 3820) + // Minimum execution time: 8_326_000 picoseconds. + Weight::from_parts(8_656_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1039,8 +1039,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_529_000 picoseconds. - Weight::from_parts(7_732_000, 3558) + // Minimum execution time: 7_276_000 picoseconds. + Weight::from_parts(7_630_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1048,15 +1048,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 318_000 picoseconds. - Weight::from_parts(362_000, 0) + // Minimum execution time: 330_000 picoseconds. + Weight::from_parts(373_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 349_000 picoseconds. - Weight::from_parts(386_000, 0) + // Minimum execution time: 381_000 picoseconds. + Weight::from_parts(418_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1064,8 +1064,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_885_000 picoseconds. - Weight::from_parts(3_005_000, 1704) + // Minimum execution time: 2_711_000 picoseconds. + Weight::from_parts(2_941_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1073,10 +1073,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 732_000 picoseconds. - Weight::from_parts(930_550, 0) - // Standard Error: 25 - .saturating_add(Weight::from_parts(7_096, 0).saturating_mul(r.into())) + // Minimum execution time: 720_000 picoseconds. + Weight::from_parts(389_111, 0) + // Standard Error: 16 + .saturating_add(Weight::from_parts(7_278, 0).saturating_mul(r.into())) } } @@ -1088,8 +1088,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 1_868_000 picoseconds. - Weight::from_parts(1_940_000, 1627) + // Minimum execution time: 1_921_000 picoseconds. + Weight::from_parts(2_003_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1099,10 +1099,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 11_390_000 picoseconds. - Weight::from_parts(11_812_000, 442) - // Standard Error: 1_686 - .saturating_add(Weight::from_parts(1_137_138, 0).saturating_mul(k.into())) + // Minimum execution time: 11_364_000 picoseconds. + Weight::from_parts(11_463_000, 442) + // Standard Error: 2_141 + .saturating_add(Weight::from_parts(1_149_944, 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)) @@ -1116,10 +1116,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 7_576_000 picoseconds. - Weight::from_parts(4_420_265, 6149) + // Minimum execution time: 7_565_000 picoseconds. + Weight::from_parts(5_041_009, 6149) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_649, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_640, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1132,8 +1132,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_147_000 picoseconds. - Weight::from_parts(16_485_000, 6450) + // Minimum execution time: 15_894_000 picoseconds. + Weight::from_parts(16_618_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1146,10 +1146,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_140_000 picoseconds. - Weight::from_parts(3_203_000, 3635) - // Standard Error: 660 - .saturating_add(Weight::from_parts(1_106_850, 0).saturating_mul(k.into())) + // Minimum execution time: 3_077_000 picoseconds. + Weight::from_parts(3_144_000, 3635) + // Standard Error: 650 + .saturating_add(Weight::from_parts(1_095_835, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1168,10 +1168,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 14_742_000 picoseconds. - Weight::from_parts(15_346_515, 6263) + // Minimum execution time: 14_960_000 picoseconds. + Weight::from_parts(15_778_951, 6263) // Standard Error: 1 - .saturating_add(Weight::from_parts(454, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(443, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1182,8 +1182,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_060_000 picoseconds. - Weight::from_parts(12_694_000, 6380) + // Minimum execution time: 11_849_000 picoseconds. + Weight::from_parts(12_273_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1197,8 +1197,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 47_782_000 picoseconds. - Weight::from_parts(48_385_000, 6292) + // Minimum execution time: 47_862_000 picoseconds. + Weight::from_parts(48_879_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1210,8 +1210,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 52_281_000 picoseconds. - Weight::from_parts(54_174_000, 6534) + // Minimum execution time: 50_754_000 picoseconds. + Weight::from_parts(52_720_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1221,8 +1221,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 11_337_000 picoseconds. - Weight::from_parts(11_890_000, 6349) + // Minimum execution time: 11_459_000 picoseconds. + Weight::from_parts(11_921_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1232,8 +1232,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_126_000 picoseconds. - Weight::from_parts(2_260_000, 1627) + // Minimum execution time: 2_135_000 picoseconds. + Weight::from_parts(2_247_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1245,8 +1245,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 10_757_000 picoseconds. - Weight::from_parts(11_120_000, 3631) + // Minimum execution time: 10_645_000 picoseconds. + Weight::from_parts(11_107_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1256,8 +1256,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_342_000 picoseconds. - Weight::from_parts(4_510_000, 3607) + // Minimum execution time: 4_353_000 picoseconds. + Weight::from_parts(4_628_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1268,8 +1268,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 5_534_000 picoseconds. - Weight::from_parts(5_731_000, 3632) + // Minimum execution time: 5_432_000 picoseconds. + Weight::from_parts(5_624_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1280,8 +1280,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 5_439_000 picoseconds. - Weight::from_parts(5_699_000, 3607) + // Minimum execution time: 5_371_000 picoseconds. + Weight::from_parts(5_794_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1302,10 +1302,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `800 + c * (1 ±0)` // Estimated: `4266 + c * (1 ±0)` - // Minimum execution time: 259_120_000 picoseconds. - Weight::from_parts(269_467_515, 4266) + // Minimum execution time: 247_157_000 picoseconds. + Weight::from_parts(269_252_698, 4266) // Standard Error: 4 - .saturating_add(Weight::from_parts(731, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(729, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1333,14 +1333,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_610_363_000 picoseconds. - Weight::from_parts(149_861_617, 6262) - // Standard Error: 126 - .saturating_add(Weight::from_parts(53_395, 0).saturating_mul(c.into())) + // Minimum execution time: 4_575_784_000 picoseconds. + Weight::from_parts(207_379_459, 6262) + // Standard Error: 124 + .saturating_add(Weight::from_parts(52_392, 0).saturating_mul(c.into())) // Standard Error: 15 - .saturating_add(Weight::from_parts(2_292, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(2_257, 0).saturating_mul(i.into())) // Standard Error: 15 - .saturating_add(Weight::from_parts(2_268, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_263, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1366,12 +1366,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4017` - // Minimum execution time: 2_299_412_000 picoseconds. - Weight::from_parts(2_314_212_000, 4017) - // Standard Error: 32 - .saturating_add(Weight::from_parts(1_003, 0).saturating_mul(i.into())) - // Standard Error: 32 - .saturating_add(Weight::from_parts(937, 0).saturating_mul(s.into())) + // Minimum execution time: 2_306_770_000 picoseconds. + Weight::from_parts(2_462_908_000, 4017) + // Standard Error: 33 + .saturating_add(Weight::from_parts(898, 0).saturating_mul(i.into())) + // Standard Error: 33 + .saturating_add(Weight::from_parts(859, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1391,8 +1391,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 166_492_000 picoseconds. - Weight::from_parts(170_786_000, 4291) + // Minimum execution time: 165_499_000 picoseconds. + Weight::from_parts(169_903_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1409,10 +1409,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 227_831_000 picoseconds. - Weight::from_parts(276_759_168, 3607) - // Standard Error: 73 - .saturating_add(Weight::from_parts(51_518, 0).saturating_mul(c.into())) + // Minimum execution time: 227_590_000 picoseconds. + Weight::from_parts(260_045_588, 3607) + // Standard Error: 52 + .saturating_add(Weight::from_parts(51_305, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1429,10 +1429,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 242_961_000 picoseconds. - Weight::from_parts(276_454_808, 3607) - // Standard Error: 52 - .saturating_add(Weight::from_parts(51_574, 0).saturating_mul(c.into())) + // Minimum execution time: 239_634_000 picoseconds. + Weight::from_parts(262_040_831, 3607) + // Standard Error: 103 + .saturating_add(Weight::from_parts(51_590, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1448,8 +1448,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 39_314_000 picoseconds. - Weight::from_parts(40_497_000, 3780) + // Minimum execution time: 39_152_000 picoseconds. + Weight::from_parts(39_970_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1463,8 +1463,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 25_080_000 picoseconds. - Weight::from_parts(26_235_000, 6492) + // Minimum execution time: 25_143_000 picoseconds. + Weight::from_parts(26_103_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1473,17 +1473,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_312_000 picoseconds. - Weight::from_parts(9_396_819, 0) - // Standard Error: 92 - .saturating_add(Weight::from_parts(51_946, 0).saturating_mul(r.into())) + // Minimum execution time: 8_406_000 picoseconds. + Weight::from_parts(9_056_753, 0) + // Standard Error: 98 + .saturating_add(Weight::from_parts(53_110, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 685_000 picoseconds. - Weight::from_parts(725_000, 0) + // Minimum execution time: 659_000 picoseconds. + Weight::from_parts(705_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1491,8 +1491,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_037_000 picoseconds. - Weight::from_parts(6_379_000, 3819) + // Minimum execution time: 6_165_000 picoseconds. + Weight::from_parts(6_340_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1501,79 +1501,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_193_000 picoseconds. - Weight::from_parts(7_542_000, 3912) + // Minimum execution time: 7_398_000 picoseconds. + Weight::from_parts(7_661_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 744_000 picoseconds. + // Minimum execution time: 723_000 picoseconds. Weight::from_parts(793_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 360_000 picoseconds. - Weight::from_parts(405_000, 0) + // Minimum execution time: 398_000 picoseconds. + Weight::from_parts(428_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 304_000 picoseconds. - Weight::from_parts(344_000, 0) + // Minimum execution time: 329_000 picoseconds. + Weight::from_parts(364_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 610_000 picoseconds. - Weight::from_parts(659_000, 0) + // Minimum execution time: 592_000 picoseconds. + Weight::from_parts(624_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 656_000 picoseconds. - Weight::from_parts(691_000, 0) + // Minimum execution time: 665_000 picoseconds. + Weight::from_parts(714_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_413_000 picoseconds. - Weight::from_parts(4_644_000, 0) + // Minimum execution time: 4_486_000 picoseconds. + Weight::from_parts(4_668_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 577_000 picoseconds. - Weight::from_parts(633_000, 0) + // Minimum execution time: 548_000 picoseconds. + Weight::from_parts(590_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 547_000 picoseconds. - Weight::from_parts(589_000, 0) + // Minimum execution time: 536_000 picoseconds. + Weight::from_parts(578_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 572_000 picoseconds. - Weight::from_parts(605_000, 0) + // Minimum execution time: 552_000 picoseconds. + Weight::from_parts(599_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 544_000 picoseconds. - Weight::from_parts(593_000, 0) + // Minimum execution time: 556_000 picoseconds. + Weight::from_parts(600_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1581,8 +1581,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_073_000 picoseconds. - Weight::from_parts(4_396_000, 1552) + // Minimum execution time: 4_084_000 picoseconds. + Weight::from_parts(4_321_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1590,8 +1590,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 496_000 picoseconds. - Weight::from_parts(508_000, 0) + // Minimum execution time: 468_000 picoseconds. + Weight::from_parts(492_000, 0) // Standard Error: 3 .saturating_add(Weight::from_parts(310, 0).saturating_mul(n.into())) } @@ -1600,10 +1600,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 322_000 picoseconds. - Weight::from_parts(353_000, 0) + // Minimum execution time: 377_000 picoseconds. + Weight::from_parts(396_000, 0) // Standard Error: 9 - .saturating_add(Weight::from_parts(429, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(431, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1616,10 +1616,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 13_135_000 picoseconds. - Weight::from_parts(15_444_257, 3784) - // Standard Error: 7_383 - .saturating_add(Weight::from_parts(3_433_291, 0).saturating_mul(n.into())) + // Minimum execution time: 13_028_000 picoseconds. + Weight::from_parts(15_330_917, 3784) + // Standard Error: 8_260 + .saturating_add(Weight::from_parts(3_594_893, 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(3_u64)) @@ -1632,8 +1632,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_284_000 picoseconds. - Weight::from_parts(3_578_000, 1561) + // Minimum execution time: 3_367_000 picoseconds. + Weight::from_parts(3_555_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1644,12 +1644,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 3_656_000 picoseconds. - Weight::from_parts(3_844_233, 990) - // Standard Error: 5_163 - .saturating_add(Weight::from_parts(2_020_870, 0).saturating_mul(t.into())) + // Minimum execution time: 3_779_000 picoseconds. + Weight::from_parts(4_003_836, 990) + // Standard Error: 5_409 + .saturating_add(Weight::from_parts(2_082_176, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(18, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(14, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1659,10 +1659,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 401_000 picoseconds. - Weight::from_parts(427_000, 0) + // Minimum execution time: 409_000 picoseconds. + Weight::from_parts(447_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_218, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_219, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1672,12 +1672,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 8_796_000 picoseconds. - Weight::from_parts(8_510_040, 249) - // Standard Error: 2 - .saturating_add(Weight::from_parts(305, 0).saturating_mul(n.into())) - // Standard Error: 2 - .saturating_add(Weight::from_parts(56, 0).saturating_mul(o.into())) + // Minimum execution time: 9_176_000 picoseconds. + Weight::from_parts(9_121_191, 249) + // Standard Error: 1 + .saturating_add(Weight::from_parts(292, 0).saturating_mul(n.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(31, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1689,10 +1689,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_094_000 picoseconds. - Weight::from_parts(7_890_157, 248) + // Minimum execution time: 7_294_000 picoseconds. + Weight::from_parts(7_963_151, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(95, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(92, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1704,10 +1704,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_787_000 picoseconds. - Weight::from_parts(7_702_986, 248) + // Minimum execution time: 6_978_000 picoseconds. + Weight::from_parts(7_741_355, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(661, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(654, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1718,10 +1718,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_292_000 picoseconds. - Weight::from_parts(6_980_800, 248) + // Minimum execution time: 6_286_000 picoseconds. + Weight::from_parts(7_026_923, 248) // Standard Error: 1 - .saturating_add(Weight::from_parts(78, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(86, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1732,10 +1732,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_701_000 picoseconds. - Weight::from_parts(8_452_715, 248) - // Standard Error: 4 - .saturating_add(Weight::from_parts(663, 0).saturating_mul(n.into())) + // Minimum execution time: 7_597_000 picoseconds. + Weight::from_parts(8_706_785, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(653, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1744,36 +1744,36 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_664_000 picoseconds. - Weight::from_parts(3_747_000, 0) + // Minimum execution time: 1_497_000 picoseconds. + Weight::from_parts(1_564_000, 0) } fn set_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_878_000 picoseconds. - Weight::from_parts(5_119_000, 0) + // Minimum execution time: 2_670_000 picoseconds. + Weight::from_parts(2_807_000, 0) } fn get_transient_storage_empty() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_680_000 picoseconds. - Weight::from_parts(3_737_000, 0) + // Minimum execution time: 3_836_000 picoseconds. + Weight::from_parts(3_878_000, 0) } fn get_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_403_000 picoseconds. - Weight::from_parts(4_526_000, 0) + // Minimum execution time: 4_537_000 picoseconds. + Weight::from_parts(4_665_000, 0) } fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_532_000 picoseconds. - Weight::from_parts(1_657_000, 0) + // Minimum execution time: 1_592_000 picoseconds. + Weight::from_parts(1_742_000, 0) } /// The range of component `n` is `[0, 16384]`. /// The range of component `o` is `[0, 16384]`. @@ -1781,30 +1781,30 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_621_000 picoseconds. - Weight::from_parts(3_101_448, 0) + // Minimum execution time: 6_101_000 picoseconds. + Weight::from_parts(2_481_218, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(241, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(242, 0).saturating_mul(n.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(301, 0).saturating_mul(o.into())) + .saturating_add(Weight::from_parts(300, 0).saturating_mul(o.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_clear_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_646_000 picoseconds. - Weight::from_parts(3_011_683, 0) - // Standard Error: 0 - .saturating_add(Weight::from_parts(301, 0).saturating_mul(n.into())) + // Minimum execution time: 2_059_000 picoseconds. + Weight::from_parts(2_426_609, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(307, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_793_000 picoseconds. - Weight::from_parts(1_962_873, 0) + // Minimum execution time: 1_918_000 picoseconds. + Weight::from_parts(2_114_837, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(302, 0).saturating_mul(n.into())) } @@ -1813,25 +1813,25 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_611_000 picoseconds. - Weight::from_parts(1_797_598, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(154, 0).saturating_mul(n.into())) + // Minimum execution time: 1_759_000 picoseconds. + Weight::from_parts(1_959_995, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(147, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 16384]`. fn seal_take_transient_storage(_n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_354_000 picoseconds. - Weight::from_parts(10_838_032, 0) + // Minimum execution time: 9_759_000 picoseconds. + Weight::from_parts(9_952_099, 0) } fn seal_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 8_446_000 picoseconds. - Weight::from_parts(8_671_000, 0) + // Minimum execution time: 8_700_000 picoseconds. + Weight::from_parts(8_903_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1847,12 +1847,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 124_785_000 picoseconds. - Weight::from_parts(123_734_045, 4085) - // Standard Error: 216_532 - .saturating_add(Weight::from_parts(42_188_553, 0).saturating_mul(t.into())) + // Minimum execution time: 123_399_000 picoseconds. + Weight::from_parts(120_909_821, 4085) + // Standard Error: 166_830 + .saturating_add(Weight::from_parts(43_853_642, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(5, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(6, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1867,8 +1867,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 111_252_000 picoseconds. - Weight::from_parts(113_980_000, 3895) + // Minimum execution time: 112_350_000 picoseconds. + Weight::from_parts(116_003_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1887,12 +1887,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4132` - // Minimum execution time: 1_960_976_000 picoseconds. - Weight::from_parts(1_980_055_000, 4132) + // Minimum execution time: 1_972_276_000 picoseconds. + Weight::from_parts(1_977_872_000, 4132) // Standard Error: 24 - .saturating_add(Weight::from_parts(619, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(623, 0).saturating_mul(i.into())) // Standard Error: 24 - .saturating_add(Weight::from_parts(913, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(917, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1901,64 +1901,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 859_000 picoseconds. - Weight::from_parts(9_249_672, 0) + // Minimum execution time: 899_000 picoseconds. + Weight::from_parts(10_963_972, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_357, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_355, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_345_000 picoseconds. - Weight::from_parts(8_050_662, 0) + // Minimum execution time: 1_396_000 picoseconds. + Weight::from_parts(9_404_986, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(3_628, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_627, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 766_000 picoseconds. - Weight::from_parts(10_050_435, 0) + // Minimum execution time: 834_000 picoseconds. + Weight::from_parts(9_749_716, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_490, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_500, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 769_000 picoseconds. - Weight::from_parts(8_125_044, 0) + // Minimum execution time: 756_000 picoseconds. + Weight::from_parts(8_995_036, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_491, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_495, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_430_000 picoseconds. - Weight::from_parts(44_038_200, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(5_135, 0).saturating_mul(n.into())) + // Minimum execution time: 45_800_000 picoseconds. + Weight::from_parts(44_676_829, 0) + // Standard Error: 8 + .saturating_add(Weight::from_parts(5_315, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_948_000 picoseconds. - Weight::from_parts(48_692_000, 0) + // Minimum execution time: 47_415_000 picoseconds. + Weight::from_parts(48_743_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_982_000 picoseconds. - Weight::from_parts(13_142_000, 0) + // Minimum execution time: 13_437_000 picoseconds. + Weight::from_parts(13_588_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1968,8 +1968,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 17_539_000 picoseconds. - Weight::from_parts(18_145_000, 3895) + // Minimum execution time: 17_775_000 picoseconds. + Weight::from_parts(18_332_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1979,8 +1979,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 8_323_000 picoseconds. - Weight::from_parts(8_600_000, 3820) + // Minimum execution time: 8_326_000 picoseconds. + Weight::from_parts(8_656_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1990,8 +1990,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 7_529_000 picoseconds. - Weight::from_parts(7_732_000, 3558) + // Minimum execution time: 7_276_000 picoseconds. + Weight::from_parts(7_630_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1999,15 +1999,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 318_000 picoseconds. - Weight::from_parts(362_000, 0) + // Minimum execution time: 330_000 picoseconds. + Weight::from_parts(373_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 349_000 picoseconds. - Weight::from_parts(386_000, 0) + // Minimum execution time: 381_000 picoseconds. + Weight::from_parts(418_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -2015,8 +2015,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_885_000 picoseconds. - Weight::from_parts(3_005_000, 1704) + // Minimum execution time: 2_711_000 picoseconds. + Weight::from_parts(2_941_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -2024,9 +2024,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 732_000 picoseconds. - Weight::from_parts(930_550, 0) - // Standard Error: 25 - .saturating_add(Weight::from_parts(7_096, 0).saturating_mul(r.into())) + // Minimum execution time: 720_000 picoseconds. + Weight::from_parts(389_111, 0) + // Standard Error: 16 + .saturating_add(Weight::from_parts(7_278, 0).saturating_mul(r.into())) } } From 45603b801395b698cbf3c4e0f48bfdcdc510c637 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 10 Jul 2024 15:14:47 +0200 Subject: [PATCH 58/58] Comment added --- substrate/frame/contracts/src/wasm/runtime.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index f1a7f547e94f..6c98c3e78504 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -254,6 +254,10 @@ pub enum RuntimeCosts { UnlockDelegateDependency, } +// For the function that modifies the storage, the benchmarks are done with one item in the +// transient_storage (BTreeMap). To consider the worst-case scenario, the weight of the overhead of +// writing to a full BTreeMap should be included. On top of that, the rollback weight is added, +// which is the worst scenario. macro_rules! cost_write { // cost_write!(name, a, b, c) -> T::WeightInfo::name(a, b, c).saturating_add(T::WeightInfo::rollback_transient_storage()) // .saturating_add(T::WeightInfo::set_transient_storage_full().saturating_sub(T::WeightInfo::set_transient_storage_empty())