diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml index 512f32d66a66c..862bb3baec7d3 100644 --- a/bin/node/runtime/Cargo.toml +++ b/bin/node/runtime/Cargo.toml @@ -237,3 +237,8 @@ try-runtime = [ "pallet-vesting/try-runtime", "pallet-gilt/try-runtime", ] +# Make contract callable functions marked as __unstable__ available. Do not enable +# on live chains as those are subject to change. +contracts-unstable-interface = [ + "pallet-contracts/unstable-interface" +] diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index 9381f3be5c934..f09e61c3e5baf 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -72,5 +72,9 @@ runtime-benchmarks = [ "frame-benchmarking", "rand", "rand_pcg", + "unstable-interface", ] try-runtime = ["frame-support/try-runtime"] +# Make contract callable functions marked as __unstable__ available. Do not enable +# on live chains as those are subject to change. +unstable-interface = [] diff --git a/frame/contracts/README.md b/frame/contracts/README.md index 0b34a55ff42f9..f3a8d13f6e77d 100644 --- a/frame/contracts/README.md +++ b/frame/contracts/README.md @@ -69,7 +69,8 @@ It is up the the individual client if and how those messages are presented to th This buffer is also printed as a debug message. In order to see these messages on the node console the log level for the `runtime::contracts` target needs to be raised to at least the `debug` level. However, those messages are easy to overlook because of the noise generated -by block production. A good starting point for observing them on the console is: +by block production. A good starting point for observing them on the console is using this +command line in the root directory of the substrate repository: ```bash cargo run --release -- --dev --tmp -lerror,runtime::contracts=debug @@ -81,4 +82,27 @@ to `error` in order to prevent them from spamming the console. `--dev`: Use a dev chain spec `--tmp`: Use temporary storage for chain data (the chain state is deleted on exit) +## Unstable Interfaces + +Driven by the desire to have an iterative approach in developing new contract interfaces +this pallet contains the concept of an unstable interface. Akin to the rust nightly compiler +it allows us to add new interfaces but mark them as unstable so that contract languages can +experiment with them and give feedback before we stabilize those. + +In order to access interfaces marked as `__unstable__` in `runtime.rs` one need to compile +this crate with the `unstable-interface` feature enabled. It should be obvious that any +live runtime should never be compiled with this feature: In addition to be subject to +change or removal those interfaces do not have proper weights associated with them and +are therefore considered unsafe. + +The substrate runtime exposes this feature as `contracts-unstable-interface`. Example +commandline for running the substrate node with unstable contracts interfaces: + +```bash +cargo run --release --features contracts-unstable-interface -- --dev +``` + +New interfaces are generally added as unstable and might go through several iterations +before they are promoted to a stable interface. + License: Apache-2.0 diff --git a/frame/contracts/fixtures/debug_message_invalid_utf8.wat b/frame/contracts/fixtures/debug_message_invalid_utf8.wat index c60371076440e..82cabb6fdca44 100644 --- a/frame/contracts/fixtures/debug_message_invalid_utf8.wat +++ b/frame/contracts/fixtures/debug_message_invalid_utf8.wat @@ -1,6 +1,6 @@ ;; Emit a "Hello World!" debug message (module - (import "seal0" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) + (import "__unstable__" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) (data (i32.const 0) "\fc") diff --git a/frame/contracts/fixtures/debug_message_logging_disabled.wat b/frame/contracts/fixtures/debug_message_logging_disabled.wat index cfe238943ad06..0eaa9696afb63 100644 --- a/frame/contracts/fixtures/debug_message_logging_disabled.wat +++ b/frame/contracts/fixtures/debug_message_logging_disabled.wat @@ -1,6 +1,6 @@ ;; Emit a "Hello World!" debug message but assume that logging is disabled. (module - (import "seal0" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) + (import "__unstable__" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) (data (i32.const 0) "Hello World!") diff --git a/frame/contracts/fixtures/debug_message_works.wat b/frame/contracts/fixtures/debug_message_works.wat index 61933c2329611..1a50a51e3e0df 100644 --- a/frame/contracts/fixtures/debug_message_works.wat +++ b/frame/contracts/fixtures/debug_message_works.wat @@ -1,6 +1,6 @@ ;; Emit a "Hello World!" debug message (module - (import "seal0" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) + (import "__unstable__" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) (data (i32.const 0) "Hello World!") diff --git a/frame/contracts/src/benchmarking/code.rs b/frame/contracts/src/benchmarking/code.rs index 811ba71bdea7f..930996a437c5b 100644 --- a/frame/contracts/src/benchmarking/code.rs +++ b/frame/contracts/src/benchmarking/code.rs @@ -103,6 +103,7 @@ impl ImportedMemory { } pub struct ImportedFunction { + pub module: &'static str, pub name: &'static str, pub params: Vec, pub return_type: Option, @@ -171,7 +172,7 @@ where .build_sig(); let sig = contract.push_signature(sig); contract = contract.import() - .module("seal0") + .module(func.module) .field(func.name) .with_external(parity_wasm::elements::External::Function(sig)) .build(); @@ -292,6 +293,7 @@ where ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: getter_name, params: vec![ValueType::I32, ValueType::I32], return_type: None, @@ -321,6 +323,7 @@ where ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name, params: vec![ValueType::I32, ValueType::I32, ValueType::I32], return_type: None, diff --git a/frame/contracts/src/benchmarking/mod.rs b/frame/contracts/src/benchmarking/mod.rs index cab80d63bbce0..91210f08883e8 100644 --- a/frame/contracts/src/benchmarking/mod.rs +++ b/frame/contracts/src/benchmarking/mod.rs @@ -527,20 +527,13 @@ benchmarks! { let origin = RawOrigin::Signed(instance.caller.clone()); }: call(origin, instance.addr, 0u32.into(), Weight::max_value(), vec![]) - seal_rent_params { - let r in 0 .. API_BENCHMARK_BATCHES; - let instance = Contract::::new(WasmModule::getter( - "seal_rent_params", r * API_BENCHMARK_BATCH_SIZE - ), vec![], Endow::Max)?; - let origin = RawOrigin::Signed(instance.caller.clone()); - }: call(origin, instance.addr, 0u32.into(), Weight::max_value(), vec![]) - seal_weight_to_fee { let r in 0 .. API_BENCHMARK_BATCHES; let pages = code::max_pages::(); let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_weight_to_fee", params: vec![ValueType::I64, ValueType::I32, ValueType::I32], return_type: None, @@ -565,6 +558,7 @@ benchmarks! { let r in 0 .. API_BENCHMARK_BATCHES; let code = WasmModule::::from(ModuleDefinition { imported_functions: vec![ImportedFunction { + module: "seal0", name: "gas", params: vec![ValueType::I32], return_type: None, @@ -588,6 +582,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_input", params: vec![ValueType::I32, ValueType::I32], return_type: None, @@ -616,6 +611,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_input", params: vec![ValueType::I32, ValueType::I32], return_type: None, @@ -645,6 +641,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_return", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], return_type: None, @@ -666,6 +663,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_return", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], return_type: None, @@ -692,6 +690,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_terminate", params: vec![ValueType::I32, ValueType::I32], return_type: None, @@ -729,6 +728,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_terminate", params: vec![ValueType::I32, ValueType::I32], return_type: None, @@ -780,6 +780,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_restore_to", params: vec![ ValueType::I32, @@ -864,6 +865,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_restore_to", params: vec![ ValueType::I32, @@ -935,6 +937,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_random", params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: None, @@ -965,6 +968,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_deposit_event", params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: None, @@ -996,6 +1000,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_deposit_event", params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: None, @@ -1026,6 +1031,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory { min_pages: 1, max_pages: 1 }), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_set_rent_allowance", params: vec![ValueType::I32, ValueType::I32], return_type: None, @@ -1056,6 +1062,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory { min_pages: 1, max_pages: 1 }), imported_functions: vec![ImportedFunction { + module: "__unstable__", name: "seal_debug_message", params: vec![ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), @@ -1085,6 +1092,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_set_storage", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], return_type: None, @@ -1114,6 +1122,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_set_storage", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], return_type: None, @@ -1149,6 +1158,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_clear_storage", params: vec![ValueType::I32], return_type: None, @@ -1192,6 +1202,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_get_storage", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), @@ -1233,6 +1244,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_get_storage", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), @@ -1285,6 +1297,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_transfer", params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), @@ -1336,6 +1349,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_call", params: vec![ ValueType::I32, @@ -1387,6 +1401,7 @@ benchmarks! { let callee_code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_return", params: vec![ ValueType::I32, @@ -1417,6 +1432,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_call", params: vec![ ValueType::I32, @@ -1502,6 +1518,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_instantiate", params: vec![ ValueType::I32, @@ -1584,6 +1601,7 @@ benchmarks! { let callee_code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_return", params: vec![ ValueType::I32, @@ -1627,6 +1645,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { + module: "seal0", name: "seal_instantiate", params: vec![ ValueType::I32, diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 793b4c4bf291a..d69964ff778b3 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -17,7 +17,7 @@ use crate::{ CodeHash, Event, Config, Pallet as Contracts, - BalanceOf, ContractInfo, gas::GasMeter, rent::Rent, storage::Storage, + BalanceOf, ContractInfo, gas::GasMeter, rent::{Rent, RentStatus}, storage::Storage, Error, ContractInfoOf, Schedule, AliveContractInfo, AccountCounter, }; use sp_core::crypto::UncheckedFrom; @@ -32,7 +32,7 @@ use frame_support::{ storage::{with_transaction, TransactionOutcome}, traits::{ExistenceRequirement, Currency, Time, Randomness, Get}, weights::Weight, - ensure, + ensure, DefaultNoBound, }; use pallet_contracts_primitives::{ExecReturnValue}; use smallvec::{SmallVec, Array}; @@ -82,7 +82,7 @@ impl> From for ExecError { } /// Information needed for rent calculations that can be requested by a contract. -#[derive(codec::Encode)] +#[derive(codec::Encode, DefaultNoBound)] #[cfg_attr(test, derive(Debug, PartialEq))] pub struct RentParams { /// The total balance of the contract. Includes the balance transferred from the caller. @@ -142,27 +142,6 @@ where } } -/// We cannot derive `Default` because `T` does not necessarily implement `Default`. -#[cfg(test)] -impl Default for RentParams { - fn default() -> Self { - Self { - total_balance: Default::default(), - free_balance: Default::default(), - subsistence_threshold: Default::default(), - deposit_per_contract: Default::default(), - deposit_per_storage_byte: Default::default(), - deposit_per_storage_item: Default::default(), - rent_allowance: Default::default(), - rent_fraction: Default::default(), - storage_size: Default::default(), - code_size: Default::default(), - code_refcount: Default::default(), - _reserved: Default::default(), - } - } -} - /// An interface that provides access to the external environment in which the /// smart-contract is executed. /// @@ -313,6 +292,9 @@ pub trait Ext: sealing::Sealed { /// Information needed for rent calculations. fn rent_params(&self) -> &RentParams; + /// Information about the required deposit and resulting rent. + fn rent_status(&mut self, at_refcount: u32) -> RentStatus; + /// Get a mutable reference to the nested gas meter. fn gas_meter(&mut self) -> &mut GasMeter; @@ -909,11 +891,11 @@ where } } } else { - if let Some(message) = &self.debug_message { + if let Some((msg, false)) = self.debug_message.as_ref().map(|m| (m, m.is_empty())) { log::debug!( target: "runtime::contracts", - "Debug Message: {}", - core::str::from_utf8(message).unwrap_or(""), + "Execution finished with debug buffer: {}", + core::str::from_utf8(msg).unwrap_or(""), ); } // Write back to the root gas meter. @@ -1240,6 +1222,20 @@ where &self.top_frame().rent_params } + fn rent_status(&mut self, at_refcount: u32) -> RentStatus { + let frame = self.top_frame_mut(); + let balance = T::Currency::free_balance(&frame.account_id); + let code_size = frame.rent_params.code_size; + let refcount = frame.rent_params.code_refcount; + >::rent_status( + &balance, + &frame.contract_info(), + code_size, + refcount, + at_refcount, + ) + } + fn gas_meter(&mut self) -> &mut GasMeter { &mut self.top_frame_mut().nested_meter } @@ -2194,6 +2190,48 @@ mod tests { }); } + #[test] + fn rent_status_works() { + let code_hash = MockLoader::insert(Call, |ctx, _| { + assert_eq!(ctx.ext.rent_status(0), RentStatus { + max_deposit: 80000, + current_deposit: 80000, + custom_refcount_deposit: None, + max_rent: 32, + current_rent: 32, + custom_refcount_rent: None, + _reserved: None, + }); + assert_eq!(ctx.ext.rent_status(1), RentStatus { + max_deposit: 80000, + current_deposit: 80000, + custom_refcount_deposit: Some(80000), + max_rent: 32, + current_rent: 32, + custom_refcount_rent: Some(32), + _reserved: None, + }); + exec_success() + }); + + ExtBuilder::default().build().execute_with(|| { + let subsistence = Contracts::::subsistence_threshold(); + let schedule = ::Schedule::get(); + let mut gas_meter = GasMeter::::new(GAS_LIMIT); + set_balance(&ALICE, subsistence * 10); + place_contract(&BOB, code_hash); + MockStack::run_call( + ALICE, + BOB, + &mut gas_meter, + &schedule, + 0, + vec![], + None, + ).unwrap(); + }); + } + #[test] fn in_memory_changes_not_discarded() { // Call stack: BOB -> CHARLIE (trap) -> BOB' (success) diff --git a/frame/contracts/src/gas.rs b/frame/contracts/src/gas.rs index 21b9cce38c2ba..2c19c999b56a3 100644 --- a/frame/contracts/src/gas.rs +++ b/frame/contracts/src/gas.rs @@ -23,6 +23,7 @@ use frame_support::{ DispatchResultWithPostInfo, PostDispatchInfo, DispatchErrorWithPostInfo, DispatchError, }, weights::Weight, + DefaultNoBound, }; use sp_core::crypto::UncheckedFrom; @@ -73,6 +74,7 @@ pub struct ErasedToken { pub token: Box, } +#[derive(DefaultNoBound)] pub struct GasMeter { gas_limit: Weight, /// Amount of gas left from initial gas limit. Can reach zero. @@ -82,18 +84,6 @@ pub struct GasMeter { tokens: Vec, } -impl Default for GasMeter { - fn default() -> Self { - Self { - gas_limit: Default::default(), - gas_left: Default::default(), - _phantom: Default::default(), - #[cfg(test)] - tokens: Default::default(), - } - } -} - impl GasMeter where T::AccountId: UncheckedFrom<::Hash> + AsRef<[u8]> diff --git a/frame/contracts/src/rent.rs b/frame/contracts/src/rent.rs index d57a3004aa0c9..5999a152d04d8 100644 --- a/frame/contracts/src/rent.rs +++ b/frame/contracts/src/rent.rs @@ -28,6 +28,7 @@ use sp_core::crypto::UncheckedFrom; use frame_support::{ storage::child, traits::{Currency, ExistenceRequirement, Get, OnUnbalanced, WithdrawReasons}, + DefaultNoBound, }; use pallet_contracts_primitives::{ContractAccessError, RentProjection, RentProjectionResult}; use sp_runtime::{ @@ -35,54 +36,32 @@ use sp_runtime::{ traits::{Bounded, CheckedDiv, CheckedMul, SaturatedConversion, Saturating, Zero}, }; -/// The amount to charge. +/// Information about the required deposit and resulting rent. /// -/// This amount respects the contract's rent allowance and the subsistence deposit. -/// Because of that, charging the amount cannot remove the contract. -struct OutstandingAmount { - amount: BalanceOf, -} - -impl OutstandingAmount { - /// Create the new outstanding amount. - /// - /// The amount should be always withdrawable and it should not kill the account. - fn new(amount: BalanceOf) -> Self { - Self { amount } - } - - /// Returns the amount this instance wraps. - fn peek(&self) -> BalanceOf { - self.amount - } - - /// Withdraws the outstanding amount from the given account. - fn withdraw(self, account: &T::AccountId) { - if let Ok(imbalance) = T::Currency::withdraw( - account, - self.amount, - WithdrawReasons::FEE, - ExistenceRequirement::KeepAlive, - ) { - // This should never fail. However, let's err on the safe side. - T::RentPayment::on_unbalanced(imbalance); - } - } -} - -enum Verdict { - /// The contract is exempted from paying rent. - /// - /// For example, it already paid its rent in the current block, or it has enough deposit for not - /// paying rent at all. - Exempt, - /// The contract cannot afford payment within its rent budget so it gets evicted. However, - /// because its balance is greater than the subsistence threshold it leaves a tombstone. - Evict { - amount: Option>, - }, - /// Everything is OK, we just only take some charge. - Charge { amount: OutstandingAmount }, +/// The easiest way to guarantee that a contract stays alive is to assert that +/// `max_rent == 0` at the **end** of a contract's execution. +/// +/// # Note +/// +/// The `current_*` fields do **not** consider changes to the code's refcount made during +/// the currently running call. +#[derive(codec::Encode, DefaultNoBound)] +#[cfg_attr(test, derive(Debug, PartialEq))] +pub struct RentStatus { + /// Required deposit assuming that this contract is the only user of its code. + pub max_deposit: BalanceOf, + /// Required deposit assuming the code's current refcount. + pub current_deposit: BalanceOf, + /// Required deposit assuming the specified refcount (None if 0 is supplied). + pub custom_refcount_deposit: Option>, + /// Rent that is paid assuming that the contract is the only user of its code. + pub max_rent: BalanceOf, + /// Rent that is paid given the code's current refcount. + pub current_rent: BalanceOf, + /// Rent that is paid assuming the specified refcount (None is 0 is supplied). + pub custom_refcount_rent: Option>, + /// Reserved for backwards compatible changes to this data structure. + pub _reserved: Option<()>, } pub struct Rent(sp_std::marker::PhantomData<(T, E)>); @@ -93,208 +72,6 @@ where T::AccountId: UncheckedFrom + AsRef<[u8]>, E: Executable, { - /// Returns a fee charged per block from the contract. - /// - /// This function accounts for the storage rent deposit. I.e. if the contract possesses enough funds - /// then the fee can drop to zero. - fn compute_fee_per_block( - free_balance: &BalanceOf, - contract: &AliveContractInfo, - code_size_share: u32, - ) -> BalanceOf { - let uncovered_by_balance = T::DepositPerStorageByte::get() - .saturating_mul(contract.storage_size.saturating_add(code_size_share).into()) - .saturating_add( - T::DepositPerStorageItem::get() - .saturating_mul(contract.pair_count.into()) - ) - .saturating_add(T::DepositPerContract::get()) - .saturating_sub(*free_balance); - T::RentFraction::get().mul_ceil(uncovered_by_balance) - } - - /// Returns amount of funds available to consume by rent mechanism. - /// - /// Rent mechanism cannot consume more than `rent_allowance` set by the contract and it cannot make - /// the balance lower than [`subsistence_threshold`]. - /// - /// In case the toal_balance is below the subsistence threshold, this function returns `None`. - fn rent_budget( - total_balance: &BalanceOf, - free_balance: &BalanceOf, - contract: &AliveContractInfo, - ) -> Option> { - let subsistence_threshold = Pallet::::subsistence_threshold(); - // Reserved balance contributes towards the subsistence threshold to stay consistent - // with the existential deposit where the reserved balance is also counted. - if *total_balance < subsistence_threshold { - return None; - } - - // However, reserved balance cannot be charged so we need to use the free balance - // to calculate the actual budget (which can be 0). - let rent_allowed_to_charge = free_balance.saturating_sub(subsistence_threshold); - Some(>::min( - contract.rent_allowance, - rent_allowed_to_charge, - )) - } - - /// Consider the case for rent payment of the given account and returns a `Verdict`. - /// - /// Use `handicap` in case you want to change the reference block number. (To get more details see - /// `try_eviction` ). - fn consider_case( - account: &T::AccountId, - current_block_number: T::BlockNumber, - handicap: T::BlockNumber, - contract: &AliveContractInfo, - code_size: u32, - ) -> Verdict { - // How much block has passed since the last deduction for the contract. - let blocks_passed = { - // Calculate an effective block number, i.e. after adjusting for handicap. - let effective_block_number = current_block_number.saturating_sub(handicap); - effective_block_number.saturating_sub(contract.deduct_block) - }; - if blocks_passed.is_zero() { - // Rent has already been paid - return Verdict::Exempt; - } - - let total_balance = T::Currency::total_balance(account); - let free_balance = T::Currency::free_balance(account); - - // An amount of funds to charge per block for storage taken up by the contract. - let fee_per_block = Self::compute_fee_per_block(&free_balance, contract, code_size); - if fee_per_block.is_zero() { - // The rent deposit offset reduced the fee to 0. This means that the contract - // gets the rent for free. - return Verdict::Exempt; - } - - let rent_budget = match Self::rent_budget(&total_balance, &free_balance, contract) { - Some(rent_budget) => rent_budget, - None => { - // All functions that allow a contract to transfer balance enforce - // that the contract always stays above the subsistence threshold. - // We want the rent system to always leave a tombstone to prevent the - // accidental loss of a contract. Ony `seal_terminate` can remove a - // contract without a tombstone. Therefore this case should be never - // hit. - log::error!( - target: "runtime::contracts", - "Tombstoned a contract that is below the subsistence threshold: {:?}", - account, - ); - 0u32.into() - } - }; - - let dues = fee_per_block - .checked_mul(&blocks_passed.saturated_into::().into()) - .unwrap_or_else(|| >::max_value()); - let insufficient_rent = rent_budget < dues; - - // If the rent payment cannot be withdrawn due to locks on the account balance, then evict the - // account. - // - // NOTE: This seems problematic because it provides a way to tombstone an account while - // avoiding the last rent payment. In effect, someone could retroactively set rent_allowance - // for their contract to 0. - let dues_limited = dues.min(rent_budget); - let can_withdraw_rent = T::Currency::ensure_can_withdraw( - account, - dues_limited, - WithdrawReasons::FEE, - free_balance.saturating_sub(dues_limited), - ) - .is_ok(); - - if insufficient_rent || !can_withdraw_rent { - // The contract cannot afford the rent payment and has a balance above the subsistence - // threshold, so it leaves a tombstone. - let amount = if can_withdraw_rent { - Some(OutstandingAmount::new(dues_limited)) - } else { - None - }; - return Verdict::Evict { amount }; - } - - return Verdict::Charge { - // We choose to use `dues_limited` here instead of `dues` just to err on the safer side. - amount: OutstandingAmount::new(dues_limited), - }; - } - - /// Enacts the given verdict and returns the updated `ContractInfo`. - /// - /// `alive_contract_info` should be from the same address as `account`. - /// - /// # Note - /// - /// if `evictable_code` is `None` an `Evict` verdict will not be enacted. This is for - /// when calling this function during a `call` where access to the soon to be evicted - /// contract should be denied but storage should be left unmodified. - fn enact_verdict( - account: &T::AccountId, - alive_contract_info: AliveContractInfo, - current_block_number: T::BlockNumber, - verdict: Verdict, - evictable_code: Option>, - ) -> Result>, DispatchError> { - match (verdict, evictable_code) { - (Verdict::Evict { amount }, Some(code)) => { - // We need to remove the trie first because it is the only operation - // that can fail and this function is called without a storage - // transaction when called through `claim_surcharge`. - Storage::::queue_trie_for_deletion(&alive_contract_info)?; - - if let Some(amount) = amount { - amount.withdraw(account); - } - - // Note: this operation is heavy. - let child_storage_root = child::root( - &alive_contract_info.child_trie_info(), - ); - - let tombstone = >::new( - &child_storage_root[..], - alive_contract_info.code_hash, - ); - let tombstone_info = ContractInfo::Tombstone(tombstone); - >::insert(account, &tombstone_info); - code.drop_from_storage(); - >::deposit_event(Event::Evicted(account.clone())); - Ok(None) - } - (Verdict::Evict { amount: _ }, None) => { - Ok(None) - } - (Verdict::Exempt, _) => { - let contract = ContractInfo::Alive(AliveContractInfo:: { - deduct_block: current_block_number, - ..alive_contract_info - }); - >::insert(account, &contract); - Ok(Some(contract.get_alive().expect("We just constructed it as alive. qed"))) - }, - (Verdict::Charge { amount }, _) => { - let contract = ContractInfo::Alive(AliveContractInfo:: { - rent_allowance: alive_contract_info.rent_allowance - amount.peek(), - deduct_block: current_block_number, - rent_payed: alive_contract_info.rent_payed.saturating_add(amount.peek()), - ..alive_contract_info - }); - >::insert(account, &contract); - amount.withdraw(account); - Ok(Some(contract.get_alive().expect("We just constructed it as alive. qed"))) - } - } - } - /// Make account paying the rent for the current block number /// /// This functions does **not** evict the contract. It returns `None` in case the @@ -412,7 +189,7 @@ where // Compute how much would the fee per block be with the *updated* balance. let total_balance = T::Currency::total_balance(account); let free_balance = T::Currency::free_balance(account); - let fee_per_block = Self::compute_fee_per_block( + let fee_per_block = Self::fee_per_block( &free_balance, &alive_contract_info, code_size, ); if fee_per_block.is_zero() { @@ -532,4 +309,300 @@ where Ok((caller_code_len, tombstone_code_len)) } + + /// Create a new `RentStatus` struct for pass through to a requesting contract. + pub fn rent_status( + free_balance: &BalanceOf, + contract: &AliveContractInfo, + aggregated_code_size: u32, + current_refcount: u32, + at_refcount: u32, + ) -> RentStatus { + let calc_share = |refcount: u32| { + aggregated_code_size.checked_div(refcount).unwrap_or(0) + }; + let current_share = calc_share(current_refcount); + let custom_share = calc_share(at_refcount); + RentStatus { + max_deposit: Self::required_deposit(contract, aggregated_code_size), + current_deposit: Self::required_deposit(contract, current_share), + custom_refcount_deposit: + if at_refcount > 0 { + Some(Self::required_deposit(contract, custom_share)) + } else { + None + }, + max_rent: Self::fee_per_block(free_balance, contract, aggregated_code_size), + current_rent: Self::fee_per_block(free_balance, contract, current_share), + custom_refcount_rent: + if at_refcount > 0 { + Some(Self::fee_per_block(free_balance, contract, custom_share)) + } else { + None + }, + _reserved: None, + } + } + + /// Returns how much deposit is required to not pay rent. + fn required_deposit( + contract: &AliveContractInfo, + code_size_share: u32, + ) -> BalanceOf { + T::DepositPerStorageByte::get() + .saturating_mul(contract.storage_size.saturating_add(code_size_share).into()) + .saturating_add( + T::DepositPerStorageItem::get() + .saturating_mul(contract.pair_count.into()) + ) + .saturating_add(T::DepositPerContract::get()) + } + + /// Returns a fee charged per block from the contract. + /// + /// This function accounts for the storage rent deposit. I.e. if the contract + /// possesses enough funds then the fee can drop to zero. + fn fee_per_block( + free_balance: &BalanceOf, + contract: &AliveContractInfo, + code_size_share: u32, + ) -> BalanceOf { + let missing_deposit = Self::required_deposit(contract, code_size_share) + .saturating_sub(*free_balance); + T::RentFraction::get().mul_ceil(missing_deposit) + } + + /// Returns amount of funds available to consume by rent mechanism. + /// + /// Rent mechanism cannot consume more than `rent_allowance` set by the contract and it cannot make + /// the balance lower than [`subsistence_threshold`]. + /// + /// In case the toal_balance is below the subsistence threshold, this function returns `None`. + fn rent_budget( + total_balance: &BalanceOf, + free_balance: &BalanceOf, + contract: &AliveContractInfo, + ) -> Option> { + let subsistence_threshold = Pallet::::subsistence_threshold(); + // Reserved balance contributes towards the subsistence threshold to stay consistent + // with the existential deposit where the reserved balance is also counted. + if *total_balance < subsistence_threshold { + return None; + } + + // However, reserved balance cannot be charged so we need to use the free balance + // to calculate the actual budget (which can be 0). + let rent_allowed_to_charge = free_balance.saturating_sub(subsistence_threshold); + Some(>::min( + contract.rent_allowance, + rent_allowed_to_charge, + )) + } + + /// Consider the case for rent payment of the given account and returns a `Verdict`. + /// + /// Use `handicap` in case you want to change the reference block number. (To get more details see + /// `try_eviction` ). + fn consider_case( + account: &T::AccountId, + current_block_number: T::BlockNumber, + handicap: T::BlockNumber, + contract: &AliveContractInfo, + code_size: u32, + ) -> Verdict { + // How much block has passed since the last deduction for the contract. + let blocks_passed = { + // Calculate an effective block number, i.e. after adjusting for handicap. + let effective_block_number = current_block_number.saturating_sub(handicap); + effective_block_number.saturating_sub(contract.deduct_block) + }; + if blocks_passed.is_zero() { + // Rent has already been paid + return Verdict::Exempt; + } + + let total_balance = T::Currency::total_balance(account); + let free_balance = T::Currency::free_balance(account); + + // An amount of funds to charge per block for storage taken up by the contract. + let fee_per_block = Self::fee_per_block(&free_balance, contract, code_size); + if fee_per_block.is_zero() { + // The rent deposit offset reduced the fee to 0. This means that the contract + // gets the rent for free. + return Verdict::Exempt; + } + + let rent_budget = match Self::rent_budget(&total_balance, &free_balance, contract) { + Some(rent_budget) => rent_budget, + None => { + // All functions that allow a contract to transfer balance enforce + // that the contract always stays above the subsistence threshold. + // We want the rent system to always leave a tombstone to prevent the + // accidental loss of a contract. Ony `seal_terminate` can remove a + // contract without a tombstone. Therefore this case should be never + // hit. + log::error!( + target: "runtime::contracts", + "Tombstoned a contract that is below the subsistence threshold: {:?}", + account, + ); + 0u32.into() + } + }; + + let dues = fee_per_block + .checked_mul(&blocks_passed.saturated_into::().into()) + .unwrap_or_else(|| >::max_value()); + let insufficient_rent = rent_budget < dues; + + // If the rent payment cannot be withdrawn due to locks on the account balance, then evict the + // account. + // + // NOTE: This seems problematic because it provides a way to tombstone an account while + // avoiding the last rent payment. In effect, someone could retroactively set rent_allowance + // for their contract to 0. + let dues_limited = dues.min(rent_budget); + let can_withdraw_rent = T::Currency::ensure_can_withdraw( + account, + dues_limited, + WithdrawReasons::FEE, + free_balance.saturating_sub(dues_limited), + ) + .is_ok(); + + if insufficient_rent || !can_withdraw_rent { + // The contract cannot afford the rent payment and has a balance above the subsistence + // threshold, so it leaves a tombstone. + let amount = if can_withdraw_rent { + Some(OutstandingAmount::new(dues_limited)) + } else { + None + }; + return Verdict::Evict { amount }; + } + + return Verdict::Charge { + // We choose to use `dues_limited` here instead of `dues` just to err on the safer side. + amount: OutstandingAmount::new(dues_limited), + }; + } + + /// Enacts the given verdict and returns the updated `ContractInfo`. + /// + /// `alive_contract_info` should be from the same address as `account`. + /// + /// # Note + /// + /// if `evictable_code` is `None` an `Evict` verdict will not be enacted. This is for + /// when calling this function during a `call` where access to the soon to be evicted + /// contract should be denied but storage should be left unmodified. + fn enact_verdict( + account: &T::AccountId, + alive_contract_info: AliveContractInfo, + current_block_number: T::BlockNumber, + verdict: Verdict, + evictable_code: Option>, + ) -> Result>, DispatchError> { + match (verdict, evictable_code) { + (Verdict::Evict { amount }, Some(code)) => { + // We need to remove the trie first because it is the only operation + // that can fail and this function is called without a storage + // transaction when called through `claim_surcharge`. + Storage::::queue_trie_for_deletion(&alive_contract_info)?; + + if let Some(amount) = amount { + amount.withdraw(account); + } + + // Note: this operation is heavy. + let child_storage_root = child::root( + &alive_contract_info.child_trie_info(), + ); + + let tombstone = >::new( + &child_storage_root[..], + alive_contract_info.code_hash, + ); + let tombstone_info = ContractInfo::Tombstone(tombstone); + >::insert(account, &tombstone_info); + code.drop_from_storage(); + >::deposit_event(Event::Evicted(account.clone())); + Ok(None) + } + (Verdict::Evict { amount: _ }, None) => { + Ok(None) + } + (Verdict::Exempt, _) => { + let contract = ContractInfo::Alive(AliveContractInfo:: { + deduct_block: current_block_number, + ..alive_contract_info + }); + >::insert(account, &contract); + Ok(Some(contract.get_alive().expect("We just constructed it as alive. qed"))) + }, + (Verdict::Charge { amount }, _) => { + let contract = ContractInfo::Alive(AliveContractInfo:: { + rent_allowance: alive_contract_info.rent_allowance - amount.peek(), + deduct_block: current_block_number, + rent_payed: alive_contract_info.rent_payed.saturating_add(amount.peek()), + ..alive_contract_info + }); + >::insert(account, &contract); + amount.withdraw(account); + Ok(Some(contract.get_alive().expect("We just constructed it as alive. qed"))) + } + } + } + + +} + +/// The amount to charge. +/// +/// This amount respects the contract's rent allowance and the subsistence deposit. +/// Because of that, charging the amount cannot remove the contract. +struct OutstandingAmount { + amount: BalanceOf, +} + +impl OutstandingAmount { + /// Create the new outstanding amount. + /// + /// The amount should be always withdrawable and it should not kill the account. + fn new(amount: BalanceOf) -> Self { + Self { amount } + } + + /// Returns the amount this instance wraps. + fn peek(&self) -> BalanceOf { + self.amount + } + + /// Withdraws the outstanding amount from the given account. + fn withdraw(self, account: &T::AccountId) { + if let Ok(imbalance) = T::Currency::withdraw( + account, + self.amount, + WithdrawReasons::FEE, + ExistenceRequirement::KeepAlive, + ) { + // This should never fail. However, let's err on the safe side. + T::RentPayment::on_unbalanced(imbalance); + } + } +} + +enum Verdict { + /// The contract is exempted from paying rent. + /// + /// For example, it already paid its rent in the current block, or it has enough deposit for not + /// paying rent at all. + Exempt, + /// The contract cannot afford payment within its rent budget so it gets evicted. However, + /// because its balance is greater than the subsistence threshold it leaves a tombstone. + Evict { + amount: Option>, + }, + /// Everything is OK, we just only take some charge. + Charge { amount: OutstandingAmount }, } diff --git a/frame/contracts/src/schedule.rs b/frame/contracts/src/schedule.rs index a94a08e27d795..67f531f2ba6ac 100644 --- a/frame/contracts/src/schedule.rs +++ b/frame/contracts/src/schedule.rs @@ -23,7 +23,7 @@ use crate::{Config, weights::WeightInfo}; #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; use pallet_contracts_proc_macro::{ScheduleDebug, WeightDebug}; -use frame_support::weights::Weight; +use frame_support::{DefaultNoBound, weights::Weight}; use sp_std::{marker::PhantomData, vec::Vec}; use codec::{Encode, Decode}; use parity_wasm::elements; @@ -46,7 +46,7 @@ pub const INSTR_BENCHMARK_BATCH_SIZE: u32 = 1_000; /// should rely on public functions of this type. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", serde(bound(serialize = "", deserialize = "")))] -#[derive(Clone, Encode, Decode, PartialEq, Eq, ScheduleDebug)] +#[derive(Clone, Encode, Decode, PartialEq, Eq, ScheduleDebug, DefaultNoBound)] pub struct Schedule { /// Describes the upper limits on various metrics. pub(crate) limits: Limits, @@ -388,9 +388,6 @@ pub struct HostFnWeights { /// Weight per byte hashed by `seal_hash_blake2_128`. pub hash_blake2_128_per_byte: Weight, - /// Weight of calling `seal_rent_params`. - pub rent_params: Weight, - /// The type parameter is used in the default implementation. #[codec(skip)] pub _phantom: PhantomData @@ -473,16 +470,6 @@ macro_rules! cost_byte_batched { } } -impl Default for Schedule { - fn default() -> Self { - Self { - limits: Default::default(), - instruction_weights: Default::default(), - host_fn_weights: Default::default(), - } - } -} - impl Default for Limits { fn default() -> Self { Self { @@ -619,7 +606,6 @@ impl Default for HostFnWeights { hash_blake2_256_per_byte: cost_byte_batched!(seal_hash_blake2_256_per_kb), hash_blake2_128: cost_batched!(seal_hash_blake2_128), hash_blake2_128_per_byte: cost_byte_batched!(seal_hash_blake2_128_per_kb), - rent_params: cost_batched!(seal_rent_params), _phantom: PhantomData, } } diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index a1308767fb657..f3d6be6279f99 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -2835,6 +2835,7 @@ fn reinstrument_does_charge() { } #[test] +#[cfg(feature = "unstable-interface")] fn debug_message_works() { let (wasm, code_hash) = compile_module::("debug_message_works").unwrap(); @@ -2866,6 +2867,7 @@ fn debug_message_works() { } #[test] +#[cfg(feature = "unstable-interface")] fn debug_message_logging_disabled() { let (wasm, code_hash) = compile_module::("debug_message_logging_disabled").unwrap(); @@ -2905,6 +2907,7 @@ fn debug_message_logging_disabled() { } #[test] +#[cfg(feature = "unstable-interface")] fn debug_message_invalid_utf8() { let (wasm, code_hash) = compile_module::("debug_message_invalid_utf8").unwrap(); diff --git a/frame/contracts/src/wasm/env_def/macros.rs b/frame/contracts/src/wasm/env_def/macros.rs index 10d61bab1bb2c..a8127939c0189 100644 --- a/frame/contracts/src/wasm/env_def/macros.rs +++ b/frame/contracts/src/wasm/env_def/macros.rs @@ -50,7 +50,12 @@ macro_rules! gen_signature_dispatch { $name:ident ( $ctx:ident $( , $names:ident : $params:ty )* ) $( -> $returns:ty )* , $($rest:tt)* ) => { - if stringify!($module).as_bytes() == $needle_module && stringify!($name).as_bytes() == $needle_name { + let module = stringify!($module).as_bytes(); + #[cfg(not(feature = "unstable-interface"))] + if module == b"__unstable__" { + return false; + } + if module == $needle_module && stringify!($name).as_bytes() == $needle_name { let signature = gen_signature!( ( $( $params ),* ) $( -> $returns )* ); if $needle_sig == &signature { return true; @@ -127,8 +132,8 @@ macro_rules! unmarshall_then_body_then_marshall { } macro_rules! define_func { - ( < E: $seal_ty:tt > $name:ident ( $ctx: ident $(, $names:ident : $params:ty)*) $(-> $returns:ty)* => $body:tt ) => { - fn $name< E: $seal_ty >( + ( $trait:tt $name:ident ( $ctx: ident $(, $names:ident : $params:ty)*) $(-> $returns:ty)* => $body:tt ) => { + fn $name< E: $trait >( $ctx: &mut $crate::wasm::Runtime, args: &[sp_sandbox::Value], ) -> Result @@ -149,24 +154,52 @@ macro_rules! define_func { }; } -macro_rules! register_func { - ( $reg_cb:ident, < E: $seal_ty:tt > ; ) => {}; - - ( $reg_cb:ident, < E: $seal_ty:tt > ; +macro_rules! register_body { + ( $reg_cb:ident, $trait:tt; $module:ident $name:ident ( $ctx:ident $( , $names:ident : $params:ty )* ) - $( -> $returns:ty )* => $body:tt $($rest:tt)* + $( -> $returns:ty )* => $body:tt ) => { $reg_cb( stringify!($module).as_bytes(), stringify!($name).as_bytes(), { define_func!( - < E: $seal_ty > $name ( $ctx $(, $names : $params )* ) $( -> $returns )* => $body + $trait $name ( $ctx $(, $names : $params )* ) $( -> $returns )* => $body ); $name:: } ); - register_func!( $reg_cb, < E: $seal_ty > ; $($rest)* ); + } +} + +macro_rules! register_func { + ( $reg_cb:ident, $trait:tt; ) => {}; + + ( $reg_cb:ident, $trait:tt; + __unstable__ $name:ident ( $ctx:ident $( , $names:ident : $params:ty )* ) + $( -> $returns:ty )* => $body:tt $($rest:tt)* + ) => { + #[cfg(feature = "unstable-interface")] + register_body!( + $reg_cb, $trait; + __unstable__ $name + ( $ctx $( , $names : $params )* ) + $( -> $returns )* => $body + ); + register_func!( $reg_cb, $trait; $($rest)* ); + }; + + ( $reg_cb:ident, $trait:tt; + $module:ident $name:ident ( $ctx:ident $( , $names:ident : $params:ty )* ) + $( -> $returns:ty )* => $body:tt $($rest:tt)* + ) => { + register_body!( + $reg_cb, $trait; + $module $name + ( $ctx $( , $names : $params )* ) + $( -> $returns )* => $body + ); + register_func!( $reg_cb, $trait; $($rest)* ); }; } @@ -178,7 +211,7 @@ macro_rules! register_func { /// It's up to the user of this macro to check signatures of wasm code to be executed /// and reject the code if any imported function has a mismatched signature. macro_rules! define_env { - ( $init_name:ident , < E: $seal_ty:tt > , + ( $init_name:ident , < E: $trait:tt > , $( [$module:ident] $name:ident ( $ctx:ident $( , $names:ident : $params:ty )* ) $( -> $returns:ty )* => $body:tt , )* ) => { @@ -204,7 +237,7 @@ macro_rules! define_env { fn impls)>(f: &mut F) { register_func!( f, - < E: $seal_ty > ; + $trait; $( $module $name ( $ctx $( , $names : $params )* ) $( -> $returns)* => $body )* ); } @@ -285,7 +318,7 @@ mod tests { #[test] fn macro_define_func() { - define_func!( seal_gas (_ctx, amount: u32) => { + define_func!( Ext seal_gas (_ctx, amount: u32) => { let amount = Weight::from(amount); if !amount.is_zero() { Ok(()) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 04e9bf2d905bb..ed603732f6c02 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -247,6 +247,7 @@ mod tests { RentParams, ExecError, ErrorOrigin, }, gas::GasMeter, + rent::RentStatus, tests::{Test, Call, ALICE, BOB}, }; use std::collections::HashMap; @@ -452,6 +453,9 @@ mod tests { fn rent_params(&self) -> &RentParams { &self.rent_params } + fn rent_status(&mut self, _at_refcount: u32) -> RentStatus { + Default::default() + } fn gas_meter(&mut self) -> &mut GasMeter { &mut self.gas_meter } @@ -1817,9 +1821,14 @@ mod tests { ); } - const CODE_RENT_PARAMS: &str = r#" + + + #[test] + #[cfg(feature = "unstable-interface")] + fn rent_params_work() { + const CODE_RENT_PARAMS: &str = r#" (module - (import "seal0" "seal_rent_params" (func $seal_rent_params (param i32 i32))) + (import "__unstable__" "seal_rent_params" (func $seal_rent_params (param i32 i32))) (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) (import "env" "memory" (memory 1 1)) @@ -1846,9 +1855,6 @@ mod tests { (func (export "deploy")) ) "#; - - #[test] - fn rent_params_work() { let output = execute( CODE_RENT_PARAMS, vec![], @@ -1858,9 +1864,56 @@ mod tests { assert_eq!(output, ExecReturnValue { flags: ReturnFlags::empty(), data: rent_params }); } - const CODE_DEBUG_MESSAGE: &str = r#" + + + #[test] + #[cfg(feature = "unstable-interface")] + fn rent_status_works() { + const CODE_RENT_STATUS: &str = r#" +(module + (import "__unstable__" "seal_rent_status" (func $seal_rent_status (param i32 i32 i32))) + (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) + (import "env" "memory" (memory 1 1)) + + ;; [0, 4) buffer size = 128 bytes + (data (i32.const 0) "\80") + + ;; [4; inf) buffer where the result is copied + + (func (export "call") + ;; Load the rent params into memory + (call $seal_rent_status + (i32.const 1) ;; at_refcount + (i32.const 4) ;; Pointer to the output buffer + (i32.const 0) ;; Pointer to the size of the buffer + ) + + ;; Return the contents of the buffer + (call $seal_return + (i32.const 0) ;; return flags + (i32.const 4) ;; buffer pointer + (i32.load (i32.const 0)) ;; buffer size + ) + ) + + (func (export "deploy")) +) +"#; + let output = execute( + CODE_RENT_STATUS, + vec![], + MockExt::default(), + ).unwrap(); + let rent_status = Bytes(>::default().encode()); + assert_eq!(output, ExecReturnValue { flags: ReturnFlags::empty(), data: rent_status }); + } + + #[test] + #[cfg(feature = "unstable-interface")] + fn debug_message_works() { + const CODE_DEBUG_MESSAGE: &str = r#" (module - (import "seal0" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) + (import "__unstable__" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) (data (i32.const 0) "Hello World!") @@ -1876,9 +1929,6 @@ mod tests { (func (export "deploy")) ) "#; - - #[test] - fn debug_message_works() { let mut ext = MockExt::default(); execute( CODE_DEBUG_MESSAGE, @@ -1889,39 +1939,39 @@ mod tests { assert_eq!(std::str::from_utf8(&ext.debug_buffer).unwrap(), "Hello World!"); } - const CODE_DEBUG_MESSAGE_FAIL: &str = r#" - (module - (import "seal0" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) - (import "env" "memory" (memory 1 1)) + #[test] + #[cfg(feature = "unstable-interface")] + fn debug_message_invalid_utf8_fails() { + const CODE_DEBUG_MESSAGE_FAIL: &str = r#" +(module + (import "__unstable__" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32))) + (import "env" "memory" (memory 1 1)) - (data (i32.const 0) "\fc") + (data (i32.const 0) "\fc") - (func (export "call") - (call $seal_debug_message - (i32.const 0) ;; Pointer to the text buffer - (i32.const 1) ;; The size of the buffer - ) - drop + (func (export "call") + (call $seal_debug_message + (i32.const 0) ;; Pointer to the text buffer + (i32.const 1) ;; The size of the buffer ) - - (func (export "deploy")) + drop ) - "#; - #[test] - fn debug_message_invalid_utf8_fails() { - let mut ext = MockExt::default(); - let result = execute( - CODE_DEBUG_MESSAGE_FAIL, - vec![], - &mut ext, - ); - assert_eq!( - result, - Err(ExecError { - error: Error::::DebugMessageInvalidUTF8.into(), - origin: ErrorOrigin::Caller, - }) - ); - } + (func (export "deploy")) +) +"#; + let mut ext = MockExt::default(); + let result = execute( + CODE_DEBUG_MESSAGE_FAIL, + vec![], + &mut ext, + ); + assert_eq!( + result, + Err(ExecError { + error: Error::::DebugMessageInvalidUTF8.into(), + origin: ErrorOrigin::Caller, + }) + ); + } } diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 0935dbe9cbe3f..f9e6e9283211a 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -73,6 +73,7 @@ pub enum ReturnCode { NotCallable = 8, /// The call to `seal_debug_message` had no effect because debug message /// recording was disabled. + #[cfg(feature = "unstable-interface")] LoggingDisabled = 9, } @@ -179,6 +180,7 @@ pub enum RuntimeCosts { /// Weight of calling `seal_deposit_event` with the given number of topics and event size. DepositEvent{num_topic: u32, len: u32}, /// Weight of calling `seal_debug_message`. + #[cfg(feature = "unstable-interface")] DebugMessage, /// Weight of calling `seal_set_rent_allowance`. SetRentAllowance, @@ -220,8 +222,6 @@ pub enum RuntimeCosts { ChainExtension(u64), /// Weight charged for copying data from the sandbox. CopyIn(u32), - /// Weight of calling `seal_rent_params`. - RentParams, } impl RuntimeCosts { @@ -260,6 +260,7 @@ impl RuntimeCosts { DepositEvent{num_topic, len} => s.deposit_event .saturating_add(s.deposit_event_per_topic.saturating_mul(num_topic.into())) .saturating_add(s.deposit_event_per_byte.saturating_mul(len.into())), + #[cfg(feature = "unstable-interface")] DebugMessage => s.debug_message, SetRentAllowance => s.set_rent_allowance, SetStorage(len) => s.set_storage @@ -290,7 +291,6 @@ impl RuntimeCosts { .saturating_add(s.hash_blake2_128_per_byte.saturating_mul(len.into())), ChainExtension(amount) => amount, CopyIn(len) => s.return_per_byte.saturating_mul(len.into()), - RentParams => s.rent_params, }; RuntimeToken { #[cfg(test)] @@ -1390,35 +1390,6 @@ define_env!(Env, , )?) }, - // Emit a custom debug message. - // - // No newlines are added to the supplied message. - // Specifying invalid UTF-8 triggers a trap. - // - // This is a no-op if debug message recording is disabled which is always the case - // when the code is executing on-chain. The message is interpreted as UTF-8 and - // appended to the debug buffer which is then supplied to the calling RPC client. - // - // # Note - // - // Even though no action is taken when debug message recording is disabled there is still - // a non trivial overhead (and weight cost) associated with calling this function. Contract - // languages should remove calls to this function (either at runtime or compile time) when - // not being executed as an RPC. For example, they could allow users to disable logging - // through compile time flags (cargo features) for on-chain deployment. Additionally, the - // return value of this function can be cached in order to prevent further calls at runtime. - [seal0] seal_debug_message(ctx, str_ptr: u32, str_len: u32) -> ReturnCode => { - ctx.charge_gas(RuntimeCosts::DebugMessage)?; - if ctx.ext.append_debug_buffer("") { - let data = ctx.read_sandbox_memory(str_ptr, str_len)?; - let msg = core::str::from_utf8(&data) - .map_err(|_| >::DebugMessageInvalidUTF8)?; - ctx.ext.append_debug_buffer(msg); - return Ok(ReturnCode::Success); - } - Ok(ReturnCode::LoggingDisabled) - }, - // Stores the current block number of the current contract into the supplied buffer. // // The value is stored to linear memory at the address pointed to by `out_ptr`. @@ -1565,6 +1536,35 @@ define_env!(Env, , } }, + // Emit a custom debug message. + // + // No newlines are added to the supplied message. + // Specifying invalid UTF-8 triggers a trap. + // + // This is a no-op if debug message recording is disabled which is always the case + // when the code is executing on-chain. The message is interpreted as UTF-8 and + // appended to the debug buffer which is then supplied to the calling RPC client. + // + // # Note + // + // Even though no action is taken when debug message recording is disabled there is still + // a non trivial overhead (and weight cost) associated with calling this function. Contract + // languages should remove calls to this function (either at runtime or compile time) when + // not being executed as an RPC. For example, they could allow users to disable logging + // through compile time flags (cargo features) for on-chain deployment. Additionally, the + // return value of this function can be cached in order to prevent further calls at runtime. + [__unstable__] seal_debug_message(ctx, str_ptr: u32, str_len: u32) -> ReturnCode => { + ctx.charge_gas(RuntimeCosts::DebugMessage)?; + if ctx.ext.append_debug_buffer("") { + let data = ctx.read_sandbox_memory(str_ptr, str_len)?; + let msg = core::str::from_utf8(&data) + .map_err(|_| >::DebugMessageInvalidUTF8)?; + ctx.ext.append_debug_buffer(msg); + return Ok(ReturnCode::Success); + } + Ok(ReturnCode::LoggingDisabled) + }, + // Stores the rent params into the supplied buffer. // // The value is stored to linear memory at the address pointed to by `out_ptr`. @@ -1579,10 +1579,38 @@ define_env!(Env, , // The returned information was collected and cached when the current contract call // started execution. Any change to those values that happens due to actions of the // current call or contracts that are called by this contract are not considered. - [seal0] seal_rent_params(ctx, out_ptr: u32, out_len_ptr: u32) => { - ctx.charge_gas(RuntimeCosts::RentParams)?; + // + // # Unstable + // + // This function is unstable and subject to change (or removal) in the future. Do not + // deploy a contract using it to a production chain. + [__unstable__] seal_rent_params(ctx, out_ptr: u32, out_len_ptr: u32) => { Ok(ctx.write_sandbox_output( out_ptr, out_len_ptr, &ctx.ext.rent_params().encode(), false, already_charged )?) }, + + // Stores the rent status into the supplied buffer. + // + // The value is stored to linear memory at the address pointed to by `out_ptr`. + // `out_len_ptr` must point to a u32 value that describes the available space at + // `out_ptr`. This call overwrites it with the size of the value. If the available + // space at `out_ptr` is less than the size of the value a trap is triggered. + // + // The data is encoded as [`crate::rent::RentStatus`]. + // + // # Parameters + // + // - `at_refcount`: The refcount assumed for the returned `custom_refcount_*` fields + // + // # Unstable + // + // This function is unstable and subject to change (or removal) in the future. Do not + // deploy a contract using it to a production chain. + [__unstable__] seal_rent_status(ctx, at_refcount: u32, out_ptr: u32, out_len_ptr: u32) => { + let rent_status = ctx.ext.rent_status(at_refcount).encode(); + Ok(ctx.write_sandbox_output( + out_ptr, out_len_ptr, &rent_status, false, already_charged + )?) + }, ); diff --git a/frame/contracts/src/weights.rs b/frame/contracts/src/weights.rs index ea3f424dd98c5..b96a3cad5b735 100644 --- a/frame/contracts/src/weights.rs +++ b/frame/contracts/src/weights.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-05-10, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-05-11, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -63,6 +63,7 @@ pub trait WeightInfo { fn seal_block_number(r: u32, ) -> Weight; fn seal_now(r: u32, ) -> Weight; fn seal_rent_params(r: u32, ) -> Weight; + fn seal_rent_status(r: u32, ) -> Weight; fn seal_weight_to_fee(r: u32, ) -> Weight; fn seal_gas(r: u32, ) -> Weight; fn seal_input(r: u32, ) -> Weight; @@ -153,303 +154,310 @@ pub trait WeightInfo { pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { fn on_initialize() -> Weight { - (3_676_000 as Weight) + (3_656_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) } fn on_initialize_per_trie_key(k: u32, ) -> Weight { (0 as Weight) - // Standard Error: 2_000 - .saturating_add((2_259_000 as Weight).saturating_mul(k as Weight)) + // Standard Error: 3_000 + .saturating_add((2_241_000 as Weight).saturating_mul(k as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(k as Weight))) } fn on_initialize_per_queue_item(q: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 33_000 - .saturating_add((35_157_000 as Weight).saturating_mul(q as Weight)) + (36_820_000 as Weight) + // Standard Error: 4_000 + .saturating_add((34_550_000 as Weight).saturating_mul(q as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn instrument(c: u32, ) -> Weight { - (42_341_000 as Weight) - // Standard Error: 190_000 - .saturating_add((95_696_000 as Weight).saturating_mul(c as Weight)) + (42_348_000 as Weight) + // Standard Error: 185_000 + .saturating_add((95_664_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (178_191_000 as Weight) - // Standard Error: 141_000 - .saturating_add((135_736_000 as Weight).saturating_mul(c as Weight)) + (210_852_000 as Weight) + // Standard Error: 138_000 + .saturating_add((135_241_000 as Weight).saturating_mul(c as Weight)) // Standard Error: 9_000 - .saturating_add((1_867_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_846_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn instantiate(c: u32, s: u32, ) -> Weight { - (183_874_000 as Weight) - // Standard Error: 11_000 - .saturating_add((8_659_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 1_000 - .saturating_add((1_781_000 as Weight).saturating_mul(s as Weight)) + (217_380_000 as Weight) + // Standard Error: 6_000 + .saturating_add((8_483_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 0 + .saturating_add((1_752_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn call(c: u32, ) -> Weight { - (186_051_000 as Weight) - // Standard Error: 1_000 - .saturating_add((3_919_000 as Weight).saturating_mul(c as Weight)) + (181_443_000 as Weight) + // Standard Error: 3_000 + .saturating_add((3_955_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn claim_surcharge(c: u32, ) -> Weight { - (133_967_000 as Weight) - // Standard Error: 2_000 - .saturating_add((4_733_000 as Weight).saturating_mul(c as Weight)) + (132_551_000 as Weight) + // Standard Error: 1_000 + .saturating_add((4_740_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn seal_caller(r: u32, ) -> Weight { - (131_758_000 as Weight) - // Standard Error: 361_000 - .saturating_add((249_131_000 as Weight).saturating_mul(r as Weight)) + (137_742_000 as Weight) + // Standard Error: 74_000 + .saturating_add((242_261_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_address(r: u32, ) -> Weight { - (141_100_000 as Weight) - // Standard Error: 73_000 - .saturating_add((245_593_000 as Weight).saturating_mul(r as Weight)) + (137_739_000 as Weight) + // Standard Error: 91_000 + .saturating_add((241_803_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_gas_left(r: u32, ) -> Weight { - (141_578_000 as Weight) - // Standard Error: 76_000 - .saturating_add((240_505_000 as Weight).saturating_mul(r as Weight)) + (139_631_000 as Weight) + // Standard Error: 83_000 + .saturating_add((236_790_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_balance(r: u32, ) -> Weight { - (144_329_000 as Weight) - // Standard Error: 197_000 - .saturating_add((529_903_000 as Weight).saturating_mul(r as Weight)) + (142_506_000 as Weight) + // Standard Error: 176_000 + .saturating_add((525_752_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_value_transferred(r: u32, ) -> Weight { - (137_318_000 as Weight) - // Standard Error: 77_000 - .saturating_add((239_623_000 as Weight).saturating_mul(r as Weight)) + (138_569_000 as Weight) + // Standard Error: 76_000 + .saturating_add((237_016_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_minimum_balance(r: u32, ) -> Weight { - (138_343_000 as Weight) - // Standard Error: 260_000 - .saturating_add((241_997_000 as Weight).saturating_mul(r as Weight)) + (134_713_000 as Weight) + // Standard Error: 81_000 + .saturating_add((237_962_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_tombstone_deposit(r: u32, ) -> Weight { - (138_989_000 as Weight) - // Standard Error: 77_000 - .saturating_add((239_424_000 as Weight).saturating_mul(r as Weight)) + (131_523_000 as Weight) + // Standard Error: 90_000 + .saturating_add((237_435_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_rent_allowance(r: u32, ) -> Weight { - (140_118_000 as Weight) - // Standard Error: 83_000 - .saturating_add((240_866_000 as Weight).saturating_mul(r as Weight)) + (141_574_000 as Weight) + // Standard Error: 86_000 + .saturating_add((238_102_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_block_number(r: u32, ) -> Weight { - (139_962_000 as Weight) - // Standard Error: 69_000 - .saturating_add((239_267_000 as Weight).saturating_mul(r as Weight)) + (140_240_000 as Weight) + // Standard Error: 101_000 + .saturating_add((236_568_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_now(r: u32, ) -> Weight { - (139_652_000 as Weight) - // Standard Error: 69_000 - .saturating_add((240_282_000 as Weight).saturating_mul(r as Weight)) + (138_265_000 as Weight) + // Standard Error: 91_000 + .saturating_add((237_187_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_rent_params(r: u32, ) -> Weight { - (136_806_000 as Weight) - // Standard Error: 104_000 - .saturating_add((359_911_000 as Weight).saturating_mul(r as Weight)) + (149_701_000 as Weight) + // Standard Error: 297_000 + .saturating_add((357_149_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn seal_rent_status(r: u32, ) -> Weight { + (146_863_000 as Weight) + // Standard Error: 191_000 + .saturating_add((638_683_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_weight_to_fee(r: u32, ) -> Weight { - (148_086_000 as Weight) - // Standard Error: 116_000 - .saturating_add((470_271_000 as Weight).saturating_mul(r as Weight)) + (144_278_000 as Weight) + // Standard Error: 149_000 + .saturating_add((470_264_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_gas(r: u32, ) -> Weight { - (123_560_000 as Weight) - // Standard Error: 295_000 - .saturating_add((119_119_000 as Weight).saturating_mul(r as Weight)) + (111_361_000 as Weight) + // Standard Error: 157_000 + .saturating_add((118_441_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_input(r: u32, ) -> Weight { - (132_420_000 as Weight) - // Standard Error: 83_000 - .saturating_add((6_835_000 as Weight).saturating_mul(r as Weight)) + (129_970_000 as Weight) + // Standard Error: 316_000 + .saturating_add((7_160_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_input_per_kb(n: u32, ) -> Weight { - (142_119_000 as Weight) + (139_275_000 as Weight) // Standard Error: 0 - .saturating_add((245_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((250_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_return(r: u32, ) -> Weight { - (121_030_000 as Weight) - // Standard Error: 68_000 - .saturating_add((4_444_000 as Weight).saturating_mul(r as Weight)) + (119_240_000 as Weight) + // Standard Error: 57_000 + .saturating_add((4_347_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_return_per_kb(n: u32, ) -> Weight { - (131_704_000 as Weight) + (128_896_000 as Weight) // Standard Error: 1_000 - .saturating_add((756_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((757_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_terminate(r: u32, ) -> Weight { - (132_544_000 as Weight) - // Standard Error: 113_000 - .saturating_add((97_343_000 as Weight).saturating_mul(r as Weight)) + (130_119_000 as Weight) + // Standard Error: 108_000 + .saturating_add((95_078_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(r as Weight))) } fn seal_terminate_per_code_kb(c: u32, ) -> Weight { - (234_751_000 as Weight) - // Standard Error: 3_000 - .saturating_add((8_482_000 as Weight).saturating_mul(c as Weight)) + (230_167_000 as Weight) + // Standard Error: 2_000 + .saturating_add((8_495_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(5 as Weight)) } fn seal_restore_to(r: u32, ) -> Weight { - (156_439_000 as Weight) - // Standard Error: 1_068_000 - .saturating_add((96_724_000 as Weight).saturating_mul(r as Weight)) + (159_200_000 as Weight) + // Standard Error: 261_000 + .saturating_add((103_048_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(r as Weight))) } fn seal_restore_to_per_code_kb_delta(c: u32, t: u32, d: u32, ) -> Weight { - (101_920_000 as Weight) - // Standard Error: 162_000 - .saturating_add((7_588_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 162_000 - .saturating_add((3_475_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 1_431_000 - .saturating_add((3_733_137_000 as Weight).saturating_mul(d as Weight)) + (58_389_000 as Weight) + // Standard Error: 131_000 + .saturating_add((7_910_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 131_000 + .saturating_add((4_036_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 1_156_000 + .saturating_add((3_714_110_000 as Weight).saturating_mul(d as Weight)) .saturating_add(T::DbWeight::get().reads(7 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(d as Weight))) .saturating_add(T::DbWeight::get().writes(7 as Weight)) .saturating_add(T::DbWeight::get().writes((100 as Weight).saturating_mul(d as Weight))) } fn seal_random(r: u32, ) -> Weight { - (151_598_000 as Weight) - // Standard Error: 168_000 - .saturating_add((608_967_000 as Weight).saturating_mul(r as Weight)) + (138_794_000 as Weight) + // Standard Error: 216_000 + .saturating_add((599_742_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_deposit_event(r: u32, ) -> Weight { - (149_224_000 as Weight) - // Standard Error: 205_000 - .saturating_add((896_074_000 as Weight).saturating_mul(r as Weight)) + (139_890_000 as Weight) + // Standard Error: 263_000 + .saturating_add((885_805_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (1_198_650_000 as Weight) - // Standard Error: 2_742_000 - .saturating_add((566_152_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 540_000 - .saturating_add((248_898_000 as Weight).saturating_mul(n as Weight)) + (1_117_962_000 as Weight) + // Standard Error: 4_029_000 + .saturating_add((566_825_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 794_000 + .saturating_add((251_096_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(t as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((100 as Weight).saturating_mul(t as Weight))) } fn seal_set_rent_allowance(r: u32, ) -> Weight { - (133_149_000 as Weight) - // Standard Error: 72_000 - .saturating_add((163_281_000 as Weight).saturating_mul(r as Weight)) + (132_720_000 as Weight) + // Standard Error: 87_000 + .saturating_add((164_134_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_debug_message(r: u32, ) -> Weight { - (126_413_000 as Weight) - // Standard Error: 127_000 - .saturating_add((128_176_000 as Weight).saturating_mul(r as Weight)) + (125_834_000 as Weight) + // Standard Error: 142_000 + .saturating_add((127_200_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_set_storage(r: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 1_710_000 - .saturating_add((3_933_779_000 as Weight).saturating_mul(r as Weight)) + (478_734_000 as Weight) + // Standard Error: 2_559_000 + .saturating_add((3_766_445_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((100 as Weight).saturating_mul(r as Weight))) } fn seal_set_storage_per_kb(n: u32, ) -> Weight { - (582_721_000 as Weight) - // Standard Error: 228_000 - .saturating_add((71_341_000 as Weight).saturating_mul(n as Weight)) + (600_306_000 as Weight) + // Standard Error: 234_000 + .saturating_add((70_989_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn seal_clear_storage(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 2_470_000 - .saturating_add((1_281_241_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 2_380_000 + .saturating_add((1_242_131_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((100 as Weight).saturating_mul(r as Weight))) } fn seal_get_storage(r: u32, ) -> Weight { - (11_848_000 as Weight) - // Standard Error: 1_028_000 - .saturating_add((934_213_000 as Weight).saturating_mul(r as Weight)) + (0 as Weight) + // Standard Error: 1_060_000 + .saturating_add((910_861_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (602_494_000 as Weight) - // Standard Error: 255_000 - .saturating_add((152_885_000 as Weight).saturating_mul(n as Weight)) + (605_545_000 as Weight) + // Standard Error: 252_000 + .saturating_add((153_519_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_transfer(r: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 1_746_000 - .saturating_add((5_264_601_000 as Weight).saturating_mul(r as Weight)) + (36_854_000 as Weight) + // Standard Error: 2_076_000 + .saturating_add((5_183_774_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) @@ -457,662 +465,669 @@ impl WeightInfo for SubstrateWeight { } fn seal_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 13_325_000 - .saturating_add((11_706_784_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 6_583_000 + .saturating_add((11_599_057_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((200 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(1 as Weight)) .saturating_add(T::DbWeight::get().writes((100 as Weight).saturating_mul(r as Weight))) } fn seal_call_per_code_transfer_input_output_kb(c: u32, t: u32, i: u32, o: u32, ) -> Weight { - (9_518_851_000 as Weight) - // Standard Error: 349_000 - .saturating_add((391_414_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 145_480_000 - .saturating_add((4_113_632_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 46_000 - .saturating_add((60_888_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 49_000 - .saturating_add((79_489_000 as Weight).saturating_mul(o as Weight)) + (10_431_738_000 as Weight) + // Standard Error: 301_000 + .saturating_add((392_174_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 125_400_000 + .saturating_add((3_698_896_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 39_000 + .saturating_add((60_692_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 42_000 + .saturating_add((78_872_000 as Weight).saturating_mul(o as Weight)) .saturating_add(T::DbWeight::get().reads(205 as Weight)) .saturating_add(T::DbWeight::get().writes(101 as Weight)) .saturating_add(T::DbWeight::get().writes((101 as Weight).saturating_mul(t as Weight))) } fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 39_418_000 - .saturating_add((21_356_322_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 32_118_000 + .saturating_add((21_117_947_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().reads((300 as Weight).saturating_mul(r as Weight))) .saturating_add(T::DbWeight::get().writes(3 as Weight)) .saturating_add(T::DbWeight::get().writes((300 as Weight).saturating_mul(r as Weight))) } fn seal_instantiate_per_code_input_output_salt_kb(c: u32, i: u32, o: u32, s: u32, ) -> Weight { - (12_419_243_000 as Weight) - // Standard Error: 1_454_000 - .saturating_add((848_075_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 206_000 - .saturating_add((61_500_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 206_000 - .saturating_add((82_895_000 as Weight).saturating_mul(o as Weight)) - // Standard Error: 206_000 - .saturating_add((236_893_000 as Weight).saturating_mul(s as Weight)) + (8_542_521_000 as Weight) + // Standard Error: 644_000 + .saturating_add((878_020_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 91_000 + .saturating_add((63_004_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 91_000 + .saturating_add((83_203_000 as Weight).saturating_mul(o as Weight)) + // Standard Error: 91_000 + .saturating_add((240_170_000 as Weight).saturating_mul(s as Weight)) .saturating_add(T::DbWeight::get().reads(206 as Weight)) .saturating_add(T::DbWeight::get().writes(204 as Weight)) } fn seal_hash_sha2_256(r: u32, ) -> Weight { - (129_427_000 as Weight) - // Standard Error: 110_000 - .saturating_add((227_721_000 as Weight).saturating_mul(r as Weight)) + (130_991_000 as Weight) + // Standard Error: 106_000 + .saturating_add((230_186_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 202_000 - .saturating_add((494_366_000 as Weight).saturating_mul(n as Weight)) + (508_089_000 as Weight) + // Standard Error: 38_000 + .saturating_add((491_916_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_hash_keccak_256(r: u32, ) -> Weight { - (133_222_000 as Weight) - // Standard Error: 330_000 - .saturating_add((237_008_000 as Weight).saturating_mul(r as Weight)) + (135_384_000 as Weight) + // Standard Error: 111_000 + .saturating_add((233_638_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (1_245_757_000 as Weight) - // Standard Error: 77_000 - .saturating_add((339_755_000 as Weight).saturating_mul(n as Weight)) + (445_961_000 as Weight) + // Standard Error: 29_000 + .saturating_add((340_992_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_hash_blake2_256(r: u32, ) -> Weight { - (133_091_000 as Weight) - // Standard Error: 126_000 - .saturating_add((208_234_000 as Weight).saturating_mul(r as Weight)) + (133_593_000 as Weight) + // Standard Error: 112_000 + .saturating_add((208_000_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (799_510_000 as Weight) - // Standard Error: 49_000 - .saturating_add((158_583_000 as Weight).saturating_mul(n as Weight)) + (444_562_000 as Weight) + // Standard Error: 27_000 + .saturating_add((159_521_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_hash_blake2_128(r: u32, ) -> Weight { - (130_180_000 as Weight) - // Standard Error: 83_000 - .saturating_add((206_505_000 as Weight).saturating_mul(r as Weight)) + (131_381_000 as Weight) + // Standard Error: 82_000 + .saturating_add((207_479_000 as Weight).saturating_mul(r as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (965_700_000 as Weight) - // Standard Error: 64_000 - .saturating_add((154_387_000 as Weight).saturating_mul(n as Weight)) + (576_129_000 as Weight) + // Standard Error: 49_000 + .saturating_add((156_900_000 as Weight).saturating_mul(n as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn instr_i64const(r: u32, ) -> Weight { - (20_233_000 as Weight) - // Standard Error: 21_000 - .saturating_add((3_445_000 as Weight).saturating_mul(r as Weight)) + (20_276_000 as Weight) + // Standard Error: 16_000 + .saturating_add((3_355_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64load(r: u32, ) -> Weight { - (29_798_000 as Weight) - // Standard Error: 1_137_000 - .saturating_add((137_787_000 as Weight).saturating_mul(r as Weight)) + (22_345_000 as Weight) + // Standard Error: 18_000 + .saturating_add((133_628_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64store(r: u32, ) -> Weight { - (22_914_000 as Weight) - // Standard Error: 701_000 - .saturating_add((205_918_000 as Weight).saturating_mul(r as Weight)) + (22_294_000 as Weight) + // Standard Error: 95_000 + .saturating_add((204_007_000 as Weight).saturating_mul(r as Weight)) } fn instr_select(r: u32, ) -> Weight { - (20_225_000 as Weight) - // Standard Error: 20_000 - .saturating_add((12_545_000 as Weight).saturating_mul(r as Weight)) + (20_266_000 as Weight) + // Standard Error: 25_000 + .saturating_add((12_605_000 as Weight).saturating_mul(r as Weight)) } fn instr_if(r: u32, ) -> Weight { - (20_196_000 as Weight) - // Standard Error: 19_000 - .saturating_add((12_677_000 as Weight).saturating_mul(r as Weight)) + (20_208_000 as Weight) + // Standard Error: 13_000 + .saturating_add((12_589_000 as Weight).saturating_mul(r as Weight)) } fn instr_br(r: u32, ) -> Weight { - (20_204_000 as Weight) - // Standard Error: 19_000 - .saturating_add((6_920_000 as Weight).saturating_mul(r as Weight)) + (20_227_000 as Weight) + // Standard Error: 18_000 + .saturating_add((6_429_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_if(r: u32, ) -> Weight { - (20_220_000 as Weight) - // Standard Error: 30_000 - .saturating_add((15_209_000 as Weight).saturating_mul(r as Weight)) + (20_279_000 as Weight) + // Standard Error: 15_000 + .saturating_add((14_560_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_table(r: u32, ) -> Weight { - (20_262_000 as Weight) - // Standard Error: 37_000 - .saturating_add((15_909_000 as Weight).saturating_mul(r as Weight)) + (20_210_000 as Weight) + // Standard Error: 16_000 + .saturating_add((15_613_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_table_per_entry(e: u32, ) -> Weight { - (35_644_000 as Weight) + (34_276_000 as Weight) // Standard Error: 0 - .saturating_add((82_000 as Weight).saturating_mul(e as Weight)) + .saturating_add((130_000 as Weight).saturating_mul(e as Weight)) } fn instr_call(r: u32, ) -> Weight { - (20_566_000 as Weight) - // Standard Error: 79_000 - .saturating_add((91_776_000 as Weight).saturating_mul(r as Weight)) + (20_426_000 as Weight) + // Standard Error: 69_000 + .saturating_add((91_850_000 as Weight).saturating_mul(r as Weight)) } fn instr_call_indirect(r: u32, ) -> Weight { - (28_243_000 as Weight) - // Standard Error: 207_000 - .saturating_add((169_342_000 as Weight).saturating_mul(r as Weight)) + (27_099_000 as Weight) + // Standard Error: 111_000 + .saturating_add((169_212_000 as Weight).saturating_mul(r as Weight)) } fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (206_233_000 as Weight) + (206_492_000 as Weight) // Standard Error: 4_000 .saturating_add((4_685_000 as Weight).saturating_mul(p as Weight)) } fn instr_local_get(r: u32, ) -> Weight { - (37_775_000 as Weight) - // Standard Error: 18_000 - .saturating_add((3_553_000 as Weight).saturating_mul(r as Weight)) + (37_892_000 as Weight) + // Standard Error: 24_000 + .saturating_add((3_510_000 as Weight).saturating_mul(r as Weight)) } fn instr_local_set(r: u32, ) -> Weight { - (37_836_000 as Weight) - // Standard Error: 19_000 - .saturating_add((3_745_000 as Weight).saturating_mul(r as Weight)) + (37_773_000 as Weight) + // Standard Error: 15_000 + .saturating_add((3_814_000 as Weight).saturating_mul(r as Weight)) } fn instr_local_tee(r: u32, ) -> Weight { - (37_816_000 as Weight) - // Standard Error: 21_000 - .saturating_add((4_929_000 as Weight).saturating_mul(r as Weight)) + (37_785_000 as Weight) + // Standard Error: 20_000 + .saturating_add((4_949_000 as Weight).saturating_mul(r as Weight)) } fn instr_global_get(r: u32, ) -> Weight { - (23_385_000 as Weight) - // Standard Error: 24_000 - .saturating_add((7_494_000 as Weight).saturating_mul(r as Weight)) + (23_467_000 as Weight) + // Standard Error: 25_000 + .saturating_add((7_493_000 as Weight).saturating_mul(r as Weight)) } fn instr_global_set(r: u32, ) -> Weight { - (23_334_000 as Weight) - // Standard Error: 24_000 - .saturating_add((8_306_000 as Weight).saturating_mul(r as Weight)) + (23_492_000 as Weight) + // Standard Error: 28_000 + .saturating_add((8_499_000 as Weight).saturating_mul(r as Weight)) } fn instr_memory_current(r: u32, ) -> Weight { - (22_311_000 as Weight) - // Standard Error: 27_000 - .saturating_add((3_548_000 as Weight).saturating_mul(r as Weight)) + (22_347_000 as Weight) + // Standard Error: 18_000 + .saturating_add((3_565_000 as Weight).saturating_mul(r as Weight)) } fn instr_memory_grow(r: u32, ) -> Weight { - (20_789_000 as Weight) - // Standard Error: 269_000 - .saturating_add((2_070_923_000 as Weight).saturating_mul(r as Weight)) + (20_849_000 as Weight) + // Standard Error: 2_751_000 + .saturating_add((2_072_517_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64clz(r: u32, ) -> Weight { - (20_196_000 as Weight) - // Standard Error: 20_000 - .saturating_add((5_132_000 as Weight).saturating_mul(r as Weight)) + (20_216_000 as Weight) + // Standard Error: 18_000 + .saturating_add((5_067_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ctz(r: u32, ) -> Weight { - (20_215_000 as Weight) - // Standard Error: 7_000 - .saturating_add((5_053_000 as Weight).saturating_mul(r as Weight)) + (20_218_000 as Weight) + // Standard Error: 11_000 + .saturating_add((5_015_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64popcnt(r: u32, ) -> Weight { - (20_257_000 as Weight) - // Standard Error: 22_000 - .saturating_add((5_891_000 as Weight).saturating_mul(r as Weight)) + (20_215_000 as Weight) + // Standard Error: 16_000 + .saturating_add((5_888_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64eqz(r: u32, ) -> Weight { - (20_263_000 as Weight) - // Standard Error: 13_000 - .saturating_add((5_438_000 as Weight).saturating_mul(r as Weight)) + (20_232_000 as Weight) + // Standard Error: 12_000 + .saturating_add((5_366_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64extendsi32(r: u32, ) -> Weight { - (20_214_000 as Weight) - // Standard Error: 12_000 - .saturating_add((4_882_000 as Weight).saturating_mul(r as Weight)) + (20_205_000 as Weight) + // Standard Error: 17_000 + .saturating_add((4_847_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64extendui32(r: u32, ) -> Weight { - (20_152_000 as Weight) - // Standard Error: 17_000 - .saturating_add((4_946_000 as Weight).saturating_mul(r as Weight)) + (20_181_000 as Weight) + // Standard Error: 12_000 + .saturating_add((4_849_000 as Weight).saturating_mul(r as Weight)) } fn instr_i32wrapi64(r: u32, ) -> Weight { - (20_216_000 as Weight) + (20_175_000 as Weight) // Standard Error: 18_000 - .saturating_add((4_974_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((4_981_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64eq(r: u32, ) -> Weight { - (20_195_000 as Weight) - // Standard Error: 16_000 - .saturating_add((7_463_000 as Weight).saturating_mul(r as Weight)) + (20_273_000 as Weight) + // Standard Error: 19_000 + .saturating_add((7_402_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ne(r: u32, ) -> Weight { - (20_170_000 as Weight) - // Standard Error: 23_000 - .saturating_add((7_425_000 as Weight).saturating_mul(r as Weight)) + (20_260_000 as Weight) + // Standard Error: 11_000 + .saturating_add((7_392_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64lts(r: u32, ) -> Weight { - (20_208_000 as Weight) - // Standard Error: 14_000 - .saturating_add((7_424_000 as Weight).saturating_mul(r as Weight)) + (20_248_000 as Weight) + // Standard Error: 11_000 + .saturating_add((7_363_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ltu(r: u32, ) -> Weight { - (20_244_000 as Weight) - // Standard Error: 19_000 - .saturating_add((7_391_000 as Weight).saturating_mul(r as Weight)) + (20_229_000 as Weight) + // Standard Error: 11_000 + .saturating_add((7_412_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64gts(r: u32, ) -> Weight { - (20_218_000 as Weight) - // Standard Error: 21_000 - .saturating_add((7_384_000 as Weight).saturating_mul(r as Weight)) + (20_232_000 as Weight) + // Standard Error: 9_000 + .saturating_add((7_364_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64gtu(r: u32, ) -> Weight { - (20_208_000 as Weight) - // Standard Error: 20_000 - .saturating_add((7_392_000 as Weight).saturating_mul(r as Weight)) + (20_252_000 as Weight) + // Standard Error: 19_000 + .saturating_add((7_383_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64les(r: u32, ) -> Weight { - (20_201_000 as Weight) - // Standard Error: 25_000 - .saturating_add((7_375_000 as Weight).saturating_mul(r as Weight)) + (20_258_000 as Weight) + // Standard Error: 16_000 + .saturating_add((7_359_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64leu(r: u32, ) -> Weight { - (20_213_000 as Weight) - // Standard Error: 16_000 - .saturating_add((7_460_000 as Weight).saturating_mul(r as Weight)) + (20_245_000 as Weight) + // Standard Error: 21_000 + .saturating_add((7_400_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ges(r: u32, ) -> Weight { - (20_141_000 as Weight) - // Standard Error: 23_000 - .saturating_add((7_498_000 as Weight).saturating_mul(r as Weight)) + (20_245_000 as Weight) + // Standard Error: 19_000 + .saturating_add((7_391_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64geu(r: u32, ) -> Weight { - (20_213_000 as Weight) - // Standard Error: 20_000 - .saturating_add((7_373_000 as Weight).saturating_mul(r as Weight)) + (20_230_000 as Weight) + // Standard Error: 15_000 + .saturating_add((7_439_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64add(r: u32, ) -> Weight { - (20_137_000 as Weight) - // Standard Error: 24_000 - .saturating_add((7_325_000 as Weight).saturating_mul(r as Weight)) + (20_254_000 as Weight) + // Standard Error: 16_000 + .saturating_add((7_204_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64sub(r: u32, ) -> Weight { - (20_148_000 as Weight) - // Standard Error: 23_000 - .saturating_add((7_389_000 as Weight).saturating_mul(r as Weight)) + (20_182_000 as Weight) + // Standard Error: 22_000 + .saturating_add((7_327_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64mul(r: u32, ) -> Weight { - (20_152_000 as Weight) - // Standard Error: 15_000 - .saturating_add((7_264_000 as Weight).saturating_mul(r as Weight)) + (20_203_000 as Weight) + // Standard Error: 20_000 + .saturating_add((7_221_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64divs(r: u32, ) -> Weight { - (20_153_000 as Weight) + (20_187_000 as Weight) // Standard Error: 16_000 - .saturating_add((13_755_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((13_738_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64divu(r: u32, ) -> Weight { - (20_135_000 as Weight) - // Standard Error: 19_000 - .saturating_add((12_845_000 as Weight).saturating_mul(r as Weight)) + (20_153_000 as Weight) + // Standard Error: 11_000 + .saturating_add((12_766_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rems(r: u32, ) -> Weight { - (20_203_000 as Weight) - // Standard Error: 16_000 - .saturating_add((13_792_000 as Weight).saturating_mul(r as Weight)) + (20_219_000 as Weight) + // Standard Error: 13_000 + .saturating_add((13_732_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64remu(r: u32, ) -> Weight { - (20_110_000 as Weight) - // Standard Error: 30_000 - .saturating_add((12_880_000 as Weight).saturating_mul(r as Weight)) + (20_246_000 as Weight) + // Standard Error: 16_000 + .saturating_add((12_686_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64and(r: u32, ) -> Weight { - (20_098_000 as Weight) - // Standard Error: 12_000 - .saturating_add((7_416_000 as Weight).saturating_mul(r as Weight)) + (20_228_000 as Weight) + // Standard Error: 13_000 + .saturating_add((7_245_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64or(r: u32, ) -> Weight { - (20_156_000 as Weight) + (20_238_000 as Weight) // Standard Error: 17_000 - .saturating_add((7_428_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((7_250_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64xor(r: u32, ) -> Weight { - (20_163_000 as Weight) - // Standard Error: 19_000 - .saturating_add((7_343_000 as Weight).saturating_mul(r as Weight)) + (20_213_000 as Weight) + // Standard Error: 10_000 + .saturating_add((7_292_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shl(r: u32, ) -> Weight { - (20_167_000 as Weight) - // Standard Error: 21_000 - .saturating_add((7_610_000 as Weight).saturating_mul(r as Weight)) + (20_224_000 as Weight) + // Standard Error: 18_000 + .saturating_add((7_554_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shrs(r: u32, ) -> Weight { - (20_192_000 as Weight) - // Standard Error: 21_000 - .saturating_add((7_660_000 as Weight).saturating_mul(r as Weight)) + (20_261_000 as Weight) + // Standard Error: 20_000 + .saturating_add((7_551_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shru(r: u32, ) -> Weight { - (20_162_000 as Weight) - // Standard Error: 26_000 - .saturating_add((7_652_000 as Weight).saturating_mul(r as Weight)) + (20_212_000 as Weight) + // Standard Error: 15_000 + .saturating_add((7_616_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rotl(r: u32, ) -> Weight { - (20_151_000 as Weight) - // Standard Error: 12_000 - .saturating_add((7_890_000 as Weight).saturating_mul(r as Weight)) + (20_176_000 as Weight) + // Standard Error: 9_000 + .saturating_add((7_877_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rotr(r: u32, ) -> Weight { - (20_154_000 as Weight) - // Standard Error: 20_000 - .saturating_add((7_434_000 as Weight).saturating_mul(r as Weight)) + (20_230_000 as Weight) + // Standard Error: 17_000 + .saturating_add((7_347_000 as Weight).saturating_mul(r as Weight)) } } // For backwards compatibility and tests impl WeightInfo for () { fn on_initialize() -> Weight { - (3_676_000 as Weight) + (3_656_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) } fn on_initialize_per_trie_key(k: u32, ) -> Weight { (0 as Weight) - // Standard Error: 2_000 - .saturating_add((2_259_000 as Weight).saturating_mul(k as Weight)) + // Standard Error: 3_000 + .saturating_add((2_241_000 as Weight).saturating_mul(k as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(k as Weight))) } fn on_initialize_per_queue_item(q: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 33_000 - .saturating_add((35_157_000 as Weight).saturating_mul(q as Weight)) + (36_820_000 as Weight) + // Standard Error: 4_000 + .saturating_add((34_550_000 as Weight).saturating_mul(q as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn instrument(c: u32, ) -> Weight { - (42_341_000 as Weight) - // Standard Error: 190_000 - .saturating_add((95_696_000 as Weight).saturating_mul(c as Weight)) + (42_348_000 as Weight) + // Standard Error: 185_000 + .saturating_add((95_664_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn instantiate_with_code(c: u32, s: u32, ) -> Weight { - (178_191_000 as Weight) - // Standard Error: 141_000 - .saturating_add((135_736_000 as Weight).saturating_mul(c as Weight)) + (210_852_000 as Weight) + // Standard Error: 138_000 + .saturating_add((135_241_000 as Weight).saturating_mul(c as Weight)) // Standard Error: 9_000 - .saturating_add((1_867_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_846_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } fn instantiate(c: u32, s: u32, ) -> Weight { - (183_874_000 as Weight) - // Standard Error: 11_000 - .saturating_add((8_659_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 1_000 - .saturating_add((1_781_000 as Weight).saturating_mul(s as Weight)) + (217_380_000 as Weight) + // Standard Error: 6_000 + .saturating_add((8_483_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 0 + .saturating_add((1_752_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn call(c: u32, ) -> Weight { - (186_051_000 as Weight) - // Standard Error: 1_000 - .saturating_add((3_919_000 as Weight).saturating_mul(c as Weight)) + (181_443_000 as Weight) + // Standard Error: 3_000 + .saturating_add((3_955_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } fn claim_surcharge(c: u32, ) -> Weight { - (133_967_000 as Weight) - // Standard Error: 2_000 - .saturating_add((4_733_000 as Weight).saturating_mul(c as Weight)) + (132_551_000 as Weight) + // Standard Error: 1_000 + .saturating_add((4_740_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } fn seal_caller(r: u32, ) -> Weight { - (131_758_000 as Weight) - // Standard Error: 361_000 - .saturating_add((249_131_000 as Weight).saturating_mul(r as Weight)) + (137_742_000 as Weight) + // Standard Error: 74_000 + .saturating_add((242_261_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_address(r: u32, ) -> Weight { - (141_100_000 as Weight) - // Standard Error: 73_000 - .saturating_add((245_593_000 as Weight).saturating_mul(r as Weight)) + (137_739_000 as Weight) + // Standard Error: 91_000 + .saturating_add((241_803_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_gas_left(r: u32, ) -> Weight { - (141_578_000 as Weight) - // Standard Error: 76_000 - .saturating_add((240_505_000 as Weight).saturating_mul(r as Weight)) + (139_631_000 as Weight) + // Standard Error: 83_000 + .saturating_add((236_790_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_balance(r: u32, ) -> Weight { - (144_329_000 as Weight) - // Standard Error: 197_000 - .saturating_add((529_903_000 as Weight).saturating_mul(r as Weight)) + (142_506_000 as Weight) + // Standard Error: 176_000 + .saturating_add((525_752_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_value_transferred(r: u32, ) -> Weight { - (137_318_000 as Weight) - // Standard Error: 77_000 - .saturating_add((239_623_000 as Weight).saturating_mul(r as Weight)) + (138_569_000 as Weight) + // Standard Error: 76_000 + .saturating_add((237_016_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_minimum_balance(r: u32, ) -> Weight { - (138_343_000 as Weight) - // Standard Error: 260_000 - .saturating_add((241_997_000 as Weight).saturating_mul(r as Weight)) + (134_713_000 as Weight) + // Standard Error: 81_000 + .saturating_add((237_962_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_tombstone_deposit(r: u32, ) -> Weight { - (138_989_000 as Weight) - // Standard Error: 77_000 - .saturating_add((239_424_000 as Weight).saturating_mul(r as Weight)) + (131_523_000 as Weight) + // Standard Error: 90_000 + .saturating_add((237_435_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_rent_allowance(r: u32, ) -> Weight { - (140_118_000 as Weight) - // Standard Error: 83_000 - .saturating_add((240_866_000 as Weight).saturating_mul(r as Weight)) + (141_574_000 as Weight) + // Standard Error: 86_000 + .saturating_add((238_102_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_block_number(r: u32, ) -> Weight { - (139_962_000 as Weight) - // Standard Error: 69_000 - .saturating_add((239_267_000 as Weight).saturating_mul(r as Weight)) + (140_240_000 as Weight) + // Standard Error: 101_000 + .saturating_add((236_568_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_now(r: u32, ) -> Weight { - (139_652_000 as Weight) - // Standard Error: 69_000 - .saturating_add((240_282_000 as Weight).saturating_mul(r as Weight)) + (138_265_000 as Weight) + // Standard Error: 91_000 + .saturating_add((237_187_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_rent_params(r: u32, ) -> Weight { - (136_806_000 as Weight) - // Standard Error: 104_000 - .saturating_add((359_911_000 as Weight).saturating_mul(r as Weight)) + (149_701_000 as Weight) + // Standard Error: 297_000 + .saturating_add((357_149_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn seal_rent_status(r: u32, ) -> Weight { + (146_863_000 as Weight) + // Standard Error: 191_000 + .saturating_add((638_683_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_weight_to_fee(r: u32, ) -> Weight { - (148_086_000 as Weight) - // Standard Error: 116_000 - .saturating_add((470_271_000 as Weight).saturating_mul(r as Weight)) + (144_278_000 as Weight) + // Standard Error: 149_000 + .saturating_add((470_264_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_gas(r: u32, ) -> Weight { - (123_560_000 as Weight) - // Standard Error: 295_000 - .saturating_add((119_119_000 as Weight).saturating_mul(r as Weight)) + (111_361_000 as Weight) + // Standard Error: 157_000 + .saturating_add((118_441_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_input(r: u32, ) -> Weight { - (132_420_000 as Weight) - // Standard Error: 83_000 - .saturating_add((6_835_000 as Weight).saturating_mul(r as Weight)) + (129_970_000 as Weight) + // Standard Error: 316_000 + .saturating_add((7_160_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_input_per_kb(n: u32, ) -> Weight { - (142_119_000 as Weight) + (139_275_000 as Weight) // Standard Error: 0 - .saturating_add((245_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((250_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_return(r: u32, ) -> Weight { - (121_030_000 as Weight) - // Standard Error: 68_000 - .saturating_add((4_444_000 as Weight).saturating_mul(r as Weight)) + (119_240_000 as Weight) + // Standard Error: 57_000 + .saturating_add((4_347_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_return_per_kb(n: u32, ) -> Weight { - (131_704_000 as Weight) + (128_896_000 as Weight) // Standard Error: 1_000 - .saturating_add((756_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((757_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_terminate(r: u32, ) -> Weight { - (132_544_000 as Weight) - // Standard Error: 113_000 - .saturating_add((97_343_000 as Weight).saturating_mul(r as Weight)) + (130_119_000 as Weight) + // Standard Error: 108_000 + .saturating_add((95_078_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(r as Weight))) } fn seal_terminate_per_code_kb(c: u32, ) -> Weight { - (234_751_000 as Weight) - // Standard Error: 3_000 - .saturating_add((8_482_000 as Weight).saturating_mul(c as Weight)) + (230_167_000 as Weight) + // Standard Error: 2_000 + .saturating_add((8_495_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } fn seal_restore_to(r: u32, ) -> Weight { - (156_439_000 as Weight) - // Standard Error: 1_068_000 - .saturating_add((96_724_000 as Weight).saturating_mul(r as Weight)) + (159_200_000 as Weight) + // Standard Error: 261_000 + .saturating_add((103_048_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(r as Weight))) } fn seal_restore_to_per_code_kb_delta(c: u32, t: u32, d: u32, ) -> Weight { - (101_920_000 as Weight) - // Standard Error: 162_000 - .saturating_add((7_588_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 162_000 - .saturating_add((3_475_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 1_431_000 - .saturating_add((3_733_137_000 as Weight).saturating_mul(d as Weight)) + (58_389_000 as Weight) + // Standard Error: 131_000 + .saturating_add((7_910_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 131_000 + .saturating_add((4_036_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 1_156_000 + .saturating_add((3_714_110_000 as Weight).saturating_mul(d as Weight)) .saturating_add(RocksDbWeight::get().reads(7 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(d as Weight))) .saturating_add(RocksDbWeight::get().writes(7 as Weight)) .saturating_add(RocksDbWeight::get().writes((100 as Weight).saturating_mul(d as Weight))) } fn seal_random(r: u32, ) -> Weight { - (151_598_000 as Weight) - // Standard Error: 168_000 - .saturating_add((608_967_000 as Weight).saturating_mul(r as Weight)) + (138_794_000 as Weight) + // Standard Error: 216_000 + .saturating_add((599_742_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_deposit_event(r: u32, ) -> Weight { - (149_224_000 as Weight) - // Standard Error: 205_000 - .saturating_add((896_074_000 as Weight).saturating_mul(r as Weight)) + (139_890_000 as Weight) + // Standard Error: 263_000 + .saturating_add((885_805_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32, ) -> Weight { - (1_198_650_000 as Weight) - // Standard Error: 2_742_000 - .saturating_add((566_152_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 540_000 - .saturating_add((248_898_000 as Weight).saturating_mul(n as Weight)) + (1_117_962_000 as Weight) + // Standard Error: 4_029_000 + .saturating_add((566_825_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 794_000 + .saturating_add((251_096_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(t as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((100 as Weight).saturating_mul(t as Weight))) } fn seal_set_rent_allowance(r: u32, ) -> Weight { - (133_149_000 as Weight) - // Standard Error: 72_000 - .saturating_add((163_281_000 as Weight).saturating_mul(r as Weight)) + (132_720_000 as Weight) + // Standard Error: 87_000 + .saturating_add((164_134_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_debug_message(r: u32, ) -> Weight { - (126_413_000 as Weight) - // Standard Error: 127_000 - .saturating_add((128_176_000 as Weight).saturating_mul(r as Weight)) + (125_834_000 as Weight) + // Standard Error: 142_000 + .saturating_add((127_200_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_set_storage(r: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 1_710_000 - .saturating_add((3_933_779_000 as Weight).saturating_mul(r as Weight)) + (478_734_000 as Weight) + // Standard Error: 2_559_000 + .saturating_add((3_766_445_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((100 as Weight).saturating_mul(r as Weight))) } fn seal_set_storage_per_kb(n: u32, ) -> Weight { - (582_721_000 as Weight) - // Standard Error: 228_000 - .saturating_add((71_341_000 as Weight).saturating_mul(n as Weight)) + (600_306_000 as Weight) + // Standard Error: 234_000 + .saturating_add((70_989_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } fn seal_clear_storage(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 2_470_000 - .saturating_add((1_281_241_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 2_380_000 + .saturating_add((1_242_131_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((100 as Weight).saturating_mul(r as Weight))) } fn seal_get_storage(r: u32, ) -> Weight { - (11_848_000 as Weight) - // Standard Error: 1_028_000 - .saturating_add((934_213_000 as Weight).saturating_mul(r as Weight)) + (0 as Weight) + // Standard Error: 1_060_000 + .saturating_add((910_861_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_get_storage_per_kb(n: u32, ) -> Weight { - (602_494_000 as Weight) - // Standard Error: 255_000 - .saturating_add((152_885_000 as Weight).saturating_mul(n as Weight)) + (605_545_000 as Weight) + // Standard Error: 252_000 + .saturating_add((153_519_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_transfer(r: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 1_746_000 - .saturating_add((5_264_601_000 as Weight).saturating_mul(r as Weight)) + (36_854_000 as Weight) + // Standard Error: 2_076_000 + .saturating_add((5_183_774_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().reads((100 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) @@ -1120,358 +1135,358 @@ impl WeightInfo for () { } fn seal_call(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 13_325_000 - .saturating_add((11_706_784_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 6_583_000 + .saturating_add((11_599_057_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((200 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((100 as Weight).saturating_mul(r as Weight))) } fn seal_call_per_code_transfer_input_output_kb(c: u32, t: u32, i: u32, o: u32, ) -> Weight { - (9_518_851_000 as Weight) - // Standard Error: 349_000 - .saturating_add((391_414_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 145_480_000 - .saturating_add((4_113_632_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 46_000 - .saturating_add((60_888_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 49_000 - .saturating_add((79_489_000 as Weight).saturating_mul(o as Weight)) + (10_431_738_000 as Weight) + // Standard Error: 301_000 + .saturating_add((392_174_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 125_400_000 + .saturating_add((3_698_896_000 as Weight).saturating_mul(t as Weight)) + // Standard Error: 39_000 + .saturating_add((60_692_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 42_000 + .saturating_add((78_872_000 as Weight).saturating_mul(o as Weight)) .saturating_add(RocksDbWeight::get().reads(205 as Weight)) .saturating_add(RocksDbWeight::get().writes(101 as Weight)) .saturating_add(RocksDbWeight::get().writes((101 as Weight).saturating_mul(t as Weight))) } fn seal_instantiate(r: u32, ) -> Weight { (0 as Weight) - // Standard Error: 39_418_000 - .saturating_add((21_356_322_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 32_118_000 + .saturating_add((21_117_947_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().reads((300 as Weight).saturating_mul(r as Weight))) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) .saturating_add(RocksDbWeight::get().writes((300 as Weight).saturating_mul(r as Weight))) } fn seal_instantiate_per_code_input_output_salt_kb(c: u32, i: u32, o: u32, s: u32, ) -> Weight { - (12_419_243_000 as Weight) - // Standard Error: 1_454_000 - .saturating_add((848_075_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 206_000 - .saturating_add((61_500_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 206_000 - .saturating_add((82_895_000 as Weight).saturating_mul(o as Weight)) - // Standard Error: 206_000 - .saturating_add((236_893_000 as Weight).saturating_mul(s as Weight)) + (8_542_521_000 as Weight) + // Standard Error: 644_000 + .saturating_add((878_020_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 91_000 + .saturating_add((63_004_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 91_000 + .saturating_add((83_203_000 as Weight).saturating_mul(o as Weight)) + // Standard Error: 91_000 + .saturating_add((240_170_000 as Weight).saturating_mul(s as Weight)) .saturating_add(RocksDbWeight::get().reads(206 as Weight)) .saturating_add(RocksDbWeight::get().writes(204 as Weight)) } fn seal_hash_sha2_256(r: u32, ) -> Weight { - (129_427_000 as Weight) - // Standard Error: 110_000 - .saturating_add((227_721_000 as Weight).saturating_mul(r as Weight)) + (130_991_000 as Weight) + // Standard Error: 106_000 + .saturating_add((230_186_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_hash_sha2_256_per_kb(n: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 202_000 - .saturating_add((494_366_000 as Weight).saturating_mul(n as Weight)) + (508_089_000 as Weight) + // Standard Error: 38_000 + .saturating_add((491_916_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_hash_keccak_256(r: u32, ) -> Weight { - (133_222_000 as Weight) - // Standard Error: 330_000 - .saturating_add((237_008_000 as Weight).saturating_mul(r as Weight)) + (135_384_000 as Weight) + // Standard Error: 111_000 + .saturating_add((233_638_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_hash_keccak_256_per_kb(n: u32, ) -> Weight { - (1_245_757_000 as Weight) - // Standard Error: 77_000 - .saturating_add((339_755_000 as Weight).saturating_mul(n as Weight)) + (445_961_000 as Weight) + // Standard Error: 29_000 + .saturating_add((340_992_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_hash_blake2_256(r: u32, ) -> Weight { - (133_091_000 as Weight) - // Standard Error: 126_000 - .saturating_add((208_234_000 as Weight).saturating_mul(r as Weight)) + (133_593_000 as Weight) + // Standard Error: 112_000 + .saturating_add((208_000_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_hash_blake2_256_per_kb(n: u32, ) -> Weight { - (799_510_000 as Weight) - // Standard Error: 49_000 - .saturating_add((158_583_000 as Weight).saturating_mul(n as Weight)) + (444_562_000 as Weight) + // Standard Error: 27_000 + .saturating_add((159_521_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_hash_blake2_128(r: u32, ) -> Weight { - (130_180_000 as Weight) - // Standard Error: 83_000 - .saturating_add((206_505_000 as Weight).saturating_mul(r as Weight)) + (131_381_000 as Weight) + // Standard Error: 82_000 + .saturating_add((207_479_000 as Weight).saturating_mul(r as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn seal_hash_blake2_128_per_kb(n: u32, ) -> Weight { - (965_700_000 as Weight) - // Standard Error: 64_000 - .saturating_add((154_387_000 as Weight).saturating_mul(n as Weight)) + (576_129_000 as Weight) + // Standard Error: 49_000 + .saturating_add((156_900_000 as Weight).saturating_mul(n as Weight)) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } fn instr_i64const(r: u32, ) -> Weight { - (20_233_000 as Weight) - // Standard Error: 21_000 - .saturating_add((3_445_000 as Weight).saturating_mul(r as Weight)) + (20_276_000 as Weight) + // Standard Error: 16_000 + .saturating_add((3_355_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64load(r: u32, ) -> Weight { - (29_798_000 as Weight) - // Standard Error: 1_137_000 - .saturating_add((137_787_000 as Weight).saturating_mul(r as Weight)) + (22_345_000 as Weight) + // Standard Error: 18_000 + .saturating_add((133_628_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64store(r: u32, ) -> Weight { - (22_914_000 as Weight) - // Standard Error: 701_000 - .saturating_add((205_918_000 as Weight).saturating_mul(r as Weight)) + (22_294_000 as Weight) + // Standard Error: 95_000 + .saturating_add((204_007_000 as Weight).saturating_mul(r as Weight)) } fn instr_select(r: u32, ) -> Weight { - (20_225_000 as Weight) - // Standard Error: 20_000 - .saturating_add((12_545_000 as Weight).saturating_mul(r as Weight)) + (20_266_000 as Weight) + // Standard Error: 25_000 + .saturating_add((12_605_000 as Weight).saturating_mul(r as Weight)) } fn instr_if(r: u32, ) -> Weight { - (20_196_000 as Weight) - // Standard Error: 19_000 - .saturating_add((12_677_000 as Weight).saturating_mul(r as Weight)) + (20_208_000 as Weight) + // Standard Error: 13_000 + .saturating_add((12_589_000 as Weight).saturating_mul(r as Weight)) } fn instr_br(r: u32, ) -> Weight { - (20_204_000 as Weight) - // Standard Error: 19_000 - .saturating_add((6_920_000 as Weight).saturating_mul(r as Weight)) + (20_227_000 as Weight) + // Standard Error: 18_000 + .saturating_add((6_429_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_if(r: u32, ) -> Weight { - (20_220_000 as Weight) - // Standard Error: 30_000 - .saturating_add((15_209_000 as Weight).saturating_mul(r as Weight)) + (20_279_000 as Weight) + // Standard Error: 15_000 + .saturating_add((14_560_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_table(r: u32, ) -> Weight { - (20_262_000 as Weight) - // Standard Error: 37_000 - .saturating_add((15_909_000 as Weight).saturating_mul(r as Weight)) + (20_210_000 as Weight) + // Standard Error: 16_000 + .saturating_add((15_613_000 as Weight).saturating_mul(r as Weight)) } fn instr_br_table_per_entry(e: u32, ) -> Weight { - (35_644_000 as Weight) + (34_276_000 as Weight) // Standard Error: 0 - .saturating_add((82_000 as Weight).saturating_mul(e as Weight)) + .saturating_add((130_000 as Weight).saturating_mul(e as Weight)) } fn instr_call(r: u32, ) -> Weight { - (20_566_000 as Weight) - // Standard Error: 79_000 - .saturating_add((91_776_000 as Weight).saturating_mul(r as Weight)) + (20_426_000 as Weight) + // Standard Error: 69_000 + .saturating_add((91_850_000 as Weight).saturating_mul(r as Weight)) } fn instr_call_indirect(r: u32, ) -> Weight { - (28_243_000 as Weight) - // Standard Error: 207_000 - .saturating_add((169_342_000 as Weight).saturating_mul(r as Weight)) + (27_099_000 as Weight) + // Standard Error: 111_000 + .saturating_add((169_212_000 as Weight).saturating_mul(r as Weight)) } fn instr_call_indirect_per_param(p: u32, ) -> Weight { - (206_233_000 as Weight) + (206_492_000 as Weight) // Standard Error: 4_000 .saturating_add((4_685_000 as Weight).saturating_mul(p as Weight)) } fn instr_local_get(r: u32, ) -> Weight { - (37_775_000 as Weight) - // Standard Error: 18_000 - .saturating_add((3_553_000 as Weight).saturating_mul(r as Weight)) + (37_892_000 as Weight) + // Standard Error: 24_000 + .saturating_add((3_510_000 as Weight).saturating_mul(r as Weight)) } fn instr_local_set(r: u32, ) -> Weight { - (37_836_000 as Weight) - // Standard Error: 19_000 - .saturating_add((3_745_000 as Weight).saturating_mul(r as Weight)) + (37_773_000 as Weight) + // Standard Error: 15_000 + .saturating_add((3_814_000 as Weight).saturating_mul(r as Weight)) } fn instr_local_tee(r: u32, ) -> Weight { - (37_816_000 as Weight) - // Standard Error: 21_000 - .saturating_add((4_929_000 as Weight).saturating_mul(r as Weight)) + (37_785_000 as Weight) + // Standard Error: 20_000 + .saturating_add((4_949_000 as Weight).saturating_mul(r as Weight)) } fn instr_global_get(r: u32, ) -> Weight { - (23_385_000 as Weight) - // Standard Error: 24_000 - .saturating_add((7_494_000 as Weight).saturating_mul(r as Weight)) + (23_467_000 as Weight) + // Standard Error: 25_000 + .saturating_add((7_493_000 as Weight).saturating_mul(r as Weight)) } fn instr_global_set(r: u32, ) -> Weight { - (23_334_000 as Weight) - // Standard Error: 24_000 - .saturating_add((8_306_000 as Weight).saturating_mul(r as Weight)) + (23_492_000 as Weight) + // Standard Error: 28_000 + .saturating_add((8_499_000 as Weight).saturating_mul(r as Weight)) } fn instr_memory_current(r: u32, ) -> Weight { - (22_311_000 as Weight) - // Standard Error: 27_000 - .saturating_add((3_548_000 as Weight).saturating_mul(r as Weight)) + (22_347_000 as Weight) + // Standard Error: 18_000 + .saturating_add((3_565_000 as Weight).saturating_mul(r as Weight)) } fn instr_memory_grow(r: u32, ) -> Weight { - (20_789_000 as Weight) - // Standard Error: 269_000 - .saturating_add((2_070_923_000 as Weight).saturating_mul(r as Weight)) + (20_849_000 as Weight) + // Standard Error: 2_751_000 + .saturating_add((2_072_517_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64clz(r: u32, ) -> Weight { - (20_196_000 as Weight) - // Standard Error: 20_000 - .saturating_add((5_132_000 as Weight).saturating_mul(r as Weight)) + (20_216_000 as Weight) + // Standard Error: 18_000 + .saturating_add((5_067_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ctz(r: u32, ) -> Weight { - (20_215_000 as Weight) - // Standard Error: 7_000 - .saturating_add((5_053_000 as Weight).saturating_mul(r as Weight)) + (20_218_000 as Weight) + // Standard Error: 11_000 + .saturating_add((5_015_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64popcnt(r: u32, ) -> Weight { - (20_257_000 as Weight) - // Standard Error: 22_000 - .saturating_add((5_891_000 as Weight).saturating_mul(r as Weight)) + (20_215_000 as Weight) + // Standard Error: 16_000 + .saturating_add((5_888_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64eqz(r: u32, ) -> Weight { - (20_263_000 as Weight) - // Standard Error: 13_000 - .saturating_add((5_438_000 as Weight).saturating_mul(r as Weight)) + (20_232_000 as Weight) + // Standard Error: 12_000 + .saturating_add((5_366_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64extendsi32(r: u32, ) -> Weight { - (20_214_000 as Weight) - // Standard Error: 12_000 - .saturating_add((4_882_000 as Weight).saturating_mul(r as Weight)) + (20_205_000 as Weight) + // Standard Error: 17_000 + .saturating_add((4_847_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64extendui32(r: u32, ) -> Weight { - (20_152_000 as Weight) - // Standard Error: 17_000 - .saturating_add((4_946_000 as Weight).saturating_mul(r as Weight)) + (20_181_000 as Weight) + // Standard Error: 12_000 + .saturating_add((4_849_000 as Weight).saturating_mul(r as Weight)) } fn instr_i32wrapi64(r: u32, ) -> Weight { - (20_216_000 as Weight) + (20_175_000 as Weight) // Standard Error: 18_000 - .saturating_add((4_974_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((4_981_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64eq(r: u32, ) -> Weight { - (20_195_000 as Weight) - // Standard Error: 16_000 - .saturating_add((7_463_000 as Weight).saturating_mul(r as Weight)) + (20_273_000 as Weight) + // Standard Error: 19_000 + .saturating_add((7_402_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ne(r: u32, ) -> Weight { - (20_170_000 as Weight) - // Standard Error: 23_000 - .saturating_add((7_425_000 as Weight).saturating_mul(r as Weight)) + (20_260_000 as Weight) + // Standard Error: 11_000 + .saturating_add((7_392_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64lts(r: u32, ) -> Weight { - (20_208_000 as Weight) - // Standard Error: 14_000 - .saturating_add((7_424_000 as Weight).saturating_mul(r as Weight)) + (20_248_000 as Weight) + // Standard Error: 11_000 + .saturating_add((7_363_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ltu(r: u32, ) -> Weight { - (20_244_000 as Weight) - // Standard Error: 19_000 - .saturating_add((7_391_000 as Weight).saturating_mul(r as Weight)) + (20_229_000 as Weight) + // Standard Error: 11_000 + .saturating_add((7_412_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64gts(r: u32, ) -> Weight { - (20_218_000 as Weight) - // Standard Error: 21_000 - .saturating_add((7_384_000 as Weight).saturating_mul(r as Weight)) + (20_232_000 as Weight) + // Standard Error: 9_000 + .saturating_add((7_364_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64gtu(r: u32, ) -> Weight { - (20_208_000 as Weight) - // Standard Error: 20_000 - .saturating_add((7_392_000 as Weight).saturating_mul(r as Weight)) + (20_252_000 as Weight) + // Standard Error: 19_000 + .saturating_add((7_383_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64les(r: u32, ) -> Weight { - (20_201_000 as Weight) - // Standard Error: 25_000 - .saturating_add((7_375_000 as Weight).saturating_mul(r as Weight)) + (20_258_000 as Weight) + // Standard Error: 16_000 + .saturating_add((7_359_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64leu(r: u32, ) -> Weight { - (20_213_000 as Weight) - // Standard Error: 16_000 - .saturating_add((7_460_000 as Weight).saturating_mul(r as Weight)) + (20_245_000 as Weight) + // Standard Error: 21_000 + .saturating_add((7_400_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64ges(r: u32, ) -> Weight { - (20_141_000 as Weight) - // Standard Error: 23_000 - .saturating_add((7_498_000 as Weight).saturating_mul(r as Weight)) + (20_245_000 as Weight) + // Standard Error: 19_000 + .saturating_add((7_391_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64geu(r: u32, ) -> Weight { - (20_213_000 as Weight) - // Standard Error: 20_000 - .saturating_add((7_373_000 as Weight).saturating_mul(r as Weight)) + (20_230_000 as Weight) + // Standard Error: 15_000 + .saturating_add((7_439_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64add(r: u32, ) -> Weight { - (20_137_000 as Weight) - // Standard Error: 24_000 - .saturating_add((7_325_000 as Weight).saturating_mul(r as Weight)) + (20_254_000 as Weight) + // Standard Error: 16_000 + .saturating_add((7_204_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64sub(r: u32, ) -> Weight { - (20_148_000 as Weight) - // Standard Error: 23_000 - .saturating_add((7_389_000 as Weight).saturating_mul(r as Weight)) + (20_182_000 as Weight) + // Standard Error: 22_000 + .saturating_add((7_327_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64mul(r: u32, ) -> Weight { - (20_152_000 as Weight) - // Standard Error: 15_000 - .saturating_add((7_264_000 as Weight).saturating_mul(r as Weight)) + (20_203_000 as Weight) + // Standard Error: 20_000 + .saturating_add((7_221_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64divs(r: u32, ) -> Weight { - (20_153_000 as Weight) + (20_187_000 as Weight) // Standard Error: 16_000 - .saturating_add((13_755_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((13_738_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64divu(r: u32, ) -> Weight { - (20_135_000 as Weight) - // Standard Error: 19_000 - .saturating_add((12_845_000 as Weight).saturating_mul(r as Weight)) + (20_153_000 as Weight) + // Standard Error: 11_000 + .saturating_add((12_766_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rems(r: u32, ) -> Weight { - (20_203_000 as Weight) - // Standard Error: 16_000 - .saturating_add((13_792_000 as Weight).saturating_mul(r as Weight)) + (20_219_000 as Weight) + // Standard Error: 13_000 + .saturating_add((13_732_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64remu(r: u32, ) -> Weight { - (20_110_000 as Weight) - // Standard Error: 30_000 - .saturating_add((12_880_000 as Weight).saturating_mul(r as Weight)) + (20_246_000 as Weight) + // Standard Error: 16_000 + .saturating_add((12_686_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64and(r: u32, ) -> Weight { - (20_098_000 as Weight) - // Standard Error: 12_000 - .saturating_add((7_416_000 as Weight).saturating_mul(r as Weight)) + (20_228_000 as Weight) + // Standard Error: 13_000 + .saturating_add((7_245_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64or(r: u32, ) -> Weight { - (20_156_000 as Weight) + (20_238_000 as Weight) // Standard Error: 17_000 - .saturating_add((7_428_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((7_250_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64xor(r: u32, ) -> Weight { - (20_163_000 as Weight) - // Standard Error: 19_000 - .saturating_add((7_343_000 as Weight).saturating_mul(r as Weight)) + (20_213_000 as Weight) + // Standard Error: 10_000 + .saturating_add((7_292_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shl(r: u32, ) -> Weight { - (20_167_000 as Weight) - // Standard Error: 21_000 - .saturating_add((7_610_000 as Weight).saturating_mul(r as Weight)) + (20_224_000 as Weight) + // Standard Error: 18_000 + .saturating_add((7_554_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shrs(r: u32, ) -> Weight { - (20_192_000 as Weight) - // Standard Error: 21_000 - .saturating_add((7_660_000 as Weight).saturating_mul(r as Weight)) + (20_261_000 as Weight) + // Standard Error: 20_000 + .saturating_add((7_551_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64shru(r: u32, ) -> Weight { - (20_162_000 as Weight) - // Standard Error: 26_000 - .saturating_add((7_652_000 as Weight).saturating_mul(r as Weight)) + (20_212_000 as Weight) + // Standard Error: 15_000 + .saturating_add((7_616_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rotl(r: u32, ) -> Weight { - (20_151_000 as Weight) - // Standard Error: 12_000 - .saturating_add((7_890_000 as Weight).saturating_mul(r as Weight)) + (20_176_000 as Weight) + // Standard Error: 9_000 + .saturating_add((7_877_000 as Weight).saturating_mul(r as Weight)) } fn instr_i64rotr(r: u32, ) -> Weight { - (20_154_000 as Weight) - // Standard Error: 20_000 - .saturating_add((7_434_000 as Weight).saturating_mul(r as Weight)) + (20_230_000 as Weight) + // Standard Error: 17_000 + .saturating_add((7_347_000 as Weight).saturating_mul(r as Weight)) } }