From 6847f883efdb48072a100821f3c4e42f22c5aca6 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 7 May 2024 17:36:37 +0200 Subject: [PATCH 01/29] Add static_call flag to contracts call function --- substrate/frame/contracts/src/exec.rs | 94 ++++++++++++++++--- substrate/frame/contracts/src/lib.rs | 2 + substrate/frame/contracts/src/wasm/mod.rs | 14 +-- substrate/frame/contracts/src/wasm/runtime.rs | 3 +- substrate/frame/contracts/uapi/src/flags.rs | 8 ++ substrate/frame/contracts/uapi/src/host.rs | 2 +- 6 files changed, 103 insertions(+), 20 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 31cdadb4bb43..0cdea463593f 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -149,6 +149,7 @@ pub trait Ext: sealing::Sealed { value: BalanceOf, input_data: Vec, allows_reentry: bool, + allows_state_change: bool, ) -> Result; /// Execute code in the current frame. @@ -498,6 +499,8 @@ pub struct Frame { nested_storage: storage::meter::NestedMeter, /// If `false` the contract enabled its defense against reentrance attacks. allows_reentry: bool, + /// TODO + allows_state_change: bool, /// The caller of the currently executing frame which was spawned by `delegate_call`. delegate_caller: Option>, } @@ -864,6 +867,7 @@ where nested_gas: gas_meter.nested(gas_limit), nested_storage: storage_meter.nested(deposit_limit), allows_reentry: true, + allows_state_change: true, }; Ok((frame, executable, nonce)) @@ -1174,7 +1178,7 @@ where /// Iterator over all frames. /// /// The iterator starts with the top frame and ends with the root frame. - fn frames(&self) -> impl Iterator> { + fn frames(&self) -> impl DoubleEndedIterator> { sp_std::iter::once(&self.first_frame).chain(&self.frames).rev() } @@ -1194,6 +1198,19 @@ where !self.frames().any(|f| &f.account_id == id && !f.allows_reentry) } + /// Returns whether the state can be changed + fn allows_state_change(&self) -> bool { + !self.frames().rev().any(|f| !f.allows_state_change) + } + + /// Returns whether the state can be changed + fn requires_state_change(&self) -> DispatchResult { + if !self.allows_state_change() { + return Err(>::StateChangeDenied.into()) + } + Ok(()) + } + /// Increments and returns the next nonce. Pulls it from storage if it isn't in cache. fn next_nonce(&mut self) -> u64 { let next = self.nonce().wrapping_add(1); @@ -1217,16 +1234,23 @@ where value: BalanceOf, input_data: Vec, allows_reentry: bool, + allows_state_change: bool, ) -> Result { // Before pushing the new frame: Protect the caller contract against reentrancy attacks. // It is important to do this before calling `allows_reentry` so that a direct recursion // is caught by it. self.top_frame_mut().allows_reentry = allows_reentry; + self.top_frame_mut().allows_state_change = allows_state_change; let try_call = || { if !self.allows_reentry(&to) { return Err(>::ReentranceDenied.into()) } + + // If the call value is non-zero and state change is not allowed, issue an error. + if !value.is_zero() { + self.requires_state_change()?; + } // We ignore instantiate frames in our search for a cached contract. // Otherwise it would be possible to recursively call a contract from its own // constructor: We disallow calling not fully constructed contracts. @@ -1251,6 +1275,7 @@ where // Protection is on a per call basis. self.top_frame_mut().allows_reentry = true; + self.top_frame_mut().allows_state_change = true; result } @@ -1352,6 +1377,7 @@ where value: Option>, take_old: bool, ) -> Result { + self.requires_state_change()?; let frame = self.top_frame_mut(); frame.contract_info.get(&frame.account_id).write( key.into(), @@ -2122,7 +2148,7 @@ mod tests { let value = Default::default(); let recurse_ch = MockLoader::insert(Call, |ctx, _| { // Try to call into yourself. - let r = ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![], true); + let r = ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![], true, true); ReachedBottom::mutate(|reached_bottom| { if !*reached_bottom { @@ -2182,7 +2208,7 @@ mod tests { // Call into CHARLIE contract. assert_matches!( ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true), + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true), Ok(_) ); exec_success() @@ -2329,7 +2355,7 @@ mod tests { assert!(ctx.ext.caller_is_origin()); // BOB calls CHARLIE ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true) + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) }); ExtBuilder::default().build().execute_with(|| { @@ -2428,7 +2454,7 @@ mod tests { assert!(ctx.ext.caller_is_root()); // BOB calls CHARLIE. ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true) + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) }); ExtBuilder::default().build().execute_with(|| { @@ -2463,7 +2489,7 @@ mod tests { // Call into charlie contract. assert_matches!( ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true), + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true), Ok(_) ); exec_success() @@ -2831,6 +2857,7 @@ mod tests { CHARLIE, 0, vec![], + true, true ), exec_trapped() @@ -2842,7 +2869,7 @@ mod tests { let code_charlie = MockLoader::insert(Call, |ctx, _| { assert!(ctx .ext - .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true) + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true, true) .is_ok()); exec_trapped() }); @@ -2875,7 +2902,7 @@ mod tests { fn recursive_call_during_constructor_fails() { let code = MockLoader::insert(Constructor, |ctx, _| { assert_matches!( - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), ctx.ext.address().clone(), 0, vec![], true), + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), ctx.ext.address().clone(), 0, vec![], true, true), Err(ExecError{error, ..}) if error == >::ContractNotFound.into() ); exec_success() @@ -3025,7 +3052,7 @@ mod tests { // call the contract passed as input with disabled reentry let code_bob = MockLoader::insert(Call, |ctx, _| { let dest = Decode::decode(&mut ctx.input_data.as_ref()).unwrap(); - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), dest, 0, vec![], false) + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), dest, 0, vec![], false, true) }); let code_charlie = MockLoader::insert(Call, |_, _| exec_success()); @@ -3075,7 +3102,7 @@ mod tests { let code_bob = MockLoader::insert(Call, |ctx, _| { if ctx.input_data[0] == 0 { ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], false) + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], false, true) } else { exec_success() } @@ -3083,7 +3110,7 @@ mod tests { // call BOB with input set to '1' let code_charlie = MockLoader::insert(Call, |ctx, _| { - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true) + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, true) }); ExtBuilder::default().build().execute_with(|| { @@ -3113,6 +3140,49 @@ mod tests { }); } + #[test] + fn call_deny_state_change() { + let code_bob = MockLoader::insert(Call, |ctx, _| { + if ctx.input_data[0] == 0 { + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) + } else { + exec_success() + } + }); + + // call BOB with input set to '1' + let code_charlie = MockLoader::insert(Call, |ctx, _| { + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) + }); + + ExtBuilder::default().build().execute_with(|| { + let schedule = ::Schedule::get(); + place_contract(&BOB, code_bob); + place_contract(&CHARLIE, code_charlie); + let contract_origin = Origin::from_account_id(ALICE); + let mut storage_meter = + storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); + + // BOB -> CHARLIE -> BOB fails as BOB denies reentry. + assert_err!( + MockStack::run_call( + contract_origin, + BOB, + &mut GasMeter::::new(GAS_LIMIT), + &mut storage_meter, + &schedule, + 0, + vec![0], + None, + Determinism::Enforced + ) + .map_err(|e| e.error), + >::StateChangeDenied, + ); + }); + } + #[test] fn call_runtime_works() { let code_hash = MockLoader::insert(Call, |ctx, _| { @@ -3303,7 +3373,7 @@ mod tests { // a plain call should not influence the account counter ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), account_id, 0, vec![], false) + .call(Weight::zero(), BalanceOf::::zero(), account_id, 0, vec![], false, true) .unwrap(); exec_success() diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 3e87eb9f37ea..e9528e4ae00b 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -1202,6 +1202,8 @@ pub mod pallet { /// into `pallet-contracts`. This would make the whole pallet reentrant with regard to /// contract code execution which is not supported. ReentranceDenied, + /// A contract tried to invoke a call that disallows for state change. + StateChangeDenied, /// Origin doesn't have enough balance to pay the required storage deposits. StorageDepositNotEnoughFunds, /// More storage was created than allowed by the storage deposit limit. diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 8d7f928dba33..7963f12856f5 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -544,6 +544,7 @@ mod tests { value: u64, data: Vec, allows_reentry: bool, + allows_state_change: bool } #[derive(Debug, PartialEq, Eq)] @@ -611,8 +612,9 @@ mod tests { value: u64, data: Vec, allows_reentry: bool, + allows_state_change: bool, ) -> Result { - self.calls.push(CallEntry { to, value, data, allows_reentry }); + self.calls.push(CallEntry { to, value, data, allows_reentry, allows_state_change }); Ok(ExecReturnValue { flags: ReturnFlags::empty(), data: call_return_data() }) } fn delegate_call( @@ -985,7 +987,7 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true }] + &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true, allows_state_change: true }] ); } @@ -1082,7 +1084,7 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false }] + &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false, allows_state_change: true }] ); } @@ -1137,7 +1139,7 @@ mod tests { assert_eq!(result.data, input); assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: true }] + &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: true, allows_state_change: true }] ); } @@ -1184,7 +1186,7 @@ mod tests { assert_eq!(result.data, call_return_data()); assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false }] + &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false, allows_state_change: true }] ); } @@ -1425,7 +1427,7 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true }] + &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true, allows_state_change: true }] ); } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 3212aff31269..278a3ddcbb42 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -851,10 +851,11 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { value, input_data, flags.contains(CallFlags::ALLOW_REENTRY), + !flags.contains(CallFlags::STATIC_CALL), ) }, CallType::DelegateCall { code_hash_ptr } => { - if flags.contains(CallFlags::ALLOW_REENTRY) { + if flags.contains(CallFlags::ALLOW_REENTRY | CallFlags::STATIC_CALL) { return Err(Error::::InvalidCallFlags.into()) } let code_hash = self.read_sandbox_memory_as(memory, code_hash_ptr)?; diff --git a/substrate/frame/contracts/uapi/src/flags.rs b/substrate/frame/contracts/uapi/src/flags.rs index 32553817fb7a..65083b0ab616 100644 --- a/substrate/frame/contracts/uapi/src/flags.rs +++ b/substrate/frame/contracts/uapi/src/flags.rs @@ -69,5 +69,13 @@ bitflags! { /// For `seal_delegate_call` should be always unset, otherwise /// [`Error::InvalidCallFlags`] is returned. const ALLOW_REENTRY = 0b0000_1000; + /// Indicates that the callee is restricted from modifying the state during call execution, + /// equivalent to Ethereum's STATICCALL + /// + /// # Note + /// + /// For `seal_delegate_call` should be always unset, otherwise + /// [`Error::InvalidCallFlags`] is returned. + const STATIC_CALL = 0b0001_0000; } } diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index 92065eda5d63..b217d609fa88 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -125,7 +125,7 @@ pub trait HostFn { /// Make a call to another contract. /// /// This is equivalent to calling the newer version of this function with - /// `flags` set to [`CallFlags::ALLOW_REENTRY`]. See the newer version for documentation. + /// `flags` set to [`CallFlags::ALLOW_REENTRY CallFlags::ALLOW_STATE_CHANGE`]. See the newer version for documentation. #[deprecated(note = "Deprecated, use newer version instead")] fn call( callee: &[u8], From b19bc7791a48ba833d3f0c73f6c9d2005be5036f Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 8 May 2024 15:40:01 +0200 Subject: [PATCH 02/29] Refactoring --- substrate/frame/contracts/src/exec.rs | 148 ++++++++++++------ substrate/frame/contracts/src/wasm/mod.rs | 32 ++-- substrate/frame/contracts/src/wasm/runtime.rs | 8 +- substrate/frame/contracts/uapi/src/flags.rs | 2 +- 4 files changed, 124 insertions(+), 66 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 0cdea463593f..c37b2e0a993b 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -149,7 +149,7 @@ pub trait Ext: sealing::Sealed { value: BalanceOf, input_data: Vec, allows_reentry: bool, - allows_state_change: bool, + allows_readonly: bool, ) -> Result; /// Execute code in the current frame. @@ -183,7 +183,7 @@ pub trait Ext: sealing::Sealed { /// /// This function will fail if the same contract is present on the contract /// call stack. - fn terminate(&mut self, beneficiary: &AccountIdOf) -> Result<(), DispatchError>; + fn terminate(&mut self, beneficiary: &AccountIdOf) -> DispatchResult; /// Transfer some amount of funds into the specified account. fn transfer(&mut self, to: &AccountIdOf, value: BalanceOf) -> DispatchResult; @@ -255,7 +255,7 @@ pub trait Ext: sealing::Sealed { /// Deposit an event with the given topics. /// /// There should not be any duplicates in `topics`. - fn deposit_event(&mut self, topics: Vec>, data: Vec); + fn deposit_event(&mut self, topics: Vec>, data: Vec) -> DispatchResult; /// Returns the current block number. fn block_number(&self) -> BlockNumberFor; @@ -308,7 +308,7 @@ pub trait Ext: sealing::Sealed { fn contract_info(&mut self) -> &mut ContractInfo; /// Sets new code hash for existing contract. - fn set_code_hash(&mut self, hash: CodeHash) -> Result<(), DispatchError>; + fn set_code_hash(&mut self, hash: CodeHash) -> DispatchResult; /// Returns the number of times the currently executing contract exists on the call stack in /// addition to the calling instance. A value of 0 means no reentrancy. @@ -328,7 +328,7 @@ pub trait Ext: sealing::Sealed { /// /// [`Error::CodeNotFound`] is returned if no stored code found having the specified /// `code_hash`. - fn increment_refcount(code_hash: CodeHash) -> Result<(), DispatchError>; + fn increment_refcount(code_hash: CodeHash) -> DispatchResult; /// Decrement the reference count of a stored code by one. /// @@ -352,7 +352,7 @@ pub trait Ext: sealing::Sealed { fn lock_delegate_dependency( &mut self, code_hash: CodeHash, - ) -> Result<(), DispatchError>; + ) -> DispatchResult; /// Removes a delegate dependency from [`ContractInfo`]'s `delegate_dependencies` field. /// @@ -365,7 +365,7 @@ pub trait Ext: sealing::Sealed { fn unlock_delegate_dependency( &mut self, code_hash: &CodeHash, - ) -> Result<(), DispatchError>; + ) -> DispatchResult; } /// Describes the different functions that can be exported by an [`Executable`]. @@ -499,8 +499,8 @@ pub struct Frame { nested_storage: storage::meter::NestedMeter, /// If `false` the contract enabled its defense against reentrance attacks. allows_reentry: bool, - /// TODO - allows_state_change: bool, + /// If `true` subsequent calls cannot modify storage. + read_only: bool, /// The caller of the currently executing frame which was spawned by `delegate_call`. delegate_caller: Option>, } @@ -779,6 +779,7 @@ where storage_meter, BalanceOf::::zero(), determinism, + false )?; let stack = Self { @@ -811,6 +812,7 @@ where storage_meter: &mut storage::meter::GenericMeter, deposit_limit: BalanceOf, determinism: Determinism, + read_only: bool, ) -> Result<(Frame, E, Option), ExecError> { let (account_id, contract_info, executable, delegate_caller, entry_point, nonce) = match frame_args { @@ -867,7 +869,7 @@ where nested_gas: gas_meter.nested(gas_limit), nested_storage: storage_meter.nested(deposit_limit), allows_reentry: true, - allows_state_change: true, + read_only, }; Ok((frame, executable, nonce)) @@ -899,6 +901,8 @@ where let frame = top_frame_mut!(self); let nested_gas = &mut frame.nested_gas; let nested_storage = &mut frame.nested_storage; + // Inherit `read_only` flag from top frame. + let read_only = frame.read_only; let (frame, executable, _) = Self::new_frame( frame_args, value_transferred, @@ -907,6 +911,7 @@ where nested_storage, deposit_limit, self.determinism, + read_only )?; self.frames.push(frame); Ok(executable) @@ -1198,14 +1203,9 @@ where !self.frames().any(|f| &f.account_id == id && !f.allows_reentry) } - /// Returns whether the state can be changed - fn allows_state_change(&self) -> bool { - !self.frames().rev().any(|f| !f.allows_state_change) - } - - /// Returns whether the state can be changed - fn requires_state_change(&self) -> DispatchResult { - if !self.allows_state_change() { + /// Checks if the state can be changed + fn allows_state_change(&self) -> DispatchResult { + if self.top_frame().read_only { return Err(>::StateChangeDenied.into()) } Ok(()) @@ -1234,13 +1234,18 @@ where value: BalanceOf, input_data: Vec, allows_reentry: bool, - allows_state_change: bool, + read_only: bool, ) -> Result { // Before pushing the new frame: Protect the caller contract against reentrancy attacks. // It is important to do this before calling `allows_reentry` so that a direct recursion // is caught by it. self.top_frame_mut().allows_reentry = allows_reentry; - self.top_frame_mut().allows_state_change = allows_state_change; + + let frame_read_only = self.top_frame().read_only; + // Enable read-only access if requested; cannot disable it if already set. + if read_only && !frame_read_only { + self.top_frame_mut().read_only = read_only; + } let try_call = || { if !self.allows_reentry(&to) { @@ -1249,7 +1254,7 @@ where // If the call value is non-zero and state change is not allowed, issue an error. if !value.is_zero() { - self.requires_state_change()?; + self.allows_state_change()?; } // We ignore instantiate frames in our search for a cached contract. // Otherwise it would be possible to recursively call a contract from its own @@ -1267,6 +1272,7 @@ where gas_limit, deposit_limit, )?; + self.run(executable, input_data) }; @@ -1275,7 +1281,9 @@ where // Protection is on a per call basis. self.top_frame_mut().allows_reentry = true; - self.top_frame_mut().allows_state_change = true; + + // Revert to the previous setting. + self.top_frame_mut().read_only = frame_read_only; result } @@ -1312,6 +1320,7 @@ where input_data: Vec, salt: &[u8], ) -> Result<(AccountIdOf, ExecReturnValue), ExecError> { + self.allows_state_change()?; let executable = E::from_storage(code_hash, self.gas_meter_mut())?; let nonce = self.next_nonce(); let executable = self.push_frame( @@ -1330,7 +1339,8 @@ where self.run(executable, input_data).map(|ret| (account_id, ret)) } - fn terminate(&mut self, beneficiary: &AccountIdOf) -> Result<(), DispatchError> { + fn terminate(&mut self, beneficiary: &AccountIdOf) -> DispatchResult { + self.allows_state_change()?; if self.is_recursive() { return Err(Error::::TerminatedWhileReentrant.into()) } @@ -1360,6 +1370,7 @@ where } fn transfer(&mut self, to: &T::AccountId, value: BalanceOf) -> DispatchResult { + self.allows_state_change()?; Self::transfer(Preservation::Preserve, &self.top_frame().account_id, to, value) } @@ -1377,7 +1388,7 @@ where value: Option>, take_old: bool, ) -> Result { - self.requires_state_change()?; + self.allows_state_change()?; let frame = self.top_frame_mut(); frame.contract_info.get(&frame.account_id).write( key.into(), @@ -1447,11 +1458,13 @@ where T::Currency::minimum_balance() } - fn deposit_event(&mut self, topics: Vec, data: Vec) { + fn deposit_event(&mut self, topics: Vec, data: Vec) -> DispatchResult { + self.allows_state_change()?; Contracts::::deposit_event( topics, Event::ContractEmitted { contract: self.top_frame().account_id.clone(), data }, ); + Ok(()) } fn block_number(&self) -> BlockNumberFor { @@ -1531,7 +1544,8 @@ where self.top_frame_mut().contract_info() } - fn set_code_hash(&mut self, hash: CodeHash) -> Result<(), DispatchError> { + fn set_code_hash(&mut self, hash: CodeHash) -> DispatchResult { + self.allows_state_change()?; let frame = top_frame_mut!(self); if !E::from_storage(hash, &mut frame.nested_gas)?.is_deterministic() { return Err(>::Indeterministic.into()) @@ -1585,7 +1599,7 @@ where } } - fn increment_refcount(code_hash: CodeHash) -> Result<(), DispatchError> { + fn increment_refcount(code_hash: CodeHash) -> DispatchResult { >::mutate(code_hash, |existing| -> Result<(), DispatchError> { if let Some(info) = existing { *info.refcount_mut() = info.refcount().saturating_add(1); @@ -1607,7 +1621,8 @@ where fn lock_delegate_dependency( &mut self, code_hash: CodeHash, - ) -> Result<(), DispatchError> { + ) -> DispatchResult { + self.allows_state_change()?; let frame = self.top_frame_mut(); let info = frame.contract_info.get(&frame.account_id); ensure!(code_hash != info.code_hash, Error::::CannotAddSelfAsDelegateDependency); @@ -1626,7 +1641,8 @@ where fn unlock_delegate_dependency( &mut self, code_hash: &CodeHash, - ) -> Result<(), DispatchError> { + ) -> DispatchResult { + self.allows_state_change()?; let frame = self.top_frame_mut(); let info = frame.contract_info.get(&frame.account_id); @@ -2858,7 +2874,7 @@ mod tests { 0, vec![], true, - true + false ), exec_trapped() ); @@ -2902,7 +2918,7 @@ mod tests { fn recursive_call_during_constructor_fails() { let code = MockLoader::insert(Constructor, |ctx, _| { assert_matches!( - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), ctx.ext.address().clone(), 0, vec![], true, true), + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), ctx.ext.address().clone(), 0, vec![], true, false), Err(ExecError{error, ..}) if error == >::ContractNotFound.into() ); exec_success() @@ -3052,7 +3068,7 @@ mod tests { // call the contract passed as input with disabled reentry let code_bob = MockLoader::insert(Call, |ctx, _| { let dest = Decode::decode(&mut ctx.input_data.as_ref()).unwrap(); - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), dest, 0, vec![], false, true) + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), dest, 0, vec![], false, false) }); let code_charlie = MockLoader::insert(Call, |_, _| exec_success()); @@ -3102,7 +3118,7 @@ mod tests { let code_bob = MockLoader::insert(Call, |ctx, _| { if ctx.input_data[0] == 0 { ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], false, true) + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], false, false) } else { exec_success() } @@ -3110,7 +3126,7 @@ mod tests { // call BOB with input set to '1' let code_charlie = MockLoader::insert(Call, |ctx, _| { - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, true) + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) }); ExtBuilder::default().build().execute_with(|| { @@ -3141,19 +3157,63 @@ mod tests { } #[test] - fn call_deny_state_change() { + fn read_only_call_with_non_zero_value_fails() { + let code_bob = MockLoader::insert(Call, |ctx, _| { + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), CHARLIE, ctx.input_data[0] as u64, vec![], true, true) + }); + + let code_charlie = MockLoader::insert(Call, |_, _| exec_success()); + + ExtBuilder::default().build().execute_with(|| { + let schedule = ::Schedule::get(); + place_contract(&BOB, code_bob); + place_contract(&CHARLIE, code_charlie); + let contract_origin = Origin::from_account_id(ALICE); + let mut storage_meter = + storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); + + // BOB calls CHARLIE with read only flag and zero value + assert_ok!(MockStack::run_call( + contract_origin.clone(), + BOB, + &mut GasMeter::::new(GAS_LIMIT), + &mut storage_meter, + &schedule, + 0, + vec![0], + None, + Determinism::Enforced + )); + + // BOB calls CHARLIE with read only flag and non zero value + assert_err!( + MockStack::run_call( + contract_origin, + BOB, + &mut GasMeter::::new(GAS_LIMIT), + &mut storage_meter, + &schedule, + 0, + vec![1], + None, + Determinism::Enforced + ) + .map_err(|e| e.error), + >::StateChangeDenied, + ); + }); + } + + #[test] + fn read_only_call_with_set_storage_fails() { let code_bob = MockLoader::insert(Call, |ctx, _| { - if ctx.input_data[0] == 0 { ctx.ext .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) - } else { - exec_success() - } }); - // call BOB with input set to '1' let code_charlie = MockLoader::insert(Call, |ctx, _| { - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) + ctx.ext.set_storage(&Key::Fix([1; 32]), Some(vec![1, 2, 3]), false)?; + exec_success() }); ExtBuilder::default().build().execute_with(|| { @@ -3164,7 +3224,7 @@ mod tests { let mut storage_meter = storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); - // BOB -> CHARLIE -> BOB fails as BOB denies reentry. + // If BOB calls CHARLIE with the read-only flag, CHARLIE cannot modify the storage, causing set_storage to fail. assert_err!( MockStack::run_call( contract_origin, @@ -3173,7 +3233,7 @@ mod tests { &mut storage_meter, &schedule, 0, - vec![0], + vec![], None, Determinism::Enforced ) @@ -3181,7 +3241,7 @@ mod tests { >::StateChangeDenied, ); }); - } + } #[test] fn call_runtime_works() { diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 7963f12856f5..2229bc754a2f 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -544,7 +544,7 @@ mod tests { value: u64, data: Vec, allows_reentry: bool, - allows_state_change: bool + read_only: bool } #[derive(Debug, PartialEq, Eq)] @@ -612,9 +612,9 @@ mod tests { value: u64, data: Vec, allows_reentry: bool, - allows_state_change: bool, + read_only: bool, ) -> Result { - self.calls.push(CallEntry { to, value, data, allows_reentry, allows_state_change }); + self.calls.push(CallEntry { to, value, data, allows_reentry, read_only }); Ok(ExecReturnValue { flags: ReturnFlags::empty(), data: call_return_data() }) } fn delegate_call( @@ -646,15 +646,15 @@ mod tests { ExecReturnValue { flags: ReturnFlags::empty(), data: Vec::new() }, )) } - fn set_code_hash(&mut self, hash: CodeHash) -> Result<(), DispatchError> { + fn set_code_hash(&mut self, hash: CodeHash) -> DispatchResult { self.code_hashes.push(hash); Ok(()) } - fn transfer(&mut self, to: &AccountIdOf, value: u64) -> Result<(), DispatchError> { + fn transfer(&mut self, to: &AccountIdOf, value: u64) -> DispatchResult { self.transfers.push(TransferEntry { to: to.clone(), value }); Ok(()) } - fn terminate(&mut self, beneficiary: &AccountIdOf) -> Result<(), DispatchError> { + fn terminate(&mut self, beneficiary: &AccountIdOf) -> DispatchResult { self.terminations.push(TerminationEntry { beneficiary: beneficiary.clone() }); Ok(()) } @@ -720,8 +720,8 @@ mod tests { fn random(&self, subject: &[u8]) -> (SeedOf, BlockNumberFor) { (H256::from_slice(subject), 42) } - fn deposit_event(&mut self, topics: Vec, data: Vec) { - self.events.push((topics, data)) + fn deposit_event(&mut self, topics: Vec, data: Vec) -> DispatchResult { + Ok(self.events.push((topics, data))) } fn block_number(&self) -> u64 { 121 @@ -788,21 +788,21 @@ mod tests { fn nonce(&mut self) -> u64 { 995 } - fn increment_refcount(_code_hash: CodeHash) -> Result<(), DispatchError> { + fn increment_refcount(_code_hash: CodeHash) -> DispatchResult { Ok(()) } fn decrement_refcount(_code_hash: CodeHash) {} fn lock_delegate_dependency( &mut self, code: CodeHash, - ) -> Result<(), DispatchError> { + ) -> DispatchResult { self.delegate_dependencies.borrow_mut().insert(code); Ok(()) } fn unlock_delegate_dependency( &mut self, code: &CodeHash, - ) -> Result<(), DispatchError> { + ) -> DispatchResult { self.delegate_dependencies.borrow_mut().remove(code); Ok(()) } @@ -987,7 +987,7 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true, allows_state_change: true }] + &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true, read_only: false }] ); } @@ -1084,7 +1084,7 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false, allows_state_change: true }] + &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false, read_only: false }] ); } @@ -1139,7 +1139,7 @@ mod tests { assert_eq!(result.data, input); assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: true, allows_state_change: true }] + &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: true, read_only: false }] ); } @@ -1186,7 +1186,7 @@ mod tests { assert_eq!(result.data, call_return_data()); assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false, allows_state_change: true }] + &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false, read_only: false }] ); } @@ -1427,7 +1427,7 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true, allows_state_change: true }] + &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true, read_only: false }] ); } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 278a3ddcbb42..b761b6b2c9c0 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -851,11 +851,11 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { value, input_data, flags.contains(CallFlags::ALLOW_REENTRY), - !flags.contains(CallFlags::STATIC_CALL), + flags.contains(CallFlags::READ_ONLY), ) }, CallType::DelegateCall { code_hash_ptr } => { - if flags.contains(CallFlags::ALLOW_REENTRY | CallFlags::STATIC_CALL) { + if flags.contains(CallFlags::ALLOW_REENTRY | CallFlags::READ_ONLY) { return Err(Error::::InvalidCallFlags.into()) } let code_hash = self.read_sandbox_memory_as(memory, code_hash_ptr)?; @@ -1906,9 +1906,7 @@ pub mod env { let event_data = ctx.read_sandbox_memory(memory, data_ptr, data_len)?; - ctx.ext.deposit_event(topics, event_data); - - Ok(()) + Ok(ctx.ext.deposit_event(topics, event_data)?) } /// Stores the current block number of the current contract into the supplied buffer. diff --git a/substrate/frame/contracts/uapi/src/flags.rs b/substrate/frame/contracts/uapi/src/flags.rs index 65083b0ab616..12d4c52ef77f 100644 --- a/substrate/frame/contracts/uapi/src/flags.rs +++ b/substrate/frame/contracts/uapi/src/flags.rs @@ -76,6 +76,6 @@ bitflags! { /// /// For `seal_delegate_call` should be always unset, otherwise /// [`Error::InvalidCallFlags`] is returned. - const STATIC_CALL = 0b0001_0000; + const READ_ONLY = 0b0001_0000; } } From 161d4ac6d98e06eadb338e7cd052e29b531c5648 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 8 May 2024 17:02:23 +0200 Subject: [PATCH 03/29] Unit test added --- substrate/frame/contracts/src/exec.rs | 47 +++++++++++++++++++++- substrate/frame/contracts/uapi/src/host.rs | 2 +- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index c37b2e0a993b..9fcf2b44181f 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -1183,7 +1183,7 @@ where /// Iterator over all frames. /// /// The iterator starts with the top frame and ends with the root frame. - fn frames(&self) -> impl DoubleEndedIterator> { + fn frames(&self) -> impl Iterator> { sp_std::iter::once(&self.first_frame).chain(&self.frames).rev() } @@ -1272,7 +1272,6 @@ where gas_limit, deposit_limit, )?; - self.run(executable, input_data) }; @@ -3243,6 +3242,50 @@ mod tests { }); } + #[test] + fn read_only_subsequent_call_with_set_storage_fails() { + // Checks if the read only flag is kept for subsequent calls. + let code_bob = MockLoader::insert(Call, |ctx, _| { + if ctx.input_data[0] == 0 { + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) + } else { + ctx.ext.set_storage(&Key::Fix([1; 32]), Some(vec![1, 2, 3]), false)?; + exec_success() + } + }); + + let code_charlie = MockLoader::insert(Call, |ctx, _| { + ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) + }); + + ExtBuilder::default().build().execute_with(|| { + let schedule = ::Schedule::get(); + place_contract(&BOB, code_bob); + place_contract(&CHARLIE, code_charlie); + let contract_origin = Origin::from_account_id(ALICE); + let mut storage_meter = + storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); + + // If BOB calls CHARLIE with the read-only flag, CHARLIE cannot modify the storage, causing set_storage to fail. + assert_err!( + MockStack::run_call( + contract_origin, + BOB, + &mut GasMeter::::new(GAS_LIMIT), + &mut storage_meter, + &schedule, + 0, + vec![0], + None, + Determinism::Enforced + ) + .map_err(|e| e.error), + >::StateChangeDenied, + ); + }); + } + #[test] fn call_runtime_works() { let code_hash = MockLoader::insert(Call, |ctx, _| { diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index b217d609fa88..9b964c5c88e0 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -125,7 +125,7 @@ pub trait HostFn { /// Make a call to another contract. /// /// This is equivalent to calling the newer version of this function with - /// `flags` set to [`CallFlags::ALLOW_REENTRY CallFlags::ALLOW_STATE_CHANGE`]. See the newer version for documentation. + /// `flags` set to [`CallFlags::ALLOW_REENTRY]. See the newer version for documentation. #[deprecated(note = "Deprecated, use newer version instead")] fn call( callee: &[u8], From a96a4aaa26c17bee6a34feda516b3ffeca7b4ec1 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 8 May 2024 22:16:31 +0200 Subject: [PATCH 04/29] Cleanup --- substrate/frame/contracts/src/exec.rs | 33 +++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 9fcf2b44181f..a2b5f61e3d5e 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -149,7 +149,7 @@ pub trait Ext: sealing::Sealed { value: BalanceOf, input_data: Vec, allows_reentry: bool, - allows_readonly: bool, + read_only: bool, ) -> Result; /// Execute code in the current frame. @@ -1010,11 +1010,13 @@ where let contract = frame.contract_info.as_contract(); frame.nested_storage.enforce_subcall_limit(contract)?; - let caller = self.caller(); - Contracts::::deposit_event( - vec![T::Hashing::hash_of(&caller), T::Hashing::hash_of(&account_id)], - Event::Called { caller: caller.clone(), contract: account_id.clone() }, - ); + if !frame.read_only { + let caller = self.caller(); + Contracts::::deposit_event( + vec![T::Hashing::hash_of(&caller), T::Hashing::hash_of(&account_id)], + Event::Called { caller: caller.clone(), contract: account_id.clone() }, + ); + } }, } @@ -1241,9 +1243,9 @@ where // is caught by it. self.top_frame_mut().allows_reentry = allows_reentry; - let frame_read_only = self.top_frame().read_only; // Enable read-only access if requested; cannot disable it if already set. - if read_only && !frame_read_only { + let set_frame_read_only = read_only && !self.top_frame().read_only; + if set_frame_read_only { self.top_frame_mut().read_only = read_only; } @@ -1281,8 +1283,10 @@ where // Protection is on a per call basis. self.top_frame_mut().allows_reentry = true; - // Revert to the previous setting. - self.top_frame_mut().read_only = frame_read_only; + if set_frame_read_only { + // Revert to the previous setting, if it was changed. + self.top_frame_mut().read_only = false; + } result } @@ -3171,7 +3175,7 @@ mod tests { let mut storage_meter = storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); - // BOB calls CHARLIE with read only flag and zero value + // BOB calls CHARLIE with read-only flag and zero value assert_ok!(MockStack::run_call( contract_origin.clone(), BOB, @@ -3184,7 +3188,7 @@ mod tests { Determinism::Enforced )); - // BOB calls CHARLIE with read only flag and non zero value + // BOB calls CHARLIE with read-only flag and non zero value assert_err!( MockStack::run_call( contract_origin, @@ -3244,7 +3248,7 @@ mod tests { #[test] fn read_only_subsequent_call_with_set_storage_fails() { - // Checks if the read only flag is kept for subsequent calls. + // Checks if the read-only flag is kept for subsequent calls. let code_bob = MockLoader::insert(Call, |ctx, _| { if ctx.input_data[0] == 0 { ctx.ext @@ -3267,7 +3271,8 @@ mod tests { let mut storage_meter = storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); - // If BOB calls CHARLIE with the read-only flag, CHARLIE cannot modify the storage, causing set_storage to fail. + // If BOB calls CHARLIE with the read-only flag, and CHARLIE calls back BOB, + // BOB cannot modify the storage, causing set_storage to fail. assert_err!( MockStack::run_call( contract_origin, From ae1151e594147586265f2d3d7128e5498ff6bc4a Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 8 May 2024 22:18:52 +0200 Subject: [PATCH 05/29] Fmt --- substrate/frame/contracts/src/exec.rs | 106 ++++++++++++++-------- substrate/frame/contracts/src/wasm/mod.rs | 52 ++++++++--- 2 files changed, 106 insertions(+), 52 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index a2b5f61e3d5e..cca70f179d45 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -349,10 +349,7 @@ pub trait Ext: sealing::Sealed { /// - [`Error::::MaxDelegateDependenciesReached`] /// - [`Error::::CannotAddSelfAsDelegateDependency`] /// - [`Error::::DelegateDependencyAlreadyExists`] - fn lock_delegate_dependency( - &mut self, - code_hash: CodeHash, - ) -> DispatchResult; + fn lock_delegate_dependency(&mut self, code_hash: CodeHash) -> DispatchResult; /// Removes a delegate dependency from [`ContractInfo`]'s `delegate_dependencies` field. /// @@ -362,10 +359,7 @@ pub trait Ext: sealing::Sealed { /// # Errors /// /// - [`Error::::DelegateDependencyNotFound`] - fn unlock_delegate_dependency( - &mut self, - code_hash: &CodeHash, - ) -> DispatchResult; + fn unlock_delegate_dependency(&mut self, code_hash: &CodeHash) -> DispatchResult; } /// Describes the different functions that can be exported by an [`Executable`]. @@ -779,7 +773,7 @@ where storage_meter, BalanceOf::::zero(), determinism, - false + false, )?; let stack = Self { @@ -911,7 +905,7 @@ where nested_storage, deposit_limit, self.determinism, - read_only + read_only, )?; self.frames.push(frame); Ok(executable) @@ -1242,7 +1236,7 @@ where // It is important to do this before calling `allows_reentry` so that a direct recursion // is caught by it. self.top_frame_mut().allows_reentry = allows_reentry; - + // Enable read-only access if requested; cannot disable it if already set. let set_frame_read_only = read_only && !self.top_frame().read_only; if set_frame_read_only { @@ -1621,10 +1615,7 @@ where }); } - fn lock_delegate_dependency( - &mut self, - code_hash: CodeHash, - ) -> DispatchResult { + fn lock_delegate_dependency(&mut self, code_hash: CodeHash) -> DispatchResult { self.allows_state_change()?; let frame = self.top_frame_mut(); let info = frame.contract_info.get(&frame.account_id); @@ -1641,10 +1632,7 @@ where Ok(()) } - fn unlock_delegate_dependency( - &mut self, - code_hash: &CodeHash, - ) -> DispatchResult { + fn unlock_delegate_dependency(&mut self, code_hash: &CodeHash) -> DispatchResult { self.allows_state_change()?; let frame = self.top_frame_mut(); let info = frame.contract_info.get(&frame.account_id); @@ -2167,7 +2155,9 @@ mod tests { let value = Default::default(); let recurse_ch = MockLoader::insert(Call, |ctx, _| { // Try to call into yourself. - let r = ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![], true, true); + let r = + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![], true, true); ReachedBottom::mutate(|reached_bottom| { if !*reached_bottom { @@ -2226,8 +2216,15 @@ mod tests { // Call into CHARLIE contract. assert_matches!( - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true), + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + true, + true + ), Ok(_) ); exec_success() @@ -2507,8 +2504,15 @@ mod tests { // Call into charlie contract. assert_matches!( - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true), + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + true, + true + ), Ok(_) ); exec_success() @@ -3071,7 +3075,8 @@ mod tests { // call the contract passed as input with disabled reentry let code_bob = MockLoader::insert(Call, |ctx, _| { let dest = Decode::decode(&mut ctx.input_data.as_ref()).unwrap(); - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), dest, 0, vec![], false, false) + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), dest, 0, vec![], false, false) }); let code_charlie = MockLoader::insert(Call, |_, _| exec_success()); @@ -3120,8 +3125,15 @@ mod tests { fn call_deny_reentry() { let code_bob = MockLoader::insert(Call, |ctx, _| { if ctx.input_data[0] == 0 { - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], false, false) + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + false, + false, + ) } else { exec_success() } @@ -3129,7 +3141,8 @@ mod tests { // call BOB with input set to '1' let code_charlie = MockLoader::insert(Call, |ctx, _| { - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) }); ExtBuilder::default().build().execute_with(|| { @@ -3162,7 +3175,15 @@ mod tests { #[test] fn read_only_call_with_non_zero_value_fails() { let code_bob = MockLoader::insert(Call, |ctx, _| { - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), CHARLIE, ctx.input_data[0] as u64, vec![], true, true) + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + ctx.input_data[0] as u64, + vec![], + true, + true, + ) }); let code_charlie = MockLoader::insert(Call, |_, _| exec_success()); @@ -3210,8 +3231,8 @@ mod tests { #[test] fn read_only_call_with_set_storage_fails() { let code_bob = MockLoader::insert(Call, |ctx, _| { - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) }); let code_charlie = MockLoader::insert(Call, |ctx, _| { @@ -3227,7 +3248,8 @@ mod tests { let mut storage_meter = storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); - // If BOB calls CHARLIE with the read-only flag, CHARLIE cannot modify the storage, causing set_storage to fail. + // If BOB calls CHARLIE with the read-only flag, CHARLIE cannot modify the storage, + // causing set_storage to fail. assert_err!( MockStack::run_call( contract_origin, @@ -3244,15 +3266,22 @@ mod tests { >::StateChangeDenied, ); }); - } + } #[test] fn read_only_subsequent_call_with_set_storage_fails() { // Checks if the read-only flag is kept for subsequent calls. let code_bob = MockLoader::insert(Call, |ctx, _| { if ctx.input_data[0] == 0 { - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + true, + true, + ) } else { ctx.ext.set_storage(&Key::Fix([1; 32]), Some(vec![1, 2, 3]), false)?; exec_success() @@ -3260,7 +3289,8 @@ mod tests { }); let code_charlie = MockLoader::insert(Call, |ctx, _| { - ctx.ext.call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) }); ExtBuilder::default().build().execute_with(|| { @@ -3271,7 +3301,7 @@ mod tests { let mut storage_meter = storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); - // If BOB calls CHARLIE with the read-only flag, and CHARLIE calls back BOB, + // If BOB calls CHARLIE with the read-only flag, and CHARLIE calls back BOB, // BOB cannot modify the storage, causing set_storage to fail. assert_err!( MockStack::run_call( @@ -3289,7 +3319,7 @@ mod tests { >::StateChangeDenied, ); }); - } + } #[test] fn call_runtime_works() { diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 2229bc754a2f..400099530ed7 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -544,7 +544,7 @@ mod tests { value: u64, data: Vec, allows_reentry: bool, - read_only: bool + read_only: bool, } #[derive(Debug, PartialEq, Eq)] @@ -792,17 +792,11 @@ mod tests { Ok(()) } fn decrement_refcount(_code_hash: CodeHash) {} - fn lock_delegate_dependency( - &mut self, - code: CodeHash, - ) -> DispatchResult { + fn lock_delegate_dependency(&mut self, code: CodeHash) -> DispatchResult { self.delegate_dependencies.borrow_mut().insert(code); Ok(()) } - fn unlock_delegate_dependency( - &mut self, - code: &CodeHash, - ) -> DispatchResult { + fn unlock_delegate_dependency(&mut self, code: &CodeHash) -> DispatchResult { self.delegate_dependencies.borrow_mut().remove(code); Ok(()) } @@ -987,7 +981,13 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true, read_only: false }] + &[CallEntry { + to: ALICE, + value: 6, + data: vec![1, 2, 3, 4], + allows_reentry: true, + read_only: false + }] ); } @@ -1084,7 +1084,13 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false, read_only: false }] + &[CallEntry { + to: ALICE, + value: 0x2a, + data: input, + allows_reentry: false, + read_only: false + }] ); } @@ -1139,7 +1145,13 @@ mod tests { assert_eq!(result.data, input); assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: true, read_only: false }] + &[CallEntry { + to: ALICE, + value: 0x2a, + data: input, + allows_reentry: true, + read_only: false + }] ); } @@ -1186,7 +1198,13 @@ mod tests { assert_eq!(result.data, call_return_data()); assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 0x2a, data: input, allows_reentry: false, read_only: false }] + &[CallEntry { + to: ALICE, + value: 0x2a, + data: input, + allows_reentry: false, + read_only: false + }] ); } @@ -1427,7 +1445,13 @@ mod tests { assert_eq!( &mock_ext.calls, - &[CallEntry { to: ALICE, value: 6, data: vec![1, 2, 3, 4], allows_reentry: true, read_only: false }] + &[CallEntry { + to: ALICE, + value: 6, + data: vec![1, 2, 3, 4], + allows_reentry: true, + read_only: false + }] ); } From 41d753e739fa226029e4700cb632b87ecf076402 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 8 May 2024 23:56:05 +0200 Subject: [PATCH 06/29] Add prdoc --- prdoc/pr_4418.prdoc | 14 ++++++++++++++ substrate/frame/contracts/uapi/src/flags.rs | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 prdoc/pr_4418.prdoc diff --git a/prdoc/pr_4418.prdoc b/prdoc/pr_4418.prdoc new file mode 100644 index 000000000000..b4196761686d --- /dev/null +++ b/prdoc/pr_4418.prdoc @@ -0,0 +1,14 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: "[pallet_contracts] Add `READ_ONLY` flag to contract `call` function" + +doc: + - audience: Runtime User + description: | + This PR implements the `READ_ONLY` flag to be used as a `Callflag` in the contract `call` function. + The flag indicates that the callee is restricted from modifying the state during call execution. + It is equivalent to Ethereum's [STATICCALL](https://eips.ethereum.org/EIPS/eip-214). + +crates: + - name: pallet-contracts diff --git a/substrate/frame/contracts/uapi/src/flags.rs b/substrate/frame/contracts/uapi/src/flags.rs index 12d4c52ef77f..89c692a2a933 100644 --- a/substrate/frame/contracts/uapi/src/flags.rs +++ b/substrate/frame/contracts/uapi/src/flags.rs @@ -71,9 +71,9 @@ bitflags! { const ALLOW_REENTRY = 0b0000_1000; /// Indicates that the callee is restricted from modifying the state during call execution, /// equivalent to Ethereum's STATICCALL - /// + /// /// # Note - /// + /// /// For `seal_delegate_call` should be always unset, otherwise /// [`Error::InvalidCallFlags`] is returned. const READ_ONLY = 0b0001_0000; From 5278c7a3e966de0a999a52f348ca7a7e4c19fa43 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 9 May 2024 00:15:23 +0200 Subject: [PATCH 07/29] Fix prdoc --- prdoc/pr_4418.prdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/prdoc/pr_4418.prdoc b/prdoc/pr_4418.prdoc index b4196761686d..983bc790836c 100644 --- a/prdoc/pr_4418.prdoc +++ b/prdoc/pr_4418.prdoc @@ -12,3 +12,4 @@ doc: crates: - name: pallet-contracts + bump: minor From 15fca3cb6b2ced5144d99f1b7ce6b47da6cd4992 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 9 May 2024 10:23:16 +0200 Subject: [PATCH 08/29] Update description --- substrate/frame/contracts/src/lib.rs | 3 ++- substrate/frame/contracts/uapi/src/host.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index e9528e4ae00b..b3d945cecbd1 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -1202,7 +1202,8 @@ pub mod pallet { /// into `pallet-contracts`. This would make the whole pallet reentrant with regard to /// contract code execution which is not supported. ReentranceDenied, - /// A contract tried to invoke a call that disallows for state change. + /// A contract attempted to invoke a call that is flagged as read-only, and inside that + /// call, a state-changing call happened. StateChangeDenied, /// Origin doesn't have enough balance to pay the required storage deposits. StorageDepositNotEnoughFunds, diff --git a/substrate/frame/contracts/uapi/src/host.rs b/substrate/frame/contracts/uapi/src/host.rs index 9b964c5c88e0..92065eda5d63 100644 --- a/substrate/frame/contracts/uapi/src/host.rs +++ b/substrate/frame/contracts/uapi/src/host.rs @@ -125,7 +125,7 @@ pub trait HostFn { /// Make a call to another contract. /// /// This is equivalent to calling the newer version of this function with - /// `flags` set to [`CallFlags::ALLOW_REENTRY]. See the newer version for documentation. + /// `flags` set to [`CallFlags::ALLOW_REENTRY`]. See the newer version for documentation. #[deprecated(note = "Deprecated, use newer version instead")] fn call( callee: &[u8], From 71692141245c37f1bc5183777cd31b9a51e81592 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 9 May 2024 10:57:33 +0200 Subject: [PATCH 09/29] Update prdoc --- prdoc/pr_4418.prdoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prdoc/pr_4418.prdoc b/prdoc/pr_4418.prdoc index 983bc790836c..95ef3111e745 100644 --- a/prdoc/pr_4418.prdoc +++ b/prdoc/pr_4418.prdoc @@ -13,3 +13,5 @@ doc: crates: - name: pallet-contracts bump: minor + - name: pallet-contracts-uapi + bump: minor From cfd419885a5fbe6c5093fed4364d1cf76b0da9e0 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 9 May 2024 12:54:06 +0200 Subject: [PATCH 10/29] Add read-only protection to call_runtime --- substrate/frame/contracts/src/exec.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index cca70f179d45..506ed34caef2 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -346,9 +346,10 @@ pub trait Ext: sealing::Sealed { /// /// # Errors /// - /// - [`Error::::MaxDelegateDependenciesReached`] - /// - [`Error::::CannotAddSelfAsDelegateDependency`] - /// - [`Error::::DelegateDependencyAlreadyExists`] + /// - [`Error::MaxDelegateDependenciesReached`] + /// - [`Error::CannotAddSelfAsDelegateDependency`] + /// - [`Error::DelegateDependencyAlreadyExists`] + /// - [`Error::StateChangeDenied`] fn lock_delegate_dependency(&mut self, code_hash: CodeHash) -> DispatchResult; /// Removes a delegate dependency from [`ContractInfo`]'s `delegate_dependencies` field. @@ -358,7 +359,8 @@ pub trait Ext: sealing::Sealed { /// /// # Errors /// - /// - [`Error::::DelegateDependencyNotFound`] + /// - [`Error::DelegateDependencyNotFound`] + /// - [`Error::StateChangeDenied`] fn unlock_delegate_dependency(&mut self, code_hash: &CodeHash) -> DispatchResult; } @@ -1515,6 +1517,7 @@ where } fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo { + self.allows_state_change()?; let mut origin: T::RuntimeOrigin = RawOrigin::Signed(self.address().clone()).into(); origin.add_filter(T::CallFilter::contains); call.dispatch(origin) From 0a708a06821ea18105626f89f75d8e26c6506be2 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Thu, 9 May 2024 20:21:44 +0000 Subject: [PATCH 11/29] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 1224 +++++++++++----------- 1 file changed, 610 insertions(+), 614 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index b95b1d1a9a2e..e02ddb631196 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/frame/contracts/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for `pallet_contracts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-05-09, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-anb7yjbi-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `runner-unxyhko3-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: @@ -143,8 +143,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_149_000 picoseconds. - Weight::from_parts(2_274_000, 1627) + // Minimum execution time: 2_070_000 picoseconds. + Weight::from_parts(2_191_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -154,10 +154,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 12_863_000 picoseconds. - Weight::from_parts(13_188_000, 442) - // Standard Error: 1_053 - .saturating_add(Weight::from_parts(1_105_325, 0).saturating_mul(k.into())) + // Minimum execution time: 12_518_000 picoseconds. + Weight::from_parts(12_838_000, 442) + // Standard Error: 948 + .saturating_add(Weight::from_parts(1_080_417, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -171,10 +171,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 8_432_000 picoseconds. - Weight::from_parts(9_203_290, 6149) + // Minimum execution time: 8_403_000 picoseconds. + Weight::from_parts(8_908_050, 6149) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_186, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_161, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -187,8 +187,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 17_177_000 picoseconds. - Weight::from_parts(17_663_000, 6450) + // Minimum execution time: 17_078_000 picoseconds. + Weight::from_parts(18_111_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -201,10 +201,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_636_000 picoseconds. - Weight::from_parts(3_774_000, 3635) - // Standard Error: 542 - .saturating_add(Weight::from_parts(1_260_058, 0).saturating_mul(k.into())) + // Minimum execution time: 3_483_000 picoseconds. + Weight::from_parts(3_620_000, 3635) + // Standard Error: 1_511 + .saturating_add(Weight::from_parts(1_223_614, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -225,10 +225,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `328 + c * (1 ±0)` // Estimated: `6266 + c * (1 ±0)` - // Minimum execution time: 21_585_000 picoseconds. - Weight::from_parts(22_069_944, 6266) - // Standard Error: 1 - .saturating_add(Weight::from_parts(404, 0).saturating_mul(c.into())) + // Minimum execution time: 20_594_000 picoseconds. + Weight::from_parts(21_309_501, 6266) + // Standard Error: 0 + .saturating_add(Weight::from_parts(367, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -239,8 +239,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 13_283_000 picoseconds. - Weight::from_parts(14_015_000, 6380) + // Minimum execution time: 13_250_000 picoseconds. + Weight::from_parts(13_583_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -254,8 +254,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 48_022_000 picoseconds. - Weight::from_parts(49_627_000, 6292) + // Minimum execution time: 47_552_000 picoseconds. + Weight::from_parts(48_386_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -267,8 +267,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 58_374_000 picoseconds. - Weight::from_parts(59_615_000, 6534) + // Minimum execution time: 56_232_000 picoseconds. + Weight::from_parts(58_841_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -278,8 +278,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 12_559_000 picoseconds. - Weight::from_parts(12_947_000, 6349) + // Minimum execution time: 12_268_000 picoseconds. + Weight::from_parts(12_887_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -289,8 +289,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_480_000 picoseconds. - Weight::from_parts(2_680_000, 1627) + // Minimum execution time: 2_516_000 picoseconds. + Weight::from_parts(2_587_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -302,8 +302,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 12_625_000 picoseconds. - Weight::from_parts(13_094_000, 3631) + // Minimum execution time: 12_297_000 picoseconds. + Weight::from_parts(12_668_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -313,8 +313,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_836_000 picoseconds. - Weight::from_parts(5_182_000, 3607) + // Minimum execution time: 4_833_000 picoseconds. + Weight::from_parts(5_041_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -325,8 +325,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 6_319_000 picoseconds. - Weight::from_parts(6_582_000, 3632) + // Minimum execution time: 6_148_000 picoseconds. + Weight::from_parts(6_463_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -337,8 +337,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 6_532_000 picoseconds. - Weight::from_parts(6_909_000, 3607) + // Minimum execution time: 6_322_000 picoseconds. + Weight::from_parts(6_575_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -363,10 +363,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `804 + c * (1 ±0)` // Estimated: `9217 + c * (1 ±0)` - // Minimum execution time: 305_778_000 picoseconds. - Weight::from_parts(282_321_249, 9217) - // Standard Error: 72 - .saturating_add(Weight::from_parts(33_456, 0).saturating_mul(c.into())) + // Minimum execution time: 309_862_000 picoseconds. + Weight::from_parts(290_506_612, 9217) + // Standard Error: 68 + .saturating_add(Weight::from_parts(32_911, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -398,14 +398,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `326` // Estimated: `8740` - // Minimum execution time: 3_810_809_000 picoseconds. - Weight::from_parts(739_511_598, 8740) - // Standard Error: 140 - .saturating_add(Weight::from_parts(67_574, 0).saturating_mul(c.into())) - // Standard Error: 16 - .saturating_add(Weight::from_parts(1_488, 0).saturating_mul(i.into())) - // Standard Error: 16 - .saturating_add(Weight::from_parts(1_537, 0).saturating_mul(s.into())) + // Minimum execution time: 3_777_655_000 picoseconds. + Weight::from_parts(776_168_467, 8740) + // Standard Error: 129 + .saturating_add(Weight::from_parts(66_417, 0).saturating_mul(c.into())) + // Standard Error: 15 + .saturating_add(Weight::from_parts(1_439, 0).saturating_mul(i.into())) + // Standard Error: 15 + .saturating_add(Weight::from_parts(1_525, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -435,12 +435,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `563` // Estimated: `8982` - // Minimum execution time: 1_986_789_000 picoseconds. - Weight::from_parts(2_017_466_000, 8982) - // Standard Error: 26 - .saturating_add(Weight::from_parts(827, 0).saturating_mul(i.into())) - // Standard Error: 26 - .saturating_add(Weight::from_parts(781, 0).saturating_mul(s.into())) + // Minimum execution time: 1_973_557_000 picoseconds. + Weight::from_parts(2_002_671_000, 8982) + // Standard Error: 25 + .saturating_add(Weight::from_parts(817, 0).saturating_mul(i.into())) + // Standard Error: 25 + .saturating_add(Weight::from_parts(785, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -464,8 +464,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `829` // Estimated: `9244` - // Minimum execution time: 210_724_000 picoseconds. - Weight::from_parts(218_608_000, 9244) + // Minimum execution time: 207_934_000 picoseconds. + Weight::from_parts(216_665_000, 9244) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -486,10 +486,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `145` // Estimated: `6085` - // Minimum execution time: 271_259_000 picoseconds. - Weight::from_parts(298_852_854, 6085) - // Standard Error: 65 - .saturating_add(Weight::from_parts(33_547, 0).saturating_mul(c.into())) + // Minimum execution time: 276_059_000 picoseconds. + Weight::from_parts(309_969_864, 6085) + // Standard Error: 46 + .saturating_add(Weight::from_parts(32_566, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -510,10 +510,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `145` // Estimated: `6085` - // Minimum execution time: 278_167_000 picoseconds. - Weight::from_parts(311_888_941, 6085) - // Standard Error: 58 - .saturating_add(Weight::from_parts(33_595, 0).saturating_mul(c.into())) + // Minimum execution time: 300_492_000 picoseconds. + Weight::from_parts(315_131_183, 6085) + // Standard Error: 46 + .saturating_add(Weight::from_parts(32_844, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -531,8 +531,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 47_403_000 picoseconds. - Weight::from_parts(48_707_000, 3780) + // Minimum execution time: 44_644_000 picoseconds. + Weight::from_parts(46_030_000, 3780) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -548,8 +548,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `8967` - // Minimum execution time: 35_361_000 picoseconds. - Weight::from_parts(36_714_000, 8967) + // Minimum execution time: 34_528_000 picoseconds. + Weight::from_parts(36_025_000, 8967) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -558,10 +558,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_340_000 picoseconds. - Weight::from_parts(9_360_237, 0) - // Standard Error: 269 - .saturating_add(Weight::from_parts(249_611, 0).saturating_mul(r.into())) + // Minimum execution time: 9_371_000 picoseconds. + Weight::from_parts(10_291_757, 0) + // Standard Error: 206 + .saturating_add(Weight::from_parts(250_772, 0).saturating_mul(r.into())) } /// Storage: `Contracts::ContractInfoOf` (r:1600 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -570,10 +570,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `509 + r * (77 ±0)` // Estimated: `1467 + r * (2552 ±0)` - // Minimum execution time: 9_059_000 picoseconds. - Weight::from_parts(9_201_000, 1467) - // Standard Error: 5_643 - .saturating_add(Weight::from_parts(3_343_859, 0).saturating_mul(r.into())) + // Minimum execution time: 9_429_000 picoseconds. + Weight::from_parts(9_590_000, 1467) + // Standard Error: 5_538 + .saturating_add(Weight::from_parts(3_353_897, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2552).saturating_mul(r.into())) } @@ -584,10 +584,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `517 + r * (170 ±0)` // Estimated: `1468 + r * (2645 ±0)` - // Minimum execution time: 9_220_000 picoseconds. - Weight::from_parts(9_399_000, 1468) - // Standard Error: 6_194 - .saturating_add(Weight::from_parts(4_172_011, 0).saturating_mul(r.into())) + // Minimum execution time: 9_430_000 picoseconds. + Weight::from_parts(9_601_000, 1468) + // Standard Error: 5_410 + .saturating_add(Weight::from_parts(4_150_336, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2645).saturating_mul(r.into())) } @@ -596,50 +596,50 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_707_000 picoseconds. - Weight::from_parts(10_100_456, 0) - // Standard Error: 234 - .saturating_add(Weight::from_parts(338_464, 0).saturating_mul(r.into())) + // Minimum execution time: 9_559_000 picoseconds. + Weight::from_parts(9_922_167, 0) + // Standard Error: 195 + .saturating_add(Weight::from_parts(357_039, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_caller_is_origin(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_524_000 picoseconds. - Weight::from_parts(10_813_389, 0) - // Standard Error: 76 - .saturating_add(Weight::from_parts(102_535, 0).saturating_mul(r.into())) + // Minimum execution time: 9_520_000 picoseconds. + Weight::from_parts(10_811_836, 0) + // Standard Error: 85 + .saturating_add(Weight::from_parts(98_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_caller_is_root(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_799_000 picoseconds. - Weight::from_parts(10_886_744, 0) - // Standard Error: 75 - .saturating_add(Weight::from_parts(80_901, 0).saturating_mul(r.into())) + // Minimum execution time: 9_383_000 picoseconds. + Weight::from_parts(10_367_343, 0) + // Standard Error: 96 + .saturating_add(Weight::from_parts(80_662, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_address(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_895_000 picoseconds. - Weight::from_parts(10_658_338, 0) - // Standard Error: 189 - .saturating_add(Weight::from_parts(249_694, 0).saturating_mul(r.into())) + // Minimum execution time: 9_697_000 picoseconds. + Weight::from_parts(10_011_008, 0) + // Standard Error: 195 + .saturating_add(Weight::from_parts(254_807, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_gas_left(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_643_000 picoseconds. - Weight::from_parts(10_932_126, 0) - // Standard Error: 153 - .saturating_add(Weight::from_parts(280_924, 0).saturating_mul(r.into())) + // Minimum execution time: 9_618_000 picoseconds. + Weight::from_parts(12_017_883, 0) + // Standard Error: 260 + .saturating_add(Weight::from_parts(288_461, 0).saturating_mul(r.into())) } /// Storage: `System::Account` (r:1 w:0) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) @@ -648,10 +648,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `3599` - // Minimum execution time: 9_548_000 picoseconds. - Weight::from_parts(9_737_000, 3599) - // Standard Error: 971 - .saturating_add(Weight::from_parts(1_704_134, 0).saturating_mul(r.into())) + // Minimum execution time: 9_655_000 picoseconds. + Weight::from_parts(35_284_593, 3599) + // Standard Error: 1_467 + .saturating_add(Weight::from_parts(1_538_337, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 1600]`. @@ -659,40 +659,40 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_172_000 picoseconds. - Weight::from_parts(18_255_933, 0) - // Standard Error: 540 - .saturating_add(Weight::from_parts(230_929, 0).saturating_mul(r.into())) + // Minimum execution time: 9_677_000 picoseconds. + Weight::from_parts(10_863_201, 0) + // Standard Error: 275 + .saturating_add(Weight::from_parts(256_433, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_minimum_balance(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_232_000 picoseconds. - Weight::from_parts(9_796_584, 0) - // Standard Error: 208 - .saturating_add(Weight::from_parts(239_962, 0).saturating_mul(r.into())) + // Minimum execution time: 9_345_000 picoseconds. + Weight::from_parts(10_054_215, 0) + // Standard Error: 183 + .saturating_add(Weight::from_parts(249_128, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_block_number(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_747_000 picoseconds. - Weight::from_parts(8_733_230, 0) - // Standard Error: 377 - .saturating_add(Weight::from_parts(253_801, 0).saturating_mul(r.into())) + // Minimum execution time: 9_577_000 picoseconds. + Weight::from_parts(10_983_713, 0) + // Standard Error: 154 + .saturating_add(Weight::from_parts(242_312, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_now(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_214_000 picoseconds. - Weight::from_parts(10_194_153, 0) - // Standard Error: 516 - .saturating_add(Weight::from_parts(247_621, 0).saturating_mul(r.into())) + // Minimum execution time: 9_484_000 picoseconds. + Weight::from_parts(9_694_713, 0) + // Standard Error: 284 + .saturating_add(Weight::from_parts(249_892, 0).saturating_mul(r.into())) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -701,10 +701,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 9_022_000 picoseconds. - Weight::from_parts(22_051_160, 1552) - // Standard Error: 697 - .saturating_add(Weight::from_parts(709_612, 0).saturating_mul(r.into())) + // Minimum execution time: 9_445_000 picoseconds. + Weight::from_parts(24_701_331, 1552) + // Standard Error: 677 + .saturating_add(Weight::from_parts(661_177, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 1600]`. @@ -712,10 +712,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_135_000 picoseconds. - Weight::from_parts(10_646_215, 0) - // Standard Error: 161 - .saturating_add(Weight::from_parts(170_336, 0).saturating_mul(r.into())) + // Minimum execution time: 9_430_000 picoseconds. + Weight::from_parts(10_848_005, 0) + // Standard Error: 213 + .saturating_add(Weight::from_parts(171_409, 0).saturating_mul(r.into())) } /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) @@ -738,10 +738,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `872` // Estimated: `9287` - // Minimum execution time: 273_896_000 picoseconds. - Weight::from_parts(148_309_654, 9287) - // Standard Error: 16 - .saturating_add(Weight::from_parts(1_355, 0).saturating_mul(n.into())) + // Minimum execution time: 282_529_000 picoseconds. + Weight::from_parts(143_922_825, 9287) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_362, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -750,20 +750,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_906_000 picoseconds. - Weight::from_parts(9_264_446, 0) - // Standard Error: 19_760 - .saturating_add(Weight::from_parts(1_256_053, 0).saturating_mul(r.into())) + // Minimum execution time: 8_990_000 picoseconds. + Weight::from_parts(9_516_528, 0) + // Standard Error: 23_657 + .saturating_add(Weight::from_parts(1_516_571, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_return_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_266_000 picoseconds. - Weight::from_parts(10_602_261, 0) + // Minimum execution time: 10_634_000 picoseconds. + Weight::from_parts(11_032_475, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(318, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(316, 0).saturating_mul(n.into())) } /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) @@ -792,10 +792,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `4805 + r * (2121 ±0)` // Estimated: `13220 + r * (81321 ±0)` - // Minimum execution time: 295_922_000 picoseconds. - Weight::from_parts(322_472_877, 13220) - // Standard Error: 993_812 - .saturating_add(Weight::from_parts(259_075_422, 0).saturating_mul(r.into())) + // Minimum execution time: 297_889_000 picoseconds. + Weight::from_parts(323_493_293, 13220) + // Standard Error: 956_375 + .saturating_add(Weight::from_parts(244_100_306, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().reads((36_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -809,10 +809,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 9_427_000 picoseconds. - Weight::from_parts(12_996_213, 1561) - // Standard Error: 845 - .saturating_add(Weight::from_parts(1_182_642, 0).saturating_mul(r.into())) + // Minimum execution time: 9_707_000 picoseconds. + Weight::from_parts(17_781_513, 1561) + // Standard Error: 617 + .saturating_add(Weight::from_parts(1_112_754, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 1600]`. @@ -820,10 +820,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_304_000 picoseconds. - Weight::from_parts(25_678_842, 0) - // Standard Error: 1_855 - .saturating_add(Weight::from_parts(1_814_511, 0).saturating_mul(r.into())) + // Minimum execution time: 9_316_000 picoseconds. + Weight::from_parts(19_371_063, 0) + // Standard Error: 832 + .saturating_add(Weight::from_parts(1_670_527, 0).saturating_mul(r.into())) } /// Storage: `System::EventTopics` (r:4 w:4) /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -833,12 +833,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 23_425_000 picoseconds. - Weight::from_parts(15_229_010, 990) - // Standard Error: 14_380 - .saturating_add(Weight::from_parts(2_545_653, 0).saturating_mul(t.into())) - // Standard Error: 4 - .saturating_add(Weight::from_parts(594, 0).saturating_mul(n.into())) + // Minimum execution time: 24_006_000 picoseconds. + Weight::from_parts(15_581_150, 990) + // Standard Error: 12_434 + .saturating_add(Weight::from_parts(2_414_541, 0).saturating_mul(t.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(610, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -848,20 +848,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_117_000 picoseconds. - Weight::from_parts(12_887_533, 0) - // Standard Error: 83 - .saturating_add(Weight::from_parts(99_373, 0).saturating_mul(r.into())) + // Minimum execution time: 9_004_000 picoseconds. + Weight::from_parts(9_859_329, 0) + // Standard Error: 94 + .saturating_add(Weight::from_parts(101_511, 0).saturating_mul(r.into())) } /// The range of component `i` is `[0, 1048576]`. fn seal_debug_message_per_byte(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_982_000 picoseconds. - Weight::from_parts(11_176_000, 0) + // Minimum execution time: 10_655_000 picoseconds. + Weight::from_parts(10_995_000, 0) // Standard Error: 8 - .saturating_add(Weight::from_parts(983, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(977, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -870,10 +870,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_150_000 picoseconds. - Weight::from_parts(9_269_000, 105) - // Standard Error: 8_147 - .saturating_add(Weight::from_parts(5_339_554, 0).saturating_mul(r.into())) + // Minimum execution time: 9_519_000 picoseconds. + Weight::from_parts(9_603_000, 105) + // Standard Error: 8_299 + .saturating_add(Weight::from_parts(5_137_313, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) @@ -885,10 +885,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `245` // Estimated: `245` - // Minimum execution time: 19_085_000 picoseconds. - Weight::from_parts(20_007_323, 245) - // Standard Error: 3 - .saturating_add(Weight::from_parts(291, 0).saturating_mul(n.into())) + // Minimum execution time: 19_317_000 picoseconds. + Weight::from_parts(19_967_876, 245) + // Standard Error: 2 + .saturating_add(Weight::from_parts(280, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -899,10 +899,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 19_127_000 picoseconds. - Weight::from_parts(21_152_987, 248) - // Standard Error: 3 - .saturating_add(Weight::from_parts(42, 0).saturating_mul(n.into())) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_538_959, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(62, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -914,10 +914,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_264_000 picoseconds. - Weight::from_parts(9_449_000, 105) - // Standard Error: 8_196 - .saturating_add(Weight::from_parts(5_325_578, 0).saturating_mul(r.into())) + // Minimum execution time: 9_485_000 picoseconds. + Weight::from_parts(9_591_000, 105) + // Standard Error: 8_372 + .saturating_add(Weight::from_parts(5_165_811, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) @@ -929,10 +929,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 18_489_000 picoseconds. - Weight::from_parts(19_916_153, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(97, 0).saturating_mul(n.into())) + // Minimum execution time: 19_064_000 picoseconds. + Weight::from_parts(20_735_793, 248) + // Standard Error: 3 + .saturating_add(Weight::from_parts(53, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -944,10 +944,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_299_000 picoseconds. - Weight::from_parts(9_464_000, 105) - // Standard Error: 6_827 - .saturating_add(Weight::from_parts(4_720_699, 0).saturating_mul(r.into())) + // Minimum execution time: 9_709_000 picoseconds. + Weight::from_parts(9_894_000, 105) + // Standard Error: 6_982 + .saturating_add(Weight::from_parts(4_533_141, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) } @@ -958,10 +958,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 17_981_000 picoseconds. - Weight::from_parts(19_802_353, 248) + // Minimum execution time: 18_024_000 picoseconds. + Weight::from_parts(19_612_635, 248) // Standard Error: 3 - .saturating_add(Weight::from_parts(617, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(610, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -972,10 +972,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_891_000 picoseconds. - Weight::from_parts(10_046_000, 105) - // Standard Error: 6_993 - .saturating_add(Weight::from_parts(4_601_167, 0).saturating_mul(r.into())) + // Minimum execution time: 9_618_000 picoseconds. + Weight::from_parts(9_820_000, 105) + // Standard Error: 6_968 + .saturating_add(Weight::from_parts(4_400_926, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) } @@ -986,10 +986,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 17_229_000 picoseconds. - Weight::from_parts(18_302_733, 248) + // Minimum execution time: 17_339_000 picoseconds. + Weight::from_parts(18_524_914, 248) // Standard Error: 2 - .saturating_add(Weight::from_parts(112, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(84, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1000,10 +1000,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_323_000 picoseconds. - Weight::from_parts(9_462_000, 105) - // Standard Error: 8_031 - .saturating_add(Weight::from_parts(5_433_981, 0).saturating_mul(r.into())) + // Minimum execution time: 9_337_000 picoseconds. + Weight::from_parts(9_645_000, 105) + // Standard Error: 8_140 + .saturating_add(Weight::from_parts(5_231_703, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) @@ -1015,10 +1015,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 18_711_000 picoseconds. - Weight::from_parts(20_495_670, 248) + // Minimum execution time: 18_882_000 picoseconds. + Weight::from_parts(20_628_746, 248) // Standard Error: 3 - .saturating_add(Weight::from_parts(640, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(618, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1030,10 +1030,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `770` // Estimated: `4221 + r * (2475 ±0)` - // Minimum execution time: 9_226_000 picoseconds. - Weight::from_parts(9_394_000, 4221) - // Standard Error: 14_741 - .saturating_add(Weight::from_parts(34_179_316, 0).saturating_mul(r.into())) + // Minimum execution time: 9_334_000 picoseconds. + Weight::from_parts(9_525_000, 4221) + // Standard Error: 17_887 + .saturating_add(Weight::from_parts(33_343_504, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -1055,10 +1055,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `520 + r * (170 ±0)` // Estimated: `6463 + r * (2646 ±0)` - // Minimum execution time: 9_455_000 picoseconds. - Weight::from_parts(9_671_000, 6463) - // Standard Error: 126_080 - .saturating_add(Weight::from_parts(244_204_040, 0).saturating_mul(r.into())) + // Minimum execution time: 9_483_000 picoseconds. + Weight::from_parts(9_663_000, 6463) + // Standard Error: 110_354 + .saturating_add(Weight::from_parts(245_827_711, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -1080,10 +1080,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0 + r * (527 ±0)` // Estimated: `6447 + r * (2583 ±10)` - // Minimum execution time: 9_274_000 picoseconds. - Weight::from_parts(9_437_000, 6447) - // Standard Error: 150_832 - .saturating_add(Weight::from_parts(244_196_269, 0).saturating_mul(r.into())) + // Minimum execution time: 9_473_000 picoseconds. + Weight::from_parts(9_655_000, 6447) + // Standard Error: 130_607 + .saturating_add(Weight::from_parts(244_861_297, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2583).saturating_mul(r.into())) @@ -1106,12 +1106,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `699 + t * (277 ±0)` // Estimated: `6639 + t * (3458 ±0)` - // Minimum execution time: 214_483_000 picoseconds. - Weight::from_parts(122_634_366, 6639) - // Standard Error: 2_499_235 - .saturating_add(Weight::from_parts(41_326_008, 0).saturating_mul(t.into())) + // Minimum execution time: 216_689_000 picoseconds. + Weight::from_parts(130_041_795, 6639) + // Standard Error: 2_493_034 + .saturating_add(Weight::from_parts(38_826_681, 0).saturating_mul(t.into())) // Standard Error: 3 - .saturating_add(Weight::from_parts(422, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(418, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) @@ -1137,10 +1137,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1097 + r * (188 ±0)` // Estimated: `6990 + r * (2664 ±0)` - // Minimum execution time: 341_569_000 picoseconds. - Weight::from_parts(360_574_000, 6990) - // Standard Error: 259_746 - .saturating_add(Weight::from_parts(337_944_674, 0).saturating_mul(r.into())) + // Minimum execution time: 352_276_000 picoseconds. + Weight::from_parts(358_665_000, 6990) + // Standard Error: 214_243 + .saturating_add(Weight::from_parts(334_998_245, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) @@ -1168,14 +1168,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `760 + t * (104 ±0)` // Estimated: `6719 + t * (2549 ±1)` - // Minimum execution time: 1_863_119_000 picoseconds. - Weight::from_parts(900_189_174, 6719) - // Standard Error: 13_040_979 - .saturating_add(Weight::from_parts(4_056_063, 0).saturating_mul(t.into())) + // Minimum execution time: 1_873_663_000 picoseconds. + Weight::from_parts(928_999_031, 6719) // Standard Error: 20 - .saturating_add(Weight::from_parts(1_028, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_046, 0).saturating_mul(i.into())) // Standard Error: 20 - .saturating_add(Weight::from_parts(1_173, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_158, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(7_u64)) @@ -1187,78 +1185,78 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_211_000 picoseconds. - Weight::from_parts(11_696_412, 0) - // Standard Error: 388 - .saturating_add(Weight::from_parts(265_538, 0).saturating_mul(r.into())) + // Minimum execution time: 9_500_000 picoseconds. + Weight::from_parts(9_022_529, 0) + // Standard Error: 295 + .saturating_add(Weight::from_parts(270_989, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_sha2_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_296_000 picoseconds. - Weight::from_parts(572_494, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_067, 0).saturating_mul(n.into())) + // Minimum execution time: 10_743_000 picoseconds. + Weight::from_parts(10_950_000, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_061, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_177_000 picoseconds. - Weight::from_parts(8_620_481, 0) - // Standard Error: 249 - .saturating_add(Weight::from_parts(674_502, 0).saturating_mul(r.into())) + // Minimum execution time: 9_395_000 picoseconds. + Weight::from_parts(12_944_233, 0) + // Standard Error: 286 + .saturating_add(Weight::from_parts(664_044, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_240_000 picoseconds. - Weight::from_parts(8_696_186, 0) + // Minimum execution time: 11_300_000 picoseconds. + Weight::from_parts(6_919_359, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(3_328, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_337, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_889_000 picoseconds. - Weight::from_parts(16_103_170, 0) - // Standard Error: 343 - .saturating_add(Weight::from_parts(328_939, 0).saturating_mul(r.into())) + // Minimum execution time: 9_510_000 picoseconds. + Weight::from_parts(9_432_045, 0) + // Standard Error: 290 + .saturating_add(Weight::from_parts(335_344, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_405_000 picoseconds. - Weight::from_parts(2_264_024, 0) + // Minimum execution time: 11_067_000 picoseconds. + Weight::from_parts(3_082_553, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_196, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_199, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_215_000 picoseconds. - Weight::from_parts(10_505_632, 0) - // Standard Error: 240 - .saturating_add(Weight::from_parts(324_854, 0).saturating_mul(r.into())) + // Minimum execution time: 9_583_000 picoseconds. + Weight::from_parts(10_413_882, 0) + // Standard Error: 188 + .saturating_add(Weight::from_parts(330_398, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_440_000 picoseconds. - Weight::from_parts(2_575_889, 0) + // Minimum execution time: 10_740_000 picoseconds. + Weight::from_parts(938_375, 0) // Standard Error: 1 .saturating_add(Weight::from_parts(1_199, 0).saturating_mul(n.into())) } @@ -1267,40 +1265,40 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 55_119_000 picoseconds. - Weight::from_parts(56_732_248, 0) - // Standard Error: 8 - .saturating_add(Weight::from_parts(4_639, 0).saturating_mul(n.into())) + // Minimum execution time: 54_010_000 picoseconds. + Weight::from_parts(54_513_543, 0) + // Standard Error: 7 + .saturating_add(Weight::from_parts(4_681, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 160]`. fn seal_sr25519_verify(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_176_000 picoseconds. - Weight::from_parts(9_861_102, 0) - // Standard Error: 6_029 - .saturating_add(Weight::from_parts(45_948_571, 0).saturating_mul(r.into())) + // Minimum execution time: 9_456_000 picoseconds. + Weight::from_parts(21_224_326, 0) + // Standard Error: 5_864 + .saturating_add(Weight::from_parts(40_800_447, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 160]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_293_000 picoseconds. - Weight::from_parts(28_785_765, 0) - // Standard Error: 9_160 - .saturating_add(Weight::from_parts(45_566_150, 0).saturating_mul(r.into())) + // Minimum execution time: 9_476_000 picoseconds. + Weight::from_parts(23_619_641, 0) + // Standard Error: 7_475 + .saturating_add(Weight::from_parts(45_413_458, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 160]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_206_000 picoseconds. - Weight::from_parts(12_420_664, 0) - // Standard Error: 3_489 - .saturating_add(Weight::from_parts(11_628_989, 0).saturating_mul(r.into())) + // Minimum execution time: 9_437_000 picoseconds. + Weight::from_parts(11_960_409, 0) + // Standard Error: 3_234 + .saturating_add(Weight::from_parts(11_537_048, 0).saturating_mul(r.into())) } /// Storage: `Contracts::CodeInfoOf` (r:1536 w:1536) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1314,11 +1312,11 @@ impl WeightInfo for SubstrateWeight { fn seal_set_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + r * (926 ±0)` - // Estimated: `8969 + r * (3047 ±7)` - // Minimum execution time: 9_219_000 picoseconds. - Weight::from_parts(9_385_000, 8969) - // Standard Error: 45_562 - .saturating_add(Weight::from_parts(26_360_661, 0).saturating_mul(r.into())) + // Estimated: `8969 + r * (3047 ±10)` + // Minimum execution time: 9_835_000 picoseconds. + Weight::from_parts(9_920_000, 8969) + // Standard Error: 40_340 + .saturating_add(Weight::from_parts(24_865_180, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 3047).saturating_mul(r.into())) @@ -1330,10 +1328,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `274 + r * (78 ±0)` // Estimated: `1265 + r * (2553 ±0)` - // Minimum execution time: 9_355_000 picoseconds. - Weight::from_parts(15_071_309, 1265) - // Standard Error: 9_722 - .saturating_add(Weight::from_parts(5_328_717, 0).saturating_mul(r.into())) + // Minimum execution time: 9_640_000 picoseconds. + Weight::from_parts(15_820_877, 1265) + // Standard Error: 10_282 + .saturating_add(Weight::from_parts(5_252_164, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2553).saturating_mul(r.into())) @@ -1345,10 +1343,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `275 + r * (78 ±0)` // Estimated: `990 + r * (2568 ±0)` - // Minimum execution time: 8_979_000 picoseconds. - Weight::from_parts(14_362_224, 990) - // Standard Error: 9_137 - .saturating_add(Weight::from_parts(4_488_748, 0).saturating_mul(r.into())) + // Minimum execution time: 9_645_000 picoseconds. + Weight::from_parts(15_218_466, 990) + // Standard Error: 10_080 + .saturating_add(Weight::from_parts(4_416_668, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2568).saturating_mul(r.into())) @@ -1374,10 +1372,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `861 + r * (3 ±0)` // Estimated: `9282 + r * (3 ±0)` - // Minimum execution time: 269_704_000 picoseconds. - Weight::from_parts(289_916_035, 9282) - // Standard Error: 408 - .saturating_add(Weight::from_parts(166_040, 0).saturating_mul(r.into())) + // Minimum execution time: 274_312_000 picoseconds. + Weight::from_parts(290_447_885, 9282) + // Standard Error: 533 + .saturating_add(Weight::from_parts(171_021, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) @@ -1387,10 +1385,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_361_000 picoseconds. - Weight::from_parts(11_633_836, 0) - // Standard Error: 86 - .saturating_add(Weight::from_parts(83_083, 0).saturating_mul(r.into())) + // Minimum execution time: 9_577_000 picoseconds. + Weight::from_parts(11_390_437, 0) + // Standard Error: 87 + .saturating_add(Weight::from_parts(80_029, 0).saturating_mul(r.into())) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1399,10 +1397,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 9_133_000 picoseconds. - Weight::from_parts(13_259_836, 1704) - // Standard Error: 121 - .saturating_add(Weight::from_parts(76_878, 0).saturating_mul(r.into())) + // Minimum execution time: 9_331_000 picoseconds. + Weight::from_parts(13_138_476, 1704) + // Standard Error: 118 + .saturating_add(Weight::from_parts(75_848, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1410,10 +1408,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 851_000 picoseconds. - Weight::from_parts(587_883, 0) - // Standard Error: 16 - .saturating_add(Weight::from_parts(14_912, 0).saturating_mul(r.into())) + // Minimum execution time: 808_000 picoseconds. + Weight::from_parts(593_163, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(15_174, 0).saturating_mul(r.into())) } } @@ -1425,8 +1423,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_149_000 picoseconds. - Weight::from_parts(2_274_000, 1627) + // Minimum execution time: 2_070_000 picoseconds. + Weight::from_parts(2_191_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1436,10 +1434,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 12_863_000 picoseconds. - Weight::from_parts(13_188_000, 442) - // Standard Error: 1_053 - .saturating_add(Weight::from_parts(1_105_325, 0).saturating_mul(k.into())) + // Minimum execution time: 12_518_000 picoseconds. + Weight::from_parts(12_838_000, 442) + // Standard Error: 948 + .saturating_add(Weight::from_parts(1_080_417, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -1453,10 +1451,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 8_432_000 picoseconds. - Weight::from_parts(9_203_290, 6149) + // Minimum execution time: 8_403_000 picoseconds. + Weight::from_parts(8_908_050, 6149) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_186, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(1_161, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1469,8 +1467,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 17_177_000 picoseconds. - Weight::from_parts(17_663_000, 6450) + // Minimum execution time: 17_078_000 picoseconds. + Weight::from_parts(18_111_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1483,10 +1481,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_636_000 picoseconds. - Weight::from_parts(3_774_000, 3635) - // Standard Error: 542 - .saturating_add(Weight::from_parts(1_260_058, 0).saturating_mul(k.into())) + // Minimum execution time: 3_483_000 picoseconds. + Weight::from_parts(3_620_000, 3635) + // Standard Error: 1_511 + .saturating_add(Weight::from_parts(1_223_614, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1507,10 +1505,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `328 + c * (1 ±0)` // Estimated: `6266 + c * (1 ±0)` - // Minimum execution time: 21_585_000 picoseconds. - Weight::from_parts(22_069_944, 6266) - // Standard Error: 1 - .saturating_add(Weight::from_parts(404, 0).saturating_mul(c.into())) + // Minimum execution time: 20_594_000 picoseconds. + Weight::from_parts(21_309_501, 6266) + // Standard Error: 0 + .saturating_add(Weight::from_parts(367, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1521,8 +1519,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 13_283_000 picoseconds. - Weight::from_parts(14_015_000, 6380) + // Minimum execution time: 13_250_000 picoseconds. + Weight::from_parts(13_583_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1536,8 +1534,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 48_022_000 picoseconds. - Weight::from_parts(49_627_000, 6292) + // Minimum execution time: 47_552_000 picoseconds. + Weight::from_parts(48_386_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1549,8 +1547,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 58_374_000 picoseconds. - Weight::from_parts(59_615_000, 6534) + // Minimum execution time: 56_232_000 picoseconds. + Weight::from_parts(58_841_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1560,8 +1558,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 12_559_000 picoseconds. - Weight::from_parts(12_947_000, 6349) + // Minimum execution time: 12_268_000 picoseconds. + Weight::from_parts(12_887_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1571,8 +1569,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_480_000 picoseconds. - Weight::from_parts(2_680_000, 1627) + // Minimum execution time: 2_516_000 picoseconds. + Weight::from_parts(2_587_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1584,8 +1582,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 12_625_000 picoseconds. - Weight::from_parts(13_094_000, 3631) + // Minimum execution time: 12_297_000 picoseconds. + Weight::from_parts(12_668_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1595,8 +1593,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_836_000 picoseconds. - Weight::from_parts(5_182_000, 3607) + // Minimum execution time: 4_833_000 picoseconds. + Weight::from_parts(5_041_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1607,8 +1605,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 6_319_000 picoseconds. - Weight::from_parts(6_582_000, 3632) + // Minimum execution time: 6_148_000 picoseconds. + Weight::from_parts(6_463_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1619,8 +1617,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 6_532_000 picoseconds. - Weight::from_parts(6_909_000, 3607) + // Minimum execution time: 6_322_000 picoseconds. + Weight::from_parts(6_575_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1645,10 +1643,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `804 + c * (1 ±0)` // Estimated: `9217 + c * (1 ±0)` - // Minimum execution time: 305_778_000 picoseconds. - Weight::from_parts(282_321_249, 9217) - // Standard Error: 72 - .saturating_add(Weight::from_parts(33_456, 0).saturating_mul(c.into())) + // Minimum execution time: 309_862_000 picoseconds. + Weight::from_parts(290_506_612, 9217) + // Standard Error: 68 + .saturating_add(Weight::from_parts(32_911, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1680,14 +1678,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `326` // Estimated: `8740` - // Minimum execution time: 3_810_809_000 picoseconds. - Weight::from_parts(739_511_598, 8740) - // Standard Error: 140 - .saturating_add(Weight::from_parts(67_574, 0).saturating_mul(c.into())) - // Standard Error: 16 - .saturating_add(Weight::from_parts(1_488, 0).saturating_mul(i.into())) - // Standard Error: 16 - .saturating_add(Weight::from_parts(1_537, 0).saturating_mul(s.into())) + // Minimum execution time: 3_777_655_000 picoseconds. + Weight::from_parts(776_168_467, 8740) + // Standard Error: 129 + .saturating_add(Weight::from_parts(66_417, 0).saturating_mul(c.into())) + // Standard Error: 15 + .saturating_add(Weight::from_parts(1_439, 0).saturating_mul(i.into())) + // Standard Error: 15 + .saturating_add(Weight::from_parts(1_525, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -1717,12 +1715,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `563` // Estimated: `8982` - // Minimum execution time: 1_986_789_000 picoseconds. - Weight::from_parts(2_017_466_000, 8982) - // Standard Error: 26 - .saturating_add(Weight::from_parts(827, 0).saturating_mul(i.into())) - // Standard Error: 26 - .saturating_add(Weight::from_parts(781, 0).saturating_mul(s.into())) + // Minimum execution time: 1_973_557_000 picoseconds. + Weight::from_parts(2_002_671_000, 8982) + // Standard Error: 25 + .saturating_add(Weight::from_parts(817, 0).saturating_mul(i.into())) + // Standard Error: 25 + .saturating_add(Weight::from_parts(785, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1746,8 +1744,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `829` // Estimated: `9244` - // Minimum execution time: 210_724_000 picoseconds. - Weight::from_parts(218_608_000, 9244) + // Minimum execution time: 207_934_000 picoseconds. + Weight::from_parts(216_665_000, 9244) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1768,10 +1766,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `145` // Estimated: `6085` - // Minimum execution time: 271_259_000 picoseconds. - Weight::from_parts(298_852_854, 6085) - // Standard Error: 65 - .saturating_add(Weight::from_parts(33_547, 0).saturating_mul(c.into())) + // Minimum execution time: 276_059_000 picoseconds. + Weight::from_parts(309_969_864, 6085) + // Standard Error: 46 + .saturating_add(Weight::from_parts(32_566, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1792,10 +1790,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `145` // Estimated: `6085` - // Minimum execution time: 278_167_000 picoseconds. - Weight::from_parts(311_888_941, 6085) - // Standard Error: 58 - .saturating_add(Weight::from_parts(33_595, 0).saturating_mul(c.into())) + // Minimum execution time: 300_492_000 picoseconds. + Weight::from_parts(315_131_183, 6085) + // Standard Error: 46 + .saturating_add(Weight::from_parts(32_844, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1813,8 +1811,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 47_403_000 picoseconds. - Weight::from_parts(48_707_000, 3780) + // Minimum execution time: 44_644_000 picoseconds. + Weight::from_parts(46_030_000, 3780) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1830,8 +1828,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `8967` - // Minimum execution time: 35_361_000 picoseconds. - Weight::from_parts(36_714_000, 8967) + // Minimum execution time: 34_528_000 picoseconds. + Weight::from_parts(36_025_000, 8967) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -1840,10 +1838,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_340_000 picoseconds. - Weight::from_parts(9_360_237, 0) - // Standard Error: 269 - .saturating_add(Weight::from_parts(249_611, 0).saturating_mul(r.into())) + // Minimum execution time: 9_371_000 picoseconds. + Weight::from_parts(10_291_757, 0) + // Standard Error: 206 + .saturating_add(Weight::from_parts(250_772, 0).saturating_mul(r.into())) } /// Storage: `Contracts::ContractInfoOf` (r:1600 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1852,10 +1850,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `509 + r * (77 ±0)` // Estimated: `1467 + r * (2552 ±0)` - // Minimum execution time: 9_059_000 picoseconds. - Weight::from_parts(9_201_000, 1467) - // Standard Error: 5_643 - .saturating_add(Weight::from_parts(3_343_859, 0).saturating_mul(r.into())) + // Minimum execution time: 9_429_000 picoseconds. + Weight::from_parts(9_590_000, 1467) + // Standard Error: 5_538 + .saturating_add(Weight::from_parts(3_353_897, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2552).saturating_mul(r.into())) } @@ -1866,10 +1864,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `517 + r * (170 ±0)` // Estimated: `1468 + r * (2645 ±0)` - // Minimum execution time: 9_220_000 picoseconds. - Weight::from_parts(9_399_000, 1468) - // Standard Error: 6_194 - .saturating_add(Weight::from_parts(4_172_011, 0).saturating_mul(r.into())) + // Minimum execution time: 9_430_000 picoseconds. + Weight::from_parts(9_601_000, 1468) + // Standard Error: 5_410 + .saturating_add(Weight::from_parts(4_150_336, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2645).saturating_mul(r.into())) } @@ -1878,50 +1876,50 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_707_000 picoseconds. - Weight::from_parts(10_100_456, 0) - // Standard Error: 234 - .saturating_add(Weight::from_parts(338_464, 0).saturating_mul(r.into())) + // Minimum execution time: 9_559_000 picoseconds. + Weight::from_parts(9_922_167, 0) + // Standard Error: 195 + .saturating_add(Weight::from_parts(357_039, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_caller_is_origin(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_524_000 picoseconds. - Weight::from_parts(10_813_389, 0) - // Standard Error: 76 - .saturating_add(Weight::from_parts(102_535, 0).saturating_mul(r.into())) + // Minimum execution time: 9_520_000 picoseconds. + Weight::from_parts(10_811_836, 0) + // Standard Error: 85 + .saturating_add(Weight::from_parts(98_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_caller_is_root(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_799_000 picoseconds. - Weight::from_parts(10_886_744, 0) - // Standard Error: 75 - .saturating_add(Weight::from_parts(80_901, 0).saturating_mul(r.into())) + // Minimum execution time: 9_383_000 picoseconds. + Weight::from_parts(10_367_343, 0) + // Standard Error: 96 + .saturating_add(Weight::from_parts(80_662, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_address(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_895_000 picoseconds. - Weight::from_parts(10_658_338, 0) - // Standard Error: 189 - .saturating_add(Weight::from_parts(249_694, 0).saturating_mul(r.into())) + // Minimum execution time: 9_697_000 picoseconds. + Weight::from_parts(10_011_008, 0) + // Standard Error: 195 + .saturating_add(Weight::from_parts(254_807, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_gas_left(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_643_000 picoseconds. - Weight::from_parts(10_932_126, 0) - // Standard Error: 153 - .saturating_add(Weight::from_parts(280_924, 0).saturating_mul(r.into())) + // Minimum execution time: 9_618_000 picoseconds. + Weight::from_parts(12_017_883, 0) + // Standard Error: 260 + .saturating_add(Weight::from_parts(288_461, 0).saturating_mul(r.into())) } /// Storage: `System::Account` (r:1 w:0) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) @@ -1930,10 +1928,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `140` // Estimated: `3599` - // Minimum execution time: 9_548_000 picoseconds. - Weight::from_parts(9_737_000, 3599) - // Standard Error: 971 - .saturating_add(Weight::from_parts(1_704_134, 0).saturating_mul(r.into())) + // Minimum execution time: 9_655_000 picoseconds. + Weight::from_parts(35_284_593, 3599) + // Standard Error: 1_467 + .saturating_add(Weight::from_parts(1_538_337, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 1600]`. @@ -1941,40 +1939,40 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_172_000 picoseconds. - Weight::from_parts(18_255_933, 0) - // Standard Error: 540 - .saturating_add(Weight::from_parts(230_929, 0).saturating_mul(r.into())) + // Minimum execution time: 9_677_000 picoseconds. + Weight::from_parts(10_863_201, 0) + // Standard Error: 275 + .saturating_add(Weight::from_parts(256_433, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_minimum_balance(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_232_000 picoseconds. - Weight::from_parts(9_796_584, 0) - // Standard Error: 208 - .saturating_add(Weight::from_parts(239_962, 0).saturating_mul(r.into())) + // Minimum execution time: 9_345_000 picoseconds. + Weight::from_parts(10_054_215, 0) + // Standard Error: 183 + .saturating_add(Weight::from_parts(249_128, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_block_number(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_747_000 picoseconds. - Weight::from_parts(8_733_230, 0) - // Standard Error: 377 - .saturating_add(Weight::from_parts(253_801, 0).saturating_mul(r.into())) + // Minimum execution time: 9_577_000 picoseconds. + Weight::from_parts(10_983_713, 0) + // Standard Error: 154 + .saturating_add(Weight::from_parts(242_312, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_now(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_214_000 picoseconds. - Weight::from_parts(10_194_153, 0) - // Standard Error: 516 - .saturating_add(Weight::from_parts(247_621, 0).saturating_mul(r.into())) + // Minimum execution time: 9_484_000 picoseconds. + Weight::from_parts(9_694_713, 0) + // Standard Error: 284 + .saturating_add(Weight::from_parts(249_892, 0).saturating_mul(r.into())) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1983,10 +1981,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 9_022_000 picoseconds. - Weight::from_parts(22_051_160, 1552) - // Standard Error: 697 - .saturating_add(Weight::from_parts(709_612, 0).saturating_mul(r.into())) + // Minimum execution time: 9_445_000 picoseconds. + Weight::from_parts(24_701_331, 1552) + // Standard Error: 677 + .saturating_add(Weight::from_parts(661_177, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 1600]`. @@ -1994,10 +1992,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_135_000 picoseconds. - Weight::from_parts(10_646_215, 0) - // Standard Error: 161 - .saturating_add(Weight::from_parts(170_336, 0).saturating_mul(r.into())) + // Minimum execution time: 9_430_000 picoseconds. + Weight::from_parts(10_848_005, 0) + // Standard Error: 213 + .saturating_add(Weight::from_parts(171_409, 0).saturating_mul(r.into())) } /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) @@ -2020,10 +2018,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `872` // Estimated: `9287` - // Minimum execution time: 273_896_000 picoseconds. - Weight::from_parts(148_309_654, 9287) - // Standard Error: 16 - .saturating_add(Weight::from_parts(1_355, 0).saturating_mul(n.into())) + // Minimum execution time: 282_529_000 picoseconds. + Weight::from_parts(143_922_825, 9287) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_362, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -2032,20 +2030,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_906_000 picoseconds. - Weight::from_parts(9_264_446, 0) - // Standard Error: 19_760 - .saturating_add(Weight::from_parts(1_256_053, 0).saturating_mul(r.into())) + // Minimum execution time: 8_990_000 picoseconds. + Weight::from_parts(9_516_528, 0) + // Standard Error: 23_657 + .saturating_add(Weight::from_parts(1_516_571, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_return_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_266_000 picoseconds. - Weight::from_parts(10_602_261, 0) + // Minimum execution time: 10_634_000 picoseconds. + Weight::from_parts(11_032_475, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(318, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(316, 0).saturating_mul(n.into())) } /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) @@ -2074,10 +2072,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `4805 + r * (2121 ±0)` // Estimated: `13220 + r * (81321 ±0)` - // Minimum execution time: 295_922_000 picoseconds. - Weight::from_parts(322_472_877, 13220) - // Standard Error: 993_812 - .saturating_add(Weight::from_parts(259_075_422, 0).saturating_mul(r.into())) + // Minimum execution time: 297_889_000 picoseconds. + Weight::from_parts(323_493_293, 13220) + // Standard Error: 956_375 + .saturating_add(Weight::from_parts(244_100_306, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().reads((36_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -2091,10 +2089,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 9_427_000 picoseconds. - Weight::from_parts(12_996_213, 1561) - // Standard Error: 845 - .saturating_add(Weight::from_parts(1_182_642, 0).saturating_mul(r.into())) + // Minimum execution time: 9_707_000 picoseconds. + Weight::from_parts(17_781_513, 1561) + // Standard Error: 617 + .saturating_add(Weight::from_parts(1_112_754, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 1600]`. @@ -2102,10 +2100,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_304_000 picoseconds. - Weight::from_parts(25_678_842, 0) - // Standard Error: 1_855 - .saturating_add(Weight::from_parts(1_814_511, 0).saturating_mul(r.into())) + // Minimum execution time: 9_316_000 picoseconds. + Weight::from_parts(19_371_063, 0) + // Standard Error: 832 + .saturating_add(Weight::from_parts(1_670_527, 0).saturating_mul(r.into())) } /// Storage: `System::EventTopics` (r:4 w:4) /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2115,12 +2113,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 23_425_000 picoseconds. - Weight::from_parts(15_229_010, 990) - // Standard Error: 14_380 - .saturating_add(Weight::from_parts(2_545_653, 0).saturating_mul(t.into())) - // Standard Error: 4 - .saturating_add(Weight::from_parts(594, 0).saturating_mul(n.into())) + // Minimum execution time: 24_006_000 picoseconds. + Weight::from_parts(15_581_150, 990) + // Standard Error: 12_434 + .saturating_add(Weight::from_parts(2_414_541, 0).saturating_mul(t.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(610, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -2130,20 +2128,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_117_000 picoseconds. - Weight::from_parts(12_887_533, 0) - // Standard Error: 83 - .saturating_add(Weight::from_parts(99_373, 0).saturating_mul(r.into())) + // Minimum execution time: 9_004_000 picoseconds. + Weight::from_parts(9_859_329, 0) + // Standard Error: 94 + .saturating_add(Weight::from_parts(101_511, 0).saturating_mul(r.into())) } /// The range of component `i` is `[0, 1048576]`. fn seal_debug_message_per_byte(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_982_000 picoseconds. - Weight::from_parts(11_176_000, 0) + // Minimum execution time: 10_655_000 picoseconds. + Weight::from_parts(10_995_000, 0) // Standard Error: 8 - .saturating_add(Weight::from_parts(983, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(977, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2152,10 +2150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_150_000 picoseconds. - Weight::from_parts(9_269_000, 105) - // Standard Error: 8_147 - .saturating_add(Weight::from_parts(5_339_554, 0).saturating_mul(r.into())) + // Minimum execution time: 9_519_000 picoseconds. + Weight::from_parts(9_603_000, 105) + // Standard Error: 8_299 + .saturating_add(Weight::from_parts(5_137_313, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) @@ -2167,10 +2165,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `245` // Estimated: `245` - // Minimum execution time: 19_085_000 picoseconds. - Weight::from_parts(20_007_323, 245) - // Standard Error: 3 - .saturating_add(Weight::from_parts(291, 0).saturating_mul(n.into())) + // Minimum execution time: 19_317_000 picoseconds. + Weight::from_parts(19_967_876, 245) + // Standard Error: 2 + .saturating_add(Weight::from_parts(280, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -2181,10 +2179,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 19_127_000 picoseconds. - Weight::from_parts(21_152_987, 248) - // Standard Error: 3 - .saturating_add(Weight::from_parts(42, 0).saturating_mul(n.into())) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_538_959, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(62, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -2196,10 +2194,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_264_000 picoseconds. - Weight::from_parts(9_449_000, 105) - // Standard Error: 8_196 - .saturating_add(Weight::from_parts(5_325_578, 0).saturating_mul(r.into())) + // Minimum execution time: 9_485_000 picoseconds. + Weight::from_parts(9_591_000, 105) + // Standard Error: 8_372 + .saturating_add(Weight::from_parts(5_165_811, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) @@ -2211,10 +2209,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 18_489_000 picoseconds. - Weight::from_parts(19_916_153, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(97, 0).saturating_mul(n.into())) + // Minimum execution time: 19_064_000 picoseconds. + Weight::from_parts(20_735_793, 248) + // Standard Error: 3 + .saturating_add(Weight::from_parts(53, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -2226,10 +2224,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_299_000 picoseconds. - Weight::from_parts(9_464_000, 105) - // Standard Error: 6_827 - .saturating_add(Weight::from_parts(4_720_699, 0).saturating_mul(r.into())) + // Minimum execution time: 9_709_000 picoseconds. + Weight::from_parts(9_894_000, 105) + // Standard Error: 6_982 + .saturating_add(Weight::from_parts(4_533_141, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) } @@ -2240,10 +2238,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 17_981_000 picoseconds. - Weight::from_parts(19_802_353, 248) + // Minimum execution time: 18_024_000 picoseconds. + Weight::from_parts(19_612_635, 248) // Standard Error: 3 - .saturating_add(Weight::from_parts(617, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(610, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -2254,10 +2252,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_891_000 picoseconds. - Weight::from_parts(10_046_000, 105) - // Standard Error: 6_993 - .saturating_add(Weight::from_parts(4_601_167, 0).saturating_mul(r.into())) + // Minimum execution time: 9_618_000 picoseconds. + Weight::from_parts(9_820_000, 105) + // Standard Error: 6_968 + .saturating_add(Weight::from_parts(4_400_926, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) } @@ -2268,10 +2266,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 17_229_000 picoseconds. - Weight::from_parts(18_302_733, 248) + // Minimum execution time: 17_339_000 picoseconds. + Weight::from_parts(18_524_914, 248) // Standard Error: 2 - .saturating_add(Weight::from_parts(112, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(84, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -2282,10 +2280,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `108 + r * (150 ±0)` // Estimated: `105 + r * (151 ±0)` - // Minimum execution time: 9_323_000 picoseconds. - Weight::from_parts(9_462_000, 105) - // Standard Error: 8_031 - .saturating_add(Weight::from_parts(5_433_981, 0).saturating_mul(r.into())) + // Minimum execution time: 9_337_000 picoseconds. + Weight::from_parts(9_645_000, 105) + // Standard Error: 8_140 + .saturating_add(Weight::from_parts(5_231_703, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 151).saturating_mul(r.into())) @@ -2297,10 +2295,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 18_711_000 picoseconds. - Weight::from_parts(20_495_670, 248) + // Minimum execution time: 18_882_000 picoseconds. + Weight::from_parts(20_628_746, 248) // Standard Error: 3 - .saturating_add(Weight::from_parts(640, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(618, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -2312,10 +2310,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `770` // Estimated: `4221 + r * (2475 ±0)` - // Minimum execution time: 9_226_000 picoseconds. - Weight::from_parts(9_394_000, 4221) - // Standard Error: 14_741 - .saturating_add(Weight::from_parts(34_179_316, 0).saturating_mul(r.into())) + // Minimum execution time: 9_334_000 picoseconds. + Weight::from_parts(9_525_000, 4221) + // Standard Error: 17_887 + .saturating_add(Weight::from_parts(33_343_504, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -2337,10 +2335,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `520 + r * (170 ±0)` // Estimated: `6463 + r * (2646 ±0)` - // Minimum execution time: 9_455_000 picoseconds. - Weight::from_parts(9_671_000, 6463) - // Standard Error: 126_080 - .saturating_add(Weight::from_parts(244_204_040, 0).saturating_mul(r.into())) + // Minimum execution time: 9_483_000 picoseconds. + Weight::from_parts(9_663_000, 6463) + // Standard Error: 110_354 + .saturating_add(Weight::from_parts(245_827_711, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -2362,10 +2360,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0 + r * (527 ±0)` // Estimated: `6447 + r * (2583 ±10)` - // Minimum execution time: 9_274_000 picoseconds. - Weight::from_parts(9_437_000, 6447) - // Standard Error: 150_832 - .saturating_add(Weight::from_parts(244_196_269, 0).saturating_mul(r.into())) + // Minimum execution time: 9_473_000 picoseconds. + Weight::from_parts(9_655_000, 6447) + // Standard Error: 130_607 + .saturating_add(Weight::from_parts(244_861_297, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2583).saturating_mul(r.into())) @@ -2388,12 +2386,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `699 + t * (277 ±0)` // Estimated: `6639 + t * (3458 ±0)` - // Minimum execution time: 214_483_000 picoseconds. - Weight::from_parts(122_634_366, 6639) - // Standard Error: 2_499_235 - .saturating_add(Weight::from_parts(41_326_008, 0).saturating_mul(t.into())) + // Minimum execution time: 216_689_000 picoseconds. + Weight::from_parts(130_041_795, 6639) + // Standard Error: 2_493_034 + .saturating_add(Weight::from_parts(38_826_681, 0).saturating_mul(t.into())) // Standard Error: 3 - .saturating_add(Weight::from_parts(422, 0).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(418, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) @@ -2419,10 +2417,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1097 + r * (188 ±0)` // Estimated: `6990 + r * (2664 ±0)` - // Minimum execution time: 341_569_000 picoseconds. - Weight::from_parts(360_574_000, 6990) - // Standard Error: 259_746 - .saturating_add(Weight::from_parts(337_944_674, 0).saturating_mul(r.into())) + // Minimum execution time: 352_276_000 picoseconds. + Weight::from_parts(358_665_000, 6990) + // Standard Error: 214_243 + .saturating_add(Weight::from_parts(334_998_245, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) @@ -2450,14 +2448,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `760 + t * (104 ±0)` // Estimated: `6719 + t * (2549 ±1)` - // Minimum execution time: 1_863_119_000 picoseconds. - Weight::from_parts(900_189_174, 6719) - // Standard Error: 13_040_979 - .saturating_add(Weight::from_parts(4_056_063, 0).saturating_mul(t.into())) + // Minimum execution time: 1_873_663_000 picoseconds. + Weight::from_parts(928_999_031, 6719) // Standard Error: 20 - .saturating_add(Weight::from_parts(1_028, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_046, 0).saturating_mul(i.into())) // Standard Error: 20 - .saturating_add(Weight::from_parts(1_173, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_158, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(7_u64)) @@ -2469,78 +2465,78 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_211_000 picoseconds. - Weight::from_parts(11_696_412, 0) - // Standard Error: 388 - .saturating_add(Weight::from_parts(265_538, 0).saturating_mul(r.into())) + // Minimum execution time: 9_500_000 picoseconds. + Weight::from_parts(9_022_529, 0) + // Standard Error: 295 + .saturating_add(Weight::from_parts(270_989, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_sha2_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_296_000 picoseconds. - Weight::from_parts(572_494, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_067, 0).saturating_mul(n.into())) + // Minimum execution time: 10_743_000 picoseconds. + Weight::from_parts(10_950_000, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_061, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_hash_keccak_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_177_000 picoseconds. - Weight::from_parts(8_620_481, 0) - // Standard Error: 249 - .saturating_add(Weight::from_parts(674_502, 0).saturating_mul(r.into())) + // Minimum execution time: 9_395_000 picoseconds. + Weight::from_parts(12_944_233, 0) + // Standard Error: 286 + .saturating_add(Weight::from_parts(664_044, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_240_000 picoseconds. - Weight::from_parts(8_696_186, 0) + // Minimum execution time: 11_300_000 picoseconds. + Weight::from_parts(6_919_359, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(3_328, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_337, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_hash_blake2_256(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_889_000 picoseconds. - Weight::from_parts(16_103_170, 0) - // Standard Error: 343 - .saturating_add(Weight::from_parts(328_939, 0).saturating_mul(r.into())) + // Minimum execution time: 9_510_000 picoseconds. + Weight::from_parts(9_432_045, 0) + // Standard Error: 290 + .saturating_add(Weight::from_parts(335_344, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_405_000 picoseconds. - Weight::from_parts(2_264_024, 0) + // Minimum execution time: 11_067_000 picoseconds. + Weight::from_parts(3_082_553, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_196, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_199, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1600]`. fn seal_hash_blake2_128(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_215_000 picoseconds. - Weight::from_parts(10_505_632, 0) - // Standard Error: 240 - .saturating_add(Weight::from_parts(324_854, 0).saturating_mul(r.into())) + // Minimum execution time: 9_583_000 picoseconds. + Weight::from_parts(10_413_882, 0) + // Standard Error: 188 + .saturating_add(Weight::from_parts(330_398, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128_per_byte(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_440_000 picoseconds. - Weight::from_parts(2_575_889, 0) + // Minimum execution time: 10_740_000 picoseconds. + Weight::from_parts(938_375, 0) // Standard Error: 1 .saturating_add(Weight::from_parts(1_199, 0).saturating_mul(n.into())) } @@ -2549,40 +2545,40 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 55_119_000 picoseconds. - Weight::from_parts(56_732_248, 0) - // Standard Error: 8 - .saturating_add(Weight::from_parts(4_639, 0).saturating_mul(n.into())) + // Minimum execution time: 54_010_000 picoseconds. + Weight::from_parts(54_513_543, 0) + // Standard Error: 7 + .saturating_add(Weight::from_parts(4_681, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 160]`. fn seal_sr25519_verify(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_176_000 picoseconds. - Weight::from_parts(9_861_102, 0) - // Standard Error: 6_029 - .saturating_add(Weight::from_parts(45_948_571, 0).saturating_mul(r.into())) + // Minimum execution time: 9_456_000 picoseconds. + Weight::from_parts(21_224_326, 0) + // Standard Error: 5_864 + .saturating_add(Weight::from_parts(40_800_447, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 160]`. fn seal_ecdsa_recover(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_293_000 picoseconds. - Weight::from_parts(28_785_765, 0) - // Standard Error: 9_160 - .saturating_add(Weight::from_parts(45_566_150, 0).saturating_mul(r.into())) + // Minimum execution time: 9_476_000 picoseconds. + Weight::from_parts(23_619_641, 0) + // Standard Error: 7_475 + .saturating_add(Weight::from_parts(45_413_458, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 160]`. fn seal_ecdsa_to_eth_address(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_206_000 picoseconds. - Weight::from_parts(12_420_664, 0) - // Standard Error: 3_489 - .saturating_add(Weight::from_parts(11_628_989, 0).saturating_mul(r.into())) + // Minimum execution time: 9_437_000 picoseconds. + Weight::from_parts(11_960_409, 0) + // Standard Error: 3_234 + .saturating_add(Weight::from_parts(11_537_048, 0).saturating_mul(r.into())) } /// Storage: `Contracts::CodeInfoOf` (r:1536 w:1536) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -2596,11 +2592,11 @@ impl WeightInfo for () { fn seal_set_code_hash(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + r * (926 ±0)` - // Estimated: `8969 + r * (3047 ±7)` - // Minimum execution time: 9_219_000 picoseconds. - Weight::from_parts(9_385_000, 8969) - // Standard Error: 45_562 - .saturating_add(Weight::from_parts(26_360_661, 0).saturating_mul(r.into())) + // Estimated: `8969 + r * (3047 ±10)` + // Minimum execution time: 9_835_000 picoseconds. + Weight::from_parts(9_920_000, 8969) + // Standard Error: 40_340 + .saturating_add(Weight::from_parts(24_865_180, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 3047).saturating_mul(r.into())) @@ -2612,10 +2608,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `274 + r * (78 ±0)` // Estimated: `1265 + r * (2553 ±0)` - // Minimum execution time: 9_355_000 picoseconds. - Weight::from_parts(15_071_309, 1265) - // Standard Error: 9_722 - .saturating_add(Weight::from_parts(5_328_717, 0).saturating_mul(r.into())) + // Minimum execution time: 9_640_000 picoseconds. + Weight::from_parts(15_820_877, 1265) + // Standard Error: 10_282 + .saturating_add(Weight::from_parts(5_252_164, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2553).saturating_mul(r.into())) @@ -2627,10 +2623,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `275 + r * (78 ±0)` // Estimated: `990 + r * (2568 ±0)` - // Minimum execution time: 8_979_000 picoseconds. - Weight::from_parts(14_362_224, 990) - // Standard Error: 9_137 - .saturating_add(Weight::from_parts(4_488_748, 0).saturating_mul(r.into())) + // Minimum execution time: 9_645_000 picoseconds. + Weight::from_parts(15_218_466, 990) + // Standard Error: 10_080 + .saturating_add(Weight::from_parts(4_416_668, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(r.into()))) .saturating_add(Weight::from_parts(0, 2568).saturating_mul(r.into())) @@ -2656,10 +2652,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `861 + r * (3 ±0)` // Estimated: `9282 + r * (3 ±0)` - // Minimum execution time: 269_704_000 picoseconds. - Weight::from_parts(289_916_035, 9282) - // Standard Error: 408 - .saturating_add(Weight::from_parts(166_040, 0).saturating_mul(r.into())) + // Minimum execution time: 274_312_000 picoseconds. + Weight::from_parts(290_447_885, 9282) + // Standard Error: 533 + .saturating_add(Weight::from_parts(171_021, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) @@ -2669,10 +2665,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_361_000 picoseconds. - Weight::from_parts(11_633_836, 0) - // Standard Error: 86 - .saturating_add(Weight::from_parts(83_083, 0).saturating_mul(r.into())) + // Minimum execution time: 9_577_000 picoseconds. + Weight::from_parts(11_390_437, 0) + // Standard Error: 87 + .saturating_add(Weight::from_parts(80_029, 0).saturating_mul(r.into())) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -2681,10 +2677,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 9_133_000 picoseconds. - Weight::from_parts(13_259_836, 1704) - // Standard Error: 121 - .saturating_add(Weight::from_parts(76_878, 0).saturating_mul(r.into())) + // Minimum execution time: 9_331_000 picoseconds. + Weight::from_parts(13_138_476, 1704) + // Standard Error: 118 + .saturating_add(Weight::from_parts(75_848, 0).saturating_mul(r.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -2692,9 +2688,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 851_000 picoseconds. - Weight::from_parts(587_883, 0) - // Standard Error: 16 - .saturating_add(Weight::from_parts(14_912, 0).saturating_mul(r.into())) + // Minimum execution time: 808_000 picoseconds. + Weight::from_parts(593_163, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(15_174, 0).saturating_mul(r.into())) } } From 3369de68baf31636fbd19431fae36ddba3255448 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 10 May 2024 10:25:28 +0200 Subject: [PATCH 12/29] Add test --- .../fixtures/contracts/read_only_call.rs | 49 +++++++++++++++++ substrate/frame/contracts/src/exec.rs | 13 ++--- substrate/frame/contracts/src/tests.rs | 54 +++++++++++++++++++ 3 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 substrate/frame/contracts/fixtures/contracts/read_only_call.rs diff --git a/substrate/frame/contracts/fixtures/contracts/read_only_call.rs b/substrate/frame/contracts/fixtures/contracts/read_only_call.rs new file mode 100644 index 000000000000..4d3d48087fef --- /dev/null +++ b/substrate/frame/contracts/fixtures/contracts/read_only_call.rs @@ -0,0 +1,49 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This fixture tests if account_reentrance_count works as expected. +#![no_std] +#![no_main] + +use common::input; +use uapi::{HostFn, HostFnImpl as api}; + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn deploy() {} + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn call() { + input!( + callee_input: [u8; 4], + callee_addr: [u8; 32], + ); + + // Call the callee + api::call_v2( + uapi::CallFlags::READ_ONLY, + callee_addr, + 0u64, // How much ref_time to devote for the execution. 0 = all. + 0u64, // How much proof_size to devote for the execution. 0 = all. + None, // No deposit limit. + &0u64.to_le_bytes(), // Value transferred to the contract. + callee_input, + None, + ) + .unwrap(); +} diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 506ed34caef2..54019ca9373d 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -993,12 +993,13 @@ where Event::Instantiated { deployer: caller, contract: account_id.clone() }, ); }, - (ExportedFunction::Call, Some(code_hash)) => { - Contracts::::deposit_event( - vec![T::Hashing::hash_of(account_id), T::Hashing::hash_of(&code_hash)], - Event::DelegateCalled { contract: account_id.clone(), code_hash }, - ); - }, + (ExportedFunction::Call, Some(code_hash)) => + if !frame.read_only { + Contracts::::deposit_event( + vec![T::Hashing::hash_of(account_id), T::Hashing::hash_of(&code_hash)], + Event::DelegateCalled { contract: account_id.clone(), code_hash }, + ); + }, (ExportedFunction::Call, None) => { // If a special limit was set for the sub-call, we enforce it here. // The sub-call will be rolled back in case the limit is exhausted. diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 8fe845fcf0f8..57f278bb2c3d 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -4249,3 +4249,57 @@ fn gas_consumed_is_linear_for_nested_calls() { assert_eq!(gas_max, gas_0 + gas_per_recursion * max_call_depth as u64); }); } + +#[test] +fn read_only_call_cannot_store() { + let (wasm_caller, _code_hash_caller) = compile_module::("read_only_call").unwrap(); + let (wasm_callee, _code_hash_callee) = compile_module::("store_call").unwrap(); + ExtBuilder::default().existential_deposit(200).build().execute_with(|| { + let _ = ::Currency::set_balance(&ALICE, 1_000_000); + + // Create both contracts: Constructors do nothing. + let addr_caller = + builder::bare_instantiate(Code::Upload(wasm_caller)).build_and_unwrap_account_id(); + let addr_callee = + builder::bare_instantiate(Code::Upload(wasm_callee)).build_and_unwrap_account_id(); + + // Read-only call fails when modifying storage + assert_err_ignore_postinfo!( + builder::call(addr_caller).data((100u32, &addr_callee).encode()).build(), + >::ContractTrapped + ); + }); +} + +#[test] +fn read_only_call_works() { + let (wasm_caller, _code_hash_caller) = compile_module::("read_only_call").unwrap(); + let (wasm_callee, _code_hash_callee) = compile_module::("dummy").unwrap(); + ExtBuilder::default().existential_deposit(200).build().execute_with(|| { + let _ = ::Currency::set_balance(&ALICE, 1_000_000); + + // Create both contracts: Constructors do nothing. + let addr_caller = + builder::bare_instantiate(Code::Upload(wasm_caller)).build_and_unwrap_account_id(); + let addr_callee = + builder::bare_instantiate(Code::Upload(wasm_callee)).build_and_unwrap_account_id(); + + // Drop previous events + initialize_block(2); + assert_ok!(builder::call(addr_caller.clone()) + .data((100u32, &addr_callee).encode()) + .build()); + + assert_eq!( + System::events(), + vec![EventRecord { + phase: Phase::Initialization, + event: RuntimeEvent::Contracts(crate::Event::Called { + caller: Origin::from_account_id(ALICE), + contract: addr_caller.clone(), + }), + topics: vec![hash(&Origin::::from_account_id(ALICE)), hash(&addr_caller)], + },] + ); + }); +} From 6ebfafcf1b5d05719bbf8d0299cab44440ec4687 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 10 May 2024 10:41:34 +0200 Subject: [PATCH 13/29] Fix fixture description --- substrate/frame/contracts/fixtures/contracts/read_only_call.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/fixtures/contracts/read_only_call.rs b/substrate/frame/contracts/fixtures/contracts/read_only_call.rs index 4d3d48087fef..a291d8780407 100644 --- a/substrate/frame/contracts/fixtures/contracts/read_only_call.rs +++ b/substrate/frame/contracts/fixtures/contracts/read_only_call.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// This fixture tests if account_reentrance_count works as expected. +// This fixture tests if read-only call works as expected. #![no_std] #![no_main] From 91d145ef0fb55a8df8eb2ab975b8a0febde16178 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 13 May 2024 15:49:00 +0200 Subject: [PATCH 14/29] Address comments --- .../contracts/call_with_flags_and_value.rs | 52 +++++++ .../fixtures/contracts/read_only_call.rs | 3 +- .../frame/contracts/proc-macro/src/lib.rs | 19 ++- substrate/frame/contracts/src/exec.rs | 137 ++---------------- substrate/frame/contracts/src/tests.rs | 68 ++++++++- substrate/frame/contracts/src/wasm/mod.rs | 4 + substrate/frame/contracts/src/wasm/runtime.rs | 19 +++ 7 files changed, 171 insertions(+), 131 deletions(-) create mode 100644 substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs diff --git a/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs b/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs new file mode 100644 index 000000000000..fc51ec2c9d3e --- /dev/null +++ b/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs @@ -0,0 +1,52 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! This fixture calls the account_id with the 2D Weight limit. +//! It returns the result of the call as output data. +#![no_std] +#![no_main] + +use common::input; +use uapi::{HostFn, HostFnImpl as api}; + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn deploy() {} + +#[no_mangle] +#[polkavm_derive::polkavm_export] +pub extern "C" fn call() { + input!( + 256, + callee_addr: [u8; 32], + flags: u32, + value: u64, + forwarded_input: [u8], + ); + + api::call_v2( + uapi::CallFlags::from_bits(flags).unwrap(), + callee_addr, + 0u64, // How much ref_time to devote for the execution. 0 = all. + 0u64, // How much proof_size to devote for the execution. 0 = all. + None, // No deposit limit. + &value.to_le_bytes(), // Value transferred to the contract. + forwarded_input, + None, + ) + .unwrap(); +} diff --git a/substrate/frame/contracts/fixtures/contracts/read_only_call.rs b/substrate/frame/contracts/fixtures/contracts/read_only_call.rs index a291d8780407..524fe50b6d06 100644 --- a/substrate/frame/contracts/fixtures/contracts/read_only_call.rs +++ b/substrate/frame/contracts/fixtures/contracts/read_only_call.rs @@ -30,8 +30,9 @@ pub extern "C" fn deploy() {} #[polkavm_derive::polkavm_export] pub extern "C" fn call() { input!( - callee_input: [u8; 4], + 256, callee_addr: [u8; 32], + callee_input: [u8], ); // Call the callee diff --git a/substrate/frame/contracts/proc-macro/src/lib.rs b/substrate/frame/contracts/proc-macro/src/lib.rs index 1794d09d5ad2..b38a8a3d6cec 100644 --- a/substrate/frame/contracts/proc-macro/src/lib.rs +++ b/substrate/frame/contracts/proc-macro/src/lib.rs @@ -169,7 +169,7 @@ impl HostFn { // process attributes let msg = - "only #[version()], #[unstable], #[prefixed_alias] and #[deprecated] attributes are allowed."; + "only #[version()], #[unstable], #[prefixed_alias], #[deprecated] and #[mutable] attributes are allowed."; let span = item.span(); let mut attrs = item.attrs.clone(); attrs.retain(|a| !a.path().is_ident("doc")); @@ -177,6 +177,7 @@ impl HostFn { let mut is_stable = true; let mut alias_to = None; let mut not_deprecated = true; + let mut mutable = false; while let Some(attr) = attrs.pop() { let ident = attr.path().get_ident().ok_or(err(span, msg))?.to_string(); match ident.as_str() { @@ -206,9 +207,25 @@ impl HostFn { } not_deprecated = false; }, + "mutable" => { + if mutable { + return Err(err(span, "#[mutable] can only be specified once")) + } + mutable = true; + }, _ => return Err(err(span, msg)), } } + + if mutable { + let stmt = syn::parse_quote! { + if ctx.ext.is_read_only() { + return Err(Error::::StateChangeDenied.into()); + } + }; + item.block.stmts.insert(0, stmt); + } + let name = item.sig.ident.to_string(); if !(is_stable || not_deprecated) { diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 54019ca9373d..75e317d1e5b6 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -362,6 +362,9 @@ pub trait Ext: sealing::Sealed { /// - [`Error::DelegateDependencyNotFound`] /// - [`Error::StateChangeDenied`] fn unlock_delegate_dependency(&mut self, code_hash: &CodeHash) -> DispatchResult; + + /// Check if running in read-only context. + fn is_read_only(&self) -> bool; } /// Describes the different functions that can be exported by an [`Executable`]. @@ -878,6 +881,7 @@ where value_transferred: BalanceOf, gas_limit: Weight, deposit_limit: BalanceOf, + read_only: bool, ) -> Result { if self.frames.len() == T::CallStack::size() { return Err(Error::::MaxCallDepthReached.into()) @@ -897,8 +901,6 @@ where let frame = top_frame_mut!(self); let nested_gas = &mut frame.nested_gas; let nested_storage = &mut frame.nested_storage; - // Inherit `read_only` flag from top frame. - let read_only = frame.read_only; let (frame, executable, _) = Self::new_frame( frame_args, value_transferred, @@ -1202,14 +1204,6 @@ where !self.frames().any(|f| &f.account_id == id && !f.allows_reentry) } - /// Checks if the state can be changed - fn allows_state_change(&self) -> DispatchResult { - if self.top_frame().read_only { - return Err(>::StateChangeDenied.into()) - } - Ok(()) - } - /// Increments and returns the next nonce. Pulls it from storage if it isn't in cache. fn next_nonce(&mut self) -> u64 { let next = self.nonce().wrapping_add(1); @@ -1241,10 +1235,7 @@ where self.top_frame_mut().allows_reentry = allows_reentry; // Enable read-only access if requested; cannot disable it if already set. - let set_frame_read_only = read_only && !self.top_frame().read_only; - if set_frame_read_only { - self.top_frame_mut().read_only = read_only; - } + let frame_read_only = read_only || self.top_frame().read_only; let try_call = || { if !self.allows_reentry(&to) { @@ -1252,8 +1243,8 @@ where } // If the call value is non-zero and state change is not allowed, issue an error. - if !value.is_zero() { - self.allows_state_change()?; + if !value.is_zero() && frame_read_only { + return Err(>::StateChangeDenied.into()); } // We ignore instantiate frames in our search for a cached contract. // Otherwise it would be possible to recursively call a contract from its own @@ -1270,6 +1261,7 @@ where value, gas_limit, deposit_limit, + frame_read_only, )?; self.run(executable, input_data) }; @@ -1280,11 +1272,6 @@ where // Protection is on a per call basis. self.top_frame_mut().allows_reentry = true; - if set_frame_read_only { - // Revert to the previous setting, if it was changed. - self.top_frame_mut().read_only = false; - } - result } @@ -1307,6 +1294,7 @@ where value, Weight::zero(), BalanceOf::::zero(), + self.top_frame().read_only, )?; self.run(executable, input_data) } @@ -1320,7 +1308,6 @@ where input_data: Vec, salt: &[u8], ) -> Result<(AccountIdOf, ExecReturnValue), ExecError> { - self.allows_state_change()?; let executable = E::from_storage(code_hash, self.gas_meter_mut())?; let nonce = self.next_nonce(); let executable = self.push_frame( @@ -1334,13 +1321,13 @@ where value, gas_limit, deposit_limit, + self.top_frame().read_only, )?; let account_id = self.top_frame().account_id.clone(); self.run(executable, input_data).map(|ret| (account_id, ret)) } fn terminate(&mut self, beneficiary: &AccountIdOf) -> DispatchResult { - self.allows_state_change()?; if self.is_recursive() { return Err(Error::::TerminatedWhileReentrant.into()) } @@ -1370,7 +1357,6 @@ where } fn transfer(&mut self, to: &T::AccountId, value: BalanceOf) -> DispatchResult { - self.allows_state_change()?; Self::transfer(Preservation::Preserve, &self.top_frame().account_id, to, value) } @@ -1388,7 +1374,6 @@ where value: Option>, take_old: bool, ) -> Result { - self.allows_state_change()?; let frame = self.top_frame_mut(); frame.contract_info.get(&frame.account_id).write( key.into(), @@ -1459,7 +1444,6 @@ where } fn deposit_event(&mut self, topics: Vec, data: Vec) -> DispatchResult { - self.allows_state_change()?; Contracts::::deposit_event( topics, Event::ContractEmitted { contract: self.top_frame().account_id.clone(), data }, @@ -1518,7 +1502,6 @@ where } fn call_runtime(&self, call: ::RuntimeCall) -> DispatchResultWithPostInfo { - self.allows_state_change()?; let mut origin: T::RuntimeOrigin = RawOrigin::Signed(self.address().clone()).into(); origin.add_filter(T::CallFilter::contains); call.dispatch(origin) @@ -1546,7 +1529,6 @@ where } fn set_code_hash(&mut self, hash: CodeHash) -> DispatchResult { - self.allows_state_change()?; let frame = top_frame_mut!(self); if !E::from_storage(hash, &mut frame.nested_gas)?.is_deterministic() { return Err(>::Indeterministic.into()) @@ -1620,7 +1602,6 @@ where } fn lock_delegate_dependency(&mut self, code_hash: CodeHash) -> DispatchResult { - self.allows_state_change()?; let frame = self.top_frame_mut(); let info = frame.contract_info.get(&frame.account_id); ensure!(code_hash != info.code_hash, Error::::CannotAddSelfAsDelegateDependency); @@ -1637,7 +1618,6 @@ where } fn unlock_delegate_dependency(&mut self, code_hash: &CodeHash) -> DispatchResult { - self.allows_state_change()?; let frame = self.top_frame_mut(); let info = frame.contract_info.get(&frame.account_id); @@ -1648,6 +1628,10 @@ where .charge_deposit(frame.account_id.clone(), StorageDeposit::Refund(deposit)); Ok(()) } + + fn is_read_only(&self) -> bool { + self.top_frame().read_only + } } mod sealing { @@ -3232,99 +3216,6 @@ mod tests { }); } - #[test] - fn read_only_call_with_set_storage_fails() { - let code_bob = MockLoader::insert(Call, |ctx, _| { - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) - }); - - let code_charlie = MockLoader::insert(Call, |ctx, _| { - ctx.ext.set_storage(&Key::Fix([1; 32]), Some(vec![1, 2, 3]), false)?; - exec_success() - }); - - ExtBuilder::default().build().execute_with(|| { - let schedule = ::Schedule::get(); - place_contract(&BOB, code_bob); - place_contract(&CHARLIE, code_charlie); - let contract_origin = Origin::from_account_id(ALICE); - let mut storage_meter = - storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); - - // If BOB calls CHARLIE with the read-only flag, CHARLIE cannot modify the storage, - // causing set_storage to fail. - assert_err!( - MockStack::run_call( - contract_origin, - BOB, - &mut GasMeter::::new(GAS_LIMIT), - &mut storage_meter, - &schedule, - 0, - vec![], - None, - Determinism::Enforced - ) - .map_err(|e| e.error), - >::StateChangeDenied, - ); - }); - } - - #[test] - fn read_only_subsequent_call_with_set_storage_fails() { - // Checks if the read-only flag is kept for subsequent calls. - let code_bob = MockLoader::insert(Call, |ctx, _| { - if ctx.input_data[0] == 0 { - ctx.ext.call( - Weight::zero(), - BalanceOf::::zero(), - CHARLIE, - 0, - vec![], - true, - true, - ) - } else { - ctx.ext.set_storage(&Key::Fix([1; 32]), Some(vec![1, 2, 3]), false)?; - exec_success() - } - }); - - let code_charlie = MockLoader::insert(Call, |ctx, _| { - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) - }); - - ExtBuilder::default().build().execute_with(|| { - let schedule = ::Schedule::get(); - place_contract(&BOB, code_bob); - place_contract(&CHARLIE, code_charlie); - let contract_origin = Origin::from_account_id(ALICE); - let mut storage_meter = - storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); - - // If BOB calls CHARLIE with the read-only flag, and CHARLIE calls back BOB, - // BOB cannot modify the storage, causing set_storage to fail. - assert_err!( - MockStack::run_call( - contract_origin, - BOB, - &mut GasMeter::::new(GAS_LIMIT), - &mut storage_meter, - &schedule, - 0, - vec![0], - None, - Determinism::Enforced - ) - .map_err(|e| e.error), - >::StateChangeDenied, - ); - }); - } - #[test] fn call_runtime_works() { let code_hash = MockLoader::insert(Call, |ctx, _| { diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 57f278bb2c3d..e3642d98a842 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -4263,9 +4263,67 @@ fn read_only_call_cannot_store() { let addr_callee = builder::bare_instantiate(Code::Upload(wasm_callee)).build_and_unwrap_account_id(); - // Read-only call fails when modifying storage + // Read-only call fails when modifying storage. assert_err_ignore_postinfo!( - builder::call(addr_caller).data((100u32, &addr_callee).encode()).build(), + builder::call(addr_caller).data((&addr_callee, 100u32).encode()).build(), + >::ContractTrapped + ); + }); +} + +#[test] +fn read_only_call_cannot_transfer() { + let (wasm_caller, _code_hash_caller) = + compile_module::("call_with_flags_and_value").unwrap(); + let (wasm_callee, _code_hash_callee) = compile_module::("dummy").unwrap(); + ExtBuilder::default().existential_deposit(200).build().execute_with(|| { + let _ = ::Currency::set_balance(&ALICE, 1_000_000); + + // Create both contracts: Constructors do nothing. + let addr_caller = + builder::bare_instantiate(Code::Upload(wasm_caller)).build_and_unwrap_account_id(); + let addr_callee = + builder::bare_instantiate(Code::Upload(wasm_callee)).build_and_unwrap_account_id(); + + // Read-only call fails when a non-zero value is set. + assert_err_ignore_postinfo!( + builder::call(addr_caller) + .data( + (addr_callee, pallet_contracts_uapi::CallFlags::READ_ONLY.bits(), 100u64) + .encode() + ) + .build(), + >::StateChangeDenied + ); + }); +} + +#[test] +fn read_only_subsequent_call_cannot_store() { + let (wasm_read_only_caller, _code_hash_caller) = + compile_module::("read_only_call").unwrap(); + let (wasm_caller, _code_hash_caller) = + compile_module::("call_with_flags_and_value").unwrap(); + let (wasm_callee, _code_hash_callee) = compile_module::("store_call").unwrap(); + ExtBuilder::default().existential_deposit(200).build().execute_with(|| { + let _ = ::Currency::set_balance(&ALICE, 1_000_000); + + // Create contracts: Constructors do nothing. + let addr_caller = builder::bare_instantiate(Code::Upload(wasm_read_only_caller)) + .build_and_unwrap_account_id(); + let addr_subsequent_caller = + builder::bare_instantiate(Code::Upload(wasm_caller)).build_and_unwrap_account_id(); + let addr_callee = + builder::bare_instantiate(Code::Upload(wasm_callee)).build_and_unwrap_account_id(); + + // Subsequent call input. + let input = (&addr_callee, pallet_contracts_uapi::CallFlags::empty().bits(), 0u64, 100u32); + + // Read-only call fails when modifying storage. + assert_err_ignore_postinfo!( + builder::call(addr_caller) + .data((&addr_subsequent_caller, input).encode()) + .build(), >::ContractTrapped ); }); @@ -4284,11 +4342,9 @@ fn read_only_call_works() { let addr_callee = builder::bare_instantiate(Code::Upload(wasm_callee)).build_and_unwrap_account_id(); - // Drop previous events + // Drop previous events. initialize_block(2); - assert_ok!(builder::call(addr_caller.clone()) - .data((100u32, &addr_callee).encode()) - .build()); + assert_ok!(builder::call(addr_caller.clone()).data(addr_callee.encode()).build()); assert_eq!( System::events(), diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 400099530ed7..3cd371948741 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -800,6 +800,10 @@ mod tests { self.delegate_dependencies.borrow_mut().remove(code); Ok(()) } + + fn is_read_only(&self) -> bool { + false + } } /// Execute the supplied code. diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index b761b6b2c9c0..bc58e57c3101 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -963,6 +963,7 @@ pub mod env { /// Set the value at the given key in the contract storage. /// See [`pallet_contracts_uapi::HostFn::set_storage`] #[prefixed_alias] + #[mutable] fn set_storage( ctx: _, memory: _, @@ -977,6 +978,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::set_storage_v1`] #[version(1)] #[prefixed_alias] + #[mutable] fn set_storage( ctx: _, memory: _, @@ -991,6 +993,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::set_storage_v2`] #[version(2)] #[prefixed_alias] + #[mutable] fn set_storage( ctx: _, memory: _, @@ -1005,6 +1008,7 @@ pub mod env { /// Clear the value at the given key in the contract storage. /// See [`pallet_contracts_uapi::HostFn::clear_storage`] #[prefixed_alias] + #[mutable] fn clear_storage(ctx: _, memory: _, key_ptr: u32) -> Result<(), TrapReason> { ctx.clear_storage(memory, KeyType::Fix, key_ptr).map(|_| ()) } @@ -1013,6 +1017,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::clear_storage_v1`] #[version(1)] #[prefixed_alias] + #[mutable] fn clear_storage(ctx: _, memory: _, key_ptr: u32, key_len: u32) -> Result { ctx.clear_storage(memory, KeyType::Var(key_len), key_ptr) } @@ -1063,6 +1068,7 @@ pub mod env { /// Retrieve and remove the value under the given key from storage. /// See [`pallet_contracts_uapi::HostFn::take_storage`] #[prefixed_alias] + #[mutable] fn take_storage( ctx: _, memory: _, @@ -1094,6 +1100,7 @@ pub mod env { /// Transfer some value to another account. /// See [`pallet_contracts_uapi::HostFn::transfer`]. #[prefixed_alias] + #[mutable] fn transfer( ctx: _, memory: _, @@ -1251,6 +1258,7 @@ pub mod env { /// of those types are fixed through [`codec::MaxEncodedLen`]. The fields exist /// for backwards compatibility. Consider switching to the newest version of this function. #[prefixed_alias] + #[mutable] fn instantiate( ctx: _, memory: _, @@ -1289,6 +1297,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::instantiate_v1`]. #[version(1)] #[prefixed_alias] + #[mutable] fn instantiate( ctx: _, memory: _, @@ -1324,6 +1333,7 @@ pub mod env { /// Instantiate a contract with the specified code hash. /// See [`pallet_contracts_uapi::HostFn::instantiate_v2`]. #[version(2)] + #[mutable] fn instantiate( ctx: _, memory: _, @@ -1367,6 +1377,7 @@ pub mod env { /// this type is fixed through `[`MaxEncodedLen`]. The field exist for backwards /// compatibility. Consider switching to the newest version of this function. #[prefixed_alias] + #[mutable] fn terminate( ctx: _, memory: _, @@ -1380,6 +1391,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::terminate_v1`]. #[version(1)] #[prefixed_alias] + #[mutable] fn terminate(ctx: _, memory: _, beneficiary_ptr: u32) -> Result<(), TrapReason> { ctx.terminate(memory, beneficiary_ptr) } @@ -1878,6 +1890,7 @@ pub mod env { /// Deposit a contract event with the data buffer and optional list of topics. /// See [pallet_contracts_uapi::HostFn::deposit_event] #[prefixed_alias] + #[mutable] fn deposit_event( ctx: _, memory: _, @@ -2056,6 +2069,7 @@ pub mod env { /// Call some dispatchable of the runtime. /// See [`frame_support::traits::call_runtime`]. + #[mutable] fn call_runtime( ctx: _, memory: _, @@ -2075,6 +2089,7 @@ pub mod env { /// Execute an XCM program locally, using the contract's address as the origin. /// See [`pallet_contracts_uapi::HostFn::execute_xcm`]. + #[mutable] fn xcm_execute( ctx: _, memory: _, @@ -2112,6 +2127,7 @@ pub mod env { /// Send an XCM program from the contract to the specified destination. /// See [`pallet_contracts_uapi::HostFn::send_xcm`]. + #[mutable] fn xcm_send( ctx: _, memory: _, @@ -2208,6 +2224,7 @@ pub mod env { /// Replace the contract code at the specified address with new code. /// See [`pallet_contracts_uapi::HostFn::set_code_hash`]. #[prefixed_alias] + #[mutable] fn set_code_hash(ctx: _, memory: _, code_hash_ptr: u32) -> Result { ctx.charge_gas(RuntimeCosts::SetCodeHash)?; let code_hash: CodeHash<::T> = @@ -2272,6 +2289,7 @@ pub mod env { /// Adds a new delegate dependency to the contract. /// See [`pallet_contracts_uapi::HostFn::lock_delegate_dependency`]. + #[mutable] fn lock_delegate_dependency(ctx: _, memory: _, code_hash_ptr: u32) -> Result<(), TrapReason> { ctx.charge_gas(RuntimeCosts::LockDelegateDependency)?; let code_hash = ctx.read_sandbox_memory_as(memory, code_hash_ptr)?; @@ -2281,6 +2299,7 @@ pub mod env { /// Removes the delegate dependency from the contract. /// see [`pallet_contracts_uapi::HostFn::unlock_delegate_dependency`]. + #[mutable] fn unlock_delegate_dependency(ctx: _, memory: _, code_hash_ptr: u32) -> Result<(), TrapReason> { ctx.charge_gas(RuntimeCosts::UnlockDelegateDependency)?; let code_hash = ctx.read_sandbox_memory_as(memory, code_hash_ptr)?; From 2eeed620f2101ff56169374f7a9034b8feb97b96 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 13 May 2024 15:53:33 +0200 Subject: [PATCH 15/29] Fmt --- .../fixtures/contracts/call_with_flags_and_value.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs b/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs index fc51ec2c9d3e..6a817ff6601a 100644 --- a/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs +++ b/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs @@ -41,10 +41,10 @@ pub extern "C" fn call() { api::call_v2( uapi::CallFlags::from_bits(flags).unwrap(), callee_addr, - 0u64, // How much ref_time to devote for the execution. 0 = all. - 0u64, // How much proof_size to devote for the execution. 0 = all. - None, // No deposit limit. - &value.to_le_bytes(), // Value transferred to the contract. + 0u64, // How much ref_time to devote for the execution. 0 = all. + 0u64, // How much proof_size to devote for the execution. 0 = all. + None, // No deposit limit. + &value.to_le_bytes(), // Value transferred to the contract. forwarded_input, None, ) From fc15cd69e415a23065ff2e03d4f9aa96fe7dad79 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 13 May 2024 16:22:34 +0200 Subject: [PATCH 16/29] Revert deposit_event implementation --- .../fixtures/contracts/call_with_flags_and_value.rs | 3 +-- substrate/frame/contracts/src/exec.rs | 5 ++--- substrate/frame/contracts/src/wasm/mod.rs | 4 ++-- substrate/frame/contracts/src/wasm/runtime.rs | 4 +++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs b/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs index 6a817ff6601a..16a85eff3989 100644 --- a/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs +++ b/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs @@ -15,8 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! This fixture calls the account_id with the 2D Weight limit. -//! It returns the result of the call as output data. +//! This fixture calls the account_id with the flags and value. #![no_std] #![no_main] diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 75e317d1e5b6..20bc6fcd8733 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -255,7 +255,7 @@ pub trait Ext: sealing::Sealed { /// Deposit an event with the given topics. /// /// There should not be any duplicates in `topics`. - fn deposit_event(&mut self, topics: Vec>, data: Vec) -> DispatchResult; + fn deposit_event(&mut self, topics: Vec>, data: Vec); /// Returns the current block number. fn block_number(&self) -> BlockNumberFor; @@ -1443,12 +1443,11 @@ where T::Currency::minimum_balance() } - fn deposit_event(&mut self, topics: Vec, data: Vec) -> DispatchResult { + fn deposit_event(&mut self, topics: Vec, data: Vec) { Contracts::::deposit_event( topics, Event::ContractEmitted { contract: self.top_frame().account_id.clone(), data }, ); - Ok(()) } fn block_number(&self) -> BlockNumberFor { diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 3cd371948741..b565f7c5f208 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -720,8 +720,8 @@ mod tests { fn random(&self, subject: &[u8]) -> (SeedOf, BlockNumberFor) { (H256::from_slice(subject), 42) } - fn deposit_event(&mut self, topics: Vec, data: Vec) -> DispatchResult { - Ok(self.events.push((topics, data))) + fn deposit_event(&mut self, topics: Vec, data: Vec) { + self.events.push((topics, data)) } fn block_number(&self) -> u64 { 121 diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index bc58e57c3101..120da7df8fc4 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -1919,7 +1919,9 @@ pub mod env { let event_data = ctx.read_sandbox_memory(memory, data_ptr, data_len)?; - Ok(ctx.ext.deposit_event(topics, event_data)?) + ctx.ext.deposit_event(topics, event_data); + + Ok(()) } /// Stores the current block number of the current contract into the supplied buffer. From 47f9d7656f0776dc3ba19e6dab2da267dc7c683a Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 14 May 2024 09:29:17 +0200 Subject: [PATCH 17/29] Cleanup --- substrate/frame/contracts/src/exec.rs | 42 +++++++++++++++++---------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 20bc6fcd8733..ed05a8bf4449 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -349,7 +349,6 @@ pub trait Ext: sealing::Sealed { /// - [`Error::MaxDelegateDependenciesReached`] /// - [`Error::CannotAddSelfAsDelegateDependency`] /// - [`Error::DelegateDependencyAlreadyExists`] - /// - [`Error::StateChangeDenied`] fn lock_delegate_dependency(&mut self, code_hash: CodeHash) -> DispatchResult; /// Removes a delegate dependency from [`ContractInfo`]'s `delegate_dependencies` field. @@ -360,7 +359,6 @@ pub trait Ext: sealing::Sealed { /// # Errors /// /// - [`Error::DelegateDependencyNotFound`] - /// - [`Error::StateChangeDenied`] fn unlock_delegate_dependency(&mut self, code_hash: &CodeHash) -> DispatchResult; /// Check if running in read-only context. @@ -996,7 +994,7 @@ where ); }, (ExportedFunction::Call, Some(code_hash)) => - if !frame.read_only { + if !self.is_read_only() { Contracts::::deposit_event( vec![T::Hashing::hash_of(account_id), T::Hashing::hash_of(&code_hash)], Event::DelegateCalled { contract: account_id.clone(), code_hash }, @@ -1009,7 +1007,7 @@ where let contract = frame.contract_info.as_contract(); frame.nested_storage.enforce_subcall_limit(contract)?; - if !frame.read_only { + if !self.is_read_only() { let caller = self.caller(); Contracts::::deposit_event( vec![T::Hashing::hash_of(&caller), T::Hashing::hash_of(&account_id)], @@ -1294,7 +1292,7 @@ where value, Weight::zero(), BalanceOf::::zero(), - self.top_frame().read_only, + self.is_read_only(), )?; self.run(executable, input_data) } @@ -1321,7 +1319,7 @@ where value, gas_limit, deposit_limit, - self.top_frame().read_only, + self.is_read_only(), )?; let account_id = self.top_frame().account_id.clone(); self.run(executable, input_data).map(|ret| (account_id, ret)) @@ -2142,9 +2140,15 @@ mod tests { let value = Default::default(); let recurse_ch = MockLoader::insert(Call, |ctx, _| { // Try to call into yourself. - let r = - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![], true, true); + let r = ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + BOB, + 0, + vec![], + true, + false, + ); ReachedBottom::mutate(|reached_bottom| { if !*reached_bottom { @@ -2210,7 +2214,7 @@ mod tests { 0, vec![], true, - true + false ), Ok(_) ); @@ -2358,7 +2362,7 @@ mod tests { assert!(ctx.ext.caller_is_origin()); // BOB calls CHARLIE ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, false) }); ExtBuilder::default().build().execute_with(|| { @@ -2457,7 +2461,7 @@ mod tests { assert!(ctx.ext.caller_is_root()); // BOB calls CHARLIE. ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, true) + .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true, false) }); ExtBuilder::default().build().execute_with(|| { @@ -2498,7 +2502,7 @@ mod tests { 0, vec![], true, - true + false ), Ok(_) ); @@ -2879,7 +2883,7 @@ mod tests { let code_charlie = MockLoader::insert(Call, |ctx, _| { assert!(ctx .ext - .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true, true) + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true, false) .is_ok()); exec_trapped() }); @@ -3405,7 +3409,15 @@ mod tests { // a plain call should not influence the account counter ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), account_id, 0, vec![], false, true) + .call( + Weight::zero(), + BalanceOf::::zero(), + account_id, + 0, + vec![], + false, + false, + ) .unwrap(); exec_success() From 76e50fc2f4d8b94651fd74e6f22de46476b0f90a Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 14 May 2024 12:34:20 +0200 Subject: [PATCH 18/29] Update chain extension description --- substrate/frame/contracts/src/chain_extension.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/substrate/frame/contracts/src/chain_extension.rs b/substrate/frame/contracts/src/chain_extension.rs index 8a7243d6bb37..10dd5b0e9c83 100644 --- a/substrate/frame/contracts/src/chain_extension.rs +++ b/substrate/frame/contracts/src/chain_extension.rs @@ -104,6 +104,11 @@ pub trait ChainExtension { /// chain extensions. It is called whenever a contract calls the `seal_call_chain_extension` /// imported wasm function. /// + /// Note that `seal_call_chain_extension` can be invoked within a read-only context, + /// where any state-changing calls are disallowed. This information can be obtained + /// using the call `env.ext().is_read_only()`. + /// It's crucial for the implementer to handle this scenario appropriately. + /// /// # Parameters /// - `env`: Access to the remaining arguments and the execution environment. /// From b6c378b0f53b7db280032df2bb04cf8921f92a57 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 14 May 2024 13:05:09 +0200 Subject: [PATCH 19/29] Improved description --- substrate/frame/contracts/src/chain_extension.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/substrate/frame/contracts/src/chain_extension.rs b/substrate/frame/contracts/src/chain_extension.rs index 10dd5b0e9c83..f3a67fcb09a0 100644 --- a/substrate/frame/contracts/src/chain_extension.rs +++ b/substrate/frame/contracts/src/chain_extension.rs @@ -104,11 +104,6 @@ pub trait ChainExtension { /// chain extensions. It is called whenever a contract calls the `seal_call_chain_extension` /// imported wasm function. /// - /// Note that `seal_call_chain_extension` can be invoked within a read-only context, - /// where any state-changing calls are disallowed. This information can be obtained - /// using the call `env.ext().is_read_only()`. - /// It's crucial for the implementer to handle this scenario appropriately. - /// /// # Parameters /// - `env`: Access to the remaining arguments and the execution environment. /// @@ -117,6 +112,12 @@ pub trait ChainExtension { /// In case of `Err` the contract execution is immediately suspended and the passed error /// is returned to the caller. Otherwise the value of [`RetVal`] determines the exit /// behaviour. + /// + /// # Note + /// + /// The [`Self::call`] can be invoked within a read-only context, where any state-changing calls + /// are disallowed. This information can be obtained using `env.ext().is_read_only()`. It is + /// crucial for the implementer to handle this scenario appropriately. fn call>(&mut self, env: Environment) -> Result; /// Determines whether chain extensions are enabled for this chain. From 70c654c5f8707292d68086708e04efd6d5912d0a Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Tue, 14 May 2024 18:58:02 +0200 Subject: [PATCH 20/29] Update prdoc --- prdoc/pr_4418.prdoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prdoc/pr_4418.prdoc b/prdoc/pr_4418.prdoc index 95ef3111e745..4372692b2b98 100644 --- a/prdoc/pr_4418.prdoc +++ b/prdoc/pr_4418.prdoc @@ -15,3 +15,5 @@ crates: bump: minor - name: pallet-contracts-uapi bump: minor + - name: pallet-contracts-proc-macro + bump: minor From f10a0dbdb7239354b2a54427413f1876b728a838 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 15 May 2024 08:29:16 +0200 Subject: [PATCH 21/29] Update substrate/frame/contracts/proc-macro/src/lib.rs Co-authored-by: Andrew Jones --- substrate/frame/contracts/proc-macro/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/proc-macro/src/lib.rs b/substrate/frame/contracts/proc-macro/src/lib.rs index b38a8a3d6cec..30b04d298a8c 100644 --- a/substrate/frame/contracts/proc-macro/src/lib.rs +++ b/substrate/frame/contracts/proc-macro/src/lib.rs @@ -219,7 +219,7 @@ impl HostFn { if mutable { let stmt = syn::parse_quote! { - if ctx.ext.is_read_only() { + if ctx.ext().is_read_only() { return Err(Error::::StateChangeDenied.into()); } }; From ac65bd7902c16064ef135f8a0d412c23262c8c15 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 15 May 2024 13:32:49 +0200 Subject: [PATCH 22/29] Update substrate/frame/contracts/uapi/src/flags.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- substrate/frame/contracts/uapi/src/flags.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/uapi/src/flags.rs b/substrate/frame/contracts/uapi/src/flags.rs index 89c692a2a933..e6dfdeaedfa7 100644 --- a/substrate/frame/contracts/uapi/src/flags.rs +++ b/substrate/frame/contracts/uapi/src/flags.rs @@ -70,7 +70,7 @@ bitflags! { /// [`Error::InvalidCallFlags`] is returned. const ALLOW_REENTRY = 0b0000_1000; /// Indicates that the callee is restricted from modifying the state during call execution, - /// equivalent to Ethereum's STATICCALL + /// equivalent to Ethereum's STATICCALL. /// /// # Note /// From b4ad72b4972bd8d4dd5e67580e33e90499e9afb0 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 15 May 2024 13:38:16 +0200 Subject: [PATCH 23/29] Update substrate/frame/contracts/src/lib.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- substrate/frame/contracts/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index b3d945cecbd1..ce2e7321707d 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -1202,8 +1202,7 @@ pub mod pallet { /// into `pallet-contracts`. This would make the whole pallet reentrant with regard to /// contract code execution which is not supported. ReentranceDenied, - /// A contract attempted to invoke a call that is flagged as read-only, and inside that - /// call, a state-changing call happened. + /// A contract attempted to invoke a state modifying API while being in read-only mode. StateChangeDenied, /// Origin doesn't have enough balance to pay the required storage deposits. StorageDepositNotEnoughFunds, From fb8b2dcb3546145d3240b33900be1e490d469d03 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 15 May 2024 13:41:19 +0200 Subject: [PATCH 24/29] Update substrate/frame/contracts/src/exec.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- substrate/frame/contracts/src/exec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index ed05a8bf4449..2357c5e52bd0 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -1233,7 +1233,7 @@ where self.top_frame_mut().allows_reentry = allows_reentry; // Enable read-only access if requested; cannot disable it if already set. - let frame_read_only = read_only || self.top_frame().read_only; + let read_only = read_only || self.top_frame().read_only; let try_call = || { if !self.allows_reentry(&to) { From 03a77bb1c57bf39a92ae3ec7fd68a5293d4e04ea Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 15 May 2024 15:54:06 +0200 Subject: [PATCH 25/29] Update substrate/frame/contracts/src/wasm/runtime.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- substrate/frame/contracts/src/wasm/runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 120da7df8fc4..fdd18def03e1 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -855,7 +855,7 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { ) }, CallType::DelegateCall { code_hash_ptr } => { - if flags.contains(CallFlags::ALLOW_REENTRY | CallFlags::READ_ONLY) { + if flags.intersects(CallFlags::ALLOW_REENTRY | CallFlags::READ_ONLY) { return Err(Error::::InvalidCallFlags.into()) } let code_hash = self.read_sandbox_memory_as(memory, code_hash_ptr)?; From 08b4ca70c7a2c8d6556178cecb45bbb2a18f5e11 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Wed, 15 May 2024 16:26:00 +0200 Subject: [PATCH 26/29] Address comments --- .../frame/contracts/proc-macro/src/lib.rs | 14 +++---- substrate/frame/contracts/src/exec.rs | 29 +++++++------- substrate/frame/contracts/src/tests.rs | 14 ------- substrate/frame/contracts/src/wasm/runtime.rs | 38 +++++++++---------- 4 files changed, 39 insertions(+), 56 deletions(-) diff --git a/substrate/frame/contracts/proc-macro/src/lib.rs b/substrate/frame/contracts/proc-macro/src/lib.rs index 30b04d298a8c..26fb3cdfd281 100644 --- a/substrate/frame/contracts/proc-macro/src/lib.rs +++ b/substrate/frame/contracts/proc-macro/src/lib.rs @@ -169,7 +169,7 @@ impl HostFn { // process attributes let msg = - "only #[version()], #[unstable], #[prefixed_alias], #[deprecated] and #[mutable] attributes are allowed."; + "only #[version()], #[unstable], #[prefixed_alias], #[deprecated] and #[mutating] attributes are allowed."; let span = item.span(); let mut attrs = item.attrs.clone(); attrs.retain(|a| !a.path().is_ident("doc")); @@ -177,7 +177,7 @@ impl HostFn { let mut is_stable = true; let mut alias_to = None; let mut not_deprecated = true; - let mut mutable = false; + let mut mutating = false; while let Some(attr) = attrs.pop() { let ident = attr.path().get_ident().ok_or(err(span, msg))?.to_string(); match ident.as_str() { @@ -207,17 +207,17 @@ impl HostFn { } not_deprecated = false; }, - "mutable" => { - if mutable { - return Err(err(span, "#[mutable] can only be specified once")) + "mutating" => { + if mutating { + return Err(err(span, "#[mutating] can only be specified once")) } - mutable = true; + mutating = true; }, _ => return Err(err(span, msg)), } } - if mutable { + if mutating { let stmt = syn::parse_quote! { if ctx.ext().is_read_only() { return Err(Error::::StateChangeDenied.into()); diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 2357c5e52bd0..b0fe191d63a6 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -993,13 +993,12 @@ where Event::Instantiated { deployer: caller, contract: account_id.clone() }, ); }, - (ExportedFunction::Call, Some(code_hash)) => - if !self.is_read_only() { - Contracts::::deposit_event( - vec![T::Hashing::hash_of(account_id), T::Hashing::hash_of(&code_hash)], - Event::DelegateCalled { contract: account_id.clone(), code_hash }, - ); - }, + (ExportedFunction::Call, Some(code_hash)) => { + Contracts::::deposit_event( + vec![T::Hashing::hash_of(account_id), T::Hashing::hash_of(&code_hash)], + Event::DelegateCalled { contract: account_id.clone(), code_hash }, + ); + }, (ExportedFunction::Call, None) => { // If a special limit was set for the sub-call, we enforce it here. // The sub-call will be rolled back in case the limit is exhausted. @@ -1007,13 +1006,11 @@ where let contract = frame.contract_info.as_contract(); frame.nested_storage.enforce_subcall_limit(contract)?; - if !self.is_read_only() { - let caller = self.caller(); - Contracts::::deposit_event( - vec![T::Hashing::hash_of(&caller), T::Hashing::hash_of(&account_id)], - Event::Called { caller: caller.clone(), contract: account_id.clone() }, - ); - } + let caller = self.caller(); + Contracts::::deposit_event( + vec![T::Hashing::hash_of(&caller), T::Hashing::hash_of(&account_id)], + Event::Called { caller: caller.clone(), contract: account_id.clone() }, + ); }, } @@ -1241,7 +1238,7 @@ where } // If the call value is non-zero and state change is not allowed, issue an error. - if !value.is_zero() && frame_read_only { + if !value.is_zero() && read_only { return Err(>::StateChangeDenied.into()); } // We ignore instantiate frames in our search for a cached contract. @@ -1259,7 +1256,7 @@ where value, gas_limit, deposit_limit, - frame_read_only, + read_only, )?; self.run(executable, input_data) }; diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index e3642d98a842..d92c965cf088 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -4342,20 +4342,6 @@ fn read_only_call_works() { let addr_callee = builder::bare_instantiate(Code::Upload(wasm_callee)).build_and_unwrap_account_id(); - // Drop previous events. - initialize_block(2); assert_ok!(builder::call(addr_caller.clone()).data(addr_callee.encode()).build()); - - assert_eq!( - System::events(), - vec![EventRecord { - phase: Phase::Initialization, - event: RuntimeEvent::Contracts(crate::Event::Called { - caller: Origin::from_account_id(ALICE), - contract: addr_caller.clone(), - }), - topics: vec![hash(&Origin::::from_account_id(ALICE)), hash(&addr_caller)], - },] - ); }); } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index fdd18def03e1..e201df2bb8b1 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -963,7 +963,7 @@ pub mod env { /// Set the value at the given key in the contract storage. /// See [`pallet_contracts_uapi::HostFn::set_storage`] #[prefixed_alias] - #[mutable] + #[mutating] fn set_storage( ctx: _, memory: _, @@ -978,7 +978,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::set_storage_v1`] #[version(1)] #[prefixed_alias] - #[mutable] + #[mutating] fn set_storage( ctx: _, memory: _, @@ -993,7 +993,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::set_storage_v2`] #[version(2)] #[prefixed_alias] - #[mutable] + #[mutating] fn set_storage( ctx: _, memory: _, @@ -1008,7 +1008,7 @@ pub mod env { /// Clear the value at the given key in the contract storage. /// See [`pallet_contracts_uapi::HostFn::clear_storage`] #[prefixed_alias] - #[mutable] + #[mutating] fn clear_storage(ctx: _, memory: _, key_ptr: u32) -> Result<(), TrapReason> { ctx.clear_storage(memory, KeyType::Fix, key_ptr).map(|_| ()) } @@ -1017,7 +1017,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::clear_storage_v1`] #[version(1)] #[prefixed_alias] - #[mutable] + #[mutating] fn clear_storage(ctx: _, memory: _, key_ptr: u32, key_len: u32) -> Result { ctx.clear_storage(memory, KeyType::Var(key_len), key_ptr) } @@ -1068,7 +1068,7 @@ pub mod env { /// Retrieve and remove the value under the given key from storage. /// See [`pallet_contracts_uapi::HostFn::take_storage`] #[prefixed_alias] - #[mutable] + #[mutating] fn take_storage( ctx: _, memory: _, @@ -1100,7 +1100,7 @@ pub mod env { /// Transfer some value to another account. /// See [`pallet_contracts_uapi::HostFn::transfer`]. #[prefixed_alias] - #[mutable] + #[mutating] fn transfer( ctx: _, memory: _, @@ -1258,7 +1258,7 @@ pub mod env { /// of those types are fixed through [`codec::MaxEncodedLen`]. The fields exist /// for backwards compatibility. Consider switching to the newest version of this function. #[prefixed_alias] - #[mutable] + #[mutating] fn instantiate( ctx: _, memory: _, @@ -1297,7 +1297,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::instantiate_v1`]. #[version(1)] #[prefixed_alias] - #[mutable] + #[mutating] fn instantiate( ctx: _, memory: _, @@ -1333,7 +1333,7 @@ pub mod env { /// Instantiate a contract with the specified code hash. /// See [`pallet_contracts_uapi::HostFn::instantiate_v2`]. #[version(2)] - #[mutable] + #[mutating] fn instantiate( ctx: _, memory: _, @@ -1377,7 +1377,7 @@ pub mod env { /// this type is fixed through `[`MaxEncodedLen`]. The field exist for backwards /// compatibility. Consider switching to the newest version of this function. #[prefixed_alias] - #[mutable] + #[mutating] fn terminate( ctx: _, memory: _, @@ -1391,7 +1391,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::terminate_v1`]. #[version(1)] #[prefixed_alias] - #[mutable] + #[mutating] fn terminate(ctx: _, memory: _, beneficiary_ptr: u32) -> Result<(), TrapReason> { ctx.terminate(memory, beneficiary_ptr) } @@ -1890,7 +1890,7 @@ pub mod env { /// Deposit a contract event with the data buffer and optional list of topics. /// See [pallet_contracts_uapi::HostFn::deposit_event] #[prefixed_alias] - #[mutable] + #[mutating] fn deposit_event( ctx: _, memory: _, @@ -2071,7 +2071,7 @@ pub mod env { /// Call some dispatchable of the runtime. /// See [`frame_support::traits::call_runtime`]. - #[mutable] + #[mutating] fn call_runtime( ctx: _, memory: _, @@ -2091,7 +2091,7 @@ pub mod env { /// Execute an XCM program locally, using the contract's address as the origin. /// See [`pallet_contracts_uapi::HostFn::execute_xcm`]. - #[mutable] + #[mutating] fn xcm_execute( ctx: _, memory: _, @@ -2129,7 +2129,7 @@ pub mod env { /// Send an XCM program from the contract to the specified destination. /// See [`pallet_contracts_uapi::HostFn::send_xcm`]. - #[mutable] + #[mutating] fn xcm_send( ctx: _, memory: _, @@ -2226,7 +2226,7 @@ pub mod env { /// Replace the contract code at the specified address with new code. /// See [`pallet_contracts_uapi::HostFn::set_code_hash`]. #[prefixed_alias] - #[mutable] + #[mutating] fn set_code_hash(ctx: _, memory: _, code_hash_ptr: u32) -> Result { ctx.charge_gas(RuntimeCosts::SetCodeHash)?; let code_hash: CodeHash<::T> = @@ -2291,7 +2291,7 @@ pub mod env { /// Adds a new delegate dependency to the contract. /// See [`pallet_contracts_uapi::HostFn::lock_delegate_dependency`]. - #[mutable] + #[mutating] fn lock_delegate_dependency(ctx: _, memory: _, code_hash_ptr: u32) -> Result<(), TrapReason> { ctx.charge_gas(RuntimeCosts::LockDelegateDependency)?; let code_hash = ctx.read_sandbox_memory_as(memory, code_hash_ptr)?; @@ -2301,7 +2301,7 @@ pub mod env { /// Removes the delegate dependency from the contract. /// see [`pallet_contracts_uapi::HostFn::unlock_delegate_dependency`]. - #[mutable] + #[mutating] fn unlock_delegate_dependency(ctx: _, memory: _, code_hash_ptr: u32) -> Result<(), TrapReason> { ctx.charge_gas(RuntimeCosts::UnlockDelegateDependency)?; let code_hash = ctx.read_sandbox_memory_as(memory, code_hash_ptr)?; From b3571d7df270f512da276df8293523be8a85d092 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Thu, 16 May 2024 15:00:01 +0200 Subject: [PATCH 27/29] Move read-only condition to runtime --- substrate/frame/contracts/src/exec.rs | 66 +------------------ substrate/frame/contracts/src/wasm/runtime.rs | 8 ++- 2 files changed, 9 insertions(+), 65 deletions(-) diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index b0fe191d63a6..d7a357cb42df 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -1229,18 +1229,11 @@ where // is caught by it. self.top_frame_mut().allows_reentry = allows_reentry; - // Enable read-only access if requested; cannot disable it if already set. - let read_only = read_only || self.top_frame().read_only; - let try_call = || { if !self.allows_reentry(&to) { return Err(>::ReentranceDenied.into()) } - // If the call value is non-zero and state change is not allowed, issue an error. - if !value.is_zero() && read_only { - return Err(>::StateChangeDenied.into()); - } // We ignore instantiate frames in our search for a cached contract. // Otherwise it would be possible to recursively call a contract from its own // constructor: We disallow calling not fully constructed contracts. @@ -1256,7 +1249,8 @@ where value, gas_limit, deposit_limit, - read_only, + // Enable read-only access if requested; cannot disable it if already set. + read_only || self.is_read_only(), )?; self.run(executable, input_data) }; @@ -3160,62 +3154,6 @@ mod tests { }); } - #[test] - fn read_only_call_with_non_zero_value_fails() { - let code_bob = MockLoader::insert(Call, |ctx, _| { - ctx.ext.call( - Weight::zero(), - BalanceOf::::zero(), - CHARLIE, - ctx.input_data[0] as u64, - vec![], - true, - true, - ) - }); - - let code_charlie = MockLoader::insert(Call, |_, _| exec_success()); - - ExtBuilder::default().build().execute_with(|| { - let schedule = ::Schedule::get(); - place_contract(&BOB, code_bob); - place_contract(&CHARLIE, code_charlie); - let contract_origin = Origin::from_account_id(ALICE); - let mut storage_meter = - storage::meter::Meter::new(&contract_origin, Some(0), 0).unwrap(); - - // BOB calls CHARLIE with read-only flag and zero value - assert_ok!(MockStack::run_call( - contract_origin.clone(), - BOB, - &mut GasMeter::::new(GAS_LIMIT), - &mut storage_meter, - &schedule, - 0, - vec![0], - None, - Determinism::Enforced - )); - - // BOB calls CHARLIE with read-only flag and non zero value - assert_err!( - MockStack::run_call( - contract_origin, - BOB, - &mut GasMeter::::new(GAS_LIMIT), - &mut storage_meter, - &schedule, - 0, - vec![1], - None, - Determinism::Enforced - ) - .map_err(|e| e.error), - >::StateChangeDenied, - ); - }); - } - #[test] fn call_runtime_works() { let code_hash = MockLoader::insert(Call, |ctx, _| { diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index e201df2bb8b1..6b26a7df5212 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -839,9 +839,15 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { } else { self.read_sandbox_memory_as(memory, deposit_ptr)? }; + let read_only = flags.contains(CallFlags::READ_ONLY); let value: BalanceOf<::T> = self.read_sandbox_memory_as(memory, value_ptr)?; if value > 0u32.into() { + // If the call value is non-zero and state change is not allowed, issue an + // error. + if read_only || self.ext.is_read_only() { + return Err(Error::::StateChangeDenied.into()); + } self.charge_gas(RuntimeCosts::CallSurchargeTransfer)?; } self.ext.call( @@ -851,7 +857,7 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { value, input_data, flags.contains(CallFlags::ALLOW_REENTRY), - flags.contains(CallFlags::READ_ONLY), + read_only, ) }, CallType::DelegateCall { code_hash_ptr } => { From 2cb80846c41808a9df667ee1452793b2955e9563 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Tue, 28 May 2024 20:47:55 +0000 Subject: [PATCH 28/29] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts --- substrate/frame/contracts/src/weights.rs | 786 +++++++++++------------ 1 file changed, 391 insertions(+), 395 deletions(-) diff --git a/substrate/frame/contracts/src/weights.rs b/substrate/frame/contracts/src/weights.rs index 2e9c2cd15af8..98b41eda964c 100644 --- a/substrate/frame/contracts/src/weights.rs +++ b/substrate/frame/contracts/src/weights.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for `pallet_contracts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-05-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-05-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `runner-vicqj8em-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` @@ -127,8 +127,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(2_142_000, 1627) + // Minimum execution time: 1_960_000 picoseconds. + Weight::from_parts(2_043_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -138,10 +138,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 12_095_000 picoseconds. - Weight::from_parts(12_699_000, 442) - // Standard Error: 891 - .saturating_add(Weight::from_parts(1_114_063, 0).saturating_mul(k.into())) + // Minimum execution time: 11_574_000 picoseconds. + Weight::from_parts(11_846_000, 442) + // Standard Error: 1_342 + .saturating_add(Weight::from_parts(1_113_844, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -155,10 +155,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 8_433_000 picoseconds. - Weight::from_parts(8_992_328, 6149) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_207, 0).saturating_mul(c.into())) + // Minimum execution time: 7_709_000 picoseconds. + Weight::from_parts(5_068_795, 6149) + // Standard Error: 5 + .saturating_add(Weight::from_parts(1_689, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -171,8 +171,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_415_000 picoseconds. - Weight::from_parts(17_348_000, 6450) + // Minimum execution time: 16_477_000 picoseconds. + Weight::from_parts(17_313_000, 6450) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -185,10 +185,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_433_000 picoseconds. - Weight::from_parts(3_490_000, 3635) - // Standard Error: 1_043 - .saturating_add(Weight::from_parts(1_225_953, 0).saturating_mul(k.into())) + // Minimum execution time: 3_111_000 picoseconds. + Weight::from_parts(3_198_000, 3635) + // Standard Error: 593 + .saturating_add(Weight::from_parts(1_081_746, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -207,10 +207,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 16_421_000 picoseconds. - Weight::from_parts(16_822_963, 6263) - // Standard Error: 0 - .saturating_add(Weight::from_parts(456, 0).saturating_mul(c.into())) + // Minimum execution time: 15_390_000 picoseconds. + Weight::from_parts(16_157_208, 6263) + // Standard Error: 1 + .saturating_add(Weight::from_parts(501, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -221,8 +221,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_569_000 picoseconds. - Weight::from_parts(13_277_000, 6380) + // Minimum execution time: 12_045_000 picoseconds. + Weight::from_parts(12_892_000, 6380) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -236,8 +236,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 46_777_000 picoseconds. - Weight::from_parts(47_690_000, 6292) + // Minimum execution time: 47_250_000 picoseconds. + Weight::from_parts(49_231_000, 6292) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -249,8 +249,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 55_280_000 picoseconds. - Weight::from_parts(57_081_000, 6534) + // Minimum execution time: 53_722_000 picoseconds. + Weight::from_parts(55_268_000, 6534) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -260,8 +260,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 12_077_000 picoseconds. - Weight::from_parts(12_647_000, 6349) + // Minimum execution time: 11_707_000 picoseconds. + Weight::from_parts(12_305_000, 6349) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -271,8 +271,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_559_000 picoseconds. - Weight::from_parts(2_711_000, 1627) + // Minimum execution time: 2_129_000 picoseconds. + Weight::from_parts(2_197_000, 1627) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -284,8 +284,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 12_238_000 picoseconds. - Weight::from_parts(12_627_000, 3631) + // Minimum execution time: 11_145_000 picoseconds. + Weight::from_parts(11_445_000, 3631) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -295,8 +295,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_836_000 picoseconds. - Weight::from_parts(5_086_000, 3607) + // Minimum execution time: 4_463_000 picoseconds. + Weight::from_parts(4_585_000, 3607) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -307,8 +307,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 6_147_000 picoseconds. - Weight::from_parts(6_380_000, 3632) + // Minimum execution time: 5_639_000 picoseconds. + Weight::from_parts(5_865_000, 3632) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -319,8 +319,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 6_140_000 picoseconds. - Weight::from_parts(6_670_000, 3607) + // Minimum execution time: 5_540_000 picoseconds. + Weight::from_parts(5_954_000, 3607) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -341,10 +341,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 354_459_000 picoseconds. - Weight::from_parts(332_397_871, 4264) - // Standard Error: 70 - .saturating_add(Weight::from_parts(33_775, 0).saturating_mul(c.into())) + // Minimum execution time: 353_812_000 picoseconds. + Weight::from_parts(337_889_300, 4264) + // Standard Error: 94 + .saturating_add(Weight::from_parts(34_200, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -372,14 +372,14 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_239_452_000 picoseconds. - Weight::from_parts(800_849_282, 6262) - // Standard Error: 117 - .saturating_add(Weight::from_parts(68_435, 0).saturating_mul(c.into())) - // Standard Error: 14 - .saturating_add(Weight::from_parts(1_653, 0).saturating_mul(i.into())) - // Standard Error: 14 - .saturating_add(Weight::from_parts(1_668, 0).saturating_mul(s.into())) + // Minimum execution time: 4_499_852_000 picoseconds. + Weight::from_parts(135_265_841, 6262) + // Standard Error: 247 + .saturating_add(Weight::from_parts(72_051, 0).saturating_mul(c.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(2_180, 0).saturating_mul(i.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(2_195, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -405,12 +405,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_085_570_000 picoseconds. - Weight::from_parts(2_112_501_000, 4029) - // Standard Error: 26 - .saturating_add(Weight::from_parts(888, 0).saturating_mul(i.into())) - // Standard Error: 26 - .saturating_add(Weight::from_parts(795, 0).saturating_mul(s.into())) + // Minimum execution time: 2_376_075_000 picoseconds. + Weight::from_parts(2_387_885_000, 4029) + // Standard Error: 32 + .saturating_add(Weight::from_parts(1_036, 0).saturating_mul(i.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(936, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -430,8 +430,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 201_900_000 picoseconds. - Weight::from_parts(206_738_000, 4291) + // Minimum execution time: 197_222_000 picoseconds. + Weight::from_parts(203_633_000, 4291) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -448,10 +448,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 330_704_000 picoseconds. - Weight::from_parts(345_129_342, 3607) - // Standard Error: 51 - .saturating_add(Weight::from_parts(33_126, 0).saturating_mul(c.into())) + // Minimum execution time: 325_788_000 picoseconds. + Weight::from_parts(335_491_760, 3607) + // Standard Error: 50 + .saturating_add(Weight::from_parts(35_337, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -468,10 +468,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 343_339_000 picoseconds. - Weight::from_parts(356_479_729, 3607) - // Standard Error: 49 - .saturating_add(Weight::from_parts(33_404, 0).saturating_mul(c.into())) + // Minimum execution time: 336_010_000 picoseconds. + Weight::from_parts(348_030_264, 3607) + // Standard Error: 43 + .saturating_add(Weight::from_parts(35_696, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -487,8 +487,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 42_241_000 picoseconds. - Weight::from_parts(43_365_000, 3780) + // Minimum execution time: 40_118_000 picoseconds. + Weight::from_parts(40_987_000, 3780) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -502,8 +502,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 26_318_000 picoseconds. - Weight::from_parts(27_840_000, 6492) + // Minimum execution time: 25_236_000 picoseconds. + Weight::from_parts(26_450_000, 6492) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -512,17 +512,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_397_000 picoseconds. - Weight::from_parts(9_318_986, 0) - // Standard Error: 72 - .saturating_add(Weight::from_parts(72_994, 0).saturating_mul(r.into())) + // Minimum execution time: 9_200_000 picoseconds. + Weight::from_parts(9_773_983, 0) + // Standard Error: 74 + .saturating_add(Weight::from_parts(72_257, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 644_000 picoseconds. - Weight::from_parts(687_000, 0) + // Minimum execution time: 606_000 picoseconds. + Weight::from_parts(672_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -530,8 +530,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_465_000 picoseconds. - Weight::from_parts(6_850_000, 3819) + // Minimum execution time: 6_260_000 picoseconds. + Weight::from_parts(6_645_000, 3819) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -540,79 +540,79 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_735_000 picoseconds. - Weight::from_parts(8_115_000, 3912) + // Minimum execution time: 7_599_000 picoseconds. + Weight::from_parts(7_913_000, 3912) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 717_000 picoseconds. - Weight::from_parts(791_000, 0) + // Minimum execution time: 772_000 picoseconds. + Weight::from_parts(852_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 365_000 picoseconds. - Weight::from_parts(427_000, 0) + // Minimum execution time: 390_000 picoseconds. + Weight::from_parts(417_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 331_000 picoseconds. - Weight::from_parts(363_000, 0) + // Minimum execution time: 340_000 picoseconds. + Weight::from_parts(368_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 586_000 picoseconds. - Weight::from_parts(625_000, 0) + // Minimum execution time: 640_000 picoseconds. + Weight::from_parts(672_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 680_000 picoseconds. - Weight::from_parts(734_000, 0) + // Minimum execution time: 607_000 picoseconds. + Weight::from_parts(699_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_732_000 picoseconds. - Weight::from_parts(5_008_000, 0) + // Minimum execution time: 4_519_000 picoseconds. + Weight::from_parts(4_668_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 608_000 picoseconds. - Weight::from_parts(635_000, 0) + // Minimum execution time: 600_000 picoseconds. + Weight::from_parts(639_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 571_000 picoseconds. - Weight::from_parts(606_000, 0) + // Minimum execution time: 579_000 picoseconds. + Weight::from_parts(609_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 511_000 picoseconds. - Weight::from_parts(584_000, 0) + // Minimum execution time: 575_000 picoseconds. + Weight::from_parts(613_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 552_000 picoseconds. - Weight::from_parts(612_000, 0) + // Minimum execution time: 554_000 picoseconds. + Weight::from_parts(622_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -620,8 +620,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_396_000 picoseconds. - Weight::from_parts(4_630_000, 1552) + // Minimum execution time: 4_265_000 picoseconds. + Weight::from_parts(4_525_000, 1552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -629,8 +629,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 494_000 picoseconds. - Weight::from_parts(510_000, 0) + // Minimum execution time: 512_000 picoseconds. + Weight::from_parts(524_000, 0) // Standard Error: 3 .saturating_add(Weight::from_parts(303, 0).saturating_mul(n.into())) } @@ -639,10 +639,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 311_000 picoseconds. - Weight::from_parts(346_000, 0) + // Minimum execution time: 358_000 picoseconds. + Weight::from_parts(375_000, 0) // Standard Error: 9 - .saturating_add(Weight::from_parts(480, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(481, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -655,10 +655,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 14_403_000 picoseconds. - Weight::from_parts(16_478_113, 3784) - // Standard Error: 6_667 - .saturating_add(Weight::from_parts(3_641_603, 0).saturating_mul(n.into())) + // Minimum execution time: 13_267_000 picoseconds. + Weight::from_parts(15_705_698, 3784) + // Standard Error: 7_176 + .saturating_add(Weight::from_parts(3_506_583, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -671,8 +671,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_639_000 picoseconds. - Weight::from_parts(3_801_000, 1561) + // Minimum execution time: 3_339_000 picoseconds. + Weight::from_parts(3_544_000, 1561) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -683,12 +683,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 4_102_000 picoseconds. - Weight::from_parts(4_256_984, 990) - // Standard Error: 6_777 - .saturating_add(Weight::from_parts(2_331_893, 0).saturating_mul(t.into())) + // Minimum execution time: 3_789_000 picoseconds. + Weight::from_parts(4_070_991, 990) + // Standard Error: 6_319 + .saturating_add(Weight::from_parts(2_264_078, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(31, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(20, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -698,10 +698,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 385_000 picoseconds. - Weight::from_parts(427_000, 0) + // Minimum execution time: 426_000 picoseconds. + Weight::from_parts(465_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_272, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_277, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -711,12 +711,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 10_128_000 picoseconds. - Weight::from_parts(9_963_519, 249) - // Standard Error: 1 - .saturating_add(Weight::from_parts(327, 0).saturating_mul(n.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(58, 0).saturating_mul(o.into())) + // Minimum execution time: 9_148_000 picoseconds. + Weight::from_parts(8_789_382, 249) + // Standard Error: 2 + .saturating_add(Weight::from_parts(361, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(66, 0).saturating_mul(o.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -728,10 +728,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_921_000 picoseconds. - Weight::from_parts(9_290_526, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(77, 0).saturating_mul(n.into())) + // Minimum execution time: 7_344_000 picoseconds. + Weight::from_parts(8_119_197, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(83, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -743,10 +743,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_403_000 picoseconds. - Weight::from_parts(8_815_037, 248) - // Standard Error: 3 - .saturating_add(Weight::from_parts(701, 0).saturating_mul(n.into())) + // Minimum execution time: 6_763_000 picoseconds. + Weight::from_parts(7_669_781, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(710, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -757,10 +757,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_590_000 picoseconds. - Weight::from_parts(7_949_861, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(76, 0).saturating_mul(n.into())) + // Minimum execution time: 6_310_000 picoseconds. + Weight::from_parts(7_039_085, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(84, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -771,10 +771,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_900_000 picoseconds. - Weight::from_parts(9_988_151, 248) - // Standard Error: 3 - .saturating_add(Weight::from_parts(703, 0).saturating_mul(n.into())) + // Minimum execution time: 7_541_000 picoseconds. + Weight::from_parts(8_559_509, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(711, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -783,8 +783,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 9_023_000 picoseconds. - Weight::from_parts(9_375_000, 0) + // Minimum execution time: 8_728_000 picoseconds. + Weight::from_parts(9_035_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -800,12 +800,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 157_109_000 picoseconds. - Weight::from_parts(159_458_069, 4085) - // Standard Error: 339_702 - .saturating_add(Weight::from_parts(44_066_869, 0).saturating_mul(t.into())) + // Minimum execution time: 153_385_000 picoseconds. + Weight::from_parts(156_813_102, 4085) + // Standard Error: 290_142 + .saturating_add(Weight::from_parts(42_350_253, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(6, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(4, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -820,8 +820,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 143_384_000 picoseconds. - Weight::from_parts(147_554_000, 3895) + // Minimum execution time: 140_007_000 picoseconds. + Weight::from_parts(144_781_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -837,18 +837,16 @@ impl WeightInfo for SubstrateWeight { /// The range of component `t` is `[0, 1]`. /// The range of component `i` is `[0, 983040]`. /// The range of component `s` is `[0, 983040]`. - fn seal_instantiate(t: u32, i: u32, s: u32, ) -> Weight { + fn seal_instantiate(_t: u32, i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4138` - // Minimum execution time: 1_798_243_000 picoseconds. - Weight::from_parts(82_642_573, 4138) - // Standard Error: 6_831_260 - .saturating_add(Weight::from_parts(159_867_027, 0).saturating_mul(t.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_534, 0).saturating_mul(i.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_809, 0).saturating_mul(s.into())) + // Minimum execution time: 2_073_851_000 picoseconds. + Weight::from_parts(2_084_321_000, 4138) + // Standard Error: 17 + .saturating_add(Weight::from_parts(986, 0).saturating_mul(i.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_261, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -857,64 +855,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 875_000 picoseconds. - Weight::from_parts(904_000, 0) + // Minimum execution time: 902_000 picoseconds. + Weight::from_parts(10_389_779, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_145, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_422, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_475_000 picoseconds. - Weight::from_parts(1_551_000, 0) + // Minimum execution time: 1_477_000 picoseconds. + Weight::from_parts(12_143_874, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(3_410, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_683, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 821_000 picoseconds. - Weight::from_parts(850_000, 0) + // Minimum execution time: 778_000 picoseconds. + Weight::from_parts(8_762_544, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_279, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_557, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 747_000 picoseconds. - Weight::from_parts(773_000, 0) + // Minimum execution time: 748_000 picoseconds. + Weight::from_parts(10_364_578, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_276, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_550, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_154_000 picoseconds. - Weight::from_parts(45_087_558, 0) - // Standard Error: 9 - .saturating_add(Weight::from_parts(4_628, 0).saturating_mul(n.into())) + // Minimum execution time: 43_388_000 picoseconds. + Weight::from_parts(42_346_211, 0) + // Standard Error: 10 + .saturating_add(Weight::from_parts(5_103, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_193_000 picoseconds. - Weight::from_parts(48_514_000, 0) + // Minimum execution time: 46_825_000 picoseconds. + Weight::from_parts(48_073_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_083_000 picoseconds. - Weight::from_parts(13_218_000, 0) + // Minimum execution time: 12_864_000 picoseconds. + Weight::from_parts(13_065_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -924,8 +922,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 19_308_000 picoseconds. - Weight::from_parts(20_116_000, 3895) + // Minimum execution time: 18_406_000 picoseconds. + Weight::from_parts(19_112_000, 3895) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -935,8 +933,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 9_271_000 picoseconds. - Weight::from_parts(9_640_000, 3820) + // Minimum execution time: 8_441_000 picoseconds. + Weight::from_parts(8_710_000, 3820) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -946,8 +944,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 8_182_000 picoseconds. - Weight::from_parts(8_343_000, 3558) + // Minimum execution time: 7_525_000 picoseconds. + Weight::from_parts(7_819_000, 3558) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -955,15 +953,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 320_000 picoseconds. - Weight::from_parts(347_000, 0) + // Minimum execution time: 313_000 picoseconds. + Weight::from_parts(375_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 345_000 picoseconds. - Weight::from_parts(370_000, 0) + // Minimum execution time: 308_000 picoseconds. + Weight::from_parts(334_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -971,8 +969,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_998_000 picoseconds. - Weight::from_parts(3_221_000, 1704) + // Minimum execution time: 2_775_000 picoseconds. + Weight::from_parts(3_043_000, 1704) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -980,10 +978,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_002_000 picoseconds. - Weight::from_parts(1_094_958, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(14_531, 0).saturating_mul(r.into())) + // Minimum execution time: 925_000 picoseconds. + Weight::from_parts(443_142, 0) + // Standard Error: 19 + .saturating_add(Weight::from_parts(15_316, 0).saturating_mul(r.into())) } } @@ -995,8 +993,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(2_142_000, 1627) + // Minimum execution time: 1_960_000 picoseconds. + Weight::from_parts(2_043_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1006,10 +1004,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452 + k * (69 ±0)` // Estimated: `442 + k * (70 ±0)` - // Minimum execution time: 12_095_000 picoseconds. - Weight::from_parts(12_699_000, 442) - // Standard Error: 891 - .saturating_add(Weight::from_parts(1_114_063, 0).saturating_mul(k.into())) + // Minimum execution time: 11_574_000 picoseconds. + Weight::from_parts(11_846_000, 442) + // Standard Error: 1_342 + .saturating_add(Weight::from_parts(1_113_844, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -1023,10 +1021,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1 ±0)` // Estimated: `6149 + c * (1 ±0)` - // Minimum execution time: 8_433_000 picoseconds. - Weight::from_parts(8_992_328, 6149) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_207, 0).saturating_mul(c.into())) + // Minimum execution time: 7_709_000 picoseconds. + Weight::from_parts(5_068_795, 6149) + // Standard Error: 5 + .saturating_add(Weight::from_parts(1_689, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1039,8 +1037,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `510` // Estimated: `6450` - // Minimum execution time: 16_415_000 picoseconds. - Weight::from_parts(17_348_000, 6450) + // Minimum execution time: 16_477_000 picoseconds. + Weight::from_parts(17_313_000, 6450) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1053,10 +1051,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `171 + k * (1 ±0)` // Estimated: `3635 + k * (1 ±0)` - // Minimum execution time: 3_433_000 picoseconds. - Weight::from_parts(3_490_000, 3635) - // Standard Error: 1_043 - .saturating_add(Weight::from_parts(1_225_953, 0).saturating_mul(k.into())) + // Minimum execution time: 3_111_000 picoseconds. + Weight::from_parts(3_198_000, 3635) + // Standard Error: 593 + .saturating_add(Weight::from_parts(1_081_746, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(k.into()))) @@ -1075,10 +1073,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `325 + c * (1 ±0)` // Estimated: `6263 + c * (1 ±0)` - // Minimum execution time: 16_421_000 picoseconds. - Weight::from_parts(16_822_963, 6263) - // Standard Error: 0 - .saturating_add(Weight::from_parts(456, 0).saturating_mul(c.into())) + // Minimum execution time: 15_390_000 picoseconds. + Weight::from_parts(16_157_208, 6263) + // Standard Error: 1 + .saturating_add(Weight::from_parts(501, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1089,8 +1087,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `6380` - // Minimum execution time: 12_569_000 picoseconds. - Weight::from_parts(13_277_000, 6380) + // Minimum execution time: 12_045_000 picoseconds. + Weight::from_parts(12_892_000, 6380) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1104,8 +1102,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `352` // Estimated: `6292` - // Minimum execution time: 46_777_000 picoseconds. - Weight::from_parts(47_690_000, 6292) + // Minimum execution time: 47_250_000 picoseconds. + Weight::from_parts(49_231_000, 6292) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1117,8 +1115,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `594` // Estimated: `6534` - // Minimum execution time: 55_280_000 picoseconds. - Weight::from_parts(57_081_000, 6534) + // Minimum execution time: 53_722_000 picoseconds. + Weight::from_parts(55_268_000, 6534) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1128,8 +1126,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `409` // Estimated: `6349` - // Minimum execution time: 12_077_000 picoseconds. - Weight::from_parts(12_647_000, 6349) + // Minimum execution time: 11_707_000 picoseconds. + Weight::from_parts(12_305_000, 6349) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1139,8 +1137,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `1627` - // Minimum execution time: 2_559_000 picoseconds. - Weight::from_parts(2_711_000, 1627) + // Minimum execution time: 2_129_000 picoseconds. + Weight::from_parts(2_197_000, 1627) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1152,8 +1150,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `166` // Estimated: `3631` - // Minimum execution time: 12_238_000 picoseconds. - Weight::from_parts(12_627_000, 3631) + // Minimum execution time: 11_145_000 picoseconds. + Weight::from_parts(11_445_000, 3631) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1163,8 +1161,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 4_836_000 picoseconds. - Weight::from_parts(5_086_000, 3607) + // Minimum execution time: 4_463_000 picoseconds. + Weight::from_parts(4_585_000, 3607) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1175,8 +1173,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `167` // Estimated: `3632` - // Minimum execution time: 6_147_000 picoseconds. - Weight::from_parts(6_380_000, 3632) + // Minimum execution time: 5_639_000 picoseconds. + Weight::from_parts(5_865_000, 3632) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) @@ -1187,8 +1185,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 6_140_000 picoseconds. - Weight::from_parts(6_670_000, 3607) + // Minimum execution time: 5_540_000 picoseconds. + Weight::from_parts(5_954_000, 3607) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1209,10 +1207,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `801 + c * (1 ±0)` // Estimated: `4264 + c * (1 ±0)` - // Minimum execution time: 354_459_000 picoseconds. - Weight::from_parts(332_397_871, 4264) - // Standard Error: 70 - .saturating_add(Weight::from_parts(33_775, 0).saturating_mul(c.into())) + // Minimum execution time: 353_812_000 picoseconds. + Weight::from_parts(337_889_300, 4264) + // Standard Error: 94 + .saturating_add(Weight::from_parts(34_200, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) @@ -1240,14 +1238,14 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `323` // Estimated: `6262` - // Minimum execution time: 4_239_452_000 picoseconds. - Weight::from_parts(800_849_282, 6262) - // Standard Error: 117 - .saturating_add(Weight::from_parts(68_435, 0).saturating_mul(c.into())) - // Standard Error: 14 - .saturating_add(Weight::from_parts(1_653, 0).saturating_mul(i.into())) - // Standard Error: 14 - .saturating_add(Weight::from_parts(1_668, 0).saturating_mul(s.into())) + // Minimum execution time: 4_499_852_000 picoseconds. + Weight::from_parts(135_265_841, 6262) + // Standard Error: 247 + .saturating_add(Weight::from_parts(72_051, 0).saturating_mul(c.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(2_180, 0).saturating_mul(i.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(2_195, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1273,12 +1271,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `560` // Estimated: `4029` - // Minimum execution time: 2_085_570_000 picoseconds. - Weight::from_parts(2_112_501_000, 4029) - // Standard Error: 26 - .saturating_add(Weight::from_parts(888, 0).saturating_mul(i.into())) - // Standard Error: 26 - .saturating_add(Weight::from_parts(795, 0).saturating_mul(s.into())) + // Minimum execution time: 2_376_075_000 picoseconds. + Weight::from_parts(2_387_885_000, 4029) + // Standard Error: 32 + .saturating_add(Weight::from_parts(1_036, 0).saturating_mul(i.into())) + // Standard Error: 32 + .saturating_add(Weight::from_parts(936, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1298,8 +1296,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `826` // Estimated: `4291` - // Minimum execution time: 201_900_000 picoseconds. - Weight::from_parts(206_738_000, 4291) + // Minimum execution time: 197_222_000 picoseconds. + Weight::from_parts(203_633_000, 4291) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1316,10 +1314,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 330_704_000 picoseconds. - Weight::from_parts(345_129_342, 3607) - // Standard Error: 51 - .saturating_add(Weight::from_parts(33_126, 0).saturating_mul(c.into())) + // Minimum execution time: 325_788_000 picoseconds. + Weight::from_parts(335_491_760, 3607) + // Standard Error: 50 + .saturating_add(Weight::from_parts(35_337, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1336,10 +1334,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `142` // Estimated: `3607` - // Minimum execution time: 343_339_000 picoseconds. - Weight::from_parts(356_479_729, 3607) - // Standard Error: 49 - .saturating_add(Weight::from_parts(33_404, 0).saturating_mul(c.into())) + // Minimum execution time: 336_010_000 picoseconds. + Weight::from_parts(348_030_264, 3607) + // Standard Error: 43 + .saturating_add(Weight::from_parts(35_696, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1355,8 +1353,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `315` // Estimated: `3780` - // Minimum execution time: 42_241_000 picoseconds. - Weight::from_parts(43_365_000, 3780) + // Minimum execution time: 40_118_000 picoseconds. + Weight::from_parts(40_987_000, 3780) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1370,8 +1368,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `552` // Estimated: `6492` - // Minimum execution time: 26_318_000 picoseconds. - Weight::from_parts(27_840_000, 6492) + // Minimum execution time: 25_236_000 picoseconds. + Weight::from_parts(26_450_000, 6492) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1380,17 +1378,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_397_000 picoseconds. - Weight::from_parts(9_318_986, 0) - // Standard Error: 72 - .saturating_add(Weight::from_parts(72_994, 0).saturating_mul(r.into())) + // Minimum execution time: 9_200_000 picoseconds. + Weight::from_parts(9_773_983, 0) + // Standard Error: 74 + .saturating_add(Weight::from_parts(72_257, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 644_000 picoseconds. - Weight::from_parts(687_000, 0) + // Minimum execution time: 606_000 picoseconds. + Weight::from_parts(672_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1398,8 +1396,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `354` // Estimated: `3819` - // Minimum execution time: 6_465_000 picoseconds. - Weight::from_parts(6_850_000, 3819) + // Minimum execution time: 6_260_000 picoseconds. + Weight::from_parts(6_645_000, 3819) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:0) @@ -1408,79 +1406,79 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `447` // Estimated: `3912` - // Minimum execution time: 7_735_000 picoseconds. - Weight::from_parts(8_115_000, 3912) + // Minimum execution time: 7_599_000 picoseconds. + Weight::from_parts(7_913_000, 3912) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 717_000 picoseconds. - Weight::from_parts(791_000, 0) + // Minimum execution time: 772_000 picoseconds. + Weight::from_parts(852_000, 0) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 365_000 picoseconds. - Weight::from_parts(427_000, 0) + // Minimum execution time: 390_000 picoseconds. + Weight::from_parts(417_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 331_000 picoseconds. - Weight::from_parts(363_000, 0) + // Minimum execution time: 340_000 picoseconds. + Weight::from_parts(368_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 586_000 picoseconds. - Weight::from_parts(625_000, 0) + // Minimum execution time: 640_000 picoseconds. + Weight::from_parts(672_000, 0) } fn seal_gas_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 680_000 picoseconds. - Weight::from_parts(734_000, 0) + // Minimum execution time: 607_000 picoseconds. + Weight::from_parts(699_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 4_732_000 picoseconds. - Weight::from_parts(5_008_000, 0) + // Minimum execution time: 4_519_000 picoseconds. + Weight::from_parts(4_668_000, 0) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 608_000 picoseconds. - Weight::from_parts(635_000, 0) + // Minimum execution time: 600_000 picoseconds. + Weight::from_parts(639_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 571_000 picoseconds. - Weight::from_parts(606_000, 0) + // Minimum execution time: 579_000 picoseconds. + Weight::from_parts(609_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 511_000 picoseconds. - Weight::from_parts(584_000, 0) + // Minimum execution time: 575_000 picoseconds. + Weight::from_parts(613_000, 0) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 552_000 picoseconds. - Weight::from_parts(612_000, 0) + // Minimum execution time: 554_000 picoseconds. + Weight::from_parts(622_000, 0) } /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) @@ -1488,8 +1486,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `67` // Estimated: `1552` - // Minimum execution time: 4_396_000 picoseconds. - Weight::from_parts(4_630_000, 1552) + // Minimum execution time: 4_265_000 picoseconds. + Weight::from_parts(4_525_000, 1552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `n` is `[0, 1048572]`. @@ -1497,8 +1495,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 494_000 picoseconds. - Weight::from_parts(510_000, 0) + // Minimum execution time: 512_000 picoseconds. + Weight::from_parts(524_000, 0) // Standard Error: 3 .saturating_add(Weight::from_parts(303, 0).saturating_mul(n.into())) } @@ -1507,10 +1505,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 311_000 picoseconds. - Weight::from_parts(346_000, 0) + // Minimum execution time: 358_000 picoseconds. + Weight::from_parts(375_000, 0) // Standard Error: 9 - .saturating_add(Weight::from_parts(480, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(481, 0).saturating_mul(n.into())) } /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1523,10 +1521,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `319 + n * (78 ±0)` // Estimated: `3784 + n * (2553 ±0)` - // Minimum execution time: 14_403_000 picoseconds. - Weight::from_parts(16_478_113, 3784) - // Standard Error: 6_667 - .saturating_add(Weight::from_parts(3_641_603, 0).saturating_mul(n.into())) + // Minimum execution time: 13_267_000 picoseconds. + Weight::from_parts(15_705_698, 3784) + // Standard Error: 7_176 + .saturating_add(Weight::from_parts(3_506_583, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -1539,8 +1537,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 3_639_000 picoseconds. - Weight::from_parts(3_801_000, 1561) + // Minimum execution time: 3_339_000 picoseconds. + Weight::from_parts(3_544_000, 1561) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::EventTopics` (r:4 w:4) @@ -1551,12 +1549,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `990 + t * (2475 ±0)` - // Minimum execution time: 4_102_000 picoseconds. - Weight::from_parts(4_256_984, 990) - // Standard Error: 6_777 - .saturating_add(Weight::from_parts(2_331_893, 0).saturating_mul(t.into())) + // Minimum execution time: 3_789_000 picoseconds. + Weight::from_parts(4_070_991, 990) + // Standard Error: 6_319 + .saturating_add(Weight::from_parts(2_264_078, 0).saturating_mul(t.into())) // Standard Error: 1 - .saturating_add(Weight::from_parts(31, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(20, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(t.into()))) .saturating_add(Weight::from_parts(0, 2475).saturating_mul(t.into())) @@ -1566,10 +1564,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 385_000 picoseconds. - Weight::from_parts(427_000, 0) + // Minimum execution time: 426_000 picoseconds. + Weight::from_parts(465_000, 0) // Standard Error: 10 - .saturating_add(Weight::from_parts(1_272, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(1_277, 0).saturating_mul(i.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1579,12 +1577,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `250 + o * (1 ±0)` // Estimated: `249 + o * (1 ±0)` - // Minimum execution time: 10_128_000 picoseconds. - Weight::from_parts(9_963_519, 249) - // Standard Error: 1 - .saturating_add(Weight::from_parts(327, 0).saturating_mul(n.into())) - // Standard Error: 1 - .saturating_add(Weight::from_parts(58, 0).saturating_mul(o.into())) + // Minimum execution time: 9_148_000 picoseconds. + Weight::from_parts(8_789_382, 249) + // Standard Error: 2 + .saturating_add(Weight::from_parts(361, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(66, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) @@ -1596,10 +1594,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_921_000 picoseconds. - Weight::from_parts(9_290_526, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(77, 0).saturating_mul(n.into())) + // Minimum execution time: 7_344_000 picoseconds. + Weight::from_parts(8_119_197, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(83, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1611,10 +1609,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_403_000 picoseconds. - Weight::from_parts(8_815_037, 248) - // Standard Error: 3 - .saturating_add(Weight::from_parts(701, 0).saturating_mul(n.into())) + // Minimum execution time: 6_763_000 picoseconds. + Weight::from_parts(7_669_781, 248) + // Standard Error: 2 + .saturating_add(Weight::from_parts(710, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1625,10 +1623,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 6_590_000 picoseconds. - Weight::from_parts(7_949_861, 248) - // Standard Error: 2 - .saturating_add(Weight::from_parts(76, 0).saturating_mul(n.into())) + // Minimum execution time: 6_310_000 picoseconds. + Weight::from_parts(7_039_085, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(84, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1639,10 +1637,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `248 + n * (1 ±0)` // Estimated: `248 + n * (1 ±0)` - // Minimum execution time: 7_900_000 picoseconds. - Weight::from_parts(9_988_151, 248) - // Standard Error: 3 - .saturating_add(Weight::from_parts(703, 0).saturating_mul(n.into())) + // Minimum execution time: 7_541_000 picoseconds. + Weight::from_parts(8_559_509, 248) + // Standard Error: 1 + .saturating_add(Weight::from_parts(711, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1651,8 +1649,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `140` // Estimated: `0` - // Minimum execution time: 9_023_000 picoseconds. - Weight::from_parts(9_375_000, 0) + // Minimum execution time: 8_728_000 picoseconds. + Weight::from_parts(9_035_000, 0) } /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) @@ -1668,12 +1666,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `620 + t * (280 ±0)` // Estimated: `4085 + t * (2182 ±0)` - // Minimum execution time: 157_109_000 picoseconds. - Weight::from_parts(159_458_069, 4085) - // Standard Error: 339_702 - .saturating_add(Weight::from_parts(44_066_869, 0).saturating_mul(t.into())) + // Minimum execution time: 153_385_000 picoseconds. + Weight::from_parts(156_813_102, 4085) + // Standard Error: 290_142 + .saturating_add(Weight::from_parts(42_350_253, 0).saturating_mul(t.into())) // Standard Error: 0 - .saturating_add(Weight::from_parts(6, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(4, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(t.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1688,8 +1686,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 143_384_000 picoseconds. - Weight::from_parts(147_554_000, 3895) + // Minimum execution time: 140_007_000 picoseconds. + Weight::from_parts(144_781_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) @@ -1705,18 +1703,16 @@ impl WeightInfo for () { /// The range of component `t` is `[0, 1]`. /// The range of component `i` is `[0, 983040]`. /// The range of component `s` is `[0, 983040]`. - fn seal_instantiate(t: u32, i: u32, s: u32, ) -> Weight { + fn seal_instantiate(_t: u32, i: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `676` // Estimated: `4138` - // Minimum execution time: 1_798_243_000 picoseconds. - Weight::from_parts(82_642_573, 4138) - // Standard Error: 6_831_260 - .saturating_add(Weight::from_parts(159_867_027, 0).saturating_mul(t.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_534, 0).saturating_mul(i.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(1_809, 0).saturating_mul(s.into())) + // Minimum execution time: 2_073_851_000 picoseconds. + Weight::from_parts(2_084_321_000, 4138) + // Standard Error: 17 + .saturating_add(Weight::from_parts(986, 0).saturating_mul(i.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_261, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1725,64 +1721,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 875_000 picoseconds. - Weight::from_parts(904_000, 0) + // Minimum execution time: 902_000 picoseconds. + Weight::from_parts(10_389_779, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_145, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_422, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_475_000 picoseconds. - Weight::from_parts(1_551_000, 0) + // Minimum execution time: 1_477_000 picoseconds. + Weight::from_parts(12_143_874, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(3_410, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(3_683, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 821_000 picoseconds. - Weight::from_parts(850_000, 0) + // Minimum execution time: 778_000 picoseconds. + Weight::from_parts(8_762_544, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_279, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_557, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 1048576]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 747_000 picoseconds. - Weight::from_parts(773_000, 0) + // Minimum execution time: 748_000 picoseconds. + Weight::from_parts(10_364_578, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_276, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_550, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 125697]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_154_000 picoseconds. - Weight::from_parts(45_087_558, 0) - // Standard Error: 9 - .saturating_add(Weight::from_parts(4_628, 0).saturating_mul(n.into())) + // Minimum execution time: 43_388_000 picoseconds. + Weight::from_parts(42_346_211, 0) + // Standard Error: 10 + .saturating_add(Weight::from_parts(5_103, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 47_193_000 picoseconds. - Weight::from_parts(48_514_000, 0) + // Minimum execution time: 46_825_000 picoseconds. + Weight::from_parts(48_073_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_083_000 picoseconds. - Weight::from_parts(13_218_000, 0) + // Minimum execution time: 12_864_000 picoseconds. + Weight::from_parts(13_065_000, 0) } /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) @@ -1792,8 +1788,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `430` // Estimated: `3895` - // Minimum execution time: 19_308_000 picoseconds. - Weight::from_parts(20_116_000, 3895) + // Minimum execution time: 18_406_000 picoseconds. + Weight::from_parts(19_112_000, 3895) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1803,8 +1799,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3820` - // Minimum execution time: 9_271_000 picoseconds. - Weight::from_parts(9_640_000, 3820) + // Minimum execution time: 8_441_000 picoseconds. + Weight::from_parts(8_710_000, 3820) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1814,8 +1810,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `3558` - // Minimum execution time: 8_182_000 picoseconds. - Weight::from_parts(8_343_000, 3558) + // Minimum execution time: 7_525_000 picoseconds. + Weight::from_parts(7_819_000, 3558) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1823,15 +1819,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 320_000 picoseconds. - Weight::from_parts(347_000, 0) + // Minimum execution time: 313_000 picoseconds. + Weight::from_parts(375_000, 0) } fn seal_account_reentrance_count() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 345_000 picoseconds. - Weight::from_parts(370_000, 0) + // Minimum execution time: 308_000 picoseconds. + Weight::from_parts(334_000, 0) } /// Storage: `Contracts::Nonce` (r:1 w:0) /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) @@ -1839,8 +1835,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `219` // Estimated: `1704` - // Minimum execution time: 2_998_000 picoseconds. - Weight::from_parts(3_221_000, 1704) + // Minimum execution time: 2_775_000 picoseconds. + Weight::from_parts(3_043_000, 1704) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// The range of component `r` is `[0, 5000]`. @@ -1848,9 +1844,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_002_000 picoseconds. - Weight::from_parts(1_094_958, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(14_531, 0).saturating_mul(r.into())) + // Minimum execution time: 925_000 picoseconds. + Weight::from_parts(443_142, 0) + // Standard Error: 19 + .saturating_add(Weight::from_parts(15_316, 0).saturating_mul(r.into())) } } From d5f8d153846bf1c30fe0c32131d81ced984d029f Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Mon, 3 Jun 2024 21:05:56 +0200 Subject: [PATCH 29/29] Bump API verision for contracts pallet --- substrate/frame/contracts/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 77681d41e3ee..e9cf28a66912 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -223,7 +223,7 @@ pub struct Environment { pub struct ApiVersion(u16); impl Default for ApiVersion { fn default() -> Self { - Self(3) + Self(4) } }