From 4ea2fe5c94f36a5979520edfa082976e22b767f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 15 Dec 2021 10:32:00 +0100 Subject: [PATCH] Add new versions for storage access host functions --- frame/contracts/src/benchmarking/mod.rs | 177 +++- frame/contracts/src/exec.rs | 122 ++- frame/contracts/src/schedule.rs | 12 + frame/contracts/src/storage.rs | 39 +- frame/contracts/src/tests.rs | 9 +- frame/contracts/src/wasm/mod.rs | 314 +++++- frame/contracts/src/wasm/runtime.rs | 152 ++- frame/contracts/src/weights.rs | 1163 ++++++++++++----------- 8 files changed, 1388 insertions(+), 600 deletions(-) diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index ae39d1feca114..45411dbe536f8 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -134,7 +134,7 @@ where fn store(&self, items: &Vec<(StorageKey, Vec)>) -> Result<(), &'static str> { let info = self.info()?; for item in items { - Storage::::write(&info.trie_id, &item.0, Some(item.1.clone()), None) + Storage::::write(&info.trie_id, &item.0, Some(item.1.clone()), None, false) .map_err(|_| "Failed to write storage to restoration dest")?; } >::insert(&self.account_id, info.clone()); @@ -784,10 +784,10 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", + module: "__unstable__", name: "seal_set_storage", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], - return_type: None, + return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { @@ -800,6 +800,7 @@ benchmarks! { Regular(Instruction::I32Const(0)), // value_ptr Regular(Instruction::I32Const(0)), // value_len Regular(Instruction::Call(0)), + Regular(Instruction::Drop), ])), .. Default::default() }); @@ -814,10 +815,10 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", + module: "__unstable__", name: "seal_set_storage", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], - return_type: None, + return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { @@ -830,6 +831,7 @@ benchmarks! { Instruction::I32Const(0), // value_ptr Instruction::I32Const((n * 1024) as i32), // value_len Instruction::Call(0), + Instruction::Drop, ])), .. Default::default() }); @@ -851,10 +853,10 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "seal0", + module: "__unstable__", name: "seal_clear_storage", params: vec![ValueType::I32], - return_type: None, + return_type: Some(ValueType::I32), }], data_segments: vec![ DataSegment { @@ -865,6 +867,7 @@ benchmarks! { call_body: Some(body::repeated_dyn(r * API_BENCHMARK_BATCH_SIZE, vec![ Counter(0, key_len as u32), Regular(Instruction::Call(0)), + Regular(Instruction::Drop), ])), .. Default::default() }); @@ -876,6 +879,7 @@ benchmarks! { key.as_slice().try_into().map_err(|e| "Key has wrong length")?, Some(vec![42; T::Schedule::get().limits.payload_len as usize]), None, + false, ) .map_err(|_| "Failed to write to storage during setup.")?; } @@ -906,6 +910,10 @@ benchmarks! { offset: 0, value: key_bytes, }, + DataSegment { + 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(0, key_len as u32), // key_ptr @@ -924,6 +932,54 @@ benchmarks! { key.as_slice().try_into().map_err(|e| "Key has wrong length")?, Some(vec![]), None, + false, + ) + .map_err(|_| "Failed to write to storage during setup.")?; + } + >::insert(&instance.account_id, info.clone()); + let origin = RawOrigin::Signed(instance.caller.clone()); + }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) + + // We make sure that all storage accesses are to unique keys. + #[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 = sp_std::mem::size_of::<::Output>(); + 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: "__unstable__", + name: "seal_contains_storage", + params: vec![ValueType::I32], + return_type: Some(ValueType::I32), + }], + data_segments: vec![ + DataSegment { + offset: 0, + 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::Call(0)), + Regular(Instruction::Drop), + ])), + .. Default::default() + }); + let instance = Contract::::new(code, vec![])?; + let info = instance.info()?; + for key in keys { + Storage::::write( + &info.trie_id, + key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + Some(vec![42; T::Schedule::get().limits.payload_len as usize]), + None, + false, ) .map_err(|_| "Failed to write to storage during setup.")?; } @@ -970,12 +1026,117 @@ benchmarks! { key.as_slice().try_into().map_err(|e| "Key has wrong length")?, Some(vec![42u8; (n * 1024) as usize]), None, + false, ) .map_err(|_| "Failed to write to storage during setup.")?; >::insert(&instance.account_id, info.clone()); let origin = RawOrigin::Signed(instance.caller.clone()); }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) + #[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 = sp_std::mem::size_of::<::Output>(); + 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: "__unstable__", + name: "seal_take_storage", + params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + return_type: Some(ValueType::I32), + }], + data_segments: vec![ + DataSegment { + offset: 0, + value: key_bytes, + }, + DataSegment { + 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(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 + Regular(Instruction::Call(0)), + Regular(Instruction::Drop), + ])), + .. Default::default() + }); + let instance = Contract::::new(code, vec![])?; + let info = instance.info()?; + for key in keys { + Storage::::write( + &info.trie_id, + key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + Some(vec![]), + None, + false, + ) + .map_err(|_| "Failed to write to storage during setup.")?; + } + >::insert(&instance.account_id, info.clone()); + let origin = RawOrigin::Signed(instance.caller.clone()); + }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) + + #[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 = sp_std::mem::size_of::<::Output>(); + 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: "__unstable__", + name: "seal_take_storage", + params: vec![ValueType::I32, ValueType::I32, ValueType::I32], + return_type: Some(ValueType::I32), + }], + data_segments: vec![ + DataSegment { + offset: 0, + value: key_bytes, + }, + DataSegment { + 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(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 + Regular(Instruction::Call(0)), + Regular(Instruction::Drop), + ])), + .. Default::default() + }); + let instance = Contract::::new(code, vec![])?; + let info = instance.info()?; + for key in keys { + Storage::::write( + &info.trie_id, + key.as_slice().try_into().map_err(|e| "Key has wrong length")?, + Some(vec![42u8; (n * 1024) as usize]), + None, + false, + ) + .map_err(|_| "Failed to write to storage during setup.")?; + } + >::insert(&instance.account_id, info.clone()); + let origin = RawOrigin::Signed(instance.caller.clone()); + }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) + // We transfer to unique accounts. seal_transfer { let r in 0 .. API_BENCHMARK_BATCHES; @@ -2285,7 +2446,7 @@ benchmarks! { // configured `Schedule` during benchmark development. // It can be outputed using the following command: // cargo run --manifest-path=bin/node/cli/Cargo.toml --release \ - // --features runtime-benchmarks -- benchmark --dev --execution=native \ + // --features runtime-benchmarks -- benchmark --extra --dev --execution=native \ // -p pallet_contracts -e print_schedule --no-median-slopes --no-min-squares #[extra] print_schedule { diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index bd54c7a08c636..ebaa8a81ebbdf 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -17,7 +17,7 @@ use crate::{ gas::GasMeter, - storage::{self, Storage}, + storage::{self, Storage, WriteOutcome}, AccountCounter, BalanceOf, CodeHash, Config, ContractInfo, ContractInfoOf, Error, Event, Pallet as Contracts, Schedule, }; @@ -140,9 +140,20 @@ pub trait Ext: sealing::Sealed { /// was deleted. fn get_storage(&mut self, key: &StorageKey) -> Option>; + /// Returns true iff some storage entry exists under the supplied `key` + /// + /// Returns `false` if the `key` wasn't previously set by `set_storage` or + /// was deleted. + fn contains_storage(&mut self, key: &StorageKey) -> bool; + /// 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, value: Option>) -> DispatchResult; + fn set_storage( + &mut self, + key: StorageKey, + value: Option>, + take_old: bool, + ) -> Result; /// Returns a reference to the account id of the caller. fn caller(&self) -> &AccountIdOf; @@ -985,13 +996,23 @@ where Storage::::read(&self.top_frame_mut().contract_info().trie_id, key) } - fn set_storage(&mut self, key: StorageKey, value: Option>) -> DispatchResult { + fn contains_storage(&mut self, key: &StorageKey) -> bool { + Storage::::contains(&self.top_frame_mut().contract_info().trie_id, key) + } + + fn set_storage( + &mut self, + key: StorageKey, + 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, ) } @@ -2349,4 +2370,99 @@ mod tests { assert_eq!(>::get(), 4); }); } + + #[test] + fn set_storage_works() { + let code_hash = MockLoader::insert(Call, |ctx, _| { + // Write + 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![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)); + + // Overwrite + assert_eq!( + 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), + 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([5; 32], Some(vec![]), false), + Ok(WriteOutcome::Overwritten(0)) + ); + assert_eq!( + ctx.ext.set_storage([6; 32], 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 contains_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.contains_storage(&[1; 32]), true); + assert_eq!(ctx.ext.contains_storage(&[1; 32]), true); + assert_eq!(ctx.ext.contains_storage(&[3; 32]), false); + + 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, + )); + }); + } } diff --git a/frame/contracts/src/schedule.rs b/frame/contracts/src/schedule.rs index b9acc9d49204f..ca5fa6eef3823 100644 --- a/frame/contracts/src/schedule.rs +++ b/frame/contracts/src/schedule.rs @@ -322,12 +322,21 @@ pub struct HostFnWeights { /// Weight of calling `seal_clear_storage`. pub clear_storage: Weight, + /// Weight of calling `seal_contains_storage`. + pub contains_storage: Weight, + /// Weight of calling `seal_get_storage`. pub get_storage: Weight, /// Weight per byte of an item received via `seal_get_storage`. pub get_storage_per_byte: Weight, + /// Weight of calling `seal_take_storage`. + pub take_storage: Weight, + + /// Weight per byte of an item received via `seal_take_storage`. + pub take_storage_per_byte: Weight, + /// Weight of calling `seal_transfer`. pub transfer: Weight, @@ -579,8 +588,11 @@ impl Default for HostFnWeights { set_storage: cost_batched!(seal_set_storage), set_storage_per_byte: cost_byte_batched!(seal_set_storage_per_kb), clear_storage: cost_batched!(seal_clear_storage), + contains_storage: cost_batched!(seal_contains_storage), get_storage: cost_batched!(seal_get_storage), get_storage_per_byte: cost_byte_batched!(seal_get_storage_per_kb), + take_storage: cost_batched!(seal_take_storage), + take_storage_per_byte: cost_byte_batched!(seal_take_storage_per_kb), transfer: cost_batched!(seal_transfer), call: cost_batched!(seal_call), call_transfer_surcharge: cost_batched_args!( diff --git a/frame/contracts/src/storage.rs b/frame/contracts/src/storage.rs index 6d67729a9a682..326183a2fc3c8 100644 --- a/frame/contracts/src/storage.rs +++ b/frame/contracts/src/storage.rs @@ -72,6 +72,21 @@ pub struct DeletedContract { pub(crate) trie_id: TrieId, } +/// Information about what happended to the pre-existing value when calling [`Storage::write`]. +#[cfg_attr(test, derive(Debug, PartialEq))] +pub enum WriteOutcome { + /// No value existed at the specified key. + New, + /// A value of the returned length was overwritten. + Overwritten(u32), + /// The returned value was taken out of storage before being overwritten. + /// + /// This is only returned when specifically requested because it causes additional work + /// depending on the size of the pre-existing value. When not requested [`Self::Overwritten`] + /// is returned instead. + Taken(Vec), +} + pub struct Storage(PhantomData); impl Storage @@ -87,9 +102,15 @@ where child::get_raw(&child_trie_info(trie_id), &blake2_256(key)) } + /// Returns `true` iff the `key` exists in storage. + pub fn contains(trie_id: &TrieId, key: &StorageKey) -> bool { + child::exists(&child_trie_info(trie_id), &blake2_256(key)) + } + /// Update a storage entry into a contract's kv storage. /// - /// If the `new_value` is `None` then the kv pair is removed. + /// If the `new_value` is `None` then the kv pair is removed. If `take` is true + /// a [`WriteOutcome::Taken`] is returned instead of a [`WriteOutcome::Overwritten`]. /// /// 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. @@ -98,13 +119,19 @@ where key: &StorageKey, new_value: Option>, storage_meter: Option<&mut meter::NestedMeter>, - ) -> DispatchResult { + take: bool, + ) -> Result { let hashed_key = blake2_256(key); 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); + (val.as_ref().map(|v| v.len() as u32), val) + } else { + (child::len(&child_trie_info, &hashed_key), None) + }; if let Some(storage_meter) = storage_meter { let mut diff = meter::Diff::default(); - let old_len = child::len(&child_trie_info, &hashed_key); match (old_len, new_value.as_ref().map(|v| v.len() as u32)) { (Some(old_len), Some(new_len)) => if new_len > old_len { @@ -130,7 +157,11 @@ where None => child::kill(&child_trie_info, &hashed_key), } - Ok(()) + Ok(match (old_len, old_value) { + (None, _) => WriteOutcome::New, + (Some(old_len), None) => WriteOutcome::Overwritten(old_len), + (Some(_), Some(old_value)) => WriteOutcome::Taken(old_value), + }) } /// Creates a new contract descriptor in the storage with the given code hash at the given diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 584253aeaadfe..f2a7dbd985039 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -1543,7 +1543,8 @@ 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).unwrap(); + Storage::::write(&info.trie_id, &val.0, Some(val.2.clone()), None, false) + .unwrap(); } >::insert(&addr, info.clone()); @@ -1627,7 +1628,8 @@ 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).unwrap(); + Storage::::write(&info.trie_id, &val.0, Some(val.2.clone()), None, false) + .unwrap(); } >::insert(&addr, info.clone()); @@ -1710,7 +1712,8 @@ 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).unwrap(); + Storage::::write(&info.trie_id, &val.0, 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 913894e8152db..2177dbcbfc189 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -257,21 +257,22 @@ mod tests { AccountIdOf, BlockNumberOf, ErrorOrigin, ExecError, Executable, Ext, SeedOf, StorageKey, }, gas::GasMeter, + storage::WriteOutcome, tests::{Call, Test, ALICE, BOB}, BalanceOf, CodeHash, Error, Pallet as Contracts, }; use assert_matches::assert_matches; - use frame_support::{ - assert_ok, - dispatch::{DispatchResult, DispatchResultWithPostInfo}, - weights::Weight, - }; + use frame_support::{assert_ok, dispatch::DispatchResultWithPostInfo, weights::Weight}; use hex_literal::hex; use pallet_contracts_primitives::{ExecReturnValue, ReturnFlags}; use pretty_assertions::assert_eq; use sp_core::{Bytes, H256}; use sp_runtime::DispatchError; - use std::{borrow::BorrowMut, cell::RefCell, collections::HashMap}; + use std::{ + borrow::BorrowMut, + cell::RefCell, + collections::hash_map::{Entry, HashMap}, + }; #[derive(Debug, PartialEq, Eq)] struct InstantiateEntry { @@ -384,9 +385,26 @@ mod tests { fn get_storage(&mut self, key: &StorageKey) -> Option> { self.storage.get(key).cloned() } - fn set_storage(&mut self, key: StorageKey, value: Option>) -> DispatchResult { - *self.storage.entry(key).or_insert(Vec::new()) = value.unwrap_or(Vec::new()); - Ok(()) + fn contains_storage(&mut self, key: &StorageKey) -> bool { + self.storage.contains_key(key) + } + fn set_storage( + &mut self, + key: StorageKey, + value: Option>, + take_old: bool, + ) -> Result { + let entry = self.storage.entry(key); + 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, value); + } + Ok(result) } fn caller(&self) -> &AccountIdOf { &ALICE @@ -932,8 +950,8 @@ mod tests { "\11\11\11\11\11\11\11\11\11\11\11\11\11\11\11\11" ) - ;; [32, 36) buffer size = 128 bytes - (data (i32.const 32) "\80") + ;; [32, 36) buffer size = 4k in little endian + (data (i32.const 32) "\00\10") ;; [36; inf) buffer where the result is copied @@ -1957,4 +1975,278 @@ mod tests { ); assert_eq!(*ext.runtime_calls.borrow(), vec![]); } + + #[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) (result i32))) + (import "env" "memory" (memory 1 1)) + + ;; 0x1000 = 4k in little endian + ;; size of input buffer + (data (i32.const 0) "\00\10") + + (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 length buffer + ) + ;; Store the passed value to the passed key and store result to memory + (i32.store (i32.const 0) + (call $seal_set_storage + (i32.const 4) ;; key_ptr + (i32.const 36) ;; value_ptr + (i32.sub ;; value_len (input_size - key_size) + (i32.load (i32.const 0)) + (i32.const 32) + ) + ) + ) + (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(); + + // value did not exist before -> sentinel returned + 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()), u32::MAX); + assert_eq!(ext.storage.get(&[1u8; 32]).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]); + + // 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]); + } + + #[test] + #[cfg(feature = "unstable-interface")] + fn clear_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_clear_storage" (func $seal_clear_storage (param i32) (result i32))) + (import "env" "memory" (memory 1 1)) + + ;; 0x1000 = 4k in little endian + ;; size of input buffer + (data (i32.const 0) "\00\10") + + (func (export "call") + ;; Receive key + (call $seal_input + (i32.const 4) ;; Pointer to the input buffer + (i32.const 0) ;; Size of the length buffer + ) + ;; Store the passed value to the passed key and store result to memory + (i32.store (i32.const 0) + (call $seal_clear_storage + (i32.const 4) ;; key_ptr + ) + ) + (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.storage.insert([1u8; 32], vec![42u8]); + ext.storage.insert([2u8; 32], 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()), u32::MAX); + assert_eq!(ext.storage.get(&[3u8; 32]), 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); + + // 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); + } + + #[test] + #[cfg(feature = "unstable-interface")] + fn take_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_take_storage" (func $seal_take_storage (param 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") + + ;; [32, 64) size of output buffer + ;; 4k in little endian + (data (i32.const 32) "\00\10") + + ;; [64, 96) input buffer + + ;; [96, inf) output buffer + + (func (export "call") + ;; Receive key + (call $seal_input + (i32.const 64) ;; 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) + (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 + ) + ) + + ;; 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 4) + ) + ) + ) + + (func (export "deploy")) +) +"#; + + let mut ext = MockExt::default(); + + ext.storage.insert([1u8; 32], vec![42u8]); + ext.storage.insert([2u8; 32], vec![]); + + // value does not exist -> error returned + let result = execute(CODE, [3u8; 32].encode(), &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(); + 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]), 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(); + 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]), None); + assert_eq!(&result.data.0[4..], &[0u8; 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) (result i32))) + (import "env" "memory" (memory 1 1)) + + ;; [0, 4) size of input buffer (32 byte as we copy the key here) + (data (i32.const 0) "\20") + + ;; [4, 36) input buffer + + ;; [36, inf) output 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 + ) + + ;; Load the return value into the output buffer + (i32.store (i32.const 36) + (call $seal_contains_storage + (i32.const 4) ;; The pointer to the storage key to fetch + ) + ) + + ;; Return the contents of the buffer + (call $seal_return + (i32.const 0) ;; flags + (i32.const 36) ;; output buffer ptr + (i32.const 4) ;; result is integer (4 bytes) + ) + ) + + (func (export "deploy")) +) +"#; + + let mut ext = MockExt::default(); + + ext.storage.insert([1u8; 32], vec![42u8]); + ext.storage.insert([2u8; 32], vec![]); + + // value does not exist -> error returned + let result = execute(CODE, [3u8; 32].encode(), &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data.0.try_into().unwrap()), + ReturnCode::KeyNotFound as u32 + ); + + // value did exist -> success + let result = execute(CODE, [1u8; 32].encode(), &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data.0.try_into().unwrap()), + ReturnCode::Success as u32 + ); + + // value did exist -> success (zero sized type) + let result = execute(CODE, [2u8; 32].encode(), &mut ext).unwrap(); + assert_eq!( + u32::from_le_bytes(result.data.0.try_into().unwrap()), + ReturnCode::Success as u32 + ); + } } diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index ad13d18435a96..a0cac717ed2e8 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -21,6 +21,7 @@ use crate::{ exec::{ExecError, ExecResult, Ext, StorageKey, TopicOf}, gas::{ChargedAmount, Token}, schedule::HostFnWeights, + storage::WriteOutcome, wasm::env_def::ConvertibleToWasm, BalanceOf, CodeHash, Config, Error, }; @@ -172,10 +173,19 @@ pub enum RuntimeCosts { SetStorage(u32), /// Weight of calling `seal_clear_storage`. ClearStorage, + /// Weight of calling `seal_contains_storage`. + #[cfg(feature = "unstable-interface")] + ContainsStorage, /// Weight of calling `seal_get_storage` without output weight. GetStorageBase, /// Weight of an item received via `seal_get_storage` for the given size. GetStorageCopyOut(u32), + /// Weight of calling `seal_take_storage` without output weight. + #[cfg(feature = "unstable-interface")] + TakeStorageBase, + /// Weight of an item received via `seal_take_storage` for the given size. + #[cfg(feature = "unstable-interface")] + TakeStorageCopyOut(u32), /// Weight of calling `seal_transfer`. Transfer, /// Weight of calling `seal_call` for the given input size. @@ -242,8 +252,14 @@ impl RuntimeCosts { SetStorage(len) => s.set_storage.saturating_add(s.set_storage_per_byte.saturating_mul(len.into())), ClearStorage => s.clear_storage, + #[cfg(feature = "unstable-interface")] + ContainsStorage => s.contains_storage, GetStorageBase => s.get_storage, GetStorageCopyOut(len) => s.get_storage_per_byte.saturating_mul(len.into()), + #[cfg(feature = "unstable-interface")] + TakeStorageBase => s.take_storage, + #[cfg(feature = "unstable-interface")] + TakeStorageCopyOut(len) => s.take_storage_per_byte.saturating_mul(len.into()), Transfer => s.transfer, CallBase(len) => s.call.saturating_add(s.call_per_input_byte.saturating_mul(len.into())), @@ -632,6 +648,46 @@ where } } + /// Extracts the size of the overwritten value or `u32::MAX`. + fn overwritten_len(outcome: WriteOutcome) -> u32 { + match outcome { + // We cannot use `0` as sentinel value because there could be a zero sized + // storage entry which is different from a non existing one. + WriteOutcome::New => u32::MAX, + WriteOutcome::Overwritten(len) => len, + WriteOutcome::Taken(value) => value.len() as u32, + } + } + + fn set_storage( + &mut self, + key_ptr: u32, + value_ptr: u32, + value_len: u32, + ) -> Result { + self.charge_gas(RuntimeCosts::SetStorage(value_len))?; + if value_len > self.ext.max_value_size() { + Err(Error::::ValueTooLarge)?; + } + let mut key: StorageKey = [0; 32]; + self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; + let value = Some(self.read_sandbox_memory(value_ptr, value_len)?); + self.ext + .set_storage(key, value, false) + .map(Self::overwritten_len) + .map_err(Into::into) + } + + fn clear_storage(&mut self, key_ptr: u32) -> Result { + self.charge_gas(RuntimeCosts::ClearStorage)?; + let mut key: StorageKey = [0; 32]; + self.read_sandbox_memory_into_buf(key_ptr, &mut key)?; + self.ext + .set_storage(key, None, false) + .map(Self::overwritten_len) + .map_err(Into::into) + } + fn call( &mut self, flags: CallFlags, @@ -745,10 +801,18 @@ define_env!(Env, , Ok(()) }, + // Set the value at the given key in the contract storage. + // + // 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(|_| ()) + }, + // Set the value at the given key in the contract storage. // // The value length must not exceed the maximum defined by the contracts module parameters. - // Storing an empty value is disallowed. + // Specifying a `value_len` of zero will store an empty value. // // # Parameters // @@ -756,19 +820,20 @@ define_env!(Env, , // - `value_ptr`: pointer into the linear memory where the value to set is placed. // - `value_len`: the length of the value in bytes. // - // # Traps + // # Return Value // - // - If value length exceeds the configured maximum value length of a storage entry. - // - Upon trying to set an empty storage entry (value length is 0). - [seal0] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) => { - ctx.charge_gas(RuntimeCosts::SetStorage(value_len))?; - if value_len > ctx.ext.max_value_size() { - Err(Error::::ValueTooLarge)?; - } - let mut key: StorageKey = [0; 32]; - ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - let value = Some(ctx.read_sandbox_memory(value_ptr, value_len)?); - ctx.ext.set_storage(key, value).map_err(Into::into) + // Returns the size of the pre-existing value at the specified key if any. Otherwise + // `u32::MAX` is returned as a sentinel value. + [__unstable__] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) -> u32 => { + ctx.set_storage(key_ptr, value_ptr, value_len) + }, + + // 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 + // 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) }, // Clear the value at the given key in the contract storage. @@ -776,11 +841,13 @@ define_env!(Env, , // # Parameters // // - `key_ptr`: pointer into the linear memory where the location to clear the value is placed. - [seal0] seal_clear_storage(ctx, key_ptr: u32) => { - ctx.charge_gas(RuntimeCosts::ClearStorage)?; - let mut key: StorageKey = [0; 32]; - ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; - ctx.ext.set_storage(key, None).map_err(Into::into) + // + // # Return Value + // + // Returns the size of the pre-existing value at the specified key if any. Otherwise + // `u32::MAX` is returned as a sentinel value. + [__unstable__] seal_clear_storage(ctx, key_ptr: u32) -> u32 => { + ctx.clear_storage(key_ptr).map_err(Into::into) }, // Retrieve the value under the given key from storage. @@ -809,6 +876,55 @@ define_env!(Env, , } }, + // Checks whether there is a value stored under the given key. + // + // Returns `ReturnCode::Success` if there is a key in storage. Otherwise an error + // is returned. + // + // # Parameters + // + // - `key_ptr`: pointer into the linear memory where the key of the requested value is placed. + // + // # Errors + // + // `ReturnCode::KeyNotFound` + [__unstable__] seal_contains_storage(ctx, key_ptr: u32) -> ReturnCode => { + ctx.charge_gas(RuntimeCosts::ContainsStorage)?; + let mut key: StorageKey = [0; 32]; + ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; + if ctx.ext.contains_storage(&key) { + Ok(ReturnCode::Success) + } else { + Ok(ReturnCode::KeyNotFound) + } + }, + + // Retrieve and remove the value under the given key from storage. + // + // # Parameters + // + // - `key_ptr`: pointer into the linear memory where the key of the requested value is placed. + // - `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_take_storage(ctx, key_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { + ctx.charge_gas(RuntimeCosts::TakeStorageBase)?; + let mut key: StorageKey = [0; 32]; + ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?; + if let WriteOutcome::Taken(value) = ctx.ext.set_storage(key, None, true)? { + ctx.write_sandbox_output(out_ptr, out_len_ptr, &value, false, |len| { + Some(RuntimeCosts::TakeStorageCopyOut(len)) + })?; + Ok(ReturnCode::Success) + } else { + Ok(ReturnCode::KeyNotFound) + } + }, + // Transfer some value to another account. // // # Parameters diff --git a/frame/contracts/src/weights.rs b/frame/contracts/src/weights.rs index 5f61c1e4a3462..3edf04f91868b 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: 2021-12-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-12-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -77,7 +77,10 @@ pub trait WeightInfo { fn seal_set_storage_per_kb(n: u32, ) -> Weight; fn seal_clear_storage(r: u32, ) -> Weight; fn seal_get_storage(r: u32, ) -> Weight; + fn seal_contains_storage(r: u32, ) -> Weight; fn seal_get_storage_per_kb(n: u32, ) -> Weight; + fn seal_take_storage(r: u32, ) -> Weight; + fn seal_take_storage_per_kb(n: u32, ) -> Weight; fn seal_transfer(r: u32, ) -> Weight; fn seal_call(r: u32, ) -> Weight; fn seal_call_per_transfer_input_output_kb(t: u32, i: u32, o: u32, ) -> Weight; @@ -150,32 +153,32 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_initialize() -> Weight { - (2_720_000 as Weight) + (2_286_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) fn on_initialize_per_trie_key(k: u32, ) -> Weight { (0 as Weight) // Standard Error: 3_000 - .saturating_add((2_208_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((2_219_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) fn on_initialize_per_queue_item(q: u32, ) -> Weight { - (95_834_000 as Weight) + (95_627_000 as Weight) // Standard Error: 2_000 - .saturating_add((317_000 as Weight).saturating_mul(q as Weight)) + .saturating_add((242_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) fn reinstrument(c: u32, ) -> Weight { - (17_177_000 as Weight) - // Standard Error: 85_000 - .saturating_add((91_306_000 as Weight).saturating_mul(c as Weight)) + (17_037_000 as Weight) + // Standard Error: 98_000 + .saturating_add((88_875_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)) } @@ -184,9 +187,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: System Account (r:1 w:1) fn call_with_code_kb(c: u32, ) -> Weight { - (371_888_000 as Weight) - // Standard Error: 137_000 - .saturating_add((92_314_000 as Weight).saturating_mul(c as Weight)) + (348_110_000 as Weight) + // Standard Error: 136_000 + .saturating_add((81_086_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)) } @@ -198,11 +201,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (429_131_000 as Weight) - // Standard Error: 154_000 - .saturating_add((208_736_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 10_000 - .saturating_add((2_203_000 as Weight).saturating_mul(s as Weight)) + (414_966_000 as Weight) + // Standard Error: 137_000 + .saturating_add((198_330_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 8_000 + .saturating_add((2_180_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } @@ -213,9 +216,9 @@ impl WeightInfo for SubstrateWeight { // Storage: System Account (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) fn instantiate(s: u32, ) -> Weight { - (241_132_000 as Weight) + (201_465_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_986_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_993_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(5 as Weight)) } @@ -224,7 +227,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: System Account (r:1 w:1) fn call() -> Weight { - (173_649_000 as Weight) + (154_139_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -232,9 +235,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) fn upload_code(c: u32, ) -> Weight { - (84_508_000 as Weight) + (69_640_000 as Weight) // Standard Error: 93_000 - .saturating_add((91_690_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((89_969_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)) } @@ -242,7 +245,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - (39_407_000 as Weight) + (31_567_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } @@ -251,9 +254,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_caller(r: u32, ) -> Weight { - (421_879_000 as Weight) - // Standard Error: 168_000 - .saturating_add((114_154_000 as Weight).saturating_mul(r as Weight)) + (405_395_000 as Weight) + // Standard Error: 167_000 + .saturating_add((79_867_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)) } @@ -262,9 +265,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_address(r: u32, ) -> Weight { - (428_124_000 as Weight) - // Standard Error: 167_000 - .saturating_add((113_196_000 as Weight).saturating_mul(r as Weight)) + (405_173_000 as Weight) + // Standard Error: 152_000 + .saturating_add((79_619_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)) } @@ -273,9 +276,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_gas_left(r: u32, ) -> Weight { - (424_405_000 as Weight) - // Standard Error: 182_000 - .saturating_add((112_511_000 as Weight).saturating_mul(r as Weight)) + (406_537_000 as Weight) + // Standard Error: 148_000 + .saturating_add((78_129_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)) } @@ -284,9 +287,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_balance(r: u32, ) -> Weight { - (433_901_000 as Weight) - // Standard Error: 206_000 - .saturating_add((307_273_000 as Weight).saturating_mul(r as Weight)) + (416_289_000 as Weight) + // Standard Error: 165_000 + .saturating_add((218_401_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)) } @@ -295,9 +298,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_value_transferred(r: u32, ) -> Weight { - (428_707_000 as Weight) - // Standard Error: 203_000 - .saturating_add((113_558_000 as Weight).saturating_mul(r as Weight)) + (408_205_000 as Weight) + // Standard Error: 154_000 + .saturating_add((79_563_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)) } @@ -306,9 +309,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_minimum_balance(r: u32, ) -> Weight { - (423_775_000 as Weight) - // Standard Error: 174_000 - .saturating_add((113_371_000 as Weight).saturating_mul(r as Weight)) + (408_124_000 as Weight) + // Standard Error: 149_000 + .saturating_add((79_032_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)) } @@ -317,9 +320,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_block_number(r: u32, ) -> Weight { - (423_282_000 as Weight) - // Standard Error: 220_000 - .saturating_add((113_709_000 as Weight).saturating_mul(r as Weight)) + (406_141_000 as Weight) + // Standard Error: 150_000 + .saturating_add((78_992_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)) } @@ -328,9 +331,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_now(r: u32, ) -> Weight { - (435_209_000 as Weight) - // Standard Error: 157_000 - .saturating_add((111_492_000 as Weight).saturating_mul(r as Weight)) + (418_112_000 as Weight) + // Standard Error: 155_000 + .saturating_add((77_902_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)) } @@ -340,9 +343,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) fn seal_weight_to_fee(r: u32, ) -> Weight { - (432_886_000 as Weight) - // Standard Error: 193_000 - .saturating_add((260_787_000 as Weight).saturating_mul(r as Weight)) + (411_683_000 as Weight) + // Standard Error: 173_000 + .saturating_add((205_824_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)) } @@ -351,9 +354,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_gas(r: u32, ) -> Weight { - (147_315_000 as Weight) - // Standard Error: 124_000 - .saturating_add((52_336_000 as Weight).saturating_mul(r as Weight)) + (132_178_000 as Weight) + // Standard Error: 84_000 + .saturating_add((38_233_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)) } @@ -362,9 +365,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_input(r: u32, ) -> Weight { - (422_074_000 as Weight) - // Standard Error: 199_000 - .saturating_add((100_398_000 as Weight).saturating_mul(r as Weight)) + (405_685_000 as Weight) + // Standard Error: 142_000 + .saturating_add((72_826_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)) } @@ -373,9 +376,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_input_per_kb(n: u32, ) -> Weight { - (543_944_000 as Weight) - // Standard Error: 10_000 - .saturating_add((38_098_000 as Weight).saturating_mul(n as Weight)) + (490_336_000 as Weight) + // Standard Error: 7_000 + .saturating_add((38_070_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)) } @@ -384,9 +387,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_return(r: u32, ) -> Weight { - (398_945_000 as Weight) - // Standard Error: 417_000 - .saturating_add((15_763_000 as Weight).saturating_mul(r as Weight)) + (384_543_000 as Weight) + // Standard Error: 105_000 + .saturating_add((15_793_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)) } @@ -395,9 +398,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_return_per_kb(n: u32, ) -> Weight { - (416_850_000 as Weight) + (399_205_000 as Weight) // Standard Error: 1_000 - .saturating_add((635_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((637_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)) } @@ -408,9 +411,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts DeletionQueue (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) fn seal_terminate(r: u32, ) -> Weight { - (408_445_000 as Weight) - // Standard Error: 248_000 - .saturating_add((102_109_000 as Weight).saturating_mul(r as Weight)) + (396_375_000 as Weight) + // Standard Error: 3_023_000 + .saturating_add((79_797_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)) @@ -422,9 +425,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) fn seal_random(r: u32, ) -> Weight { - (410_845_000 as Weight) - // Standard Error: 289_000 - .saturating_add((341_867_000 as Weight).saturating_mul(r as Weight)) + (390_550_000 as Weight) + // Standard Error: 290_000 + .saturating_add((245_730_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)) } @@ -433,9 +436,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_deposit_event(r: u32, ) -> Weight { - (425_037_000 as Weight) - // Standard Error: 424_000 - .saturating_add((571_604_000 as Weight).saturating_mul(r as Weight)) + (408_011_000 as Weight) + // Standard Error: 273_000 + .saturating_add((406_522_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)) } @@ -445,11 +448,11 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: System EventTopics (r:100 w:100) fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (1_055_868_000 as Weight) - // Standard Error: 3_004_000 - .saturating_add((453_979_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 592_000 - .saturating_add((166_716_000 as Weight).saturating_mul(n as Weight)) + (890_741_000 as Weight) + // Standard Error: 2_072_000 + .saturating_add((382_953_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 408_000 + .saturating_add((162_320_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -460,17 +463,17 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_debug_message(r: u32, ) -> Weight { - (161_170_000 as Weight) - // Standard Error: 169_000 - .saturating_add((74_379_000 as Weight).saturating_mul(r as Weight)) + (153_163_000 as Weight) + // Standard Error: 137_000 + .saturating_add((59_081_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) fn seal_set_storage(r: u32, ) -> Weight { - (500_168_000 as Weight) - // Standard Error: 473_000 - .saturating_add((371_239_000 as Weight).saturating_mul(r as Weight)) + (459_368_000 as Weight) + // Standard Error: 560_000 + .saturating_add((330_190_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) @@ -482,17 +485,17 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: unknown [0x7afa01283080ef247df84e0ba38ea5a587d25ce6633a6bfbba02068c14023441] (r:1 w:1) fn seal_set_storage_per_kb(n: u32, ) -> Weight { - (796_175_000 as Weight) - // Standard Error: 249_000 - .saturating_add((74_071_000 as Weight).saturating_mul(n as Weight)) + (727_394_000 as Weight) + // Standard Error: 247_000 + .saturating_add((73_350_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) fn seal_clear_storage(r: u32, ) -> Weight { - (178_237_000 as Weight) - // Standard Error: 1_652_000 - .saturating_add((835_947_000 as Weight).saturating_mul(r as Weight)) + (163_262_000 as Weight) + // Standard Error: 1_492_000 + .saturating_add((799_087_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) @@ -500,9 +503,18 @@ impl WeightInfo for SubstrateWeight { } // Storage: Skipped Metadata (r:0 w:0) fn seal_get_storage(r: u32, ) -> Weight { - (305_702_000 as Weight) - // Standard Error: 750_000 - .saturating_add((493_580_000 as Weight).saturating_mul(r as Weight)) + (288_728_000 as Weight) + // Standard Error: 752_000 + .saturating_add((434_780_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + fn seal_contains_storage(r: u32, ) -> Weight { + (209_606_000 as Weight) + // Standard Error: 1_137_000 + .saturating_add((680_187_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -513,20 +525,38 @@ impl WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:0) // Storage: unknown [0x7afa01283080ef247df84e0ba38ea5a587d25ce6633a6bfbba02068c14023441] (r:1 w:0) fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (697_017_000 as Weight) - // Standard Error: 216_000 - .saturating_add((111_743_000 as Weight).saturating_mul(n as Weight)) + (619_600_000 as Weight) + // Standard Error: 207_000 + .saturating_add((111_030_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) + fn seal_take_storage(r: u32, ) -> Weight { + (279_528_000 as Weight) + // Standard Error: 932_000 + .saturating_add((541_965_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(T::DbWeight::get().writes((100 as Weight).saturating_mul(r as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn seal_take_storage_per_kb(n: u32, ) -> Weight { + (985_732_000 as Weight) + // Standard Error: 446_000 + .saturating_add((123_295_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(105 as Weight)) + .saturating_add(T::DbWeight::get().writes(103 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) fn seal_transfer(r: u32, ) -> Weight { - (243_124_000 as Weight) - // Standard Error: 1_718_000 - .saturating_add((3_530_873_000 as Weight).saturating_mul(r as Weight)) + (284_785_000 as Weight) + // Standard Error: 1_479_000 + .saturating_add((2_527_544_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) @@ -537,9 +567,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_call(r: u32, ) -> Weight { - (140_524_000 as Weight) - // Standard Error: 4_504_000 - .saturating_add((39_287_224_000 as Weight).saturating_mul(r as Weight)) + (0 as Weight) + // Standard Error: 5_742_000 + .saturating_add((37_993_391_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) @@ -550,13 +580,13 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_call_per_transfer_input_output_kb(t: u32, i: u32, o: u32, ) -> Weight { - (38_929_132_000 as Weight) - // Standard Error: 65_806_000 - .saturating_add((2_980_358_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 23_000 - .saturating_add((62_980_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 25_000 - .saturating_add((101_383_000 as Weight).saturating_mul(o as Weight)) + (37_404_660_000 as Weight) + // Standard Error: 92_661_000 + .saturating_add((2_486_257_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 33_000 + .saturating_add((63_001_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 35_000 + .saturating_add((101_347_000 as Weight).saturating_mul(o as Weight)) .saturating_add(T::DbWeight::get().reads(105 as Weight)) .saturating_add(T::DbWeight::get().reads((101 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(101 as Weight)) @@ -570,8 +600,8 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts OwnerInfoOf (r:100 w:100) fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 120_171_000 - .saturating_add((50_779_937_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 119_281_000 + .saturating_add((47_113_525_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().reads((400 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) @@ -584,13 +614,13 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts AccountCounter (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) fn seal_instantiate_per_input_output_salt_kb(i: u32, o: u32, s: u32, ) -> Weight { - (45_749_415_000 as Weight) - // Standard Error: 34_000 - .saturating_add((64_650_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 34_000 - .saturating_add((101_902_000 as Weight).saturating_mul(o as Weight)) - // Standard Error: 34_000 - .saturating_add((201_402_000 as Weight).saturating_mul(s as Weight)) + (41_157_901_000 as Weight) + // Standard Error: 147_000 + .saturating_add((64_877_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 147_000 + .saturating_add((102_420_000 as Weight).saturating_mul(o as Weight)) + // Standard Error: 147_000 + .saturating_add((201_587_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(208 as Weight)) .saturating_add(T::DbWeight::get().writes(206 as Weight)) } @@ -599,9 +629,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_sha2_256(r: u32, ) -> Weight { - (414_773_000 as Weight) - // Standard Error: 183_000 - .saturating_add((127_117_000 as Weight).saturating_mul(r as Weight)) + (402_224_000 as Weight) + // Standard Error: 166_000 + .saturating_add((103_985_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)) } @@ -610,9 +640,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (581_981_000 as Weight) - // Standard Error: 38_000 - .saturating_add((505_754_000 as Weight).saturating_mul(n as Weight)) + (663_731_000 as Weight) + // Standard Error: 42_000 + .saturating_add((505_157_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)) } @@ -621,9 +651,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_keccak_256(r: u32, ) -> Weight { - (424_421_000 as Weight) - // Standard Error: 223_000 - .saturating_add((137_068_000 as Weight).saturating_mul(r as Weight)) + (402_638_000 as Weight) + // Standard Error: 165_000 + .saturating_add((117_589_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)) } @@ -632,9 +662,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (497_132_000 as Weight) - // Standard Error: 24_000 - .saturating_add((363_894_000 as Weight).saturating_mul(n as Weight)) + (491_978_000 as Weight) + // Standard Error: 23_000 + .saturating_add((363_687_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)) } @@ -643,9 +673,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_blake2_256(r: u32, ) -> Weight { - (419_414_000 as Weight) - // Standard Error: 174_000 - .saturating_add((106_283_000 as Weight).saturating_mul(r as Weight)) + (402_254_000 as Weight) + // Standard Error: 154_000 + .saturating_add((86_403_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)) } @@ -654,9 +684,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (572_206_000 as Weight) - // Standard Error: 24_000 - .saturating_add((163_930_000 as Weight).saturating_mul(n as Weight)) + (476_405_000 as Weight) + // Standard Error: 18_000 + .saturating_add((163_921_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)) } @@ -665,9 +695,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_blake2_128(r: u32, ) -> Weight { - (417_971_000 as Weight) - // Standard Error: 180_000 - .saturating_add((106_016_000 as Weight).saturating_mul(r as Weight)) + (399_949_000 as Weight) + // Standard Error: 142_000 + .saturating_add((85_448_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)) } @@ -676,9 +706,9 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (568_067_000 as Weight) - // Standard Error: 20_000 - .saturating_add((163_853_000 as Weight).saturating_mul(n as Weight)) + (475_437_000 as Weight) + // Standard Error: 15_000 + .saturating_add((163_921_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)) } @@ -687,266 +717,266 @@ impl WeightInfo for SubstrateWeight { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_ecdsa_recover(r: u32, ) -> Weight { - (372_816_000 as Weight) - // Standard Error: 1_677_000 - .saturating_add((15_723_462_000 as Weight).saturating_mul(r as Weight)) + (373_575_000 as Weight) + // Standard Error: 1_639_000 + .saturating_add((15_530_027_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)) } fn instr_i64const(r: u32, ) -> Weight { - (53_407_000 as Weight) - // Standard Error: 14_000 - .saturating_add((885_000 as Weight).saturating_mul(r as Weight)) + (52_763_000 as Weight) + // Standard Error: 12_000 + .saturating_add((857_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64load(r: u32, ) -> Weight { - (48_061_000 as Weight) + (47_313_000 as Weight) // Standard Error: 10_000 - .saturating_add((2_947_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_935_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64store(r: u32, ) -> Weight { - (48_150_000 as Weight) + (47_147_000 as Weight) // Standard Error: 10_000 - .saturating_add((2_978_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_995_000 as Weight).saturating_mul(r as Weight)) } fn instr_select(r: u32, ) -> Weight { - (50_943_000 as Weight) + (50_124_000 as Weight) // Standard Error: 11_000 - .saturating_add((2_446_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_421_000 as Weight).saturating_mul(r as Weight)) } fn instr_if(r: u32, ) -> Weight { - (47_862_000 as Weight) - // Standard Error: 12_000 - .saturating_add((2_627_000 as Weight).saturating_mul(r as Weight)) + (47_288_000 as Weight) + // Standard Error: 11_000 + .saturating_add((2_523_000 as Weight).saturating_mul(r as Weight)) } fn instr_br(r: u32, ) -> Weight { - (51_291_000 as Weight) + (50_198_000 as Weight) // Standard Error: 16_000 - .saturating_add((1_467_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_473_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_if(r: u32, ) -> Weight { - (44_627_000 as Weight) - // Standard Error: 18_000 - .saturating_add((2_211_000 as Weight).saturating_mul(r as Weight)) + (44_008_000 as Weight) + // Standard Error: 17_000 + .saturating_add((2_174_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_table(r: u32, ) -> Weight { - (38_208_000 as Weight) + (37_602_000 as Weight) // Standard Error: 16_000 - .saturating_add((2_914_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_820_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_table_per_entry(e: u32, ) -> Weight { - (47_228_000 as Weight) + (46_232_000 as Weight) // Standard Error: 3_000 .saturating_add((17_000 as Weight).saturating_mul(e as Weight)) } fn instr_call(r: u32, ) -> Weight { - (39_507_000 as Weight) - // Standard Error: 26_000 - .saturating_add((20_544_000 as Weight).saturating_mul(r as Weight)) + (40_148_000 as Weight) + // Standard Error: 22_000 + .saturating_add((20_585_000 as Weight).saturating_mul(r as Weight)) } fn instr_call_indirect(r: u32, ) -> Weight { - (47_235_000 as Weight) + (43_948_000 as Weight) // Standard Error: 31_000 - .saturating_add((29_869_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((30_226_000 as Weight).saturating_mul(r as Weight)) } fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (78_847_000 as Weight) - // Standard Error: 6_000 - .saturating_add((1_217_000 as Weight).saturating_mul(p as Weight)) + (78_722_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_199_000 as Weight).saturating_mul(p as Weight)) } fn instr_local_get(r: u32, ) -> Weight { - (48_441_000 as Weight) - // Standard Error: 11_000 - .saturating_add((816_000 as Weight).saturating_mul(r as Weight)) + (48_083_000 as Weight) + // Standard Error: 12_000 + .saturating_add((805_000 as Weight).saturating_mul(r as Weight)) } fn instr_local_set(r: u32, ) -> Weight { - (48_324_000 as Weight) + (47_710_000 as Weight) // Standard Error: 11_000 - .saturating_add((861_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((843_000 as Weight).saturating_mul(r as Weight)) } fn instr_local_tee(r: u32, ) -> Weight { - (45_372_000 as Weight) - // Standard Error: 10_000 - .saturating_add((1_488_000 as Weight).saturating_mul(r as Weight)) + (44_785_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_466_000 as Weight).saturating_mul(r as Weight)) } fn instr_global_get(r: u32, ) -> Weight { - (58_465_000 as Weight) + (50_106_000 as Weight) // Standard Error: 20_000 - .saturating_add((1_655_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_641_000 as Weight).saturating_mul(r as Weight)) } fn instr_global_set(r: u32, ) -> Weight { - (55_457_000 as Weight) + (47_058_000 as Weight) // Standard Error: 18_000 - .saturating_add((1_671_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_707_000 as Weight).saturating_mul(r as Weight)) } fn instr_memory_current(r: u32, ) -> Weight { - (52_615_000 as Weight) - // Standard Error: 14_000 - .saturating_add((905_000 as Weight).saturating_mul(r as Weight)) + (51_494_000 as Weight) + // Standard Error: 15_000 + .saturating_add((925_000 as Weight).saturating_mul(r as Weight)) } fn instr_memory_grow(r: u32, ) -> Weight { - (37_739_000 as Weight) - // Standard Error: 2_851_000 - .saturating_add((634_780_000 as Weight).saturating_mul(r as Weight)) + (36_983_000 as Weight) + // Standard Error: 3_602_000 + .saturating_add((634_259_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64clz(r: u32, ) -> Weight { - (54_830_000 as Weight) - // Standard Error: 9_000 - .saturating_add((1_309_000 as Weight).saturating_mul(r as Weight)) + (60_711_000 as Weight) + // Standard Error: 22_000 + .saturating_add((1_157_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ctz(r: u32, ) -> Weight { - (54_712_000 as Weight) + (53_908_000 as Weight) // Standard Error: 9_000 - .saturating_add((1_310_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_305_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64popcnt(r: u32, ) -> Weight { - (54_864_000 as Weight) - // Standard Error: 10_000 - .saturating_add((1_312_000 as Weight).saturating_mul(r as Weight)) + (53_939_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_314_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64eqz(r: u32, ) -> Weight { - (54_596_000 as Weight) - // Standard Error: 9_000 - .saturating_add((1_314_000 as Weight).saturating_mul(r as Weight)) + (54_086_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_309_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64extendsi32(r: u32, ) -> Weight { - (44_536_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_514_000 as Weight).saturating_mul(r as Weight)) + (43_845_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_493_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64extendui32(r: u32, ) -> Weight { - (44_380_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_512_000 as Weight).saturating_mul(r as Weight)) + (43_518_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_501_000 as Weight).saturating_mul(r as Weight)) } fn instr_i32wrapi64(r: u32, ) -> Weight { - (54_968_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_310_000 as Weight).saturating_mul(r as Weight)) + (53_912_000 as Weight) + // Standard Error: 9_000 + .saturating_add((1_302_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64eq(r: u32, ) -> Weight { - (50_161_000 as Weight) - // Standard Error: 10_000 - .saturating_add((1_917_000 as Weight).saturating_mul(r as Weight)) + (49_594_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_890_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ne(r: u32, ) -> Weight { - (50_417_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_911_000 as Weight).saturating_mul(r as Weight)) + (49_659_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_894_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64lts(r: u32, ) -> Weight { - (50_358_000 as Weight) + (49_401_000 as Weight) // Standard Error: 11_000 - .saturating_add((1_914_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_902_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ltu(r: u32, ) -> Weight { - (49_864_000 as Weight) + (49_880_000 as Weight) // Standard Error: 11_000 - .saturating_add((1_928_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_885_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64gts(r: u32, ) -> Weight { - (50_159_000 as Weight) + (49_466_000 as Weight) // Standard Error: 10_000 - .saturating_add((1_917_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_894_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64gtu(r: u32, ) -> Weight { - (50_037_000 as Weight) - // Standard Error: 16_000 - .saturating_add((1_945_000 as Weight).saturating_mul(r as Weight)) + (49_514_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_891_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64les(r: u32, ) -> Weight { - (50_482_000 as Weight) + (49_588_000 as Weight) // Standard Error: 11_000 - .saturating_add((1_909_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_898_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64leu(r: u32, ) -> Weight { - (50_426_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_908_000 as Weight).saturating_mul(r as Weight)) + (49_589_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_891_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ges(r: u32, ) -> Weight { - (50_205_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_918_000 as Weight).saturating_mul(r as Weight)) + (49_685_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_892_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64geu(r: u32, ) -> Weight { - (50_189_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_928_000 as Weight).saturating_mul(r as Weight)) + (49_601_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_891_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64add(r: u32, ) -> Weight { - (50_205_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_922_000 as Weight).saturating_mul(r as Weight)) + (49_430_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_894_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64sub(r: u32, ) -> Weight { - (50_375_000 as Weight) - // Standard Error: 15_000 - .saturating_add((1_929_000 as Weight).saturating_mul(r as Weight)) + (49_533_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_893_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64mul(r: u32, ) -> Weight { - (50_343_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_916_000 as Weight).saturating_mul(r as Weight)) + (49_766_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_888_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64divs(r: u32, ) -> Weight { - (50_707_000 as Weight) + (49_315_000 as Weight) // Standard Error: 11_000 - .saturating_add((2_667_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_552_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64divu(r: u32, ) -> Weight { - (50_318_000 as Weight) + (49_786_000 as Weight) // Standard Error: 11_000 - .saturating_add((2_408_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_203_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rems(r: u32, ) -> Weight { - (50_214_000 as Weight) - // Standard Error: 17_000 - .saturating_add((2_702_000 as Weight).saturating_mul(r as Weight)) + (49_651_000 as Weight) + // Standard Error: 11_000 + .saturating_add((2_461_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64remu(r: u32, ) -> Weight { - (50_394_000 as Weight) - // Standard Error: 11_000 - .saturating_add((2_411_000 as Weight).saturating_mul(r as Weight)) + (49_747_000 as Weight) + // Standard Error: 10_000 + .saturating_add((2_196_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64and(r: u32, ) -> Weight { - (50_397_000 as Weight) + (49_719_000 as Weight) // Standard Error: 11_000 - .saturating_add((1_910_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_892_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64or(r: u32, ) -> Weight { - (50_291_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_915_000 as Weight).saturating_mul(r as Weight)) + (49_463_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_896_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64xor(r: u32, ) -> Weight { - (50_684_000 as Weight) - // Standard Error: 12_000 + (49_379_000 as Weight) + // Standard Error: 11_000 .saturating_add((1_903_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shl(r: u32, ) -> Weight { - (49_638_000 as Weight) - // Standard Error: 17_000 - .saturating_add((1_967_000 as Weight).saturating_mul(r as Weight)) + (49_404_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_902_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shrs(r: u32, ) -> Weight { - (50_817_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_899_000 as Weight).saturating_mul(r as Weight)) + (49_498_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_900_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shru(r: u32, ) -> Weight { - (50_987_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_899_000 as Weight).saturating_mul(r as Weight)) + (49_541_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_897_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rotl(r: u32, ) -> Weight { - (50_885_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_905_000 as Weight).saturating_mul(r as Weight)) + (49_452_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_900_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rotr(r: u32, ) -> Weight { - (50_465_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_908_000 as Weight).saturating_mul(r as Weight)) + (49_350_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_902_000 as Weight).saturating_mul(r as Weight)) } } @@ -954,32 +984,32 @@ impl WeightInfo for SubstrateWeight { impl WeightInfo for () { // Storage: Contracts DeletionQueue (r:1 w:0) fn on_initialize() -> Weight { - (2_720_000 as Weight) + (2_286_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) } // Storage: Skipped Metadata (r:0 w:0) fn on_initialize_per_trie_key(k: u32, ) -> Weight { (0 as Weight) // Standard Error: 3_000 - .saturating_add((2_208_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((2_219_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) fn on_initialize_per_queue_item(q: u32, ) -> Weight { - (95_834_000 as Weight) + (95_627_000 as Weight) // Standard Error: 2_000 - .saturating_add((317_000 as Weight).saturating_mul(q as Weight)) + .saturating_add((242_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) fn reinstrument(c: u32, ) -> Weight { - (17_177_000 as Weight) - // Standard Error: 85_000 - .saturating_add((91_306_000 as Weight).saturating_mul(c as Weight)) + (17_037_000 as Weight) + // Standard Error: 98_000 + .saturating_add((88_875_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -988,9 +1018,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: System Account (r:1 w:1) fn call_with_code_kb(c: u32, ) -> Weight { - (371_888_000 as Weight) - // Standard Error: 137_000 - .saturating_add((92_314_000 as Weight).saturating_mul(c as Weight)) + (348_110_000 as Weight) + // Standard Error: 136_000 + .saturating_add((81_086_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } @@ -1002,11 +1032,11 @@ impl WeightInfo for () { // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (429_131_000 as Weight) - // Standard Error: 154_000 - .saturating_add((208_736_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 10_000 - .saturating_add((2_203_000 as Weight).saturating_mul(s as Weight)) + (414_966_000 as Weight) + // Standard Error: 137_000 + .saturating_add((198_330_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 8_000 + .saturating_add((2_180_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(6 as Weight)) } @@ -1017,9 +1047,9 @@ impl WeightInfo for () { // Storage: System Account (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) fn instantiate(s: u32, ) -> Weight { - (241_132_000 as Weight) + (201_465_000 as Weight) // Standard Error: 2_000 - .saturating_add((1_986_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_993_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } @@ -1028,7 +1058,7 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: System Account (r:1 w:1) fn call() -> Weight { - (173_649_000 as Weight) + (154_139_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } @@ -1036,9 +1066,9 @@ impl WeightInfo for () { // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) fn upload_code(c: u32, ) -> Weight { - (84_508_000 as Weight) + (69_640_000 as Weight) // Standard Error: 93_000 - .saturating_add((91_690_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((89_969_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } @@ -1046,7 +1076,7 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) fn remove_code() -> Weight { - (39_407_000 as Weight) + (31_567_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } @@ -1055,9 +1085,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_caller(r: u32, ) -> Weight { - (421_879_000 as Weight) - // Standard Error: 168_000 - .saturating_add((114_154_000 as Weight).saturating_mul(r as Weight)) + (405_395_000 as Weight) + // Standard Error: 167_000 + .saturating_add((79_867_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1066,9 +1096,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_address(r: u32, ) -> Weight { - (428_124_000 as Weight) - // Standard Error: 167_000 - .saturating_add((113_196_000 as Weight).saturating_mul(r as Weight)) + (405_173_000 as Weight) + // Standard Error: 152_000 + .saturating_add((79_619_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1077,9 +1107,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_gas_left(r: u32, ) -> Weight { - (424_405_000 as Weight) - // Standard Error: 182_000 - .saturating_add((112_511_000 as Weight).saturating_mul(r as Weight)) + (406_537_000 as Weight) + // Standard Error: 148_000 + .saturating_add((78_129_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1088,9 +1118,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_balance(r: u32, ) -> Weight { - (433_901_000 as Weight) - // Standard Error: 206_000 - .saturating_add((307_273_000 as Weight).saturating_mul(r as Weight)) + (416_289_000 as Weight) + // Standard Error: 165_000 + .saturating_add((218_401_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1099,9 +1129,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_value_transferred(r: u32, ) -> Weight { - (428_707_000 as Weight) - // Standard Error: 203_000 - .saturating_add((113_558_000 as Weight).saturating_mul(r as Weight)) + (408_205_000 as Weight) + // Standard Error: 154_000 + .saturating_add((79_563_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1110,9 +1140,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_minimum_balance(r: u32, ) -> Weight { - (423_775_000 as Weight) - // Standard Error: 174_000 - .saturating_add((113_371_000 as Weight).saturating_mul(r as Weight)) + (408_124_000 as Weight) + // Standard Error: 149_000 + .saturating_add((79_032_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1121,9 +1151,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_block_number(r: u32, ) -> Weight { - (423_282_000 as Weight) - // Standard Error: 220_000 - .saturating_add((113_709_000 as Weight).saturating_mul(r as Weight)) + (406_141_000 as Weight) + // Standard Error: 150_000 + .saturating_add((78_992_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1132,9 +1162,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_now(r: u32, ) -> Weight { - (435_209_000 as Weight) - // Standard Error: 157_000 - .saturating_add((111_492_000 as Weight).saturating_mul(r as Weight)) + (418_112_000 as Weight) + // Standard Error: 155_000 + .saturating_add((77_902_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1144,9 +1174,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) fn seal_weight_to_fee(r: u32, ) -> Weight { - (432_886_000 as Weight) - // Standard Error: 193_000 - .saturating_add((260_787_000 as Weight).saturating_mul(r as Weight)) + (411_683_000 as Weight) + // Standard Error: 173_000 + .saturating_add((205_824_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1155,9 +1185,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_gas(r: u32, ) -> Weight { - (147_315_000 as Weight) - // Standard Error: 124_000 - .saturating_add((52_336_000 as Weight).saturating_mul(r as Weight)) + (132_178_000 as Weight) + // Standard Error: 84_000 + .saturating_add((38_233_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1166,9 +1196,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_input(r: u32, ) -> Weight { - (422_074_000 as Weight) - // Standard Error: 199_000 - .saturating_add((100_398_000 as Weight).saturating_mul(r as Weight)) + (405_685_000 as Weight) + // Standard Error: 142_000 + .saturating_add((72_826_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1177,9 +1207,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_input_per_kb(n: u32, ) -> Weight { - (543_944_000 as Weight) - // Standard Error: 10_000 - .saturating_add((38_098_000 as Weight).saturating_mul(n as Weight)) + (490_336_000 as Weight) + // Standard Error: 7_000 + .saturating_add((38_070_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1188,9 +1218,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_return(r: u32, ) -> Weight { - (398_945_000 as Weight) - // Standard Error: 417_000 - .saturating_add((15_763_000 as Weight).saturating_mul(r as Weight)) + (384_543_000 as Weight) + // Standard Error: 105_000 + .saturating_add((15_793_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1199,9 +1229,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_return_per_kb(n: u32, ) -> Weight { - (416_850_000 as Weight) + (399_205_000 as Weight) // Standard Error: 1_000 - .saturating_add((635_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((637_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1212,9 +1242,9 @@ impl WeightInfo for () { // Storage: Contracts DeletionQueue (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) fn seal_terminate(r: u32, ) -> Weight { - (408_445_000 as Weight) - // Standard Error: 248_000 - .saturating_add((102_109_000 as Weight).saturating_mul(r as Weight)) + (396_375_000 as Weight) + // Standard Error: 3_023_000 + .saturating_add((79_797_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)) @@ -1226,9 +1256,9 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) fn seal_random(r: u32, ) -> Weight { - (410_845_000 as Weight) - // Standard Error: 289_000 - .saturating_add((341_867_000 as Weight).saturating_mul(r as Weight)) + (390_550_000 as Weight) + // Standard Error: 290_000 + .saturating_add((245_730_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1237,9 +1267,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_deposit_event(r: u32, ) -> Weight { - (425_037_000 as Weight) - // Standard Error: 424_000 - .saturating_add((571_604_000 as Weight).saturating_mul(r as Weight)) + (408_011_000 as Weight) + // Standard Error: 273_000 + .saturating_add((406_522_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1249,11 +1279,11 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: System EventTopics (r:100 w:100) fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (1_055_868_000 as Weight) - // Standard Error: 3_004_000 - .saturating_add((453_979_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 592_000 - .saturating_add((166_716_000 as Weight).saturating_mul(n as Weight)) + (890_741_000 as Weight) + // Standard Error: 2_072_000 + .saturating_add((382_953_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 408_000 + .saturating_add((162_320_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1264,17 +1294,17 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_debug_message(r: u32, ) -> Weight { - (161_170_000 as Weight) - // Standard Error: 169_000 - .saturating_add((74_379_000 as Weight).saturating_mul(r as Weight)) + (153_163_000 as Weight) + // Standard Error: 137_000 + .saturating_add((59_081_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) fn seal_set_storage(r: u32, ) -> Weight { - (500_168_000 as Weight) - // Standard Error: 473_000 - .saturating_add((371_239_000 as Weight).saturating_mul(r as Weight)) + (459_368_000 as Weight) + // Standard Error: 560_000 + .saturating_add((330_190_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) @@ -1286,17 +1316,17 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: unknown [0x7afa01283080ef247df84e0ba38ea5a587d25ce6633a6bfbba02068c14023441] (r:1 w:1) fn seal_set_storage_per_kb(n: u32, ) -> Weight { - (796_175_000 as Weight) - // Standard Error: 249_000 - .saturating_add((74_071_000 as Weight).saturating_mul(n as Weight)) + (727_394_000 as Weight) + // Standard Error: 247_000 + .saturating_add((73_350_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) fn seal_clear_storage(r: u32, ) -> Weight { - (178_237_000 as Weight) - // Standard Error: 1_652_000 - .saturating_add((835_947_000 as Weight).saturating_mul(r as Weight)) + (163_262_000 as Weight) + // Standard Error: 1_492_000 + .saturating_add((799_087_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) @@ -1304,9 +1334,18 @@ impl WeightInfo for () { } // Storage: Skipped Metadata (r:0 w:0) fn seal_get_storage(r: u32, ) -> Weight { - (305_702_000 as Weight) - // Standard Error: 750_000 - .saturating_add((493_580_000 as Weight).saturating_mul(r as Weight)) + (288_728_000 as Weight) + // Standard Error: 752_000 + .saturating_add((434_780_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + fn seal_contains_storage(r: u32, ) -> Weight { + (209_606_000 as Weight) + // Standard Error: 1_137_000 + .saturating_add((680_187_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1317,20 +1356,38 @@ impl WeightInfo for () { // Storage: Timestamp Now (r:1 w:0) // Storage: unknown [0x7afa01283080ef247df84e0ba38ea5a587d25ce6633a6bfbba02068c14023441] (r:1 w:0) fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (697_017_000 as Weight) - // Standard Error: 216_000 - .saturating_add((111_743_000 as Weight).saturating_mul(n as Weight)) + (619_600_000 as Weight) + // Standard Error: 207_000 + .saturating_add((111_030_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) + fn seal_take_storage(r: u32, ) -> Weight { + (279_528_000 as Weight) + // Standard Error: 932_000 + .saturating_add((541_965_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes((100 as Weight).saturating_mul(r as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn seal_take_storage_per_kb(n: u32, ) -> Weight { + (985_732_000 as Weight) + // Standard Error: 446_000 + .saturating_add((123_295_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(105 as Weight)) + .saturating_add(RocksDbWeight::get().writes(103 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) fn seal_transfer(r: u32, ) -> Weight { - (243_124_000 as Weight) - // Standard Error: 1_718_000 - .saturating_add((3_530_873_000 as Weight).saturating_mul(r as Weight)) + (284_785_000 as Weight) + // Standard Error: 1_479_000 + .saturating_add((2_527_544_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) @@ -1341,9 +1398,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_call(r: u32, ) -> Weight { - (140_524_000 as Weight) - // Standard Error: 4_504_000 - .saturating_add((39_287_224_000 as Weight).saturating_mul(r as Weight)) + (0 as Weight) + // Standard Error: 5_742_000 + .saturating_add((37_993_391_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) @@ -1354,13 +1411,13 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_call_per_transfer_input_output_kb(t: u32, i: u32, o: u32, ) -> Weight { - (38_929_132_000 as Weight) - // Standard Error: 65_806_000 - .saturating_add((2_980_358_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 23_000 - .saturating_add((62_980_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 25_000 - .saturating_add((101_383_000 as Weight).saturating_mul(o as Weight)) + (37_404_660_000 as Weight) + // Standard Error: 92_661_000 + .saturating_add((2_486_257_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 33_000 + .saturating_add((63_001_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 35_000 + .saturating_add((101_347_000 as Weight).saturating_mul(o as Weight)) .saturating_add(RocksDbWeight::get().reads(105 as Weight)) .saturating_add(RocksDbWeight::get().reads((101 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(101 as Weight)) @@ -1374,8 +1431,8 @@ impl WeightInfo for () { // Storage: Contracts OwnerInfoOf (r:100 w:100) fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 120_171_000 - .saturating_add((50_779_937_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 119_281_000 + .saturating_add((47_113_525_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().reads((400 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) @@ -1388,13 +1445,13 @@ impl WeightInfo for () { // Storage: Contracts AccountCounter (r:1 w:1) // Storage: Contracts OwnerInfoOf (r:1 w:1) fn seal_instantiate_per_input_output_salt_kb(i: u32, o: u32, s: u32, ) -> Weight { - (45_749_415_000 as Weight) - // Standard Error: 34_000 - .saturating_add((64_650_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 34_000 - .saturating_add((101_902_000 as Weight).saturating_mul(o as Weight)) - // Standard Error: 34_000 - .saturating_add((201_402_000 as Weight).saturating_mul(s as Weight)) + (41_157_901_000 as Weight) + // Standard Error: 147_000 + .saturating_add((64_877_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 147_000 + .saturating_add((102_420_000 as Weight).saturating_mul(o as Weight)) + // Standard Error: 147_000 + .saturating_add((201_587_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(208 as Weight)) .saturating_add(RocksDbWeight::get().writes(206 as Weight)) } @@ -1403,9 +1460,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_sha2_256(r: u32, ) -> Weight { - (414_773_000 as Weight) - // Standard Error: 183_000 - .saturating_add((127_117_000 as Weight).saturating_mul(r as Weight)) + (402_224_000 as Weight) + // Standard Error: 166_000 + .saturating_add((103_985_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1414,9 +1471,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (581_981_000 as Weight) - // Standard Error: 38_000 - .saturating_add((505_754_000 as Weight).saturating_mul(n as Weight)) + (663_731_000 as Weight) + // Standard Error: 42_000 + .saturating_add((505_157_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1425,9 +1482,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_keccak_256(r: u32, ) -> Weight { - (424_421_000 as Weight) - // Standard Error: 223_000 - .saturating_add((137_068_000 as Weight).saturating_mul(r as Weight)) + (402_638_000 as Weight) + // Standard Error: 165_000 + .saturating_add((117_589_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1436,9 +1493,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (497_132_000 as Weight) - // Standard Error: 24_000 - .saturating_add((363_894_000 as Weight).saturating_mul(n as Weight)) + (491_978_000 as Weight) + // Standard Error: 23_000 + .saturating_add((363_687_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1447,9 +1504,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_blake2_256(r: u32, ) -> Weight { - (419_414_000 as Weight) - // Standard Error: 174_000 - .saturating_add((106_283_000 as Weight).saturating_mul(r as Weight)) + (402_254_000 as Weight) + // Standard Error: 154_000 + .saturating_add((86_403_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1458,9 +1515,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (572_206_000 as Weight) - // Standard Error: 24_000 - .saturating_add((163_930_000 as Weight).saturating_mul(n as Weight)) + (476_405_000 as Weight) + // Standard Error: 18_000 + .saturating_add((163_921_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1469,9 +1526,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_blake2_128(r: u32, ) -> Weight { - (417_971_000 as Weight) - // Standard Error: 180_000 - .saturating_add((106_016_000 as Weight).saturating_mul(r as Weight)) + (399_949_000 as Weight) + // Standard Error: 142_000 + .saturating_add((85_448_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1480,9 +1537,9 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (568_067_000 as Weight) - // Standard Error: 20_000 - .saturating_add((163_853_000 as Weight).saturating_mul(n as Weight)) + (475_437_000 as Weight) + // Standard Error: 15_000 + .saturating_add((163_921_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -1491,265 +1548,265 @@ impl WeightInfo for () { // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) fn seal_ecdsa_recover(r: u32, ) -> Weight { - (372_816_000 as Weight) - // Standard Error: 1_677_000 - .saturating_add((15_723_462_000 as Weight).saturating_mul(r as Weight)) + (373_575_000 as Weight) + // Standard Error: 1_639_000 + .saturating_add((15_530_027_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn instr_i64const(r: u32, ) -> Weight { - (53_407_000 as Weight) - // Standard Error: 14_000 - .saturating_add((885_000 as Weight).saturating_mul(r as Weight)) + (52_763_000 as Weight) + // Standard Error: 12_000 + .saturating_add((857_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64load(r: u32, ) -> Weight { - (48_061_000 as Weight) + (47_313_000 as Weight) // Standard Error: 10_000 - .saturating_add((2_947_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_935_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64store(r: u32, ) -> Weight { - (48_150_000 as Weight) + (47_147_000 as Weight) // Standard Error: 10_000 - .saturating_add((2_978_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_995_000 as Weight).saturating_mul(r as Weight)) } fn instr_select(r: u32, ) -> Weight { - (50_943_000 as Weight) + (50_124_000 as Weight) // Standard Error: 11_000 - .saturating_add((2_446_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_421_000 as Weight).saturating_mul(r as Weight)) } fn instr_if(r: u32, ) -> Weight { - (47_862_000 as Weight) - // Standard Error: 12_000 - .saturating_add((2_627_000 as Weight).saturating_mul(r as Weight)) + (47_288_000 as Weight) + // Standard Error: 11_000 + .saturating_add((2_523_000 as Weight).saturating_mul(r as Weight)) } fn instr_br(r: u32, ) -> Weight { - (51_291_000 as Weight) + (50_198_000 as Weight) // Standard Error: 16_000 - .saturating_add((1_467_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_473_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_if(r: u32, ) -> Weight { - (44_627_000 as Weight) - // Standard Error: 18_000 - .saturating_add((2_211_000 as Weight).saturating_mul(r as Weight)) + (44_008_000 as Weight) + // Standard Error: 17_000 + .saturating_add((2_174_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_table(r: u32, ) -> Weight { - (38_208_000 as Weight) + (37_602_000 as Weight) // Standard Error: 16_000 - .saturating_add((2_914_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_820_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_table_per_entry(e: u32, ) -> Weight { - (47_228_000 as Weight) + (46_232_000 as Weight) // Standard Error: 3_000 .saturating_add((17_000 as Weight).saturating_mul(e as Weight)) } fn instr_call(r: u32, ) -> Weight { - (39_507_000 as Weight) - // Standard Error: 26_000 - .saturating_add((20_544_000 as Weight).saturating_mul(r as Weight)) + (40_148_000 as Weight) + // Standard Error: 22_000 + .saturating_add((20_585_000 as Weight).saturating_mul(r as Weight)) } fn instr_call_indirect(r: u32, ) -> Weight { - (47_235_000 as Weight) + (43_948_000 as Weight) // Standard Error: 31_000 - .saturating_add((29_869_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((30_226_000 as Weight).saturating_mul(r as Weight)) } fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (78_847_000 as Weight) - // Standard Error: 6_000 - .saturating_add((1_217_000 as Weight).saturating_mul(p as Weight)) + (78_722_000 as Weight) + // Standard Error: 5_000 + .saturating_add((1_199_000 as Weight).saturating_mul(p as Weight)) } fn instr_local_get(r: u32, ) -> Weight { - (48_441_000 as Weight) - // Standard Error: 11_000 - .saturating_add((816_000 as Weight).saturating_mul(r as Weight)) + (48_083_000 as Weight) + // Standard Error: 12_000 + .saturating_add((805_000 as Weight).saturating_mul(r as Weight)) } fn instr_local_set(r: u32, ) -> Weight { - (48_324_000 as Weight) + (47_710_000 as Weight) // Standard Error: 11_000 - .saturating_add((861_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((843_000 as Weight).saturating_mul(r as Weight)) } fn instr_local_tee(r: u32, ) -> Weight { - (45_372_000 as Weight) - // Standard Error: 10_000 - .saturating_add((1_488_000 as Weight).saturating_mul(r as Weight)) + (44_785_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_466_000 as Weight).saturating_mul(r as Weight)) } fn instr_global_get(r: u32, ) -> Weight { - (58_465_000 as Weight) + (50_106_000 as Weight) // Standard Error: 20_000 - .saturating_add((1_655_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_641_000 as Weight).saturating_mul(r as Weight)) } fn instr_global_set(r: u32, ) -> Weight { - (55_457_000 as Weight) + (47_058_000 as Weight) // Standard Error: 18_000 - .saturating_add((1_671_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_707_000 as Weight).saturating_mul(r as Weight)) } fn instr_memory_current(r: u32, ) -> Weight { - (52_615_000 as Weight) - // Standard Error: 14_000 - .saturating_add((905_000 as Weight).saturating_mul(r as Weight)) + (51_494_000 as Weight) + // Standard Error: 15_000 + .saturating_add((925_000 as Weight).saturating_mul(r as Weight)) } fn instr_memory_grow(r: u32, ) -> Weight { - (37_739_000 as Weight) - // Standard Error: 2_851_000 - .saturating_add((634_780_000 as Weight).saturating_mul(r as Weight)) + (36_983_000 as Weight) + // Standard Error: 3_602_000 + .saturating_add((634_259_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64clz(r: u32, ) -> Weight { - (54_830_000 as Weight) - // Standard Error: 9_000 - .saturating_add((1_309_000 as Weight).saturating_mul(r as Weight)) + (60_711_000 as Weight) + // Standard Error: 22_000 + .saturating_add((1_157_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ctz(r: u32, ) -> Weight { - (54_712_000 as Weight) + (53_908_000 as Weight) // Standard Error: 9_000 - .saturating_add((1_310_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_305_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64popcnt(r: u32, ) -> Weight { - (54_864_000 as Weight) - // Standard Error: 10_000 - .saturating_add((1_312_000 as Weight).saturating_mul(r as Weight)) + (53_939_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_314_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64eqz(r: u32, ) -> Weight { - (54_596_000 as Weight) - // Standard Error: 9_000 - .saturating_add((1_314_000 as Weight).saturating_mul(r as Weight)) + (54_086_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_309_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64extendsi32(r: u32, ) -> Weight { - (44_536_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_514_000 as Weight).saturating_mul(r as Weight)) + (43_845_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_493_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64extendui32(r: u32, ) -> Weight { - (44_380_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_512_000 as Weight).saturating_mul(r as Weight)) + (43_518_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_501_000 as Weight).saturating_mul(r as Weight)) } fn instr_i32wrapi64(r: u32, ) -> Weight { - (54_968_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_310_000 as Weight).saturating_mul(r as Weight)) + (53_912_000 as Weight) + // Standard Error: 9_000 + .saturating_add((1_302_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64eq(r: u32, ) -> Weight { - (50_161_000 as Weight) - // Standard Error: 10_000 - .saturating_add((1_917_000 as Weight).saturating_mul(r as Weight)) + (49_594_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_890_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ne(r: u32, ) -> Weight { - (50_417_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_911_000 as Weight).saturating_mul(r as Weight)) + (49_659_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_894_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64lts(r: u32, ) -> Weight { - (50_358_000 as Weight) + (49_401_000 as Weight) // Standard Error: 11_000 - .saturating_add((1_914_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_902_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ltu(r: u32, ) -> Weight { - (49_864_000 as Weight) + (49_880_000 as Weight) // Standard Error: 11_000 - .saturating_add((1_928_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_885_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64gts(r: u32, ) -> Weight { - (50_159_000 as Weight) + (49_466_000 as Weight) // Standard Error: 10_000 - .saturating_add((1_917_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_894_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64gtu(r: u32, ) -> Weight { - (50_037_000 as Weight) - // Standard Error: 16_000 - .saturating_add((1_945_000 as Weight).saturating_mul(r as Weight)) + (49_514_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_891_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64les(r: u32, ) -> Weight { - (50_482_000 as Weight) + (49_588_000 as Weight) // Standard Error: 11_000 - .saturating_add((1_909_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_898_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64leu(r: u32, ) -> Weight { - (50_426_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_908_000 as Weight).saturating_mul(r as Weight)) + (49_589_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_891_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ges(r: u32, ) -> Weight { - (50_205_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_918_000 as Weight).saturating_mul(r as Weight)) + (49_685_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_892_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64geu(r: u32, ) -> Weight { - (50_189_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_928_000 as Weight).saturating_mul(r as Weight)) + (49_601_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_891_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64add(r: u32, ) -> Weight { - (50_205_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_922_000 as Weight).saturating_mul(r as Weight)) + (49_430_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_894_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64sub(r: u32, ) -> Weight { - (50_375_000 as Weight) - // Standard Error: 15_000 - .saturating_add((1_929_000 as Weight).saturating_mul(r as Weight)) + (49_533_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_893_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64mul(r: u32, ) -> Weight { - (50_343_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_916_000 as Weight).saturating_mul(r as Weight)) + (49_766_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_888_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64divs(r: u32, ) -> Weight { - (50_707_000 as Weight) + (49_315_000 as Weight) // Standard Error: 11_000 - .saturating_add((2_667_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_552_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64divu(r: u32, ) -> Weight { - (50_318_000 as Weight) + (49_786_000 as Weight) // Standard Error: 11_000 - .saturating_add((2_408_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_203_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rems(r: u32, ) -> Weight { - (50_214_000 as Weight) - // Standard Error: 17_000 - .saturating_add((2_702_000 as Weight).saturating_mul(r as Weight)) + (49_651_000 as Weight) + // Standard Error: 11_000 + .saturating_add((2_461_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64remu(r: u32, ) -> Weight { - (50_394_000 as Weight) - // Standard Error: 11_000 - .saturating_add((2_411_000 as Weight).saturating_mul(r as Weight)) + (49_747_000 as Weight) + // Standard Error: 10_000 + .saturating_add((2_196_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64and(r: u32, ) -> Weight { - (50_397_000 as Weight) + (49_719_000 as Weight) // Standard Error: 11_000 - .saturating_add((1_910_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_892_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64or(r: u32, ) -> Weight { - (50_291_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_915_000 as Weight).saturating_mul(r as Weight)) + (49_463_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_896_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64xor(r: u32, ) -> Weight { - (50_684_000 as Weight) - // Standard Error: 12_000 + (49_379_000 as Weight) + // Standard Error: 11_000 .saturating_add((1_903_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shl(r: u32, ) -> Weight { - (49_638_000 as Weight) - // Standard Error: 17_000 - .saturating_add((1_967_000 as Weight).saturating_mul(r as Weight)) + (49_404_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_902_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shrs(r: u32, ) -> Weight { - (50_817_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_899_000 as Weight).saturating_mul(r as Weight)) + (49_498_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_900_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shru(r: u32, ) -> Weight { - (50_987_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_899_000 as Weight).saturating_mul(r as Weight)) + (49_541_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_897_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rotl(r: u32, ) -> Weight { - (50_885_000 as Weight) - // Standard Error: 12_000 - .saturating_add((1_905_000 as Weight).saturating_mul(r as Weight)) + (49_452_000 as Weight) + // Standard Error: 11_000 + .saturating_add((1_900_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rotr(r: u32, ) -> Weight { - (50_465_000 as Weight) - // Standard Error: 11_000 - .saturating_add((1_908_000 as Weight).saturating_mul(r as Weight)) + (49_350_000 as Weight) + // Standard Error: 10_000 + .saturating_add((1_902_000 as Weight).saturating_mul(r as Weight)) } }