diff --git a/prdoc/pr_4418.prdoc b/prdoc/pr_4418.prdoc new file mode 100644 index 000000000000..4372692b2b98 --- /dev/null +++ b/prdoc/pr_4418.prdoc @@ -0,0 +1,19 @@ +# 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 + bump: minor + - name: pallet-contracts-uapi + bump: minor + - name: pallet-contracts-proc-macro + bump: minor 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..16a85eff3989 --- /dev/null +++ b/substrate/frame/contracts/fixtures/contracts/call_with_flags_and_value.rs @@ -0,0 +1,51 @@ +// 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 flags and value. +#![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 new file mode 100644 index 000000000000..524fe50b6d06 --- /dev/null +++ b/substrate/frame/contracts/fixtures/contracts/read_only_call.rs @@ -0,0 +1,50 @@ +// 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 read-only call 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!( + 256, + callee_addr: [u8; 32], + callee_input: [u8], + ); + + // 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/proc-macro/src/lib.rs b/substrate/frame/contracts/proc-macro/src/lib.rs index 356b42268da6..2472863b58b1 100644 --- a/substrate/frame/contracts/proc-macro/src/lib.rs +++ b/substrate/frame/contracts/proc-macro/src/lib.rs @@ -170,7 +170,7 @@ impl HostFn { // process attributes let msg = - "Only #[version()], #[unstable], #[prefixed_alias], #[cfg] and #[deprecated] attributes are allowed."; + "Only #[version()], #[unstable], #[prefixed_alias], #[cfg], #[mutating] and #[deprecated] attributes are allowed."; let span = item.span(); let mut attrs = item.attrs.clone(); attrs.retain(|a| !a.path().is_ident("doc")); @@ -178,6 +178,7 @@ impl HostFn { let mut is_stable = true; let mut alias_to = None; let mut not_deprecated = true; + let mut mutating = false; let mut cfg = None; while let Some(attr) = attrs.pop() { let ident = attr.path().get_ident().ok_or(err(span, msg))?.to_string(); @@ -208,6 +209,12 @@ impl HostFn { } not_deprecated = false; }, + "mutating" => { + if mutating { + return Err(err(span, "#[mutating] can only be specified once")) + } + mutating = true; + }, "cfg" => { if cfg.is_some() { return Err(err(span, "#[cfg] can only be specified once")) @@ -217,6 +224,16 @@ impl HostFn { id => return Err(err(span, &format!("Unsupported attribute \"{id}\". {msg}"))), } } + + if mutating { + 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/chain_extension.rs b/substrate/frame/contracts/src/chain_extension.rs index 8a7243d6bb37..f3a67fcb09a0 100644 --- a/substrate/frame/contracts/src/chain_extension.rs +++ b/substrate/frame/contracts/src/chain_extension.rs @@ -112,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. diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 992f7aaace31..84a3f7dc2a14 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, + read_only: bool, ) -> Result; /// Execute code in the current frame. @@ -182,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; @@ -307,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. @@ -327,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. /// @@ -345,13 +346,10 @@ pub trait Ext: sealing::Sealed { /// /// # Errors /// - /// - [`Error::::MaxDelegateDependenciesReached`] - /// - [`Error::::CannotAddSelfAsDelegateDependency`] - /// - [`Error::::DelegateDependencyAlreadyExists`] - fn lock_delegate_dependency( - &mut self, - code_hash: CodeHash, - ) -> Result<(), DispatchError>; + /// - [`Error::MaxDelegateDependenciesReached`] + /// - [`Error::CannotAddSelfAsDelegateDependency`] + /// - [`Error::DelegateDependencyAlreadyExists`] + fn lock_delegate_dependency(&mut self, code_hash: CodeHash) -> DispatchResult; /// Removes a delegate dependency from [`ContractInfo`]'s `delegate_dependencies` field. /// @@ -360,16 +358,16 @@ pub trait Ext: sealing::Sealed { /// /// # Errors /// - /// - [`Error::::DelegateDependencyNotFound`] - fn unlock_delegate_dependency( - &mut self, - code_hash: &CodeHash, - ) -> Result<(), DispatchError>; + /// - [`Error::DelegateDependencyNotFound`] + fn unlock_delegate_dependency(&mut self, code_hash: &CodeHash) -> DispatchResult; /// Returns the number of locked delegate dependencies. /// /// Note: Requires &mut self to access the contract info. fn locked_delegate_dependencies_count(&mut self) -> usize; + + /// Check if running in read-only context. + fn is_read_only(&self) -> bool; } /// Describes the different functions that can be exported by an [`Executable`]. @@ -503,6 +501,8 @@ pub struct Frame { nested_storage: storage::meter::NestedMeter, /// If `false` the contract enabled its defense against reentrance attacks. allows_reentry: 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>, } @@ -781,6 +781,7 @@ where storage_meter, BalanceOf::::zero(), determinism, + false, )?; let stack = Self { @@ -813,6 +814,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 { @@ -869,6 +871,7 @@ where nested_gas: gas_meter.nested(gas_limit), nested_storage: storage_meter.nested(deposit_limit), allows_reentry: true, + read_only, }; Ok((frame, executable, nonce)) @@ -881,6 +884,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()) @@ -908,6 +912,7 @@ where nested_storage, deposit_limit, self.determinism, + read_only, )?; self.frames.push(frame); Ok(executable) @@ -1222,6 +1227,7 @@ where value: BalanceOf, input_data: Vec, allows_reentry: 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 @@ -1232,6 +1238,7 @@ where if !self.allows_reentry(&to) { return Err(>::ReentranceDenied.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. @@ -1247,6 +1254,8 @@ where value, gas_limit, deposit_limit, + // Enable read-only access if requested; cannot disable it if already set. + read_only || self.is_read_only(), )?; self.run(executable, input_data) }; @@ -1279,6 +1288,7 @@ where value, Weight::zero(), BalanceOf::::zero(), + self.is_read_only(), )?; self.run(executable, input_data) } @@ -1305,12 +1315,13 @@ where value, gas_limit, deposit_limit, + self.is_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) -> Result<(), DispatchError> { + fn terminate(&mut self, beneficiary: &AccountIdOf) -> DispatchResult { if self.is_recursive() { return Err(Error::::TerminatedWhileReentrant.into()) } @@ -1507,7 +1518,7 @@ 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 { let frame = top_frame_mut!(self); if !E::from_storage(hash, &mut frame.nested_gas)?.is_deterministic() { return Err(>::Indeterministic.into()) @@ -1558,7 +1569,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); @@ -1577,10 +1588,7 @@ where }); } - fn lock_delegate_dependency( - &mut self, - code_hash: CodeHash, - ) -> Result<(), DispatchError> { + fn lock_delegate_dependency(&mut self, code_hash: CodeHash) -> DispatchResult { let frame = self.top_frame_mut(); let info = frame.contract_info.get(&frame.account_id); ensure!(code_hash != info.code_hash, Error::::CannotAddSelfAsDelegateDependency); @@ -1596,10 +1604,7 @@ where Ok(()) } - fn unlock_delegate_dependency( - &mut self, - code_hash: &CodeHash, - ) -> Result<(), DispatchError> { + fn unlock_delegate_dependency(&mut self, code_hash: &CodeHash) -> DispatchResult { let frame = self.top_frame_mut(); let info = frame.contract_info.get(&frame.account_id); @@ -1614,6 +1619,10 @@ where fn locked_delegate_dependencies_count(&mut self) -> usize { self.top_frame_mut().contract_info().delegate_dependencies_count() } + + fn is_read_only(&self) -> bool { + self.top_frame().read_only + } } mod sealing { @@ -2125,7 +2134,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); + let r = ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + BOB, + 0, + vec![], + true, + false, + ); ReachedBottom::mutate(|reached_bottom| { if !*reached_bottom { @@ -2184,8 +2201,15 @@ mod tests { // Call into CHARLIE contract. assert_matches!( - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true), + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + true, + false + ), Ok(_) ); exec_success() @@ -2332,7 +2356,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, false) }); ExtBuilder::default().build().execute_with(|| { @@ -2431,7 +2455,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, false) }); ExtBuilder::default().build().execute_with(|| { @@ -2465,8 +2489,15 @@ mod tests { // Call into charlie contract. assert_matches!( - ctx.ext - .call(Weight::zero(), BalanceOf::::zero(), CHARLIE, 0, vec![], true), + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + true, + false + ), Ok(_) ); exec_success() @@ -2834,7 +2865,8 @@ mod tests { CHARLIE, 0, vec![], - true + true, + false ), exec_trapped() ); @@ -2845,7 +2877,7 @@ mod tests { let code_charlie = MockLoader::insert(Call, |ctx, _| { assert!(ctx .ext - .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true) + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![99], true, false) .is_ok()); exec_trapped() }); @@ -2878,7 +2910,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, false), Err(ExecError{error, ..}) if error == >::ContractNotFound.into() ); exec_success() @@ -3028,7 +3060,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) + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), dest, 0, vec![], false, false) }); let code_charlie = MockLoader::insert(Call, |_, _| exec_success()); @@ -3077,8 +3110,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) + ctx.ext.call( + Weight::zero(), + BalanceOf::::zero(), + CHARLIE, + 0, + vec![], + false, + false, + ) } else { exec_success() } @@ -3086,7 +3126,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) + ctx.ext + .call(Weight::zero(), BalanceOf::::zero(), BOB, 0, vec![1], true, false) }); ExtBuilder::default().build().execute_with(|| { @@ -3306,7 +3347,15 @@ 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, + false, + ) .unwrap(); exec_success() diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 6fab1a44ecb9..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) } } @@ -1199,6 +1199,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 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, /// More storage was created than allowed by the storage deposit limit. diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 899b0144b072..c20577a3f645 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -4236,3 +4236,99 @@ 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((&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 + ); + }); +} + +#[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(); + + assert_ok!(builder::call(addr_caller.clone()).data(addr_callee.encode()).build()); + }); +} diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index e5497b143b8b..5eccdfffb91d 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -545,6 +545,7 @@ mod tests { value: u64, data: Vec, allows_reentry: bool, + read_only: bool, } #[derive(Debug, PartialEq, Eq)] @@ -612,8 +613,9 @@ mod tests { value: u64, data: Vec, allows_reentry: bool, + read_only: bool, ) -> Result { - self.calls.push(CallEntry { to, value, data, allows_reentry }); + self.calls.push(CallEntry { to, value, data, allows_reentry, read_only }); Ok(ExecReturnValue { flags: ReturnFlags::empty(), data: call_return_data() }) } fn delegate_call( @@ -645,15 +647,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(()) } @@ -787,27 +789,26 @@ 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> { + 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, - ) -> Result<(), DispatchError> { + fn unlock_delegate_dependency(&mut self, code: &CodeHash) -> DispatchResult { self.delegate_dependencies.borrow_mut().remove(code); Ok(()) } + fn locked_delegate_dependencies_count(&mut self) -> usize { self.delegate_dependencies.borrow().len() } + + fn is_read_only(&self) -> bool { + false + } } /// Execute the supplied code. @@ -989,7 +990,13 @@ 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, + read_only: false + }] ); } @@ -1086,7 +1093,13 @@ 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, + read_only: false + }] ); } @@ -1141,7 +1154,13 @@ 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, + read_only: false + }] ); } @@ -1188,7 +1207,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 }] + &[CallEntry { + to: ALICE, + value: 0x2a, + data: input, + allows_reentry: false, + read_only: false + }] ); } @@ -1429,7 +1454,13 @@ 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, + read_only: false + }] ); } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 39b15c867c6a..07ecd60f7d5e 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -824,9 +824,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::CallTransferSurcharge)?; } self.ext.call( @@ -836,10 +842,11 @@ impl<'a, E: Ext + 'a> Runtime<'a, E> { value, input_data, flags.contains(CallFlags::ALLOW_REENTRY), + read_only, ) }, CallType::DelegateCall { code_hash_ptr } => { - if flags.contains(CallFlags::ALLOW_REENTRY) { + 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)?; @@ -957,6 +964,7 @@ pub mod env { /// Set the value at the given key in the contract storage. /// See [`pallet_contracts_uapi::HostFn::set_storage`] #[prefixed_alias] + #[mutating] fn set_storage( ctx: _, memory: _, @@ -971,6 +979,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::set_storage_v1`] #[version(1)] #[prefixed_alias] + #[mutating] fn set_storage( ctx: _, memory: _, @@ -985,6 +994,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::set_storage_v2`] #[version(2)] #[prefixed_alias] + #[mutating] fn set_storage( ctx: _, memory: _, @@ -999,6 +1009,7 @@ pub mod env { /// Clear the value at the given key in the contract storage. /// See [`pallet_contracts_uapi::HostFn::clear_storage`] #[prefixed_alias] + #[mutating] fn clear_storage(ctx: _, memory: _, key_ptr: u32) -> Result<(), TrapReason> { ctx.clear_storage(memory, KeyType::Fix, key_ptr).map(|_| ()) } @@ -1007,6 +1018,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::clear_storage_v1`] #[version(1)] #[prefixed_alias] + #[mutating] fn clear_storage(ctx: _, memory: _, key_ptr: u32, key_len: u32) -> Result { ctx.clear_storage(memory, KeyType::Var(key_len), key_ptr) } @@ -1057,6 +1069,7 @@ pub mod env { /// Retrieve and remove the value under the given key from storage. /// See [`pallet_contracts_uapi::HostFn::take_storage`] #[prefixed_alias] + #[mutating] fn take_storage( ctx: _, memory: _, @@ -1088,6 +1101,7 @@ pub mod env { /// Transfer some value to another account. /// See [`pallet_contracts_uapi::HostFn::transfer`]. #[prefixed_alias] + #[mutating] fn transfer( ctx: _, memory: _, @@ -1245,6 +1259,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] + #[mutating] fn instantiate( ctx: _, memory: _, @@ -1283,6 +1298,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::instantiate_v1`]. #[version(1)] #[prefixed_alias] + #[mutating] fn instantiate( ctx: _, memory: _, @@ -1318,6 +1334,7 @@ pub mod env { /// Instantiate a contract with the specified code hash. /// See [`pallet_contracts_uapi::HostFn::instantiate_v2`]. #[version(2)] + #[mutating] fn instantiate( ctx: _, memory: _, @@ -1361,6 +1378,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] + #[mutating] fn terminate( ctx: _, memory: _, @@ -1374,6 +1392,7 @@ pub mod env { /// See [`pallet_contracts_uapi::HostFn::terminate_v1`]. #[version(1)] #[prefixed_alias] + #[mutating] fn terminate(ctx: _, memory: _, beneficiary_ptr: u32) -> Result<(), TrapReason> { ctx.terminate(memory, beneficiary_ptr) } @@ -1871,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] + #[mutating] fn deposit_event( ctx: _, memory: _, @@ -2051,6 +2071,7 @@ pub mod env { /// Call some dispatchable of the runtime. /// See [`frame_support::traits::call_runtime`]. + #[mutating] fn call_runtime( ctx: _, memory: _, @@ -2070,6 +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`]. + #[mutating] fn xcm_execute( ctx: _, memory: _, @@ -2107,6 +2129,7 @@ pub mod env { /// Send an XCM program from the contract to the specified destination. /// See [`pallet_contracts_uapi::HostFn::send_xcm`]. + #[mutating] fn xcm_send( ctx: _, memory: _, @@ -2203,6 +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] + #[mutating] fn set_code_hash(ctx: _, memory: _, code_hash_ptr: u32) -> Result { ctx.charge_gas(RuntimeCosts::SetCodeHash)?; let code_hash: CodeHash<::T> = @@ -2267,6 +2291,7 @@ pub mod env { /// Adds a new delegate dependency to the contract. /// See [`pallet_contracts_uapi::HostFn::lock_delegate_dependency`]. + #[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)?; @@ -2276,6 +2301,7 @@ pub mod env { /// Removes the delegate dependency from the contract. /// see [`pallet_contracts_uapi::HostFn::unlock_delegate_dependency`]. + #[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)?; 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())) } } diff --git a/substrate/frame/contracts/uapi/src/flags.rs b/substrate/frame/contracts/uapi/src/flags.rs index 32553817fb7a..e6dfdeaedfa7 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 READ_ONLY = 0b0001_0000; } }