From 9a0da02ceac14c13a6e62e6815b0179d7c941c2b Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Thu, 19 May 2022 11:26:57 +0300 Subject: [PATCH 01/63] save --- frame/contracts/src/exec.rs | 6 +++- frame/contracts/src/storage.rs | 21 +++++++++++--- frame/contracts/src/wasm/runtime.rs | 45 ++++++++++++++++++++++------- 3 files changed, 56 insertions(+), 16 deletions(-) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index e3ff4788791a5..7e85daa6221fd 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -40,12 +40,16 @@ pub type AccountIdOf = ::AccountId; pub type MomentOf = <::Time as Time>::Moment; pub type SeedOf = ::Hash; pub type BlockNumberOf = ::BlockNumber; -pub type StorageKey = [u8; 32]; pub type ExecResult = Result; /// A type that represents a topic of an event. At the moment a hash is used. pub type TopicOf = ::Hash; +pub enum StorageKey { + FixedSizedKey([u8; 32]), + VariableSizedKey(Vec), +} + /// Origin of the error. /// /// Call or instantiate both called into other contracts and pass through errors happening diff --git a/frame/contracts/src/storage.rs b/frame/contracts/src/storage.rs index 2bdacc15cb11f..da51ebd70420a 100644 --- a/frame/contracts/src/storage.rs +++ b/frame/contracts/src/storage.rs @@ -33,7 +33,7 @@ use frame_support::{ }; use scale_info::TypeInfo; use sp_core::crypto::UncheckedFrom; -use sp_io::hashing::blake2_256; +use sp_io::hashing::{blake2_256; use sp_runtime::{ traits::{Hash, Zero}, RuntimeDebug, @@ -126,7 +126,12 @@ where /// The read is performed from the `trie_id` only. The `address` is not necessary. If the /// contract doesn't store under the given `key` `None` is returned. pub fn read(trie_id: &TrieId, key: &StorageKey) -> Option> { - child::get_raw(&child_trie_info(trie_id), &blake2_256(key)) + match key { + StorageKey::FixedSizedKey(k) => + child::get_raw(&child_trie_info(trie_id), &blake2_256(k)), + StorageKey::VariableSizedKey(k) => + child::get_raw(&child_trie_info(trie_id), &blake2_128_concat(k)), + } } /// Returns `Some(len)` (in bytes) if a storage item exists at `key`. @@ -134,7 +139,11 @@ where /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. pub fn size(trie_id: &TrieId, key: &StorageKey) -> Option { - child::len(&child_trie_info(trie_id), &blake2_256(key)) + match key { + StorageKey::FixedSizedKey(k) => child::len(&child_trie_info(trie_id), &blake2_256(key)), + StorageKey::VariableSizedKey(k) => + child::len(&child_trie_info(trie_id), &blake2_128_concat(key)), + } } /// Update a storage entry into a contract's kv storage. @@ -151,7 +160,11 @@ where storage_meter: Option<&mut meter::NestedMeter>, take: bool, ) -> Result { - let hashed_key = blake2_256(key); + let hashed_key = match key { + StorageKey::FixedSizedKey(k) => blake2_256(k), + StorageKey::VariableSizedKey(k) => blake2_128_concat(k), + }; + let child_trie_info = &child_trie_info(trie_id); let (old_len, old_value) = if take { let val = child::get_raw(child_trie_info, &hashed_key); diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 11dfc77616e69..45e1640654c2f 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -701,7 +701,9 @@ where fn set_storage( &mut self, + key_type: &StorageKey, key_ptr: u32, + key_len: u32, value_ptr: u32, value_len: u32, ) -> Result { @@ -711,10 +713,20 @@ where if value_len > max_size { return Err(Error::::ValueTooLarge.into()) } - let mut key: StorageKey = [0; 32]; + let mut key = match key_type { + FixedSizedKey(_) => [0; 32], + VariableSizedKey(_) => &[u8], + }; + self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; + + let key_typed = match key_type { + FixedSizedKey(_) => FixedSizedKey(key), + VariableSizedKey(_) => VariableSizedKey(key.try_into()), + }; + let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); - let write_outcome = self.ext.set_storage(key, value, false)?; + let write_outcome = self.ext.set_storage(key_typed, value, false)?; self.adjust_gas( charged, RuntimeCosts::SetStorage { new_bytes: value_len, old_bytes: write_outcome.old_len() }, @@ -722,11 +734,19 @@ where Ok(write_outcome.old_len_with_sentinel()) } - fn clear_storage(&mut self, key_ptr: u32) -> Result { + fn clear_storage(&mut self, key_type: &StorageKey, key_ptr: u32) -> Result { let charged = self.charge_gas(RuntimeCosts::ClearStorage(self.ext.max_value_size()))?; - let mut key: StorageKey = [0; 32]; + let mut key = match key_type { + FixedSizedKey(_) => [0; 32], + VariableSizedKey(_) => [0; key_len].into_vec(), + }; self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let outcome = self.ext.set_storage(key, None, false)?; + + let key_typed = match key_type { + FixedSizedKey(_) => FixedSizedKey(key), + VariableSizedKey(_) => VariableSizedKey(key), + }; + let outcome = self.ext.set_storage(key_typed, None, false)?; self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.old_len())); Ok(outcome.old_len_with_sentinel()) } @@ -927,9 +947,10 @@ define_env!(Env, , // `ReturnCode::KeyNotFound` [seal0] seal_get_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::GetStorage(ctx.ext.max_value_size()))?; - let mut key: StorageKey = [0; 32]; + let mut key = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - if let Some(value) = ctx.ext.get_storage(&key) { + let key_typed = StorageKey::FixSizedKey(key); + if let Some(value) = ctx.ext.get_storage(&key_typed) { ctx.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; Ok(ReturnCode::Success) @@ -951,9 +972,10 @@ define_env!(Env, , // `SENTINEL` is returned as a sentinel value. [seal0] seal_contains_storage(ctx, key_ptr: u32) -> u32 => { let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?; - let mut key: StorageKey = [0; 32]; + let mut key = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - if let Some(len) = ctx.ext.get_storage_size(&key) { + let key_typed = StorageKey::FixSizedKey(key); + if let Some(len) = ctx.ext.get_storage_size(&key_typed) { ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); Ok(len) } else { @@ -976,9 +998,10 @@ define_env!(Env, , // `ReturnCode::KeyNotFound` [__unstable__] seal_take_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; - let mut key: StorageKey = [0; 32]; + let mut key = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage(key, None, true)? { + let key_typed = StorageKey::FixSizedKey(key); + if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage(key_typed, None, true)? { ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; Ok(ReturnCode::Success) From da608cbd5a0be7a37c5a570a6e2a2084b5d07215 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sun, 22 May 2022 00:04:39 +0300 Subject: [PATCH 02/63] builds and old tests pass save: temporary value dropped while borrowed save: finally builds test updated but still fails --- frame/contracts/src/exec.rs | 83 ++++++++++++++++++++++++----- frame/contracts/src/lib.rs | 6 ++- frame/contracts/src/storage.rs | 30 +++-------- frame/contracts/src/tests.rs | 32 ++++++++--- frame/contracts/src/wasm/mod.rs | 55 +++++++++++++------ frame/contracts/src/wasm/runtime.rs | 75 +++++++++++++++----------- 6 files changed, 191 insertions(+), 90 deletions(-) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 7e85daa6221fd..6d5758d3a1d90 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -24,15 +24,17 @@ use crate::{ use frame_support::{ crypto::ecdsa::ECDSAExt, dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable}, + pallet_prelude::ConstU32, storage::{with_transaction, TransactionOutcome}, traits::{Contains, Currency, ExistenceRequirement, OriginTrait, Randomness, Time}, weights::Weight, + Blake2_128Concat, BoundedVec, StorageHasher, }; use frame_system::RawOrigin; use pallet_contracts_primitives::ExecReturnValue; use smallvec::{Array, SmallVec}; use sp_core::{crypto::UncheckedFrom, ecdsa::Public as ECDSAPublic}; -use sp_io::crypto::secp256k1_ecdsa_recover_compressed; +use sp_io::{crypto::secp256k1_ecdsa_recover_compressed, hashing::blake2_256}; use sp_runtime::traits::Convert; use sp_std::{marker::PhantomData, mem, prelude::*}; @@ -45,9 +47,24 @@ pub type ExecResult = Result; /// A type that represents a topic of an event. At the moment a hash is used. pub type TopicOf = ::Hash; -pub enum StorageKey { - FixedSizedKey([u8; 32]), - VariableSizedKey(Vec), +pub type FixedSizedKey = [u8; 32]; +pub type VariableSizedKey = BoundedVec>; // TODO: length to Config Get param + +pub trait StorageHash { + fn hash(self) -> Vec; +} + +// TODO: think how DYI: take StorageHasher impl from frame_support without copy-pasting +impl StorageHash for FixedSizedKey { + fn hash(self) -> Vec { + blake2_256(self.as_slice()).to_vec() + } +} + +impl StorageHash for VariableSizedKey { + fn hash(self) -> Vec { + Blake2_128Concat::hash(self.as_slice()) + } } /// Origin of the error. @@ -144,19 +161,33 @@ pub trait Ext: sealing::Sealed { /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - fn get_storage(&mut self, key: &StorageKey) -> Option>; + fn get_storage(&mut self, key: FixedSizedKey) -> Option>; + + /// + fn get_storage_transparent(&mut self, key: VariableSizedKey) -> 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_storage_size(&mut self, key: &StorageKey) -> Option; + fn get_storage_size(&mut self, key: FixedSizedKey) -> Option; + + /// + fn get_storage_size_transparent(&mut self, key: VariableSizedKey) -> 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_storage( &mut self, - key: StorageKey, + key: FixedSizedKey, + value: Option>, + take_old: bool, + ) -> Result; + + /// + fn set_storage_transparent( + &mut self, + key: VariableSizedKey, value: Option>, take_old: bool, ) -> Result; @@ -1089,24 +1120,48 @@ where Self::transfer(ExistenceRequirement::KeepAlive, &self.top_frame().account_id, to, value) } - fn get_storage(&mut self, key: &StorageKey) -> Option> { + fn get_storage(&mut self, key: FixedSizedKey) -> Option> { + Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) + } + + fn get_storage_transparent(&mut self, key: VariableSizedKey) -> Option> { Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) } - fn get_storage_size(&mut self, key: &StorageKey) -> Option { + fn get_storage_size(&mut self, key: FixedSizedKey) -> Option { + Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) + } + + fn get_storage_size_transparent(&mut self, key: VariableSizedKey) -> Option { Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) } fn set_storage( &mut self, - key: StorageKey, + key: FixedSizedKey, + value: Option>, + take_old: bool, + ) -> Result { + let frame = self.top_frame_mut(); + Storage::::write( + &frame.contract_info.get(&frame.account_id).trie_id, + key, + value, + Some(&mut frame.nested_storage), + take_old, + ) + } + + fn set_storage_transparent( + &mut self, + key: VariableSizedKey, value: Option>, take_old: bool, ) -> Result { let frame = self.top_frame_mut(); Storage::::write( &frame.contract_info.get(&frame.account_id).trie_id, - &key, + key, value, Some(&mut frame.nested_storage), take_old, @@ -2702,9 +2757,9 @@ mod tests { Ok(WriteOutcome::New) ); assert_eq!(ctx.ext.set_storage([2; 32], Some(vec![]), false), Ok(WriteOutcome::New)); - assert_eq!(ctx.ext.get_storage_size(&[1; 32]), Some(3)); - assert_eq!(ctx.ext.get_storage_size(&[2; 32]), Some(0)); - assert_eq!(ctx.ext.get_storage_size(&[3; 32]), None); + assert_eq!(ctx.ext.get_storage_size([1; 32]), Some(3)); + assert_eq!(ctx.ext.get_storage_size([2; 32]), Some(0)); + assert_eq!(ctx.ext.get_storage_size([3; 32]), None); exec_success() }); diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 0ae326f6c1e8f..a0dae8eb297cb 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -128,6 +128,8 @@ use sp_core::{crypto::UncheckedFrom, Bytes}; use sp_runtime::traits::{Convert, Hash, Saturating, StaticLookup}; use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; +use crate::exec::StorageHash; + type CodeHash = ::Hash; type TrieId = Vec; type BalanceOf = @@ -876,11 +878,11 @@ where } /// Query storage of a specified contract under a specified key. - pub fn get_storage(address: T::AccountId, key: [u8; 32]) -> GetStorageResult { + pub fn get_storage(address: T::AccountId, key: K) -> GetStorageResult { let contract_info = ContractInfoOf::::get(&address).ok_or(ContractAccessError::DoesntExist)?; - let maybe_value = Storage::::read(&contract_info.trie_id, &key); + let maybe_value = Storage::::read(&contract_info.trie_id, key); Ok(maybe_value) } diff --git a/frame/contracts/src/storage.rs b/frame/contracts/src/storage.rs index da51ebd70420a..3f2b928ed4133 100644 --- a/frame/contracts/src/storage.rs +++ b/frame/contracts/src/storage.rs @@ -20,7 +20,7 @@ pub mod meter; use crate::{ - exec::{AccountIdOf, StorageKey}, + exec::{AccountIdOf, StorageHash}, weights::WeightInfo, BalanceOf, CodeHash, Config, ContractInfoOf, DeletionQueue, Error, TrieId, SENTINEL, }; @@ -33,7 +33,6 @@ use frame_support::{ }; use scale_info::TypeInfo; use sp_core::crypto::UncheckedFrom; -use sp_io::hashing::{blake2_256; use sp_runtime::{ traits::{Hash, Zero}, RuntimeDebug, @@ -125,25 +124,16 @@ where /// /// The read is performed from the `trie_id` only. The `address` is not necessary. If the /// contract doesn't store under the given `key` `None` is returned. - pub fn read(trie_id: &TrieId, key: &StorageKey) -> Option> { - match key { - StorageKey::FixedSizedKey(k) => - child::get_raw(&child_trie_info(trie_id), &blake2_256(k)), - StorageKey::VariableSizedKey(k) => - child::get_raw(&child_trie_info(trie_id), &blake2_128_concat(k)), - } + pub fn read(trie_id: &TrieId, key: K) -> Option> { + child::get_raw(&child_trie_info(trie_id), key.hash().as_slice()) } /// 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. - pub fn size(trie_id: &TrieId, key: &StorageKey) -> Option { - match key { - StorageKey::FixedSizedKey(k) => child::len(&child_trie_info(trie_id), &blake2_256(key)), - StorageKey::VariableSizedKey(k) => - child::len(&child_trie_info(trie_id), &blake2_128_concat(key)), - } + pub fn size(trie_id: &TrieId, key: K) -> Option { + child::len(&child_trie_info(trie_id), key.hash().as_slice()) } /// Update a storage entry into a contract's kv storage. @@ -153,19 +143,15 @@ where /// /// This function also records how much storage was created or removed if a `storage_meter` /// is supplied. It should only be absent for testing or benchmarking code. - pub fn write( + pub fn write( trie_id: &TrieId, - key: &StorageKey, + key: K, new_value: Option>, storage_meter: Option<&mut meter::NestedMeter>, take: bool, ) -> Result { - let hashed_key = match key { - StorageKey::FixedSizedKey(k) => blake2_256(k), - StorageKey::VariableSizedKey(k) => blake2_128_concat(k), - }; - let child_trie_info = &child_trie_info(trie_id); + let hashed_key = key.hash(); let (old_len, old_value) = if take { let val = child::get_raw(child_trie_info, &hashed_key); (val.as_ref().map(|v| v.len() as u32), val) diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 407e1e999dde1..a4130d4786ed4 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -20,7 +20,7 @@ use crate::{ ChainExtension, Environment, Ext, InitState, Result as ExtensionResult, RetVal, ReturnFlags, SysConfig, UncheckedFrom, }, - exec::Frame, + exec::{FixedSizedKey, Frame}, storage::Storage, wasm::{PrefabWasmModule, ReturnCode as RuntimeReturnCode}, weights::WeightInfo, @@ -1701,8 +1701,14 @@ fn lazy_removal_partial_remove_works() { // Put value into the contracts child trie for val in &vals { - Storage::::write(&info.trie_id, &val.0, Some(val.2.clone()), None, false) - .unwrap(); + Storage::::write( + &info.trie_id, + val.0 as FixedSizedKey, + Some(val.2.clone()), + None, + false, + ) + .unwrap(); } >::insert(&addr, info.clone()); @@ -1786,8 +1792,14 @@ fn lazy_removal_does_no_run_on_full_block() { // Put value into the contracts child trie for val in &vals { - Storage::::write(&info.trie_id, &val.0, Some(val.2.clone()), None, false) - .unwrap(); + Storage::::write( + &info.trie_id, + val.0 as FixedSizedKey, + Some(val.2.clone()), + None, + false, + ) + .unwrap(); } >::insert(&addr, info.clone()); @@ -1870,8 +1882,14 @@ fn lazy_removal_does_not_use_all_weight() { // Put value into the contracts child trie for val in &vals { - Storage::::write(&info.trie_id, &val.0, Some(val.2.clone()), None, false) - .unwrap(); + Storage::::write( + &info.trie_id, + val.0 as FixedSizedKey, + Some(val.2.clone()), + None, + false, + ) + .unwrap(); } >::insert(&addr, info.clone()); diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index d710cad199f93..13c624f5d0c5d 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -258,7 +258,8 @@ mod tests { use super::*; use crate::{ exec::{ - AccountIdOf, BlockNumberOf, ErrorOrigin, ExecError, Executable, Ext, SeedOf, StorageKey, + AccountIdOf, BlockNumberOf, ErrorOrigin, ExecError, Executable, Ext, FixedSizedKey, + SeedOf, VariableSizedKey, }, gas::GasMeter, storage::WriteOutcome, @@ -313,7 +314,7 @@ mod tests { } pub struct MockExt { - storage: HashMap>, + storage: HashMap, Vec>, instantiates: Vec, terminations: Vec, calls: Vec, @@ -408,19 +409,43 @@ mod tests { self.terminations.push(TerminationEntry { beneficiary: beneficiary.clone() }); Ok(()) } - fn get_storage(&mut self, key: &StorageKey) -> Option> { - self.storage.get(key).cloned() + fn get_storage(&mut self, key: FixedSizedKey) -> Option> { + self.storage.get(&key.to_vec()).cloned() } - fn get_storage_size(&mut self, key: &StorageKey) -> Option { - self.storage.get(key).map(|val| val.len() as u32) + fn get_storage_transparent(&mut self, key: VariableSizedKey) -> Option> { + self.storage.get(&key.to_vec()).cloned() + } + fn get_storage_size(&mut self, key: FixedSizedKey) -> Option { + self.storage.get(&key.to_vec()).map(|val| val.len() as u32) + } + fn get_storage_size_transparent(&mut self, key: VariableSizedKey) -> Option { + self.storage.get(&key.to_vec()).map(|val| val.len() as u32) } fn set_storage( &mut self, - key: StorageKey, + key: FixedSizedKey, + value: Option>, + take_old: bool, + ) -> Result { + let entry = self.storage.entry(key.to_vec()); + 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.storage.insert(key.to_vec(), value); + } + Ok(result) + } + fn set_storage_transparent( + &mut self, + key: VariableSizedKey, value: Option>, take_old: bool, ) -> Result { - let entry = self.storage.entry(key); + let entry = self.storage.entry(key.to_vec()); let result = match (entry, take_old) { (Entry::Vacant(_), _) => WriteOutcome::New, (Entry::Occupied(entry), false) => @@ -428,7 +453,7 @@ mod tests { (Entry::Occupied(entry), true) => WriteOutcome::Taken(entry.remove()), }; if let Some(value) = value { - self.storage.insert(key, value); + self.storage.insert(key.to_vec(), value); } Ok(result) } @@ -862,8 +887,8 @@ mod tests { let mut ext = MockExt::default(); - ext.storage.insert([1u8; 32], vec![42u8]); - ext.storage.insert([2u8; 32], vec![]); + ext.storage.insert(vec![1u8; 32], vec![42u8]); + ext.storage.insert(vec![2u8; 32], vec![]); // value does not exist -> sentinel value returned let result = execute(CODE, [3u8; 32].encode(), &mut ext).unwrap(); @@ -1190,7 +1215,7 @@ mod tests { #[test] fn get_storage_puts_data_into_buf() { let mut mock_ext = MockExt::default(); - mock_ext.storage.insert([0x11; 32], [0x22; 32].to_vec()); + mock_ext.storage.insert([0x11; 32].to_vec(), [0x22; 32].to_vec()); let output = execute(CODE_GET_STORAGE, vec![], mock_ext).unwrap(); @@ -2208,19 +2233,19 @@ mod tests { let input = ([1u8; 32], [42u8, 48]).encode(); let result = execute(CODE, input, &mut ext).unwrap(); assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), crate::SENTINEL); - assert_eq!(ext.storage.get(&[1u8; 32]).unwrap(), &[42u8, 48]); + assert_eq!(ext.storage.get(&[1u8; 32].to_vec()).unwrap(), &[42u8, 48]); // value do exist -> length of old value returned let input = ([1u8; 32], [0u8; 0]).encode(); let result = execute(CODE, input, &mut ext).unwrap(); assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 2); - assert_eq!(ext.storage.get(&[1u8; 32]).unwrap(), &[0u8; 0]); + assert_eq!(ext.storage.get(&[1u8; 32].to_vec()).unwrap(), &[0u8; 0]); // value do exist -> length of old value returned (test for zero sized val) let input = ([1u8; 32], [99u8]).encode(); let result = execute(CODE, input, &mut ext).unwrap(); assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 0); - assert_eq!(ext.storage.get(&[1u8; 32]).unwrap(), &[99u8]); + assert_eq!(ext.storage.get(&[1u8; 32].to_vec()).unwrap(), &[99u8]); } #[test] diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 45e1640654c2f..88e538af1ee74 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -18,12 +18,13 @@ //! Environment definition of the wasm smart-contract runtime. use crate::{ - exec::{ExecError, ExecResult, Ext, StorageKey, TopicOf}, + exec::{ExecError, ExecResult, Ext, FixedSizedKey, TopicOf, VariableSizedKey}, gas::{ChargedAmount, Token}, schedule::HostFnWeights, wasm::env_def::ConvertibleToWasm, BalanceOf, CodeHash, Config, Error, SENTINEL, }; + use bitflags::bitflags; use codec::{Decode, DecodeAll, Encode, MaxEncodedLen}; use frame_support::{dispatch::DispatchError, ensure, weights::Weight}; @@ -35,6 +36,11 @@ use sp_sandbox::SandboxMemory; use sp_std::prelude::*; use wasm_instrument::parity_wasm::elements::ValueType; +enum KeyType { + Fixed, + Transparent, +} + /// Every error that can be returned to a contract when it calls any of the host functions. /// /// # Note @@ -701,7 +707,7 @@ where fn set_storage( &mut self, - key_type: &StorageKey, + key_type: KeyType, key_ptr: u32, key_len: u32, value_ptr: u32, @@ -713,20 +719,22 @@ where if value_len > max_size { return Err(Error::::ValueTooLarge.into()) } - let mut key = match key_type { - FixedSizedKey(_) => [0; 32], - VariableSizedKey(_) => &[u8], - }; + let mut key = vec![0; key_len.try_into().expect("key length error")]; self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let key_typed = match key_type { - FixedSizedKey(_) => FixedSizedKey(key), - VariableSizedKey(_) => VariableSizedKey(key.try_into()), + let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); + let write_outcome = match key_type { + KeyType::Fixed => { + let k: FixedSizedKey = key.try_into().expect("asda"); + self.ext.set_storage(k, value, false)? + }, + KeyType::Transparent => { + let k: VariableSizedKey = key.try_into().expect("asda"); + self.ext.set_storage_transparent(k, value, false)? + }, }; - let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); - let write_outcome = self.ext.set_storage(key_typed, value, false)?; self.adjust_gas( charged, RuntimeCosts::SetStorage { new_bytes: value_len, old_bytes: write_outcome.old_len() }, @@ -734,19 +742,28 @@ where Ok(write_outcome.old_len_with_sentinel()) } - fn clear_storage(&mut self, key_type: &StorageKey, key_ptr: u32) -> Result { + fn clear_storage( + &mut self, + key_type: KeyType, + key_ptr: u32, + key_len: u32, + ) -> Result { let charged = self.charge_gas(RuntimeCosts::ClearStorage(self.ext.max_value_size()))?; - let mut key = match key_type { - FixedSizedKey(_) => [0; 32], - VariableSizedKey(_) => [0; key_len].into_vec(), - }; + + let mut key = vec![0; key_len.try_into().expect("pp[s")]; self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let key_typed = match key_type { - FixedSizedKey(_) => FixedSizedKey(key), - VariableSizedKey(_) => VariableSizedKey(key), + let outcome = match key_type { + KeyType::Fixed => { + let k: FixedSizedKey = key.try_into().expect("asda"); + self.ext.set_storage(k, None, false)? + }, + KeyType::Transparent => { + let k: VariableSizedKey = key.try_into().expect("asda"); + self.ext.set_storage_transparent(k, None, false)? + }, }; - let outcome = self.ext.set_storage(key_typed, None, false)?; + self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.old_len())); Ok(outcome.old_len_with_sentinel()) } @@ -889,7 +906,7 @@ define_env!(Env, , // Equivalent to the newer version of `seal_set_storage` with the exception of the return // type. Still a valid thing to call when not interested in the return value. [seal0] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) => { - ctx.set_storage(key_ptr, value_ptr, value_len).map(|_| ()) + ctx.set_storage(KeyType::Fixed, key_ptr, 32u32, value_ptr, value_len).map(|_| ()) }, // Set the value at the given key in the contract storage. @@ -908,7 +925,7 @@ define_env!(Env, , // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. [seal1] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) -> u32 => { - ctx.set_storage(key_ptr, value_ptr, value_len) + ctx.set_storage(KeyType::Fixed, key_ptr, 32u32, value_ptr, value_len) }, // Clear the value at the given key in the contract storage. @@ -916,7 +933,7 @@ define_env!(Env, , // Equivalent to the newer version of `seal_clear_storage` with the exception of the return // type. Still a valid thing to call when not interested in the return value. [seal0] seal_clear_storage(ctx, key_ptr: u32) => { - ctx.clear_storage(key_ptr).map(|_| ()).map_err(Into::into) + ctx.clear_storage(KeyType::Fixed, key_ptr, 32u32).map(|_| ()).map_err(Into::into) }, // Clear the value at the given key in the contract storage. @@ -947,10 +964,9 @@ define_env!(Env, , // `ReturnCode::KeyNotFound` [seal0] seal_get_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::GetStorage(ctx.ext.max_value_size()))?; - let mut key = [0; 32]; + let mut key: FixedSizedKey = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let key_typed = StorageKey::FixSizedKey(key); - if let Some(value) = ctx.ext.get_storage(&key_typed) { + if let Some(value) = ctx.ext.get_storage(key) { ctx.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; Ok(ReturnCode::Success) @@ -972,10 +988,9 @@ define_env!(Env, , // `SENTINEL` is returned as a sentinel value. [seal0] seal_contains_storage(ctx, key_ptr: u32) -> u32 => { let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?; - let mut key = [0; 32]; + let mut key: FixedSizedKey = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let key_typed = StorageKey::FixSizedKey(key); - if let Some(len) = ctx.ext.get_storage_size(&key_typed) { + if let Some(len) = ctx.ext.get_storage_size(key) { ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); Ok(len) } else { @@ -1000,7 +1015,7 @@ define_env!(Env, , let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; let mut key = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let key_typed = StorageKey::FixSizedKey(key); + let key_typed = StorageKey::FixedSizedKey(key); if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage(key_typed, None, true)? { ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; From e15f881a0835f1602985ca3a70e6f9019cb799ad Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sun, 22 May 2022 18:03:20 +0300 Subject: [PATCH 03/63] type names enhanced --- frame/contracts/src/exec.rs | 33 ++++++++++++++--------------- frame/contracts/src/tests.rs | 8 +++---- frame/contracts/src/wasm/mod.rs | 16 +++++++------- frame/contracts/src/wasm/runtime.rs | 16 +++++++------- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 6d5758d3a1d90..42f50dc6b71b4 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -47,21 +47,20 @@ pub type ExecResult = Result; /// A type that represents a topic of an event. At the moment a hash is used. pub type TopicOf = ::Hash; -pub type FixedSizedKey = [u8; 32]; -pub type VariableSizedKey = BoundedVec>; // TODO: length to Config Get param +pub type FixSizedKey = [u8; 32]; +pub type VarSizedKey = BoundedVec>; // TODO: length to Config Get param pub trait StorageHash { fn hash(self) -> Vec; } -// TODO: think how DYI: take StorageHasher impl from frame_support without copy-pasting -impl StorageHash for FixedSizedKey { +impl StorageHash for FixSizedKey { fn hash(self) -> Vec { blake2_256(self.as_slice()).to_vec() } } -impl StorageHash for VariableSizedKey { +impl StorageHash for VarSizedKey { fn hash(self) -> Vec { Blake2_128Concat::hash(self.as_slice()) } @@ -161,25 +160,25 @@ pub trait Ext: sealing::Sealed { /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - fn get_storage(&mut self, key: FixedSizedKey) -> Option>; + fn get_storage(&mut self, key: FixSizedKey) -> Option>; /// - fn get_storage_transparent(&mut self, key: VariableSizedKey) -> Option>; + fn get_storage_transparent(&mut self, key: VarSizedKey) -> 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_storage_size(&mut self, key: FixedSizedKey) -> Option; + fn get_storage_size(&mut self, key: FixSizedKey) -> Option; /// - fn get_storage_size_transparent(&mut self, key: VariableSizedKey) -> Option; + fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> 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_storage( &mut self, - key: FixedSizedKey, + key: FixSizedKey, value: Option>, take_old: bool, ) -> Result; @@ -187,7 +186,7 @@ pub trait Ext: sealing::Sealed { /// fn set_storage_transparent( &mut self, - key: VariableSizedKey, + key: VarSizedKey, value: Option>, take_old: bool, ) -> Result; @@ -1120,25 +1119,25 @@ where Self::transfer(ExistenceRequirement::KeepAlive, &self.top_frame().account_id, to, value) } - fn get_storage(&mut self, key: FixedSizedKey) -> Option> { + fn get_storage(&mut self, key: FixSizedKey) -> Option> { Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) } - fn get_storage_transparent(&mut self, key: VariableSizedKey) -> Option> { + fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) } - fn get_storage_size(&mut self, key: FixedSizedKey) -> Option { + fn get_storage_size(&mut self, key: FixSizedKey) -> Option { Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) } - fn get_storage_size_transparent(&mut self, key: VariableSizedKey) -> Option { + fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) } fn set_storage( &mut self, - key: FixedSizedKey, + key: FixSizedKey, value: Option>, take_old: bool, ) -> Result { @@ -1154,7 +1153,7 @@ where fn set_storage_transparent( &mut self, - key: VariableSizedKey, + key: VarSizedKey, value: Option>, take_old: bool, ) -> Result { diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index a4130d4786ed4..2a9b96689b52f 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -20,7 +20,7 @@ use crate::{ ChainExtension, Environment, Ext, InitState, Result as ExtensionResult, RetVal, ReturnFlags, SysConfig, UncheckedFrom, }, - exec::{FixedSizedKey, Frame}, + exec::{FixSizedKey, Frame}, storage::Storage, wasm::{PrefabWasmModule, ReturnCode as RuntimeReturnCode}, weights::WeightInfo, @@ -1703,7 +1703,7 @@ fn lazy_removal_partial_remove_works() { for val in &vals { Storage::::write( &info.trie_id, - val.0 as FixedSizedKey, + val.0 as FixSizedKey, Some(val.2.clone()), None, false, @@ -1794,7 +1794,7 @@ fn lazy_removal_does_no_run_on_full_block() { for val in &vals { Storage::::write( &info.trie_id, - val.0 as FixedSizedKey, + val.0 as FixSizedKey, Some(val.2.clone()), None, false, @@ -1884,7 +1884,7 @@ fn lazy_removal_does_not_use_all_weight() { for val in &vals { Storage::::write( &info.trie_id, - val.0 as FixedSizedKey, + val.0 as FixSizedKey, Some(val.2.clone()), None, false, diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 13c624f5d0c5d..8da3dd4f417d8 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -258,8 +258,8 @@ mod tests { use super::*; use crate::{ exec::{ - AccountIdOf, BlockNumberOf, ErrorOrigin, ExecError, Executable, Ext, FixedSizedKey, - SeedOf, VariableSizedKey, + AccountIdOf, BlockNumberOf, ErrorOrigin, ExecError, Executable, Ext, FixSizedKey, + SeedOf, VarSizedKey, }, gas::GasMeter, storage::WriteOutcome, @@ -409,21 +409,21 @@ mod tests { self.terminations.push(TerminationEntry { beneficiary: beneficiary.clone() }); Ok(()) } - fn get_storage(&mut self, key: FixedSizedKey) -> Option> { + fn get_storage(&mut self, key: FixSizedKey) -> Option> { self.storage.get(&key.to_vec()).cloned() } - fn get_storage_transparent(&mut self, key: VariableSizedKey) -> Option> { + fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { self.storage.get(&key.to_vec()).cloned() } - fn get_storage_size(&mut self, key: FixedSizedKey) -> Option { + fn get_storage_size(&mut self, key: FixSizedKey) -> Option { self.storage.get(&key.to_vec()).map(|val| val.len() as u32) } - fn get_storage_size_transparent(&mut self, key: VariableSizedKey) -> Option { + fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { self.storage.get(&key.to_vec()).map(|val| val.len() as u32) } fn set_storage( &mut self, - key: FixedSizedKey, + key: FixSizedKey, value: Option>, take_old: bool, ) -> Result { @@ -441,7 +441,7 @@ mod tests { } fn set_storage_transparent( &mut self, - key: VariableSizedKey, + key: VarSizedKey, value: Option>, take_old: bool, ) -> Result { diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 88e538af1ee74..1d3b77cf1e984 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -18,7 +18,7 @@ //! Environment definition of the wasm smart-contract runtime. use crate::{ - exec::{ExecError, ExecResult, Ext, FixedSizedKey, TopicOf, VariableSizedKey}, + exec::{ExecError, ExecResult, Ext, FixSizedKey, TopicOf, VarSizedKey}, gas::{ChargedAmount, Token}, schedule::HostFnWeights, wasm::env_def::ConvertibleToWasm, @@ -726,11 +726,11 @@ where let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); let write_outcome = match key_type { KeyType::Fixed => { - let k: FixedSizedKey = key.try_into().expect("asda"); + let k: FixSizedKey = key.try_into().expect("asda"); self.ext.set_storage(k, value, false)? }, KeyType::Transparent => { - let k: VariableSizedKey = key.try_into().expect("asda"); + let k: VarSizedKey = key.try_into().expect("asda"); self.ext.set_storage_transparent(k, value, false)? }, }; @@ -755,11 +755,11 @@ where let outcome = match key_type { KeyType::Fixed => { - let k: FixedSizedKey = key.try_into().expect("asda"); + let k: FixSizedKey = key.try_into().expect("asda"); self.ext.set_storage(k, None, false)? }, KeyType::Transparent => { - let k: VariableSizedKey = key.try_into().expect("asda"); + let k: VarSizedKey = key.try_into().expect("asda"); self.ext.set_storage_transparent(k, None, false)? }, }; @@ -964,7 +964,7 @@ define_env!(Env, , // `ReturnCode::KeyNotFound` [seal0] seal_get_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::GetStorage(ctx.ext.max_value_size()))?; - let mut key: FixedSizedKey = [0; 32]; + let mut key: FixSizedKey = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; if let Some(value) = ctx.ext.get_storage(key) { ctx.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); @@ -988,7 +988,7 @@ define_env!(Env, , // `SENTINEL` is returned as a sentinel value. [seal0] seal_contains_storage(ctx, key_ptr: u32) -> u32 => { let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?; - let mut key: FixedSizedKey = [0; 32]; + let mut key: FixSizedKey = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; if let Some(len) = ctx.ext.get_storage_size(key) { ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); @@ -1015,7 +1015,7 @@ define_env!(Env, , let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; let mut key = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let key_typed = StorageKey::FixedSizedKey(key); + let key_typed = StorageKey::FixSizedKey(key); if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage(key_typed, None, true)? { ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; From ceb15885e8d1eab62faed7967b1f31647185d971 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sun, 22 May 2022 18:36:31 +0300 Subject: [PATCH 04/63] VarSizedKey bounded to new Config param --- bin/node/runtime/src/lib.rs | 1 + frame/contracts/src/lib.rs | 3 +++ frame/contracts/src/tests.rs | 1 + 3 files changed, 5 insertions(+) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index c98bb5cc13f85..e5ce9d62a642e 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1120,6 +1120,7 @@ impl pallet_contracts::Config for Runtime { type ContractAccessWeight = pallet_contracts::DefaultContractAccessWeight; type MaxCodeLen = ConstU32<{ 128 * 1024 }>; type RelaxedMaxCodeLen = ConstU32<{ 256 * 1024 }>; + type MaxStorageKeyLen = ConstU32<128>; } impl pallet_sudo::Config for Runtime { diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 0bc982672ce40..acbca979755dc 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -374,6 +374,9 @@ pub mod pallet { /// new instrumentation increases the size beyond the limit it would make that contract /// inaccessible until rectified by another runtime upgrade. type RelaxedMaxCodeLen: Get; + + /// The maximum length of veriable sized key used on storage with transparent hasing. + type MaxStorageKeyLen: Get; } #[pallet::hooks] diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 6c9d32cbd0d34..8951fea6ea2d2 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -290,6 +290,7 @@ impl Config for Test { type ContractAccessWeight = DefaultContractAccessWeight; type MaxCodeLen = ConstU32<{ 128 * 1024 }>; type RelaxedMaxCodeLen = ConstU32<{ 256 * 1024 }>; + type MaxStorageKeyLen = ConstU32<128>; } pub const ALICE: AccountId32 = AccountId32::new([1u8; 32]); From ea8c5be9fe6ada71dff0fc549c25d874e514d22b Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sun, 22 May 2022 19:29:01 +0300 Subject: [PATCH 05/63] improved wasm runtime updated funcs --- frame/contracts/src/wasm/runtime.rs | 54 +++++++++++++++++------------ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 164cb7881b8d9..c79054daf4aec 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -36,9 +36,13 @@ use sp_sandbox::SandboxMemory; use sp_std::prelude::*; use wasm_instrument::parity_wasm::elements::ValueType; +/// Type of storage key. +/// FixSized is old fashioned [0;32]. +/// VarSized is a key used for transparent hashing, which is a u8 vector maximum length of +/// MaxStorageKeyLen. enum KeyType { - Fixed, - Transparent, + FixSized, + VarSized, } /// Every error that can be returned to a contract when it calls any of the host functions. @@ -714,19 +718,21 @@ where return Err(Error::::ValueTooLarge.into()) } - let mut key = vec![0; key_len.try_into().expect("key length error")]; + let mut key = vec![0; key_len.try_into().map_err(|_| Error::::ValueTooLarge)?]; self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); let write_outcome = match key_type { - KeyType::Fixed => { - let k: FixSizedKey = key.try_into().expect("asda"); - self.ext.set_storage(k, value, false)? - }, - KeyType::Transparent => { - let k: VarSizedKey = key.try_into().expect("asda"); - self.ext.set_storage_transparent(k, value, false)? - }, + KeyType::FixSized => self.ext.set_storage( + FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + value, + false, + )?, + KeyType::VarSized => self.ext.set_storage_transparent( + VarSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + value, + false, + )?, }; self.adjust_gas( @@ -744,18 +750,20 @@ where ) -> Result { let charged = self.charge_gas(RuntimeCosts::ClearStorage(self.ext.max_value_size()))?; - let mut key = vec![0; key_len.try_into().expect("pp[s")]; + let mut key = vec![0; key_len.try_into().map_err(|_| Error::::ValueTooLarge)?]; self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; let outcome = match key_type { - KeyType::Fixed => { - let k: FixSizedKey = key.try_into().expect("asda"); - self.ext.set_storage(k, None, false)? - }, - KeyType::Transparent => { - let k: VarSizedKey = key.try_into().expect("asda"); - self.ext.set_storage_transparent(k, None, false)? - }, + KeyType::FixSized => self.ext.set_storage( + FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + None, + false, + )?, + KeyType::VarSized => self.ext.set_storage_transparent( + VarSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + None, + false, + )?, }; self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.old_len())); @@ -900,7 +908,7 @@ define_env!(Env, , // Equivalent to the newer version of `seal_set_storage` with the exception of the return // type. Still a valid thing to call when not interested in the return value. [seal0] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) => { - ctx.set_storage(KeyType::Fixed, key_ptr, 32u32, value_ptr, value_len).map(|_| ()) + ctx.set_storage(KeyType::FixSized, key_ptr, 32u32, value_ptr, value_len).map(|_| ()) }, // Set the value at the given key in the contract storage. @@ -919,7 +927,7 @@ define_env!(Env, , // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. [seal1] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) -> u32 => { - ctx.set_storage(KeyType::Fixed, key_ptr, 32u32, value_ptr, value_len) + ctx.set_storage(KeyType::FixSized, key_ptr, 32u32, value_ptr, value_len) }, // Clear the value at the given key in the contract storage. @@ -927,7 +935,7 @@ define_env!(Env, , // Equivalent to the newer version of `seal_clear_storage` with the exception of the return // type. Still a valid thing to call when not interested in the return value. [seal0] seal_clear_storage(ctx, key_ptr: u32) => { - ctx.clear_storage(KeyType::Fixed, key_ptr, 32u32).map(|_| ()).map_err(Into::into) + ctx.clear_storage(KeyType::FixSized, key_ptr, 32u32).map(|_| ()).map_err(Into::into) }, // Clear the value at the given key in the contract storage. From 7d5a6130ffbee9f94fdc5194659230f71d3a21b2 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sun, 22 May 2022 19:43:49 +0300 Subject: [PATCH 06/63] unstable-interface tests fixed --- frame/contracts/src/benchmarking/mod.rs | 4 ++-- frame/contracts/src/wasm/mod.rs | 18 +++++++++--------- frame/contracts/src/wasm/runtime.rs | 7 +++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 4241456389ec7..c6b060d644298 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -30,7 +30,7 @@ use self::{ sandbox::Sandbox, }; use crate::{ - exec::{AccountIdOf, StorageKey}, + exec::{AccountIdOf, FixSizedKey}, schedule::{API_BENCHMARK_BATCH_SIZE, INSTR_BENCHMARK_BATCH_SIZE}, storage::Storage, wasm::CallFlags, @@ -132,7 +132,7 @@ where } /// Store the supplied storage items into this contracts storage. - fn store(&self, items: &Vec<(StorageKey, Vec)>) -> Result<(), &'static str> { + fn store(&self, items: &Vec<(FixedSizedKey, Vec)>) -> Result<(), &'static str> { let info = self.info()?; for item in items { Storage::::write(&info.trie_id, &item.0, Some(item.1.clone()), None, false) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 24b57b2af187c..6e0e4c1a7e39f 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -2301,23 +2301,23 @@ mod tests { let mut ext = MockExt::default(); - ext.storage.insert([1u8; 32], vec![42u8]); - ext.storage.insert([2u8; 32], vec![]); + ext.storage.insert([1u8; 32].to_vec(), vec![42u8]); + ext.storage.insert([2u8; 32].to_vec(), vec![]); // value does not exist -> sentinel returned let result = execute(CODE, [3u8; 32].encode(), &mut ext).unwrap(); assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), crate::SENTINEL); - assert_eq!(ext.storage.get(&[3u8; 32]), None); + assert_eq!(ext.storage.get(&[3u8; 32].to_vec()), None); // value did exist -> length returned let result = execute(CODE, [1u8; 32].encode(), &mut ext).unwrap(); assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 1); - assert_eq!(ext.storage.get(&[1u8; 32]), None); + assert_eq!(ext.storage.get(&[1u8; 32].to_vec()), None); // value did exist -> length returned (test for 0 sized) let result = execute(CODE, [2u8; 32].encode(), &mut ext).unwrap(); assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 0); - assert_eq!(ext.storage.get(&[2u8; 32]), None); + assert_eq!(ext.storage.get(&[2u8; 32].to_vec()), None); } #[test] @@ -2374,8 +2374,8 @@ mod tests { let mut ext = MockExt::default(); - ext.storage.insert([1u8; 32], vec![42u8]); - ext.storage.insert([2u8; 32], vec![]); + ext.storage.insert([1u8; 32].to_vec(), vec![42u8]); + ext.storage.insert([2u8; 32].to_vec(), vec![]); // value does not exist -> error returned let result = execute(CODE, [3u8; 32].encode(), &mut ext).unwrap(); @@ -2390,7 +2390,7 @@ mod tests { u32::from_le_bytes(result.data.0[0..4].try_into().unwrap()), ReturnCode::Success as u32 ); - assert_eq!(ext.storage.get(&[1u8; 32]), None); + assert_eq!(ext.storage.get(&[1u8; 32].to_vec()), None); assert_eq!(&result.data.0[4..], &[42u8]); // value did exist -> length returned (test for 0 sized) @@ -2399,7 +2399,7 @@ mod tests { u32::from_le_bytes(result.data.0[0..4].try_into().unwrap()), ReturnCode::Success as u32 ); - assert_eq!(ext.storage.get(&[2u8; 32]), None); + assert_eq!(ext.storage.get(&[2u8; 32].to_vec()), None); assert_eq!(&result.data.0[4..], &[0u8; 0]); } diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index c79054daf4aec..0718d2b301993 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -949,7 +949,7 @@ define_env!(Env, , // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. [__unstable__] seal_clear_storage(ctx, key_ptr: u32) -> u32 => { - ctx.clear_storage(key_ptr).map_err(Into::into) + ctx.clear_storage(KeyType::FixSized, key_ptr, 32u32).map_err(Into::into) }, // Retrieve the value under the given key from storage. @@ -1015,10 +1015,9 @@ define_env!(Env, , // `ReturnCode::KeyNotFound` [__unstable__] seal_take_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; - let mut key = [0; 32]; + let mut key = FixSizedKey::default(); ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let key_typed = StorageKey::FixSizedKey(key); - if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage(key_typed, None, true)? { + if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage(key, None, true)? { ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; Ok(ReturnCode::Success) From 0d8206c23c45282151846f2408418ddfa88d2e83 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sun, 22 May 2022 19:58:35 +0300 Subject: [PATCH 07/63] benchmarks fixed --- frame/contracts/src/benchmarking/mod.rs | 34 +++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index c6b060d644298..c6b921ab52915 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -132,11 +132,17 @@ where } /// Store the supplied storage items into this contracts storage. - fn store(&self, items: &Vec<(FixedSizedKey, Vec)>) -> Result<(), &'static str> { + fn store(&self, items: &Vec<(FixSizedKey, Vec)>) -> Result<(), &'static str> { let info = self.info()?; for item in items { - Storage::::write(&info.trie_id, &item.0, Some(item.1.clone()), None, false) - .map_err(|_| "Failed to write storage to restoration dest")?; + Storage::::write( + &info.trie_id, + item.0 as FixSizedKey, + Some(item.1.clone()), + None, + false, + ) + .map_err(|_| "Failed to write storage to restoration dest")?; } >::insert(&self.account_id, info); Ok(()) @@ -935,7 +941,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -981,7 +987,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1027,7 +1033,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1074,7 +1080,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1119,7 +1125,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1171,7 +1177,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1223,7 +1229,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1270,7 +1276,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1315,7 +1321,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1367,7 +1373,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1419,7 +1425,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, From e1a735f424ee633b997619f745d79cd2957ba865 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 24 May 2022 16:46:21 +0300 Subject: [PATCH 08/63] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- frame/contracts/src/exec.rs | 2 +- frame/contracts/src/lib.rs | 2 +- frame/contracts/src/wasm/runtime.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 42f50dc6b71b4..8dffad50c575f 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -48,7 +48,7 @@ pub type ExecResult = Result; pub type TopicOf = ::Hash; pub type FixSizedKey = [u8; 32]; -pub type VarSizedKey = BoundedVec>; // TODO: length to Config Get param +pub type VarSizedKey = BoundedVec::MaxStorageKeyLen>; pub trait StorageHash { fn hash(self) -> Vec; diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index acbca979755dc..8d07cbbab807d 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -375,7 +375,7 @@ pub mod pallet { /// inaccessible until rectified by another runtime upgrade. type RelaxedMaxCodeLen: Get; - /// The maximum length of veriable sized key used on storage with transparent hasing. + /// The maximum allowable length in bytes for storage keys. type MaxStorageKeyLen: Get; } diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 0718d2b301993..e918525ee1c34 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -41,8 +41,8 @@ use wasm_instrument::parity_wasm::elements::ValueType; /// VarSized is a key used for transparent hashing, which is a u8 vector maximum length of /// MaxStorageKeyLen. enum KeyType { - FixSized, - VarSized, + Fixed, + Variable(u32), } /// Every error that can be returned to a contract when it calls any of the host functions. @@ -718,8 +718,8 @@ where return Err(Error::::ValueTooLarge.into()) } - let mut key = vec![0; key_len.try_into().map_err(|_| Error::::ValueTooLarge)?]; - self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; + ensure!(key_len <= ::MaxStorageKeyLen, Error::::DecodingFailed); + let key = self.read_sandbox_memory(key_ptr, key_len)? let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); let write_outcome = match key_type { From e195d5c3b06e125d37e2d18bc59b6bae0de81669 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 24 May 2022 16:48:18 +0300 Subject: [PATCH 09/63] fixes on feedback --- frame/contracts/src/exec.rs | 10 ++++++++++ frame/contracts/src/lib.rs | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 42f50dc6b71b4..4ca9c83ef4ce5 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -162,7 +162,12 @@ pub trait Ext: sealing::Sealed { /// was deleted. fn get_storage(&mut self, key: FixSizedKey) -> Option>; + /// This is a variation of `get_storage()` to be used with transparent hashing. + /// These two will be merged into a single function after some refactoring is done. + /// 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_storage_transparent(&mut self, key: VarSizedKey) -> Option>; /// Returns `Some(len)` (in bytes) if a storage item exists at `key`. @@ -171,7 +176,12 @@ pub trait Ext: sealing::Sealed { /// was deleted. fn get_storage_size(&mut self, key: FixSizedKey) -> Option; + /// This is a variation of `get_storage_size()` to be used with transparent hashing. + /// These two will be merged into a single function after some refactoring is done. + /// 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_storage_size_transparent(&mut self, key: VarSizedKey) -> Option; /// Sets the storage entry by the given key to the specified value. If `value` is `None` then diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index acbca979755dc..c29df34baa722 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -104,7 +104,7 @@ pub use crate::{ schedule::{HostFnWeights, InstructionWeights, Limits, Schedule}, }; use crate::{ - exec::{AccountIdOf, ExecError, Executable, Stack as ExecStack}, + exec::{AccountIdOf, ExecError, Executable, Stack as ExecStack, StorageHash}, gas::GasMeter, storage::{meter::Meter as StorageMeter, ContractInfo, DeletedContract, Storage}, wasm::{OwnerInfo, PrefabWasmModule}, @@ -129,8 +129,6 @@ use sp_core::{crypto::UncheckedFrom, Bytes}; use sp_runtime::traits::{Convert, Hash, Saturating, StaticLookup}; use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; -use crate::exec::StorageHash; - type CodeHash = ::Hash; type TrieId = BoundedVec>; type BalanceOf = From cb01583d21c81cb7f899f935b12d5aa234c96551 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 25 May 2022 16:18:05 +0300 Subject: [PATCH 10/63] fixes on feedback applied + make it build --- frame/contracts/src/exec.rs | 25 ++++++---- frame/contracts/src/lib.rs | 2 +- frame/contracts/src/storage.rs | 6 +-- frame/contracts/src/wasm/runtime.rs | 73 ++++++++++++++++------------- 4 files changed, 60 insertions(+), 46 deletions(-) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index e48ab2b3387f9..34dad4b90e662 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -24,7 +24,6 @@ use crate::{ use frame_support::{ crypto::ecdsa::ECDSAExt, dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable}, - pallet_prelude::ConstU32, storage::{with_transaction, TransactionOutcome}, traits::{Contains, Currency, ExistenceRequirement, OriginTrait, Randomness, Time}, weights::Weight, @@ -50,17 +49,23 @@ pub type TopicOf = ::Hash; pub type FixSizedKey = [u8; 32]; pub type VarSizedKey = BoundedVec::MaxStorageKeyLen>; -pub trait StorageHash { +pub trait StorageHash +where + T: Config, +{ fn hash(self) -> Vec; } -impl StorageHash for FixSizedKey { +impl StorageHash for FixSizedKey { fn hash(self) -> Vec { blake2_256(self.as_slice()).to_vec() } } -impl StorageHash for VarSizedKey { +impl StorageHash for VarSizedKey +where + T: Config, +{ fn hash(self) -> Vec { Blake2_128Concat::hash(self.as_slice()) } @@ -168,7 +173,7 @@ pub trait Ext: sealing::Sealed { /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option>; + fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option>; /// Returns `Some(len)` (in bytes) if a storage item exists at `key`. /// @@ -182,7 +187,7 @@ pub trait Ext: sealing::Sealed { /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option; + fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option; /// Sets the storage entry by the given key to the specified value. If `value` is `None` then /// the storage entry is deleted. @@ -196,7 +201,7 @@ pub trait Ext: sealing::Sealed { /// fn set_storage_transparent( &mut self, - key: VarSizedKey, + key: VarSizedKey, value: Option>, take_old: bool, ) -> Result; @@ -1133,7 +1138,7 @@ where Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) } - fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { + fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) } @@ -1141,7 +1146,7 @@ where Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) } - fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { + fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) } @@ -1163,7 +1168,7 @@ where fn set_storage_transparent( &mut self, - key: VarSizedKey, + key: VarSizedKey, value: Option>, take_old: bool, ) -> Result { diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 951eea803a279..c73d02fc9446d 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -932,7 +932,7 @@ where } /// Query storage of a specified contract under a specified key. - pub fn get_storage(address: T::AccountId, key: K) -> GetStorageResult { + pub fn get_storage>(address: T::AccountId, key: K) -> GetStorageResult { let contract_info = ContractInfoOf::::get(&address).ok_or(ContractAccessError::DoesntExist)?; diff --git a/frame/contracts/src/storage.rs b/frame/contracts/src/storage.rs index 73e214a16c399..c067611ef29b2 100644 --- a/frame/contracts/src/storage.rs +++ b/frame/contracts/src/storage.rs @@ -123,7 +123,7 @@ where /// /// The read is performed from the `trie_id` only. The `address` is not necessary. If the /// contract doesn't store under the given `key` `None` is returned. - pub fn read(trie_id: &TrieId, key: K) -> Option> { + pub fn read>(trie_id: &TrieId, key: K) -> Option> { child::get_raw(&child_trie_info(trie_id), key.hash().as_slice()) } @@ -131,7 +131,7 @@ where /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - pub fn size(trie_id: &TrieId, key: K) -> Option { + pub fn size>(trie_id: &TrieId, key: K) -> Option { child::len(&child_trie_info(trie_id), key.hash().as_slice()) } @@ -142,7 +142,7 @@ where /// /// This function also records how much storage was created or removed if a `storage_meter` /// is supplied. It should only be absent for testing or benchmarking code. - pub fn write( + pub fn write>( trie_id: &TrieId, key: K, new_value: Option>, diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index e918525ee1c34..c1a986aea74fa 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -27,7 +27,7 @@ use crate::{ use bitflags::bitflags; use codec::{Decode, DecodeAll, Encode, MaxEncodedLen}; -use frame_support::{dispatch::DispatchError, ensure, weights::Weight}; +use frame_support::{dispatch::DispatchError, ensure, traits::Get, weights::Weight}; use pallet_contracts_primitives::{ExecReturnValue, ReturnFlags}; use sp_core::{crypto::UncheckedFrom, Bytes}; use sp_io::hashing::{blake2_128, blake2_256, keccak_256, sha2_256}; @@ -41,7 +41,7 @@ use wasm_instrument::parity_wasm::elements::ValueType; /// VarSized is a key used for transparent hashing, which is a u8 vector maximum length of /// MaxStorageKeyLen. enum KeyType { - Fixed, + Fix, Variable(u32), } @@ -707,7 +707,6 @@ where &mut self, key_type: KeyType, key_ptr: u32, - key_len: u32, value_ptr: u32, value_len: u32, ) -> Result { @@ -717,19 +716,26 @@ where if value_len > max_size { return Err(Error::::ValueTooLarge.into()) } - - ensure!(key_len <= ::MaxStorageKeyLen, Error::::DecodingFailed); - let key = self.read_sandbox_memory(key_ptr, key_len)? - + let key_len = match key_type { + KeyType::Fix => 32u32, + KeyType::Variable(len) => { + ensure!( + len <= ::MaxStorageKeyLen::get(), + Error::::DecodingFailed + ); + len + }, + }; + let key = self.read_sandbox_memory(key_ptr, key_len)?; let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); let write_outcome = match key_type { - KeyType::FixSized => self.ext.set_storage( + KeyType::Fix => self.ext.set_storage( FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, value, false, )?, - KeyType::VarSized => self.ext.set_storage_transparent( - VarSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + KeyType::Variable(_) => self.ext.set_storage_transparent( + VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, value, false, )?, @@ -742,25 +748,27 @@ where Ok(write_outcome.old_len_with_sentinel()) } - fn clear_storage( - &mut self, - key_type: KeyType, - key_ptr: u32, - key_len: u32, - ) -> Result { + fn clear_storage(&mut self, key_type: KeyType, key_ptr: u32) -> Result { let charged = self.charge_gas(RuntimeCosts::ClearStorage(self.ext.max_value_size()))?; - - let mut key = vec![0; key_len.try_into().map_err(|_| Error::::ValueTooLarge)?]; - self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - + let key_len = match key_type { + KeyType::Fix => 32u32, + KeyType::Variable(len) => { + ensure!( + len <= ::MaxStorageKeyLen::get(), + Error::::DecodingFailed + ); + len + }, + }; + let key = self.read_sandbox_memory(key_ptr, key_len)?; let outcome = match key_type { - KeyType::FixSized => self.ext.set_storage( + KeyType::Fix => self.ext.set_storage( FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, None, false, )?, - KeyType::VarSized => self.ext.set_storage_transparent( - VarSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + KeyType::Variable(_) => self.ext.set_storage_transparent( + VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, None, false, )?, @@ -908,7 +916,7 @@ define_env!(Env, , // Equivalent to the newer version of `seal_set_storage` with the exception of the return // type. Still a valid thing to call when not interested in the return value. [seal0] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) => { - ctx.set_storage(KeyType::FixSized, key_ptr, 32u32, value_ptr, value_len).map(|_| ()) + ctx.set_storage(KeyType::Fix, key_ptr, value_ptr, value_len).map(|_| ()) }, // Set the value at the given key in the contract storage. @@ -927,7 +935,7 @@ define_env!(Env, , // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. [seal1] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) -> u32 => { - ctx.set_storage(KeyType::FixSized, key_ptr, 32u32, value_ptr, value_len) + ctx.set_storage(KeyType::Fix, key_ptr, value_ptr, value_len) }, // Clear the value at the given key in the contract storage. @@ -935,21 +943,22 @@ define_env!(Env, , // Equivalent to the newer version of `seal_clear_storage` with the exception of the return // type. Still a valid thing to call when not interested in the return value. [seal0] seal_clear_storage(ctx, key_ptr: u32) => { - ctx.clear_storage(KeyType::FixSized, key_ptr, 32u32).map(|_| ()).map_err(Into::into) + ctx.clear_storage(KeyType::Fix, key_ptr).map(|_| ()).map_err(Into::into) }, // Clear the value at the given key in the contract storage. // // # Parameters // - // - `key_ptr`: pointer into the linear memory where the location to clear the value is placed. + // - `key_ptr`: pointer into the linear memory where the key is placed. + // - `key_len`: the length of the key in bytes. // // # Return Value // // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. - [__unstable__] seal_clear_storage(ctx, key_ptr: u32) -> u32 => { - ctx.clear_storage(KeyType::FixSized, key_ptr, 32u32).map_err(Into::into) + [__unstable__] seal_clear_storage(ctx, key_ptr: u32, key_len: u32) -> u32 => { + ctx.clear_storage(KeyType::Variable(key_len), key_ptr).map_err(Into::into) }, // Retrieve the value under the given key from storage. @@ -1006,6 +1015,7 @@ define_env!(Env, , // # Parameters // // - `key_ptr`: pointer into the linear memory where the key of the requested value is placed. + // - `key_len`: the length of the key in bytes. // - `out_ptr`: pointer to the linear memory where the value is written to. // - `out_len_ptr`: in-out pointer into linear memory where the buffer length // is read from and the value length is written to. @@ -1013,10 +1023,9 @@ define_env!(Env, , // # Errors // // `ReturnCode::KeyNotFound` - [__unstable__] seal_take_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { + [__unstable__] seal_take_storage(ctx, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; - let mut key = FixSizedKey::default(); - ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; + let key = ctx.read_sandbox_memory(key_ptr, key_len)?; if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage(key, None, true)? { ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; From 75fadc87a5c18efa41418732eaea51b16675c6e6 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 25 May 2022 16:30:10 +0300 Subject: [PATCH 11/63] benchmarks build but fail (old) --- frame/contracts/src/wasm/mod.rs | 6 +++--- frame/contracts/src/wasm/runtime.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 6e0e4c1a7e39f..6712f39f3e38b 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -429,13 +429,13 @@ mod tests { fn get_storage(&mut self, key: FixSizedKey) -> Option> { self.storage.get(&key.to_vec()).cloned() } - fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { + fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { self.storage.get(&key.to_vec()).cloned() } fn get_storage_size(&mut self, key: FixSizedKey) -> Option { self.storage.get(&key.to_vec()).map(|val| val.len() as u32) } - fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { + fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { self.storage.get(&key.to_vec()).map(|val| val.len() as u32) } fn set_storage( @@ -458,7 +458,7 @@ mod tests { } fn set_storage_transparent( &mut self, - key: VarSizedKey, + key: VarSizedKey, value: Option>, take_old: bool, ) -> Result { diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index c1a986aea74fa..f3f3650cd0b07 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -1026,7 +1026,7 @@ define_env!(Env, , [__unstable__] seal_take_storage(ctx, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; let key = ctx.read_sandbox_memory(key_ptr, key_len)?; - if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage(key, None, true)? { + if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage_transparent(VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, None, true)? { ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; Ok(ReturnCode::Success) From 7a8ea0f754ef0cb3a154847053bd1593199a04ad Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 25 May 2022 20:39:13 +0300 Subject: [PATCH 12/63] "Original code too large" --- frame/contracts/src/benchmarking/mod.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index c6b921ab52915..b9516062c722b 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -1045,31 +1045,37 @@ benchmarks! { // Similar to seal_set_storage. However, we store all the keys that we are about to // delete beforehand in order to prevent any optimizations that could occur when - // deleting a non existing key. + // deleting a non existing key. We generate keys of a maximum length. #[skip_meta] seal_clear_storage { let r in 0 .. API_BENCHMARK_BATCHES; + let max_key_len = T::MaxStorageKeyLen::get(); let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { module: "__unstable__", name: "seal_clear_storage", - params: vec![ValueType::I32], + params: vec![ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), From 4d548c8ead159cd55f047056524bdffe7e24df10 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 25 May 2022 20:48:37 +0300 Subject: [PATCH 13/63] seal_clear_storage bench fixed (code size workaround hack removal tbd) --- frame/contracts/src/benchmarking/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index b9516062c722b..20042c06bbb69 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -30,7 +30,7 @@ use self::{ sandbox::Sandbox, }; use crate::{ - exec::{AccountIdOf, FixSizedKey}, + exec::{AccountIdOf, FixSizedKey, VarSizedKey}, schedule::{API_BENCHMARK_BATCH_SIZE, INSTR_BENCHMARK_BATCH_SIZE}, storage::Storage, wasm::CallFlags, @@ -1050,7 +1050,7 @@ benchmarks! { seal_clear_storage { let r in 0 .. API_BENCHMARK_BATCHES; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) + let keys = (0 .. r * 10) // TODO: GOTTA calc new value here to keep Original Code inside boundary size .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1086,7 +1086,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, From ed3539c17e32bd387ca9b5fcddb7de1f12e8449a Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Fri, 27 May 2022 16:44:11 +0300 Subject: [PATCH 14/63] bench_seal_clear_storage pass --- frame/contracts/src/benchmarking/mod.rs | 27 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 20042c06bbb69..5224fbcb982ff 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -1045,14 +1045,15 @@ benchmarks! { // Similar to seal_set_storage. However, we store all the keys that we are about to // delete beforehand in order to prevent any optimizations that could occur when - // deleting a non existing key. We generate keys of a maximum length. + // deleting a non existing key. We generate keys of a maximum length, and have to + // reduce batch size in order to make resulting contract code size less than MaxCodeLen. #[skip_meta] seal_clear_storage { let r in 0 .. API_BENCHMARK_BATCHES; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. r * 10) // TODO: GOTTA calc new value here to keep Original Code inside boundary size + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); - h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let code = WasmModule::::from(ModuleDefinition { @@ -1100,27 +1101,33 @@ benchmarks! { #[skip_meta] seal_clear_storage_per_kb { let n in 0 .. T::Schedule::get().limits.payload_len / 1024; - let keys = (0 .. API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { module: "__unstable__", name: "seal_clear_storage", - params: vec![ValueType::I32], + params: vec![ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1131,7 +1138,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, From 86b9275b0ae605242a786d28cd38133c2d1ee387 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Fri, 27 May 2022 17:00:58 +0300 Subject: [PATCH 15/63] bench_seal_take_storage ... ok --- frame/contracts/src/benchmarking/mod.rs | 52 +++++++++++++++---------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 5224fbcb982ff..1c429da2057e2 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -1348,10 +1348,11 @@ benchmarks! { #[skip_meta] seal_take_storage { let r in 0 .. API_BENCHMARK_BATCHES; - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let key_bytes_len = key_bytes.len(); let code = WasmModule::::from(ModuleDefinition { @@ -1359,23 +1360,28 @@ benchmarks! { imported_functions: vec![ImportedFunction { module: "__unstable__", name: "seal_take_storage", - params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, DataSegment { - offset: key_bytes_len as u32, + offset: 32 + key_bytes_len as u32, value: T::Schedule::get().limits.payload_len.to_le_bytes().into(), }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr - Regular(Instruction::I32Const((key_bytes_len + 4) as i32)), // out_ptr - Regular(Instruction::I32Const(key_bytes_len as i32)), // out_len_ptr + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len + Regular(Instruction::I32Const((32 + key_bytes_len + 4) as i32)), // out_ptr + Regular(Instruction::I32Const(32 + key_bytes_len as i32)), // out_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1386,7 +1392,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1400,10 +1406,11 @@ benchmarks! { #[skip_meta] seal_take_storage_per_kb { let n in 0 .. T::Schedule::get().limits.payload_len / 1024; - let keys = (0 .. API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let key_bytes_len = key_bytes.len(); let code = WasmModule::::from(ModuleDefinition { @@ -1411,23 +1418,28 @@ benchmarks! { imported_functions: vec![ImportedFunction { module: "__unstable__", name: "seal_take_storage", - params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, DataSegment { - offset: key_bytes_len as u32, + offset: 32 + key_bytes_len as u32, value: T::Schedule::get().limits.payload_len.to_le_bytes().into(), }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr - Regular(Instruction::I32Const((key_bytes_len + 4) as i32)), // out_ptr - Regular(Instruction::I32Const(key_bytes_len as i32)), // out_len_ptr + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len + Regular(Instruction::I32Const((32 + key_bytes_len + 4) as i32)), // out_ptr + Regular(Instruction::I32Const(32 + key_bytes_len as i32)), // out_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1438,7 +1450,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, From a0ffe4b1b9230da77ff1e6bc59848ce21aed5f8d Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Fri, 27 May 2022 18:48:08 +0300 Subject: [PATCH 16/63] added new seal_set_storage + updated benchmarks --- frame/contracts/src/benchmarking/mod.rs | 84 +++++++++++++++---------- frame/contracts/src/wasm/runtime.rs | 15 +++-- 2 files changed, 63 insertions(+), 36 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 1c429da2057e2..5e9e35ab09f87 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -902,35 +902,43 @@ benchmarks! { }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) // Only the overhead of calling the function itself with minimal arguments. - // The contract is a bit more complex because I needs to use different keys in order + // The contract is a bit more complex because it needs to use different keys in order // to generate unique storage accesses. However, it is still dominated by the storage - // accesses. + // accesses. We store all the keys that we are about to write at beforehand + // because re-writing at an existing key is always more expensive than writing + // it at a virgin key. #[skip_meta] seal_set_storage { let r in 0 .. API_BENCHMARK_BATCHES; - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal1", + module: "__unstable__", name: "seal_set_storage", - params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // value_ptr - Regular(Instruction::I32Const(0)), // value_len + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len + Regular(Instruction::I32Const(32)), // value_ptr + Regular(Instruction::I32Const(32)), // value_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -941,7 +949,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -954,28 +962,34 @@ benchmarks! { #[skip_meta] seal_set_storage_per_new_kb { let n in 0 .. T::Schedule::get().limits.payload_len / 1024; - let keys = (0 .. API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal1", + module: "__unstable__", name: "seal_set_storage", - params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // value_ptr + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len + Regular(Instruction::I32Const(32)), // value_ptr Regular(Instruction::I32Const((n * 1024) as i32)), // value_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), @@ -987,7 +1001,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1000,29 +1014,35 @@ benchmarks! { #[skip_meta] seal_set_storage_per_old_kb { let n in 0 .. T::Schedule::get().limits.payload_len / 1024; - let keys = (0 .. API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal1", + module: "__unstable__", name: "seal_set_storage", - params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // value_ptr - Regular(Instruction::I32Const(0)), // value_len + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len + Regular(Instruction::I32Const(32)), // value_ptr + Regular(Instruction::I32Const(32)), // value_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1033,7 +1053,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1043,7 +1063,7 @@ benchmarks! { let origin = RawOrigin::Signed(instance.caller.clone()); }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) - // Similar to seal_set_storage. However, we store all the keys that we are about to + // Similar to seal_set_storage. We store all the keys that we are about to // delete beforehand in order to prevent any optimizations that could occur when // deleting a non existing key. We generate keys of a maximum length, and have to // reduce batch size in order to make resulting contract code size less than MaxCodeLen. diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index f3f3650cd0b07..4abeb4da43f2b 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -36,12 +36,12 @@ use sp_sandbox::SandboxMemory; use sp_std::prelude::*; use wasm_instrument::parity_wasm::elements::ValueType; -/// Type of storage key. -/// FixSized is old fashioned [0;32]. -/// VarSized is a key used for transparent hashing, which is a u8 vector maximum length of -/// MaxStorageKeyLen. +/// Type of a storage key. enum KeyType { + /// Deprecated fix sized key [0;32]. Fix, + /// Variable sized key used in transparent hashing, + /// cannot be larger than MaxStorageKeyLen. Variable(u32), } @@ -938,6 +938,13 @@ define_env!(Env, , ctx.set_storage(KeyType::Fix, key_ptr, value_ptr, value_len) }, + // Set the value at the given key in the contract storage. + // + // Equivalent to `[seal1] seal_set_storage` to be used with transparent hashing. + [__unstable__] seal_set_storage(ctx, key_ptr: u32, key_len: u32, value_ptr: u32, value_len: u32) -> u32 => { + ctx.set_storage(KeyType::Variable(key_len), key_ptr, value_ptr, value_len).map_err(Into::into) + }, + // Clear the value at the given key in the contract storage. // // Equivalent to the newer version of `seal_clear_storage` with the exception of the return From 01db020d360296aea72cc6e7b0fe1b103fd81c2f Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Fri, 27 May 2022 19:14:53 +0300 Subject: [PATCH 17/63] added new seal_get_storage + updated benchmarks --- frame/contracts/src/benchmarking/mod.rs | 56 +++++++++++++++---------- frame/contracts/src/wasm/runtime.rs | 52 ++++++++++++++++++++++- 2 files changed, 85 insertions(+), 23 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 5e9e35ab09f87..4956bb452bb2e 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -1172,34 +1172,40 @@ benchmarks! { #[skip_meta] seal_get_storage { let r in 0 .. API_BENCHMARK_BATCHES; - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let key_bytes_len = key_bytes.len(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", + module: "__unstable__", name: "seal_get_storage", - params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, DataSegment { - offset: key_bytes_len as u32, + offset: 32 + key_bytes_len as u32, value: T::Schedule::get().limits.payload_len.to_le_bytes().into(), }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr - Regular(Instruction::I32Const((key_bytes_len + 4) as i32)), // out_ptr - Regular(Instruction::I32Const(key_bytes_len as i32)), // out_len_ptr + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len + Regular(Instruction::I32Const((32 + key_bytes_len + 4) as i32)), // out_ptr + Regular(Instruction::I32Const(32 + key_bytes_len as i32)), // out_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1210,7 +1216,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1224,34 +1230,40 @@ benchmarks! { #[skip_meta] seal_get_storage_per_kb { let n in 0 .. T::Schedule::get().limits.payload_len / 1024; - let keys = (0 .. API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let key_bytes_len = key_bytes.len(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", + module: "__unstable__", name: "seal_get_storage", - params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, DataSegment { - offset: key_bytes_len as u32, + offset: 32 + key_bytes_len as u32, value: T::Schedule::get().limits.payload_len.to_le_bytes().into(), }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr - Regular(Instruction::I32Const((key_bytes_len + 4) as i32)), // out_ptr - Regular(Instruction::I32Const(key_bytes_len as i32)), // out_len_ptr + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len + Regular(Instruction::I32Const((32 + key_bytes_len + 4) as i32)), // out_ptr + Regular(Instruction::I32Const(32 + key_bytes_len as i32)), // out_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1262,7 +1274,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 4abeb4da43f2b..1c5e7ad48d8cb 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -921,6 +921,9 @@ define_env!(Env, , // Set the value at the given key in the contract storage. // + // This version is to be used with a fixed sized storage key. For runtimes supporting transparent + // hashing, please use the newer version of this function. + // // The value length must not exceed the maximum defined by the contracts module parameters. // Specifying a `value_len` of zero will store an empty value. // @@ -940,7 +943,20 @@ define_env!(Env, , // Set the value at the given key in the contract storage. // - // Equivalent to `[seal1] seal_set_storage` to be used with transparent hashing. + // The key and value lengths must not exceed the maximums defined by the contracts module parameters. + // Specifying a `value_len` of zero will store an empty value. + // + // # Parameters + // + // - `key_ptr`: pointer into the linear memory where the location to store the value is placed. + // - `key_len`: the length of the key in bytes. + // - `value_ptr`: pointer into the linear memory where the value to set is placed. + // - `value_len`: the length of the value in bytes. + // + // # Return Value + // + // Returns the size of the pre-existing value at the specified key if any. Otherwise + // `SENTINEL` is returned as a sentinel value. [__unstable__] seal_set_storage(ctx, key_ptr: u32, key_len: u32, value_ptr: u32, value_len: u32) -> u32 => { ctx.set_storage(KeyType::Variable(key_len), key_ptr, value_ptr, value_len).map_err(Into::into) }, @@ -970,6 +986,9 @@ define_env!(Env, , // Retrieve the value under the given key from storage. // + // This version is to be used with a fixed sized storage key. For runtimes supporting transparent + // hashing, please use the newer version of this function. + // // # Parameters // // - `key_ptr`: pointer into the linear memory where the key of the requested value is placed. @@ -994,6 +1013,37 @@ define_env!(Env, , } }, + // Retrieve the value under the given key from storage. + // + // This version is to be used with a fixed sized storage key. For runtimes supporting transparent + // hashing, please use the newer version of this function. + // + // The key length must not exceed the maximum defined by the contracts module parameter. + // + // # Parameters + // + // - `key_ptr`: pointer into the linear memory where the key of the requested value is placed. + // - `key_len`: the length of the key in bytes. + // - `out_ptr`: pointer to the linear memory where the value is written to. + // - `out_len_ptr`: in-out pointer into linear memory where the buffer length + // is read from and the value length is written to. + // + // # Errors + // + // `ReturnCode::KeyNotFound` + [__unstable__] seal_get_storage(ctx, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { + let charged = ctx.charge_gas(RuntimeCosts::GetStorage(ctx.ext.max_value_size()))?; + let key = ctx.read_sandbox_memory(key_ptr, key_len)?; + if let Some(value) = ctx.ext.get_storage_transparent(VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?) { + ctx.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); + ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; + Ok(ReturnCode::Success) + } else { + ctx.adjust_gas(charged, RuntimeCosts::GetStorage(0)); + Ok(ReturnCode::KeyNotFound) + } + }, + // Checks whether there is a value stored under the given key. // // # Parameters From 67ee7542218999ed00982202fbfb0232e6d2b867 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Fri, 27 May 2022 19:24:55 +0300 Subject: [PATCH 18/63] added new seal_contains_storage + updated benchmarks --- frame/contracts/src/benchmarking/mod.rs | 44 ++++++++++++++++--------- frame/contracts/src/wasm/runtime.rs | 28 ++++++++++++++++ 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 4956bb452bb2e..5ee3b77e43a2f 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -1289,28 +1289,34 @@ benchmarks! { #[skip_meta] seal_contains_storage { let r in 0 .. API_BENCHMARK_BATCHES; - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let key_bytes_len = key_bytes.len(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", + module: "__unstable__", name: "seal_contains_storage", - params: vec![ValueType::I32], + params: vec![ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1321,7 +1327,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1335,27 +1341,33 @@ benchmarks! { #[skip_meta] seal_contains_storage_per_kb { let n in 0 .. T::Schedule::get().limits.payload_len / 1024; - let keys = (0 .. API_BENCHMARK_BATCH_SIZE) - .map(|n| T::Hashing::hash_of(&n).as_ref().to_vec()) - .collect::>(); - let key_len = keys.get(0).map(|i| i.len() as u32).unwrap_or(0); + let max_key_len = T::MaxStorageKeyLen::get(); + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); + h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) + .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", + module: "__unstable__", name: "seal_contains_storage", - params: vec![ValueType::I32], + params: vec![ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { offset: 0, + value: max_key_len.to_le_bytes().to_vec(), + }, + DataSegment { + offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(0, key_len as u32), // key_ptr + Counter(32, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(0)), // key_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1366,7 +1378,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - FixSizedKey::try_from(key).map_err(|e| "Key has wrong length")?, + VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 1c5e7ad48d8cb..e172a712d6dbb 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -1046,6 +1046,9 @@ define_env!(Env, , // Checks whether there is a value stored under the given key. // + // This version is to be used with a fixed sized storage key. For runtimes supporting transparent + // hashing, please use the newer version of this function. + // // # Parameters // // - `key_ptr`: pointer into the linear memory where the key of the requested value is placed. @@ -1067,6 +1070,31 @@ define_env!(Env, , } }, + // Checks whether there is a value stored under the given key. + // + // The key length must not exceed the maximum defined by the contracts module parameter. + // + // # Parameters + // + // - `key_ptr`: pointer into the linear memory where the key of the requested value is placed. + // - `key_len`: the length of the key in bytes. + // + // # Return Value + // + // Returns the size of the pre-existing value at the specified key if any. Otherwise + // `SENTINEL` is returned as a sentinel value. + [__unstable__] seal_contains_storage(ctx, key_ptr: u32, key_len: u32) -> u32 => { + let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?; + let key = ctx.read_sandbox_memory(key_ptr, key_len)?; + if let Some(len) = ctx.ext.get_storage_size_transparent(VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?) { + ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); + Ok(len) + } else { + ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(0)); + Ok(SENTINEL) + } + }, + // Retrieve and remove the value under the given key from storage. // // # Parameters From 25f4e8594ed4672adfb77bd5b508798f388d58bf Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Fri, 27 May 2022 20:08:59 +0300 Subject: [PATCH 19/63] added tests for _transparent exec functions --- frame/contracts/src/exec.rs | 284 ++++++++++++++++++++++++++++ frame/contracts/src/wasm/runtime.rs | 1 + 2 files changed, 285 insertions(+) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 34dad4b90e662..454a40c90b4c1 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -2763,6 +2763,167 @@ mod tests { }); } + #[test] + fn set_storage_transparent_works() { + let code_hash = MockLoader::insert(Call, |ctx, _| { + // Write + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([1; 64].to_vec()).unwrap(), + Some(vec![1, 2, 3]), + false + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([2; 19].to_vec()).unwrap(), + Some(vec![4, 5, 6]), + true + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([3; 19].to_vec()).unwrap(), + None, + false + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([4; 64].to_vec()).unwrap(), + None, + true + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([5; 30].to_vec()).unwrap(), + Some(vec![]), + false + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([6; 128].to_vec()).unwrap(), + Some(vec![]), + true + ), + Ok(WriteOutcome::New) + ); + + // Overwrite + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([1; 64].to_vec()).unwrap(), + Some(vec![42, 43, 44]), + false + ), + Ok(WriteOutcome::Overwritten(3)) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([2; 19].to_vec()).unwrap(), + Some(vec![48]), + true + ), + Ok(WriteOutcome::Taken(vec![4, 5, 6])) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([3; 19].to_vec()).unwrap(), + None, + false + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([4; 64].to_vec()).unwrap(), + None, + true + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([5; 30].to_vec()).unwrap(), + Some(vec![]), + false + ), + Ok(WriteOutcome::Overwritten(0)) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([6; 128].to_vec()).unwrap(), + Some(vec![]), + true + ), + Ok(WriteOutcome::Taken(vec![])) + ); + + exec_success() + }); + + ExtBuilder::default().build().execute_with(|| { + let min_balance = ::Currency::minimum_balance(); + let schedule = ::Schedule::get(); + let mut gas_meter = GasMeter::::new(GAS_LIMIT); + set_balance(&ALICE, min_balance * 1000); + place_contract(&BOB, code_hash); + let mut storage_meter = storage::meter::Meter::new(&ALICE, None, 0).unwrap(); + assert_ok!(MockStack::run_call( + ALICE, + BOB, + &mut gas_meter, + &mut storage_meter, + &schedule, + 0, + vec![], + None, + )); + }); + } + + #[test] + fn get_storage_works() { + let code_hash = MockLoader::insert(Call, |ctx, _| { + assert_eq!( + ctx.ext.set_storage([1; 32], Some(vec![1, 2, 3]), false), + Ok(WriteOutcome::New) + ); + assert_eq!(ctx.ext.set_storage([2; 32], Some(vec![]), false), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.get_storage([1; 32]), Some(vec![1, 2, 3])); + assert_eq!(ctx.ext.get_storage([2; 32]), Some(vec![])); + assert_eq!(ctx.ext.get_storage([3; 32]), None); + + exec_success() + }); + + ExtBuilder::default().build().execute_with(|| { + let min_balance = ::Currency::minimum_balance(); + let schedule = ::Schedule::get(); + let mut gas_meter = GasMeter::::new(GAS_LIMIT); + set_balance(&ALICE, min_balance * 1000); + place_contract(&BOB, code_hash); + let mut storage_meter = storage::meter::Meter::new(&ALICE, None, 0).unwrap(); + assert_ok!(MockStack::run_call( + ALICE, + BOB, + &mut gas_meter, + &mut storage_meter, + &schedule, + 0, + vec![], + None, + )); + }); + } + #[test] fn get_storage_size_works() { let code_hash = MockLoader::insert(Call, |ctx, _| { @@ -2797,6 +2958,129 @@ mod tests { )); }); } + + #[test] + fn get_storage_transparent_works() { + let code_hash = MockLoader::insert(Call, |ctx, _| { + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([1; 19].to_vec()).unwrap(), + Some(vec![1, 2, 3]), + false + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([2; 16].to_vec()).unwrap(), + Some(vec![]), + false + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.get_storage_transparent( + VarSizedKey::::try_from([1; 19].to_vec()).unwrap() + ), + Some(vec![1, 2, 3]) + ); + assert_eq!( + ctx.ext.get_storage_transparent( + VarSizedKey::::try_from([2; 16].to_vec()).unwrap() + ), + Some(vec![]) + ); + assert_eq!( + ctx.ext.get_storage_transparent( + VarSizedKey::::try_from([3; 8].to_vec()).unwrap() + ), + None + ); + + exec_success() + }); + + ExtBuilder::default().build().execute_with(|| { + let min_balance = ::Currency::minimum_balance(); + let schedule = ::Schedule::get(); + let mut gas_meter = GasMeter::::new(GAS_LIMIT); + set_balance(&ALICE, min_balance * 1000); + place_contract(&BOB, code_hash); + let mut storage_meter = storage::meter::Meter::new(&ALICE, None, 0).unwrap(); + assert_ok!(MockStack::run_call( + ALICE, + BOB, + &mut gas_meter, + &mut storage_meter, + &schedule, + 0, + vec![], + None, + )); + }); + } + + #[test] + fn get_storage_size_transparent_works() { + let code_hash = MockLoader::insert(Call, |ctx, _| { + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([1; 19].to_vec()).unwrap(), + Some(vec![1, 2, 3]), + false + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.set_storage_transparent( + VarSizedKey::::try_from([2; 16].to_vec()).unwrap(), + Some(vec![]), + false + ), + Ok(WriteOutcome::New) + ); + assert_eq!( + ctx.ext.get_storage_size_transparent( + VarSizedKey::::try_from([1; 19].to_vec()).unwrap() + ), + Some(3) + ); + assert_eq!( + ctx.ext.get_storage_size_transparent( + VarSizedKey::::try_from([2; 16].to_vec()).unwrap() + ), + Some(0) + ); + assert_eq!( + ctx.ext.get_storage_size_transparent( + VarSizedKey::::try_from([3; 8].to_vec()).unwrap() + ), + None + ); + + exec_success() + }); + + ExtBuilder::default().build().execute_with(|| { + let min_balance = ::Currency::minimum_balance(); + let schedule = ::Schedule::get(); + let mut gas_meter = GasMeter::::new(GAS_LIMIT); + set_balance(&ALICE, min_balance * 1000); + place_contract(&BOB, code_hash); + let mut storage_meter = storage::meter::Meter::new(&ALICE, None, 0).unwrap(); + assert_ok!(MockStack::run_call( + ALICE, + BOB, + &mut gas_meter, + &mut storage_meter, + &schedule, + 0, + vec![], + None, + )); + }); + } + #[test] fn ecdsa_to_eth_address_returns_proper_value() { let bob_ch = MockLoader::insert(Call, |ctx, _| { diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index e172a712d6dbb..5044d61dfa171 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -37,6 +37,7 @@ use sp_std::prelude::*; use wasm_instrument::parity_wasm::elements::ValueType; /// Type of a storage key. +#[allow(dead_code)] enum KeyType { /// Deprecated fix sized key [0;32]. Fix, From 970f8b7c54f33e5a5a999dd294bfa1c2cb0bd5f4 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Mon, 30 May 2022 22:15:22 +0300 Subject: [PATCH 20/63] wasm test for clear_storage --- frame/contracts/src/wasm/mod.rs | 64 +++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 6712f39f3e38b..c6dd603cf7844 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -869,7 +869,7 @@ mod tests { (import "seal0" "seal_contains_storage" (func $seal_contains_storage (param i32) (result i32))) (import "env" "memory" (memory 1 1)) - ;; [0, 4) size of input buffer (32 byte as we copy the key here) + ;; [0, 4) size of input buffer (32 bits as we copy the key here) (data (i32.const 0) "\20") ;; [4, 36) input buffer @@ -2269,23 +2269,26 @@ mod tests { (module (import "seal0" "seal_input" (func $seal_input (param i32 i32))) (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) - (import "__unstable__" "seal_clear_storage" (func $seal_clear_storage (param i32) (result i32))) + (import "__unstable__" "seal_clear_storage" (func $seal_clear_storage (param i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) - ;; 0x1000 = 4k in little endian ;; size of input buffer - (data (i32.const 0) "\00\10") + ;; [0, 4) size of input buffer (128+32 = 160 bits = 0xA0) + (data (i32.const 0) "\A0") + + ;; [4, 160) input buffer (func (export "call") ;; Receive key (call $seal_input - (i32.const 4) ;; Pointer to the input buffer - (i32.const 0) ;; Size of the length buffer + (i32.const 4) ;; Where we take input and store it + (i32.const 0) ;; Where we take and store the length of the taken data ) - ;; Store the passed value to the passed key and store result to memory + ;; Call seal_clear_storage and save what it returns at 0 (i32.store (i32.const 0) (call $seal_clear_storage - (i32.const 4) ;; key_ptr + (i32.const 8) ;; key_ptr + (i32.load (i32.const 4)) ;; key_len ) ) (call $seal_return @@ -2301,23 +2304,48 @@ mod tests { let mut ext = MockExt::default(); - ext.storage.insert([1u8; 32].to_vec(), vec![42u8]); - ext.storage.insert([2u8; 32].to_vec(), vec![]); + ext.set_storage_transparent( + VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), + Some(vec![42u8]), + false, + ) + .unwrap(); + ext.set_storage_transparent( + VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), + Some(vec![]), + false, + ) + .unwrap(); - // value does not exist -> sentinel returned - let result = execute(CODE, [3u8; 32].encode(), &mut ext).unwrap(); + // 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.0.try_into().unwrap()), crate::SENTINEL); assert_eq!(ext.storage.get(&[3u8; 32].to_vec()), None); - // value did exist -> length returned - let result = execute(CODE, [1u8; 32].encode(), &mut ext).unwrap(); + // 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.0.try_into().unwrap()), 1); - assert_eq!(ext.storage.get(&[1u8; 32].to_vec()), None); + // value cleared + assert_eq!(ext.storage.get(&[1u8; 64].to_vec()), None); - // value did exist -> length returned (test for 0 sized) - let result = execute(CODE, [2u8; 32].encode(), &mut ext).unwrap(); + //value did not exist (wrong key length) + let input = (63, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + // sentinel returned + assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), crate::SENTINEL); + assert_eq!(ext.storage.get(&[1u8; 64].to_vec()), None); + + // value exists + let input = (19, [2u8; 19]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + // length returned (test for 0 sized) assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 0); - assert_eq!(ext.storage.get(&[2u8; 32].to_vec()), None); + // value cleared + assert_eq!(ext.storage.get(&[2u8; 19].to_vec()), None); } #[test] From 840488ad5c266bf86b0c17a9ce4ada422e662c77 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Mon, 30 May 2022 23:19:10 +0300 Subject: [PATCH 21/63] wasm test for take_storage --- frame/contracts/src/wasm/mod.rs | 61 ++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index c6dd603cf7844..a413bdc8da2d1 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -2276,7 +2276,7 @@ mod tests { ;; [0, 4) size of input buffer (128+32 = 160 bits = 0xA0) (data (i32.const 0) "\A0") - ;; [4, 160) input buffer + ;; [4, 164) input buffer (func (export "call") ;; Receive key @@ -2355,42 +2355,43 @@ mod tests { (module (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) (import "seal0" "seal_input" (func $seal_input (param i32 i32))) - (import "__unstable__" "seal_take_storage" (func $seal_take_storage (param i32 i32 i32) (result i32))) + (import "__unstable__" "seal_take_storage" (func $seal_take_storage (param i32 i32 i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) - ;; [0, 32) size of input buffer (32 byte as we copy the key here) - (data (i32.const 0) "\20") + ;; [0, 4) size of input buffer (160 Bits as we copy the key+len here) + (data (i32.const 0) "\A0") - ;; [32, 64) size of output buffer + ;; [4, 8) size of output buffer ;; 4k in little endian - (data (i32.const 32) "\00\10") + (data (i32.const 4) "\00\10") - ;; [64, 96) input buffer + ;; [8, 168) input buffer - ;; [96, inf) output buffer + ;; [168, 4264) output buffer (func (export "call") ;; Receive key (call $seal_input - (i32.const 64) ;; Pointer to the input buffer + (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 96) + (i32.store (i32.const 168) (call $seal_take_storage - (i32.const 64) ;; The pointer to the storage key to fetch - (i32.const 100) ;; Pointer to the output buffer - (i32.const 32) ;; Pointer to the size of the buffer + (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 96) ;; output buffer ptr - (i32.add ;; length: storage size + 4 (retval) - (i32.load (i32.const 32)) + (i32.const 168) ;; output buffer ptr + (i32.add ;; length: storage size + 4 (retval) + (i32.load (i32.const 4)) (i32.const 4) ) ) @@ -2402,32 +2403,46 @@ mod tests { let mut ext = MockExt::default(); - ext.storage.insert([1u8; 32].to_vec(), vec![42u8]); - ext.storage.insert([2u8; 32].to_vec(), vec![]); + ext.set_storage_transparent( + VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), + Some(vec![42u8]), + false, + ) + .unwrap(); + + ext.set_storage_transparent( + VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), + Some(vec![]), + false, + ) + .unwrap(); // value does not exist -> error returned - let result = execute(CODE, [3u8; 32].encode(), &mut ext).unwrap(); + let input = (63, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); assert_eq!( u32::from_le_bytes(result.data.0[0..4].try_into().unwrap()), ReturnCode::KeyNotFound as u32 ); // value did exist -> value returned - let result = execute(CODE, [1u8; 32].encode(), &mut ext).unwrap(); + let input = (64, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); assert_eq!( u32::from_le_bytes(result.data.0[0..4].try_into().unwrap()), ReturnCode::Success as u32 ); - assert_eq!(ext.storage.get(&[1u8; 32].to_vec()), None); + assert_eq!(ext.storage.get(&[1u8; 64].to_vec()), None); assert_eq!(&result.data.0[4..], &[42u8]); // value did exist -> length returned (test for 0 sized) - let result = execute(CODE, [2u8; 32].encode(), &mut ext).unwrap(); + let input = (19, [2u8; 19]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); assert_eq!( u32::from_le_bytes(result.data.0[0..4].try_into().unwrap()), ReturnCode::Success as u32 ); - assert_eq!(ext.storage.get(&[2u8; 32].to_vec()), None); + assert_eq!(ext.storage.get(&[2u8; 19].to_vec()), None); assert_eq!(&result.data.0[4..], &[0u8; 0]); } From d1068d81f83b2da1d70b3c95099ec3ae10683c79 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 31 May 2022 00:01:12 +0300 Subject: [PATCH 22/63] wasm test for new set_storage --- frame/contracts/src/wasm/mod.rs | 79 +++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 4 deletions(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index a413bdc8da2d1..65ca1d52b96ba 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -2201,6 +2201,7 @@ mod tests { } #[test] + #[cfg(not(feature = "unstable-interface"))] fn set_storage_works() { const CODE: &str = r#" (module @@ -2224,7 +2225,7 @@ mod tests { (call $seal_set_storage (i32.const 4) ;; key_ptr (i32.const 36) ;; value_ptr - (i32.sub ;; value_len (input_size - key_size) + (i32.sub ;; value_len (input_size - key_size) (i32.load (i32.const 0)) (i32.const 32) ) @@ -2232,7 +2233,7 @@ mod tests { ) (call $seal_return (i32.const 0) ;; flags - (i32.const 0) ;; returned value + (i32.const 0) ;; pointer to returned value (i32.const 4) ;; length of returned value ) ) @@ -2262,6 +2263,77 @@ mod tests { assert_eq!(ext.storage.get(&[1u8; 32].to_vec()).unwrap(), &[99u8]); } + #[test] + #[cfg(feature = "unstable-interface")] + fn set_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 "__unstable__" "seal_set_storage" (func $seal_set_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 $seal_set_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.0.try_into().unwrap()), crate::SENTINEL); + assert_eq!(ext.storage.get(&[1u8; 32].to_vec()).unwrap(), &[42u8, 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.0.try_into().unwrap()), 2); + assert_eq!(ext.storage.get(&[1u8; 32].to_vec()).unwrap(), &[0u8; 0]); + + // 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.0.try_into().unwrap()), 0); + assert_eq!(ext.storage.get(&[1u8; 32].to_vec()).unwrap(), &[99u8]); + } + #[test] #[cfg(feature = "unstable-interface")] fn clear_storage_works() { @@ -2366,7 +2438,6 @@ mod tests { (data (i32.const 4) "\00\10") ;; [8, 168) input buffer - ;; [168, 4264) output buffer (func (export "call") @@ -2381,7 +2452,7 @@ mod tests { (call $seal_take_storage (i32.const 12) ;; key_ptr (i32.load (i32.const 8)) ;; key_len - (i32.const 172) ;; Pointer to the output buffer + (I32.const 172) ;; Pointer to the output buffer (i32.const 4) ;; Pointer to the size of the buffer ) ) From c7663fcf4484e85d82404fdb0ae7e313137ae2fa Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 31 May 2022 10:40:08 +0300 Subject: [PATCH 23/63] wasm test for new get_storage --- frame/contracts/src/wasm/mod.rs | 97 ++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 65ca1d52b96ba..3aa762e38a2d0 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -2334,6 +2334,100 @@ mod tests { assert_eq!(ext.storage.get(&[1u8; 32].to_vec()).unwrap(), &[99u8]); } + #[test] + #[cfg(feature = "unstable-interface")] + fn get_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 "__unstable__" "seal_get_storage" (func $seal_get_storage (param i32 i32 i32 i32) (result i32))) + (import "env" "memory" (memory 1 1)) + + ;; [0, 4) size of input buffer (160 Bits 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 $seal_get_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(); + + ext.set_storage_transparent( + VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), + Some(vec![42u8]), + false, + ) + .unwrap(); + + ext.set_storage_transparent( + VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), + Some(vec![]), + false, + ) + .unwrap(); + + // 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[0..4].try_into().unwrap()), + ReturnCode::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[0..4].try_into().unwrap()), + ReturnCode::Success as u32 + ); + assert_eq!(ext.storage.get(&[1u8; 64].to_vec()).unwrap(), &[42u8]); + assert_eq!(&result.data.0[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[0..4].try_into().unwrap()), + ReturnCode::Success as u32 + ); + assert_eq!(ext.storage.get(&[2u8; 19].to_vec()), Some(&vec![])); + assert_eq!(&result.data.0[4..], &([] as [u8; 0])); + } + #[test] #[cfg(feature = "unstable-interface")] fn clear_storage_works() { @@ -2452,7 +2546,7 @@ mod tests { (call $seal_take_storage (i32.const 12) ;; key_ptr (i32.load (i32.const 8)) ;; key_len - (I32.const 172) ;; Pointer to the output buffer + (i32.const 172) ;; Pointer to the output buffer (i32.const 4) ;; Pointer to the size of the buffer ) ) @@ -2467,6 +2561,7 @@ mod tests { ) ) ) + ) (func (export "deploy")) ) From a38bda6b4c3a8973223e2e392973e9883f70e58d Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 31 May 2022 10:56:14 +0300 Subject: [PATCH 24/63] wasm test for new contains_storage --- frame/contracts/src/wasm/mod.rs | 88 +++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 5 deletions(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 3aa762e38a2d0..41db27691165b 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -861,6 +861,7 @@ mod tests { } #[test] + #[cfg(not(feature = "unstable-interface"))] fn contains_storage_works() { const CODE: &str = r#" (module @@ -869,11 +870,10 @@ mod tests { (import "seal0" "seal_contains_storage" (func $seal_contains_storage (param i32) (result i32))) (import "env" "memory" (memory 1 1)) - ;; [0, 4) size of input buffer (32 bits as we copy the key here) + ;; [0, 4) size of input buffer (32 bytes as we copy the key here) (data (i32.const 0) "\20") ;; [4, 36) input buffer - ;; [36, inf) output buffer (func (export "call") @@ -920,6 +920,84 @@ mod tests { assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 0,); } + #[test] + #[cfg(feature = "unstable-interface")] + fn contains_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 "__unstable__" "seal_contains_storage" (func $seal_contains_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 the data + ) + ;; Call seal_clear_storage and save what it returns at 0 + (i32.store (i32.const 0) + (call $seal_contains_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(); + ext.set_storage_transparent( + VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), + Some(vec![42u8]), + false, + ) + .unwrap(); + ext.set_storage_transparent( + VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), + Some(vec![]), + false, + ) + .unwrap(); + + //value does not exist (wrong key length) + let input = (63, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + // sentinel returned + assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), crate::SENTINEL); + + // value exists + let input = (64, [1u8; 64]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + // true as u32 returned + assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 1); + // getter does not remove the value from storage + assert_eq!(ext.storage.get(&[1u8; 64].to_vec()).unwrap(), &[42u8]); + + // value exists (test for 0 sized) + let input = (19, [2u8; 19]).encode(); + let result = execute(CODE, input, &mut ext).unwrap(); + // true as u32 returned + assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 0); + // getter does not remove the value from storage + assert_eq!(ext.storage.get(&[2u8; 19].to_vec()).unwrap(), &([] as [u8; 0])); + } + const CODE_INSTANTIATE: &str = r#" (module ;; seal_instantiate( @@ -2344,7 +2422,7 @@ mod tests { (import "__unstable__" "seal_get_storage" (func $seal_get_storage (param i32 i32 i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) - ;; [0, 4) size of input buffer (160 Bits as we copy the key+len here) + ;; [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 @@ -2439,7 +2517,7 @@ mod tests { (import "env" "memory" (memory 1 1)) ;; size of input buffer - ;; [0, 4) size of input buffer (128+32 = 160 bits = 0xA0) + ;; [0, 4) size of input buffer (128+32 = 160 bytes = 0xA0) (data (i32.const 0) "\A0") ;; [4, 164) input buffer @@ -2524,7 +2602,7 @@ mod tests { (import "__unstable__" "seal_take_storage" (func $seal_take_storage (param i32 i32 i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) - ;; [0, 4) size of input buffer (160 Bits as we copy the key+len here) + ;; [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 From a2f51439e896fdb4a21ed0b9ee097e36a252a69c Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 31 May 2022 14:00:38 +0300 Subject: [PATCH 25/63] CI fix --- bin/node/executor/tests/basic.rs | 2 +- frame/contracts/src/storage.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index da0f4e6afb319..d993308565f74 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -731,7 +731,7 @@ fn deploying_wasm_contract_should_work() { t.execute_with(|| { // Verify that the contract does exist by querying some of its storage items // It does not matter that the storage item itself does not exist. - assert!(&pallet_contracts::Pallet::::get_storage(addr, Default::default()).is_ok()); + assert!(&pallet_contracts::Pallet::::get_storage(addr, pallet_contracts::exec::FixSizedKey::default()).is_ok()); }); } diff --git a/frame/contracts/src/storage.rs b/frame/contracts/src/storage.rs index 359fd22bce343..8e2080fcaf7dc 100644 --- a/frame/contracts/src/storage.rs +++ b/frame/contracts/src/storage.rs @@ -32,7 +32,7 @@ use frame_support::{ }; use scale_info::TypeInfo; use sp_core::crypto::UncheckedFrom; -use sp_io::{hashing::blake2_256, KillStorageResult}; +use sp_io::KillStorageResult; use sp_runtime::{ traits::{Hash, Zero}, RuntimeDebug, From 76fbbb08df84023536a94a7b752c2239cbe25753 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 31 May 2022 14:13:27 +0300 Subject: [PATCH 26/63] ci fix --- bin/node/executor/tests/basic.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index d993308565f74..0910237583a13 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -731,7 +731,11 @@ fn deploying_wasm_contract_should_work() { t.execute_with(|| { // Verify that the contract does exist by querying some of its storage items // It does not matter that the storage item itself does not exist. - assert!(&pallet_contracts::Pallet::::get_storage(addr, pallet_contracts::exec::FixSizedKey::default()).is_ok()); + assert!(&pallet_contracts::Pallet::::get_storage( + addr, + pallet_contracts::exec::FixSizedKey::default() + ) + .is_ok()); }); } From 7b76ea9fdaf7eea5ed10eb90539bca0ef5ffce14 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 31 May 2022 14:33:43 +0300 Subject: [PATCH 27/63] ci fix --- frame/contracts/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index c84e83e5607c0..c82ca9732fdd4 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -98,11 +98,6 @@ pub mod weights; #[cfg(test)] mod tests; -pub use crate::{ - exec::Frame, - pallet::*, - schedule::{HostFnWeights, InstructionWeights, Limits, Schedule}, -}; use crate::{ exec::{AccountIdOf, ExecError, Executable, Stack as ExecStack, StorageHash}, gas::GasMeter, @@ -110,6 +105,11 @@ use crate::{ wasm::{OwnerInfo, PrefabWasmModule}, weights::WeightInfo, }; +pub use crate::{ + exec::{FixSizedKey, Frame, VarSizedKey}, + pallet::*, + schedule::{HostFnWeights, InstructionWeights, Limits, Schedule}, +}; use codec::{Encode, HasCompact}; use frame_support::{ dispatch::Dispatchable, From d5d4bae316bc1fa08cfa5166e5d45a83a4246f6d Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 31 May 2022 14:53:28 +0300 Subject: [PATCH 28/63] ci fix --- bin/node/executor/tests/basic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 0910237583a13..7e521034d97af 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -733,7 +733,7 @@ fn deploying_wasm_contract_should_work() { // It does not matter that the storage item itself does not exist. assert!(&pallet_contracts::Pallet::::get_storage( addr, - pallet_contracts::exec::FixSizedKey::default() + pallet_contracts::FixSizedKey::default() ) .is_ok()); }); From f35dccd993b27917d8d42fb7eddff24b1017c083 Mon Sep 17 00:00:00 2001 From: Parity Bot Date: Tue, 7 Jun 2022 17:37:47 +0000 Subject: [PATCH 29/63] cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs --- frame/contracts/src/weights.rs | 1708 +++++++++++++++++--------------- 1 file changed, 919 insertions(+), 789 deletions(-) diff --git a/frame/contracts/src/weights.rs b/frame/contracts/src/weights.rs index b18c259ebd433..5cae9544dafa2 100644 --- a/frame/contracts/src/weights.rs +++ b/frame/contracts/src/weights.rs @@ -18,11 +18,12 @@ //! Autogenerated weights for pallet_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-04-24, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-06-07, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/substrate +// target/production/substrate // benchmark // pallet // --chain=dev @@ -32,8 +33,9 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --template=./.maintain/frame-weight-template.hbs +// --heap-pages=4096 // --output=./frame/contracts/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -164,44 +166,47 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_process_deletion_queue_batch() -> Weight { - (1_664_000 as Weight) + (1_552_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32, ) -> Weight { - (11_878_000 as Weight) + (7_539_000 as Weight) // Standard Error: 0 - .saturating_add((758_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((873_000 as Weight).saturating_mul(k as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(k as Weight))) } // Storage: Contracts DeletionQueue (r:1 w:0) + /// The range of component `q` is `[0, 1024]`. fn on_initialize_per_queue_item(q: u32, ) -> Weight { - (10_240_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_899_000 as Weight).saturating_mul(q as Weight)) + (0 as Weight) + // Standard Error: 5_000 + .saturating_add((1_967_000 as Weight).saturating_mul(q as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Contracts PristineCode (r:1 w:0) // Storage: Contracts CodeStorage (r:0 w:1) + /// The range of component `c` is `[0, 64226]`. fn reinstrument(c: u32, ) -> Weight { - (18_012_000 as Weight) + (25_242_000 as Weight) // Standard Error: 0 - .saturating_add((51_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((48_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `c` is `[0, 131072]`. fn call_with_code_per_byte(c: u32, ) -> Weight { - (206_036_000 as Weight) + (303_218_000 as Weight) // Standard Error: 0 - .saturating_add((52_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((54_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -209,50 +214,51 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts Nonce (r:1 w:1) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) + /// The range of component `c` is `[0, 64226]`. + /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (243_162_000 as Weight) + (352_997_000 as Weight) // Standard Error: 0 - .saturating_add((122_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((127_000 as Weight).saturating_mul(c as Weight)) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) } // Storage: Contracts CodeStorage (r:1 w:1) // Storage: Contracts Nonce (r:1 w:1) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) + /// The range of component `s` is `[0, 1048576]`. fn instantiate(s: u32, ) -> Weight { - (180_607_000 as Weight) + (233_624_000 as Weight) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: System Account (r:1 w:1) fn call() -> Weight { - (146_032_000 as Weight) + (197_235_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Contracts CodeStorage (r:1 w:1) // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) + /// The range of component `c` is `[0, 64226]`. fn upload_code(c: u32, ) -> Weight { - (45_113_000 as Weight) + (54_940_000 as Weight) // Standard Error: 0 - .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((50_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } @@ -260,14 +266,14 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - (25_722_000 as Weight) + (29_185_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:2 w:2) fn set_code() -> Weight { - (23_135_000 as Weight) + (27_016_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } @@ -275,11 +281,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_caller(r: u32, ) -> Weight { - (205_061_000 as Weight) - // Standard Error: 76_000 - .saturating_add((40_732_000 as Weight).saturating_mul(r as Weight)) + (308_072_000 as Weight) + // Standard Error: 115_000 + .saturating_add((40_651_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -287,11 +293,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_is_contract(r: u32, ) -> Weight { - (97_971_000 as Weight) - // Standard Error: 741_000 - .saturating_add((308_361_000 as Weight).saturating_mul(r as Weight)) + (194_111_000 as Weight) + // Standard Error: 676_000 + .saturating_add((303_123_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -300,11 +306,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_code_hash(r: u32, ) -> Weight { - (109_052_000 as Weight) - // Standard Error: 716_000 - .saturating_add((366_257_000 as Weight).saturating_mul(r as Weight)) + (208_761_000 as Weight) + // Standard Error: 754_000 + .saturating_add((355_429_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -313,11 +319,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_own_code_hash(r: u32, ) -> Weight { - (205_748_000 as Weight) - // Standard Error: 87_000 - .saturating_add((44_474_000 as Weight).saturating_mul(r as Weight)) + (306_378_000 as Weight) + // Standard Error: 132_000 + .saturating_add((44_647_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -325,11 +331,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_caller_is_origin(r: u32, ) -> Weight { - (201_898_000 as Weight) - // Standard Error: 55_000 - .saturating_add((16_703_000 as Weight).saturating_mul(r as Weight)) + (304_441_000 as Weight) + // Standard Error: 92_000 + .saturating_add((16_802_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -337,11 +343,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_address(r: u32, ) -> Weight { - (204_668_000 as Weight) - // Standard Error: 65_000 - .saturating_add((40_459_000 as Weight).saturating_mul(r as Weight)) + (305_807_000 as Weight) + // Standard Error: 111_000 + .saturating_add((40_393_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -349,11 +355,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_gas_left(r: u32, ) -> Weight { - (203_240_000 as Weight) - // Standard Error: 68_000 - .saturating_add((40_270_000 as Weight).saturating_mul(r as Weight)) + (309_122_000 as Weight) + // Standard Error: 139_000 + .saturating_add((40_234_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -361,11 +367,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_balance(r: u32, ) -> Weight { - (211_535_000 as Weight) - // Standard Error: 73_000 - .saturating_add((114_954_000 as Weight).saturating_mul(r as Weight)) + (316_857_000 as Weight) + // Standard Error: 142_000 + .saturating_add((112_644_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -373,11 +379,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_value_transferred(r: u32, ) -> Weight { - (204_653_000 as Weight) - // Standard Error: 71_000 - .saturating_add((40_188_000 as Weight).saturating_mul(r as Weight)) + (308_151_000 as Weight) + // Standard Error: 129_000 + .saturating_add((40_587_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -385,11 +391,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_minimum_balance(r: u32, ) -> Weight { - (204_690_000 as Weight) - // Standard Error: 82_000 - .saturating_add((40_260_000 as Weight).saturating_mul(r as Weight)) + (306_543_000 as Weight) + // Standard Error: 123_000 + .saturating_add((40_334_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -397,11 +403,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_block_number(r: u32, ) -> Weight { - (205_004_000 as Weight) - // Standard Error: 62_000 - .saturating_add((40_018_000 as Weight).saturating_mul(r as Weight)) + (307_558_000 as Weight) + // Standard Error: 131_000 + .saturating_add((40_208_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -409,11 +415,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_now(r: u32, ) -> Weight { - (204_341_000 as Weight) - // Standard Error: 93_000 - .saturating_add((39_920_000 as Weight).saturating_mul(r as Weight)) + (308_717_000 as Weight) + // Standard Error: 128_000 + .saturating_add((40_107_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -421,12 +427,12 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_weight_to_fee(r: u32, ) -> Weight { - (208_702_000 as Weight) - // Standard Error: 115_000 - .saturating_add((101_441_000 as Weight).saturating_mul(r as Weight)) + (311_389_000 as Weight) + // Standard Error: 160_000 + .saturating_add((99_639_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -434,11 +440,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_gas(r: u32, ) -> Weight { - (131_983_000 as Weight) - // Standard Error: 17_000 - .saturating_add((19_153_000 as Weight).saturating_mul(r as Weight)) + (190_262_000 as Weight) + // Standard Error: 51_000 + .saturating_add((19_003_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -446,11 +452,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_input(r: u32, ) -> Weight { - (203_768_000 as Weight) - // Standard Error: 57_000 - .saturating_add((39_316_000 as Weight).saturating_mul(r as Weight)) + (309_399_000 as Weight) + // Standard Error: 117_000 + .saturating_add((38_996_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -458,11 +464,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_input_per_kb(n: u32, ) -> Weight { - (273_930_000 as Weight) - // Standard Error: 3_000 - .saturating_add((9_513_000 as Weight).saturating_mul(n as Weight)) + (366_814_000 as Weight) + // Standard Error: 9_000 + .saturating_add((8_703_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -470,10 +476,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) + /// The range of component `r` is `[0, 1]`. fn seal_return(r: u32, ) -> Weight { - (199_311_000 as Weight) - // Standard Error: 601_000 - .saturating_add((2_181_000 as Weight).saturating_mul(r as Weight)) + (300_238_000 as Weight) + // Standard Error: 95_000 + .saturating_add((1_434_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -481,11 +488,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_return_per_kb(n: u32, ) -> Weight { - (201_130_000 as Weight) - // Standard Error: 0 - .saturating_add((184_000 as Weight).saturating_mul(n as Weight)) + (302_611_000 as Weight) + // Standard Error: 1_000 + .saturating_add((220_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -493,28 +500,28 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Contracts DeletionQueue (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) + /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32, ) -> Weight { - (202_063_000 as Weight) - // Standard Error: 100_000 - .saturating_add((54_190_000 as Weight).saturating_mul(r as Weight)) + (304_214_000 as Weight) + // Standard Error: 149_000 + .saturating_add((55_765_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(r as Weight))) } // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_random(r: u32, ) -> Weight { - (206_528_000 as Weight) - // Standard Error: 120_000 - .saturating_add((136_384_000 as Weight).saturating_mul(r as Weight)) + (310_070_000 as Weight) + // Standard Error: 158_000 + .saturating_add((128_878_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -522,11 +529,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_deposit_event(r: u32, ) -> Weight { - (210_309_000 as Weight) - // Standard Error: 138_000 - .saturating_add((236_583_000 as Weight).saturating_mul(r as Weight)) + (334_672_000 as Weight) + // Standard Error: 299_000 + .saturating_add((227_801_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -535,12 +542,14 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) // Storage: System EventTopics (r:80 w:80) + /// The range of component `t` is `[0, 4]`. + /// The range of component `n` is `[0, 16]`. fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (434_046_000 as Weight) - // Standard Error: 1_678_000 - .saturating_add((242_928_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 330_000 - .saturating_add((66_716_000 as Weight).saturating_mul(n as Weight)) + (561_717_000 as Weight) + // Standard Error: 1_857_000 + .saturating_add((247_510_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 366_000 + .saturating_add((68_991_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -550,119 +559,122 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_debug_message(r: u32, ) -> Weight { - (138_934_000 as Weight) - // Standard Error: 34_000 - .saturating_add((31_927_000 as Weight).saturating_mul(r as Weight)) + (196_577_000 as Weight) + // Standard Error: 71_000 + .saturating_add((31_872_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_set_storage(r: u32, ) -> Weight { - (88_315_000 as Weight) - // Standard Error: 594_000 - .saturating_add((328_984_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) + (347_776_000 as Weight) + // Standard Error: 211_000 + .saturating_add((133_764_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_set_storage_per_new_kb(n: u32, ) -> Weight { - (529_349_000 as Weight) - // Standard Error: 223_000 - .saturating_add((21_065_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(85 as Weight)) - .saturating_add(T::DbWeight::get().writes(83 as Weight)) + (474_366_000 as Weight) + // Standard Error: 224_000 + .saturating_add((37_764_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_set_storage_per_old_kb(n: u32, ) -> Weight { - (546_447_000 as Weight) - // Standard Error: 261_000 - .saturating_add((8_709_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(85 as Weight)) - .saturating_add(T::DbWeight::get().writes(83 as Weight)) + (463_764_000 as Weight) + // Standard Error: 132_000 + .saturating_add((16_476_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_clear_storage(r: u32, ) -> Weight { - (118_849_000 as Weight) - // Standard Error: 518_000 - .saturating_add((309_800_000 as Weight).saturating_mul(r as Weight)) + (322_458_000 as Weight) + // Standard Error: 149_000 + .saturating_add((109_679_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - .saturating_add(T::DbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_clear_storage_per_kb(n: u32, ) -> Weight { - (537_039_000 as Weight) - // Standard Error: 235_000 - .saturating_add((8_071_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(85 as Weight)) - .saturating_add(T::DbWeight::get().writes(83 as Weight)) + (408_831_000 as Weight) + // Standard Error: 113_000 + .saturating_add((16_649_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_get_storage(r: u32, ) -> Weight { - (125_427_000 as Weight) - // Standard Error: 635_000 - .saturating_add((276_126_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) + (328_599_000 as Weight) + // Standard Error: 182_000 + .saturating_add((100_880_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (500_356_000 as Weight) - // Standard Error: 279_000 - .saturating_add((49_746_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(84 as Weight)) + (403_332_000 as Weight) + // Standard Error: 114_000 + .saturating_add((16_143_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_contains_storage(r: u32, ) -> Weight { - (129_046_000 as Weight) - // Standard Error: 408_000 - .saturating_add((237_117_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) + (319_793_000 as Weight) + // Standard Error: 137_000 + .saturating_add((94_377_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_contains_storage_per_kb(n: u32, ) -> Weight { - (451_122_000 as Weight) - // Standard Error: 200_000 - .saturating_add((7_750_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(84 as Weight)) + (390_510_000 as Weight) + // Standard Error: 110_000 + .saturating_add((16_691_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_take_storage(r: u32, ) -> Weight { - (118_085_000 as Weight) - // Standard Error: 526_000 - .saturating_add((338_332_000 as Weight).saturating_mul(r as Weight)) + (315_025_000 as Weight) + // Standard Error: 160_000 + .saturating_add((117_861_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - .saturating_add(T::DbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_take_storage_per_kb(n: u32, ) -> Weight { - (569_270_000 as Weight) - // Standard Error: 294_000 - .saturating_add((51_071_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(85 as Weight)) - .saturating_add(T::DbWeight::get().writes(83 as Weight)) + (420_096_000 as Weight) + // Standard Error: 148_000 + .saturating_add((16_449_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_transfer(r: u32, ) -> Weight { - (124_818_000 as Weight) - // Standard Error: 1_251_000 - .saturating_add((1_455_607_000 as Weight).saturating_mul(r as Weight)) + (248_350_000 as Weight) + // Standard Error: 1_031_000 + .saturating_add((1_427_599_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) @@ -672,11 +684,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 4_575_000 - .saturating_add((14_645_061_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 6_049_000 + .saturating_add((22_839_215_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -686,11 +698,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_delegate_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_742_000 - .saturating_add((14_623_917_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 5_354_000 + .saturating_add((22_850_912_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -698,13 +710,14 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:81 w:81) // Storage: Contracts CodeStorage (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `t` is `[0, 1]`. + /// The range of component `c` is `[0, 1024]`. fn seal_call_per_transfer_clone_kb(t: u32, c: u32, ) -> Weight { - (9_081_635_000 as Weight) - // Standard Error: 11_326_000 - .saturating_add((1_335_139_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 4_000 - .saturating_add((9_575_000 as Weight).saturating_mul(c as Weight)) + (13_335_819_000 as Weight) + // Standard Error: 17_927_000 + .saturating_add((1_312_865_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 7_000 + .saturating_add((8_630_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(85 as Weight)) .saturating_add(T::DbWeight::get().reads((81 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(81 as Weight)) @@ -714,13 +727,13 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Contracts Nonce (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:80 w:80) + /// The range of component `r` is `[0, 20]`. fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 34_958_000 - .saturating_add((20_700_850_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 34_433_000 + .saturating_add((28_960_140_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().reads((320 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) @@ -730,15 +743,16 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:81 w:81) // Storage: Contracts CodeStorage (r:2 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Contracts Nonce (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) + /// The range of component `t` is `[0, 1]`. + /// The range of component `s` is `[0, 960]`. fn seal_instantiate_per_transfer_salt_kb(t: u32, s: u32, ) -> Weight { - (12_091_206_000 as Weight) - // Standard Error: 104_884_000 - .saturating_add((635_259_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 49_000 - .saturating_add((122_935_000 as Weight).saturating_mul(s as Weight)) + (16_466_387_000 as Weight) + // Standard Error: 48_433_000 + .saturating_add((467_404_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 22_000 + .saturating_add((127_185_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(167 as Weight)) .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(165 as Weight)) @@ -748,11 +762,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_hash_sha2_256(r: u32, ) -> Weight { - (203_315_000 as Weight) - // Standard Error: 74_000 - .saturating_add((60_223_000 as Weight).saturating_mul(r as Weight)) + (306_808_000 as Weight) + // Standard Error: 150_000 + .saturating_add((65_286_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -760,11 +774,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (355_672_000 as Weight) - // Standard Error: 25_000 - .saturating_add((319_519_000 as Weight).saturating_mul(n as Weight)) + (411_569_000 as Weight) + // Standard Error: 38_000 + .saturating_add((359_246_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -772,11 +786,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { - (203_117_000 as Weight) - // Standard Error: 94_000 - .saturating_add((77_363_000 as Weight).saturating_mul(r as Weight)) + (302_327_000 as Weight) + // Standard Error: 135_000 + .saturating_add((74_250_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -784,11 +798,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (196_575_000 as Weight) - // Standard Error: 13_000 - .saturating_add((243_479_000 as Weight).saturating_mul(n as Weight)) + (332_767_000 as Weight) + // Standard Error: 25_000 + .saturating_add((248_922_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -796,11 +810,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { - (203_938_000 as Weight) - // Standard Error: 97_000 - .saturating_add((50_708_000 as Weight).saturating_mul(r as Weight)) + (305_103_000 as Weight) + // Standard Error: 132_000 + .saturating_add((51_191_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -808,11 +822,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (247_065_000 as Weight) - // Standard Error: 8_000 - .saturating_add((94_160_000 as Weight).saturating_mul(n as Weight)) + (392_280_000 as Weight) + // Standard Error: 26_000 + .saturating_add((98_104_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -820,11 +834,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { - (204_389_000 as Weight) - // Standard Error: 86_000 - .saturating_add((50_663_000 as Weight).saturating_mul(r as Weight)) + (306_369_000 as Weight) + // Standard Error: 135_000 + .saturating_add((50_845_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -832,11 +846,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (284_700_000 as Weight) - // Standard Error: 9_000 - .saturating_add((94_231_000 as Weight).saturating_mul(n as Weight)) + (403_087_000 as Weight) + // Standard Error: 16_000 + .saturating_add((97_936_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -844,11 +858,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { - (235_813_000 as Weight) - // Standard Error: 521_000 - .saturating_add((3_044_204_000 as Weight).saturating_mul(r as Weight)) + (434_609_000 as Weight) + // Standard Error: 1_085_000 + .saturating_add((3_074_042_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -856,11 +870,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { - (204_095_000 as Weight) - // Standard Error: 495_000 - .saturating_add((2_027_914_000 as Weight).saturating_mul(r as Weight)) + (314_420_000 as Weight) + // Standard Error: 605_000 + .saturating_add((2_079_506_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -869,267 +883,319 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) // Storage: Contracts OwnerInfoOf (r:16 w:16) + /// The range of component `r` is `[0, 20]`. fn seal_set_code_hash(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 1_604_000 - .saturating_add((759_511_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 1_662_000 + .saturating_add((765_406_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes((79 as Weight).saturating_mul(r as Weight))) } + /// The range of component `r` is `[0, 50]`. fn instr_i64const(r: u32, ) -> Weight { - (74_210_000 as Weight) - // Standard Error: 1_000 - .saturating_add((601_000 as Weight).saturating_mul(r as Weight)) + (118_700_000 as Weight) + // Standard Error: 2_000 + .saturating_add((613_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64load(r: u32, ) -> Weight { - (74_123_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_315_000 as Weight).saturating_mul(r as Weight)) + (118_567_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_332_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64store(r: u32, ) -> Weight { - (74_145_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_388_000 as Weight).saturating_mul(r as Weight)) + (118_956_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_384_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { - (73_931_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_768_000 as Weight).saturating_mul(r as Weight)) + (118_759_000 as Weight) + // Standard Error: 6_000 + .saturating_add((1_772_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { - (73_829_000 as Weight) - // Standard Error: 0 - .saturating_add((1_957_000 as Weight).saturating_mul(r as Weight)) + (118_570_000 as Weight) + // Standard Error: 6_000 + .saturating_add((1_949_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { - (73_760_000 as Weight) - // Standard Error: 0 - .saturating_add((932_000 as Weight).saturating_mul(r as Weight)) + (118_612_000 as Weight) + // Standard Error: 4_000 + .saturating_add((927_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { - (73_714_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_420_000 as Weight).saturating_mul(r as Weight)) + (117_783_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_447_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { - (73_496_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_575_000 as Weight).saturating_mul(r as Weight)) + (118_210_000 as Weight) + // Standard Error: 8_000 + .saturating_add((1_593_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { - (76_036_000 as Weight) - // Standard Error: 0 - .saturating_add((5_000 as Weight).saturating_mul(e as Weight)) + (120_986_000 as Weight) + // Standard Error: 1_000 + .saturating_add((4_000 as Weight).saturating_mul(e as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { - (76_015_000 as Weight) - // Standard Error: 19_000 - .saturating_add((6_954_000 as Weight).saturating_mul(r as Weight)) + (120_549_000 as Weight) + // Standard Error: 18_000 + .saturating_add((6_972_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { - (88_247_000 as Weight) - // Standard Error: 9_000 - .saturating_add((8_957_000 as Weight).saturating_mul(r as Weight)) + (133_249_000 as Weight) + // Standard Error: 17_000 + .saturating_add((9_175_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (98_336_000 as Weight) - // Standard Error: 2_000 - .saturating_add((474_000 as Weight).saturating_mul(p as Weight)) + (142_686_000 as Weight) + // Standard Error: 1_000 + .saturating_add((470_000 as Weight).saturating_mul(p as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { - (74_565_000 as Weight) - // Standard Error: 4_000 - .saturating_add((627_000 as Weight).saturating_mul(r as Weight)) + (119_505_000 as Weight) + // Standard Error: 3_000 + .saturating_add((620_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { - (74_414_000 as Weight) - // Standard Error: 1_000 - .saturating_add((684_000 as Weight).saturating_mul(r as Weight)) + (119_589_000 as Weight) + // Standard Error: 6_000 + .saturating_add((673_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { - (74_346_000 as Weight) - // Standard Error: 1_000 - .saturating_add((911_000 as Weight).saturating_mul(r as Weight)) + (119_353_000 as Weight) + // Standard Error: 2_000 + .saturating_add((903_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { - (76_649_000 as Weight) - // Standard Error: 0 - .saturating_add((1_183_000 as Weight).saturating_mul(r as Weight)) + (121_499_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_177_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { - (76_995_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_370_000 as Weight).saturating_mul(r as Weight)) + (121_197_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { - (73_927_000 as Weight) - // Standard Error: 1_000 - .saturating_add((666_000 as Weight).saturating_mul(r as Weight)) + (118_556_000 as Weight) + // Standard Error: 3_000 + .saturating_add((670_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 1]`. fn instr_memory_grow(r: u32, ) -> Weight { - (73_479_000 as Weight) - // Standard Error: 24_000 - .saturating_add((180_808_000 as Weight).saturating_mul(r as Weight)) + (118_055_000 as Weight) + // Standard Error: 2_014_000 + .saturating_add((220_700_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { - (74_048_000 as Weight) - // Standard Error: 1_000 - .saturating_add((885_000 as Weight).saturating_mul(r as Weight)) + (119_038_000 as Weight) + // Standard Error: 8_000 + .saturating_add((894_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { - (73_894_000 as Weight) - // Standard Error: 1_000 - .saturating_add((889_000 as Weight).saturating_mul(r as Weight)) + (118_594_000 as Weight) + // Standard Error: 2_000 + .saturating_add((892_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { - (73_728_000 as Weight) - // Standard Error: 0 - .saturating_add((896_000 as Weight).saturating_mul(r as Weight)) + (118_816_000 as Weight) + // Standard Error: 3_000 + .saturating_add((886_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { - (74_049_000 as Weight) - // Standard Error: 1_000 - .saturating_add((897_000 as Weight).saturating_mul(r as Weight)) + (118_500_000 as Weight) + // Standard Error: 2_000 + .saturating_add((902_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { - (74_118_000 as Weight) - // Standard Error: 1_000 - .saturating_add((863_000 as Weight).saturating_mul(r as Weight)) + (118_809_000 as Weight) + // Standard Error: 3_000 + .saturating_add((864_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { - (74_042_000 as Weight) - // Standard Error: 1_000 - .saturating_add((865_000 as Weight).saturating_mul(r as Weight)) + (118_818_000 as Weight) + // Standard Error: 6_000 + .saturating_add((869_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { - (73_885_000 as Weight) - // Standard Error: 1_000 - .saturating_add((884_000 as Weight).saturating_mul(r as Weight)) + (118_380_000 as Weight) + // Standard Error: 6_000 + .saturating_add((904_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { - (73_788_000 as Weight) - // Standard Error: 0 - .saturating_add((1_355_000 as Weight).saturating_mul(r as Weight)) + (118_778_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_342_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { - (73_727_000 as Weight) - // Standard Error: 0 - .saturating_add((1_352_000 as Weight).saturating_mul(r as Weight)) + (118_903_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_344_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { - (73_825_000 as Weight) - // Standard Error: 0 - .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) + (119_016_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_338_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { - (73_638_000 as Weight) - // Standard Error: 0 - .saturating_add((1_355_000 as Weight).saturating_mul(r as Weight)) + (116_768_000 as Weight) + // Standard Error: 54_000 + .saturating_add((1_951_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { - (73_688_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_357_000 as Weight).saturating_mul(r as Weight)) + (118_875_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_345_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { - (73_895_000 as Weight) - // Standard Error: 1_000 + (118_743_000 as Weight) + // Standard Error: 4_000 .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { - (73_860_000 as Weight) - // Standard Error: 0 - .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) + (118_703_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_349_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { - (73_864_000 as Weight) - // Standard Error: 0 - .saturating_add((1_361_000 as Weight).saturating_mul(r as Weight)) + (118_502_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_364_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { - (72_730_000 as Weight) - // Standard Error: 7_000 - .saturating_add((1_432_000 as Weight).saturating_mul(r as Weight)) + (118_646_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_345_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { - (73_998_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_346_000 as Weight).saturating_mul(r as Weight)) + (118_815_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_341_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { - (73_708_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_333_000 as Weight).saturating_mul(r as Weight)) + (118_600_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { - (74_312_000 as Weight) + (118_926_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_339_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_318_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { - (74_203_000 as Weight) + (118_787_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_321_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { - (73_990_000 as Weight) - // Standard Error: 1_000 - .saturating_add((2_010_000 as Weight).saturating_mul(r as Weight)) + (118_845_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_989_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { - (73_918_000 as Weight) - // Standard Error: 1_000 - .saturating_add((2_019_000 as Weight).saturating_mul(r as Weight)) + (119_150_000 as Weight) + // Standard Error: 9_000 + .saturating_add((2_059_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { - (73_927_000 as Weight) - // Standard Error: 1_000 - .saturating_add((2_001_000 as Weight).saturating_mul(r as Weight)) + (118_762_000 as Weight) + // Standard Error: 7_000 + .saturating_add((2_007_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { - (73_691_000 as Weight) - // Standard Error: 0 - .saturating_add((2_062_000 as Weight).saturating_mul(r as Weight)) + (118_587_000 as Weight) + // Standard Error: 3_000 + .saturating_add((2_021_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { - (73_869_000 as Weight) - // Standard Error: 0 - .saturating_add((1_327_000 as Weight).saturating_mul(r as Weight)) + (118_437_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_335_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { - (73_890_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_327_000 as Weight).saturating_mul(r as Weight)) + (118_773_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { - (73_866_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_327_000 as Weight).saturating_mul(r as Weight)) + (118_843_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { - (73_793_000 as Weight) - // Standard Error: 0 - .saturating_add((1_352_000 as Weight).saturating_mul(r as Weight)) + (118_562_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { - (73_695_000 as Weight) - // Standard Error: 0 - .saturating_add((1_354_000 as Weight).saturating_mul(r as Weight)) + (118_798_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { - (73_743_000 as Weight) - // Standard Error: 0 - .saturating_add((1_352_000 as Weight).saturating_mul(r as Weight)) + (118_497_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { - (73_781_000 as Weight) - // Standard Error: 0 - .saturating_add((1_352_000 as Weight).saturating_mul(r as Weight)) + (118_784_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_341_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { - (73_941_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_348_000 as Weight).saturating_mul(r as Weight)) + (118_921_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_338_000 as Weight).saturating_mul(r as Weight)) } } @@ -1137,44 +1203,47 @@ impl WeightInfo for SubstrateWeight { impl WeightInfo for () { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_process_deletion_queue_batch() -> Weight { - (1_641_000 as Weight) + (1_552_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32, ) -> Weight { - (11_878_000 as Weight) + (7_539_000 as Weight) // Standard Error: 0 - .saturating_add((758_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((873_000 as Weight).saturating_mul(k as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(k as Weight))) } // Storage: Contracts DeletionQueue (r:1 w:0) + /// The range of component `q` is `[0, 1024]`. fn on_initialize_per_queue_item(q: u32, ) -> Weight { - (10_240_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_899_000 as Weight).saturating_mul(q as Weight)) + (0 as Weight) + // Standard Error: 5_000 + .saturating_add((1_967_000 as Weight).saturating_mul(q as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Contracts PristineCode (r:1 w:0) // Storage: Contracts CodeStorage (r:0 w:1) + /// The range of component `c` is `[0, 64226]`. fn reinstrument(c: u32, ) -> Weight { - (18_012_000 as Weight) + (25_242_000 as Weight) // Standard Error: 0 - .saturating_add((51_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((48_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `c` is `[0, 131072]`. fn call_with_code_per_byte(c: u32, ) -> Weight { - (206_036_000 as Weight) + (303_218_000 as Weight) // Standard Error: 0 - .saturating_add((52_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((54_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } @@ -1182,50 +1251,51 @@ impl WeightInfo for () { // Storage: Contracts Nonce (r:1 w:1) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) + /// The range of component `c` is `[0, 64226]`. + /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (243_162_000 as Weight) + (352_997_000 as Weight) // Standard Error: 0 - .saturating_add((122_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((127_000 as Weight).saturating_mul(c as Weight)) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(RocksDbWeight::get().reads(6 as Weight)) - .saturating_add(RocksDbWeight::get().writes(7 as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(6 as Weight)) } // Storage: Contracts CodeStorage (r:1 w:1) // Storage: Contracts Nonce (r:1 w:1) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) + /// The range of component `s` is `[0, 1048576]`. fn instantiate(s: u32, ) -> Weight { - (180_607_000 as Weight) + (233_624_000 as Weight) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(RocksDbWeight::get().reads(7 as Weight)) - .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + .saturating_add(RocksDbWeight::get().reads(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: System Account (r:1 w:1) fn call() -> Weight { - (146_032_000 as Weight) + (197_235_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Contracts CodeStorage (r:1 w:1) // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) + /// The range of component `c` is `[0, 64226]`. fn upload_code(c: u32, ) -> Weight { - (45_113_000 as Weight) + (54_940_000 as Weight) // Standard Error: 0 - .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((50_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } @@ -1233,14 +1303,14 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - (25_722_000 as Weight) + (29_185_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:2 w:2) fn set_code() -> Weight { - (23_135_000 as Weight) + (27_016_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } @@ -1248,11 +1318,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_caller(r: u32, ) -> Weight { - (205_061_000 as Weight) - // Standard Error: 76_000 - .saturating_add((40_732_000 as Weight).saturating_mul(r as Weight)) + (308_072_000 as Weight) + // Standard Error: 115_000 + .saturating_add((40_651_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1260,11 +1330,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_is_contract(r: u32, ) -> Weight { - (97_971_000 as Weight) - // Standard Error: 741_000 - .saturating_add((308_361_000 as Weight).saturating_mul(r as Weight)) + (194_111_000 as Weight) + // Standard Error: 676_000 + .saturating_add((303_123_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1273,11 +1343,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_code_hash(r: u32, ) -> Weight { - (109_052_000 as Weight) - // Standard Error: 716_000 - .saturating_add((366_257_000 as Weight).saturating_mul(r as Weight)) + (208_761_000 as Weight) + // Standard Error: 754_000 + .saturating_add((355_429_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1286,11 +1356,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_own_code_hash(r: u32, ) -> Weight { - (205_748_000 as Weight) - // Standard Error: 87_000 - .saturating_add((44_474_000 as Weight).saturating_mul(r as Weight)) + (306_378_000 as Weight) + // Standard Error: 132_000 + .saturating_add((44_647_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1298,11 +1368,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_caller_is_origin(r: u32, ) -> Weight { - (201_898_000 as Weight) - // Standard Error: 55_000 - .saturating_add((16_703_000 as Weight).saturating_mul(r as Weight)) + (304_441_000 as Weight) + // Standard Error: 92_000 + .saturating_add((16_802_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1310,11 +1380,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_address(r: u32, ) -> Weight { - (204_668_000 as Weight) - // Standard Error: 65_000 - .saturating_add((40_459_000 as Weight).saturating_mul(r as Weight)) + (305_807_000 as Weight) + // Standard Error: 111_000 + .saturating_add((40_393_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1322,11 +1392,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_gas_left(r: u32, ) -> Weight { - (203_240_000 as Weight) - // Standard Error: 68_000 - .saturating_add((40_270_000 as Weight).saturating_mul(r as Weight)) + (309_122_000 as Weight) + // Standard Error: 139_000 + .saturating_add((40_234_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1334,11 +1404,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_balance(r: u32, ) -> Weight { - (211_535_000 as Weight) - // Standard Error: 73_000 - .saturating_add((114_954_000 as Weight).saturating_mul(r as Weight)) + (316_857_000 as Weight) + // Standard Error: 142_000 + .saturating_add((112_644_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1346,11 +1416,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_value_transferred(r: u32, ) -> Weight { - (204_653_000 as Weight) - // Standard Error: 71_000 - .saturating_add((40_188_000 as Weight).saturating_mul(r as Weight)) + (308_151_000 as Weight) + // Standard Error: 129_000 + .saturating_add((40_587_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1358,11 +1428,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_minimum_balance(r: u32, ) -> Weight { - (204_690_000 as Weight) - // Standard Error: 82_000 - .saturating_add((40_260_000 as Weight).saturating_mul(r as Weight)) + (306_543_000 as Weight) + // Standard Error: 123_000 + .saturating_add((40_334_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1370,11 +1440,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_block_number(r: u32, ) -> Weight { - (205_004_000 as Weight) - // Standard Error: 62_000 - .saturating_add((40_018_000 as Weight).saturating_mul(r as Weight)) + (307_558_000 as Weight) + // Standard Error: 131_000 + .saturating_add((40_208_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1382,11 +1452,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_now(r: u32, ) -> Weight { - (204_341_000 as Weight) - // Standard Error: 93_000 - .saturating_add((39_920_000 as Weight).saturating_mul(r as Weight)) + (308_717_000 as Weight) + // Standard Error: 128_000 + .saturating_add((40_107_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1394,12 +1464,12 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_weight_to_fee(r: u32, ) -> Weight { - (208_702_000 as Weight) - // Standard Error: 115_000 - .saturating_add((101_441_000 as Weight).saturating_mul(r as Weight)) + (311_389_000 as Weight) + // Standard Error: 160_000 + .saturating_add((99_639_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1407,11 +1477,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_gas(r: u32, ) -> Weight { - (131_983_000 as Weight) - // Standard Error: 17_000 - .saturating_add((19_153_000 as Weight).saturating_mul(r as Weight)) + (190_262_000 as Weight) + // Standard Error: 51_000 + .saturating_add((19_003_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1419,11 +1489,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_input(r: u32, ) -> Weight { - (203_768_000 as Weight) - // Standard Error: 57_000 - .saturating_add((39_316_000 as Weight).saturating_mul(r as Weight)) + (309_399_000 as Weight) + // Standard Error: 117_000 + .saturating_add((38_996_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1431,11 +1501,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_input_per_kb(n: u32, ) -> Weight { - (273_930_000 as Weight) - // Standard Error: 3_000 - .saturating_add((9_513_000 as Weight).saturating_mul(n as Weight)) + (366_814_000 as Weight) + // Standard Error: 9_000 + .saturating_add((8_703_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1443,10 +1513,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) + /// The range of component `r` is `[0, 1]`. fn seal_return(r: u32, ) -> Weight { - (199_311_000 as Weight) - // Standard Error: 601_000 - .saturating_add((2_181_000 as Weight).saturating_mul(r as Weight)) + (300_238_000 as Weight) + // Standard Error: 95_000 + .saturating_add((1_434_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1454,11 +1525,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_return_per_kb(n: u32, ) -> Weight { - (201_130_000 as Weight) - // Standard Error: 0 - .saturating_add((184_000 as Weight).saturating_mul(n as Weight)) + (302_611_000 as Weight) + // Standard Error: 1_000 + .saturating_add((220_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1466,28 +1537,28 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Contracts DeletionQueue (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) + /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32, ) -> Weight { - (202_063_000 as Weight) - // Standard Error: 100_000 - .saturating_add((54_190_000 as Weight).saturating_mul(r as Weight)) + (304_214_000 as Weight) + // Standard Error: 149_000 + .saturating_add((55_765_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) - .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(r as Weight))) } // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_random(r: u32, ) -> Weight { - (206_528_000 as Weight) - // Standard Error: 120_000 - .saturating_add((136_384_000 as Weight).saturating_mul(r as Weight)) + (310_070_000 as Weight) + // Standard Error: 158_000 + .saturating_add((128_878_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1495,11 +1566,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_deposit_event(r: u32, ) -> Weight { - (210_309_000 as Weight) - // Standard Error: 138_000 - .saturating_add((236_583_000 as Weight).saturating_mul(r as Weight)) + (334_672_000 as Weight) + // Standard Error: 299_000 + .saturating_add((227_801_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1508,12 +1579,14 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) // Storage: System EventTopics (r:80 w:80) + /// The range of component `t` is `[0, 4]`. + /// The range of component `n` is `[0, 16]`. fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (434_046_000 as Weight) - // Standard Error: 1_678_000 - .saturating_add((242_928_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 330_000 - .saturating_add((66_716_000 as Weight).saturating_mul(n as Weight)) + (561_717_000 as Weight) + // Standard Error: 1_857_000 + .saturating_add((247_510_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 366_000 + .saturating_add((68_991_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1523,119 +1596,122 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_debug_message(r: u32, ) -> Weight { - (138_934_000 as Weight) - // Standard Error: 34_000 - .saturating_add((31_927_000 as Weight).saturating_mul(r as Weight)) + (196_577_000 as Weight) + // Standard Error: 71_000 + .saturating_add((31_872_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_set_storage(r: u32, ) -> Weight { - (88_315_000 as Weight) - // Standard Error: 594_000 - .saturating_add((328_984_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(RocksDbWeight::get().reads(4 as Weight)) - .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) + (347_776_000 as Weight) + // Standard Error: 211_000 + .saturating_add((133_764_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_set_storage_per_new_kb(n: u32, ) -> Weight { - (529_349_000 as Weight) - // Standard Error: 223_000 - .saturating_add((21_065_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(85 as Weight)) - .saturating_add(RocksDbWeight::get().writes(83 as Weight)) + (474_366_000 as Weight) + // Standard Error: 224_000 + .saturating_add((37_764_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_set_storage_per_old_kb(n: u32, ) -> Weight { - (546_447_000 as Weight) - // Standard Error: 261_000 - .saturating_add((8_709_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(85 as Weight)) - .saturating_add(RocksDbWeight::get().writes(83 as Weight)) + (463_764_000 as Weight) + // Standard Error: 132_000 + .saturating_add((16_476_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_clear_storage(r: u32, ) -> Weight { - (118_849_000 as Weight) - // Standard Error: 518_000 - .saturating_add((309_800_000 as Weight).saturating_mul(r as Weight)) + (322_458_000 as Weight) + // Standard Error: 149_000 + .saturating_add((109_679_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) - .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) - .saturating_add(RocksDbWeight::get().writes(3 as Weight)) - .saturating_add(RocksDbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_clear_storage_per_kb(n: u32, ) -> Weight { - (537_039_000 as Weight) - // Standard Error: 235_000 - .saturating_add((8_071_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(85 as Weight)) - .saturating_add(RocksDbWeight::get().writes(83 as Weight)) + (408_831_000 as Weight) + // Standard Error: 113_000 + .saturating_add((16_649_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_get_storage(r: u32, ) -> Weight { - (125_427_000 as Weight) - // Standard Error: 635_000 - .saturating_add((276_126_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(RocksDbWeight::get().reads(4 as Weight)) - .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) + (328_599_000 as Weight) + // Standard Error: 182_000 + .saturating_add((100_880_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (500_356_000 as Weight) - // Standard Error: 279_000 - .saturating_add((49_746_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(84 as Weight)) + (403_332_000 as Weight) + // Standard Error: 114_000 + .saturating_add((16_143_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_contains_storage(r: u32, ) -> Weight { - (129_046_000 as Weight) - // Standard Error: 408_000 - .saturating_add((237_117_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(RocksDbWeight::get().reads(4 as Weight)) - .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) + (319_793_000 as Weight) + // Standard Error: 137_000 + .saturating_add((94_377_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_contains_storage_per_kb(n: u32, ) -> Weight { - (451_122_000 as Weight) - // Standard Error: 200_000 - .saturating_add((7_750_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(84 as Weight)) + (390_510_000 as Weight) + // Standard Error: 110_000 + .saturating_add((16_691_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `r` is `[0, 20]`. fn seal_take_storage(r: u32, ) -> Weight { - (118_085_000 as Weight) - // Standard Error: 526_000 - .saturating_add((338_332_000 as Weight).saturating_mul(r as Weight)) + (315_025_000 as Weight) + // Standard Error: 160_000 + .saturating_add((117_861_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) - .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) - .saturating_add(RocksDbWeight::get().writes(3 as Weight)) - .saturating_add(RocksDbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `n` is `[0, 16]`. fn seal_take_storage_per_kb(n: u32, ) -> Weight { - (569_270_000 as Weight) - // Standard Error: 294_000 - .saturating_add((51_071_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(85 as Weight)) - .saturating_add(RocksDbWeight::get().writes(83 as Weight)) + (420_096_000 as Weight) + // Standard Error: 148_000 + .saturating_add((16_449_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_transfer(r: u32, ) -> Weight { - (124_818_000 as Weight) - // Standard Error: 1_251_000 - .saturating_add((1_455_607_000 as Weight).saturating_mul(r as Weight)) + (248_350_000 as Weight) + // Standard Error: 1_031_000 + .saturating_add((1_427_599_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) @@ -1645,11 +1721,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 4_575_000 - .saturating_add((14_645_061_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 6_049_000 + .saturating_add((22_839_215_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1659,11 +1735,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_delegate_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_742_000 - .saturating_add((14_623_917_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 5_354_000 + .saturating_add((22_850_912_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1671,13 +1747,14 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:81 w:81) // Storage: Contracts CodeStorage (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `t` is `[0, 1]`. + /// The range of component `c` is `[0, 1024]`. fn seal_call_per_transfer_clone_kb(t: u32, c: u32, ) -> Weight { - (9_081_635_000 as Weight) - // Standard Error: 11_326_000 - .saturating_add((1_335_139_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 4_000 - .saturating_add((9_575_000 as Weight).saturating_mul(c as Weight)) + (13_335_819_000 as Weight) + // Standard Error: 17_927_000 + .saturating_add((1_312_865_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 7_000 + .saturating_add((8_630_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(85 as Weight)) .saturating_add(RocksDbWeight::get().reads((81 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(81 as Weight)) @@ -1687,13 +1764,13 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Contracts Nonce (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:80 w:80) + /// The range of component `r` is `[0, 20]`. fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 34_958_000 - .saturating_add((20_700_850_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 34_433_000 + .saturating_add((28_960_140_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().reads((320 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) @@ -1703,15 +1780,16 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:81 w:81) // Storage: Contracts CodeStorage (r:2 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Contracts Nonce (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) + /// The range of component `t` is `[0, 1]`. + /// The range of component `s` is `[0, 960]`. fn seal_instantiate_per_transfer_salt_kb(t: u32, s: u32, ) -> Weight { - (12_091_206_000 as Weight) - // Standard Error: 104_884_000 - .saturating_add((635_259_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 49_000 - .saturating_add((122_935_000 as Weight).saturating_mul(s as Weight)) + (16_466_387_000 as Weight) + // Standard Error: 48_433_000 + .saturating_add((467_404_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 22_000 + .saturating_add((127_185_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(167 as Weight)) .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(165 as Weight)) @@ -1721,11 +1799,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_hash_sha2_256(r: u32, ) -> Weight { - (203_315_000 as Weight) - // Standard Error: 74_000 - .saturating_add((60_223_000 as Weight).saturating_mul(r as Weight)) + (306_808_000 as Weight) + // Standard Error: 150_000 + .saturating_add((65_286_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1733,11 +1811,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (355_672_000 as Weight) - // Standard Error: 25_000 - .saturating_add((319_519_000 as Weight).saturating_mul(n as Weight)) + (411_569_000 as Weight) + // Standard Error: 38_000 + .saturating_add((359_246_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1745,11 +1823,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { - (203_117_000 as Weight) - // Standard Error: 94_000 - .saturating_add((77_363_000 as Weight).saturating_mul(r as Weight)) + (302_327_000 as Weight) + // Standard Error: 135_000 + .saturating_add((74_250_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1757,11 +1835,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (196_575_000 as Weight) - // Standard Error: 13_000 - .saturating_add((243_479_000 as Weight).saturating_mul(n as Weight)) + (332_767_000 as Weight) + // Standard Error: 25_000 + .saturating_add((248_922_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1769,11 +1847,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { - (203_938_000 as Weight) - // Standard Error: 97_000 - .saturating_add((50_708_000 as Weight).saturating_mul(r as Weight)) + (305_103_000 as Weight) + // Standard Error: 132_000 + .saturating_add((51_191_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1781,11 +1859,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (247_065_000 as Weight) - // Standard Error: 8_000 - .saturating_add((94_160_000 as Weight).saturating_mul(n as Weight)) + (392_280_000 as Weight) + // Standard Error: 26_000 + .saturating_add((98_104_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1793,11 +1871,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { - (204_389_000 as Weight) - // Standard Error: 86_000 - .saturating_add((50_663_000 as Weight).saturating_mul(r as Weight)) + (306_369_000 as Weight) + // Standard Error: 135_000 + .saturating_add((50_845_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1805,11 +1883,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (284_700_000 as Weight) - // Standard Error: 9_000 - .saturating_add((94_231_000 as Weight).saturating_mul(n as Weight)) + (403_087_000 as Weight) + // Standard Error: 16_000 + .saturating_add((97_936_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1817,11 +1895,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { - (235_813_000 as Weight) - // Standard Error: 521_000 - .saturating_add((3_044_204_000 as Weight).saturating_mul(r as Weight)) + (434_609_000 as Weight) + // Standard Error: 1_085_000 + .saturating_add((3_074_042_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1829,11 +1907,11 @@ impl WeightInfo for () { // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { - (204_095_000 as Weight) - // Standard Error: 495_000 - .saturating_add((2_027_914_000 as Weight).saturating_mul(r as Weight)) + (314_420_000 as Weight) + // Standard Error: 605_000 + .saturating_add((2_079_506_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1842,266 +1920,318 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) // Storage: Contracts OwnerInfoOf (r:16 w:16) + /// The range of component `r` is `[0, 20]`. fn seal_set_code_hash(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 1_604_000 - .saturating_add((759_511_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 1_662_000 + .saturating_add((765_406_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes((79 as Weight).saturating_mul(r as Weight))) } + /// The range of component `r` is `[0, 50]`. fn instr_i64const(r: u32, ) -> Weight { - (74_210_000 as Weight) - // Standard Error: 1_000 - .saturating_add((601_000 as Weight).saturating_mul(r as Weight)) + (118_700_000 as Weight) + // Standard Error: 2_000 + .saturating_add((613_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64load(r: u32, ) -> Weight { - (74_123_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_315_000 as Weight).saturating_mul(r as Weight)) + (118_567_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_332_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64store(r: u32, ) -> Weight { - (74_145_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_388_000 as Weight).saturating_mul(r as Weight)) + (118_956_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_384_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { - (73_931_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_768_000 as Weight).saturating_mul(r as Weight)) + (118_759_000 as Weight) + // Standard Error: 6_000 + .saturating_add((1_772_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { - (73_829_000 as Weight) - // Standard Error: 0 - .saturating_add((1_957_000 as Weight).saturating_mul(r as Weight)) + (118_570_000 as Weight) + // Standard Error: 6_000 + .saturating_add((1_949_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { - (73_760_000 as Weight) - // Standard Error: 0 - .saturating_add((932_000 as Weight).saturating_mul(r as Weight)) + (118_612_000 as Weight) + // Standard Error: 4_000 + .saturating_add((927_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { - (73_714_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_420_000 as Weight).saturating_mul(r as Weight)) + (117_783_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_447_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { - (73_496_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_575_000 as Weight).saturating_mul(r as Weight)) + (118_210_000 as Weight) + // Standard Error: 8_000 + .saturating_add((1_593_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { - (76_036_000 as Weight) - // Standard Error: 0 - .saturating_add((5_000 as Weight).saturating_mul(e as Weight)) + (120_986_000 as Weight) + // Standard Error: 1_000 + .saturating_add((4_000 as Weight).saturating_mul(e as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { - (76_015_000 as Weight) - // Standard Error: 19_000 - .saturating_add((6_954_000 as Weight).saturating_mul(r as Weight)) + (120_549_000 as Weight) + // Standard Error: 18_000 + .saturating_add((6_972_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { - (88_247_000 as Weight) - // Standard Error: 9_000 - .saturating_add((8_957_000 as Weight).saturating_mul(r as Weight)) + (133_249_000 as Weight) + // Standard Error: 17_000 + .saturating_add((9_175_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (98_336_000 as Weight) - // Standard Error: 2_000 - .saturating_add((474_000 as Weight).saturating_mul(p as Weight)) + (142_686_000 as Weight) + // Standard Error: 1_000 + .saturating_add((470_000 as Weight).saturating_mul(p as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { - (74_565_000 as Weight) - // Standard Error: 4_000 - .saturating_add((627_000 as Weight).saturating_mul(r as Weight)) + (119_505_000 as Weight) + // Standard Error: 3_000 + .saturating_add((620_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { - (74_414_000 as Weight) - // Standard Error: 1_000 - .saturating_add((684_000 as Weight).saturating_mul(r as Weight)) + (119_589_000 as Weight) + // Standard Error: 6_000 + .saturating_add((673_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { - (74_346_000 as Weight) - // Standard Error: 1_000 - .saturating_add((911_000 as Weight).saturating_mul(r as Weight)) + (119_353_000 as Weight) + // Standard Error: 2_000 + .saturating_add((903_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { - (76_649_000 as Weight) - // Standard Error: 0 - .saturating_add((1_183_000 as Weight).saturating_mul(r as Weight)) + (121_499_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_177_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { - (76_995_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_370_000 as Weight).saturating_mul(r as Weight)) + (121_197_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { - (73_927_000 as Weight) - // Standard Error: 1_000 - .saturating_add((666_000 as Weight).saturating_mul(r as Weight)) + (118_556_000 as Weight) + // Standard Error: 3_000 + .saturating_add((670_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 1]`. fn instr_memory_grow(r: u32, ) -> Weight { - (73_479_000 as Weight) - // Standard Error: 24_000 - .saturating_add((180_808_000 as Weight).saturating_mul(r as Weight)) + (118_055_000 as Weight) + // Standard Error: 2_014_000 + .saturating_add((220_700_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { - (74_048_000 as Weight) - // Standard Error: 1_000 - .saturating_add((885_000 as Weight).saturating_mul(r as Weight)) + (119_038_000 as Weight) + // Standard Error: 8_000 + .saturating_add((894_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { - (73_894_000 as Weight) - // Standard Error: 1_000 - .saturating_add((889_000 as Weight).saturating_mul(r as Weight)) + (118_594_000 as Weight) + // Standard Error: 2_000 + .saturating_add((892_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { - (73_728_000 as Weight) - // Standard Error: 0 - .saturating_add((896_000 as Weight).saturating_mul(r as Weight)) + (118_816_000 as Weight) + // Standard Error: 3_000 + .saturating_add((886_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { - (74_049_000 as Weight) - // Standard Error: 1_000 - .saturating_add((897_000 as Weight).saturating_mul(r as Weight)) + (118_500_000 as Weight) + // Standard Error: 2_000 + .saturating_add((902_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { - (74_118_000 as Weight) - // Standard Error: 1_000 - .saturating_add((863_000 as Weight).saturating_mul(r as Weight)) + (118_809_000 as Weight) + // Standard Error: 3_000 + .saturating_add((864_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { - (74_042_000 as Weight) - // Standard Error: 1_000 - .saturating_add((865_000 as Weight).saturating_mul(r as Weight)) + (118_818_000 as Weight) + // Standard Error: 6_000 + .saturating_add((869_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { - (73_885_000 as Weight) - // Standard Error: 1_000 - .saturating_add((884_000 as Weight).saturating_mul(r as Weight)) + (118_380_000 as Weight) + // Standard Error: 6_000 + .saturating_add((904_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { - (73_788_000 as Weight) - // Standard Error: 0 - .saturating_add((1_355_000 as Weight).saturating_mul(r as Weight)) + (118_778_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_342_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { - (73_727_000 as Weight) - // Standard Error: 0 - .saturating_add((1_352_000 as Weight).saturating_mul(r as Weight)) + (118_903_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_344_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { - (73_825_000 as Weight) - // Standard Error: 0 - .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) + (119_016_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_338_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { - (73_638_000 as Weight) - // Standard Error: 0 - .saturating_add((1_355_000 as Weight).saturating_mul(r as Weight)) + (116_768_000 as Weight) + // Standard Error: 54_000 + .saturating_add((1_951_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { - (73_688_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_357_000 as Weight).saturating_mul(r as Weight)) + (118_875_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_345_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { - (73_895_000 as Weight) - // Standard Error: 1_000 + (118_743_000 as Weight) + // Standard Error: 4_000 .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { - (73_860_000 as Weight) - // Standard Error: 0 - .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) + (118_703_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_349_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { - (73_864_000 as Weight) - // Standard Error: 0 - .saturating_add((1_361_000 as Weight).saturating_mul(r as Weight)) + (118_502_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_364_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { - (72_730_000 as Weight) - // Standard Error: 7_000 - .saturating_add((1_432_000 as Weight).saturating_mul(r as Weight)) + (118_646_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_345_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { - (73_998_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_346_000 as Weight).saturating_mul(r as Weight)) + (118_815_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_341_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { - (73_708_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_333_000 as Weight).saturating_mul(r as Weight)) + (118_600_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { - (74_312_000 as Weight) + (118_926_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_339_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_318_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { - (74_203_000 as Weight) + (118_787_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_321_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { - (73_990_000 as Weight) - // Standard Error: 1_000 - .saturating_add((2_010_000 as Weight).saturating_mul(r as Weight)) + (118_845_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_989_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { - (73_918_000 as Weight) - // Standard Error: 1_000 - .saturating_add((2_019_000 as Weight).saturating_mul(r as Weight)) + (119_150_000 as Weight) + // Standard Error: 9_000 + .saturating_add((2_059_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { - (73_927_000 as Weight) - // Standard Error: 1_000 - .saturating_add((2_001_000 as Weight).saturating_mul(r as Weight)) + (118_762_000 as Weight) + // Standard Error: 7_000 + .saturating_add((2_007_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { - (73_691_000 as Weight) - // Standard Error: 0 - .saturating_add((2_062_000 as Weight).saturating_mul(r as Weight)) + (118_587_000 as Weight) + // Standard Error: 3_000 + .saturating_add((2_021_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { - (73_869_000 as Weight) - // Standard Error: 0 - .saturating_add((1_327_000 as Weight).saturating_mul(r as Weight)) + (118_437_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_335_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { - (73_890_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_327_000 as Weight).saturating_mul(r as Weight)) + (118_773_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { - (73_866_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_327_000 as Weight).saturating_mul(r as Weight)) + (118_843_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { - (73_793_000 as Weight) - // Standard Error: 0 - .saturating_add((1_352_000 as Weight).saturating_mul(r as Weight)) + (118_562_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { - (73_695_000 as Weight) - // Standard Error: 0 - .saturating_add((1_354_000 as Weight).saturating_mul(r as Weight)) + (118_798_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { - (73_743_000 as Weight) - // Standard Error: 0 - .saturating_add((1_352_000 as Weight).saturating_mul(r as Weight)) + (118_497_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { - (73_781_000 as Weight) - // Standard Error: 0 - .saturating_add((1_352_000 as Weight).saturating_mul(r as Weight)) + (118_784_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_341_000 as Weight).saturating_mul(r as Weight)) } + /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { - (73_941_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_348_000 as Weight).saturating_mul(r as Weight)) + (118_921_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_338_000 as Weight).saturating_mul(r as Weight)) } } From 954c1853633fad6672181fcdf234ec21aa4f804c Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Thu, 9 Jun 2022 17:51:47 +0300 Subject: [PATCH 30/63] fixes according to the review feedback --- frame/contracts/src/exec.rs | 51 ++++++++++++++++------------- frame/contracts/src/lib.rs | 15 +++++---- frame/contracts/src/storage.rs | 8 ++--- frame/contracts/src/wasm/mod.rs | 8 ++--- frame/contracts/src/wasm/runtime.rs | 48 +++++++++++---------------- 5 files changed, 64 insertions(+), 66 deletions(-) diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 454a40c90b4c1..478d22cdefaee 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -46,23 +46,27 @@ pub type ExecResult = Result; /// A type that represents a topic of an event. At the moment a hash is used. pub type TopicOf = ::Hash; +/// Type for fix sized storage key. pub type FixSizedKey = [u8; 32]; + +/// Type for variable sized storage key. Used for transparent hashing. pub type VarSizedKey = BoundedVec::MaxStorageKeyLen>; -pub trait StorageHash +/// Trait for hashing storage keys. +pub trait StorageKey where T: Config, { fn hash(self) -> Vec; } -impl StorageHash for FixSizedKey { +impl StorageKey for FixSizedKey { fn hash(self) -> Vec { blake2_256(self.as_slice()).to_vec() } } -impl StorageHash for VarSizedKey +impl StorageKey for VarSizedKey where T: Config, { @@ -165,7 +169,7 @@ pub trait Ext: sealing::Sealed { /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - fn get_storage(&mut self, key: FixSizedKey) -> Option>; + fn get_storage(&mut self, key: &FixSizedKey) -> Option>; /// This is a variation of `get_storage()` to be used with transparent hashing. /// These two will be merged into a single function after some refactoring is done. @@ -173,35 +177,36 @@ pub trait Ext: sealing::Sealed { /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option>; + fn get_storage_transparent(&mut self, key: &VarSizedKey) -> 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_storage_size(&mut self, key: FixSizedKey) -> Option; + fn get_storage_size(&mut self, key: &FixSizedKey) -> Option; - /// This is a variation of `get_storage_size()` to be used with transparent hashing. + /// This is the variation of `get_storage_size()` to be used with transparent hashing. /// These two will be merged into a single function after some refactoring is done. /// 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_storage_size_transparent(&mut self, key: VarSizedKey) -> Option; + fn get_storage_size_transparent(&mut self, key: &VarSizedKey) -> 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_storage( &mut self, - key: FixSizedKey, + key: &FixSizedKey, value: Option>, take_old: bool, ) -> Result; - /// + /// This is the variation of `set_storage()` to be used with transparent hashing. + /// These two will be merged into a single function after some refactoring is done. fn set_storage_transparent( &mut self, - key: VarSizedKey, + key: &VarSizedKey, value: Option>, take_old: bool, ) -> Result; @@ -1134,32 +1139,32 @@ where Self::transfer(ExistenceRequirement::KeepAlive, &self.top_frame().account_id, to, value) } - fn get_storage(&mut self, key: FixSizedKey) -> Option> { - Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) + fn get_storage(&mut self, key: &FixSizedKey) -> Option> { + Storage::::read(&self.top_frame_mut().contract_info().trie_id, key.clone()) } - fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { - Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) + fn get_storage_transparent(&mut self, key: &VarSizedKey) -> Option> { + Storage::::read(&self.top_frame_mut().contract_info().trie_id, key.clone()) } - fn get_storage_size(&mut self, key: FixSizedKey) -> Option { - Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) + fn get_storage_size(&mut self, key: &FixSizedKey) -> Option { + Storage::::size(&self.top_frame_mut().contract_info().trie_id, key.clone()) } - fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { - Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) + fn get_storage_size_transparent(&mut self, key: &VarSizedKey) -> Option { + Storage::::size(&self.top_frame_mut().contract_info().trie_id, key.clone()) } fn set_storage( &mut self, - key: FixSizedKey, + key: &FixSizedKey, value: Option>, take_old: bool, ) -> Result { let frame = self.top_frame_mut(); Storage::::write( &frame.contract_info.get(&frame.account_id).trie_id, - key, + key.clone(), value, Some(&mut frame.nested_storage), take_old, @@ -1168,14 +1173,14 @@ where fn set_storage_transparent( &mut self, - key: VarSizedKey, + key: &VarSizedKey, value: Option>, take_old: bool, ) -> Result { let frame = self.top_frame_mut(); Storage::::write( &frame.contract_info.get(&frame.account_id).trie_id, - key, + key.clone(), value, Some(&mut frame.nested_storage), take_old, diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index c82ca9732fdd4..7d2d471f585bc 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -99,17 +99,12 @@ pub mod weights; mod tests; use crate::{ - exec::{AccountIdOf, ExecError, Executable, Stack as ExecStack, StorageHash}, + exec::{AccountIdOf, ExecError, Executable, Stack as ExecStack, StorageKey}, gas::GasMeter, storage::{meter::Meter as StorageMeter, ContractInfo, DeletedContract, Storage}, wasm::{OwnerInfo, PrefabWasmModule}, weights::WeightInfo, }; -pub use crate::{ - exec::{FixSizedKey, Frame, VarSizedKey}, - pallet::*, - schedule::{HostFnWeights, InstructionWeights, Limits, Schedule}, -}; use codec::{Encode, HasCompact}; use frame_support::{ dispatch::Dispatchable, @@ -129,6 +124,12 @@ use sp_core::{crypto::UncheckedFrom, Bytes}; use sp_runtime::traits::{Convert, Hash, Saturating, StaticLookup}; use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; +pub use crate::{ + exec::{FixSizedKey, Frame, VarSizedKey}, + pallet::*, + schedule::{HostFnWeights, InstructionWeights, Limits, Schedule}, +}; + type CodeHash = ::Hash; type TrieId = BoundedVec>; type BalanceOf = @@ -945,7 +946,7 @@ where } /// Query storage of a specified contract under a specified key. - pub fn get_storage>(address: T::AccountId, key: K) -> GetStorageResult { + pub fn get_storage>(address: T::AccountId, key: K) -> GetStorageResult { let contract_info = ContractInfoOf::::get(&address).ok_or(ContractAccessError::DoesntExist)?; diff --git a/frame/contracts/src/storage.rs b/frame/contracts/src/storage.rs index 8e2080fcaf7dc..0ada1a0f7298c 100644 --- a/frame/contracts/src/storage.rs +++ b/frame/contracts/src/storage.rs @@ -20,7 +20,7 @@ pub mod meter; use crate::{ - exec::{AccountIdOf, StorageHash}, + exec::{AccountIdOf, StorageKey}, weights::WeightInfo, BalanceOf, CodeHash, Config, ContractInfoOf, DeletionQueue, Error, TrieId, SENTINEL, }; @@ -124,7 +124,7 @@ where /// /// The read is performed from the `trie_id` only. The `address` is not necessary. If the /// contract doesn't store under the given `key` `None` is returned. - pub fn read>(trie_id: &TrieId, key: K) -> Option> { + pub fn read>(trie_id: &TrieId, key: K) -> Option> { child::get_raw(&child_trie_info(trie_id), key.hash().as_slice()) } @@ -132,7 +132,7 @@ where /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - pub fn size>(trie_id: &TrieId, key: K) -> Option { + pub fn size>(trie_id: &TrieId, key: K) -> Option { child::len(&child_trie_info(trie_id), key.hash().as_slice()) } @@ -143,7 +143,7 @@ where /// /// This function also records how much storage was created or removed if a `storage_meter` /// is supplied. It should only be absent for testing or benchmarking code. - pub fn write>( + pub fn write>( trie_id: &TrieId, key: K, new_value: Option>, diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index d143a5df89075..5d5ed8506b2cc 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -426,13 +426,13 @@ mod tests { self.terminations.push(TerminationEntry { beneficiary: beneficiary.clone() }); Ok(()) } - fn get_storage(&mut self, key: FixSizedKey) -> Option> { + fn get_storage(&mut self, key: &FixSizedKey) -> Option> { self.storage.get(&key.to_vec()).cloned() } fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { self.storage.get(&key.to_vec()).cloned() } - fn get_storage_size(&mut self, key: FixSizedKey) -> Option { + fn get_storage_size(&mut self, key: &FixSizedKey) -> Option { self.storage.get(&key.to_vec()).map(|val| val.len() as u32) } fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { @@ -440,7 +440,7 @@ mod tests { } fn set_storage( &mut self, - key: FixSizedKey, + key: &FixSizedKey, value: Option>, take_old: bool, ) -> Result { @@ -2303,7 +2303,7 @@ mod tests { (call $seal_set_storage (i32.const 4) ;; key_ptr (i32.const 36) ;; value_ptr - (i32.sub ;; value_len (input_size - key_size) + (i32.sub ;; value_len (input_size - key_size) (i32.load (i32.const 0)) (i32.const 32) ) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 5044d61dfa171..2f1a354c553a5 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -46,6 +46,18 @@ enum KeyType { Variable(u32), } +impl KeyType { + fn len(&self) -> Result { + match self { + KeyType::Fix => Ok(32u32), + KeyType::Variable(len) => { + ensure!(len <= &::MaxStorageKeyLen::get(), Error::::DecodingFailed); + Ok(*len) + }, + } + } +} + /// Every error that can be returned to a contract when it calls any of the host functions. /// /// # Note @@ -717,26 +729,16 @@ where if value_len > max_size { return Err(Error::::ValueTooLarge.into()) } - let key_len = match key_type { - KeyType::Fix => 32u32, - KeyType::Variable(len) => { - ensure!( - len <= ::MaxStorageKeyLen::get(), - Error::::DecodingFailed - ); - len - }, - }; - let key = self.read_sandbox_memory(key_ptr, key_len)?; + let key = self.read_sandbox_memory(key_ptr, key_type.len::()?)?; let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); let write_outcome = match key_type { KeyType::Fix => self.ext.set_storage( - FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + &FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, value, false, )?, KeyType::Variable(_) => self.ext.set_storage_transparent( - VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, + &VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, value, false, )?, @@ -751,25 +753,15 @@ where fn clear_storage(&mut self, key_type: KeyType, key_ptr: u32) -> Result { let charged = self.charge_gas(RuntimeCosts::ClearStorage(self.ext.max_value_size()))?; - let key_len = match key_type { - KeyType::Fix => 32u32, - KeyType::Variable(len) => { - ensure!( - len <= ::MaxStorageKeyLen::get(), - Error::::DecodingFailed - ); - len - }, - }; - let key = self.read_sandbox_memory(key_ptr, key_len)?; + let key = self.read_sandbox_memory(key_ptr, key_type.len::()?)?; let outcome = match key_type { KeyType::Fix => self.ext.set_storage( - FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + &FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, None, false, )?, KeyType::Variable(_) => self.ext.set_storage_transparent( - VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, + &VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, None, false, )?, @@ -1004,7 +996,7 @@ define_env!(Env, , let charged = ctx.charge_gas(RuntimeCosts::GetStorage(ctx.ext.max_value_size()))?; let mut key: FixSizedKey = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - if let Some(value) = ctx.ext.get_storage(key) { + if let Some(value) = ctx.ext.get_storage(&key) { ctx.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; Ok(ReturnCode::Success) @@ -1062,7 +1054,7 @@ define_env!(Env, , let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?; let mut key: FixSizedKey = [0; 32]; ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - if let Some(len) = ctx.ext.get_storage_size(key) { + if let Some(len) = ctx.ext.get_storage_size(&key) { ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); Ok(len) } else { From c429e994d9faab4ca90e667cff12a4be4dd6a106 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Thu, 9 Jun 2022 18:05:42 +0300 Subject: [PATCH 31/63] tests & benchmarks fixed --- frame/contracts/src/benchmarking/mod.rs | 22 +++--- frame/contracts/src/exec.rs | 96 ++++++++++++------------- frame/contracts/src/wasm/mod.rs | 22 +++--- frame/contracts/src/wasm/runtime.rs | 6 +- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 38c3e8dfbdebd..8b17ef3633f1a 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -949,7 +949,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1001,7 +1001,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1053,7 +1053,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1107,7 +1107,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1158,7 +1158,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1216,7 +1216,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1274,7 +1274,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1327,7 +1327,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1378,7 +1378,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, @@ -1436,7 +1436,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![]), None, false, @@ -1494,7 +1494,7 @@ benchmarks! { for key in keys { Storage::::write( &info.trie_id, - VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, + &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, false, diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 478d22cdefaee..38a0cdbfcd947 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -66,7 +66,7 @@ impl StorageKey for FixSizedKey { } } -impl StorageKey for VarSizedKey +impl StorageKey for &VarSizedKey where T: Config, { @@ -1144,7 +1144,7 @@ where } fn get_storage_transparent(&mut self, key: &VarSizedKey) -> Option> { - Storage::::read(&self.top_frame_mut().contract_info().trie_id, key.clone()) + Storage::::read(&self.top_frame_mut().contract_info().trie_id, &key.clone()) } fn get_storage_size(&mut self, key: &FixSizedKey) -> Option { @@ -1152,7 +1152,7 @@ where } fn get_storage_size_transparent(&mut self, key: &VarSizedKey) -> Option { - Storage::::size(&self.top_frame_mut().contract_info().trie_id, key.clone()) + Storage::::size(&self.top_frame_mut().contract_info().trie_id, &key.clone()) } fn set_storage( @@ -1180,7 +1180,7 @@ where let frame = self.top_frame_mut(); Storage::::write( &frame.contract_info.get(&frame.account_id).trie_id, - key.clone(), + &key.clone(), value, Some(&mut frame.nested_storage), take_old, @@ -2713,35 +2713,35 @@ mod tests { let code_hash = MockLoader::insert(Call, |ctx, _| { // Write assert_eq!( - ctx.ext.set_storage([1; 32], Some(vec![1, 2, 3]), false), + ctx.ext.set_storage(&[1; 32], Some(vec![1, 2, 3]), false), Ok(WriteOutcome::New) ); assert_eq!( - ctx.ext.set_storage([2; 32], Some(vec![4, 5, 6]), true), + ctx.ext.set_storage(&[2; 32], Some(vec![4, 5, 6]), true), Ok(WriteOutcome::New) ); - assert_eq!(ctx.ext.set_storage([3; 32], None, false), Ok(WriteOutcome::New)); - assert_eq!(ctx.ext.set_storage([4; 32], None, true), Ok(WriteOutcome::New)); - assert_eq!(ctx.ext.set_storage([5; 32], Some(vec![]), false), Ok(WriteOutcome::New)); - assert_eq!(ctx.ext.set_storage([6; 32], Some(vec![]), true), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.set_storage(&[3; 32], None, false), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.set_storage(&[4; 32], None, true), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.set_storage(&[5; 32], Some(vec![]), false), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.set_storage(&[6; 32], Some(vec![]), true), Ok(WriteOutcome::New)); // Overwrite assert_eq!( - ctx.ext.set_storage([1; 32], Some(vec![42]), false), + ctx.ext.set_storage(&[1; 32], Some(vec![42]), false), Ok(WriteOutcome::Overwritten(3)) ); assert_eq!( - ctx.ext.set_storage([2; 32], Some(vec![48]), true), + ctx.ext.set_storage(&[2; 32], Some(vec![48]), true), Ok(WriteOutcome::Taken(vec![4, 5, 6])) ); - assert_eq!(ctx.ext.set_storage([3; 32], None, false), Ok(WriteOutcome::New)); - assert_eq!(ctx.ext.set_storage([4; 32], None, true), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.set_storage(&[3; 32], None, false), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.set_storage(&[4; 32], None, true), Ok(WriteOutcome::New)); assert_eq!( - ctx.ext.set_storage([5; 32], Some(vec![]), false), + ctx.ext.set_storage(&[5; 32], Some(vec![]), false), Ok(WriteOutcome::Overwritten(0)) ); assert_eq!( - ctx.ext.set_storage([6; 32], Some(vec![]), true), + ctx.ext.set_storage(&[6; 32], Some(vec![]), true), Ok(WriteOutcome::Taken(vec![])) ); @@ -2774,7 +2774,7 @@ mod tests { // Write assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([1; 64].to_vec()).unwrap(), + &VarSizedKey::::try_from([1; 64].to_vec()).unwrap(), Some(vec![1, 2, 3]), false ), @@ -2782,7 +2782,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([2; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([2; 19].to_vec()).unwrap(), Some(vec![4, 5, 6]), true ), @@ -2790,7 +2790,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([3; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([3; 19].to_vec()).unwrap(), None, false ), @@ -2798,7 +2798,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([4; 64].to_vec()).unwrap(), + &VarSizedKey::::try_from([4; 64].to_vec()).unwrap(), None, true ), @@ -2806,7 +2806,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([5; 30].to_vec()).unwrap(), + &VarSizedKey::::try_from([5; 30].to_vec()).unwrap(), Some(vec![]), false ), @@ -2814,7 +2814,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([6; 128].to_vec()).unwrap(), + &VarSizedKey::::try_from([6; 128].to_vec()).unwrap(), Some(vec![]), true ), @@ -2824,7 +2824,7 @@ mod tests { // Overwrite assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([1; 64].to_vec()).unwrap(), + &VarSizedKey::::try_from([1; 64].to_vec()).unwrap(), Some(vec![42, 43, 44]), false ), @@ -2832,7 +2832,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([2; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([2; 19].to_vec()).unwrap(), Some(vec![48]), true ), @@ -2840,7 +2840,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([3; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([3; 19].to_vec()).unwrap(), None, false ), @@ -2848,7 +2848,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([4; 64].to_vec()).unwrap(), + &VarSizedKey::::try_from([4; 64].to_vec()).unwrap(), None, true ), @@ -2856,7 +2856,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([5; 30].to_vec()).unwrap(), + &VarSizedKey::::try_from([5; 30].to_vec()).unwrap(), Some(vec![]), false ), @@ -2864,7 +2864,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([6; 128].to_vec()).unwrap(), + &VarSizedKey::::try_from([6; 128].to_vec()).unwrap(), Some(vec![]), true ), @@ -2898,13 +2898,13 @@ mod tests { fn get_storage_works() { let code_hash = MockLoader::insert(Call, |ctx, _| { assert_eq!( - ctx.ext.set_storage([1; 32], Some(vec![1, 2, 3]), false), + ctx.ext.set_storage(&[1; 32], Some(vec![1, 2, 3]), false), Ok(WriteOutcome::New) ); - assert_eq!(ctx.ext.set_storage([2; 32], Some(vec![]), false), Ok(WriteOutcome::New)); - assert_eq!(ctx.ext.get_storage([1; 32]), Some(vec![1, 2, 3])); - assert_eq!(ctx.ext.get_storage([2; 32]), Some(vec![])); - assert_eq!(ctx.ext.get_storage([3; 32]), None); + assert_eq!(ctx.ext.set_storage(&[2; 32], Some(vec![]), false), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.get_storage(&[1; 32]), Some(vec![1, 2, 3])); + assert_eq!(ctx.ext.get_storage(&[2; 32]), Some(vec![])); + assert_eq!(ctx.ext.get_storage(&[3; 32]), None); exec_success() }); @@ -2933,13 +2933,13 @@ mod tests { fn get_storage_size_works() { let code_hash = MockLoader::insert(Call, |ctx, _| { assert_eq!( - ctx.ext.set_storage([1; 32], Some(vec![1, 2, 3]), false), + ctx.ext.set_storage(&[1; 32], Some(vec![1, 2, 3]), false), Ok(WriteOutcome::New) ); - assert_eq!(ctx.ext.set_storage([2; 32], Some(vec![]), false), Ok(WriteOutcome::New)); - assert_eq!(ctx.ext.get_storage_size([1; 32]), Some(3)); - assert_eq!(ctx.ext.get_storage_size([2; 32]), Some(0)); - assert_eq!(ctx.ext.get_storage_size([3; 32]), None); + assert_eq!(ctx.ext.set_storage(&[2; 32], Some(vec![]), false), Ok(WriteOutcome::New)); + assert_eq!(ctx.ext.get_storage_size(&[1; 32]), Some(3)); + assert_eq!(ctx.ext.get_storage_size(&[2; 32]), Some(0)); + assert_eq!(ctx.ext.get_storage_size(&[3; 32]), None); exec_success() }); @@ -2969,7 +2969,7 @@ mod tests { let code_hash = MockLoader::insert(Call, |ctx, _| { assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([1; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([1; 19].to_vec()).unwrap(), Some(vec![1, 2, 3]), false ), @@ -2977,7 +2977,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([2; 16].to_vec()).unwrap(), + &VarSizedKey::::try_from([2; 16].to_vec()).unwrap(), Some(vec![]), false ), @@ -2985,19 +2985,19 @@ mod tests { ); assert_eq!( ctx.ext.get_storage_transparent( - VarSizedKey::::try_from([1; 19].to_vec()).unwrap() + &VarSizedKey::::try_from([1; 19].to_vec()).unwrap() ), Some(vec![1, 2, 3]) ); assert_eq!( ctx.ext.get_storage_transparent( - VarSizedKey::::try_from([2; 16].to_vec()).unwrap() + &VarSizedKey::::try_from([2; 16].to_vec()).unwrap() ), Some(vec![]) ); assert_eq!( ctx.ext.get_storage_transparent( - VarSizedKey::::try_from([3; 8].to_vec()).unwrap() + &VarSizedKey::::try_from([3; 8].to_vec()).unwrap() ), None ); @@ -3030,7 +3030,7 @@ mod tests { let code_hash = MockLoader::insert(Call, |ctx, _| { assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([1; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([1; 19].to_vec()).unwrap(), Some(vec![1, 2, 3]), false ), @@ -3038,7 +3038,7 @@ mod tests { ); assert_eq!( ctx.ext.set_storage_transparent( - VarSizedKey::::try_from([2; 16].to_vec()).unwrap(), + &VarSizedKey::::try_from([2; 16].to_vec()).unwrap(), Some(vec![]), false ), @@ -3046,19 +3046,19 @@ mod tests { ); assert_eq!( ctx.ext.get_storage_size_transparent( - VarSizedKey::::try_from([1; 19].to_vec()).unwrap() + &VarSizedKey::::try_from([1; 19].to_vec()).unwrap() ), Some(3) ); assert_eq!( ctx.ext.get_storage_size_transparent( - VarSizedKey::::try_from([2; 16].to_vec()).unwrap() + &VarSizedKey::::try_from([2; 16].to_vec()).unwrap() ), Some(0) ); assert_eq!( ctx.ext.get_storage_size_transparent( - VarSizedKey::::try_from([3; 8].to_vec()).unwrap() + &VarSizedKey::::try_from([3; 8].to_vec()).unwrap() ), None ); diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 5d5ed8506b2cc..ae9ee31b8d68f 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -429,13 +429,13 @@ mod tests { fn get_storage(&mut self, key: &FixSizedKey) -> Option> { self.storage.get(&key.to_vec()).cloned() } - fn get_storage_transparent(&mut self, key: VarSizedKey) -> Option> { + fn get_storage_transparent(&mut self, key: &VarSizedKey) -> Option> { self.storage.get(&key.to_vec()).cloned() } fn get_storage_size(&mut self, key: &FixSizedKey) -> Option { self.storage.get(&key.to_vec()).map(|val| val.len() as u32) } - fn get_storage_size_transparent(&mut self, key: VarSizedKey) -> Option { + fn get_storage_size_transparent(&mut self, key: &VarSizedKey) -> Option { self.storage.get(&key.to_vec()).map(|val| val.len() as u32) } fn set_storage( @@ -458,7 +458,7 @@ mod tests { } fn set_storage_transparent( &mut self, - key: VarSizedKey, + key: &VarSizedKey, value: Option>, take_old: bool, ) -> Result { @@ -963,13 +963,13 @@ mod tests { let mut ext = MockExt::default(); ext.set_storage_transparent( - VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), + &VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), Some(vec![42u8]), false, ) .unwrap(); ext.set_storage_transparent( - VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), Some(vec![]), false, ) @@ -2464,14 +2464,14 @@ mod tests { let mut ext = MockExt::default(); ext.set_storage_transparent( - VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), + &VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), Some(vec![42u8]), false, ) .unwrap(); ext.set_storage_transparent( - VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), Some(vec![]), false, ) @@ -2549,13 +2549,13 @@ mod tests { let mut ext = MockExt::default(); ext.set_storage_transparent( - VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), + &VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), Some(vec![42u8]), false, ) .unwrap(); ext.set_storage_transparent( - VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), Some(vec![]), false, ) @@ -2647,14 +2647,14 @@ mod tests { let mut ext = MockExt::default(); ext.set_storage_transparent( - VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), + &VarSizedKey::::try_from([1u8; 64].to_vec()).unwrap(), Some(vec![42u8]), false, ) .unwrap(); ext.set_storage_transparent( - VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), + &VarSizedKey::::try_from([2u8; 19].to_vec()).unwrap(), Some(vec![]), false, ) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 2f1a354c553a5..709d34b7fe80d 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -1027,7 +1027,7 @@ define_env!(Env, , [__unstable__] seal_get_storage(ctx, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::GetStorage(ctx.ext.max_value_size()))?; let key = ctx.read_sandbox_memory(key_ptr, key_len)?; - if let Some(value) = ctx.ext.get_storage_transparent(VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?) { + if let Some(value) = ctx.ext.get_storage_transparent(&VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?) { ctx.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; Ok(ReturnCode::Success) @@ -1079,7 +1079,7 @@ define_env!(Env, , [__unstable__] seal_contains_storage(ctx, key_ptr: u32, key_len: u32) -> u32 => { let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?; let key = ctx.read_sandbox_memory(key_ptr, key_len)?; - if let Some(len) = ctx.ext.get_storage_size_transparent(VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?) { + if let Some(len) = ctx.ext.get_storage_size_transparent(&VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?) { ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); Ok(len) } else { @@ -1104,7 +1104,7 @@ define_env!(Env, , [__unstable__] seal_take_storage(ctx, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { let charged = ctx.charge_gas(RuntimeCosts::TakeStorage(ctx.ext.max_value_size()))?; let key = ctx.read_sandbox_memory(key_ptr, key_len)?; - if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage_transparent(VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, None, true)? { + if let crate::storage::WriteOutcome::Taken(value) = ctx.ext.set_storage_transparent(&VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, None, true)? { ctx.adjust_gas(charged, RuntimeCosts::TakeStorage(value.len() as u32)); ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; Ok(ReturnCode::Success) From f6336eb0c83c39e68e1dcc1e3689f4ad7b72f801 Mon Sep 17 00:00:00 2001 From: Parity Bot Date: Fri, 10 Jun 2022 10:25:19 +0000 Subject: [PATCH 32/63] cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs --- frame/contracts/src/weights.rs | 1238 ++++++++++++++++---------------- 1 file changed, 619 insertions(+), 619 deletions(-) diff --git a/frame/contracts/src/weights.rs b/frame/contracts/src/weights.rs index 5cae9544dafa2..1a0af576602a9 100644 --- a/frame/contracts/src/weights.rs +++ b/frame/contracts/src/weights.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-06-07, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-06-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -166,15 +166,15 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_process_deletion_queue_batch() -> Weight { - (1_552_000 as Weight) + (1_648_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32, ) -> Weight { - (7_539_000 as Weight) + (7_105_000 as Weight) // Standard Error: 0 - .saturating_add((873_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((879_000 as Weight).saturating_mul(k as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(k as Weight))) @@ -183,8 +183,8 @@ impl WeightInfo for SubstrateWeight { /// The range of component `q` is `[0, 1024]`. fn on_initialize_per_queue_item(q: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_000 - .saturating_add((1_967_000 as Weight).saturating_mul(q as Weight)) + // Standard Error: 4_000 + .saturating_add((1_874_000 as Weight).saturating_mul(q as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -192,9 +192,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn reinstrument(c: u32, ) -> Weight { - (25_242_000 as Weight) + (17_962_000 as Weight) // Standard Error: 0 - .saturating_add((48_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -204,9 +204,9 @@ impl WeightInfo for SubstrateWeight { // Storage: System Account (r:1 w:1) /// The range of component `c` is `[0, 131072]`. fn call_with_code_per_byte(c: u32, ) -> Weight { - (303_218_000 as Weight) + (207_433_000 as Weight) // Standard Error: 0 - .saturating_add((54_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((53_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -220,9 +220,9 @@ impl WeightInfo for SubstrateWeight { /// The range of component `c` is `[0, 64226]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (352_997_000 as Weight) + (218_094_000 as Weight) // Standard Error: 0 - .saturating_add((127_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((126_000 as Weight).saturating_mul(c as Weight)) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) @@ -236,7 +236,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `s` is `[0, 1048576]`. fn instantiate(s: u32, ) -> Weight { - (233_624_000 as Weight) + (184_236_000 as Weight) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) @@ -247,7 +247,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: System Account (r:1 w:1) fn call() -> Weight { - (197_235_000 as Weight) + (148_764_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -256,9 +256,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn upload_code(c: u32, ) -> Weight { - (54_940_000 as Weight) + (48_474_000 as Weight) // Standard Error: 0 - .saturating_add((50_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } @@ -266,14 +266,14 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - (29_185_000 as Weight) + (29_301_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:2 w:2) fn set_code() -> Weight { - (27_016_000 as Weight) + (26_779_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } @@ -283,9 +283,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_caller(r: u32, ) -> Weight { - (308_072_000 as Weight) - // Standard Error: 115_000 - .saturating_add((40_651_000 as Weight).saturating_mul(r as Weight)) + (210_501_000 as Weight) + // Standard Error: 96_000 + .saturating_add((40_406_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -295,9 +295,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_is_contract(r: u32, ) -> Weight { - (194_111_000 as Weight) - // Standard Error: 676_000 - .saturating_add((303_123_000 as Weight).saturating_mul(r as Weight)) + (98_460_000 as Weight) + // Standard Error: 717_000 + .saturating_add((302_159_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -308,9 +308,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_code_hash(r: u32, ) -> Weight { - (208_761_000 as Weight) - // Standard Error: 754_000 - .saturating_add((355_429_000 as Weight).saturating_mul(r as Weight)) + (100_103_000 as Weight) + // Standard Error: 687_000 + .saturating_add((360_394_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -321,9 +321,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_own_code_hash(r: u32, ) -> Weight { - (306_378_000 as Weight) - // Standard Error: 132_000 - .saturating_add((44_647_000 as Weight).saturating_mul(r as Weight)) + (210_131_000 as Weight) + // Standard Error: 102_000 + .saturating_add((43_916_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -333,9 +333,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_caller_is_origin(r: u32, ) -> Weight { - (304_441_000 as Weight) - // Standard Error: 92_000 - .saturating_add((16_802_000 as Weight).saturating_mul(r as Weight)) + (208_603_000 as Weight) + // Standard Error: 56_000 + .saturating_add((16_961_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -345,9 +345,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_address(r: u32, ) -> Weight { - (305_807_000 as Weight) - // Standard Error: 111_000 - .saturating_add((40_393_000 as Weight).saturating_mul(r as Weight)) + (209_735_000 as Weight) + // Standard Error: 102_000 + .saturating_add((40_378_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -357,9 +357,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_gas_left(r: u32, ) -> Weight { - (309_122_000 as Weight) - // Standard Error: 139_000 - .saturating_add((40_234_000 as Weight).saturating_mul(r as Weight)) + (213_032_000 as Weight) + // Standard Error: 112_000 + .saturating_add((39_716_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -369,9 +369,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_balance(r: u32, ) -> Weight { - (316_857_000 as Weight) - // Standard Error: 142_000 - .saturating_add((112_644_000 as Weight).saturating_mul(r as Weight)) + (216_266_000 as Weight) + // Standard Error: 149_000 + .saturating_add((117_042_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -381,9 +381,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_value_transferred(r: u32, ) -> Weight { - (308_151_000 as Weight) - // Standard Error: 129_000 - .saturating_add((40_587_000 as Weight).saturating_mul(r as Weight)) + (210_124_000 as Weight) + // Standard Error: 112_000 + .saturating_add((39_859_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -393,9 +393,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_minimum_balance(r: u32, ) -> Weight { - (306_543_000 as Weight) - // Standard Error: 123_000 - .saturating_add((40_334_000 as Weight).saturating_mul(r as Weight)) + (210_515_000 as Weight) + // Standard Error: 117_000 + .saturating_add((40_007_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -405,9 +405,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_block_number(r: u32, ) -> Weight { - (307_558_000 as Weight) - // Standard Error: 131_000 - .saturating_add((40_208_000 as Weight).saturating_mul(r as Weight)) + (212_737_000 as Weight) + // Standard Error: 111_000 + .saturating_add((39_346_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -417,9 +417,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_now(r: u32, ) -> Weight { - (308_717_000 as Weight) - // Standard Error: 128_000 - .saturating_add((40_107_000 as Weight).saturating_mul(r as Weight)) + (211_734_000 as Weight) + // Standard Error: 112_000 + .saturating_add((39_519_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -430,9 +430,9 @@ impl WeightInfo for SubstrateWeight { // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_weight_to_fee(r: u32, ) -> Weight { - (311_389_000 as Weight) - // Standard Error: 160_000 - .saturating_add((99_639_000 as Weight).saturating_mul(r as Weight)) + (212_008_000 as Weight) + // Standard Error: 159_000 + .saturating_add((99_864_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -442,9 +442,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_gas(r: u32, ) -> Weight { - (190_262_000 as Weight) - // Standard Error: 51_000 - .saturating_add((19_003_000 as Weight).saturating_mul(r as Weight)) + (134_321_000 as Weight) + // Standard Error: 49_000 + .saturating_add((19_059_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -454,9 +454,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_input(r: u32, ) -> Weight { - (309_399_000 as Weight) - // Standard Error: 117_000 - .saturating_add((38_996_000 as Weight).saturating_mul(r as Weight)) + (210_459_000 as Weight) + // Standard Error: 102_000 + .saturating_add((39_198_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -466,9 +466,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_input_per_kb(n: u32, ) -> Weight { - (366_814_000 as Weight) - // Standard Error: 9_000 - .saturating_add((8_703_000 as Weight).saturating_mul(n as Weight)) + (272_954_000 as Weight) + // Standard Error: 5_000 + .saturating_add((9_632_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -478,9 +478,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 1]`. fn seal_return(r: u32, ) -> Weight { - (300_238_000 as Weight) - // Standard Error: 95_000 - .saturating_add((1_434_000 as Weight).saturating_mul(r as Weight)) + (205_473_000 as Weight) + // Standard Error: 130_000 + .saturating_add((1_681_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -490,9 +490,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_return_per_kb(n: u32, ) -> Weight { - (302_611_000 as Weight) - // Standard Error: 1_000 - .saturating_add((220_000 as Weight).saturating_mul(n as Weight)) + (207_350_000 as Weight) + // Standard Error: 0 + .saturating_add((183_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -504,9 +504,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32, ) -> Weight { - (304_214_000 as Weight) - // Standard Error: 149_000 - .saturating_add((55_765_000 as Weight).saturating_mul(r as Weight)) + (213_057_000 as Weight) + // Standard Error: 151_000 + .saturating_add((50_517_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -519,9 +519,9 @@ impl WeightInfo for SubstrateWeight { // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_random(r: u32, ) -> Weight { - (310_070_000 as Weight) - // Standard Error: 158_000 - .saturating_add((128_878_000 as Weight).saturating_mul(r as Weight)) + (214_002_000 as Weight) + // Standard Error: 153_000 + .saturating_add((130_262_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -531,9 +531,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_deposit_event(r: u32, ) -> Weight { - (334_672_000 as Weight) - // Standard Error: 299_000 - .saturating_add((227_801_000 as Weight).saturating_mul(r as Weight)) + (214_665_000 as Weight) + // Standard Error: 219_000 + .saturating_add((236_330_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -545,11 +545,11 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 4]`. /// The range of component `n` is `[0, 16]`. fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (561_717_000 as Weight) - // Standard Error: 1_857_000 - .saturating_add((247_510_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 366_000 - .saturating_add((68_991_000 as Weight).saturating_mul(n as Weight)) + (455_398_000 as Weight) + // Standard Error: 1_991_000 + .saturating_add((251_794_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 392_000 + .saturating_add((66_900_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -561,108 +561,108 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_debug_message(r: u32, ) -> Weight { - (196_577_000 as Weight) - // Standard Error: 71_000 - .saturating_add((31_872_000 as Weight).saturating_mul(r as Weight)) + (139_616_000 as Weight) + // Standard Error: 78_000 + .saturating_add((32_049_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_set_storage(r: u32, ) -> Weight { - (347_776_000 as Weight) - // Standard Error: 211_000 - .saturating_add((133_764_000 as Weight).saturating_mul(r as Weight)) + (245_092_000 as Weight) + // Standard Error: 187_000 + .saturating_add((131_710_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_set_storage_per_new_kb(n: u32, ) -> Weight { - (474_366_000 as Weight) - // Standard Error: 224_000 - .saturating_add((37_764_000 as Weight).saturating_mul(n as Weight)) + (372_948_000 as Weight) + // Standard Error: 165_000 + .saturating_add((34_059_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_set_storage_per_old_kb(n: u32, ) -> Weight { - (463_764_000 as Weight) - // Standard Error: 132_000 - .saturating_add((16_476_000 as Weight).saturating_mul(n as Weight)) + (361_086_000 as Weight) + // Standard Error: 137_000 + .saturating_add((17_044_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_clear_storage(r: u32, ) -> Weight { - (322_458_000 as Weight) - // Standard Error: 149_000 - .saturating_add((109_679_000 as Weight).saturating_mul(r as Weight)) + (222_690_000 as Weight) + // Standard Error: 190_000 + .saturating_add((108_740_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_clear_storage_per_kb(n: u32, ) -> Weight { - (408_831_000 as Weight) - // Standard Error: 113_000 - .saturating_add((16_649_000 as Weight).saturating_mul(n as Weight)) + (311_458_000 as Weight) + // Standard Error: 111_000 + .saturating_add((16_426_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_get_storage(r: u32, ) -> Weight { - (328_599_000 as Weight) - // Standard Error: 182_000 - .saturating_add((100_880_000 as Weight).saturating_mul(r as Weight)) + (223_269_000 as Weight) + // Standard Error: 163_000 + .saturating_add((101_915_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (403_332_000 as Weight) - // Standard Error: 114_000 - .saturating_add((16_143_000 as Weight).saturating_mul(n as Weight)) + (304_319_000 as Weight) + // Standard Error: 95_000 + .saturating_add((16_374_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_contains_storage(r: u32, ) -> Weight { - (319_793_000 as Weight) - // Standard Error: 137_000 - .saturating_add((94_377_000 as Weight).saturating_mul(r as Weight)) + (220_970_000 as Weight) + // Standard Error: 154_000 + .saturating_add((92_945_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_contains_storage_per_kb(n: u32, ) -> Weight { - (390_510_000 as Weight) - // Standard Error: 110_000 - .saturating_add((16_691_000 as Weight).saturating_mul(n as Weight)) + (292_713_000 as Weight) + // Standard Error: 101_000 + .saturating_add((16_474_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_take_storage(r: u32, ) -> Weight { - (315_025_000 as Weight) - // Standard Error: 160_000 - .saturating_add((117_861_000 as Weight).saturating_mul(r as Weight)) + (220_159_000 as Weight) + // Standard Error: 171_000 + .saturating_add((119_015_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_take_storage_per_kb(n: u32, ) -> Weight { - (420_096_000 as Weight) - // Standard Error: 148_000 - .saturating_add((16_449_000 as Weight).saturating_mul(n as Weight)) + (322_797_000 as Weight) + // Standard Error: 109_000 + .saturating_add((16_426_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -672,9 +672,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_transfer(r: u32, ) -> Weight { - (248_350_000 as Weight) - // Standard Error: 1_031_000 - .saturating_add((1_427_599_000 as Weight).saturating_mul(r as Weight)) + (137_099_000 as Weight) + // Standard Error: 1_180_000 + .saturating_add((1_465_493_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) @@ -687,8 +687,8 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 20]`. fn seal_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 6_049_000 - .saturating_add((22_839_215_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 3_847_000 + .saturating_add((15_161_464_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -701,8 +701,8 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 20]`. fn seal_delegate_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_354_000 - .saturating_add((22_850_912_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 5_339_000 + .saturating_add((15_079_594_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -713,11 +713,11 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 1]`. /// The range of component `c` is `[0, 1024]`. fn seal_call_per_transfer_clone_kb(t: u32, c: u32, ) -> Weight { - (13_335_819_000 as Weight) - // Standard Error: 17_927_000 - .saturating_add((1_312_865_000 as Weight).saturating_mul(t as Weight)) + (9_155_312_000 as Weight) + // Standard Error: 18_376_000 + .saturating_add((1_400_099_000 as Weight).saturating_mul(t as Weight)) // Standard Error: 7_000 - .saturating_add((8_630_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((9_722_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(85 as Weight)) .saturating_add(T::DbWeight::get().reads((81 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(81 as Weight)) @@ -732,8 +732,8 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 20]`. fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 34_433_000 - .saturating_add((28_960_140_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 33_664_000 + .saturating_add((21_285_172_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().reads((320 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) @@ -748,11 +748,11 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 1]`. /// The range of component `s` is `[0, 960]`. fn seal_instantiate_per_transfer_salt_kb(t: u32, s: u32, ) -> Weight { - (16_466_387_000 as Weight) - // Standard Error: 48_433_000 - .saturating_add((467_404_000 as Weight).saturating_mul(t as Weight)) + (12_084_851_000 as Weight) + // Standard Error: 48_270_000 + .saturating_add((746_701_000 as Weight).saturating_mul(t as Weight)) // Standard Error: 22_000 - .saturating_add((127_185_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((124_017_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(167 as Weight)) .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(165 as Weight)) @@ -764,9 +764,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_sha2_256(r: u32, ) -> Weight { - (306_808_000 as Weight) - // Standard Error: 150_000 - .saturating_add((65_286_000 as Weight).saturating_mul(r as Weight)) + (207_117_000 as Weight) + // Standard Error: 120_000 + .saturating_add((65_616_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -776,9 +776,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (411_569_000 as Weight) - // Standard Error: 38_000 - .saturating_add((359_246_000 as Weight).saturating_mul(n as Weight)) + (298_759_000 as Weight) + // Standard Error: 43_000 + .saturating_add((356_036_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -788,9 +788,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { - (302_327_000 as Weight) - // Standard Error: 135_000 - .saturating_add((74_250_000 as Weight).saturating_mul(r as Weight)) + (211_104_000 as Weight) + // Standard Error: 162_000 + .saturating_add((72_998_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -800,9 +800,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (332_767_000 as Weight) - // Standard Error: 25_000 - .saturating_add((248_922_000 as Weight).saturating_mul(n as Weight)) + (243_076_000 as Weight) + // Standard Error: 31_000 + .saturating_add((245_455_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -812,9 +812,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { - (305_103_000 as Weight) - // Standard Error: 132_000 - .saturating_add((51_191_000 as Weight).saturating_mul(r as Weight)) + (208_430_000 as Weight) + // Standard Error: 114_000 + .saturating_add((51_167_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -824,9 +824,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (392_280_000 as Weight) - // Standard Error: 26_000 - .saturating_add((98_104_000 as Weight).saturating_mul(n as Weight)) + (270_149_000 as Weight) + // Standard Error: 13_000 + .saturating_add((94_962_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -836,9 +836,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { - (306_369_000 as Weight) - // Standard Error: 135_000 - .saturating_add((50_845_000 as Weight).saturating_mul(r as Weight)) + (208_494_000 as Weight) + // Standard Error: 130_000 + .saturating_add((51_502_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -848,9 +848,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (403_087_000 as Weight) - // Standard Error: 16_000 - .saturating_add((97_936_000 as Weight).saturating_mul(n as Weight)) + (271_999_000 as Weight) + // Standard Error: 14_000 + .saturating_add((94_942_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -860,9 +860,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { - (434_609_000 as Weight) - // Standard Error: 1_085_000 - .saturating_add((3_074_042_000 as Weight).saturating_mul(r as Weight)) + (348_302_000 as Weight) + // Standard Error: 931_000 + .saturating_add((3_073_199_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -872,9 +872,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { - (314_420_000 as Weight) - // Standard Error: 605_000 - .saturating_add((2_079_506_000 as Weight).saturating_mul(r as Weight)) + (229_870_000 as Weight) + // Standard Error: 572_000 + .saturating_add((2_054_105_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -886,316 +886,316 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 20]`. fn seal_set_code_hash(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 1_662_000 - .saturating_add((765_406_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 1_552_000 + .saturating_add((757_436_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes((79 as Weight).saturating_mul(r as Weight))) } /// The range of component `r` is `[0, 50]`. fn instr_i64const(r: u32, ) -> Weight { - (118_700_000 as Weight) + (74_465_000 as Weight) // Standard Error: 2_000 - .saturating_add((613_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((603_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64load(r: u32, ) -> Weight { - (118_567_000 as Weight) - // Standard Error: 5_000 - .saturating_add((1_332_000 as Weight).saturating_mul(r as Weight)) + (74_280_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_311_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64store(r: u32, ) -> Weight { - (118_956_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_384_000 as Weight).saturating_mul(r as Weight)) + (74_201_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_387_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { - (118_759_000 as Weight) - // Standard Error: 6_000 - .saturating_add((1_772_000 as Weight).saturating_mul(r as Weight)) + (74_062_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_777_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { - (118_570_000 as Weight) - // Standard Error: 6_000 - .saturating_add((1_949_000 as Weight).saturating_mul(r as Weight)) + (74_074_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_953_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { - (118_612_000 as Weight) - // Standard Error: 4_000 - .saturating_add((927_000 as Weight).saturating_mul(r as Weight)) + (73_914_000 as Weight) + // Standard Error: 2_000 + .saturating_add((939_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { - (117_783_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_447_000 as Weight).saturating_mul(r as Weight)) + (73_658_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_434_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { - (118_210_000 as Weight) + (73_228_000 as Weight) // Standard Error: 8_000 - .saturating_add((1_593_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_629_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { - (120_986_000 as Weight) - // Standard Error: 1_000 + (76_399_000 as Weight) + // Standard Error: 0 .saturating_add((4_000 as Weight).saturating_mul(e as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { - (120_549_000 as Weight) - // Standard Error: 18_000 - .saturating_add((6_972_000 as Weight).saturating_mul(r as Weight)) + (74_937_000 as Weight) + // Standard Error: 9_000 + .saturating_add((7_088_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { - (133_249_000 as Weight) + (87_295_000 as Weight) // Standard Error: 17_000 - .saturating_add((9_175_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((9_133_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (142_686_000 as Weight) + (98_101_000 as Weight) // Standard Error: 1_000 - .saturating_add((470_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((471_000 as Weight).saturating_mul(p as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { - (119_505_000 as Weight) - // Standard Error: 3_000 - .saturating_add((620_000 as Weight).saturating_mul(r as Weight)) + (74_727_000 as Weight) + // Standard Error: 1_000 + .saturating_add((624_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { - (119_589_000 as Weight) - // Standard Error: 6_000 - .saturating_add((673_000 as Weight).saturating_mul(r as Weight)) + (74_481_000 as Weight) + // Standard Error: 3_000 + .saturating_add((707_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { - (119_353_000 as Weight) - // Standard Error: 2_000 - .saturating_add((903_000 as Weight).saturating_mul(r as Weight)) + (74_484_000 as Weight) + // Standard Error: 1_000 + .saturating_add((918_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { - (121_499_000 as Weight) - // Standard Error: 5_000 - .saturating_add((1_177_000 as Weight).saturating_mul(r as Weight)) + (77_085_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_197_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { - (121_197_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) + (77_052_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_366_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { - (118_556_000 as Weight) - // Standard Error: 3_000 - .saturating_add((670_000 as Weight).saturating_mul(r as Weight)) + (74_392_000 as Weight) + // Standard Error: 2_000 + .saturating_add((665_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 1]`. fn instr_memory_grow(r: u32, ) -> Weight { - (118_055_000 as Weight) - // Standard Error: 2_014_000 - .saturating_add((220_700_000 as Weight).saturating_mul(r as Weight)) + (75_342_000 as Weight) + // Standard Error: 46_000 + .saturating_add((177_994_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { - (119_038_000 as Weight) - // Standard Error: 8_000 - .saturating_add((894_000 as Weight).saturating_mul(r as Weight)) + (74_090_000 as Weight) + // Standard Error: 2_000 + .saturating_add((893_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { - (118_594_000 as Weight) - // Standard Error: 2_000 - .saturating_add((892_000 as Weight).saturating_mul(r as Weight)) + (74_474_000 as Weight) + // Standard Error: 3_000 + .saturating_add((882_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { - (118_816_000 as Weight) - // Standard Error: 3_000 + (74_326_000 as Weight) + // Standard Error: 4_000 .saturating_add((886_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { - (118_500_000 as Weight) - // Standard Error: 2_000 - .saturating_add((902_000 as Weight).saturating_mul(r as Weight)) + (74_503_000 as Weight) + // Standard Error: 1_000 + .saturating_add((888_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { - (118_809_000 as Weight) - // Standard Error: 3_000 - .saturating_add((864_000 as Weight).saturating_mul(r as Weight)) + (74_178_000 as Weight) + // Standard Error: 2_000 + .saturating_add((888_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { - (118_818_000 as Weight) - // Standard Error: 6_000 - .saturating_add((869_000 as Weight).saturating_mul(r as Weight)) + (73_789_000 as Weight) + // Standard Error: 2_000 + .saturating_add((898_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { - (118_380_000 as Weight) - // Standard Error: 6_000 - .saturating_add((904_000 as Weight).saturating_mul(r as Weight)) + (74_202_000 as Weight) + // Standard Error: 5_000 + .saturating_add((892_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { - (118_778_000 as Weight) + (74_191_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_342_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { - (118_903_000 as Weight) + (73_945_000 as Weight) // Standard Error: 3_000 - .saturating_add((1_344_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { - (119_016_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_338_000 as Weight).saturating_mul(r as Weight)) + (74_139_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_355_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { - (116_768_000 as Weight) - // Standard Error: 54_000 - .saturating_add((1_951_000 as Weight).saturating_mul(r as Weight)) + (74_165_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { - (118_875_000 as Weight) - // Standard Error: 5_000 - .saturating_add((1_345_000 as Weight).saturating_mul(r as Weight)) + (73_898_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_362_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { - (118_743_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) + (74_078_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_364_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { - (118_703_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_349_000 as Weight).saturating_mul(r as Weight)) + (73_847_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { - (118_502_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_364_000 as Weight).saturating_mul(r as Weight)) + (74_166_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_362_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { - (118_646_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_345_000 as Weight).saturating_mul(r as Weight)) + (73_950_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_363_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { - (118_815_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_341_000 as Weight).saturating_mul(r as Weight)) + (73_652_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { - (118_600_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) + (73_841_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_343_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { - (118_926_000 as Weight) + (74_117_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_318_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_328_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { - (118_787_000 as Weight) + (73_893_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_321_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_339_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { - (118_845_000 as Weight) + (73_803_000 as Weight) // Standard Error: 3_000 - .saturating_add((1_989_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_028_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { - (119_150_000 as Weight) - // Standard Error: 9_000 - .saturating_add((2_059_000 as Weight).saturating_mul(r as Weight)) + (74_184_000 as Weight) + // Standard Error: 2_000 + .saturating_add((2_057_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { - (118_762_000 as Weight) - // Standard Error: 7_000 - .saturating_add((2_007_000 as Weight).saturating_mul(r as Weight)) + (74_084_000 as Weight) + // Standard Error: 5_000 + .saturating_add((2_025_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { - (118_587_000 as Weight) + (74_069_000 as Weight) // Standard Error: 3_000 - .saturating_add((2_021_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_027_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { - (118_437_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_335_000 as Weight).saturating_mul(r as Weight)) + (74_006_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_333_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { - (118_773_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) + (73_959_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_335_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { - (118_843_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) + (74_062_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { - (118_562_000 as Weight) + (74_023_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_354_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { - (118_798_000 as Weight) - // Standard Error: 5_000 - .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) + (74_261_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { - (118_497_000 as Weight) + (73_843_000 as Weight) // Standard Error: 3_000 - .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_368_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { - (118_784_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_341_000 as Weight).saturating_mul(r as Weight)) + (74_173_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_357_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { - (118_921_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_338_000 as Weight).saturating_mul(r as Weight)) + (73_827_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) } } @@ -1203,15 +1203,15 @@ impl WeightInfo for SubstrateWeight { impl WeightInfo for () { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_process_deletion_queue_batch() -> Weight { - (1_552_000 as Weight) + (1_648_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32, ) -> Weight { - (7_539_000 as Weight) + (7_105_000 as Weight) // Standard Error: 0 - .saturating_add((873_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((879_000 as Weight).saturating_mul(k as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(k as Weight))) @@ -1220,8 +1220,8 @@ impl WeightInfo for () { /// The range of component `q` is `[0, 1024]`. fn on_initialize_per_queue_item(q: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_000 - .saturating_add((1_967_000 as Weight).saturating_mul(q as Weight)) + // Standard Error: 4_000 + .saturating_add((1_874_000 as Weight).saturating_mul(q as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1229,9 +1229,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn reinstrument(c: u32, ) -> Weight { - (25_242_000 as Weight) + (17_962_000 as Weight) // Standard Error: 0 - .saturating_add((48_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1241,9 +1241,9 @@ impl WeightInfo for () { // Storage: System Account (r:1 w:1) /// The range of component `c` is `[0, 131072]`. fn call_with_code_per_byte(c: u32, ) -> Weight { - (303_218_000 as Weight) + (207_433_000 as Weight) // Standard Error: 0 - .saturating_add((54_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((53_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } @@ -1257,9 +1257,9 @@ impl WeightInfo for () { /// The range of component `c` is `[0, 64226]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (352_997_000 as Weight) + (218_094_000 as Weight) // Standard Error: 0 - .saturating_add((127_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((126_000 as Weight).saturating_mul(c as Weight)) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) @@ -1273,7 +1273,7 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `s` is `[0, 1048576]`. fn instantiate(s: u32, ) -> Weight { - (233_624_000 as Weight) + (184_236_000 as Weight) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) @@ -1284,7 +1284,7 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: System Account (r:1 w:1) fn call() -> Weight { - (197_235_000 as Weight) + (148_764_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } @@ -1293,9 +1293,9 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn upload_code(c: u32, ) -> Weight { - (54_940_000 as Weight) + (48_474_000 as Weight) // Standard Error: 0 - .saturating_add((50_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } @@ -1303,14 +1303,14 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - (29_185_000 as Weight) + (29_301_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:2 w:2) fn set_code() -> Weight { - (27_016_000 as Weight) + (26_779_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } @@ -1320,9 +1320,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_caller(r: u32, ) -> Weight { - (308_072_000 as Weight) - // Standard Error: 115_000 - .saturating_add((40_651_000 as Weight).saturating_mul(r as Weight)) + (210_501_000 as Weight) + // Standard Error: 96_000 + .saturating_add((40_406_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1332,9 +1332,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_is_contract(r: u32, ) -> Weight { - (194_111_000 as Weight) - // Standard Error: 676_000 - .saturating_add((303_123_000 as Weight).saturating_mul(r as Weight)) + (98_460_000 as Weight) + // Standard Error: 717_000 + .saturating_add((302_159_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1345,9 +1345,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_code_hash(r: u32, ) -> Weight { - (208_761_000 as Weight) - // Standard Error: 754_000 - .saturating_add((355_429_000 as Weight).saturating_mul(r as Weight)) + (100_103_000 as Weight) + // Standard Error: 687_000 + .saturating_add((360_394_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1358,9 +1358,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_own_code_hash(r: u32, ) -> Weight { - (306_378_000 as Weight) - // Standard Error: 132_000 - .saturating_add((44_647_000 as Weight).saturating_mul(r as Weight)) + (210_131_000 as Weight) + // Standard Error: 102_000 + .saturating_add((43_916_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1370,9 +1370,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_caller_is_origin(r: u32, ) -> Weight { - (304_441_000 as Weight) - // Standard Error: 92_000 - .saturating_add((16_802_000 as Weight).saturating_mul(r as Weight)) + (208_603_000 as Weight) + // Standard Error: 56_000 + .saturating_add((16_961_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1382,9 +1382,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_address(r: u32, ) -> Weight { - (305_807_000 as Weight) - // Standard Error: 111_000 - .saturating_add((40_393_000 as Weight).saturating_mul(r as Weight)) + (209_735_000 as Weight) + // Standard Error: 102_000 + .saturating_add((40_378_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1394,9 +1394,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_gas_left(r: u32, ) -> Weight { - (309_122_000 as Weight) - // Standard Error: 139_000 - .saturating_add((40_234_000 as Weight).saturating_mul(r as Weight)) + (213_032_000 as Weight) + // Standard Error: 112_000 + .saturating_add((39_716_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1406,9 +1406,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_balance(r: u32, ) -> Weight { - (316_857_000 as Weight) - // Standard Error: 142_000 - .saturating_add((112_644_000 as Weight).saturating_mul(r as Weight)) + (216_266_000 as Weight) + // Standard Error: 149_000 + .saturating_add((117_042_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1418,9 +1418,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_value_transferred(r: u32, ) -> Weight { - (308_151_000 as Weight) - // Standard Error: 129_000 - .saturating_add((40_587_000 as Weight).saturating_mul(r as Weight)) + (210_124_000 as Weight) + // Standard Error: 112_000 + .saturating_add((39_859_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1430,9 +1430,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_minimum_balance(r: u32, ) -> Weight { - (306_543_000 as Weight) - // Standard Error: 123_000 - .saturating_add((40_334_000 as Weight).saturating_mul(r as Weight)) + (210_515_000 as Weight) + // Standard Error: 117_000 + .saturating_add((40_007_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1442,9 +1442,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_block_number(r: u32, ) -> Weight { - (307_558_000 as Weight) - // Standard Error: 131_000 - .saturating_add((40_208_000 as Weight).saturating_mul(r as Weight)) + (212_737_000 as Weight) + // Standard Error: 111_000 + .saturating_add((39_346_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1454,9 +1454,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_now(r: u32, ) -> Weight { - (308_717_000 as Weight) - // Standard Error: 128_000 - .saturating_add((40_107_000 as Weight).saturating_mul(r as Weight)) + (211_734_000 as Weight) + // Standard Error: 112_000 + .saturating_add((39_519_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1467,9 +1467,9 @@ impl WeightInfo for () { // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_weight_to_fee(r: u32, ) -> Weight { - (311_389_000 as Weight) - // Standard Error: 160_000 - .saturating_add((99_639_000 as Weight).saturating_mul(r as Weight)) + (212_008_000 as Weight) + // Standard Error: 159_000 + .saturating_add((99_864_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1479,9 +1479,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_gas(r: u32, ) -> Weight { - (190_262_000 as Weight) - // Standard Error: 51_000 - .saturating_add((19_003_000 as Weight).saturating_mul(r as Weight)) + (134_321_000 as Weight) + // Standard Error: 49_000 + .saturating_add((19_059_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1491,9 +1491,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_input(r: u32, ) -> Weight { - (309_399_000 as Weight) - // Standard Error: 117_000 - .saturating_add((38_996_000 as Weight).saturating_mul(r as Weight)) + (210_459_000 as Weight) + // Standard Error: 102_000 + .saturating_add((39_198_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1503,9 +1503,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_input_per_kb(n: u32, ) -> Weight { - (366_814_000 as Weight) - // Standard Error: 9_000 - .saturating_add((8_703_000 as Weight).saturating_mul(n as Weight)) + (272_954_000 as Weight) + // Standard Error: 5_000 + .saturating_add((9_632_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1515,9 +1515,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 1]`. fn seal_return(r: u32, ) -> Weight { - (300_238_000 as Weight) - // Standard Error: 95_000 - .saturating_add((1_434_000 as Weight).saturating_mul(r as Weight)) + (205_473_000 as Weight) + // Standard Error: 130_000 + .saturating_add((1_681_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1527,9 +1527,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_return_per_kb(n: u32, ) -> Weight { - (302_611_000 as Weight) - // Standard Error: 1_000 - .saturating_add((220_000 as Weight).saturating_mul(n as Weight)) + (207_350_000 as Weight) + // Standard Error: 0 + .saturating_add((183_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1541,9 +1541,9 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32, ) -> Weight { - (304_214_000 as Weight) - // Standard Error: 149_000 - .saturating_add((55_765_000 as Weight).saturating_mul(r as Weight)) + (213_057_000 as Weight) + // Standard Error: 151_000 + .saturating_add((50_517_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1556,9 +1556,9 @@ impl WeightInfo for () { // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_random(r: u32, ) -> Weight { - (310_070_000 as Weight) - // Standard Error: 158_000 - .saturating_add((128_878_000 as Weight).saturating_mul(r as Weight)) + (214_002_000 as Weight) + // Standard Error: 153_000 + .saturating_add((130_262_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1568,9 +1568,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_deposit_event(r: u32, ) -> Weight { - (334_672_000 as Weight) - // Standard Error: 299_000 - .saturating_add((227_801_000 as Weight).saturating_mul(r as Weight)) + (214_665_000 as Weight) + // Standard Error: 219_000 + .saturating_add((236_330_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1582,11 +1582,11 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 4]`. /// The range of component `n` is `[0, 16]`. fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (561_717_000 as Weight) - // Standard Error: 1_857_000 - .saturating_add((247_510_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 366_000 - .saturating_add((68_991_000 as Weight).saturating_mul(n as Weight)) + (455_398_000 as Weight) + // Standard Error: 1_991_000 + .saturating_add((251_794_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 392_000 + .saturating_add((66_900_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1598,108 +1598,108 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_debug_message(r: u32, ) -> Weight { - (196_577_000 as Weight) - // Standard Error: 71_000 - .saturating_add((31_872_000 as Weight).saturating_mul(r as Weight)) + (139_616_000 as Weight) + // Standard Error: 78_000 + .saturating_add((32_049_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_set_storage(r: u32, ) -> Weight { - (347_776_000 as Weight) - // Standard Error: 211_000 - .saturating_add((133_764_000 as Weight).saturating_mul(r as Weight)) + (245_092_000 as Weight) + // Standard Error: 187_000 + .saturating_add((131_710_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_set_storage_per_new_kb(n: u32, ) -> Weight { - (474_366_000 as Weight) - // Standard Error: 224_000 - .saturating_add((37_764_000 as Weight).saturating_mul(n as Weight)) + (372_948_000 as Weight) + // Standard Error: 165_000 + .saturating_add((34_059_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_set_storage_per_old_kb(n: u32, ) -> Weight { - (463_764_000 as Weight) - // Standard Error: 132_000 - .saturating_add((16_476_000 as Weight).saturating_mul(n as Weight)) + (361_086_000 as Weight) + // Standard Error: 137_000 + .saturating_add((17_044_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_clear_storage(r: u32, ) -> Weight { - (322_458_000 as Weight) - // Standard Error: 149_000 - .saturating_add((109_679_000 as Weight).saturating_mul(r as Weight)) + (222_690_000 as Weight) + // Standard Error: 190_000 + .saturating_add((108_740_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_clear_storage_per_kb(n: u32, ) -> Weight { - (408_831_000 as Weight) - // Standard Error: 113_000 - .saturating_add((16_649_000 as Weight).saturating_mul(n as Weight)) + (311_458_000 as Weight) + // Standard Error: 111_000 + .saturating_add((16_426_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_get_storage(r: u32, ) -> Weight { - (328_599_000 as Weight) - // Standard Error: 182_000 - .saturating_add((100_880_000 as Weight).saturating_mul(r as Weight)) + (223_269_000 as Weight) + // Standard Error: 163_000 + .saturating_add((101_915_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (403_332_000 as Weight) - // Standard Error: 114_000 - .saturating_add((16_143_000 as Weight).saturating_mul(n as Weight)) + (304_319_000 as Weight) + // Standard Error: 95_000 + .saturating_add((16_374_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_contains_storage(r: u32, ) -> Weight { - (319_793_000 as Weight) - // Standard Error: 137_000 - .saturating_add((94_377_000 as Weight).saturating_mul(r as Weight)) + (220_970_000 as Weight) + // Standard Error: 154_000 + .saturating_add((92_945_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_contains_storage_per_kb(n: u32, ) -> Weight { - (390_510_000 as Weight) - // Standard Error: 110_000 - .saturating_add((16_691_000 as Weight).saturating_mul(n as Weight)) + (292_713_000 as Weight) + // Standard Error: 101_000 + .saturating_add((16_474_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `r` is `[0, 20]`. fn seal_take_storage(r: u32, ) -> Weight { - (315_025_000 as Weight) - // Standard Error: 160_000 - .saturating_add((117_861_000 as Weight).saturating_mul(r as Weight)) + (220_159_000 as Weight) + // Standard Error: 171_000 + .saturating_add((119_015_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `n` is `[0, 16]`. fn seal_take_storage_per_kb(n: u32, ) -> Weight { - (420_096_000 as Weight) - // Standard Error: 148_000 - .saturating_add((16_449_000 as Weight).saturating_mul(n as Weight)) + (322_797_000 as Weight) + // Standard Error: 109_000 + .saturating_add((16_426_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } @@ -1709,9 +1709,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_transfer(r: u32, ) -> Weight { - (248_350_000 as Weight) - // Standard Error: 1_031_000 - .saturating_add((1_427_599_000 as Weight).saturating_mul(r as Weight)) + (137_099_000 as Weight) + // Standard Error: 1_180_000 + .saturating_add((1_465_493_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) @@ -1724,8 +1724,8 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 20]`. fn seal_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 6_049_000 - .saturating_add((22_839_215_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 3_847_000 + .saturating_add((15_161_464_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1738,8 +1738,8 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 20]`. fn seal_delegate_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_354_000 - .saturating_add((22_850_912_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 5_339_000 + .saturating_add((15_079_594_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1750,11 +1750,11 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 1]`. /// The range of component `c` is `[0, 1024]`. fn seal_call_per_transfer_clone_kb(t: u32, c: u32, ) -> Weight { - (13_335_819_000 as Weight) - // Standard Error: 17_927_000 - .saturating_add((1_312_865_000 as Weight).saturating_mul(t as Weight)) + (9_155_312_000 as Weight) + // Standard Error: 18_376_000 + .saturating_add((1_400_099_000 as Weight).saturating_mul(t as Weight)) // Standard Error: 7_000 - .saturating_add((8_630_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((9_722_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(85 as Weight)) .saturating_add(RocksDbWeight::get().reads((81 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(81 as Weight)) @@ -1769,8 +1769,8 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 20]`. fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 34_433_000 - .saturating_add((28_960_140_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 33_664_000 + .saturating_add((21_285_172_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().reads((320 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) @@ -1785,11 +1785,11 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 1]`. /// The range of component `s` is `[0, 960]`. fn seal_instantiate_per_transfer_salt_kb(t: u32, s: u32, ) -> Weight { - (16_466_387_000 as Weight) - // Standard Error: 48_433_000 - .saturating_add((467_404_000 as Weight).saturating_mul(t as Weight)) + (12_084_851_000 as Weight) + // Standard Error: 48_270_000 + .saturating_add((746_701_000 as Weight).saturating_mul(t as Weight)) // Standard Error: 22_000 - .saturating_add((127_185_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((124_017_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(167 as Weight)) .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(165 as Weight)) @@ -1801,9 +1801,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_sha2_256(r: u32, ) -> Weight { - (306_808_000 as Weight) - // Standard Error: 150_000 - .saturating_add((65_286_000 as Weight).saturating_mul(r as Weight)) + (207_117_000 as Weight) + // Standard Error: 120_000 + .saturating_add((65_616_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1813,9 +1813,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (411_569_000 as Weight) - // Standard Error: 38_000 - .saturating_add((359_246_000 as Weight).saturating_mul(n as Weight)) + (298_759_000 as Weight) + // Standard Error: 43_000 + .saturating_add((356_036_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1825,9 +1825,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { - (302_327_000 as Weight) - // Standard Error: 135_000 - .saturating_add((74_250_000 as Weight).saturating_mul(r as Weight)) + (211_104_000 as Weight) + // Standard Error: 162_000 + .saturating_add((72_998_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1837,9 +1837,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (332_767_000 as Weight) - // Standard Error: 25_000 - .saturating_add((248_922_000 as Weight).saturating_mul(n as Weight)) + (243_076_000 as Weight) + // Standard Error: 31_000 + .saturating_add((245_455_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1849,9 +1849,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { - (305_103_000 as Weight) - // Standard Error: 132_000 - .saturating_add((51_191_000 as Weight).saturating_mul(r as Weight)) + (208_430_000 as Weight) + // Standard Error: 114_000 + .saturating_add((51_167_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1861,9 +1861,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (392_280_000 as Weight) - // Standard Error: 26_000 - .saturating_add((98_104_000 as Weight).saturating_mul(n as Weight)) + (270_149_000 as Weight) + // Standard Error: 13_000 + .saturating_add((94_962_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1873,9 +1873,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { - (306_369_000 as Weight) - // Standard Error: 135_000 - .saturating_add((50_845_000 as Weight).saturating_mul(r as Weight)) + (208_494_000 as Weight) + // Standard Error: 130_000 + .saturating_add((51_502_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1885,9 +1885,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (403_087_000 as Weight) - // Standard Error: 16_000 - .saturating_add((97_936_000 as Weight).saturating_mul(n as Weight)) + (271_999_000 as Weight) + // Standard Error: 14_000 + .saturating_add((94_942_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1897,9 +1897,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { - (434_609_000 as Weight) - // Standard Error: 1_085_000 - .saturating_add((3_074_042_000 as Weight).saturating_mul(r as Weight)) + (348_302_000 as Weight) + // Standard Error: 931_000 + .saturating_add((3_073_199_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1909,9 +1909,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { - (314_420_000 as Weight) - // Standard Error: 605_000 - .saturating_add((2_079_506_000 as Weight).saturating_mul(r as Weight)) + (229_870_000 as Weight) + // Standard Error: 572_000 + .saturating_add((2_054_105_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1923,315 +1923,315 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 20]`. fn seal_set_code_hash(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 1_662_000 - .saturating_add((765_406_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 1_552_000 + .saturating_add((757_436_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes((79 as Weight).saturating_mul(r as Weight))) } /// The range of component `r` is `[0, 50]`. fn instr_i64const(r: u32, ) -> Weight { - (118_700_000 as Weight) + (74_465_000 as Weight) // Standard Error: 2_000 - .saturating_add((613_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((603_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64load(r: u32, ) -> Weight { - (118_567_000 as Weight) - // Standard Error: 5_000 - .saturating_add((1_332_000 as Weight).saturating_mul(r as Weight)) + (74_280_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_311_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64store(r: u32, ) -> Weight { - (118_956_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_384_000 as Weight).saturating_mul(r as Weight)) + (74_201_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_387_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { - (118_759_000 as Weight) - // Standard Error: 6_000 - .saturating_add((1_772_000 as Weight).saturating_mul(r as Weight)) + (74_062_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_777_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { - (118_570_000 as Weight) - // Standard Error: 6_000 - .saturating_add((1_949_000 as Weight).saturating_mul(r as Weight)) + (74_074_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_953_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { - (118_612_000 as Weight) - // Standard Error: 4_000 - .saturating_add((927_000 as Weight).saturating_mul(r as Weight)) + (73_914_000 as Weight) + // Standard Error: 2_000 + .saturating_add((939_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { - (117_783_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_447_000 as Weight).saturating_mul(r as Weight)) + (73_658_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_434_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { - (118_210_000 as Weight) + (73_228_000 as Weight) // Standard Error: 8_000 - .saturating_add((1_593_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_629_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { - (120_986_000 as Weight) - // Standard Error: 1_000 + (76_399_000 as Weight) + // Standard Error: 0 .saturating_add((4_000 as Weight).saturating_mul(e as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { - (120_549_000 as Weight) - // Standard Error: 18_000 - .saturating_add((6_972_000 as Weight).saturating_mul(r as Weight)) + (74_937_000 as Weight) + // Standard Error: 9_000 + .saturating_add((7_088_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { - (133_249_000 as Weight) + (87_295_000 as Weight) // Standard Error: 17_000 - .saturating_add((9_175_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((9_133_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (142_686_000 as Weight) + (98_101_000 as Weight) // Standard Error: 1_000 - .saturating_add((470_000 as Weight).saturating_mul(p as Weight)) + .saturating_add((471_000 as Weight).saturating_mul(p as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { - (119_505_000 as Weight) - // Standard Error: 3_000 - .saturating_add((620_000 as Weight).saturating_mul(r as Weight)) + (74_727_000 as Weight) + // Standard Error: 1_000 + .saturating_add((624_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { - (119_589_000 as Weight) - // Standard Error: 6_000 - .saturating_add((673_000 as Weight).saturating_mul(r as Weight)) + (74_481_000 as Weight) + // Standard Error: 3_000 + .saturating_add((707_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { - (119_353_000 as Weight) - // Standard Error: 2_000 - .saturating_add((903_000 as Weight).saturating_mul(r as Weight)) + (74_484_000 as Weight) + // Standard Error: 1_000 + .saturating_add((918_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { - (121_499_000 as Weight) - // Standard Error: 5_000 - .saturating_add((1_177_000 as Weight).saturating_mul(r as Weight)) + (77_085_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_197_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { - (121_197_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) + (77_052_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_366_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { - (118_556_000 as Weight) - // Standard Error: 3_000 - .saturating_add((670_000 as Weight).saturating_mul(r as Weight)) + (74_392_000 as Weight) + // Standard Error: 2_000 + .saturating_add((665_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 1]`. fn instr_memory_grow(r: u32, ) -> Weight { - (118_055_000 as Weight) - // Standard Error: 2_014_000 - .saturating_add((220_700_000 as Weight).saturating_mul(r as Weight)) + (75_342_000 as Weight) + // Standard Error: 46_000 + .saturating_add((177_994_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { - (119_038_000 as Weight) - // Standard Error: 8_000 - .saturating_add((894_000 as Weight).saturating_mul(r as Weight)) + (74_090_000 as Weight) + // Standard Error: 2_000 + .saturating_add((893_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { - (118_594_000 as Weight) - // Standard Error: 2_000 - .saturating_add((892_000 as Weight).saturating_mul(r as Weight)) + (74_474_000 as Weight) + // Standard Error: 3_000 + .saturating_add((882_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { - (118_816_000 as Weight) - // Standard Error: 3_000 + (74_326_000 as Weight) + // Standard Error: 4_000 .saturating_add((886_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { - (118_500_000 as Weight) - // Standard Error: 2_000 - .saturating_add((902_000 as Weight).saturating_mul(r as Weight)) + (74_503_000 as Weight) + // Standard Error: 1_000 + .saturating_add((888_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { - (118_809_000 as Weight) - // Standard Error: 3_000 - .saturating_add((864_000 as Weight).saturating_mul(r as Weight)) + (74_178_000 as Weight) + // Standard Error: 2_000 + .saturating_add((888_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { - (118_818_000 as Weight) - // Standard Error: 6_000 - .saturating_add((869_000 as Weight).saturating_mul(r as Weight)) + (73_789_000 as Weight) + // Standard Error: 2_000 + .saturating_add((898_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { - (118_380_000 as Weight) - // Standard Error: 6_000 - .saturating_add((904_000 as Weight).saturating_mul(r as Weight)) + (74_202_000 as Weight) + // Standard Error: 5_000 + .saturating_add((892_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { - (118_778_000 as Weight) + (74_191_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_342_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { - (118_903_000 as Weight) + (73_945_000 as Weight) // Standard Error: 3_000 - .saturating_add((1_344_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { - (119_016_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_338_000 as Weight).saturating_mul(r as Weight)) + (74_139_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_355_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { - (116_768_000 as Weight) - // Standard Error: 54_000 - .saturating_add((1_951_000 as Weight).saturating_mul(r as Weight)) + (74_165_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { - (118_875_000 as Weight) - // Standard Error: 5_000 - .saturating_add((1_345_000 as Weight).saturating_mul(r as Weight)) + (73_898_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_362_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { - (118_743_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) + (74_078_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_364_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { - (118_703_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_349_000 as Weight).saturating_mul(r as Weight)) + (73_847_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { - (118_502_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_364_000 as Weight).saturating_mul(r as Weight)) + (74_166_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_362_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { - (118_646_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_345_000 as Weight).saturating_mul(r as Weight)) + (73_950_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_363_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { - (118_815_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_341_000 as Weight).saturating_mul(r as Weight)) + (73_652_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { - (118_600_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) + (73_841_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_343_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { - (118_926_000 as Weight) + (74_117_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_318_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_328_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { - (118_787_000 as Weight) + (73_893_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_321_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_339_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { - (118_845_000 as Weight) + (73_803_000 as Weight) // Standard Error: 3_000 - .saturating_add((1_989_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_028_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { - (119_150_000 as Weight) - // Standard Error: 9_000 - .saturating_add((2_059_000 as Weight).saturating_mul(r as Weight)) + (74_184_000 as Weight) + // Standard Error: 2_000 + .saturating_add((2_057_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { - (118_762_000 as Weight) - // Standard Error: 7_000 - .saturating_add((2_007_000 as Weight).saturating_mul(r as Weight)) + (74_084_000 as Weight) + // Standard Error: 5_000 + .saturating_add((2_025_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { - (118_587_000 as Weight) + (74_069_000 as Weight) // Standard Error: 3_000 - .saturating_add((2_021_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_027_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { - (118_437_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_335_000 as Weight).saturating_mul(r as Weight)) + (74_006_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_333_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { - (118_773_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) + (73_959_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_335_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { - (118_843_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_322_000 as Weight).saturating_mul(r as Weight)) + (74_062_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { - (118_562_000 as Weight) + (74_023_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_354_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { - (118_798_000 as Weight) - // Standard Error: 5_000 - .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) + (74_261_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { - (118_497_000 as Weight) + (73_843_000 as Weight) // Standard Error: 3_000 - .saturating_add((1_351_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_368_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { - (118_784_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_341_000 as Weight).saturating_mul(r as Weight)) + (74_173_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_357_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { - (118_921_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_338_000 as Weight).saturating_mul(r as Weight)) + (73_827_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) } } From 7b3ddf8658add194ed7596a16001e3f06ab7c16c Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sat, 11 Jun 2022 13:26:27 +0300 Subject: [PATCH 33/63] refactoring --- frame/contracts/src/benchmarking/mod.rs | 2 +- frame/contracts/src/exec.rs | 20 ++++++++++---------- frame/contracts/src/lib.rs | 2 +- frame/contracts/src/storage.rs | 6 +++--- frame/contracts/src/tests.rs | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 8b17ef3633f1a..db8c63a0b5835 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -137,7 +137,7 @@ where for item in items { Storage::::write( &info.trie_id, - item.0 as FixSizedKey, + &item.0 as &FixSizedKey, Some(item.1.clone()), None, false, diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 38a0cdbfcd947..ec7e1e9335182 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -57,20 +57,20 @@ pub trait StorageKey where T: Config, { - fn hash(self) -> Vec; + fn hash(&self) -> Vec; } impl StorageKey for FixSizedKey { - fn hash(self) -> Vec { + fn hash(&self) -> Vec { blake2_256(self.as_slice()).to_vec() } } -impl StorageKey for &VarSizedKey +impl StorageKey for VarSizedKey where T: Config, { - fn hash(self) -> Vec { + fn hash(&self) -> Vec { Blake2_128Concat::hash(self.as_slice()) } } @@ -1140,19 +1140,19 @@ where } fn get_storage(&mut self, key: &FixSizedKey) -> Option> { - Storage::::read(&self.top_frame_mut().contract_info().trie_id, key.clone()) + Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) } fn get_storage_transparent(&mut self, key: &VarSizedKey) -> Option> { - Storage::::read(&self.top_frame_mut().contract_info().trie_id, &key.clone()) + Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) } fn get_storage_size(&mut self, key: &FixSizedKey) -> Option { - Storage::::size(&self.top_frame_mut().contract_info().trie_id, key.clone()) + Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) } fn get_storage_size_transparent(&mut self, key: &VarSizedKey) -> Option { - Storage::::size(&self.top_frame_mut().contract_info().trie_id, &key.clone()) + Storage::::size(&self.top_frame_mut().contract_info().trie_id, key) } fn set_storage( @@ -1164,7 +1164,7 @@ where let frame = self.top_frame_mut(); Storage::::write( &frame.contract_info.get(&frame.account_id).trie_id, - key.clone(), + key, value, Some(&mut frame.nested_storage), take_old, @@ -1180,7 +1180,7 @@ where let frame = self.top_frame_mut(); Storage::::write( &frame.contract_info.get(&frame.account_id).trie_id, - &key.clone(), + key, value, Some(&mut frame.nested_storage), take_old, diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 90d3408ffe8e1..b068d02e76939 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -946,7 +946,7 @@ where } /// Query storage of a specified contract under a specified key. - pub fn get_storage>(address: T::AccountId, key: K) -> GetStorageResult { + pub fn get_storage>(address: T::AccountId, key: &K) -> GetStorageResult { let contract_info = ContractInfoOf::::get(&address).ok_or(ContractAccessError::DoesntExist)?; diff --git a/frame/contracts/src/storage.rs b/frame/contracts/src/storage.rs index 0ada1a0f7298c..01c809da8675e 100644 --- a/frame/contracts/src/storage.rs +++ b/frame/contracts/src/storage.rs @@ -124,7 +124,7 @@ where /// /// The read is performed from the `trie_id` only. The `address` is not necessary. If the /// contract doesn't store under the given `key` `None` is returned. - pub fn read>(trie_id: &TrieId, key: K) -> Option> { + pub fn read>(trie_id: &TrieId, key: &K) -> Option> { child::get_raw(&child_trie_info(trie_id), key.hash().as_slice()) } @@ -132,7 +132,7 @@ where /// /// Returns `None` if the `key` wasn't previously set by `set_storage` or /// was deleted. - pub fn size>(trie_id: &TrieId, key: K) -> Option { + pub fn size>(trie_id: &TrieId, key: &K) -> Option { child::len(&child_trie_info(trie_id), key.hash().as_slice()) } @@ -145,7 +145,7 @@ where /// is supplied. It should only be absent for testing or benchmarking code. pub fn write>( trie_id: &TrieId, - key: K, + key: &K, new_value: Option>, storage_meter: Option<&mut meter::NestedMeter>, take: bool, diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 2558bda440ad2..bbac18142a658 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -1726,7 +1726,7 @@ fn lazy_removal_partial_remove_works() { for val in &vals { Storage::::write( &info.trie_id, - val.0 as FixSizedKey, + &val.0 as &FixSizedKey, Some(val.2.clone()), None, false, @@ -1912,7 +1912,7 @@ fn lazy_removal_does_not_use_all_weight() { for val in &vals { Storage::::write( &info.trie_id, - val.0 as FixSizedKey, + &val.0 as &FixSizedKey, Some(val.2.clone()), None, false, From 62735c2e12b1f44700e7ecaf7c21ab4e79a9f4c7 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sat, 11 Jun 2022 13:40:17 +0300 Subject: [PATCH 34/63] fix to runtime api --- bin/node/runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 70ba02c8521d6..8f8d4958d6e44 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1938,7 +1938,7 @@ impl_runtime_apis! { address: AccountId, key: [u8; 32], ) -> pallet_contracts_primitives::GetStorageResult { - Contracts::get_storage(address, key) + Contracts::get_storage(address, &key) } } From d5f240cec0616ed1a448560cecb98070092387b1 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Sat, 11 Jun 2022 14:07:31 +0300 Subject: [PATCH 35/63] ci fix --- bin/node/executor/tests/basic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 7e521034d97af..673c4589a5509 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -733,7 +733,7 @@ fn deploying_wasm_contract_should_work() { // It does not matter that the storage item itself does not exist. assert!(&pallet_contracts::Pallet::::get_storage( addr, - pallet_contracts::FixSizedKey::default() + &pallet_contracts::FixSizedKey::default() ) .is_ok()); }); From 929ec62e3bdfbf01d325ee3522724dc08acf4f16 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 14 Jun 2022 14:58:09 +0300 Subject: [PATCH 36/63] ctx.get_storage() factored out --- frame/contracts/src/wasm/runtime.rs | 72 ++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 709d34b7fe80d..62d0a4afe6b81 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -771,6 +771,55 @@ where Ok(outcome.old_len_with_sentinel()) } + fn get_storage( + &mut self, + 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.read_sandbox_memory(key_ptr, key_type.len::()?)?; + match key_type { + KeyType::Fix => + if let Some(value) = self.ext.get_storage( + &FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + ) { + self.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); + self.write_sandbox_output( + out_ptr, + out_len_ptr, + &value, + false, + already_charged, + )?; + Ok(ReturnCode::Success) + } else { + self.adjust_gas(charged, RuntimeCosts::GetStorage(0)); + Ok(ReturnCode::KeyNotFound) + }, + KeyType::Variable(_) => { + if let Some(value) = self.ext.get_storage_transparent( + &VarSizedKey::::try_from(key) + .map_err(|_| Error::::DecodingFailed)?, + ) { + self.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); + self.write_sandbox_output( + out_ptr, + out_len_ptr, + &value, + false, + already_charged, + )?; + Ok(ReturnCode::Success) + } else { + self.adjust_gas(charged, RuntimeCosts::GetStorage(0)); + Ok(ReturnCode::KeyNotFound) + } + }, + } + } + fn call( &mut self, flags: CallFlags, @@ -993,17 +1042,7 @@ define_env!(Env, , // // `ReturnCode::KeyNotFound` [seal0] seal_get_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { - let charged = ctx.charge_gas(RuntimeCosts::GetStorage(ctx.ext.max_value_size()))?; - let mut key: FixSizedKey = [0; 32]; - ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - if let Some(value) = ctx.ext.get_storage(&key) { - ctx.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); - ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; - Ok(ReturnCode::Success) - } else { - ctx.adjust_gas(charged, RuntimeCosts::GetStorage(0)); - Ok(ReturnCode::KeyNotFound) - } + ctx.get_storage(KeyType::Fix, key_ptr, out_ptr, out_len_ptr).map_err(Into::into) }, // Retrieve the value under the given key from storage. @@ -1025,16 +1064,7 @@ define_env!(Env, , // // `ReturnCode::KeyNotFound` [__unstable__] seal_get_storage(ctx, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { - let charged = ctx.charge_gas(RuntimeCosts::GetStorage(ctx.ext.max_value_size()))?; - let key = ctx.read_sandbox_memory(key_ptr, key_len)?; - if let Some(value) = ctx.ext.get_storage_transparent(&VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?) { - ctx.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); - ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; - Ok(ReturnCode::Success) - } else { - ctx.adjust_gas(charged, RuntimeCosts::GetStorage(0)); - Ok(ReturnCode::KeyNotFound) - } + ctx.get_storage(KeyType::Variable(key_len), key_ptr, out_ptr, out_len_ptr).map_err(Into::into) }, // Checks whether there is a value stored under the given key. From e81d2c288e5596f4e34c936319dc8cb91f952fde Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 14 Jun 2022 15:14:16 +0300 Subject: [PATCH 37/63] ctx.contains_storage() factored out --- frame/contracts/src/wasm/runtime.rs | 61 +++++++++++++++++------------ 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 62d0a4afe6b81..17b7ffc5f10f8 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -820,6 +820,36 @@ where } } + fn contains_storage(&mut self, key_type: KeyType, key_ptr: u32) -> Result { + let charged = self.charge_gas(RuntimeCosts::ContainsStorage(self.ext.max_value_size()))?; + let key = self.read_sandbox_memory(key_ptr, key_type.len::()?)?; + match key_type { + KeyType::Fix => { + if let Some(len) = self.ext.get_storage_size( + &FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + ) { + self.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); + Ok(len) + } else { + self.adjust_gas(charged, RuntimeCosts::ContainsStorage(0)); + Ok(SENTINEL) + } + }, + KeyType::Variable(_) => { + if let Some(len) = self.ext.get_storage_size_transparent( + &VarSizedKey::::try_from(key) + .map_err(|_| Error::::DecodingFailed)?, + ) { + self.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); + Ok(len) + } else { + self.adjust_gas(charged, RuntimeCosts::ContainsStorage(0)); + Ok(SENTINEL) + } + }, + } + } + fn call( &mut self, flags: CallFlags, @@ -1000,7 +1030,7 @@ define_env!(Env, , // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. [__unstable__] seal_set_storage(ctx, key_ptr: u32, key_len: u32, value_ptr: u32, value_len: u32) -> u32 => { - ctx.set_storage(KeyType::Variable(key_len), key_ptr, value_ptr, value_len).map_err(Into::into) + ctx.set_storage(KeyType::Variable(key_len), key_ptr, value_ptr, value_len) }, // Clear the value at the given key in the contract storage. @@ -1008,7 +1038,7 @@ define_env!(Env, , // Equivalent to the newer version of `seal_clear_storage` with the exception of the return // type. Still a valid thing to call when not interested in the return value. [seal0] seal_clear_storage(ctx, key_ptr: u32) => { - ctx.clear_storage(KeyType::Fix, key_ptr).map(|_| ()).map_err(Into::into) + ctx.clear_storage(KeyType::Fix, key_ptr).map(|_| ()) }, // Clear the value at the given key in the contract storage. @@ -1023,7 +1053,7 @@ define_env!(Env, , // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. [__unstable__] seal_clear_storage(ctx, key_ptr: u32, key_len: u32) -> u32 => { - ctx.clear_storage(KeyType::Variable(key_len), key_ptr).map_err(Into::into) + ctx.clear_storage(KeyType::Variable(key_len), key_ptr) }, // Retrieve the value under the given key from storage. @@ -1042,7 +1072,7 @@ define_env!(Env, , // // `ReturnCode::KeyNotFound` [seal0] seal_get_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { - ctx.get_storage(KeyType::Fix, key_ptr, out_ptr, out_len_ptr).map_err(Into::into) + ctx.get_storage(KeyType::Fix, key_ptr, out_ptr, out_len_ptr) }, // Retrieve the value under the given key from storage. @@ -1064,7 +1094,7 @@ define_env!(Env, , // // `ReturnCode::KeyNotFound` [__unstable__] seal_get_storage(ctx, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { - ctx.get_storage(KeyType::Variable(key_len), key_ptr, out_ptr, out_len_ptr).map_err(Into::into) + ctx.get_storage(KeyType::Variable(key_len), key_ptr, out_ptr, out_len_ptr) }, // Checks whether there is a value stored under the given key. @@ -1081,16 +1111,7 @@ define_env!(Env, , // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. [seal0] seal_contains_storage(ctx, key_ptr: u32) -> u32 => { - let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?; - let mut key: FixSizedKey = [0; 32]; - ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - if let Some(len) = ctx.ext.get_storage_size(&key) { - ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); - Ok(len) - } else { - ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(0)); - Ok(SENTINEL) - } + ctx.contains_storage(KeyType::Fix, key_ptr) }, // Checks whether there is a value stored under the given key. @@ -1107,15 +1128,7 @@ define_env!(Env, , // Returns the size of the pre-existing value at the specified key if any. Otherwise // `SENTINEL` is returned as a sentinel value. [__unstable__] seal_contains_storage(ctx, key_ptr: u32, key_len: u32) -> u32 => { - let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?; - let key = ctx.read_sandbox_memory(key_ptr, key_len)?; - if let Some(len) = ctx.ext.get_storage_size_transparent(&VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?) { - ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); - Ok(len) - } else { - ctx.adjust_gas(charged, RuntimeCosts::ContainsStorage(0)); - Ok(SENTINEL) - } + ctx.contains_storage(KeyType::Variable(key_len), key_ptr) }, // Retrieve and remove the value under the given key from storage. From 52a6982e4cb79260df51147e5ca9319c91d13d4d Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 14 Jun 2022 15:29:33 +0300 Subject: [PATCH 38/63] number of batches reduced for transparent hashing storage benchmarks --- frame/contracts/src/benchmarking/mod.rs | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index db8c63a0b5835..954aca438fcaa 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -909,9 +909,9 @@ benchmarks! { // it at a virgin key. #[skip_meta] seal_set_storage { - let r in 0 .. API_BENCHMARK_BATCHES; + let r in 0 .. API_BENCHMARK_BATCHES/2; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -961,9 +961,9 @@ benchmarks! { #[skip_meta] seal_set_storage_per_new_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 1024; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1013,9 +1013,9 @@ benchmarks! { #[skip_meta] seal_set_storage_per_old_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 1024; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1069,9 +1069,9 @@ benchmarks! { // reduce batch size in order to make resulting contract code size less than MaxCodeLen. #[skip_meta] seal_clear_storage { - let r in 0 .. API_BENCHMARK_BATCHES; + let r in 0 .. API_BENCHMARK_BATCHES/2; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1120,9 +1120,9 @@ benchmarks! { #[skip_meta] seal_clear_storage_per_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 1024; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1171,9 +1171,9 @@ benchmarks! { // We make sure that all storage accesses are to unique keys. #[skip_meta] seal_get_storage { - let r in 0 .. API_BENCHMARK_BATCHES; + let r in 0 .. API_BENCHMARK_BATCHES/2; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1229,9 +1229,9 @@ benchmarks! { #[skip_meta] seal_get_storage_per_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 1024; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1288,9 +1288,9 @@ benchmarks! { // We make sure that all storage accesses are to unique keys. #[skip_meta] seal_contains_storage { - let r in 0 .. API_BENCHMARK_BATCHES; + let r in 0 .. API_BENCHMARK_BATCHES/2; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1340,9 +1340,9 @@ benchmarks! { #[skip_meta] seal_contains_storage_per_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 1024; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1391,9 +1391,9 @@ benchmarks! { #[skip_meta] seal_take_storage { - let r in 0 .. API_BENCHMARK_BATCHES; + let r in 0 .. API_BENCHMARK_BATCHES/2; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. r * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); @@ -1449,9 +1449,9 @@ benchmarks! { #[skip_meta] seal_take_storage_per_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 1024; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; let max_key_len = T::MaxStorageKeyLen::get(); - let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE/2) + let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); From 456f4c97289e7b54c1be04d196b43dcf26bf7f1d Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 14 Jun 2022 17:31:16 +0300 Subject: [PATCH 39/63] contracts RPC & pallet::get_storage to use transparent hashing --- bin/node/runtime/src/lib.rs | 4 ++-- frame/contracts/rpc/runtime-api/src/lib.rs | 2 +- frame/contracts/rpc/src/lib.rs | 4 ++-- frame/contracts/src/lib.rs | 9 ++++++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index e89f035ca54ee..a514bd0454753 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1938,9 +1938,9 @@ impl_runtime_apis! { fn get_storage( address: AccountId, - key: [u8; 32], + key: Vec, ) -> pallet_contracts_primitives::GetStorageResult { - Contracts::get_storage(address, &key) + Contracts::get_storage(address, key) } } diff --git a/frame/contracts/rpc/runtime-api/src/lib.rs b/frame/contracts/rpc/runtime-api/src/lib.rs index 59622a21a6593..9765b37057c7b 100644 --- a/frame/contracts/rpc/runtime-api/src/lib.rs +++ b/frame/contracts/rpc/runtime-api/src/lib.rs @@ -79,7 +79,7 @@ sp_api::decl_runtime_apis! { /// doesn't exist, or doesn't have a contract then `Err` is returned. fn get_storage( address: AccountId, - key: [u8; 32], + key: Vec, ) -> GetStorageResult; } } diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index 77ae3f3ed35e3..04aad192434cf 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -167,7 +167,7 @@ where fn get_storage( &self, address: AccountId, - key: H256, + key: Bytes, at: Option, ) -> RpcResult>; } @@ -292,7 +292,7 @@ where fn get_storage( &self, address: AccountId, - key: H256, + key: Bytes, at: Option<::Hash>, ) -> RpcResult> { let api = self.client.runtime_api(); diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index b068d02e76939..c7a4397b2318c 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -99,7 +99,7 @@ pub mod weights; mod tests; use crate::{ - exec::{AccountIdOf, ExecError, Executable, Stack as ExecStack, StorageKey}, + exec::{AccountIdOf, ExecError, Executable, Stack as ExecStack}, gas::GasMeter, storage::{meter::Meter as StorageMeter, ContractInfo, DeletedContract, Storage}, wasm::{OwnerInfo, PrefabWasmModule}, @@ -946,11 +946,14 @@ where } /// Query storage of a specified contract under a specified key. - pub fn get_storage>(address: T::AccountId, key: &K) -> GetStorageResult { + pub fn get_storage(address: T::AccountId, key: Vec) -> GetStorageResult { let contract_info = ContractInfoOf::::get(&address).ok_or(ContractAccessError::DoesntExist)?; - let maybe_value = Storage::::read(&contract_info.trie_id, key); + let maybe_value = Storage::::read( + &contract_info.trie_id, + &VarSizedKey::::try_from(key).map_err(|_| ContractAccessError::DoesntExist)?, + ); Ok(maybe_value) } From 2b764ffe76f85f9af58bc2e184d2f009e41c4232 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 21 Jun 2022 21:40:09 +0300 Subject: [PATCH 40/63] node and rpc updated to use get_storage with VarSizedKey --- bin/node/runtime/src/lib.rs | 12 ++++++++++-- frame/contracts/rpc/runtime-api/src/lib.rs | 5 +++-- frame/contracts/src/lib.rs | 7 ++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index e09aa04e504ea..7933e910b4459 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -1693,6 +1693,14 @@ mod mmr { pub type Hashing = ::Hashing; } +/// Contracts helper types. +mod contracts { + use super::Runtime; + use pallet_contracts::VarSizedKey; + + pub type StorageKey = VarSizedKey; +} + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; @@ -1904,7 +1912,7 @@ impl_runtime_apis! { } impl pallet_contracts_rpc_runtime_api::ContractsApi< - Block, AccountId, Balance, BlockNumber, Hash, + Block, AccountId, Balance, BlockNumber, Hash, contracts::StorageKey, > for Runtime { @@ -1943,7 +1951,7 @@ impl_runtime_apis! { fn get_storage( address: AccountId, - key: Vec, + key: contracts::StorageKey, ) -> pallet_contracts_primitives::GetStorageResult { Contracts::get_storage(address, key) } diff --git a/frame/contracts/rpc/runtime-api/src/lib.rs b/frame/contracts/rpc/runtime-api/src/lib.rs index 9765b37057c7b..ae080f441ae62 100644 --- a/frame/contracts/rpc/runtime-api/src/lib.rs +++ b/frame/contracts/rpc/runtime-api/src/lib.rs @@ -31,11 +31,12 @@ use sp_std::vec::Vec; sp_api::decl_runtime_apis! { /// The API to interact with contracts without using executive. - pub trait ContractsApi where + pub trait ContractsApi where AccountId: Codec, Balance: Codec, BlockNumber: Codec, Hash: Codec, + VarSizedKey: Codec, { /// Perform a call from a specified account to a given contract. /// @@ -79,7 +80,7 @@ sp_api::decl_runtime_apis! { /// doesn't exist, or doesn't have a contract then `Err` is returned. fn get_storage( address: AccountId, - key: Vec, + key: VarSizedKey, ) -> GetStorageResult; } } diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index c7a4397b2318c..318c88efa85fa 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -946,14 +946,11 @@ where } /// Query storage of a specified contract under a specified key. - pub fn get_storage(address: T::AccountId, key: Vec) -> GetStorageResult { + pub fn get_storage(address: T::AccountId, key: VarSizedKey) -> GetStorageResult { let contract_info = ContractInfoOf::::get(&address).ok_or(ContractAccessError::DoesntExist)?; - let maybe_value = Storage::::read( - &contract_info.trie_id, - &VarSizedKey::::try_from(key).map_err(|_| ContractAccessError::DoesntExist)?, - ); + let maybe_value = Storage::::read(&contract_info.trie_id, &key); Ok(maybe_value) } From 4652e6f98c6c16aa03733a3440bfc15749cf81f1 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 21 Jun 2022 21:44:23 +0300 Subject: [PATCH 41/63] refactored (more concize) --- bin/node/runtime/src/lib.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 7933e910b4459..e39c58afb81af 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -47,7 +47,7 @@ use frame_system::{ }; pub use node_primitives::{AccountId, Signature}; use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment}; -use pallet_contracts::weights::WeightInfo; +use pallet_contracts::{weights::WeightInfo, VarSizedKey as StorageKey}; use pallet_election_provider_multi_phase::SolutionAccuracyOf; use pallet_grandpa::{ fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, @@ -1693,14 +1693,6 @@ mod mmr { pub type Hashing = ::Hashing; } -/// Contracts helper types. -mod contracts { - use super::Runtime; - use pallet_contracts::VarSizedKey; - - pub type StorageKey = VarSizedKey; -} - #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; @@ -1912,7 +1904,7 @@ impl_runtime_apis! { } impl pallet_contracts_rpc_runtime_api::ContractsApi< - Block, AccountId, Balance, BlockNumber, Hash, contracts::StorageKey, + Block, AccountId, Balance, BlockNumber, Hash, StorageKey, > for Runtime { @@ -1951,7 +1943,7 @@ impl_runtime_apis! { fn get_storage( address: AccountId, - key: contracts::StorageKey, + key: StorageKey, ) -> pallet_contracts_primitives::GetStorageResult { Contracts::get_storage(address, key) } From 4ff9bf38389bb0da3d3a8ae03e299ae4c2e7a2af Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 21 Jun 2022 22:52:49 +0300 Subject: [PATCH 42/63] refactored contains_storage (DRYed) --- frame/contracts/src/wasm/runtime.rs | 36 +++++++++-------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 17b7ffc5f10f8..fc1c6d8389d48 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -823,31 +823,17 @@ where fn contains_storage(&mut self, key_type: KeyType, key_ptr: u32) -> Result { let charged = self.charge_gas(RuntimeCosts::ContainsStorage(self.ext.max_value_size()))?; let key = self.read_sandbox_memory(key_ptr, key_type.len::()?)?; - match key_type { - KeyType::Fix => { - if let Some(len) = self.ext.get_storage_size( - &FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, - ) { - self.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); - Ok(len) - } else { - self.adjust_gas(charged, RuntimeCosts::ContainsStorage(0)); - Ok(SENTINEL) - } - }, - KeyType::Variable(_) => { - if let Some(len) = self.ext.get_storage_size_transparent( - &VarSizedKey::::try_from(key) - .map_err(|_| Error::::DecodingFailed)?, - ) { - self.adjust_gas(charged, RuntimeCosts::ContainsStorage(len)); - Ok(len) - } else { - self.adjust_gas(charged, RuntimeCosts::ContainsStorage(0)); - Ok(SENTINEL) - } - }, - } + let outcome = match key_type { + KeyType::Fix => self.ext.get_storage_size( + &FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + ), + KeyType::Variable(_) => self.ext.get_storage_size_transparent( + &VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, + ), + }; + + self.adjust_gas(charged, RuntimeCosts::ClearStorage(outcome.unwrap_or(0))); + Ok(outcome.unwrap_or(SENTINEL)) } fn call( From 5f28ab863ed506ecae9aaab42734cd4f27665b5e Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 21 Jun 2022 23:27:08 +0300 Subject: [PATCH 43/63] refactored contains_storage (DRYed) --- frame/contracts/src/wasm/runtime.rs | 53 +++++++++-------------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index fc1c6d8389d48..c1757ba06412a 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -780,43 +780,22 @@ where ) -> Result { let charged = self.charge_gas(RuntimeCosts::GetStorage(self.ext.max_value_size()))?; let key = self.read_sandbox_memory(key_ptr, key_type.len::()?)?; - match key_type { - KeyType::Fix => - if let Some(value) = self.ext.get_storage( - &FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, - ) { - self.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); - self.write_sandbox_output( - out_ptr, - out_len_ptr, - &value, - false, - already_charged, - )?; - Ok(ReturnCode::Success) - } else { - self.adjust_gas(charged, RuntimeCosts::GetStorage(0)); - Ok(ReturnCode::KeyNotFound) - }, - KeyType::Variable(_) => { - if let Some(value) = self.ext.get_storage_transparent( - &VarSizedKey::::try_from(key) - .map_err(|_| Error::::DecodingFailed)?, - ) { - self.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); - self.write_sandbox_output( - out_ptr, - out_len_ptr, - &value, - false, - already_charged, - )?; - Ok(ReturnCode::Success) - } else { - self.adjust_gas(charged, RuntimeCosts::GetStorage(0)); - Ok(ReturnCode::KeyNotFound) - } - }, + let outcome = match key_type { + KeyType::Fix => self.ext.get_storage( + &FixSizedKey::try_from(key).map_err(|_| Error::::DecodingFailed)?, + ), + KeyType::Variable(_) => self.ext.get_storage_transparent( + &VarSizedKey::::try_from(key).map_err(|_| Error::::DecodingFailed)?, + ), + }; + + if let Some(value) = outcome { + self.adjust_gas(charged, RuntimeCosts::GetStorage(value.len() as u32)); + self.write_sandbox_output(out_ptr, out_len_ptr, &value, false, already_charged)?; + Ok(ReturnCode::Success) + } else { + self.adjust_gas(charged, RuntimeCosts::GetStorage(0)); + Ok(ReturnCode::KeyNotFound) } } From 2e59a8ecb6bc577838255d7dc4a9bba33a0fb926 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 21 Jun 2022 23:42:41 +0300 Subject: [PATCH 44/63] fix rpc --- frame/contracts/rpc/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index 04aad192434cf..63ab4102422e5 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -192,7 +192,8 @@ impl <::Header as HeaderT>::Number, AccountId, Balance, - Hash, + Hash, + VarSizedKey, > for Contracts where Block: BlockT, @@ -207,6 +208,7 @@ where AccountId: Codec, Balance: Codec + Copy + TryFrom + Into, Hash: Codec, + VarSizedKey: Codec, { fn call( &self, From c582cfff4b5cb2c9929fd5e3b45519bb24aeb657 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 21 Jun 2022 23:45:48 +0300 Subject: [PATCH 45/63] fmt fix --- .../basic-authorship/src/basic_authorship.rs | 84 +++++++++++-------- frame/contracts/rpc/src/lib.rs | 4 +- 2 files changed, 50 insertions(+), 38 deletions(-) diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs index b67008bc6f44b..d9fe82070fa5a 100644 --- a/client/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -625,12 +625,14 @@ mod tests { .unwrap(); block_on( - txpool.maintain(chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - )), + txpool.maintain( + chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + ), + ), ); let mut proposer_factory = @@ -720,12 +722,14 @@ mod tests { block_on(txpool.submit_at(&BlockId::number(0), SOURCE, vec![extrinsic(0)])).unwrap(); block_on( - txpool.maintain(chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - )), + txpool.maintain( + chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + ), + ), ); let mut proposer_factory = @@ -821,12 +825,14 @@ mod tests { }; block_on( - txpool.maintain(chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - )), + txpool.maintain( + chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + ), + ), ); assert_eq!(txpool.ready().count(), 7); @@ -835,12 +841,14 @@ mod tests { block_on(client.import(BlockOrigin::Own, block)).unwrap(); block_on( - txpool.maintain(chain_event( - client - .header(&BlockId::Number(1)) - .expect("header get error") - .expect("there should be header"), - )), + txpool.maintain( + chain_event( + client + .header(&BlockId::Number(1)) + .expect("header get error") + .expect("there should be header"), + ), + ), ); assert_eq!(txpool.ready().count(), 5); @@ -965,12 +973,14 @@ mod tests { .unwrap(); block_on( - txpool.maintain(chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - )), + txpool.maintain( + chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + ), + ), ); assert_eq!(txpool.ready().count(), MAX_SKIPPED_TRANSACTIONS * 3); @@ -1028,12 +1038,14 @@ mod tests { .unwrap(); block_on( - txpool.maintain(chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - )), + txpool.maintain( + chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + ), + ), ); assert_eq!(txpool.ready().count(), MAX_SKIPPED_TRANSACTIONS * 2 + 2); diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index 63ab4102422e5..b72ae395b336a 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -192,8 +192,8 @@ impl <::Header as HeaderT>::Number, AccountId, Balance, - Hash, - VarSizedKey, + Hash, + VarSizedKey, > for Contracts where Block: BlockT, From a5c265921289086e8a72b0837e2587194fd6b58b Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Tue, 21 Jun 2022 23:51:57 +0300 Subject: [PATCH 46/63] more fixes in rpc --- frame/contracts/rpc/src/lib.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index b72ae395b336a..6272fcf412686 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -33,7 +33,7 @@ use pallet_contracts_primitives::{ use serde::{Deserialize, Serialize}; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; -use sp_core::{Bytes, H256}; +use sp_core::Bytes; use sp_rpc::number::NumberOrHex; use sp_runtime::{ generic::BlockId, @@ -117,7 +117,7 @@ pub struct CodeUploadRequest { /// Contracts RPC methods. #[rpc(client, server)] -pub trait ContractsApi +pub trait ContractsApi where Balance: Copy + TryFrom + Into, { @@ -167,7 +167,7 @@ where fn get_storage( &self, address: AccountId, - key: Bytes, + key: VarSizedKey, at: Option, ) -> RpcResult>; } @@ -186,7 +186,7 @@ impl Contracts { } #[async_trait] -impl +impl ContractsApiServer< ::Hash, <::Header as HeaderT>::Number, @@ -204,6 +204,7 @@ where Balance, <::Header as HeaderT>::Number, Hash, + VarSizedKey, >, AccountId: Codec, Balance: Codec + Copy + TryFrom + Into, @@ -294,13 +295,13 @@ where fn get_storage( &self, address: AccountId, - key: Bytes, + key: VarSizedKey, at: Option<::Hash>, ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); let result = api - .get_storage(&at, address, key.into()) + .get_storage(&at, address, key) .map_err(runtime_error_into_rpc_err)? .map_err(ContractAccessError)? .map(Bytes); From 205d42874c2bf78fa14d50051cdfd6cc7a535a4b Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 01:00:46 +0300 Subject: [PATCH 47/63] rollback `Pallet:get_storage` to Vec and rpc and node parts related to it --- bin/node/runtime/src/lib.rs | 6 +++--- frame/contracts/rpc/runtime-api/src/lib.rs | 5 ++--- frame/contracts/rpc/src/lib.rs | 13 +++++-------- frame/contracts/src/lib.rs | 7 +++++-- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index e39c58afb81af..e09aa04e504ea 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -47,7 +47,7 @@ use frame_system::{ }; pub use node_primitives::{AccountId, Signature}; use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment}; -use pallet_contracts::{weights::WeightInfo, VarSizedKey as StorageKey}; +use pallet_contracts::weights::WeightInfo; use pallet_election_provider_multi_phase::SolutionAccuracyOf; use pallet_grandpa::{ fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, @@ -1904,7 +1904,7 @@ impl_runtime_apis! { } impl pallet_contracts_rpc_runtime_api::ContractsApi< - Block, AccountId, Balance, BlockNumber, Hash, StorageKey, + Block, AccountId, Balance, BlockNumber, Hash, > for Runtime { @@ -1943,7 +1943,7 @@ impl_runtime_apis! { fn get_storage( address: AccountId, - key: StorageKey, + key: Vec, ) -> pallet_contracts_primitives::GetStorageResult { Contracts::get_storage(address, key) } diff --git a/frame/contracts/rpc/runtime-api/src/lib.rs b/frame/contracts/rpc/runtime-api/src/lib.rs index ae080f441ae62..9765b37057c7b 100644 --- a/frame/contracts/rpc/runtime-api/src/lib.rs +++ b/frame/contracts/rpc/runtime-api/src/lib.rs @@ -31,12 +31,11 @@ use sp_std::vec::Vec; sp_api::decl_runtime_apis! { /// The API to interact with contracts without using executive. - pub trait ContractsApi where + pub trait ContractsApi where AccountId: Codec, Balance: Codec, BlockNumber: Codec, Hash: Codec, - VarSizedKey: Codec, { /// Perform a call from a specified account to a given contract. /// @@ -80,7 +79,7 @@ sp_api::decl_runtime_apis! { /// doesn't exist, or doesn't have a contract then `Err` is returned. fn get_storage( address: AccountId, - key: VarSizedKey, + key: Vec, ) -> GetStorageResult; } } diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index 6272fcf412686..a10e4b91082b7 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -117,7 +117,7 @@ pub struct CodeUploadRequest { /// Contracts RPC methods. #[rpc(client, server)] -pub trait ContractsApi +pub trait ContractsApi where Balance: Copy + TryFrom + Into, { @@ -167,7 +167,7 @@ where fn get_storage( &self, address: AccountId, - key: VarSizedKey, + key: Bytes, at: Option, ) -> RpcResult>; } @@ -186,14 +186,13 @@ impl Contracts { } #[async_trait] -impl +impl ContractsApiServer< ::Hash, <::Header as HeaderT>::Number, AccountId, Balance, Hash, - VarSizedKey, > for Contracts where Block: BlockT, @@ -204,12 +203,10 @@ where Balance, <::Header as HeaderT>::Number, Hash, - VarSizedKey, >, AccountId: Codec, Balance: Codec + Copy + TryFrom + Into, Hash: Codec, - VarSizedKey: Codec, { fn call( &self, @@ -295,13 +292,13 @@ where fn get_storage( &self, address: AccountId, - key: VarSizedKey, + key: Bytes, at: Option<::Hash>, ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); let result = api - .get_storage(&at, address, key) + .get_storage(&at, address, key.to_vec()) .map_err(runtime_error_into_rpc_err)? .map_err(ContractAccessError)? .map(Bytes); diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 318c88efa85fa..c7a4397b2318c 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -946,11 +946,14 @@ where } /// Query storage of a specified contract under a specified key. - pub fn get_storage(address: T::AccountId, key: VarSizedKey) -> GetStorageResult { + pub fn get_storage(address: T::AccountId, key: Vec) -> GetStorageResult { let contract_info = ContractInfoOf::::get(&address).ok_or(ContractAccessError::DoesntExist)?; - let maybe_value = Storage::::read(&contract_info.trie_id, &key); + let maybe_value = Storage::::read( + &contract_info.trie_id, + &VarSizedKey::::try_from(key).map_err(|_| ContractAccessError::DoesntExist)?, + ); Ok(maybe_value) } From cb6945b2f358e8ae019f260f9620a55b88b99c8f Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 01:18:17 +0300 Subject: [PATCH 48/63] added `KeyDecodingFailed` error --- frame/contracts/common/src/lib.rs | 2 ++ frame/contracts/rpc/src/lib.rs | 6 ++++++ frame/contracts/src/lib.rs | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frame/contracts/common/src/lib.rs b/frame/contracts/common/src/lib.rs index 49f91f6769290..f810725afcd36 100644 --- a/frame/contracts/common/src/lib.rs +++ b/frame/contracts/common/src/lib.rs @@ -106,6 +106,8 @@ pub type GetStorageResult = Result>, ContractAccessError>; pub enum ContractAccessError { /// The given address doesn't point to a contract. DoesntExist, + /// Storage key cannot be decoded from the provided input data. + KeyDecodingFailed, } bitflags! { diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index a10e4b91082b7..61df28c91f60a 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -74,6 +74,12 @@ impl From for JsonRpseeError { None::<()>, )) .into(), + KeyDecodingFailed => CallError::Custom(ErrorObject::owned( + CONTRACT_DOESNT_EXIST, + "Failed to decode the specified storage key.", + None::<()>, + )) + .into(), } } } diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index c7a4397b2318c..1506681de2f84 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -952,7 +952,7 @@ where let maybe_value = Storage::::read( &contract_info.trie_id, - &VarSizedKey::::try_from(key).map_err(|_| ContractAccessError::DoesntExist)?, + &VarSizedKey::::try_from(key).map_err(|_| ContractAccessError::KeyDecodingFailed)?, ); Ok(maybe_value) } From 72682deb82dfe0b9c58108cace991ff9cec46b02 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 01:26:23 +0300 Subject: [PATCH 49/63] Revert weird "fmt fix" This reverts commit c582cfff4b5cb2c9929fd5e3b45519bb24aeb657. --- .../basic-authorship/src/basic_authorship.rs | 84 ++++++++----------- 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs index d9fe82070fa5a..b67008bc6f44b 100644 --- a/client/basic-authorship/src/basic_authorship.rs +++ b/client/basic-authorship/src/basic_authorship.rs @@ -625,14 +625,12 @@ mod tests { .unwrap(); block_on( - txpool.maintain( - chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - ), - ), + txpool.maintain(chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + )), ); let mut proposer_factory = @@ -722,14 +720,12 @@ mod tests { block_on(txpool.submit_at(&BlockId::number(0), SOURCE, vec![extrinsic(0)])).unwrap(); block_on( - txpool.maintain( - chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - ), - ), + txpool.maintain(chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + )), ); let mut proposer_factory = @@ -825,14 +821,12 @@ mod tests { }; block_on( - txpool.maintain( - chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - ), - ), + txpool.maintain(chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + )), ); assert_eq!(txpool.ready().count(), 7); @@ -841,14 +835,12 @@ mod tests { block_on(client.import(BlockOrigin::Own, block)).unwrap(); block_on( - txpool.maintain( - chain_event( - client - .header(&BlockId::Number(1)) - .expect("header get error") - .expect("there should be header"), - ), - ), + txpool.maintain(chain_event( + client + .header(&BlockId::Number(1)) + .expect("header get error") + .expect("there should be header"), + )), ); assert_eq!(txpool.ready().count(), 5); @@ -973,14 +965,12 @@ mod tests { .unwrap(); block_on( - txpool.maintain( - chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - ), - ), + txpool.maintain(chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + )), ); assert_eq!(txpool.ready().count(), MAX_SKIPPED_TRANSACTIONS * 3); @@ -1038,14 +1028,12 @@ mod tests { .unwrap(); block_on( - txpool.maintain( - chain_event( - client - .header(&BlockId::Number(0u64)) - .expect("header get error") - .expect("there should be header"), - ), - ), + txpool.maintain(chain_event( + client + .header(&BlockId::Number(0u64)) + .expect("header get error") + .expect("there should be header"), + )), ); assert_eq!(txpool.ready().count(), MAX_SKIPPED_TRANSACTIONS * 2 + 2); From 23d2209abf48f1a7357b775696ff7d11a8b2b901 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 01:39:30 +0300 Subject: [PATCH 50/63] node-executor basic test update --- bin/node/executor/tests/basic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 003644aeef837..9371f188347ad 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -766,7 +766,7 @@ fn deploying_wasm_contract_should_work() { // It does not matter that the storage item itself does not exist. assert!(&pallet_contracts::Pallet::::get_storage( addr, - &pallet_contracts::FixSizedKey::default() + &pallet_contracts::FixSizedKey::default().to_vec() ) .is_ok()); }); From a7c58b4b2083e579371fb756882059199a912be3 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 01:51:12 +0300 Subject: [PATCH 51/63] fix node-executor basic test --- bin/node/executor/tests/basic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 9371f188347ad..36b0fc8746abd 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -766,7 +766,7 @@ fn deploying_wasm_contract_should_work() { // It does not matter that the storage item itself does not exist. assert!(&pallet_contracts::Pallet::::get_storage( addr, - &pallet_contracts::FixSizedKey::default().to_vec() + pallet_contracts::FixSizedKey::default().to_vec() ) .is_ok()); }); From 04975170c090448bd442718e568d292da8e1e16b Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 13:18:49 +0300 Subject: [PATCH 52/63] benchmarks fix --- frame/contracts/src/benchmarking/mod.rs | 30 ++++++++++--------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 954aca438fcaa..c72a5056091b8 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -915,7 +915,8 @@ benchmarks! { .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); - let key_bytes = keys.iter().flatten().cloned().collect::>(); + let keys_bytes = keys.iter().flatten().cloned().collect::>(); + let keys_len = keys_bytes.len(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { @@ -927,18 +928,14 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, - value: key_bytes, + value: keys_bytes, }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len - Regular(Instruction::I32Const(32)), // value_ptr - Regular(Instruction::I32Const(32)), // value_len + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len + Regular(Instruction::I32Const(0)), // value_ptr + Regular(Instruction::I32Const(keys_len as i32)), // value_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -968,6 +965,7 @@ benchmarks! { h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); + let keys_len = keys_bytes.len(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { @@ -979,18 +977,14 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len - Regular(Instruction::I32Const(32)), // value_ptr - Regular(Instruction::I32Const((n * 1024) as i32)), // value_len + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len + Regular(Instruction::I32Const(0)), // value_ptr + Regular(Instruction::I32Const((keys_len as i32))), // value_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), From 13777b379529afa2289b0be0d08c9c6bd6be7cd5 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 14:23:06 +0300 Subject: [PATCH 53/63] more benchmarks fix --- frame/contracts/src/benchmarking/mod.rs | 129 +++++++++--------------- 1 file changed, 46 insertions(+), 83 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index c72a5056091b8..77a0cfa180846 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -916,7 +916,7 @@ benchmarks! { h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); let keys_bytes = keys.iter().flatten().cloned().collect::>(); - let keys_len = keys_bytes.len(); + let value_len = T::Schedule::get().limits.payload_len / 1024; let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { @@ -935,7 +935,7 @@ benchmarks! { Counter(0, max_key_len as u32), // key_ptr Regular(Instruction::I32Const(max_key_len as i32)), // key_len Regular(Instruction::I32Const(0)), // value_ptr - Regular(Instruction::I32Const(keys_len as i32)), // value_len + Regular(Instruction::I32Const(value_len as i32)), // value_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -958,14 +958,13 @@ benchmarks! { #[skip_meta] seal_set_storage_per_new_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 2048; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb let max_key_len = T::MaxStorageKeyLen::get(); let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); let key_bytes = keys.iter().flatten().cloned().collect::>(); - let keys_len = keys_bytes.len(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { @@ -984,7 +983,7 @@ benchmarks! { Counter(0, max_key_len as u32), // key_ptr Regular(Instruction::I32Const(max_key_len as i32)), // key_len Regular(Instruction::I32Const(0)), // value_ptr - Regular(Instruction::I32Const((keys_len as i32))), // value_len + Regular(Instruction::I32Const((n * 2048) as i32)), // value_len = max payload_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1007,7 +1006,7 @@ benchmarks! { #[skip_meta] seal_set_storage_per_old_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 2048; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb let max_key_len = T::MaxStorageKeyLen::get(); let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); @@ -1025,18 +1024,14 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len - Regular(Instruction::I32Const(32)), // value_ptr - Regular(Instruction::I32Const(32)), // value_len + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len + Regular(Instruction::I32Const(0)), // value_ptr + Regular(Instruction::I32Const(0)), // value_len is 0 as testing vs pre-existing value len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1048,7 +1043,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 1024) as usize]), + Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len None, false, ) @@ -1081,16 +1076,12 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1114,7 +1105,7 @@ benchmarks! { #[skip_meta] seal_clear_storage_per_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 2048; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb let max_key_len = T::MaxStorageKeyLen::get(); let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); @@ -1132,16 +1123,12 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1153,7 +1140,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 1024) as usize]), + Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len None, false, ) @@ -1184,22 +1171,18 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, DataSegment { - offset: 32 + key_bytes_len as u32, + offset: key_bytes_len as u32, value: T::Schedule::get().limits.payload_len.to_le_bytes().into(), }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len - Regular(Instruction::I32Const((32 + key_bytes_len + 4) as i32)), // out_ptr - Regular(Instruction::I32Const(32 + key_bytes_len as i32)), // out_len_ptr + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len + Regular(Instruction::I32Const((key_bytes_len + 4) as i32)), // out_ptr + Regular(Instruction::I32Const(key_bytes_len as i32)), // out_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1223,7 +1206,7 @@ benchmarks! { #[skip_meta] seal_get_storage_per_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 2048; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb let max_key_len = T::MaxStorageKeyLen::get(); let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); @@ -1242,22 +1225,18 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, DataSegment { - offset: 32 + key_bytes_len as u32, + offset: key_bytes_len as u32, value: T::Schedule::get().limits.payload_len.to_le_bytes().into(), }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len - Regular(Instruction::I32Const((32 + key_bytes_len + 4) as i32)), // out_ptr - Regular(Instruction::I32Const(32 + key_bytes_len as i32)), // out_len_ptr + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len + Regular(Instruction::I32Const((key_bytes_len + 4) as i32)), // out_ptr + Regular(Instruction::I32Const(key_bytes_len as i32)), // out_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1269,7 +1248,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 1024) as usize]), + Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len None, false, ) @@ -1301,16 +1280,12 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1334,7 +1309,7 @@ benchmarks! { #[skip_meta] seal_contains_storage_per_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 2048; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb let max_key_len = T::MaxStorageKeyLen::get(); let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); @@ -1352,16 +1327,12 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1373,7 +1344,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 1024) as usize]), + Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len None, false, ) @@ -1404,22 +1375,18 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, DataSegment { - offset: 32 + key_bytes_len as u32, + offset: key_bytes_len as u32, value: T::Schedule::get().limits.payload_len.to_le_bytes().into(), }, ], call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len - Regular(Instruction::I32Const((32 + key_bytes_len + 4) as i32)), // out_ptr - Regular(Instruction::I32Const(32 + key_bytes_len as i32)), // out_len_ptr + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len + Regular(Instruction::I32Const((key_bytes_len + 4) as i32)), // out_ptr + Regular(Instruction::I32Const(key_bytes_len as i32)), // out_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1443,7 +1410,7 @@ benchmarks! { #[skip_meta] seal_take_storage_per_kb { - let n in 0 .. T::Schedule::get().limits.payload_len / 2048; + let n in 0 .. T::Schedule::get().limits.payload_len / 2048; // half of the max payload_len in kb let max_key_len = T::MaxStorageKeyLen::get(); let keys = (0 .. n * API_BENCHMARK_BATCH_SIZE) .map(|n| { let mut h = T::Hashing::hash_of(&n).as_ref().to_vec(); @@ -1462,22 +1429,18 @@ benchmarks! { data_segments: vec![ DataSegment { offset: 0, - value: max_key_len.to_le_bytes().to_vec(), - }, - DataSegment { - offset: 32, value: key_bytes, }, DataSegment { - offset: 32 + key_bytes_len as u32, + offset: key_bytes_len as u32, value: T::Schedule::get().limits.payload_len.to_le_bytes().into(), }, ], call_body: Some(body::repeated_dyn(API_BENCHMARK_BATCH_SIZE, vec![ - Counter(32, max_key_len as u32), // key_ptr - Regular(Instruction::I32Const(0)), // key_len - Regular(Instruction::I32Const((32 + key_bytes_len + 4) as i32)), // out_ptr - Regular(Instruction::I32Const(32 + key_bytes_len as i32)), // out_len_ptr + Counter(0, max_key_len as u32), // key_ptr + Regular(Instruction::I32Const(max_key_len as i32)), // key_len + Regular(Instruction::I32Const((key_bytes_len + 4) as i32)), // out_ptr + Regular(Instruction::I32Const(key_bytes_len as i32)), // out_len_ptr Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1489,7 +1452,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 1024) as usize]), + Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len None, false, ) From 12c246e498b72e4751e7bf7cda23bdc3f2a915b4 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 14:27:28 +0300 Subject: [PATCH 54/63] FixedSizedKey is hidden from pub, VarSizedKey is exported as StorageKey --- bin/node/executor/tests/basic.rs | 2 +- frame/contracts/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 36b0fc8746abd..5d20713608493 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -766,7 +766,7 @@ fn deploying_wasm_contract_should_work() { // It does not matter that the storage item itself does not exist. assert!(&pallet_contracts::Pallet::::get_storage( addr, - pallet_contracts::FixSizedKey::default().to_vec() + pallet_contracts::StorageKey::default().to_vec() ) .is_ok()); }); diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 1506681de2f84..60b30ffa25005 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -125,7 +125,7 @@ use sp_runtime::traits::{Convert, Hash, Saturating, StaticLookup}; use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; pub use crate::{ - exec::{FixSizedKey, Frame, VarSizedKey}, + exec::{Frame, VarSizedKey as StorageKey}, pallet::*, schedule::{HostFnWeights, InstructionWeights, Limits, Schedule}, }; @@ -952,7 +952,7 @@ where let maybe_value = Storage::::read( &contract_info.trie_id, - &VarSizedKey::::try_from(key).map_err(|_| ContractAccessError::KeyDecodingFailed)?, + &StorageKey::::try_from(key).map_err(|_| ContractAccessError::KeyDecodingFailed)?, ); Ok(maybe_value) } From b91af1395dada10a1c86e57c51f4a4df5a41085c Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 15:04:10 +0300 Subject: [PATCH 55/63] ci fix --- bin/node/executor/tests/basic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 5d20713608493..cfc2775e96468 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -766,7 +766,7 @@ fn deploying_wasm_contract_should_work() { // It does not matter that the storage item itself does not exist. assert!(&pallet_contracts::Pallet::::get_storage( addr, - pallet_contracts::StorageKey::default().to_vec() + pallet_contracts::StorageKey::default().to_vec() ) .is_ok()); }); @@ -774,7 +774,7 @@ fn deploying_wasm_contract_should_work() { #[test] fn wasm_big_block_import_fails() { - let mut t = new_test_ext(compact_code_unwrap()); + let mut t = new_test_ext(compact_code_unwrap()1); set_heap_pages(&mut t.ext(), 4); From 591b4b7adbcc933616826b7d6b05426093aeaf41 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 15:09:02 +0300 Subject: [PATCH 56/63] set_storage benchmark fix --- frame/contracts/src/benchmarking/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 77a0cfa180846..30b8f49474a3e 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -916,7 +916,6 @@ benchmarks! { h.resize(max_key_len.try_into().unwrap(), n.to_le_bytes()[0]); h }) .collect::>(); let keys_bytes = keys.iter().flatten().cloned().collect::>(); - let value_len = T::Schedule::get().limits.payload_len / 1024; let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { @@ -935,7 +934,7 @@ benchmarks! { Counter(0, max_key_len as u32), // key_ptr Regular(Instruction::I32Const(max_key_len as i32)), // key_len Regular(Instruction::I32Const(0)), // value_ptr - Regular(Instruction::I32Const(value_len as i32)), // value_len + Regular(Instruction::I32Const(0)), // value_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), From 58026376142bf818242f949c392f273c85ef0a17 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 15:18:25 +0300 Subject: [PATCH 57/63] ci fix --- bin/node/executor/tests/basic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index cfc2775e96468..823a5ceb97c05 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -774,7 +774,7 @@ fn deploying_wasm_contract_should_work() { #[test] fn wasm_big_block_import_fails() { - let mut t = new_test_ext(compact_code_unwrap()1); + let mut t = new_test_ext(compact_code_unwrap()); set_heap_pages(&mut t.ext(), 4); From d95fe82c7005f07039741a33d3c03e0b856ff04e Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 15:33:22 +0300 Subject: [PATCH 58/63] ci fix --- bin/node/executor/tests/basic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs index 823a5ceb97c05..31a9bd0a90496 100644 --- a/bin/node/executor/tests/basic.rs +++ b/bin/node/executor/tests/basic.rs @@ -766,7 +766,7 @@ fn deploying_wasm_contract_should_work() { // It does not matter that the storage item itself does not exist. assert!(&pallet_contracts::Pallet::::get_storage( addr, - pallet_contracts::StorageKey::default().to_vec() + pallet_contracts::StorageKey::::default().to_vec() ) .is_ok()); }); From d659578b77d3c2ac79bd92c23241268fe92ae61e Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 16:01:39 +0300 Subject: [PATCH 59/63] comments improved --- frame/contracts/src/benchmarking/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index 30b8f49474a3e..bea469bd0f5a9 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -982,7 +982,7 @@ benchmarks! { Counter(0, max_key_len as u32), // key_ptr Regular(Instruction::I32Const(max_key_len as i32)), // key_len Regular(Instruction::I32Const(0)), // value_ptr - Regular(Instruction::I32Const((n * 2048) as i32)), // value_len = max payload_len + Regular(Instruction::I32Const((n * 2048) as i32)), // value_len increments by 2kb up to max payload_len Regular(Instruction::Call(0)), Regular(Instruction::Drop), ])), @@ -1042,7 +1042,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len + Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len None, false, ) @@ -1139,7 +1139,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len + Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len None, false, ) @@ -1247,7 +1247,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len + Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len None, false, ) @@ -1343,7 +1343,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len + Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len None, false, ) @@ -1451,7 +1451,7 @@ benchmarks! { Storage::::write( &info.trie_id, &VarSizedKey::::try_from(key).map_err(|e| "Key has wrong length")?, - Some(vec![42u8; (n * 2048) as usize]), // value_len = max payload_len + Some(vec![42u8; (n * 2048) as usize]), // value_len increments by 2kb up to max payload_len None, false, ) From ada21399c2c956ff3063c127a47e017f58bc4956 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Wed, 22 Jun 2022 16:21:52 +0300 Subject: [PATCH 60/63] new error code to rpc: KEY_DECODING_FAILED --- frame/contracts/rpc/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frame/contracts/rpc/src/lib.rs b/frame/contracts/rpc/src/lib.rs index 61df28c91f60a..0df8f90237ed3 100644 --- a/frame/contracts/rpc/src/lib.rs +++ b/frame/contracts/rpc/src/lib.rs @@ -44,6 +44,7 @@ pub use pallet_contracts_rpc_runtime_api::ContractsApi as ContractsRuntimeApi; const RUNTIME_ERROR: i32 = 1; const CONTRACT_DOESNT_EXIST: i32 = 2; +const KEY_DECODING_FAILED: i32 = 3; pub type Weight = u64; @@ -75,7 +76,7 @@ impl From for JsonRpseeError { )) .into(), KeyDecodingFailed => CallError::Custom(ErrorObject::owned( - CONTRACT_DOESNT_EXIST, + KEY_DECODING_FAILED, "Failed to decode the specified storage key.", None::<()>, )) From 3f578bdb5716af0cfd78549ca41b636f07fd5e58 Mon Sep 17 00:00:00 2001 From: Vladimir Istyufeev Date: Wed, 22 Jun 2022 16:32:25 +0300 Subject: [PATCH 61/63] Put `rusty-cachier` before PR merge into `master` for `cargo-check-benches` job --- scripts/ci/gitlab/pipeline/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index b2348c48355d0..0c3fd4d33798d 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -80,6 +80,8 @@ cargo-check-benches: - .test-refs - .collect-artifacts before_script: + - !reference [.rust-info-script, script] + - !reference [.rusty-cachier, before_script] # merges in the master branch on PRs - if [ $CI_COMMIT_REF_NAME != "master" ]; then git fetch origin +master:master; @@ -88,8 +90,6 @@ cargo-check-benches: git config user.email "ci@gitlab.parity.io"; git merge $CI_COMMIT_REF_NAME --verbose --no-edit; fi - - !reference [.rust-info-script, script] - - !reference [.rusty-cachier, before_script] script: - rusty-cachier snapshot create - mkdir -p ./artifacts/benches/$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA From b19f503b8e0937d7e2ff8758377c9fbd9c9bf57f Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Wed, 22 Jun 2022 17:02:46 +0000 Subject: [PATCH 62/63] cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs --- frame/contracts/src/weights.rs | 1366 ++++++++++++++++---------------- 1 file changed, 699 insertions(+), 667 deletions(-) diff --git a/frame/contracts/src/weights.rs b/frame/contracts/src/weights.rs index 1a0af576602a9..3c90579e65d53 100644 --- a/frame/contracts/src/weights.rs +++ b/frame/contracts/src/weights.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-06-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-06-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -166,15 +166,15 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_process_deletion_queue_batch() -> Weight { - (1_648_000 as Weight) + (1_654_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32, ) -> Weight { - (7_105_000 as Weight) + (8_564_000 as Weight) // Standard Error: 0 - .saturating_add((879_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((868_000 as Weight).saturating_mul(k as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(k as Weight))) @@ -183,8 +183,8 @@ impl WeightInfo for SubstrateWeight { /// The range of component `q` is `[0, 1024]`. fn on_initialize_per_queue_item(q: u32, ) -> Weight { (0 as Weight) - // Standard Error: 4_000 - .saturating_add((1_874_000 as Weight).saturating_mul(q as Weight)) + // Standard Error: 5_000 + .saturating_add((1_944_000 as Weight).saturating_mul(q as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -192,7 +192,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn reinstrument(c: u32, ) -> Weight { - (17_962_000 as Weight) + (19_016_000 as Weight) // Standard Error: 0 .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) @@ -204,7 +204,7 @@ impl WeightInfo for SubstrateWeight { // Storage: System Account (r:1 w:1) /// The range of component `c` is `[0, 131072]`. fn call_with_code_per_byte(c: u32, ) -> Weight { - (207_433_000 as Weight) + (205_194_000 as Weight) // Standard Error: 0 .saturating_add((53_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) @@ -220,9 +220,9 @@ impl WeightInfo for SubstrateWeight { /// The range of component `c` is `[0, 64226]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (218_094_000 as Weight) + (288_487_000 as Weight) // Standard Error: 0 - .saturating_add((126_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((124_000 as Weight).saturating_mul(c as Weight)) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) @@ -236,7 +236,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `s` is `[0, 1048576]`. fn instantiate(s: u32, ) -> Weight { - (184_236_000 as Weight) + (186_136_000 as Weight) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) @@ -247,7 +247,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: System Account (r:1 w:1) fn call() -> Weight { - (148_764_000 as Weight) + (149_232_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -256,9 +256,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn upload_code(c: u32, ) -> Weight { - (48_474_000 as Weight) + (51_721_000 as Weight) // Standard Error: 0 - .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((48_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } @@ -266,14 +266,14 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - (29_301_000 as Weight) + (30_016_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:2 w:2) fn set_code() -> Weight { - (26_779_000 as Weight) + (27_192_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } @@ -283,9 +283,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_caller(r: u32, ) -> Weight { - (210_501_000 as Weight) - // Standard Error: 96_000 - .saturating_add((40_406_000 as Weight).saturating_mul(r as Weight)) + (206_405_000 as Weight) + // Standard Error: 112_000 + .saturating_add((40_987_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -295,9 +295,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_is_contract(r: u32, ) -> Weight { - (98_460_000 as Weight) - // Standard Error: 717_000 - .saturating_add((302_159_000 as Weight).saturating_mul(r as Weight)) + (106_220_000 as Weight) + // Standard Error: 710_000 + .saturating_add((307_648_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -308,9 +308,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_code_hash(r: u32, ) -> Weight { - (100_103_000 as Weight) - // Standard Error: 687_000 - .saturating_add((360_394_000 as Weight).saturating_mul(r as Weight)) + (104_498_000 as Weight) + // Standard Error: 633_000 + .saturating_add((368_901_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -321,9 +321,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_own_code_hash(r: u32, ) -> Weight { - (210_131_000 as Weight) - // Standard Error: 102_000 - .saturating_add((43_916_000 as Weight).saturating_mul(r as Weight)) + (208_696_000 as Weight) + // Standard Error: 101_000 + .saturating_add((44_445_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -333,9 +333,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_caller_is_origin(r: u32, ) -> Weight { - (208_603_000 as Weight) - // Standard Error: 56_000 - .saturating_add((16_961_000 as Weight).saturating_mul(r as Weight)) + (205_612_000 as Weight) + // Standard Error: 68_000 + .saturating_add((17_145_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -345,9 +345,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_address(r: u32, ) -> Weight { - (209_735_000 as Weight) - // Standard Error: 102_000 - .saturating_add((40_378_000 as Weight).saturating_mul(r as Weight)) + (206_947_000 as Weight) + // Standard Error: 107_000 + .saturating_add((40_789_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -357,9 +357,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_gas_left(r: u32, ) -> Weight { - (213_032_000 as Weight) - // Standard Error: 112_000 - .saturating_add((39_716_000 as Weight).saturating_mul(r as Weight)) + (208_692_000 as Weight) + // Standard Error: 109_000 + .saturating_add((40_600_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -369,9 +369,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_balance(r: u32, ) -> Weight { - (216_266_000 as Weight) - // Standard Error: 149_000 - .saturating_add((117_042_000 as Weight).saturating_mul(r as Weight)) + (209_811_000 as Weight) + // Standard Error: 208_000 + .saturating_add((116_831_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -381,9 +381,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_value_transferred(r: u32, ) -> Weight { - (210_124_000 as Weight) - // Standard Error: 112_000 - .saturating_add((39_859_000 as Weight).saturating_mul(r as Weight)) + (207_406_000 as Weight) + // Standard Error: 117_000 + .saturating_add((40_702_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -393,9 +393,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_minimum_balance(r: u32, ) -> Weight { - (210_515_000 as Weight) - // Standard Error: 117_000 - .saturating_add((40_007_000 as Weight).saturating_mul(r as Weight)) + (209_260_000 as Weight) + // Standard Error: 130_000 + .saturating_add((40_479_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -405,9 +405,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_block_number(r: u32, ) -> Weight { - (212_737_000 as Weight) - // Standard Error: 111_000 - .saturating_add((39_346_000 as Weight).saturating_mul(r as Weight)) + (206_448_000 as Weight) + // Standard Error: 95_000 + .saturating_add((40_134_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -417,9 +417,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_now(r: u32, ) -> Weight { - (211_734_000 as Weight) - // Standard Error: 112_000 - .saturating_add((39_519_000 as Weight).saturating_mul(r as Weight)) + (206_969_000 as Weight) + // Standard Error: 116_000 + .saturating_add((40_251_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -430,9 +430,9 @@ impl WeightInfo for SubstrateWeight { // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_weight_to_fee(r: u32, ) -> Weight { - (212_008_000 as Weight) - // Standard Error: 159_000 - .saturating_add((99_864_000 as Weight).saturating_mul(r as Weight)) + (211_611_000 as Weight) + // Standard Error: 175_000 + .saturating_add((98_675_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -442,9 +442,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_gas(r: u32, ) -> Weight { - (134_321_000 as Weight) - // Standard Error: 49_000 - .saturating_add((19_059_000 as Weight).saturating_mul(r as Weight)) + (134_484_000 as Weight) + // Standard Error: 57_000 + .saturating_add((19_329_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -454,9 +454,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_input(r: u32, ) -> Weight { - (210_459_000 as Weight) - // Standard Error: 102_000 - .saturating_add((39_198_000 as Weight).saturating_mul(r as Weight)) + (208_556_000 as Weight) + // Standard Error: 125_000 + .saturating_add((40_328_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -466,9 +466,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_input_per_kb(n: u32, ) -> Weight { - (272_954_000 as Weight) - // Standard Error: 5_000 - .saturating_add((9_632_000 as Weight).saturating_mul(n as Weight)) + (268_886_000 as Weight) + // Standard Error: 4_000 + .saturating_add((9_627_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -477,10 +477,8 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 1]`. - fn seal_return(r: u32, ) -> Weight { - (205_473_000 as Weight) - // Standard Error: 130_000 - .saturating_add((1_681_000 as Weight).saturating_mul(r as Weight)) + fn seal_return(_r: u32, ) -> Weight { + (203_591_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -490,7 +488,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_return_per_kb(n: u32, ) -> Weight { - (207_350_000 as Weight) + (204_258_000 as Weight) // Standard Error: 0 .saturating_add((183_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) @@ -504,9 +502,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32, ) -> Weight { - (213_057_000 as Weight) - // Standard Error: 151_000 - .saturating_add((50_517_000 as Weight).saturating_mul(r as Weight)) + (206_625_000 as Weight) + // Standard Error: 672_000 + .saturating_add((59_377_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -519,9 +517,9 @@ impl WeightInfo for SubstrateWeight { // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_random(r: u32, ) -> Weight { - (214_002_000 as Weight) - // Standard Error: 153_000 - .saturating_add((130_262_000 as Weight).saturating_mul(r as Weight)) + (208_866_000 as Weight) + // Standard Error: 164_000 + .saturating_add((133_438_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -531,9 +529,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_deposit_event(r: u32, ) -> Weight { - (214_665_000 as Weight) - // Standard Error: 219_000 - .saturating_add((236_330_000 as Weight).saturating_mul(r as Weight)) + (220_860_000 as Weight) + // Standard Error: 209_000 + .saturating_add((239_951_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -545,11 +543,11 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 4]`. /// The range of component `n` is `[0, 16]`. fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (455_398_000 as Weight) - // Standard Error: 1_991_000 - .saturating_add((251_794_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 392_000 - .saturating_add((66_900_000 as Weight).saturating_mul(n as Weight)) + (439_782_000 as Weight) + // Standard Error: 1_643_000 + .saturating_add((264_687_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 323_000 + .saturating_add((67_636_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -561,110 +559,128 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_debug_message(r: u32, ) -> Weight { - (139_616_000 as Weight) - // Standard Error: 78_000 - .saturating_add((32_049_000 as Weight).saturating_mul(r as Weight)) + (140_280_000 as Weight) + // Standard Error: 82_000 + .saturating_add((32_717_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_set_storage(r: u32, ) -> Weight { - (245_092_000 as Weight) - // Standard Error: 187_000 - .saturating_add((131_710_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (161_247_000 as Weight) + // Standard Error: 883_000 + .saturating_add((423_997_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_set_storage_per_new_kb(n: u32, ) -> Weight { - (372_948_000 as Weight) - // Standard Error: 165_000 - .saturating_add((34_059_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + (529_247_000 as Weight) + // Standard Error: 2_745_000 + .saturating_add((85_282_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(55 as Weight)) + .saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes(53 as Weight)) + .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(n as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_set_storage_per_old_kb(n: u32, ) -> Weight { - (361_086_000 as Weight) - // Standard Error: 137_000 - .saturating_add((17_044_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + (529_812_000 as Weight) + // Standard Error: 2_513_000 + .saturating_add((74_554_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(55 as Weight)) + .saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes(53 as Weight)) + .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(n as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_clear_storage(r: u32, ) -> Weight { - (222_690_000 as Weight) - // Standard Error: 190_000 - .saturating_add((108_740_000 as Weight).saturating_mul(r as Weight)) + (184_803_000 as Weight) + // Standard Error: 733_000 + .saturating_add((404_933_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_clear_storage_per_kb(n: u32, ) -> Weight { - (311_458_000 as Weight) - // Standard Error: 111_000 - .saturating_add((16_426_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (500_958_000 as Weight) + // Standard Error: 2_980_000 + .saturating_add((75_996_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(55 as Weight)) + .saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes(52 as Weight)) + .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(n as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_get_storage(r: u32, ) -> Weight { - (223_269_000 as Weight) - // Standard Error: 163_000 - .saturating_add((101_915_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) + (177_682_000 as Weight) + // Standard Error: 743_000 + .saturating_add((338_172_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (304_319_000 as Weight) - // Standard Error: 95_000 - .saturating_add((16_374_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) + (465_285_000 as Weight) + // Standard Error: 2_599_000 + .saturating_add((155_106_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(55 as Weight)) + .saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_contains_storage(r: u32, ) -> Weight { - (220_970_000 as Weight) - // Standard Error: 154_000 - .saturating_add((92_945_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) + (179_118_000 as Weight) + // Standard Error: 572_000 + .saturating_add((311_083_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_contains_storage_per_kb(n: u32, ) -> Weight { - (292_713_000 as Weight) - // Standard Error: 101_000 - .saturating_add((16_474_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) + (423_056_000 as Weight) + // Standard Error: 2_037_000 + .saturating_add((69_665_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(54 as Weight)) + .saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_take_storage(r: u32, ) -> Weight { - (220_159_000 as Weight) - // Standard Error: 171_000 - .saturating_add((119_015_000 as Weight).saturating_mul(r as Weight)) + (188_884_000 as Weight) + // Standard Error: 761_000 + .saturating_add((432_781_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_take_storage_per_kb(n: u32, ) -> Weight { - (322_797_000 as Weight) - // Standard Error: 109_000 - .saturating_add((16_426_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (532_408_000 as Weight) + // Standard Error: 3_348_000 + .saturating_add((164_943_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(55 as Weight)) + .saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes(53 as Weight)) + .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(n as Weight))) } // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) @@ -672,9 +688,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_transfer(r: u32, ) -> Weight { - (137_099_000 as Weight) - // Standard Error: 1_180_000 - .saturating_add((1_465_493_000 as Weight).saturating_mul(r as Weight)) + (127_181_000 as Weight) + // Standard Error: 1_495_000 + .saturating_add((1_500_589_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) @@ -687,8 +703,8 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 20]`. fn seal_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 3_847_000 - .saturating_add((15_161_464_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 3_803_000 + .saturating_add((14_860_909_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -701,8 +717,8 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 20]`. fn seal_delegate_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_339_000 - .saturating_add((15_079_594_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 6_045_000 + .saturating_add((14_797_140_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -713,11 +729,11 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 1]`. /// The range of component `c` is `[0, 1024]`. fn seal_call_per_transfer_clone_kb(t: u32, c: u32, ) -> Weight { - (9_155_312_000 as Weight) - // Standard Error: 18_376_000 - .saturating_add((1_400_099_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 7_000 - .saturating_add((9_722_000 as Weight).saturating_mul(c as Weight)) + (9_196_444_000 as Weight) + // Standard Error: 20_486_000 + .saturating_add((1_458_153_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 8_000 + .saturating_add((9_718_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(85 as Weight)) .saturating_add(T::DbWeight::get().reads((81 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(81 as Weight)) @@ -732,8 +748,8 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 20]`. fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 33_664_000 - .saturating_add((21_285_172_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 36_253_000 + .saturating_add((21_201_529_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().reads((320 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) @@ -748,11 +764,11 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 1]`. /// The range of component `s` is `[0, 960]`. fn seal_instantiate_per_transfer_salt_kb(t: u32, s: u32, ) -> Weight { - (12_084_851_000 as Weight) - // Standard Error: 48_270_000 - .saturating_add((746_701_000 as Weight).saturating_mul(t as Weight)) + (12_282_498_000 as Weight) + // Standard Error: 48_112_000 + .saturating_add((720_795_000 as Weight).saturating_mul(t as Weight)) // Standard Error: 22_000 - .saturating_add((124_017_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((124_274_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(167 as Weight)) .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(165 as Weight)) @@ -764,9 +780,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_sha2_256(r: u32, ) -> Weight { - (207_117_000 as Weight) - // Standard Error: 120_000 - .saturating_add((65_616_000 as Weight).saturating_mul(r as Weight)) + (203_959_000 as Weight) + // Standard Error: 142_000 + .saturating_add((61_311_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -776,9 +792,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (298_759_000 as Weight) - // Standard Error: 43_000 - .saturating_add((356_036_000 as Weight).saturating_mul(n as Weight)) + (349_915_000 as Weight) + // Standard Error: 40_000 + .saturating_add((320_652_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -788,9 +804,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { - (211_104_000 as Weight) - // Standard Error: 162_000 - .saturating_add((72_998_000 as Weight).saturating_mul(r as Weight)) + (209_219_000 as Weight) + // Standard Error: 157_000 + .saturating_add((73_728_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -800,9 +816,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (243_076_000 as Weight) - // Standard Error: 31_000 - .saturating_add((245_455_000 as Weight).saturating_mul(n as Weight)) + (208_860_000 as Weight) + // Standard Error: 25_000 + .saturating_add((245_718_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -812,9 +828,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { - (208_430_000 as Weight) - // Standard Error: 114_000 - .saturating_add((51_167_000 as Weight).saturating_mul(r as Weight)) + (206_165_000 as Weight) + // Standard Error: 138_000 + .saturating_add((51_644_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -824,9 +840,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (270_149_000 as Weight) - // Standard Error: 13_000 - .saturating_add((94_962_000 as Weight).saturating_mul(n as Weight)) + (255_955_000 as Weight) + // Standard Error: 14_000 + .saturating_add((95_090_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -836,9 +852,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { - (208_494_000 as Weight) - // Standard Error: 130_000 - .saturating_add((51_502_000 as Weight).saturating_mul(r as Weight)) + (208_153_000 as Weight) + // Standard Error: 140_000 + .saturating_add((51_264_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -848,9 +864,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (271_999_000 as Weight) + (278_368_000 as Weight) // Standard Error: 14_000 - .saturating_add((94_942_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((95_006_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -860,9 +876,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { - (348_302_000 as Weight) - // Standard Error: 931_000 - .saturating_add((3_073_199_000 as Weight).saturating_mul(r as Weight)) + (331_955_000 as Weight) + // Standard Error: 1_155_000 + .saturating_add((3_069_955_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -872,9 +888,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { - (229_870_000 as Weight) - // Standard Error: 572_000 - .saturating_add((2_054_105_000 as Weight).saturating_mul(r as Weight)) + (207_838_000 as Weight) + // Standard Error: 783_000 + .saturating_add((2_058_503_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -886,316 +902,316 @@ impl WeightInfo for SubstrateWeight { /// The range of component `r` is `[0, 20]`. fn seal_set_code_hash(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 1_552_000 - .saturating_add((757_436_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 1_567_000 + .saturating_add((774_380_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes((79 as Weight).saturating_mul(r as Weight))) } /// The range of component `r` is `[0, 50]`. fn instr_i64const(r: u32, ) -> Weight { - (74_465_000 as Weight) - // Standard Error: 2_000 - .saturating_add((603_000 as Weight).saturating_mul(r as Weight)) + (73_955_000 as Weight) + // Standard Error: 1_000 + .saturating_add((612_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64load(r: u32, ) -> Weight { - (74_280_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_311_000 as Weight).saturating_mul(r as Weight)) + (74_057_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_324_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64store(r: u32, ) -> Weight { - (74_201_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_387_000 as Weight).saturating_mul(r as Weight)) + (74_137_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_427_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { - (74_062_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_777_000 as Weight).saturating_mul(r as Weight)) + (73_844_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_773_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { - (74_074_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_953_000 as Weight).saturating_mul(r as Weight)) + (73_979_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_952_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { - (73_914_000 as Weight) - // Standard Error: 2_000 - .saturating_add((939_000 as Weight).saturating_mul(r as Weight)) + (73_924_000 as Weight) + // Standard Error: 3_000 + .saturating_add((941_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { - (73_658_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_434_000 as Weight).saturating_mul(r as Weight)) + (73_574_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_439_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { - (73_228_000 as Weight) - // Standard Error: 8_000 - .saturating_add((1_629_000 as Weight).saturating_mul(r as Weight)) + (73_343_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_603_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { - (76_399_000 as Weight) + (76_267_000 as Weight) // Standard Error: 0 .saturating_add((4_000 as Weight).saturating_mul(e as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { - (74_937_000 as Weight) - // Standard Error: 9_000 - .saturating_add((7_088_000 as Weight).saturating_mul(r as Weight)) + (74_877_000 as Weight) + // Standard Error: 12_000 + .saturating_add((7_144_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { - (87_295_000 as Weight) - // Standard Error: 17_000 - .saturating_add((9_133_000 as Weight).saturating_mul(r as Weight)) + (88_665_000 as Weight) + // Standard Error: 20_000 + .saturating_add((9_142_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (98_101_000 as Weight) - // Standard Error: 1_000 - .saturating_add((471_000 as Weight).saturating_mul(p as Weight)) + (98_600_000 as Weight) + // Standard Error: 2_000 + .saturating_add((469_000 as Weight).saturating_mul(p as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { - (74_727_000 as Weight) + (74_555_000 as Weight) // Standard Error: 1_000 .saturating_add((624_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { - (74_481_000 as Weight) - // Standard Error: 3_000 - .saturating_add((707_000 as Weight).saturating_mul(r as Weight)) + (74_329_000 as Weight) + // Standard Error: 1_000 + .saturating_add((688_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { - (74_484_000 as Weight) + (74_612_000 as Weight) // Standard Error: 1_000 - .saturating_add((918_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((909_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { - (77_085_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_197_000 as Weight).saturating_mul(r as Weight)) + (76_906_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_192_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { - (77_052_000 as Weight) + (76_979_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_366_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_361_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { - (74_392_000 as Weight) - // Standard Error: 2_000 - .saturating_add((665_000 as Weight).saturating_mul(r as Weight)) + (74_370_000 as Weight) + // Standard Error: 3_000 + .saturating_add((661_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 1]`. fn instr_memory_grow(r: u32, ) -> Weight { - (75_342_000 as Weight) - // Standard Error: 46_000 - .saturating_add((177_994_000 as Weight).saturating_mul(r as Weight)) + (73_584_000 as Weight) + // Standard Error: 353_000 + .saturating_add((187_114_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { - (74_090_000 as Weight) - // Standard Error: 2_000 - .saturating_add((893_000 as Weight).saturating_mul(r as Weight)) + (74_206_000 as Weight) + // Standard Error: 1_000 + .saturating_add((884_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { - (74_474_000 as Weight) - // Standard Error: 3_000 - .saturating_add((882_000 as Weight).saturating_mul(r as Weight)) + (73_992_000 as Weight) + // Standard Error: 1_000 + .saturating_add((893_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { - (74_326_000 as Weight) - // Standard Error: 4_000 - .saturating_add((886_000 as Weight).saturating_mul(r as Weight)) + (73_985_000 as Weight) + // Standard Error: 2_000 + .saturating_add((891_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { - (74_503_000 as Weight) - // Standard Error: 1_000 - .saturating_add((888_000 as Weight).saturating_mul(r as Weight)) + (74_117_000 as Weight) + // Standard Error: 4_000 + .saturating_add((901_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { - (74_178_000 as Weight) - // Standard Error: 2_000 - .saturating_add((888_000 as Weight).saturating_mul(r as Weight)) + (73_981_000 as Weight) + // Standard Error: 1_000 + .saturating_add((866_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { - (73_789_000 as Weight) - // Standard Error: 2_000 - .saturating_add((898_000 as Weight).saturating_mul(r as Weight)) + (74_104_000 as Weight) + // Standard Error: 3_000 + .saturating_add((868_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { - (74_202_000 as Weight) - // Standard Error: 5_000 - .saturating_add((892_000 as Weight).saturating_mul(r as Weight)) + (74_293_000 as Weight) + // Standard Error: 3_000 + .saturating_add((878_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { - (74_191_000 as Weight) + (74_055_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { - (73_945_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) + (73_710_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_360_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { - (74_139_000 as Weight) - // Standard Error: 2_000 + (73_917_000 as Weight) + // Standard Error: 1_000 .saturating_add((1_355_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { - (74_165_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) + (74_048_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_360_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { - (73_898_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_362_000 as Weight).saturating_mul(r as Weight)) + (74_029_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_349_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { - (74_078_000 as Weight) + (74_267_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_364_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_353_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { - (73_847_000 as Weight) + (73_952_000 as Weight) // Standard Error: 1_000 - .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { - (74_166_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_362_000 as Weight).saturating_mul(r as Weight)) + (73_851_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_368_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { - (73_950_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_363_000 as Weight).saturating_mul(r as Weight)) + (74_034_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_348_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { - (73_652_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) + (73_979_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_353_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { - (73_841_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_343_000 as Weight).saturating_mul(r as Weight)) + (74_000_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_328_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { - (74_117_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_328_000 as Weight).saturating_mul(r as Weight)) + (73_883_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_331_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { - (73_893_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_339_000 as Weight).saturating_mul(r as Weight)) + (74_216_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_324_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { - (73_803_000 as Weight) - // Standard Error: 3_000 - .saturating_add((2_028_000 as Weight).saturating_mul(r as Weight)) + (73_989_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_998_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { - (74_184_000 as Weight) - // Standard Error: 2_000 - .saturating_add((2_057_000 as Weight).saturating_mul(r as Weight)) + (73_857_000 as Weight) + // Standard Error: 4_000 + .saturating_add((2_073_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { - (74_084_000 as Weight) - // Standard Error: 5_000 - .saturating_add((2_025_000 as Weight).saturating_mul(r as Weight)) + (73_801_000 as Weight) + // Standard Error: 1_000 + .saturating_add((2_027_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { - (74_069_000 as Weight) - // Standard Error: 3_000 - .saturating_add((2_027_000 as Weight).saturating_mul(r as Weight)) + (74_130_000 as Weight) + // Standard Error: 1_000 + .saturating_add((2_064_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { - (74_006_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_333_000 as Weight).saturating_mul(r as Weight)) + (74_071_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_327_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { - (73_959_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_335_000 as Weight).saturating_mul(r as Weight)) + (74_201_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { - (74_062_000 as Weight) + (74_241_000 as Weight) // Standard Error: 1_000 - .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_321_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { - (74_023_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_354_000 as Weight).saturating_mul(r as Weight)) + (74_331_000 as Weight) + // Standard Error: 6_000 + .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { - (74_261_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) + (73_674_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { - (73_843_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_368_000 as Weight).saturating_mul(r as Weight)) + (73_807_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_358_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { - (74_173_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_357_000 as Weight).saturating_mul(r as Weight)) + (73_725_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_358_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { - (73_827_000 as Weight) + (73_755_000 as Weight) // Standard Error: 3_000 - .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_360_000 as Weight).saturating_mul(r as Weight)) } } @@ -1203,15 +1219,15 @@ impl WeightInfo for SubstrateWeight { impl WeightInfo for () { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_process_deletion_queue_batch() -> Weight { - (1_648_000 as Weight) + (1_654_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32, ) -> Weight { - (7_105_000 as Weight) + (8_564_000 as Weight) // Standard Error: 0 - .saturating_add((879_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((868_000 as Weight).saturating_mul(k as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(k as Weight))) @@ -1220,8 +1236,8 @@ impl WeightInfo for () { /// The range of component `q` is `[0, 1024]`. fn on_initialize_per_queue_item(q: u32, ) -> Weight { (0 as Weight) - // Standard Error: 4_000 - .saturating_add((1_874_000 as Weight).saturating_mul(q as Weight)) + // Standard Error: 5_000 + .saturating_add((1_944_000 as Weight).saturating_mul(q as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1229,7 +1245,7 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn reinstrument(c: u32, ) -> Weight { - (17_962_000 as Weight) + (19_016_000 as Weight) // Standard Error: 0 .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) @@ -1241,7 +1257,7 @@ impl WeightInfo for () { // Storage: System Account (r:1 w:1) /// The range of component `c` is `[0, 131072]`. fn call_with_code_per_byte(c: u32, ) -> Weight { - (207_433_000 as Weight) + (205_194_000 as Weight) // Standard Error: 0 .saturating_add((53_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) @@ -1257,9 +1273,9 @@ impl WeightInfo for () { /// The range of component `c` is `[0, 64226]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (218_094_000 as Weight) + (288_487_000 as Weight) // Standard Error: 0 - .saturating_add((126_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((124_000 as Weight).saturating_mul(c as Weight)) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) @@ -1273,7 +1289,7 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `s` is `[0, 1048576]`. fn instantiate(s: u32, ) -> Weight { - (184_236_000 as Weight) + (186_136_000 as Weight) // Standard Error: 0 .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) @@ -1284,7 +1300,7 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: System Account (r:1 w:1) fn call() -> Weight { - (148_764_000 as Weight) + (149_232_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } @@ -1293,9 +1309,9 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:0 w:1) /// The range of component `c` is `[0, 64226]`. fn upload_code(c: u32, ) -> Weight { - (48_474_000 as Weight) + (51_721_000 as Weight) // Standard Error: 0 - .saturating_add((49_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((48_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } @@ -1303,14 +1319,14 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - (29_301_000 as Weight) + (30_016_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:2 w:2) fn set_code() -> Weight { - (26_779_000 as Weight) + (27_192_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } @@ -1320,9 +1336,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_caller(r: u32, ) -> Weight { - (210_501_000 as Weight) - // Standard Error: 96_000 - .saturating_add((40_406_000 as Weight).saturating_mul(r as Weight)) + (206_405_000 as Weight) + // Standard Error: 112_000 + .saturating_add((40_987_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1332,9 +1348,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_is_contract(r: u32, ) -> Weight { - (98_460_000 as Weight) - // Standard Error: 717_000 - .saturating_add((302_159_000 as Weight).saturating_mul(r as Weight)) + (106_220_000 as Weight) + // Standard Error: 710_000 + .saturating_add((307_648_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1345,9 +1361,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_code_hash(r: u32, ) -> Weight { - (100_103_000 as Weight) - // Standard Error: 687_000 - .saturating_add((360_394_000 as Weight).saturating_mul(r as Weight)) + (104_498_000 as Weight) + // Standard Error: 633_000 + .saturating_add((368_901_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1358,9 +1374,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_own_code_hash(r: u32, ) -> Weight { - (210_131_000 as Weight) - // Standard Error: 102_000 - .saturating_add((43_916_000 as Weight).saturating_mul(r as Weight)) + (208_696_000 as Weight) + // Standard Error: 101_000 + .saturating_add((44_445_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1370,9 +1386,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_caller_is_origin(r: u32, ) -> Weight { - (208_603_000 as Weight) - // Standard Error: 56_000 - .saturating_add((16_961_000 as Weight).saturating_mul(r as Weight)) + (205_612_000 as Weight) + // Standard Error: 68_000 + .saturating_add((17_145_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1382,9 +1398,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_address(r: u32, ) -> Weight { - (209_735_000 as Weight) - // Standard Error: 102_000 - .saturating_add((40_378_000 as Weight).saturating_mul(r as Weight)) + (206_947_000 as Weight) + // Standard Error: 107_000 + .saturating_add((40_789_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1394,9 +1410,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_gas_left(r: u32, ) -> Weight { - (213_032_000 as Weight) - // Standard Error: 112_000 - .saturating_add((39_716_000 as Weight).saturating_mul(r as Weight)) + (208_692_000 as Weight) + // Standard Error: 109_000 + .saturating_add((40_600_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1406,9 +1422,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_balance(r: u32, ) -> Weight { - (216_266_000 as Weight) - // Standard Error: 149_000 - .saturating_add((117_042_000 as Weight).saturating_mul(r as Weight)) + (209_811_000 as Weight) + // Standard Error: 208_000 + .saturating_add((116_831_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1418,9 +1434,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_value_transferred(r: u32, ) -> Weight { - (210_124_000 as Weight) - // Standard Error: 112_000 - .saturating_add((39_859_000 as Weight).saturating_mul(r as Weight)) + (207_406_000 as Weight) + // Standard Error: 117_000 + .saturating_add((40_702_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1430,9 +1446,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_minimum_balance(r: u32, ) -> Weight { - (210_515_000 as Weight) - // Standard Error: 117_000 - .saturating_add((40_007_000 as Weight).saturating_mul(r as Weight)) + (209_260_000 as Weight) + // Standard Error: 130_000 + .saturating_add((40_479_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1442,9 +1458,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_block_number(r: u32, ) -> Weight { - (212_737_000 as Weight) - // Standard Error: 111_000 - .saturating_add((39_346_000 as Weight).saturating_mul(r as Weight)) + (206_448_000 as Weight) + // Standard Error: 95_000 + .saturating_add((40_134_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1454,9 +1470,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_now(r: u32, ) -> Weight { - (211_734_000 as Weight) - // Standard Error: 112_000 - .saturating_add((39_519_000 as Weight).saturating_mul(r as Weight)) + (206_969_000 as Weight) + // Standard Error: 116_000 + .saturating_add((40_251_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1467,9 +1483,9 @@ impl WeightInfo for () { // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_weight_to_fee(r: u32, ) -> Weight { - (212_008_000 as Weight) - // Standard Error: 159_000 - .saturating_add((99_864_000 as Weight).saturating_mul(r as Weight)) + (211_611_000 as Weight) + // Standard Error: 175_000 + .saturating_add((98_675_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1479,9 +1495,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_gas(r: u32, ) -> Weight { - (134_321_000 as Weight) - // Standard Error: 49_000 - .saturating_add((19_059_000 as Weight).saturating_mul(r as Weight)) + (134_484_000 as Weight) + // Standard Error: 57_000 + .saturating_add((19_329_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1491,9 +1507,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_input(r: u32, ) -> Weight { - (210_459_000 as Weight) - // Standard Error: 102_000 - .saturating_add((39_198_000 as Weight).saturating_mul(r as Weight)) + (208_556_000 as Weight) + // Standard Error: 125_000 + .saturating_add((40_328_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1503,9 +1519,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_input_per_kb(n: u32, ) -> Weight { - (272_954_000 as Weight) - // Standard Error: 5_000 - .saturating_add((9_632_000 as Weight).saturating_mul(n as Weight)) + (268_886_000 as Weight) + // Standard Error: 4_000 + .saturating_add((9_627_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1514,10 +1530,8 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 1]`. - fn seal_return(r: u32, ) -> Weight { - (205_473_000 as Weight) - // Standard Error: 130_000 - .saturating_add((1_681_000 as Weight).saturating_mul(r as Weight)) + fn seal_return(_r: u32, ) -> Weight { + (203_591_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1527,7 +1541,7 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_return_per_kb(n: u32, ) -> Weight { - (207_350_000 as Weight) + (204_258_000 as Weight) // Standard Error: 0 .saturating_add((183_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) @@ -1541,9 +1555,9 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:1 w:1) /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32, ) -> Weight { - (213_057_000 as Weight) - // Standard Error: 151_000 - .saturating_add((50_517_000 as Weight).saturating_mul(r as Weight)) + (206_625_000 as Weight) + // Standard Error: 672_000 + .saturating_add((59_377_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1556,9 +1570,9 @@ impl WeightInfo for () { // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_random(r: u32, ) -> Weight { - (214_002_000 as Weight) - // Standard Error: 153_000 - .saturating_add((130_262_000 as Weight).saturating_mul(r as Weight)) + (208_866_000 as Weight) + // Standard Error: 164_000 + .saturating_add((133_438_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1568,9 +1582,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_deposit_event(r: u32, ) -> Weight { - (214_665_000 as Weight) - // Standard Error: 219_000 - .saturating_add((236_330_000 as Weight).saturating_mul(r as Weight)) + (220_860_000 as Weight) + // Standard Error: 209_000 + .saturating_add((239_951_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1582,11 +1596,11 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 4]`. /// The range of component `n` is `[0, 16]`. fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (455_398_000 as Weight) - // Standard Error: 1_991_000 - .saturating_add((251_794_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 392_000 - .saturating_add((66_900_000 as Weight).saturating_mul(n as Weight)) + (439_782_000 as Weight) + // Standard Error: 1_643_000 + .saturating_add((264_687_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 323_000 + .saturating_add((67_636_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1598,110 +1612,128 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_debug_message(r: u32, ) -> Weight { - (139_616_000 as Weight) - // Standard Error: 78_000 - .saturating_add((32_049_000 as Weight).saturating_mul(r as Weight)) + (140_280_000 as Weight) + // Standard Error: 82_000 + .saturating_add((32_717_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_set_storage(r: u32, ) -> Weight { - (245_092_000 as Weight) - // Standard Error: 187_000 - .saturating_add((131_710_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(RocksDbWeight::get().reads(6 as Weight)) - .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + (161_247_000 as Weight) + // Standard Error: 883_000 + .saturating_add((423_997_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_set_storage_per_new_kb(n: u32, ) -> Weight { - (372_948_000 as Weight) - // Standard Error: 165_000 - .saturating_add((34_059_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(6 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + (529_247_000 as Weight) + // Standard Error: 2_745_000 + .saturating_add((85_282_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(55 as Weight)) + .saturating_add(RocksDbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(RocksDbWeight::get().writes(53 as Weight)) + .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(n as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_set_storage_per_old_kb(n: u32, ) -> Weight { - (361_086_000 as Weight) - // Standard Error: 137_000 - .saturating_add((17_044_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(6 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + (529_812_000 as Weight) + // Standard Error: 2_513_000 + .saturating_add((74_554_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(55 as Weight)) + .saturating_add(RocksDbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(RocksDbWeight::get().writes(53 as Weight)) + .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(n as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_clear_storage(r: u32, ) -> Weight { - (222_690_000 as Weight) - // Standard Error: 190_000 - .saturating_add((108_740_000 as Weight).saturating_mul(r as Weight)) + (184_803_000 as Weight) + // Standard Error: 733_000 + .saturating_add((404_933_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_clear_storage_per_kb(n: u32, ) -> Weight { - (311_458_000 as Weight) - // Standard Error: 111_000 - .saturating_add((16_426_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(5 as Weight)) - .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + (500_958_000 as Weight) + // Standard Error: 2_980_000 + .saturating_add((75_996_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(55 as Weight)) + .saturating_add(RocksDbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(RocksDbWeight::get().writes(52 as Weight)) + .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(n as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_get_storage(r: u32, ) -> Weight { - (223_269_000 as Weight) - // Standard Error: 163_000 - .saturating_add((101_915_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + (177_682_000 as Weight) + // Standard Error: 743_000 + .saturating_add((338_172_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (304_319_000 as Weight) - // Standard Error: 95_000 - .saturating_add((16_374_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + (465_285_000 as Weight) + // Standard Error: 2_599_000 + .saturating_add((155_106_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(55 as Weight)) + .saturating_add(RocksDbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_contains_storage(r: u32, ) -> Weight { - (220_970_000 as Weight) - // Standard Error: 154_000 - .saturating_add((92_945_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + (179_118_000 as Weight) + // Standard Error: 572_000 + .saturating_add((311_083_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_contains_storage_per_kb(n: u32, ) -> Weight { - (292_713_000 as Weight) - // Standard Error: 101_000 - .saturating_add((16_474_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + (423_056_000 as Weight) + // Standard Error: 2_037_000 + .saturating_add((69_665_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(54 as Weight)) + .saturating_add(RocksDbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `r` is `[0, 20]`. + /// The range of component `r` is `[0, 10]`. fn seal_take_storage(r: u32, ) -> Weight { - (220_159_000 as Weight) - // Standard Error: 171_000 - .saturating_add((119_015_000 as Weight).saturating_mul(r as Weight)) + (188_884_000 as Weight) + // Standard Error: 761_000 + .saturating_add((432_781_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes((80 as Weight).saturating_mul(r as Weight))) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `n` is `[0, 16]`. + /// The range of component `n` is `[0, 8]`. fn seal_take_storage_per_kb(n: u32, ) -> Weight { - (322_797_000 as Weight) - // Standard Error: 109_000 - .saturating_add((16_426_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(RocksDbWeight::get().reads(5 as Weight)) - .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + (532_408_000 as Weight) + // Standard Error: 3_348_000 + .saturating_add((164_943_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(55 as Weight)) + .saturating_add(RocksDbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(RocksDbWeight::get().writes(53 as Weight)) + .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(n as Weight))) } // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) @@ -1709,9 +1741,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_transfer(r: u32, ) -> Weight { - (137_099_000 as Weight) - // Standard Error: 1_180_000 - .saturating_add((1_465_493_000 as Weight).saturating_mul(r as Weight)) + (127_181_000 as Weight) + // Standard Error: 1_495_000 + .saturating_add((1_500_589_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) @@ -1724,8 +1756,8 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 20]`. fn seal_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 3_847_000 - .saturating_add((15_161_464_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 3_803_000 + .saturating_add((14_860_909_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((80 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1738,8 +1770,8 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 20]`. fn seal_delegate_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_339_000 - .saturating_add((15_079_594_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 6_045_000 + .saturating_add((14_797_140_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1750,11 +1782,11 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 1]`. /// The range of component `c` is `[0, 1024]`. fn seal_call_per_transfer_clone_kb(t: u32, c: u32, ) -> Weight { - (9_155_312_000 as Weight) - // Standard Error: 18_376_000 - .saturating_add((1_400_099_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 7_000 - .saturating_add((9_722_000 as Weight).saturating_mul(c as Weight)) + (9_196_444_000 as Weight) + // Standard Error: 20_486_000 + .saturating_add((1_458_153_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 8_000 + .saturating_add((9_718_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(85 as Weight)) .saturating_add(RocksDbWeight::get().reads((81 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(81 as Weight)) @@ -1769,8 +1801,8 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 20]`. fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 33_664_000 - .saturating_add((21_285_172_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 36_253_000 + .saturating_add((21_201_529_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().reads((320 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) @@ -1785,11 +1817,11 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 1]`. /// The range of component `s` is `[0, 960]`. fn seal_instantiate_per_transfer_salt_kb(t: u32, s: u32, ) -> Weight { - (12_084_851_000 as Weight) - // Standard Error: 48_270_000 - .saturating_add((746_701_000 as Weight).saturating_mul(t as Weight)) + (12_282_498_000 as Weight) + // Standard Error: 48_112_000 + .saturating_add((720_795_000 as Weight).saturating_mul(t as Weight)) // Standard Error: 22_000 - .saturating_add((124_017_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((124_274_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(167 as Weight)) .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(165 as Weight)) @@ -1801,9 +1833,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_sha2_256(r: u32, ) -> Weight { - (207_117_000 as Weight) - // Standard Error: 120_000 - .saturating_add((65_616_000 as Weight).saturating_mul(r as Weight)) + (203_959_000 as Weight) + // Standard Error: 142_000 + .saturating_add((61_311_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1813,9 +1845,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (298_759_000 as Weight) - // Standard Error: 43_000 - .saturating_add((356_036_000 as Weight).saturating_mul(n as Weight)) + (349_915_000 as Weight) + // Standard Error: 40_000 + .saturating_add((320_652_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1825,9 +1857,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { - (211_104_000 as Weight) - // Standard Error: 162_000 - .saturating_add((72_998_000 as Weight).saturating_mul(r as Weight)) + (209_219_000 as Weight) + // Standard Error: 157_000 + .saturating_add((73_728_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1837,9 +1869,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (243_076_000 as Weight) - // Standard Error: 31_000 - .saturating_add((245_455_000 as Weight).saturating_mul(n as Weight)) + (208_860_000 as Weight) + // Standard Error: 25_000 + .saturating_add((245_718_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1849,9 +1881,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { - (208_430_000 as Weight) - // Standard Error: 114_000 - .saturating_add((51_167_000 as Weight).saturating_mul(r as Weight)) + (206_165_000 as Weight) + // Standard Error: 138_000 + .saturating_add((51_644_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1861,9 +1893,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (270_149_000 as Weight) - // Standard Error: 13_000 - .saturating_add((94_962_000 as Weight).saturating_mul(n as Weight)) + (255_955_000 as Weight) + // Standard Error: 14_000 + .saturating_add((95_090_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1873,9 +1905,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { - (208_494_000 as Weight) - // Standard Error: 130_000 - .saturating_add((51_502_000 as Weight).saturating_mul(r as Weight)) + (208_153_000 as Weight) + // Standard Error: 140_000 + .saturating_add((51_264_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1885,9 +1917,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `n` is `[0, 1024]`. fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (271_999_000 as Weight) + (278_368_000 as Weight) // Standard Error: 14_000 - .saturating_add((94_942_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((95_006_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1897,9 +1929,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { - (348_302_000 as Weight) - // Standard Error: 931_000 - .saturating_add((3_073_199_000 as Weight).saturating_mul(r as Weight)) + (331_955_000 as Weight) + // Standard Error: 1_155_000 + .saturating_add((3_069_955_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1909,9 +1941,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) /// The range of component `r` is `[0, 20]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { - (229_870_000 as Weight) - // Standard Error: 572_000 - .saturating_add((2_054_105_000 as Weight).saturating_mul(r as Weight)) + (207_838_000 as Weight) + // Standard Error: 783_000 + .saturating_add((2_058_503_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1923,315 +1955,315 @@ impl WeightInfo for () { /// The range of component `r` is `[0, 20]`. fn seal_set_code_hash(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 1_552_000 - .saturating_add((757_436_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 1_567_000 + .saturating_add((774_380_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads((79 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes((79 as Weight).saturating_mul(r as Weight))) } /// The range of component `r` is `[0, 50]`. fn instr_i64const(r: u32, ) -> Weight { - (74_465_000 as Weight) - // Standard Error: 2_000 - .saturating_add((603_000 as Weight).saturating_mul(r as Weight)) + (73_955_000 as Weight) + // Standard Error: 1_000 + .saturating_add((612_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64load(r: u32, ) -> Weight { - (74_280_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_311_000 as Weight).saturating_mul(r as Weight)) + (74_057_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_324_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64store(r: u32, ) -> Weight { - (74_201_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_387_000 as Weight).saturating_mul(r as Weight)) + (74_137_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_427_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { - (74_062_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_777_000 as Weight).saturating_mul(r as Weight)) + (73_844_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_773_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { - (74_074_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_953_000 as Weight).saturating_mul(r as Weight)) + (73_979_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_952_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { - (73_914_000 as Weight) - // Standard Error: 2_000 - .saturating_add((939_000 as Weight).saturating_mul(r as Weight)) + (73_924_000 as Weight) + // Standard Error: 3_000 + .saturating_add((941_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { - (73_658_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_434_000 as Weight).saturating_mul(r as Weight)) + (73_574_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_439_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { - (73_228_000 as Weight) - // Standard Error: 8_000 - .saturating_add((1_629_000 as Weight).saturating_mul(r as Weight)) + (73_343_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_603_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { - (76_399_000 as Weight) + (76_267_000 as Weight) // Standard Error: 0 .saturating_add((4_000 as Weight).saturating_mul(e as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { - (74_937_000 as Weight) - // Standard Error: 9_000 - .saturating_add((7_088_000 as Weight).saturating_mul(r as Weight)) + (74_877_000 as Weight) + // Standard Error: 12_000 + .saturating_add((7_144_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { - (87_295_000 as Weight) - // Standard Error: 17_000 - .saturating_add((9_133_000 as Weight).saturating_mul(r as Weight)) + (88_665_000 as Weight) + // Standard Error: 20_000 + .saturating_add((9_142_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (98_101_000 as Weight) - // Standard Error: 1_000 - .saturating_add((471_000 as Weight).saturating_mul(p as Weight)) + (98_600_000 as Weight) + // Standard Error: 2_000 + .saturating_add((469_000 as Weight).saturating_mul(p as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { - (74_727_000 as Weight) + (74_555_000 as Weight) // Standard Error: 1_000 .saturating_add((624_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { - (74_481_000 as Weight) - // Standard Error: 3_000 - .saturating_add((707_000 as Weight).saturating_mul(r as Weight)) + (74_329_000 as Weight) + // Standard Error: 1_000 + .saturating_add((688_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { - (74_484_000 as Weight) + (74_612_000 as Weight) // Standard Error: 1_000 - .saturating_add((918_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((909_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { - (77_085_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_197_000 as Weight).saturating_mul(r as Weight)) + (76_906_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_192_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { - (77_052_000 as Weight) + (76_979_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_366_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_361_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { - (74_392_000 as Weight) - // Standard Error: 2_000 - .saturating_add((665_000 as Weight).saturating_mul(r as Weight)) + (74_370_000 as Weight) + // Standard Error: 3_000 + .saturating_add((661_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 1]`. fn instr_memory_grow(r: u32, ) -> Weight { - (75_342_000 as Weight) - // Standard Error: 46_000 - .saturating_add((177_994_000 as Weight).saturating_mul(r as Weight)) + (73_584_000 as Weight) + // Standard Error: 353_000 + .saturating_add((187_114_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { - (74_090_000 as Weight) - // Standard Error: 2_000 - .saturating_add((893_000 as Weight).saturating_mul(r as Weight)) + (74_206_000 as Weight) + // Standard Error: 1_000 + .saturating_add((884_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { - (74_474_000 as Weight) - // Standard Error: 3_000 - .saturating_add((882_000 as Weight).saturating_mul(r as Weight)) + (73_992_000 as Weight) + // Standard Error: 1_000 + .saturating_add((893_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { - (74_326_000 as Weight) - // Standard Error: 4_000 - .saturating_add((886_000 as Weight).saturating_mul(r as Weight)) + (73_985_000 as Weight) + // Standard Error: 2_000 + .saturating_add((891_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { - (74_503_000 as Weight) - // Standard Error: 1_000 - .saturating_add((888_000 as Weight).saturating_mul(r as Weight)) + (74_117_000 as Weight) + // Standard Error: 4_000 + .saturating_add((901_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { - (74_178_000 as Weight) - // Standard Error: 2_000 - .saturating_add((888_000 as Weight).saturating_mul(r as Weight)) + (73_981_000 as Weight) + // Standard Error: 1_000 + .saturating_add((866_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { - (73_789_000 as Weight) - // Standard Error: 2_000 - .saturating_add((898_000 as Weight).saturating_mul(r as Weight)) + (74_104_000 as Weight) + // Standard Error: 3_000 + .saturating_add((868_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { - (74_202_000 as Weight) - // Standard Error: 5_000 - .saturating_add((892_000 as Weight).saturating_mul(r as Weight)) + (74_293_000 as Weight) + // Standard Error: 3_000 + .saturating_add((878_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { - (74_191_000 as Weight) + (74_055_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { - (73_945_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) + (73_710_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_360_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { - (74_139_000 as Weight) - // Standard Error: 2_000 + (73_917_000 as Weight) + // Standard Error: 1_000 .saturating_add((1_355_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { - (74_165_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) + (74_048_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_360_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { - (73_898_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_362_000 as Weight).saturating_mul(r as Weight)) + (74_029_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_349_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { - (74_078_000 as Weight) + (74_267_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_364_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_353_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { - (73_847_000 as Weight) + (73_952_000 as Weight) // Standard Error: 1_000 - .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_350_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { - (74_166_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_362_000 as Weight).saturating_mul(r as Weight)) + (73_851_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_368_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { - (73_950_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_363_000 as Weight).saturating_mul(r as Weight)) + (74_034_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_348_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { - (73_652_000 as Weight) - // Standard Error: 1_000 - .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) + (73_979_000 as Weight) + // Standard Error: 3_000 + .saturating_add((1_353_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { - (73_841_000 as Weight) - // Standard Error: 4_000 - .saturating_add((1_343_000 as Weight).saturating_mul(r as Weight)) + (74_000_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_328_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { - (74_117_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_328_000 as Weight).saturating_mul(r as Weight)) + (73_883_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_331_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { - (73_893_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_339_000 as Weight).saturating_mul(r as Weight)) + (74_216_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_324_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { - (73_803_000 as Weight) - // Standard Error: 3_000 - .saturating_add((2_028_000 as Weight).saturating_mul(r as Weight)) + (73_989_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_998_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { - (74_184_000 as Weight) - // Standard Error: 2_000 - .saturating_add((2_057_000 as Weight).saturating_mul(r as Weight)) + (73_857_000 as Weight) + // Standard Error: 4_000 + .saturating_add((2_073_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { - (74_084_000 as Weight) - // Standard Error: 5_000 - .saturating_add((2_025_000 as Weight).saturating_mul(r as Weight)) + (73_801_000 as Weight) + // Standard Error: 1_000 + .saturating_add((2_027_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { - (74_069_000 as Weight) - // Standard Error: 3_000 - .saturating_add((2_027_000 as Weight).saturating_mul(r as Weight)) + (74_130_000 as Weight) + // Standard Error: 1_000 + .saturating_add((2_064_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { - (74_006_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_333_000 as Weight).saturating_mul(r as Weight)) + (74_071_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_327_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { - (73_959_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_335_000 as Weight).saturating_mul(r as Weight)) + (74_201_000 as Weight) + // Standard Error: 4_000 + .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { - (74_062_000 as Weight) + (74_241_000 as Weight) // Standard Error: 1_000 - .saturating_add((1_330_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_321_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { - (74_023_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_354_000 as Weight).saturating_mul(r as Weight)) + (74_331_000 as Weight) + // Standard Error: 6_000 + .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { - (74_261_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_347_000 as Weight).saturating_mul(r as Weight)) + (73_674_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_359_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { - (73_843_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_368_000 as Weight).saturating_mul(r as Weight)) + (73_807_000 as Weight) + // Standard Error: 2_000 + .saturating_add((1_358_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { - (74_173_000 as Weight) - // Standard Error: 3_000 - .saturating_add((1_357_000 as Weight).saturating_mul(r as Weight)) + (73_725_000 as Weight) + // Standard Error: 1_000 + .saturating_add((1_358_000 as Weight).saturating_mul(r as Weight)) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { - (73_827_000 as Weight) + (73_755_000 as Weight) // Standard Error: 3_000 - .saturating_add((1_365_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_360_000 as Weight).saturating_mul(r as Weight)) } } From f34676c813c188862c7e1cf4f1141fe88ecae0e8 Mon Sep 17 00:00:00 2001 From: Alexander Gryaznov Date: Thu, 23 Jun 2022 13:35:29 +0300 Subject: [PATCH 63/63] minor optimization --- frame/contracts/src/wasm/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index ae9ee31b8d68f..3dd5da187b258 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -444,7 +444,8 @@ mod tests { value: Option>, take_old: bool, ) -> Result { - let entry = self.storage.entry(key.to_vec()); + 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) => @@ -452,7 +453,7 @@ mod tests { (Entry::Occupied(entry), true) => WriteOutcome::Taken(entry.remove()), }; if let Some(value) = value { - self.storage.insert(key.to_vec(), value); + self.storage.insert(key, value); } Ok(result) } @@ -462,7 +463,8 @@ mod tests { value: Option>, take_old: bool, ) -> Result { - let entry = self.storage.entry(key.to_vec()); + 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) => @@ -470,7 +472,7 @@ mod tests { (Entry::Occupied(entry), true) => WriteOutcome::Taken(entry.remove()), }; if let Some(value) = value { - self.storage.insert(key.to_vec(), value); + self.storage.insert(key, value); } Ok(result) }